filters.texi 860 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. A special syntax implemented in the @command{ffmpeg} CLI tool allows loading
  138. option values from files. This is done be prepending a slash '/' to the option
  139. name, then the supplied value is interpreted as a path from which the actual
  140. value is loaded. E.g.
  141. @example
  142. ffmpeg -i <INPUT> -vf drawtext=/text=/tmp/some_text <OUTPUT>
  143. @end example
  144. will load the text to be drawn from @file{/tmp/some_text}. API users wishing to
  145. implement a similar feature should use the @code{avfilter_graph_segment_*()}
  146. functions together with custom IO code.
  147. The name and arguments of the filter are optionally preceded and
  148. followed by a list of link labels.
  149. A link label allows one to name a link and associate it to a filter output
  150. or input pad. The preceding labels @var{in_link_1}
  151. ... @var{in_link_N}, are associated to the filter input pads,
  152. the following labels @var{out_link_1} ... @var{out_link_M}, are
  153. associated to the output pads.
  154. When two link labels with the same name are found in the
  155. filtergraph, a link between the corresponding input and output pad is
  156. created.
  157. If an output pad is not labelled, it is linked by default to the first
  158. unlabelled input pad of the next filter in the filterchain.
  159. For example in the filterchain
  160. @example
  161. nullsrc, split[L1], [L2]overlay, nullsink
  162. @end example
  163. the split filter instance has two output pads, and the overlay filter
  164. instance two input pads. The first output pad of split is labelled
  165. "L1", the first input pad of overlay is labelled "L2", and the second
  166. output pad of split is linked to the second input pad of overlay,
  167. which are both unlabelled.
  168. In a filter description, if the input label of the first filter is not
  169. specified, "in" is assumed; if the output label of the last filter is not
  170. specified, "out" is assumed.
  171. In a complete filterchain all the unlabelled filter input and output
  172. pads must be connected. A filtergraph is considered valid if all the
  173. filter input and output pads of all the filterchains are connected.
  174. Leading and trailing whitespaces (space, tabs, or line feeds) separating tokens
  175. in the filtergraph specification are ignored. This means that the filtergraph
  176. can be expressed using empty lines and spaces to improve redability.
  177. For example, the filtergraph:
  178. @example
  179. testsrc,split[L1],hflip[L2];[L1][L2] hstack
  180. @end example
  181. can be represented as:
  182. @example
  183. testsrc,
  184. split [L1], hflip [L2];
  185. [L1][L2] hstack
  186. @end example
  187. Libavfilter will automatically insert @ref{scale} filters where format
  188. conversion is required. It is possible to specify swscale flags
  189. for those automatically inserted scalers by prepending
  190. @code{sws_flags=@var{flags};}
  191. to the filtergraph description.
  192. Here is a BNF description of the filtergraph syntax:
  193. @example
  194. @var{NAME} ::= sequence of alphanumeric characters and '_'
  195. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  196. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  197. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  198. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  199. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  200. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  201. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  202. @end example
  203. @anchor{filtergraph escaping}
  204. @section Notes on filtergraph escaping
  205. Filtergraph description composition entails several levels of
  206. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  207. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  208. information about the employed escaping procedure.
  209. A first level escaping affects the content of each filter option
  210. value, which may contain the special character @code{:} used to
  211. separate values, or one of the escaping characters @code{\'}.
  212. A second level escaping affects the whole filter description, which
  213. may contain the escaping characters @code{\'} or the special
  214. characters @code{[],;} used by the filtergraph description.
  215. Finally, when you specify a filtergraph on a shell commandline, you
  216. need to perform a third level escaping for the shell special
  217. characters contained within it.
  218. For example, consider the following string to be embedded in
  219. the @ref{drawtext} filter description @option{text} value:
  220. @example
  221. this is a 'string': may contain one, or more, special characters
  222. @end example
  223. This string contains the @code{'} special escaping character, and the
  224. @code{:} special character, so it needs to be escaped in this way:
  225. @example
  226. text=this is a \'string\'\: may contain one, or more, special characters
  227. @end example
  228. A second level of escaping is required when embedding the filter
  229. description in a filtergraph description, in order to escape all the
  230. filtergraph special characters. Thus the example above becomes:
  231. @example
  232. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  233. @end example
  234. (note that in addition to the @code{\'} escaping special characters,
  235. also @code{,} needs to be escaped).
  236. Finally an additional level of escaping is needed when writing the
  237. filtergraph description in a shell command, which depends on the
  238. escaping rules of the adopted shell. For example, assuming that
  239. @code{\} is special and needs to be escaped with another @code{\}, the
  240. previous string will finally result in:
  241. @example
  242. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  243. @end example
  244. In order to avoid cumbersome escaping when using a commandline tool accepting a
  245. filter specification as input, it is advisable to avoid direct inclusion of the
  246. filter or options specification in the shell.
  247. For example, in case of the @ref{drawtext,,drawtext filter}, you might prefer to
  248. use the @option{textfile} option in place of @option{text} to specify the text
  249. to render.
  250. When using the @command{ffmpeg} tool, you might consider to use the
  251. @ref{filter_script option,,-filter_script option,ffmpeg} or
  252. @ref{filter_complex_script option,,-filter_complex_script option,ffmpeg}.
  253. @chapter Timeline editing
  254. Some filters support a generic @option{enable} option. For the filters
  255. supporting timeline editing, this option can be set to an expression which is
  256. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  257. the filter will be enabled, otherwise the frame will be sent unchanged to the
  258. next filter in the filtergraph.
  259. The expression accepts the following values:
  260. @table @samp
  261. @item t
  262. timestamp expressed in seconds, NAN if the input timestamp is unknown
  263. @item n
  264. sequential number of the input frame, starting from 0
  265. @item pos
  266. the position in the file of the input frame, NAN if unknown; deprecated, do
  267. not use
  268. @item w
  269. @item h
  270. width and height of the input frame if video
  271. @end table
  272. Additionally, these filters support an @option{enable} command that can be used
  273. to re-define the expression.
  274. Like any other filtering option, the @option{enable} option follows the same
  275. rules.
  276. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  277. minutes, and a @ref{curves} filter starting at 3 seconds:
  278. @example
  279. smartblur = enable='between(t,10,3*60)',
  280. curves = enable='gte(t,3)' : preset=cross_process
  281. @end example
  282. See @code{ffmpeg -filters} to view which filters have timeline support.
  283. @c man end FILTERGRAPH DESCRIPTION
  284. @anchor{commands}
  285. @chapter Changing options at runtime with a command
  286. Some options can be changed during the operation of the filter using
  287. a command. These options are marked 'T' on the output of
  288. @command{ffmpeg} @option{-h filter=<name of filter>}.
  289. The name of the command is the name of the option and the argument is
  290. the new value.
  291. @anchor{framesync}
  292. @chapter Options for filters with several inputs (framesync)
  293. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  294. Some filters with several inputs support a common set of options.
  295. These options can only be set by name, not with the short notation.
  296. @table @option
  297. @item eof_action
  298. The action to take when EOF is encountered on the secondary input; it accepts
  299. one of the following values:
  300. @table @option
  301. @item repeat
  302. Repeat the last frame (the default).
  303. @item endall
  304. End both streams.
  305. @item pass
  306. Pass the main input through.
  307. @end table
  308. @item shortest
  309. If set to 1, force the output to terminate when the shortest input
  310. terminates. Default value is 0.
  311. @item repeatlast
  312. If set to 1, force the filter to extend the last frame of secondary streams
  313. until the end of the primary stream. A value of 0 disables this behavior.
  314. Default value is 1.
  315. @item ts_sync_mode
  316. How strictly to sync streams based on secondary input timestamps; it accepts
  317. one of the following values:
  318. @table @option
  319. @item default
  320. Frame from secondary input with the nearest lower or equal timestamp to the
  321. primary input frame.
  322. @item nearest
  323. Frame from secondary input with the absolute nearest timestamp to the primary
  324. input frame.
  325. @end table
  326. @end table
  327. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  328. @chapter Audio Filters
  329. @c man begin AUDIO FILTERS
  330. When you configure your FFmpeg build, you can disable any of the
  331. existing filters using @code{--disable-filters}.
  332. The configure output will show the audio filters included in your
  333. build.
  334. Below is a description of the currently available audio filters.
  335. @section acompressor
  336. A compressor is mainly used to reduce the dynamic range of a signal.
  337. Especially modern music is mostly compressed at a high ratio to
  338. improve the overall loudness. It's done to get the highest attention
  339. of a listener, "fatten" the sound and bring more "power" to the track.
  340. If a signal is compressed too much it may sound dull or "dead"
  341. afterwards or it may start to "pump" (which could be a powerful effect
  342. but can also destroy a track completely).
  343. The right compression is the key to reach a professional sound and is
  344. the high art of mixing and mastering. Because of its complex settings
  345. it may take a long time to get the right feeling for this kind of effect.
  346. Compression is done by detecting the volume above a chosen level
  347. @code{threshold} and dividing it by the factor set with @code{ratio}.
  348. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  349. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  350. the signal would cause distortion of the waveform the reduction can be
  351. levelled over the time. This is done by setting "Attack" and "Release".
  352. @code{attack} determines how long the signal has to rise above the threshold
  353. before any reduction will occur and @code{release} sets the time the signal
  354. has to fall below the threshold to reduce the reduction again. Shorter signals
  355. than the chosen attack time will be left untouched.
  356. The overall reduction of the signal can be made up afterwards with the
  357. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  358. raising the makeup to this level results in a signal twice as loud than the
  359. source. To gain a softer entry in the compression the @code{knee} flattens the
  360. hard edge at the threshold in the range of the chosen decibels.
  361. The filter accepts the following options:
  362. @table @option
  363. @item level_in
  364. Set input gain. Default is 1. Range is between 0.015625 and 64.
  365. @item mode
  366. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  367. Default is @code{downward}.
  368. @item threshold
  369. If a signal of stream rises above this level it will affect the gain
  370. reduction.
  371. By default it is 0.125. Range is between 0.00097563 and 1.
  372. @item ratio
  373. Set a ratio by which the signal is reduced. 1:2 means that if the level
  374. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  375. Default is 2. Range is between 1 and 20.
  376. @item attack
  377. Amount of milliseconds the signal has to rise above the threshold before gain
  378. reduction starts. Default is 20. Range is between 0.01 and 2000.
  379. @item release
  380. Amount of milliseconds the signal has to fall below the threshold before
  381. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  382. @item makeup
  383. Set the amount by how much signal will be amplified after processing.
  384. Default is 1. Range is from 1 to 64.
  385. @item knee
  386. Curve the sharp knee around the threshold to enter gain reduction more softly.
  387. Default is 2.82843. Range is between 1 and 8.
  388. @item link
  389. Choose if the @code{average} level between all channels of input stream
  390. or the louder(@code{maximum}) channel of input stream affects the
  391. reduction. Default is @code{average}.
  392. @item detection
  393. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  394. of @code{rms}. Default is @code{rms} which is mostly smoother.
  395. @item mix
  396. How much to use compressed signal in output. Default is 1.
  397. Range is between 0 and 1.
  398. @end table
  399. @subsection Commands
  400. This filter supports the all above options as @ref{commands}.
  401. @section acontrast
  402. Simple audio dynamic range compression/expansion filter.
  403. The filter accepts the following options:
  404. @table @option
  405. @item contrast
  406. Set contrast. Default is 33. Allowed range is between 0 and 100.
  407. @end table
  408. @section acopy
  409. Copy the input audio source unchanged to the output. This is mainly useful for
  410. testing purposes.
  411. @section acrossfade
  412. Apply cross fade from one input audio stream to another input audio stream.
  413. The cross fade is applied for specified duration near the end of first stream.
  414. The filter accepts the following options:
  415. @table @option
  416. @item nb_samples, ns
  417. Specify the number of samples for which the cross fade effect has to last.
  418. At the end of the cross fade effect the first input audio will be completely
  419. silent. Default is 44100.
  420. @item duration, d
  421. Specify the duration of the cross fade effect. See
  422. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  423. for the accepted syntax.
  424. By default the duration is determined by @var{nb_samples}.
  425. If set this option is used instead of @var{nb_samples}.
  426. @item overlap, o
  427. Should first stream end overlap with second stream start. Default is enabled.
  428. @item curve1
  429. Set curve for cross fade transition for first stream.
  430. @item curve2
  431. Set curve for cross fade transition for second stream.
  432. For description of available curve types see @ref{afade} filter description.
  433. @end table
  434. @subsection Examples
  435. @itemize
  436. @item
  437. Cross fade from one input to another:
  438. @example
  439. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  440. @end example
  441. @item
  442. Cross fade from one input to another but without overlapping:
  443. @example
  444. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  445. @end example
  446. @end itemize
  447. @section acrossover
  448. Split audio stream into several bands.
  449. This filter splits audio stream into two or more frequency ranges.
  450. Summing all streams back will give flat output.
  451. The filter accepts the following options:
  452. @table @option
  453. @item split
  454. Set split frequencies. Those must be positive and increasing.
  455. @item order
  456. Set filter order for each band split. This controls filter roll-off or steepness
  457. of filter transfer function.
  458. Available values are:
  459. @table @samp
  460. @item 2nd
  461. 12 dB per octave.
  462. @item 4th
  463. 24 dB per octave.
  464. @item 6th
  465. 36 dB per octave.
  466. @item 8th
  467. 48 dB per octave.
  468. @item 10th
  469. 60 dB per octave.
  470. @item 12th
  471. 72 dB per octave.
  472. @item 14th
  473. 84 dB per octave.
  474. @item 16th
  475. 96 dB per octave.
  476. @item 18th
  477. 108 dB per octave.
  478. @item 20th
  479. 120 dB per octave.
  480. @end table
  481. Default is @var{4th}.
  482. @item level
  483. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  484. @item gains
  485. Set output gain for each band. Default value is 1 for all bands.
  486. @item precision
  487. Set which precision to use when processing samples.
  488. @table @option
  489. @item auto
  490. Auto pick internal sample format depending on other filters.
  491. @item float
  492. Always use single-floating point precision sample format.
  493. @item double
  494. Always use double-floating point precision sample format.
  495. @end table
  496. Default value is @code{auto}.
  497. @end table
  498. @subsection Examples
  499. @itemize
  500. @item
  501. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  502. each band will be in separate stream:
  503. @example
  504. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  505. @end example
  506. @item
  507. Same as above, but with higher filter order:
  508. @example
  509. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  510. @end example
  511. @item
  512. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  513. @example
  514. 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
  515. @end example
  516. @end itemize
  517. @section acrusher
  518. Reduce audio bit resolution.
  519. This filter is bit crusher with enhanced functionality. A bit crusher
  520. is used to audibly reduce number of bits an audio signal is sampled
  521. with. This doesn't change the bit depth at all, it just produces the
  522. effect. Material reduced in bit depth sounds more harsh and "digital".
  523. This filter is able to even round to continuous values instead of discrete
  524. bit depths.
  525. Additionally it has a D/C offset which results in different crushing of
  526. the lower and the upper half of the signal.
  527. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  528. Another feature of this filter is the logarithmic mode.
  529. This setting switches from linear distances between bits to logarithmic ones.
  530. The result is a much more "natural" sounding crusher which doesn't gate low
  531. signals for example. The human ear has a logarithmic perception,
  532. so this kind of crushing is much more pleasant.
  533. Logarithmic crushing is also able to get anti-aliased.
  534. The filter accepts the following options:
  535. @table @option
  536. @item level_in
  537. Set level in.
  538. @item level_out
  539. Set level out.
  540. @item bits
  541. Set bit reduction.
  542. @item mix
  543. Set mixing amount.
  544. @item mode
  545. Can be linear: @code{lin} or logarithmic: @code{log}.
  546. @item dc
  547. Set DC.
  548. @item aa
  549. Set anti-aliasing.
  550. @item samples
  551. Set sample reduction.
  552. @item lfo
  553. Enable LFO. By default disabled.
  554. @item lforange
  555. Set LFO range.
  556. @item lforate
  557. Set LFO rate.
  558. @end table
  559. @subsection Commands
  560. This filter supports the all above options as @ref{commands}.
  561. @section acue
  562. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  563. filter.
  564. @section adeclick
  565. Remove impulsive noise from input audio.
  566. Samples detected as impulsive noise are replaced by interpolated samples using
  567. autoregressive modelling.
  568. @table @option
  569. @item window, w
  570. Set window size, in milliseconds. Allowed range is from @code{10} to
  571. @code{100}. Default value is @code{55} milliseconds.
  572. This sets size of window which will be processed at once.
  573. @item overlap, o
  574. Set window overlap, in percentage of window size. Allowed range is from
  575. @code{50} to @code{95}. Default value is @code{75} percent.
  576. Setting this to a very high value increases impulsive noise removal but makes
  577. whole process much slower.
  578. @item arorder, a
  579. Set autoregression order, in percentage of window size. Allowed range is from
  580. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  581. controls quality of interpolated samples using neighbour good samples.
  582. @item threshold, t
  583. Set threshold value. Allowed range is from @code{1} to @code{100}.
  584. Default value is @code{2}.
  585. This controls the strength of impulsive noise which is going to be removed.
  586. The lower value, the more samples will be detected as impulsive noise.
  587. @item burst, b
  588. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  589. @code{10}. Default value is @code{2}.
  590. If any two samples detected as noise are spaced less than this value then any
  591. sample between those two samples will be also detected as noise.
  592. @item method, m
  593. Set overlap method.
  594. It accepts the following values:
  595. @table @option
  596. @item add, a
  597. Select overlap-add method. Even not interpolated samples are slightly
  598. changed with this method.
  599. @item save, s
  600. Select overlap-save method. Not interpolated samples remain unchanged.
  601. @end table
  602. Default value is @code{a}.
  603. @end table
  604. @section adeclip
  605. Remove clipped samples from input audio.
  606. Samples detected as clipped are replaced by interpolated samples using
  607. autoregressive modelling.
  608. @table @option
  609. @item window, w
  610. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  611. Default value is @code{55} milliseconds.
  612. This sets size of window which will be processed at once.
  613. @item overlap, o
  614. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  615. to @code{95}. Default value is @code{75} percent.
  616. @item arorder, a
  617. Set autoregression order, in percentage of window size. Allowed range is from
  618. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  619. quality of interpolated samples using neighbour good samples.
  620. @item threshold, t
  621. Set threshold value. Allowed range is from @code{1} to @code{100}.
  622. Default value is @code{10}. Higher values make clip detection less aggressive.
  623. @item hsize, n
  624. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  625. Default value is @code{1000}. Higher values make clip detection less aggressive.
  626. @item method, m
  627. Set overlap method.
  628. It accepts the following values:
  629. @table @option
  630. @item add, a
  631. Select overlap-add method. Even not interpolated samples are slightly changed
  632. with this method.
  633. @item save, s
  634. Select overlap-save method. Not interpolated samples remain unchanged.
  635. @end table
  636. Default value is @code{a}.
  637. @end table
  638. @section adecorrelate
  639. Apply decorrelation to input audio stream.
  640. The filter accepts the following options:
  641. @table @option
  642. @item stages
  643. Set decorrelation stages of filtering. Allowed
  644. range is from 1 to 16. Default value is 6.
  645. @item seed
  646. Set random seed used for setting delay in samples across channels.
  647. @end table
  648. @section adelay
  649. Delay one or more audio channels.
  650. Samples in delayed channel are filled with silence.
  651. The filter accepts the following option:
  652. @table @option
  653. @item delays
  654. Set list of delays in milliseconds for each channel separated by '|'.
  655. Unused delays will be silently ignored. If number of given delays is
  656. smaller than number of channels all remaining channels will not be delayed.
  657. If you want to delay exact number of samples, append 'S' to number.
  658. If you want instead to delay in seconds, append 's' to number.
  659. @item all
  660. Use last set delay for all remaining channels. By default is disabled.
  661. This option if enabled changes how option @code{delays} is interpreted.
  662. @end table
  663. @subsection Examples
  664. @itemize
  665. @item
  666. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  667. the second channel (and any other channels that may be present) unchanged.
  668. @example
  669. adelay=1500|0|500
  670. @end example
  671. @item
  672. Delay second channel by 500 samples, the third channel by 700 samples and leave
  673. the first channel (and any other channels that may be present) unchanged.
  674. @example
  675. adelay=0|500S|700S
  676. @end example
  677. @item
  678. Delay all channels by same number of samples:
  679. @example
  680. adelay=delays=64S:all=1
  681. @end example
  682. @end itemize
  683. @section adenorm
  684. Remedy denormals in audio by adding extremely low-level noise.
  685. This filter shall be placed before any filter that can produce denormals.
  686. A description of the accepted parameters follows.
  687. @table @option
  688. @item level
  689. Set level of added noise in dB. Default is @code{-351}.
  690. Allowed range is from -451 to -90.
  691. @item type
  692. Set type of added noise.
  693. @table @option
  694. @item dc
  695. Add DC signal.
  696. @item ac
  697. Add AC signal.
  698. @item square
  699. Add square signal.
  700. @item pulse
  701. Add pulse signal.
  702. @end table
  703. Default is @code{dc}.
  704. @end table
  705. @subsection Commands
  706. This filter supports the all above options as @ref{commands}.
  707. @section aderivative, aintegral
  708. Compute derivative/integral of audio stream.
  709. Applying both filters one after another produces original audio.
  710. @section adrc
  711. Apply spectral dynamic range controller filter to input audio stream.
  712. A description of the accepted options follows.
  713. @table @option
  714. @item transfer
  715. Set the transfer expression.
  716. The expression can contain the following constants:
  717. @table @option
  718. @item ch
  719. current channel number
  720. @item sn
  721. current sample number
  722. @item nb_channels
  723. number of channels
  724. @item t
  725. timestamp expressed in seconds
  726. @item sr
  727. sample rate
  728. @item p
  729. current frequency power value, in dB
  730. @item f
  731. current frequency in Hz
  732. @end table
  733. Default value is @code{p}.
  734. @item attack
  735. Set the attack in milliseconds. Default is @code{50} milliseconds.
  736. Allowed range is from 1 to 1000 milliseconds.
  737. @item release
  738. Set the release in milliseconds. Default is @code{100} milliseconds.
  739. Allowed range is from 5 to 2000 milliseconds.
  740. @item channels
  741. Set which channels to filter, by default @code{all} channels in audio stream are filtered.
  742. @end table
  743. @subsection Commands
  744. This filter supports the all above options as @ref{commands}.
  745. @subsection Examples
  746. @itemize
  747. @item
  748. Apply spectral compression to all frequencies with threshold of -50 dB and 1:6 ratio:
  749. @example
  750. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/6,p)':attack=50:release=100
  751. @end example
  752. @item
  753. Similar to above but with 1:2 ratio and filtering only front center channel:
  754. @example
  755. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/2,p)':attack=50:release=100:channels=FC
  756. @end example
  757. @item
  758. Apply spectral noise gate to all frequencies with threshold of -85 dB and with short attack time and short release time:
  759. @example
  760. adrc=transfer='if(lte(p,-85),p-800,p)':attack=1:release=5
  761. @end example
  762. @item
  763. Apply spectral expansion to all frequencies with threshold of -10 dB and 1:2 ratio:
  764. @example
  765. adrc=transfer='if(lt(p,-10),-10+(p-(-10))*2,p)':attack=50:release=100
  766. @end example
  767. @item
  768. Apply limiter to max -60 dB to all frequencies, with attack of 2 ms and release of 10 ms:
  769. @example
  770. adrc=transfer='min(p,-60)':attack=2:release=10
  771. @end example
  772. @end itemize
  773. @section adynamicequalizer
  774. Apply dynamic equalization to input audio stream.
  775. A description of the accepted options follows.
  776. @table @option
  777. @item threshold
  778. Set the detection threshold used to trigger equalization.
  779. Threshold detection is using detection filter.
  780. Default value is 0. Allowed range is from 0 to 100.
  781. @item dfrequency
  782. Set the detection frequency in Hz used for detection filter used to trigger equalization.
  783. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  784. @item dqfactor
  785. Set the detection resonance factor for detection filter used to trigger equalization.
  786. Default value is 1. Allowed range is from 0.001 to 1000.
  787. @item tfrequency
  788. Set the target frequency of equalization filter.
  789. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  790. @item tqfactor
  791. Set the target resonance factor for target equalization filter.
  792. Default value is 1. Allowed range is from 0.001 to 1000.
  793. @item attack
  794. Set the amount of milliseconds the signal from detection has to rise above
  795. the detection threshold before equalization starts.
  796. Default is 20. Allowed range is between 1 and 2000.
  797. @item release
  798. Set the amount of milliseconds the signal from detection has to fall below the
  799. detection threshold before equalization ends.
  800. Default is 200. Allowed range is between 1 and 2000.
  801. @item ratio
  802. Set the ratio by which the equalization gain is raised.
  803. Default is 1. Allowed range is between 0 and 30.
  804. @item makeup
  805. Set the makeup offset by which the equalization gain is raised.
  806. Default is 0. Allowed range is between 0 and 100.
  807. @item range
  808. Set the max allowed cut/boost amount. Default is 50.
  809. Allowed range is from 1 to 200.
  810. @item mode
  811. Set the mode of filter operation, can be one of the following:
  812. @table @samp
  813. @item listen
  814. Output only isolated detection signal.
  815. @item cutbelow
  816. Cut frequencies below detection threshold.
  817. @item cutabove
  818. Cut frequencies above detection threshold.
  819. @item boostbelow
  820. Boost frequencies below detection threshold.
  821. @item boostabove
  822. Boost frequencies above detection threshold.
  823. @end table
  824. Default mode is @samp{cutbelow}.
  825. @item dftype
  826. Set the type of detection filter, can be one of the following:
  827. @table @samp
  828. @item bandpass
  829. @item lowpass
  830. @item highpass
  831. @item peak
  832. @end table
  833. Default type is @samp{bandpass}.
  834. @item tftype
  835. Set the type of target filter, can be one of the following:
  836. @table @samp
  837. @item bell
  838. @item lowshelf
  839. @item highshelf
  840. @end table
  841. Default type is @samp{bell}.
  842. @item auto
  843. Automatically gather threshold from detection filter. By default
  844. is @samp{disabled}.
  845. This option is useful to detect threshold in certain time frame of
  846. input audio stream, in such case option value is changed at runtime.
  847. Available values are:
  848. @table @samp
  849. @item disabled
  850. Disable using automatically gathered threshold value.
  851. @item off
  852. Stop picking threshold value.
  853. @item on
  854. Start picking threshold value.
  855. @item adaptive
  856. Adaptively pick threshold value, by calculating sliding window entropy.
  857. @end table
  858. @item precision
  859. Set which precision to use when processing samples.
  860. @table @option
  861. @item auto
  862. Auto pick internal sample format depending on other filters.
  863. @item float
  864. Always use single-floating point precision sample format.
  865. @item double
  866. Always use double-floating point precision sample format.
  867. @end table
  868. @end table
  869. @subsection Commands
  870. This filter supports the all above options as @ref{commands}.
  871. @section adynamicsmooth
  872. Apply dynamic smoothing to input audio stream.
  873. A description of the accepted options follows.
  874. @table @option
  875. @item sensitivity
  876. Set an amount of sensitivity to frequency fluctations. Default is 2.
  877. Allowed range is from 0 to 1e+06.
  878. @item basefreq
  879. Set a base frequency for smoothing. Default value is 22050.
  880. Allowed range is from 2 to 1e+06.
  881. @end table
  882. @subsection Commands
  883. This filter supports the all above options as @ref{commands}.
  884. @section aecho
  885. Apply echoing to the input audio.
  886. Echoes are reflected sound and can occur naturally amongst mountains
  887. (and sometimes large buildings) when talking or shouting; digital echo
  888. effects emulate this behaviour and are often used to help fill out the
  889. sound of a single instrument or vocal. The time difference between the
  890. original signal and the reflection is the @code{delay}, and the
  891. loudness of the reflected signal is the @code{decay}.
  892. Multiple echoes can have different delays and decays.
  893. A description of the accepted parameters follows.
  894. @table @option
  895. @item in_gain
  896. Set input gain of reflected signal. Default is @code{0.6}.
  897. @item out_gain
  898. Set output gain of reflected signal. Default is @code{0.3}.
  899. @item delays
  900. Set list of time intervals in milliseconds between original signal and reflections
  901. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  902. Default is @code{1000}.
  903. @item decays
  904. Set list of loudness of reflected signals separated by '|'.
  905. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  906. Default is @code{0.5}.
  907. @end table
  908. @subsection Examples
  909. @itemize
  910. @item
  911. Make it sound as if there are twice as many instruments as are actually playing:
  912. @example
  913. aecho=0.8:0.88:60:0.4
  914. @end example
  915. @item
  916. If delay is very short, then it sounds like a (metallic) robot playing music:
  917. @example
  918. aecho=0.8:0.88:6:0.4
  919. @end example
  920. @item
  921. A longer delay will sound like an open air concert in the mountains:
  922. @example
  923. aecho=0.8:0.9:1000:0.3
  924. @end example
  925. @item
  926. Same as above but with one more mountain:
  927. @example
  928. aecho=0.8:0.9:1000|1800:0.3|0.25
  929. @end example
  930. @end itemize
  931. @section aemphasis
  932. Audio emphasis filter creates or restores material directly taken from LPs or
  933. emphased CDs with different filter curves. E.g. to store music on vinyl the
  934. signal has to be altered by a filter first to even out the disadvantages of
  935. this recording medium.
  936. Once the material is played back the inverse filter has to be applied to
  937. restore the distortion of the frequency response.
  938. The filter accepts the following options:
  939. @table @option
  940. @item level_in
  941. Set input gain.
  942. @item level_out
  943. Set output gain.
  944. @item mode
  945. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  946. use @code{production} mode. Default is @code{reproduction} mode.
  947. @item type
  948. Set filter type. Selects medium. Can be one of the following:
  949. @table @option
  950. @item col
  951. select Columbia.
  952. @item emi
  953. select EMI.
  954. @item bsi
  955. select BSI (78RPM).
  956. @item riaa
  957. select RIAA.
  958. @item cd
  959. select Compact Disc (CD).
  960. @item 50fm
  961. select 50µs (FM).
  962. @item 75fm
  963. select 75µs (FM).
  964. @item 50kf
  965. select 50µs (FM-KF).
  966. @item 75kf
  967. select 75µs (FM-KF).
  968. @end table
  969. @end table
  970. @subsection Commands
  971. This filter supports the all above options as @ref{commands}.
  972. @section aeval
  973. Modify an audio signal according to the specified expressions.
  974. This filter accepts one or more expressions (one for each channel),
  975. which are evaluated and used to modify a corresponding audio signal.
  976. It accepts the following parameters:
  977. @table @option
  978. @item exprs
  979. Set the '|'-separated expressions list for each separate channel. If
  980. the number of input channels is greater than the number of
  981. expressions, the last specified expression is used for the remaining
  982. output channels.
  983. @item channel_layout, c
  984. Set output channel layout. If not specified, the channel layout is
  985. specified by the number of expressions. If set to @samp{same}, it will
  986. use by default the same input channel layout.
  987. @end table
  988. Each expression in @var{exprs} can contain the following constants and functions:
  989. @table @option
  990. @item ch
  991. channel number of the current expression
  992. @item n
  993. number of the evaluated sample, starting from 0
  994. @item s
  995. sample rate
  996. @item t
  997. time of the evaluated sample expressed in seconds
  998. @item nb_in_channels
  999. @item nb_out_channels
  1000. input and output number of channels
  1001. @item val(CH)
  1002. the value of input channel with number @var{CH}
  1003. @end table
  1004. Note: this filter is slow. For faster processing you should use a
  1005. dedicated filter.
  1006. @subsection Examples
  1007. @itemize
  1008. @item
  1009. Half volume:
  1010. @example
  1011. aeval=val(ch)/2:c=same
  1012. @end example
  1013. @item
  1014. Invert phase of the second channel:
  1015. @example
  1016. aeval=val(0)|-val(1)
  1017. @end example
  1018. @end itemize
  1019. @section aexciter
  1020. An exciter is used to produce high sound that is not present in the
  1021. original signal. This is done by creating harmonic distortions of the
  1022. signal which are restricted in range and added to the original signal.
  1023. An Exciter raises the upper end of an audio signal without simply raising
  1024. the higher frequencies like an equalizer would do to create a more
  1025. "crisp" or "brilliant" sound.
  1026. The filter accepts the following options:
  1027. @table @option
  1028. @item level_in
  1029. Set input level prior processing of signal.
  1030. Allowed range is from 0 to 64.
  1031. Default value is 1.
  1032. @item level_out
  1033. Set output level after processing of signal.
  1034. Allowed range is from 0 to 64.
  1035. Default value is 1.
  1036. @item amount
  1037. Set the amount of harmonics added to original signal.
  1038. Allowed range is from 0 to 64.
  1039. Default value is 1.
  1040. @item drive
  1041. Set the amount of newly created harmonics.
  1042. Allowed range is from 0.1 to 10.
  1043. Default value is 8.5.
  1044. @item blend
  1045. Set the octave of newly created harmonics.
  1046. Allowed range is from -10 to 10.
  1047. Default value is 0.
  1048. @item freq
  1049. Set the lower frequency limit of producing harmonics in Hz.
  1050. Allowed range is from 2000 to 12000 Hz.
  1051. Default is 7500 Hz.
  1052. @item ceil
  1053. Set the upper frequency limit of producing harmonics.
  1054. Allowed range is from 9999 to 20000 Hz.
  1055. If value is lower than 10000 Hz no limit is applied.
  1056. @item listen
  1057. Mute the original signal and output only added harmonics.
  1058. By default is disabled.
  1059. @end table
  1060. @subsection Commands
  1061. This filter supports the all above options as @ref{commands}.
  1062. @anchor{afade}
  1063. @section afade
  1064. Apply fade-in/out effect to input audio.
  1065. A description of the accepted parameters follows.
  1066. @table @option
  1067. @item type, t
  1068. Specify the effect type, can be either @code{in} for fade-in, or
  1069. @code{out} for a fade-out effect. Default is @code{in}.
  1070. @item start_sample, ss
  1071. Specify the number of the start sample for starting to apply the fade
  1072. effect. Default is 0.
  1073. @item nb_samples, ns
  1074. Specify the number of samples for which the fade effect has to last. At
  1075. the end of the fade-in effect the output audio will have the same
  1076. volume as the input audio, at the end of the fade-out transition
  1077. the output audio will be silence. Default is 44100.
  1078. @item start_time, st
  1079. Specify the start time of the fade effect. Default is 0.
  1080. The value must be specified as a time duration; see
  1081. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1082. for the accepted syntax.
  1083. If set this option is used instead of @var{start_sample}.
  1084. @item duration, d
  1085. Specify the duration of the fade effect. See
  1086. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1087. for the accepted syntax.
  1088. At the end of the fade-in effect the output audio will have the same
  1089. volume as the input audio, at the end of the fade-out transition
  1090. the output audio will be silence.
  1091. By default the duration is determined by @var{nb_samples}.
  1092. If set this option is used instead of @var{nb_samples}.
  1093. @item curve
  1094. Set curve for fade transition.
  1095. It accepts the following values:
  1096. @table @option
  1097. @item tri
  1098. select triangular, linear slope (default)
  1099. @item qsin
  1100. select quarter of sine wave
  1101. @item hsin
  1102. select half of sine wave
  1103. @item esin
  1104. select exponential sine wave
  1105. @item log
  1106. select logarithmic
  1107. @item ipar
  1108. select inverted parabola
  1109. @item qua
  1110. select quadratic
  1111. @item cub
  1112. select cubic
  1113. @item squ
  1114. select square root
  1115. @item cbr
  1116. select cubic root
  1117. @item par
  1118. select parabola
  1119. @item exp
  1120. select exponential
  1121. @item iqsin
  1122. select inverted quarter of sine wave
  1123. @item ihsin
  1124. select inverted half of sine wave
  1125. @item dese
  1126. select double-exponential seat
  1127. @item desi
  1128. select double-exponential sigmoid
  1129. @item losi
  1130. select logistic sigmoid
  1131. @item sinc
  1132. select sine cardinal function
  1133. @item isinc
  1134. select inverted sine cardinal function
  1135. @item quat
  1136. select quartic
  1137. @item quatr
  1138. select quartic root
  1139. @item qsin2
  1140. select squared quarter of sine wave
  1141. @item hsin2
  1142. select squared half of sine wave
  1143. @item nofade
  1144. no fade applied
  1145. @end table
  1146. @item silence
  1147. Set the initial gain for fade-in or final gain for fade-out.
  1148. Default value is @code{0.0}.
  1149. @item unity
  1150. Set the initial gain for fade-out or final gain for fade-in.
  1151. Default value is @code{1.0}.
  1152. @end table
  1153. @subsection Commands
  1154. This filter supports the all above options as @ref{commands}.
  1155. @subsection Examples
  1156. @itemize
  1157. @item
  1158. Fade in first 15 seconds of audio:
  1159. @example
  1160. afade=t=in:ss=0:d=15
  1161. @end example
  1162. @item
  1163. Fade out last 25 seconds of a 900 seconds audio:
  1164. @example
  1165. afade=t=out:st=875:d=25
  1166. @end example
  1167. @end itemize
  1168. @section afftdn
  1169. Denoise audio samples with FFT.
  1170. A description of the accepted parameters follows.
  1171. @table @option
  1172. @item noise_reduction, nr
  1173. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1174. Default value is 12 dB.
  1175. @item noise_floor, nf
  1176. Set the noise floor in dB, allowed range is -80 to -20.
  1177. Default value is -50 dB.
  1178. @item noise_type, nt
  1179. Set the noise type.
  1180. It accepts the following values:
  1181. @table @option
  1182. @item white, w
  1183. Select white noise.
  1184. @item vinyl, v
  1185. Select vinyl noise.
  1186. @item shellac, s
  1187. Select shellac noise.
  1188. @item custom, c
  1189. Select custom noise, defined in @code{bn} option.
  1190. Default value is white noise.
  1191. @end table
  1192. @item band_noise, bn
  1193. Set custom band noise profile for every one of 15 bands.
  1194. Bands are separated by ' ' or '|'.
  1195. @item residual_floor, rf
  1196. Set the residual floor in dB, allowed range is -80 to -20.
  1197. Default value is -38 dB.
  1198. @item track_noise, tn
  1199. Enable noise floor tracking. By default is disabled.
  1200. With this enabled, noise floor is automatically adjusted.
  1201. @item track_residual, tr
  1202. Enable residual tracking. By default is disabled.
  1203. @item output_mode, om
  1204. Set the output mode.
  1205. It accepts the following values:
  1206. @table @option
  1207. @item input, i
  1208. Pass input unchanged.
  1209. @item output, o
  1210. Pass noise filtered out.
  1211. @item noise, n
  1212. Pass only noise.
  1213. Default value is @var{output}.
  1214. @end table
  1215. @item adaptivity, ad
  1216. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1217. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1218. react much slower.
  1219. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1220. @item floor_offset, fo
  1221. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1222. noise floor. It is only effective when noise floor tracking is enabled.
  1223. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1224. @item noise_link, nl
  1225. Set the noise link used for multichannel audio.
  1226. It accepts the following values:
  1227. @table @option
  1228. @item none
  1229. Use unchanged channel's noise floor.
  1230. @item min
  1231. Use measured min noise floor of all channels.
  1232. @item max
  1233. Use measured max noise floor of all channels.
  1234. @item average
  1235. Use measured average noise floor of all channels.
  1236. Default value is @var{min}.
  1237. @end table
  1238. @item band_multiplier, bm
  1239. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1240. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1241. @item sample_noise, sn
  1242. Toggle capturing and measurement of noise profile from input audio.
  1243. It accepts the following values:
  1244. @table @option
  1245. @item start, begin
  1246. Start sample noise capture.
  1247. @item stop, end
  1248. Stop sample noise capture and measure new noise band profile.
  1249. Default value is @code{none}.
  1250. @end table
  1251. @item gain_smooth, gs
  1252. Set gain smooth spatial radius, used to smooth gains applied to each frequency bin.
  1253. Useful to reduce random music noise artefacts.
  1254. Higher values increases smoothing of gains.
  1255. Allowed range is from @code{0} to @code{50}.
  1256. Default value is @code{0}.
  1257. @end table
  1258. @subsection Commands
  1259. This filter supports the some above mentioned options as @ref{commands}.
  1260. @subsection Examples
  1261. @itemize
  1262. @item
  1263. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1264. @example
  1265. afftdn=nr=10:nf=-40
  1266. @end example
  1267. @item
  1268. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1269. tracking of noise floor so noise floor will gradually change during processing:
  1270. @example
  1271. afftdn=nr=10:nf=-80:tn=1
  1272. @end example
  1273. @item
  1274. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1275. of first 0.4 seconds of input audio:
  1276. @example
  1277. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1278. @end example
  1279. @end itemize
  1280. @section afftfilt
  1281. Apply arbitrary expressions to samples in frequency domain.
  1282. @table @option
  1283. @item real
  1284. Set frequency domain real expression for each separate channel separated
  1285. by '|'. Default is "re".
  1286. If the number of input channels is greater than the number of
  1287. expressions, the last specified expression is used for the remaining
  1288. output channels.
  1289. @item imag
  1290. Set frequency domain imaginary expression for each separate channel
  1291. separated by '|'. Default is "im".
  1292. Each expression in @var{real} and @var{imag} can contain the following
  1293. constants and functions:
  1294. @table @option
  1295. @item sr
  1296. sample rate
  1297. @item b
  1298. current frequency bin number
  1299. @item nb
  1300. number of available bins
  1301. @item ch
  1302. channel number of the current expression
  1303. @item chs
  1304. number of channels
  1305. @item pts
  1306. current frame pts
  1307. @item re
  1308. current real part of frequency bin of current channel
  1309. @item im
  1310. current imaginary part of frequency bin of current channel
  1311. @item real(b, ch)
  1312. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1313. @item imag(b, ch)
  1314. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1315. @end table
  1316. @item win_size
  1317. Set window size. Allowed range is from 16 to 131072.
  1318. Default is @code{4096}
  1319. @item win_func
  1320. Set window function.
  1321. It accepts the following values:
  1322. @table @samp
  1323. @item rect
  1324. @item bartlett
  1325. @item hann, hanning
  1326. @item hamming
  1327. @item blackman
  1328. @item welch
  1329. @item flattop
  1330. @item bharris
  1331. @item bnuttall
  1332. @item bhann
  1333. @item sine
  1334. @item nuttall
  1335. @item lanczos
  1336. @item gauss
  1337. @item tukey
  1338. @item dolph
  1339. @item cauchy
  1340. @item parzen
  1341. @item poisson
  1342. @item bohman
  1343. @item kaiser
  1344. @end table
  1345. Default is @code{hann}.
  1346. @item overlap
  1347. Set window overlap. If set to 1, the recommended overlap for selected
  1348. window function will be picked. Default is @code{0.75}.
  1349. @end table
  1350. @subsection Examples
  1351. @itemize
  1352. @item
  1353. Leave almost only low frequencies in audio:
  1354. @example
  1355. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1356. @end example
  1357. @item
  1358. Apply robotize effect:
  1359. @example
  1360. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1361. @end example
  1362. @item
  1363. Apply whisper effect:
  1364. @example
  1365. 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"
  1366. @end example
  1367. @item
  1368. Apply phase shift:
  1369. @example
  1370. afftfilt="real=re*cos(1)-im*sin(1):imag=re*sin(1)+im*cos(1)"
  1371. @end example
  1372. @end itemize
  1373. @anchor{afir}
  1374. @section afir
  1375. Apply an arbitrary Finite Impulse Response filter.
  1376. This filter is designed for applying long FIR filters,
  1377. up to 60 seconds long.
  1378. It can be used as component for digital crossover filters,
  1379. room equalization, cross talk cancellation, wavefield synthesis,
  1380. auralization, ambiophonics, ambisonics and spatialization.
  1381. This filter uses the streams higher than first one as FIR coefficients.
  1382. If the non-first stream holds a single channel, it will be used
  1383. for all input channels in the first stream, otherwise
  1384. the number of channels in the non-first stream must be same as
  1385. the number of channels in the first stream.
  1386. It accepts the following parameters:
  1387. @table @option
  1388. @item dry
  1389. Set dry gain. This sets input gain.
  1390. @item wet
  1391. Set wet gain. This sets final output gain.
  1392. @item length
  1393. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1394. @item gtype
  1395. This option is deprecated, and does nothing.
  1396. @item irnorm
  1397. Set norm to be applied to IR coefficients before filtering.
  1398. Allowed range is from @var{-1} to @var{2}.
  1399. IR coefficients are normalized with calculated vector norm set by this option.
  1400. For negative values, no norm is calculated, and IR coefficients are not modified at all.
  1401. Default is @var{1}.
  1402. @item irlink
  1403. For multichannel IR if this option is set to @var{true}. All IR channels will be
  1404. normalized with maximal measured gain of all IR channels coefficients as set by @code{irnorm} option.
  1405. When disabled, all IR coefficients in each IR channel will be normalized independently.
  1406. Default is @var{true}.
  1407. @item irgain
  1408. Set gain to be applied to IR coefficients before filtering.
  1409. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{irnorm} option.
  1410. @item irfmt
  1411. Set format of IR stream. Can be @code{mono} or @code{input}.
  1412. Default is @code{input}.
  1413. @item maxir
  1414. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1415. Allowed range is 0.1 to 60 seconds.
  1416. @item response
  1417. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1418. By default it is disabled.
  1419. @item channel
  1420. Set for which IR channel to display frequency response. By default is first channel
  1421. displayed. This option is used only when @var{response} is enabled.
  1422. @item size
  1423. Set video stream size. This option is used only when @var{response} is enabled.
  1424. @item rate
  1425. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1426. @item minp
  1427. Set minimal partition size used for convolution. Default is @var{8192}.
  1428. Allowed range is from @var{1} to @var{65536}.
  1429. Lower values decreases latency at cost of higher CPU usage.
  1430. @item maxp
  1431. Set maximal partition size used for convolution. Default is @var{8192}.
  1432. Allowed range is from @var{8} to @var{65536}.
  1433. Lower values may increase CPU usage.
  1434. @item nbirs
  1435. Set number of input impulse responses streams which will be switchable at runtime.
  1436. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1437. @item ir
  1438. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1439. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1440. This option can be changed at runtime via @ref{commands}.
  1441. @item precision
  1442. Set which precision to use when processing samples.
  1443. @table @option
  1444. @item auto
  1445. Auto pick internal sample format depending on other filters.
  1446. @item float
  1447. Always use single-floating point precision sample format.
  1448. @item double
  1449. Always use double-floating point precision sample format.
  1450. @end table
  1451. Default value is auto.
  1452. @item irload
  1453. Set when to load IR stream. Can be @code{init} or @code{access}.
  1454. First one load and prepares all IRs on initialization, second one
  1455. once on first access of specific IR.
  1456. Default is @code{init}.
  1457. @end table
  1458. @subsection Examples
  1459. @itemize
  1460. @item
  1461. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1462. @example
  1463. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1464. @end example
  1465. @item
  1466. Apply true stereo processing given input stereo stream, and two stereo impulse responses for left and right channel,
  1467. the impulse response files are files with names l_ir.wav and r_ir.wav:
  1468. @example
  1469. "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:irgain=-5dB,pan=stereo|FL<c0+c2|FR<c1+c3"
  1470. @end example
  1471. @end itemize
  1472. @anchor{aformat}
  1473. @section aformat
  1474. Set output format constraints for the input audio. The framework will
  1475. negotiate the most appropriate format to minimize conversions.
  1476. It accepts the following parameters:
  1477. @table @option
  1478. @item sample_fmts, f
  1479. A '|'-separated list of requested sample formats.
  1480. @item sample_rates, r
  1481. A '|'-separated list of requested sample rates.
  1482. @item channel_layouts, cl
  1483. A '|'-separated list of requested channel layouts.
  1484. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1485. for the required syntax.
  1486. @end table
  1487. If a parameter is omitted, all values are allowed.
  1488. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1489. @example
  1490. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1491. @end example
  1492. @section afreqshift
  1493. Apply frequency shift to input audio samples.
  1494. The filter accepts the following options:
  1495. @table @option
  1496. @item shift
  1497. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1498. Default value is 0.0.
  1499. @item level
  1500. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1501. Default value is 1.0.
  1502. @item order
  1503. Set filter order used for filtering. Allowed range is from 1 to 16.
  1504. Default value is 8.
  1505. @end table
  1506. @subsection Commands
  1507. This filter supports the all above options as @ref{commands}.
  1508. @section afwtdn
  1509. Reduce broadband noise from input samples using Wavelets.
  1510. A description of the accepted options follows.
  1511. @table @option
  1512. @item sigma
  1513. Set the noise sigma, allowed range is from 0 to 1.
  1514. Default value is 0.
  1515. This option controls strength of denoising applied to input samples.
  1516. Most useful way to set this option is via decibels, eg. -45dB.
  1517. @item levels
  1518. Set the number of wavelet levels of decomposition.
  1519. Allowed range is from 1 to 12.
  1520. Default value is 10.
  1521. Setting this too low make denoising performance very poor.
  1522. @item wavet
  1523. Set wavelet type for decomposition of input frame.
  1524. They are sorted by number of coefficients, from lowest to highest.
  1525. More coefficients means worse filtering speed, but overall better quality.
  1526. Available wavelets are:
  1527. @table @samp
  1528. @item sym2
  1529. @item sym4
  1530. @item rbior68
  1531. @item deb10
  1532. @item sym10
  1533. @item coif5
  1534. @item bl3
  1535. @end table
  1536. @item percent
  1537. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1538. Default value is 85 percent or partial denoising.
  1539. @item profile
  1540. If enabled, first input frame will be used as noise profile.
  1541. If first frame samples contain non-noise performance will be very poor.
  1542. @item adaptive
  1543. If enabled, input frames are analyzed for presence of noise.
  1544. If noise is detected with high possibility then input frame profile will be
  1545. used for processing following frames, until new noise frame is detected.
  1546. @item samples
  1547. Set size of single frame in number of samples. Allowed range is from 512 to
  1548. 65536. Default frame size is 8192 samples.
  1549. @item softness
  1550. Set softness applied inside thresholding function. Allowed range is from 0 to
  1551. 10. Default softness is 1.
  1552. @end table
  1553. @subsection Commands
  1554. This filter supports the all above options as @ref{commands}.
  1555. @section agate
  1556. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1557. processing reduces disturbing noise between useful signals.
  1558. Gating is done by detecting the volume below a chosen level @var{threshold}
  1559. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1560. floor is set via @var{range}. Because an exact manipulation of the signal
  1561. would cause distortion of the waveform the reduction can be levelled over
  1562. time. This is done by setting @var{attack} and @var{release}.
  1563. @var{attack} determines how long the signal has to fall below the threshold
  1564. before any reduction will occur and @var{release} sets the time the signal
  1565. has to rise above the threshold to reduce the reduction again.
  1566. Shorter signals than the chosen attack time will be left untouched.
  1567. @table @option
  1568. @item level_in
  1569. Set input level before filtering.
  1570. Default is 1. Allowed range is from 0.015625 to 64.
  1571. @item mode
  1572. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1573. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1574. will be amplified, expanding dynamic range in upward direction.
  1575. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1576. @item range
  1577. Set the level of gain reduction when the signal is below the threshold.
  1578. Default is 0.06125. Allowed range is from 0 to 1.
  1579. Setting this to 0 disables reduction and then filter behaves like expander.
  1580. @item threshold
  1581. If a signal rises above this level the gain reduction is released.
  1582. Default is 0.125. Allowed range is from 0 to 1.
  1583. @item ratio
  1584. Set a ratio by which the signal is reduced.
  1585. Default is 2. Allowed range is from 1 to 9000.
  1586. @item attack
  1587. Amount of milliseconds the signal has to rise above the threshold before gain
  1588. reduction stops.
  1589. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1590. @item release
  1591. Amount of milliseconds the signal has to fall below the threshold before the
  1592. reduction is increased again. Default is 250 milliseconds.
  1593. Allowed range is from 0.01 to 9000.
  1594. @item makeup
  1595. Set amount of amplification of signal after processing.
  1596. Default is 1. Allowed range is from 1 to 64.
  1597. @item knee
  1598. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1599. Default is 2.828427125. Allowed range is from 1 to 8.
  1600. @item detection
  1601. Choose if exact signal should be taken for detection or an RMS like one.
  1602. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1603. @item link
  1604. Choose if the average level between all channels or the louder channel affects
  1605. the reduction.
  1606. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1607. @end table
  1608. @subsection Commands
  1609. This filter supports the all above options as @ref{commands}.
  1610. @section aiir
  1611. Apply an arbitrary Infinite Impulse Response filter.
  1612. It accepts the following parameters:
  1613. @table @option
  1614. @item zeros, z
  1615. Set B/numerator/zeros/reflection coefficients.
  1616. @item poles, p
  1617. Set A/denominator/poles/ladder coefficients.
  1618. @item gains, k
  1619. Set channels gains.
  1620. @item dry_gain
  1621. Set input gain.
  1622. @item wet_gain
  1623. Set output gain.
  1624. @item format, f
  1625. Set coefficients format.
  1626. @table @samp
  1627. @item ll
  1628. lattice-ladder function
  1629. @item sf
  1630. analog transfer function
  1631. @item tf
  1632. digital transfer function
  1633. @item zp
  1634. Z-plane zeros/poles, cartesian (default)
  1635. @item pr
  1636. Z-plane zeros/poles, polar radians
  1637. @item pd
  1638. Z-plane zeros/poles, polar degrees
  1639. @item sp
  1640. S-plane zeros/poles
  1641. @end table
  1642. @item process, r
  1643. Set type of processing.
  1644. @table @samp
  1645. @item d
  1646. direct processing
  1647. @item s
  1648. serial processing
  1649. @item p
  1650. parallel processing
  1651. @end table
  1652. @item precision, e
  1653. Set filtering precision.
  1654. @table @samp
  1655. @item dbl
  1656. double-precision floating-point (default)
  1657. @item flt
  1658. single-precision floating-point
  1659. @item i32
  1660. 32-bit integers
  1661. @item i16
  1662. 16-bit integers
  1663. @end table
  1664. @item normalize, n
  1665. Normalize filter coefficients, by default is enabled.
  1666. Enabling it will normalize magnitude response at DC to 0dB.
  1667. @item mix
  1668. How much to use filtered signal in output. Default is 1.
  1669. Range is between 0 and 1.
  1670. @item response
  1671. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1672. By default it is disabled.
  1673. @item channel
  1674. Set for which IR channel to display frequency response. By default is first channel
  1675. displayed. This option is used only when @var{response} is enabled.
  1676. @item size
  1677. Set video stream size. This option is used only when @var{response} is enabled.
  1678. @end table
  1679. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1680. order.
  1681. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1682. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1683. imaginary unit.
  1684. Different coefficients and gains can be provided for every channel, in such case
  1685. use '|' to separate coefficients or gains. Last provided coefficients will be
  1686. used for all remaining channels.
  1687. @subsection Examples
  1688. @itemize
  1689. @item
  1690. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1691. @example
  1692. 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
  1693. @end example
  1694. @item
  1695. Same as above but in @code{zp} format:
  1696. @example
  1697. 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
  1698. @end example
  1699. @item
  1700. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1701. @example
  1702. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1703. @end example
  1704. @end itemize
  1705. @section alimiter
  1706. The limiter prevents an input signal from rising over a desired threshold.
  1707. This limiter uses lookahead technology to prevent your signal from distorting.
  1708. It means that there is a small delay after the signal is processed. Keep in mind
  1709. that the delay it produces is the attack time you set.
  1710. The filter accepts the following options:
  1711. @table @option
  1712. @item level_in
  1713. Set input gain. Default is 1.
  1714. @item level_out
  1715. Set output gain. Default is 1.
  1716. @item limit
  1717. Don't let signals above this level pass the limiter. Default is 1.
  1718. @item attack
  1719. The limiter will reach its attenuation level in this amount of time in
  1720. milliseconds. Default is 5 milliseconds.
  1721. @item release
  1722. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1723. Default is 50 milliseconds.
  1724. @item asc
  1725. When gain reduction is always needed ASC takes care of releasing to an
  1726. average reduction level rather than reaching a reduction of 0 in the release
  1727. time.
  1728. @item asc_level
  1729. Select how much the release time is affected by ASC, 0 means nearly no changes
  1730. in release time while 1 produces higher release times.
  1731. @item level
  1732. Auto level output signal. Default is enabled.
  1733. This normalizes audio back to 0dB if enabled.
  1734. @item latency
  1735. Compensate the delay introduced by using the lookahead buffer set with attack
  1736. parameter. Also flush the valid audio data in the lookahead buffer when the
  1737. stream hits EOF.
  1738. @end table
  1739. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1740. with @ref{aresample} before applying this filter.
  1741. @section allpass
  1742. Apply a two-pole all-pass filter with central frequency (in Hz)
  1743. @var{frequency}, and filter-width @var{width}.
  1744. An all-pass filter changes the audio's frequency to phase relationship
  1745. without changing its frequency to amplitude relationship.
  1746. The filter accepts the following options:
  1747. @table @option
  1748. @item frequency, f
  1749. Set frequency in Hz.
  1750. @item width_type, t
  1751. Set method to specify band-width of filter.
  1752. @table @option
  1753. @item h
  1754. Hz
  1755. @item q
  1756. Q-Factor
  1757. @item o
  1758. octave
  1759. @item s
  1760. slope
  1761. @item k
  1762. kHz
  1763. @end table
  1764. @item width, w
  1765. Specify the band-width of a filter in width_type units.
  1766. @item mix, m
  1767. How much to use filtered signal in output. Default is 1.
  1768. Range is between 0 and 1.
  1769. @item channels, c
  1770. Specify which channels to filter, by default all available are filtered.
  1771. @item normalize, n
  1772. Normalize biquad coefficients, by default is disabled.
  1773. Enabling it will normalize magnitude response at DC to 0dB.
  1774. @item order, o
  1775. Set the filter order, can be 1 or 2. Default is 2.
  1776. @item transform, a
  1777. Set transform type of IIR filter.
  1778. @table @option
  1779. @item di
  1780. @item dii
  1781. @item tdi
  1782. @item tdii
  1783. @item latt
  1784. @item svf
  1785. @item zdf
  1786. @end table
  1787. @item precision, r
  1788. Set precision of filtering.
  1789. @table @option
  1790. @item auto
  1791. Pick automatic sample format depending on surround filters.
  1792. @item s16
  1793. Always use signed 16-bit.
  1794. @item s32
  1795. Always use signed 32-bit.
  1796. @item f32
  1797. Always use float 32-bit.
  1798. @item f64
  1799. Always use float 64-bit.
  1800. @end table
  1801. @end table
  1802. @subsection Commands
  1803. This filter supports the following commands:
  1804. @table @option
  1805. @item frequency, f
  1806. Change allpass frequency.
  1807. Syntax for the command is : "@var{frequency}"
  1808. @item width_type, t
  1809. Change allpass width_type.
  1810. Syntax for the command is : "@var{width_type}"
  1811. @item width, w
  1812. Change allpass width.
  1813. Syntax for the command is : "@var{width}"
  1814. @item mix, m
  1815. Change allpass mix.
  1816. Syntax for the command is : "@var{mix}"
  1817. @end table
  1818. @section aloop
  1819. Loop audio samples.
  1820. The filter accepts the following options:
  1821. @table @option
  1822. @item loop
  1823. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1824. Default is 0.
  1825. @item size
  1826. Set maximal number of samples. Default is 0.
  1827. @item start
  1828. Set first sample of loop. Default is 0.
  1829. @item time
  1830. Set the time of loop start in seconds.
  1831. Only used if option named @var{start} is set to @code{-1}.
  1832. @end table
  1833. @anchor{amerge}
  1834. @section amerge
  1835. Merge two or more audio streams into a single multi-channel stream.
  1836. The filter accepts the following options:
  1837. @table @option
  1838. @item inputs
  1839. Set the number of inputs. Default is 2.
  1840. @end table
  1841. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1842. the channel layout of the output will be set accordingly and the channels
  1843. will be reordered as necessary. If the channel layouts of the inputs are not
  1844. disjoint, the output will have all the channels of the first input then all
  1845. the channels of the second input, in that order, and the channel layout of
  1846. the output will be the default value corresponding to the total number of
  1847. channels.
  1848. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1849. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1850. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1851. first input, b1 is the first channel of the second input).
  1852. On the other hand, if both input are in stereo, the output channels will be
  1853. in the default order: a1, a2, b1, b2, and the channel layout will be
  1854. arbitrarily set to 4.0, which may or may not be the expected value.
  1855. All inputs must have the same sample rate, and format.
  1856. If inputs do not have the same duration, the output will stop with the
  1857. shortest.
  1858. @subsection Examples
  1859. @itemize
  1860. @item
  1861. Merge two mono files into a stereo stream:
  1862. @example
  1863. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1864. @end example
  1865. @item
  1866. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1867. @example
  1868. 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
  1869. @end example
  1870. @end itemize
  1871. @section amix
  1872. Mixes multiple audio inputs into a single output.
  1873. Note that this filter only supports float samples (the @var{amerge}
  1874. and @var{pan} audio filters support many formats). If the @var{amix}
  1875. input has integer samples then @ref{aresample} will be automatically
  1876. inserted to perform the conversion to float samples.
  1877. It accepts the following parameters:
  1878. @table @option
  1879. @item inputs
  1880. The number of inputs. If unspecified, it defaults to 2.
  1881. @item duration
  1882. How to determine the end-of-stream.
  1883. @table @option
  1884. @item longest
  1885. The duration of the longest input. (default)
  1886. @item shortest
  1887. The duration of the shortest input.
  1888. @item first
  1889. The duration of the first input.
  1890. @end table
  1891. @item dropout_transition
  1892. The transition time, in seconds, for volume renormalization when an input
  1893. stream ends. The default value is 2 seconds.
  1894. @item weights
  1895. Specify weight of each input audio stream as a sequence of numbers separated
  1896. by a space. If fewer weights are specified compared to number of inputs, the
  1897. last weight is assigned to the remaining inputs.
  1898. Default weight for each input is 1.
  1899. @item normalize
  1900. Always scale inputs instead of only doing summation of samples.
  1901. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1902. by this filter if this option is disabled. By default is enabled.
  1903. @end table
  1904. @subsection Examples
  1905. @itemize
  1906. @item
  1907. This will mix 3 input audio streams to a single output with the same duration as the
  1908. first input and a dropout transition time of 3 seconds:
  1909. @example
  1910. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1911. @end example
  1912. @item
  1913. This will mix one vocal and one music input audio stream to a single output with the same duration as the
  1914. longest input. The music will have quarter the weight as the vocals, and the inputs are not normalized:
  1915. @example
  1916. ffmpeg -i VOCALS -i MUSIC -filter_complex amix=inputs=2:duration=longest:dropout_transition=0:weights="1 0.25":normalize=0 OUTPUT
  1917. @end example
  1918. @end itemize
  1919. @subsection Commands
  1920. This filter supports the following commands:
  1921. @table @option
  1922. @item weights
  1923. @item normalize
  1924. Syntax is same as option with same name.
  1925. @end table
  1926. @section amultiply
  1927. Multiply first audio stream with second audio stream and store result
  1928. in output audio stream. Multiplication is done by multiplying each
  1929. sample from first stream with sample at same position from second stream.
  1930. With this element-wise multiplication one can create amplitude fades and
  1931. amplitude modulations.
  1932. @section anequalizer
  1933. High-order parametric multiband equalizer for each channel.
  1934. It accepts the following parameters:
  1935. @table @option
  1936. @item params
  1937. This option string is in format:
  1938. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1939. Each equalizer band is separated by '|'.
  1940. @table @option
  1941. @item chn
  1942. Set channel number to which equalization will be applied.
  1943. If input doesn't have that channel the entry is ignored.
  1944. @item f
  1945. Set central frequency for band.
  1946. If input doesn't have that frequency the entry is ignored.
  1947. @item w
  1948. Set band width in Hertz.
  1949. @item g
  1950. Set band gain in dB.
  1951. @item t
  1952. Set filter type for band, optional, can be:
  1953. @table @samp
  1954. @item 0
  1955. Butterworth, this is default.
  1956. @item 1
  1957. Chebyshev type 1.
  1958. @item 2
  1959. Chebyshev type 2.
  1960. @end table
  1961. @end table
  1962. @item curves
  1963. With this option activated frequency response of anequalizer is displayed
  1964. in video stream.
  1965. @item size
  1966. Set video stream size. Only useful if curves option is activated.
  1967. @item mgain
  1968. Set max gain that will be displayed. Only useful if curves option is activated.
  1969. Setting this to a reasonable value makes it possible to display gain which is derived from
  1970. neighbour bands which are too close to each other and thus produce higher gain
  1971. when both are activated.
  1972. @item fscale
  1973. Set frequency scale used to draw frequency response in video output.
  1974. Can be linear or logarithmic. Default is logarithmic.
  1975. @item colors
  1976. Set color for each channel curve which is going to be displayed in video stream.
  1977. This is list of color names separated by space or by '|'.
  1978. Unrecognised or missing colors will be replaced by white color.
  1979. @end table
  1980. @subsection Examples
  1981. @itemize
  1982. @item
  1983. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1984. for first 2 channels using Chebyshev type 1 filter:
  1985. @example
  1986. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1987. @end example
  1988. @end itemize
  1989. @subsection Commands
  1990. This filter supports the following commands:
  1991. @table @option
  1992. @item change
  1993. Alter existing filter parameters.
  1994. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1995. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1996. error is returned.
  1997. @var{freq} set new frequency parameter.
  1998. @var{width} set new width parameter in Hertz.
  1999. @var{gain} set new gain parameter in dB.
  2000. Full filter invocation with asendcmd may look like this:
  2001. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  2002. @end table
  2003. @section anlmdn
  2004. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  2005. Each sample is adjusted by looking for other samples with similar contexts. This
  2006. context similarity is defined by comparing their surrounding patches of size
  2007. @option{p}. Patches are searched in an area of @option{r} around the sample.
  2008. The filter accepts the following options:
  2009. @table @option
  2010. @item strength, s
  2011. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  2012. @item patch, p
  2013. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  2014. Default value is 2 milliseconds.
  2015. @item research, r
  2016. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  2017. Default value is 6 milliseconds.
  2018. @item output, o
  2019. Set the output mode.
  2020. It accepts the following values:
  2021. @table @option
  2022. @item i
  2023. Pass input unchanged.
  2024. @item o
  2025. Pass noise filtered out.
  2026. @item n
  2027. Pass only noise.
  2028. Default value is @var{o}.
  2029. @end table
  2030. @item smooth, m
  2031. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  2032. @end table
  2033. @subsection Commands
  2034. This filter supports the all above options as @ref{commands}.
  2035. @section anlmf, anlms
  2036. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  2037. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  2038. relate to producing the least mean square of the error signal (difference between the desired,
  2039. 2nd input audio stream and the actual signal, the 1st input audio stream).
  2040. A description of the accepted options follows.
  2041. @table @option
  2042. @item order
  2043. Set filter order.
  2044. @item mu
  2045. Set filter mu.
  2046. @item eps
  2047. Set the filter eps.
  2048. @item leakage
  2049. Set the filter leakage.
  2050. @item out_mode
  2051. It accepts the following values:
  2052. @table @option
  2053. @item i
  2054. Pass the 1st input.
  2055. @item d
  2056. Pass the 2nd input.
  2057. @item o
  2058. Pass difference between desired, 2nd input and error signal estimate.
  2059. @item n
  2060. Pass difference between input, 1st input and error signal estimate.
  2061. @item e
  2062. Pass error signal estimated samples.
  2063. Default value is @var{o}.
  2064. @end table
  2065. @end table
  2066. @subsection Examples
  2067. @itemize
  2068. @item
  2069. One of many usages of this filter is noise reduction, input audio is filtered
  2070. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  2071. @example
  2072. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  2073. @end example
  2074. @end itemize
  2075. @subsection Commands
  2076. This filter supports the same commands as options, excluding option @code{order}.
  2077. @section anull
  2078. Pass the audio source unchanged to the output.
  2079. @section apad
  2080. Pad the end of an audio stream with silence.
  2081. This can be used together with @command{ffmpeg} @option{-shortest} to
  2082. extend audio streams to the same length as the video stream.
  2083. A description of the accepted options follows.
  2084. @table @option
  2085. @item packet_size
  2086. Set silence packet size. Default value is 4096.
  2087. @item pad_len
  2088. Set the number of samples of silence to add to the end. After the
  2089. value is reached, the stream is terminated. This option is mutually
  2090. exclusive with @option{whole_len}.
  2091. @item whole_len
  2092. Set the minimum total number of samples in the output audio stream. If
  2093. the value is longer than the input audio length, silence is added to
  2094. the end, until the value is reached. This option is mutually exclusive
  2095. with @option{pad_len}.
  2096. @item pad_dur
  2097. Specify the duration of samples of silence to add. See
  2098. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2099. for the accepted syntax. Used only if set to non-negative value.
  2100. @item whole_dur
  2101. Specify the minimum total duration in the output audio stream. See
  2102. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2103. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  2104. the input audio length, silence is added to the end, until the value is reached.
  2105. This option is mutually exclusive with @option{pad_dur}
  2106. @end table
  2107. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  2108. nor @option{whole_dur} option is set, the filter will add silence to the end of
  2109. the input stream indefinitely.
  2110. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  2111. @option{whole_dur} also caused the filter to add silence indefinitely.
  2112. @subsection Examples
  2113. @itemize
  2114. @item
  2115. Add 1024 samples of silence to the end of the input:
  2116. @example
  2117. apad=pad_len=1024
  2118. @end example
  2119. @item
  2120. Make sure the audio output will contain at least 10000 samples, pad
  2121. the input with silence if required:
  2122. @example
  2123. apad=whole_len=10000
  2124. @end example
  2125. @item
  2126. Use @command{ffmpeg} to pad the audio input with silence, so that the
  2127. video stream will always result the shortest and will be converted
  2128. until the end in the output file when using the @option{shortest}
  2129. option:
  2130. @example
  2131. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  2132. @end example
  2133. @end itemize
  2134. @section aphaser
  2135. Add a phasing effect to the input audio.
  2136. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  2137. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  2138. A description of the accepted parameters follows.
  2139. @table @option
  2140. @item in_gain
  2141. Set input gain. Default is 0.4.
  2142. @item out_gain
  2143. Set output gain. Default is 0.74
  2144. @item delay
  2145. Set delay in milliseconds. Default is 3.0.
  2146. @item decay
  2147. Set decay. Default is 0.4.
  2148. @item speed
  2149. Set modulation speed in Hz. Default is 0.5.
  2150. @item type
  2151. Set modulation type. Default is triangular.
  2152. It accepts the following values:
  2153. @table @samp
  2154. @item triangular, t
  2155. @item sinusoidal, s
  2156. @end table
  2157. @end table
  2158. @section aphaseshift
  2159. Apply phase shift to input audio samples.
  2160. The filter accepts the following options:
  2161. @table @option
  2162. @item shift
  2163. Specify phase shift. Allowed range is from -1.0 to 1.0.
  2164. Default value is 0.0.
  2165. @item level
  2166. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  2167. Default value is 1.0.
  2168. @item order
  2169. Set filter order used for filtering. Allowed range is from 1 to 16.
  2170. Default value is 8.
  2171. @end table
  2172. @subsection Commands
  2173. This filter supports the all above options as @ref{commands}.
  2174. @section apsnr
  2175. Measure Audio Peak Signal-to-Noise Ratio.
  2176. This filter takes two audio streams for input, and outputs first
  2177. audio stream.
  2178. Results are in dB per channel at end of either input.
  2179. @section apsyclip
  2180. Apply Psychoacoustic clipper to input audio stream.
  2181. The filter accepts the following options:
  2182. @table @option
  2183. @item level_in
  2184. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2185. @item level_out
  2186. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2187. @item clip
  2188. Set the clipping start value. Default value is 0dBFS or 1.
  2189. @item diff
  2190. Output only difference samples, useful to hear introduced distortions.
  2191. By default is disabled.
  2192. @item adaptive
  2193. Set strength of adaptive distortion applied. Default value is 0.5.
  2194. Allowed range is from 0 to 1.
  2195. @item iterations
  2196. Set number of iterations of psychoacoustic clipper.
  2197. Allowed range is from 1 to 20. Default value is 10.
  2198. @item level
  2199. Auto level output signal. Default is disabled.
  2200. This normalizes audio back to 0dBFS if enabled.
  2201. @end table
  2202. @subsection Commands
  2203. This filter supports the all above options as @ref{commands}.
  2204. @section apulsator
  2205. Audio pulsator is something between an autopanner and a tremolo.
  2206. But it can produce funny stereo effects as well. Pulsator changes the volume
  2207. of the left and right channel based on a LFO (low frequency oscillator) with
  2208. different waveforms and shifted phases.
  2209. This filter have the ability to define an offset between left and right
  2210. channel. An offset of 0 means that both LFO shapes match each other.
  2211. The left and right channel are altered equally - a conventional tremolo.
  2212. An offset of 50% means that the shape of the right channel is exactly shifted
  2213. in phase (or moved backwards about half of the frequency) - pulsator acts as
  2214. an autopanner. At 1 both curves match again. Every setting in between moves the
  2215. phase shift gapless between all stages and produces some "bypassing" sounds with
  2216. sine and triangle waveforms. The more you set the offset near 1 (starting from
  2217. the 0.5) the faster the signal passes from the left to the right speaker.
  2218. The filter accepts the following options:
  2219. @table @option
  2220. @item level_in
  2221. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2222. @item level_out
  2223. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2224. @item mode
  2225. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  2226. sawup or sawdown. Default is sine.
  2227. @item amount
  2228. Set modulation. Define how much of original signal is affected by the LFO.
  2229. @item offset_l
  2230. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2231. @item offset_r
  2232. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2233. @item width
  2234. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2235. @item timing
  2236. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2237. @item bpm
  2238. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2239. is set to bpm.
  2240. @item ms
  2241. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2242. is set to ms.
  2243. @item hz
  2244. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2245. if timing is set to hz.
  2246. @end table
  2247. @anchor{aresample}
  2248. @section aresample
  2249. Resample the input audio to the specified parameters, using the
  2250. libswresample library. If none are specified then the filter will
  2251. automatically convert between its input and output.
  2252. This filter is also able to stretch/squeeze the audio data to make it match
  2253. the timestamps or to inject silence / cut out audio to make it match the
  2254. timestamps, do a combination of both or do neither.
  2255. The filter accepts the syntax
  2256. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2257. expresses a sample rate and @var{resampler_options} is a list of
  2258. @var{key}=@var{value} pairs, separated by ":". See the
  2259. @ref{Resampler Options,,"Resampler Options" section in the
  2260. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2261. for the complete list of supported options.
  2262. @subsection Examples
  2263. @itemize
  2264. @item
  2265. Resample the input audio to 44100Hz:
  2266. @example
  2267. aresample=44100
  2268. @end example
  2269. @item
  2270. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2271. samples per second compensation:
  2272. @example
  2273. aresample=async=1000
  2274. @end example
  2275. @end itemize
  2276. @section areverse
  2277. Reverse an audio clip.
  2278. Warning: This filter requires memory to buffer the entire clip, so trimming
  2279. is suggested.
  2280. @subsection Examples
  2281. @itemize
  2282. @item
  2283. Take the first 5 seconds of a clip, and reverse it.
  2284. @example
  2285. atrim=end=5,areverse
  2286. @end example
  2287. @end itemize
  2288. @section arls
  2289. Apply Recursive Least Squares algorithm to the first audio stream using the second audio stream.
  2290. This adaptive filter is used to mimic a desired filter by recursively finding the filter coefficients that
  2291. relate to producing the minimal weighted linear least squares cost function of the error signal (difference
  2292. between the desired, 2nd input audio stream and the actual signal, the 1st input audio stream).
  2293. A description of the accepted options follows.
  2294. @table @option
  2295. @item order
  2296. Set the filter order.
  2297. @item lambda
  2298. Set the forgetting factor.
  2299. @item delta
  2300. Set the coefficient to initialize internal covariance matrix.
  2301. @item out_mode
  2302. Set the filter output samples. It accepts the following values:
  2303. @table @option
  2304. @item i
  2305. Pass the 1st input.
  2306. @item d
  2307. Pass the 2nd input.
  2308. @item o
  2309. Pass difference between desired, 2nd input and error signal estimate.
  2310. @item n
  2311. Pass difference between input, 1st input and error signal estimate.
  2312. @item e
  2313. Pass error signal estimated samples.
  2314. Default value is @var{o}.
  2315. @end table
  2316. @end table
  2317. @section arnndn
  2318. Reduce noise from speech using Recurrent Neural Networks.
  2319. This filter accepts the following options:
  2320. @table @option
  2321. @item model, m
  2322. Set train model file to load. This option is always required.
  2323. @item mix
  2324. Set how much to mix filtered samples into final output.
  2325. Allowed range is from -1 to 1. Default value is 1.
  2326. Negative values are special, they set how much to keep filtered noise
  2327. in the final filter output. Set this option to -1 to hear actual
  2328. noise removed from input signal.
  2329. @end table
  2330. @subsection Commands
  2331. This filter supports the all above options as @ref{commands}.
  2332. @section asdr
  2333. Measure Audio Signal-to-Distortion Ratio.
  2334. This filter takes two audio streams for input, and outputs first
  2335. audio stream.
  2336. Results are in dB per channel at end of either input.
  2337. @section asetnsamples
  2338. Set the number of samples per each output audio frame.
  2339. The last output packet may contain a different number of samples, as
  2340. the filter will flush all the remaining samples when the input audio
  2341. signals its end.
  2342. The filter accepts the following options:
  2343. @table @option
  2344. @item nb_out_samples, n
  2345. Set the number of frames per each output audio frame. The number is
  2346. intended as the number of samples @emph{per each channel}.
  2347. Default value is 1024.
  2348. @item pad, p
  2349. If set to 1, the filter will pad the last audio frame with zeroes, so
  2350. that the last frame will contain the same number of samples as the
  2351. previous ones. Default value is 1.
  2352. @end table
  2353. For example, to set the number of per-frame samples to 1234 and
  2354. disable padding for the last frame, use:
  2355. @example
  2356. asetnsamples=n=1234:p=0
  2357. @end example
  2358. @section asetrate
  2359. Set the sample rate without altering the PCM data.
  2360. This will result in a change of speed and pitch.
  2361. The filter accepts the following options:
  2362. @table @option
  2363. @item sample_rate, r
  2364. Set the output sample rate. Default is 44100 Hz.
  2365. @end table
  2366. @section ashowinfo
  2367. Show a line containing various information for each input audio frame.
  2368. The input audio is not modified.
  2369. The shown line contains a sequence of key/value pairs of the form
  2370. @var{key}:@var{value}.
  2371. The following values are shown in the output:
  2372. @table @option
  2373. @item n
  2374. The (sequential) number of the input frame, starting from 0.
  2375. @item pts
  2376. The presentation timestamp of the input frame, in time base units; the time base
  2377. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2378. @item pts_time
  2379. The presentation timestamp of the input frame in seconds.
  2380. @item fmt
  2381. The sample format.
  2382. @item chlayout
  2383. The channel layout.
  2384. @item rate
  2385. The sample rate for the audio frame.
  2386. @item nb_samples
  2387. The number of samples (per channel) in the frame.
  2388. @item checksum
  2389. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2390. audio, the data is treated as if all the planes were concatenated.
  2391. @item plane_checksums
  2392. A list of Adler-32 checksums for each data plane.
  2393. @end table
  2394. @section asisdr
  2395. Measure Audio Scaled-Invariant Signal-to-Distortion Ratio.
  2396. This filter takes two audio streams for input, and outputs first
  2397. audio stream.
  2398. Results are in dB per channel at end of either input.
  2399. @section asoftclip
  2400. Apply audio soft clipping.
  2401. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2402. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2403. This filter accepts the following options:
  2404. @table @option
  2405. @item type
  2406. Set type of soft-clipping.
  2407. It accepts the following values:
  2408. @table @option
  2409. @item hard
  2410. @item tanh
  2411. @item atan
  2412. @item cubic
  2413. @item exp
  2414. @item alg
  2415. @item quintic
  2416. @item sin
  2417. @item erf
  2418. @end table
  2419. @item threshold
  2420. Set threshold from where to start clipping. Default value is 0dB or 1.
  2421. @item output
  2422. Set gain applied to output. Default value is 0dB or 1.
  2423. @item param
  2424. Set additional parameter which controls sigmoid function.
  2425. @item oversample
  2426. Set oversampling factor.
  2427. @end table
  2428. @subsection Commands
  2429. This filter supports the all above options as @ref{commands}.
  2430. @section aspectralstats
  2431. Display frequency domain statistical information about the audio channels.
  2432. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2433. It accepts the following option:
  2434. @table @option
  2435. @item win_size
  2436. Set the window length in samples. Default value is 2048.
  2437. Allowed range is from 32 to 65536.
  2438. @item win_func
  2439. Set window function.
  2440. It accepts the following values:
  2441. @table @samp
  2442. @item rect
  2443. @item bartlett
  2444. @item hann, hanning
  2445. @item hamming
  2446. @item blackman
  2447. @item welch
  2448. @item flattop
  2449. @item bharris
  2450. @item bnuttall
  2451. @item bhann
  2452. @item sine
  2453. @item nuttall
  2454. @item lanczos
  2455. @item gauss
  2456. @item tukey
  2457. @item dolph
  2458. @item cauchy
  2459. @item parzen
  2460. @item poisson
  2461. @item bohman
  2462. @item kaiser
  2463. @end table
  2464. Default is @code{hann}.
  2465. @item overlap
  2466. Set window overlap. Allowed range is from @code{0}
  2467. to @code{1}. Default value is @code{0.5}.
  2468. @item measure
  2469. Select the parameters which are measured. The metadata keys can
  2470. be used as flags, default is @option{all} which measures everything.
  2471. @option{none} disables all measurement.
  2472. @end table
  2473. A list of each metadata key follows:
  2474. @table @option
  2475. @item mean
  2476. @item variance
  2477. @item centroid
  2478. @item spread
  2479. @item skewness
  2480. @item kurtosis
  2481. @item entropy
  2482. @item flatness
  2483. @item crest
  2484. @item flux
  2485. @item slope
  2486. @item decrease
  2487. @item rolloff
  2488. @end table
  2489. @section asr
  2490. Automatic Speech Recognition
  2491. This filter uses PocketSphinx for speech recognition. To enable
  2492. compilation of this filter, you need to configure FFmpeg with
  2493. @code{--enable-pocketsphinx}.
  2494. It accepts the following options:
  2495. @table @option
  2496. @item rate
  2497. Set sampling rate of input audio. Defaults is @code{16000}.
  2498. This need to match speech models, otherwise one will get poor results.
  2499. @item hmm
  2500. Set dictionary containing acoustic model files.
  2501. @item dict
  2502. Set pronunciation dictionary.
  2503. @item lm
  2504. Set language model file.
  2505. @item lmctl
  2506. Set language model set.
  2507. @item lmname
  2508. Set which language model to use.
  2509. @item logfn
  2510. Set output for log messages.
  2511. @end table
  2512. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2513. @anchor{astats}
  2514. @section astats
  2515. Display time domain statistical information about the audio channels.
  2516. Statistics are calculated and displayed for each audio channel and,
  2517. where applicable, an overall figure is also given.
  2518. It accepts the following option:
  2519. @table @option
  2520. @item length
  2521. Short window length in seconds, used for peak and trough RMS measurement.
  2522. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2523. @item metadata
  2524. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2525. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2526. disabled.
  2527. Available keys for each channel are:
  2528. @var{Bit_depth}
  2529. @var{Crest_factor}
  2530. @var{DC_offset}
  2531. @var{Dynamic_range}
  2532. @var{Entropy}
  2533. @var{Flat_factor}
  2534. @var{Max_difference}
  2535. @var{Max_level}
  2536. @var{Mean_difference}
  2537. @var{Min_difference}
  2538. @var{Min_level}
  2539. @var{Noise_floor}
  2540. @var{Noise_floor_count}
  2541. @var{Number_of_Infs}
  2542. @var{Number_of_NaNs}
  2543. @var{Number_of_denormals}
  2544. @var{Peak_count}
  2545. @var{Abs_Peak_count}
  2546. @var{Peak_level}
  2547. @var{RMS_difference}
  2548. @var{RMS_peak}
  2549. @var{RMS_trough}
  2550. @var{Zero_crossings}
  2551. @var{Zero_crossings_rate}
  2552. and for @code{Overall}:
  2553. @var{Bit_depth}
  2554. @var{DC_offset}
  2555. @var{Entropy}
  2556. @var{Flat_factor}
  2557. @var{Max_difference}
  2558. @var{Max_level}
  2559. @var{Mean_difference}
  2560. @var{Min_difference}
  2561. @var{Min_level}
  2562. @var{Noise_floor}
  2563. @var{Noise_floor_count}
  2564. @var{Number_of_Infs}
  2565. @var{Number_of_NaNs}
  2566. @var{Number_of_denormals}
  2567. @var{Number_of_samples}
  2568. @var{Peak_count}
  2569. @var{Abs_Peak_count}
  2570. @var{Peak_level}
  2571. @var{RMS_difference}
  2572. @var{RMS_level}
  2573. @var{RMS_peak}
  2574. @var{RMS_trough}
  2575. For example, a full key looks like @code{lavfi.astats.1.DC_offset} or
  2576. @code{lavfi.astats.Overall.Peak_count}.
  2577. Read below for the description of the keys.
  2578. @item reset
  2579. Set the number of frames over which cumulative stats are calculated before
  2580. being reset. Default is disabled.
  2581. @item measure_perchannel
  2582. Select the parameters which are measured per channel. The metadata keys can
  2583. be used as flags, default is @option{all} which measures everything.
  2584. @option{none} disables all per channel measurement.
  2585. @item measure_overall
  2586. Select the parameters which are measured overall. The metadata keys can
  2587. be used as flags, default is @option{all} which measures everything.
  2588. @option{none} disables all overall measurement.
  2589. @end table
  2590. A description of the measure keys follow:
  2591. @table @option
  2592. @item none
  2593. no measures
  2594. @item all
  2595. all measures
  2596. @item Bit_depth
  2597. overall bit depth of audio, i.e. number of bits used for each sample
  2598. @item Crest_factor
  2599. standard ratio of peak to RMS level (note: not in dB)
  2600. @item DC_offset
  2601. mean amplitude displacement from zero
  2602. @item Dynamic_range
  2603. measured dynamic range of audio in dB
  2604. @item Entropy
  2605. entropy measured across whole audio, entropy of value near 1.0 is typically measured for white noise
  2606. @item Flat_factor
  2607. flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2608. (i.e. either @var{Min_level} or @var{Max_level})
  2609. @item Max_difference
  2610. maximal difference between two consecutive samples
  2611. @item Max_level
  2612. maximal sample level
  2613. @item Mean_difference
  2614. mean difference between two consecutive samples, i.e. the average of each difference between two consecutive samples
  2615. @item Min_difference
  2616. minimal difference between two consecutive samples
  2617. @item Min_level
  2618. minimal sample level
  2619. @item Noise_floor
  2620. minimum local peak measured in dBFS over a short window
  2621. @item Noise_floor_count
  2622. number of occasions (not the number of samples) that the signal attained
  2623. @var{Noise floor}
  2624. @item Number_of_Infs
  2625. number of samples with an infinite value
  2626. @item Number_of_NaNs
  2627. number of samples with a NaN (not a number) value
  2628. @item Number_of_denormals
  2629. number of samples with a subnormal value
  2630. @item Number_of_samples
  2631. number of samples
  2632. @item Peak_count
  2633. number of occasions (not the number of samples) that the signal attained either
  2634. @var{Min_level} or @var{Max_level}
  2635. @item Abs_Peak_count
  2636. number of occasions that the absolute samples taken from the signal attained
  2637. max absolute value of @var{Min_level} and @var{Max_level}
  2638. @item Peak_level
  2639. standard peak level measured in dBFS
  2640. @item RMS_difference
  2641. Root Mean Square difference between two consecutive samples
  2642. @item RMS_level
  2643. standard RMS level measured in dBFS
  2644. @item RMS_peak
  2645. @item RMS_trough
  2646. peak and trough values for RMS level measured over a short window,
  2647. measured in dBFS.
  2648. @item Zero crossings
  2649. number of points where the waveform crosses the zero level axis
  2650. @item Zero crossings rate
  2651. rate of Zero crossings and number of audio samples
  2652. @end table
  2653. @section asubboost
  2654. Boost subwoofer frequencies.
  2655. The filter accepts the following options:
  2656. @table @option
  2657. @item dry
  2658. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2659. Default value is 1.0.
  2660. @item wet
  2661. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2662. Default value is 1.0.
  2663. @item boost
  2664. Set max boost factor. Allowed range is from 1 to 12. Default value is 2.
  2665. @item decay
  2666. Set delay line decay gain value. Allowed range is from 0 to 1.
  2667. Default value is 0.0.
  2668. @item feedback
  2669. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2670. Default value is 0.9.
  2671. @item cutoff
  2672. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2673. Default value is 100.
  2674. @item slope
  2675. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2676. Default value is 0.5.
  2677. @item delay
  2678. Set delay. Allowed range is from 1 to 100.
  2679. Default value is 20.
  2680. @item channels
  2681. Set the channels to process. Default value is all available.
  2682. @end table
  2683. @subsection Commands
  2684. This filter supports the all above options as @ref{commands}.
  2685. @section asubcut
  2686. Cut subwoofer frequencies.
  2687. This filter allows to set custom, steeper
  2688. roll off than highpass filter, and thus is able to more attenuate
  2689. frequency content in stop-band.
  2690. The filter accepts the following options:
  2691. @table @option
  2692. @item cutoff
  2693. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2694. Default value is 20.
  2695. @item order
  2696. Set filter order. Available values are from 3 to 20.
  2697. Default value is 10.
  2698. @item level
  2699. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2700. @end table
  2701. @subsection Commands
  2702. This filter supports the all above options as @ref{commands}.
  2703. @section asupercut
  2704. Cut super frequencies.
  2705. The filter accepts the following options:
  2706. @table @option
  2707. @item cutoff
  2708. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2709. Default value is 20000.
  2710. @item order
  2711. Set filter order. Available values are from 3 to 20.
  2712. Default value is 10.
  2713. @item level
  2714. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2715. @end table
  2716. @subsection Commands
  2717. This filter supports the all above options as @ref{commands}.
  2718. @section asuperpass
  2719. Apply high order Butterworth band-pass filter.
  2720. The filter accepts the following options:
  2721. @table @option
  2722. @item centerf
  2723. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2724. Default value is 1000.
  2725. @item order
  2726. Set filter order. Available values are from 4 to 20.
  2727. Default value is 4.
  2728. @item qfactor
  2729. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2730. @item level
  2731. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2732. @end table
  2733. @subsection Commands
  2734. This filter supports the all above options as @ref{commands}.
  2735. @section asuperstop
  2736. Apply high order Butterworth band-stop filter.
  2737. The filter accepts the following options:
  2738. @table @option
  2739. @item centerf
  2740. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2741. Default value is 1000.
  2742. @item order
  2743. Set filter order. Available values are from 4 to 20.
  2744. Default value is 4.
  2745. @item qfactor
  2746. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2747. @item level
  2748. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2749. @end table
  2750. @subsection Commands
  2751. This filter supports the all above options as @ref{commands}.
  2752. @section atempo
  2753. Adjust audio tempo.
  2754. The filter accepts exactly one parameter, the audio tempo. If not
  2755. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2756. be in the [0.5, 100.0] range.
  2757. Note that tempo greater than 2 will skip some samples rather than
  2758. blend them in. If for any reason this is a concern it is always
  2759. possible to daisy-chain several instances of atempo to achieve the
  2760. desired product tempo.
  2761. @subsection Examples
  2762. @itemize
  2763. @item
  2764. Slow down audio to 80% tempo:
  2765. @example
  2766. atempo=0.8
  2767. @end example
  2768. @item
  2769. To speed up audio to 300% tempo:
  2770. @example
  2771. atempo=3
  2772. @end example
  2773. @item
  2774. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2775. @example
  2776. atempo=sqrt(3),atempo=sqrt(3)
  2777. @end example
  2778. @end itemize
  2779. @subsection Commands
  2780. This filter supports the following commands:
  2781. @table @option
  2782. @item tempo
  2783. Change filter tempo scale factor.
  2784. Syntax for the command is : "@var{tempo}"
  2785. @end table
  2786. @section atilt
  2787. Apply spectral tilt filter to audio stream.
  2788. This filter apply any spectral roll-off slope over any specified frequency band.
  2789. The filter accepts the following options:
  2790. @table @option
  2791. @item freq
  2792. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2793. @item slope
  2794. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2795. @item width
  2796. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2797. @item order
  2798. Set order of tilt filter.
  2799. @item level
  2800. Set input volume level. Allowed range is from 0 to 4.
  2801. Default is 1.
  2802. @end table
  2803. @subsection Commands
  2804. This filter supports the all above options as @ref{commands}.
  2805. @section atrim
  2806. Trim the input so that the output contains one continuous subpart of the input.
  2807. It accepts the following parameters:
  2808. @table @option
  2809. @item start
  2810. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2811. sample with the timestamp @var{start} will be the first sample in the output.
  2812. @item end
  2813. Specify time of the first audio sample that will be dropped, i.e. the
  2814. audio sample immediately preceding the one with the timestamp @var{end} will be
  2815. the last sample in the output.
  2816. @item start_pts
  2817. Same as @var{start}, except this option sets the start timestamp in samples
  2818. instead of seconds.
  2819. @item end_pts
  2820. Same as @var{end}, except this option sets the end timestamp in samples instead
  2821. of seconds.
  2822. @item duration
  2823. The maximum duration of the output in seconds.
  2824. @item start_sample
  2825. The number of the first sample that should be output.
  2826. @item end_sample
  2827. The number of the first sample that should be dropped.
  2828. @end table
  2829. @option{start}, @option{end}, and @option{duration} are expressed as time
  2830. duration specifications; see
  2831. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2832. Note that the first two sets of the start/end options and the @option{duration}
  2833. option look at the frame timestamp, while the _sample options simply count the
  2834. samples that pass through the filter. So start/end_pts and start/end_sample will
  2835. give different results when the timestamps are wrong, inexact or do not start at
  2836. zero. Also note that this filter does not modify the timestamps. If you wish
  2837. to have the output timestamps start at zero, insert the asetpts filter after the
  2838. atrim filter.
  2839. If multiple start or end options are set, this filter tries to be greedy and
  2840. keep all samples that match at least one of the specified constraints. To keep
  2841. only the part that matches all the constraints at once, chain multiple atrim
  2842. filters.
  2843. The defaults are such that all the input is kept. So it is possible to set e.g.
  2844. just the end values to keep everything before the specified time.
  2845. Examples:
  2846. @itemize
  2847. @item
  2848. Drop everything except the second minute of input:
  2849. @example
  2850. ffmpeg -i INPUT -af atrim=60:120
  2851. @end example
  2852. @item
  2853. Keep only the first 1000 samples:
  2854. @example
  2855. ffmpeg -i INPUT -af atrim=end_sample=1000
  2856. @end example
  2857. @end itemize
  2858. @section axcorrelate
  2859. Calculate normalized windowed cross-correlation between two input audio streams.
  2860. Resulted samples are always between -1 and 1 inclusive.
  2861. If result is 1 it means two input samples are highly correlated in that selected segment.
  2862. Result 0 means they are not correlated at all.
  2863. If result is -1 it means two input samples are out of phase, which means they cancel each
  2864. other.
  2865. The filter accepts the following options:
  2866. @table @option
  2867. @item size
  2868. Set size of segment over which cross-correlation is calculated.
  2869. Default is 256. Allowed range is from 2 to 131072.
  2870. @item algo
  2871. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast} or @code{best}.
  2872. Default is @code{best}. Fast algorithm assumes mean values over any given segment
  2873. are always zero and thus need much less calculations to make.
  2874. This is generally not true, but is valid for typical audio streams.
  2875. @end table
  2876. @subsection Examples
  2877. @itemize
  2878. @item
  2879. Calculate correlation between channels in stereo audio stream:
  2880. @example
  2881. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2882. @end example
  2883. @end itemize
  2884. @section bandpass
  2885. Apply a two-pole Butterworth band-pass filter with central
  2886. frequency @var{frequency}, and (3dB-point) band-width width.
  2887. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2888. instead of the default: constant 0dB peak gain.
  2889. The filter roll off at 6dB per octave (20dB per decade).
  2890. The filter accepts the following options:
  2891. @table @option
  2892. @item frequency, f
  2893. Set the filter's central frequency. Default is @code{3000}.
  2894. @item csg
  2895. Constant skirt gain if set to 1. Defaults to 0.
  2896. @item width_type, t
  2897. Set method to specify band-width of filter.
  2898. @table @option
  2899. @item h
  2900. Hz
  2901. @item q
  2902. Q-Factor
  2903. @item o
  2904. octave
  2905. @item s
  2906. slope
  2907. @item k
  2908. kHz
  2909. @end table
  2910. @item width, w
  2911. Specify the band-width of a filter in width_type units.
  2912. @item mix, m
  2913. How much to use filtered signal in output. Default is 1.
  2914. Range is between 0 and 1.
  2915. @item channels, c
  2916. Specify which channels to filter, by default all available are filtered.
  2917. @item normalize, n
  2918. Normalize biquad coefficients, by default is disabled.
  2919. Enabling it will normalize magnitude response at DC to 0dB.
  2920. @item transform, a
  2921. Set transform type of IIR filter.
  2922. @table @option
  2923. @item di
  2924. @item dii
  2925. @item tdi
  2926. @item tdii
  2927. @item latt
  2928. @item svf
  2929. @item zdf
  2930. @end table
  2931. @item precision, r
  2932. Set precision of filtering.
  2933. @table @option
  2934. @item auto
  2935. Pick automatic sample format depending on surround filters.
  2936. @item s16
  2937. Always use signed 16-bit.
  2938. @item s32
  2939. Always use signed 32-bit.
  2940. @item f32
  2941. Always use float 32-bit.
  2942. @item f64
  2943. Always use float 64-bit.
  2944. @end table
  2945. @item block_size, b
  2946. Set block size used for reverse IIR processing. If this value is set to high enough
  2947. value (higher than impulse response length truncated when reaches near zero values) filtering
  2948. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2949. Note that filter delay will be exactly this many samples when set to non-zero value.
  2950. @end table
  2951. @subsection Commands
  2952. This filter supports the following commands:
  2953. @table @option
  2954. @item frequency, f
  2955. Change bandpass frequency.
  2956. Syntax for the command is : "@var{frequency}"
  2957. @item width_type, t
  2958. Change bandpass width_type.
  2959. Syntax for the command is : "@var{width_type}"
  2960. @item width, w
  2961. Change bandpass width.
  2962. Syntax for the command is : "@var{width}"
  2963. @item mix, m
  2964. Change bandpass mix.
  2965. Syntax for the command is : "@var{mix}"
  2966. @end table
  2967. @section bandreject
  2968. Apply a two-pole Butterworth band-reject filter with central
  2969. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2970. The filter roll off at 6dB per octave (20dB per decade).
  2971. The filter accepts the following options:
  2972. @table @option
  2973. @item frequency, f
  2974. Set the filter's central frequency. Default is @code{3000}.
  2975. @item width_type, t
  2976. Set method to specify band-width of filter.
  2977. @table @option
  2978. @item h
  2979. Hz
  2980. @item q
  2981. Q-Factor
  2982. @item o
  2983. octave
  2984. @item s
  2985. slope
  2986. @item k
  2987. kHz
  2988. @end table
  2989. @item width, w
  2990. Specify the band-width of a filter in width_type units.
  2991. @item mix, m
  2992. How much to use filtered signal in output. Default is 1.
  2993. Range is between 0 and 1.
  2994. @item channels, c
  2995. Specify which channels to filter, by default all available are filtered.
  2996. @item normalize, n
  2997. Normalize biquad coefficients, by default is disabled.
  2998. Enabling it will normalize magnitude response at DC to 0dB.
  2999. @item transform, a
  3000. Set transform type of IIR filter.
  3001. @table @option
  3002. @item di
  3003. @item dii
  3004. @item tdi
  3005. @item tdii
  3006. @item latt
  3007. @item svf
  3008. @item zdf
  3009. @end table
  3010. @item precision, r
  3011. Set precision of filtering.
  3012. @table @option
  3013. @item auto
  3014. Pick automatic sample format depending on surround filters.
  3015. @item s16
  3016. Always use signed 16-bit.
  3017. @item s32
  3018. Always use signed 32-bit.
  3019. @item f32
  3020. Always use float 32-bit.
  3021. @item f64
  3022. Always use float 64-bit.
  3023. @end table
  3024. @item block_size, b
  3025. Set block size used for reverse IIR processing. If this value is set to high enough
  3026. value (higher than impulse response length truncated when reaches near zero values) filtering
  3027. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3028. Note that filter delay will be exactly this many samples when set to non-zero value.
  3029. @end table
  3030. @subsection Commands
  3031. This filter supports the following commands:
  3032. @table @option
  3033. @item frequency, f
  3034. Change bandreject frequency.
  3035. Syntax for the command is : "@var{frequency}"
  3036. @item width_type, t
  3037. Change bandreject width_type.
  3038. Syntax for the command is : "@var{width_type}"
  3039. @item width, w
  3040. Change bandreject width.
  3041. Syntax for the command is : "@var{width}"
  3042. @item mix, m
  3043. Change bandreject mix.
  3044. Syntax for the command is : "@var{mix}"
  3045. @end table
  3046. @section bass, lowshelf
  3047. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  3048. shelving filter with a response similar to that of a standard
  3049. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3050. The filter accepts the following options:
  3051. @table @option
  3052. @item gain, g
  3053. Give the gain at 0 Hz. Its useful range is about -20
  3054. (for a large cut) to +20 (for a large boost).
  3055. Beware of clipping when using a positive gain.
  3056. @item frequency, f
  3057. Set the filter's central frequency and so can be used
  3058. to extend or reduce the frequency range to be boosted or cut.
  3059. The default value is @code{100} Hz.
  3060. @item width_type, t
  3061. Set method to specify band-width of filter.
  3062. @table @option
  3063. @item h
  3064. Hz
  3065. @item q
  3066. Q-Factor
  3067. @item o
  3068. octave
  3069. @item s
  3070. slope
  3071. @item k
  3072. kHz
  3073. @end table
  3074. @item width, w
  3075. Determine how steep is the filter's shelf transition.
  3076. @item poles, p
  3077. Set number of poles. Default is 2.
  3078. @item mix, m
  3079. How much to use filtered signal in output. Default is 1.
  3080. Range is between 0 and 1.
  3081. @item channels, c
  3082. Specify which channels to filter, by default all available are filtered.
  3083. @item normalize, n
  3084. Normalize biquad coefficients, by default is disabled.
  3085. Enabling it will normalize magnitude response at DC to 0dB.
  3086. @item transform, a
  3087. Set transform type of IIR filter.
  3088. @table @option
  3089. @item di
  3090. @item dii
  3091. @item tdi
  3092. @item tdii
  3093. @item latt
  3094. @item svf
  3095. @item zdf
  3096. @end table
  3097. @item precision, r
  3098. Set precision of filtering.
  3099. @table @option
  3100. @item auto
  3101. Pick automatic sample format depending on surround filters.
  3102. @item s16
  3103. Always use signed 16-bit.
  3104. @item s32
  3105. Always use signed 32-bit.
  3106. @item f32
  3107. Always use float 32-bit.
  3108. @item f64
  3109. Always use float 64-bit.
  3110. @end table
  3111. @item block_size, b
  3112. Set block size used for reverse IIR processing. If this value is set to high enough
  3113. value (higher than impulse response length truncated when reaches near zero values) filtering
  3114. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3115. Note that filter delay will be exactly this many samples when set to non-zero value.
  3116. @end table
  3117. @subsection Commands
  3118. This filter supports the following commands:
  3119. @table @option
  3120. @item frequency, f
  3121. Change bass frequency.
  3122. Syntax for the command is : "@var{frequency}"
  3123. @item width_type, t
  3124. Change bass width_type.
  3125. Syntax for the command is : "@var{width_type}"
  3126. @item width, w
  3127. Change bass width.
  3128. Syntax for the command is : "@var{width}"
  3129. @item gain, g
  3130. Change bass gain.
  3131. Syntax for the command is : "@var{gain}"
  3132. @item mix, m
  3133. Change bass mix.
  3134. Syntax for the command is : "@var{mix}"
  3135. @end table
  3136. @section biquad
  3137. Apply a biquad IIR filter with the given coefficients.
  3138. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  3139. are the numerator and denominator coefficients respectively.
  3140. and @var{channels}, @var{c} specify which channels to filter, by default all
  3141. available are filtered.
  3142. @subsection Commands
  3143. This filter supports the following commands:
  3144. @table @option
  3145. @item a0
  3146. @item a1
  3147. @item a2
  3148. @item b0
  3149. @item b1
  3150. @item b2
  3151. Change biquad parameter.
  3152. Syntax for the command is : "@var{value}"
  3153. @item mix, m
  3154. How much to use filtered signal in output. Default is 1.
  3155. Range is between 0 and 1.
  3156. @item channels, c
  3157. Specify which channels to filter, by default all available are filtered.
  3158. @item normalize, n
  3159. Normalize biquad coefficients, by default is disabled.
  3160. Enabling it will normalize magnitude response at DC to 0dB.
  3161. @item transform, a
  3162. Set transform type of IIR filter.
  3163. @table @option
  3164. @item di
  3165. @item dii
  3166. @item tdi
  3167. @item tdii
  3168. @item latt
  3169. @item svf
  3170. @item zdf
  3171. @end table
  3172. @item precision, r
  3173. Set precision of filtering.
  3174. @table @option
  3175. @item auto
  3176. Pick automatic sample format depending on surround filters.
  3177. @item s16
  3178. Always use signed 16-bit.
  3179. @item s32
  3180. Always use signed 32-bit.
  3181. @item f32
  3182. Always use float 32-bit.
  3183. @item f64
  3184. Always use float 64-bit.
  3185. @end table
  3186. @item block_size, b
  3187. Set block size used for reverse IIR processing. If this value is set to high enough
  3188. value (higher than impulse response length truncated when reaches near zero values) filtering
  3189. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3190. Note that filter delay will be exactly this many samples when set to non-zero value.
  3191. @end table
  3192. @section bs2b
  3193. Bauer stereo to binaural transformation, which improves headphone listening of
  3194. stereo audio records.
  3195. To enable compilation of this filter you need to configure FFmpeg with
  3196. @code{--enable-libbs2b}.
  3197. It accepts the following parameters:
  3198. @table @option
  3199. @item profile
  3200. Pre-defined crossfeed level.
  3201. @table @option
  3202. @item default
  3203. Default level (fcut=700, feed=50).
  3204. @item cmoy
  3205. Chu Moy circuit (fcut=700, feed=60).
  3206. @item jmeier
  3207. Jan Meier circuit (fcut=650, feed=95).
  3208. @end table
  3209. @item fcut
  3210. Cut frequency (in Hz).
  3211. @item feed
  3212. Feed level (in Hz).
  3213. @end table
  3214. @section channelmap
  3215. Remap input channels to new locations.
  3216. It accepts the following parameters:
  3217. @table @option
  3218. @item map
  3219. Map channels from input to output. The argument is a '|'-separated list of
  3220. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  3221. @var{in_channel} form. @var{in_channel} can be either the name of the input
  3222. channel (e.g. FL for front left) or its index in the input channel layout.
  3223. @var{out_channel} is the name of the output channel or its index in the output
  3224. channel layout. If @var{out_channel} is not given then it is implicitly an
  3225. index, starting with zero and increasing by one for each mapping.
  3226. @item channel_layout
  3227. The channel layout of the output stream.
  3228. @end table
  3229. If no mapping is present, the filter will implicitly map input channels to
  3230. output channels, preserving indices.
  3231. @subsection Examples
  3232. @itemize
  3233. @item
  3234. For example, assuming a 5.1+downmix input MOV file,
  3235. @example
  3236. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  3237. @end example
  3238. will create an output WAV file tagged as stereo from the downmix channels of
  3239. the input.
  3240. @item
  3241. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  3242. @example
  3243. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  3244. @end example
  3245. @end itemize
  3246. @section channelsplit
  3247. Split each channel from an input audio stream into a separate output stream.
  3248. It accepts the following parameters:
  3249. @table @option
  3250. @item channel_layout
  3251. The channel layout of the input stream. The default is "stereo".
  3252. @item channels
  3253. A channel layout describing the channels to be extracted as separate output streams
  3254. or "all" to extract each input channel as a separate stream. The default is "all".
  3255. Choosing channels not present in channel layout in the input will result in an error.
  3256. @end table
  3257. @subsection Examples
  3258. @itemize
  3259. @item
  3260. For example, assuming a stereo input MP3 file,
  3261. @example
  3262. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  3263. @end example
  3264. will create an output Matroska file with two audio streams, one containing only
  3265. the left channel and the other the right channel.
  3266. @item
  3267. Split a 5.1 WAV file into per-channel files:
  3268. @example
  3269. ffmpeg -i in.wav -filter_complex
  3270. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  3271. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  3272. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  3273. side_right.wav
  3274. @end example
  3275. @item
  3276. Extract only LFE from a 5.1 WAV file:
  3277. @example
  3278. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  3279. -map '[LFE]' lfe.wav
  3280. @end example
  3281. @end itemize
  3282. @section chorus
  3283. Add a chorus effect to the audio.
  3284. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  3285. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  3286. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  3287. The modulation depth defines the range the modulated delay is played before or after
  3288. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  3289. sound tuned around the original one, like in a chorus where some vocals are slightly
  3290. off key.
  3291. It accepts the following parameters:
  3292. @table @option
  3293. @item in_gain
  3294. Set input gain. Default is 0.4.
  3295. @item out_gain
  3296. Set output gain. Default is 0.4.
  3297. @item delays
  3298. Set delays. A typical delay is around 40ms to 60ms.
  3299. @item decays
  3300. Set decays.
  3301. @item speeds
  3302. Set speeds.
  3303. @item depths
  3304. Set depths.
  3305. @end table
  3306. @subsection Examples
  3307. @itemize
  3308. @item
  3309. A single delay:
  3310. @example
  3311. chorus=0.7:0.9:55:0.4:0.25:2
  3312. @end example
  3313. @item
  3314. Two delays:
  3315. @example
  3316. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3317. @end example
  3318. @item
  3319. Fuller sounding chorus with three delays:
  3320. @example
  3321. 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
  3322. @end example
  3323. @end itemize
  3324. @section compand
  3325. Compress or expand the audio's dynamic range.
  3326. It accepts the following parameters:
  3327. @table @option
  3328. @item attacks
  3329. @item decays
  3330. A list of times in seconds for each channel over which the instantaneous level
  3331. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3332. increase of volume and @var{decays} refers to decrease of volume. For most
  3333. situations, the attack time (response to the audio getting louder) should be
  3334. shorter than the decay time, because the human ear is more sensitive to sudden
  3335. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3336. a typical value for decay is 0.8 seconds.
  3337. If specified number of attacks & decays is lower than number of channels, the last
  3338. set attack/decay will be used for all remaining channels.
  3339. @item points
  3340. A list of points for the transfer function, specified in dB relative to the
  3341. maximum possible signal amplitude. Each key points list must be defined using
  3342. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3343. @code{x0/y0 x1/y1 x2/y2 ....}
  3344. The input values must be in strictly increasing order but the transfer function
  3345. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3346. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3347. function are @code{-70/-70|-60/-20|1/0}.
  3348. @item soft-knee
  3349. Set the curve radius in dB for all joints. It defaults to 0.01.
  3350. @item gain
  3351. Set the additional gain in dB to be applied at all points on the transfer
  3352. function. This allows for easy adjustment of the overall gain.
  3353. It defaults to 0.
  3354. @item volume
  3355. Set an initial volume, in dB, to be assumed for each channel when filtering
  3356. starts. This permits the user to supply a nominal level initially, so that, for
  3357. example, a very large gain is not applied to initial signal levels before the
  3358. companding has begun to operate. A typical value for audio which is initially
  3359. quiet is -90 dB. It defaults to 0.
  3360. @item delay
  3361. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3362. delayed before being fed to the volume adjuster. Specifying a delay
  3363. approximately equal to the attack/decay times allows the filter to effectively
  3364. operate in predictive rather than reactive mode. It defaults to 0.
  3365. @end table
  3366. @subsection Examples
  3367. @itemize
  3368. @item
  3369. Make music with both quiet and loud passages suitable for listening to in a
  3370. noisy environment:
  3371. @example
  3372. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3373. @end example
  3374. Another example for audio with whisper and explosion parts:
  3375. @example
  3376. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3377. @end example
  3378. @item
  3379. A noise gate for when the noise is at a lower level than the signal:
  3380. @example
  3381. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3382. @end example
  3383. @item
  3384. Here is another noise gate, this time for when the noise is at a higher level
  3385. than the signal (making it, in some ways, similar to squelch):
  3386. @example
  3387. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3388. @end example
  3389. @item
  3390. 2:1 compression starting at -6dB:
  3391. @example
  3392. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3393. @end example
  3394. @item
  3395. 2:1 compression starting at -9dB:
  3396. @example
  3397. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3398. @end example
  3399. @item
  3400. 2:1 compression starting at -12dB:
  3401. @example
  3402. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3403. @end example
  3404. @item
  3405. 2:1 compression starting at -18dB:
  3406. @example
  3407. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3408. @end example
  3409. @item
  3410. 3:1 compression starting at -15dB:
  3411. @example
  3412. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3413. @end example
  3414. @item
  3415. Compressor/Gate:
  3416. @example
  3417. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3418. @end example
  3419. @item
  3420. Expander:
  3421. @example
  3422. 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
  3423. @end example
  3424. @item
  3425. Hard limiter at -6dB:
  3426. @example
  3427. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3428. @end example
  3429. @item
  3430. Hard limiter at -12dB:
  3431. @example
  3432. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3433. @end example
  3434. @item
  3435. Hard noise gate at -35 dB:
  3436. @example
  3437. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3438. @end example
  3439. @item
  3440. Soft limiter:
  3441. @example
  3442. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3443. @end example
  3444. @end itemize
  3445. @section compensationdelay
  3446. Compensation Delay Line is a metric based delay to compensate differing
  3447. positions of microphones or speakers.
  3448. For example, you have recorded guitar with two microphones placed in
  3449. different locations. Because the front of sound wave has fixed speed in
  3450. normal conditions, the phasing of microphones can vary and depends on
  3451. their location and interposition. The best sound mix can be achieved when
  3452. these microphones are in phase (synchronized). Note that a distance of
  3453. ~30 cm between microphones makes one microphone capture the signal in
  3454. antiphase to the other microphone. That makes the final mix sound moody.
  3455. This filter helps to solve phasing problems by adding different delays
  3456. to each microphone track and make them synchronized.
  3457. The best result can be reached when you take one track as base and
  3458. synchronize other tracks one by one with it.
  3459. Remember that synchronization/delay tolerance depends on sample rate, too.
  3460. Higher sample rates will give more tolerance.
  3461. The filter accepts the following parameters:
  3462. @table @option
  3463. @item mm
  3464. Set millimeters distance. This is compensation distance for fine tuning.
  3465. Default is 0.
  3466. @item cm
  3467. Set cm distance. This is compensation distance for tightening distance setup.
  3468. Default is 0.
  3469. @item m
  3470. Set meters distance. This is compensation distance for hard distance setup.
  3471. Default is 0.
  3472. @item dry
  3473. Set dry amount. Amount of unprocessed (dry) signal.
  3474. Default is 0.
  3475. @item wet
  3476. Set wet amount. Amount of processed (wet) signal.
  3477. Default is 1.
  3478. @item temp
  3479. Set temperature in degrees Celsius. This is the temperature of the environment.
  3480. Default is 20.
  3481. @end table
  3482. @subsection Commands
  3483. This filter supports the all above options as @ref{commands}.
  3484. @section crossfeed
  3485. Apply headphone crossfeed filter.
  3486. Crossfeed is the process of blending the left and right channels of stereo
  3487. audio recording.
  3488. It is mainly used to reduce extreme stereo separation of low frequencies.
  3489. The intent is to produce more speaker like sound to the listener.
  3490. The filter accepts the following options:
  3491. @table @option
  3492. @item strength
  3493. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3494. This sets gain of low shelf filter for side part of stereo image.
  3495. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3496. @item range
  3497. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3498. This sets cut off frequency of low shelf filter. Default is cut off near
  3499. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3500. @item slope
  3501. Set curve slope of low shelf filter. Default is 0.5.
  3502. Allowed range is from 0.01 to 1.
  3503. @item level_in
  3504. Set input gain. Default is 0.9.
  3505. @item level_out
  3506. Set output gain. Default is 1.
  3507. @item block_size
  3508. Set block size used for reverse IIR processing. If this value is set to high enough
  3509. value (higher than impulse response length truncated when reaches near zero values) filtering
  3510. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3511. Note that filter delay will be exactly this many samples when set to non-zero value.
  3512. @end table
  3513. @subsection Commands
  3514. This filter supports the all above options as @ref{commands}.
  3515. @section crystalizer
  3516. Simple algorithm for audio noise sharpening.
  3517. This filter linearly increases differences between each audio sample.
  3518. The filter accepts the following options:
  3519. @table @option
  3520. @item i
  3521. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3522. (unchanged sound) to 10.0 (maximum effect).
  3523. To inverse filtering use negative value.
  3524. @item c
  3525. Enable clipping. By default is enabled.
  3526. @end table
  3527. @subsection Commands
  3528. This filter supports the all above options as @ref{commands}.
  3529. @section dcshift
  3530. Apply a DC shift to the audio.
  3531. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3532. in the recording chain) from the audio. The effect of a DC offset is reduced
  3533. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3534. a signal has a DC offset.
  3535. @table @option
  3536. @item shift
  3537. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3538. the audio.
  3539. @item limitergain
  3540. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3541. used to prevent clipping.
  3542. @end table
  3543. @section deesser
  3544. Apply de-essing to the audio samples.
  3545. @table @option
  3546. @item i
  3547. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3548. Default is 0.
  3549. @item m
  3550. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3551. Default is 0.5.
  3552. @item f
  3553. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3554. Default is 0.5.
  3555. @item s
  3556. Set the output mode.
  3557. It accepts the following values:
  3558. @table @option
  3559. @item i
  3560. Pass input unchanged.
  3561. @item o
  3562. Pass ess filtered out.
  3563. @item e
  3564. Pass only ess.
  3565. Default value is @var{o}.
  3566. @end table
  3567. @end table
  3568. @section dialoguenhance
  3569. Enhance dialogue in stereo audio.
  3570. This filter accepts stereo input and produce surround (3.0) channels output.
  3571. The newly produced front center channel have enhanced speech dialogue originally
  3572. available in both stereo channels.
  3573. This filter outputs front left and front right channels same as available in stereo input.
  3574. The filter accepts the following options:
  3575. @table @option
  3576. @item original
  3577. Set the original center factor to keep in front center channel output.
  3578. Allowed range is from 0 to 1. Default value is 1.
  3579. @item enhance
  3580. Set the dialogue enhance factor to put in front center channel output.
  3581. Allowed range is from 0 to 3. Default value is 1.
  3582. @item voice
  3583. Set the voice detection factor.
  3584. Allowed range is from 2 to 32. Default value is 2.
  3585. @end table
  3586. @subsection Commands
  3587. This filter supports the all above options as @ref{commands}.
  3588. @section drmeter
  3589. Measure audio dynamic range.
  3590. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3591. is found in transition material. And anything less that 8 have very poor dynamics
  3592. and is very compressed.
  3593. The filter accepts the following options:
  3594. @table @option
  3595. @item length
  3596. Set window length in seconds used to split audio into segments of equal length.
  3597. Default is 3 seconds.
  3598. @end table
  3599. @section dynaudnorm
  3600. Dynamic Audio Normalizer.
  3601. This filter applies a certain amount of gain to the input audio in order
  3602. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3603. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3604. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3605. This allows for applying extra gain to the "quiet" sections of the audio
  3606. while avoiding distortions or clipping the "loud" sections. In other words:
  3607. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3608. sections, in the sense that the volume of each section is brought to the
  3609. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3610. this goal *without* applying "dynamic range compressing". It will retain 100%
  3611. of the dynamic range *within* each section of the audio file.
  3612. @table @option
  3613. @item framelen, f
  3614. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3615. Default is 500 milliseconds.
  3616. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3617. referred to as frames. This is required, because a peak magnitude has no
  3618. meaning for just a single sample value. Instead, we need to determine the
  3619. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3620. normalizer would simply use the peak magnitude of the complete file, the
  3621. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3622. frame. The length of a frame is specified in milliseconds. By default, the
  3623. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3624. been found to give good results with most files.
  3625. Note that the exact frame length, in number of samples, will be determined
  3626. automatically, based on the sampling rate of the individual input audio file.
  3627. @item gausssize, g
  3628. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3629. number. Default is 31.
  3630. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3631. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3632. is specified in frames, centered around the current frame. For the sake of
  3633. simplicity, this must be an odd number. Consequently, the default value of 31
  3634. takes into account the current frame, as well as the 15 preceding frames and
  3635. the 15 subsequent frames. Using a larger window results in a stronger
  3636. smoothing effect and thus in less gain variation, i.e. slower gain
  3637. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3638. effect and thus in more gain variation, i.e. faster gain adaptation.
  3639. In other words, the more you increase this value, the more the Dynamic Audio
  3640. Normalizer will behave like a "traditional" normalization filter. On the
  3641. contrary, the more you decrease this value, the more the Dynamic Audio
  3642. Normalizer will behave like a dynamic range compressor.
  3643. @item peak, p
  3644. Set the target peak value. This specifies the highest permissible magnitude
  3645. level for the normalized audio input. This filter will try to approach the
  3646. target peak magnitude as closely as possible, but at the same time it also
  3647. makes sure that the normalized signal will never exceed the peak magnitude.
  3648. A frame's maximum local gain factor is imposed directly by the target peak
  3649. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3650. It is not recommended to go above this value.
  3651. @item maxgain, m
  3652. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3653. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3654. factor for each input frame, i.e. the maximum gain factor that does not
  3655. result in clipping or distortion. The maximum gain factor is determined by
  3656. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3657. additionally bounds the frame's maximum gain factor by a predetermined
  3658. (global) maximum gain factor. This is done in order to avoid excessive gain
  3659. factors in "silent" or almost silent frames. By default, the maximum gain
  3660. factor is 10.0, For most inputs the default value should be sufficient and
  3661. it usually is not recommended to increase this value. Though, for input
  3662. with an extremely low overall volume level, it may be necessary to allow even
  3663. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3664. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3665. Instead, a "sigmoid" threshold function will be applied. This way, the
  3666. gain factors will smoothly approach the threshold value, but never exceed that
  3667. value.
  3668. @item targetrms, r
  3669. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3670. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3671. This means that the maximum local gain factor for each frame is defined
  3672. (only) by the frame's highest magnitude sample. This way, the samples can
  3673. be amplified as much as possible without exceeding the maximum signal
  3674. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3675. Normalizer can also take into account the frame's root mean square,
  3676. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3677. determine the power of a time-varying signal. It is therefore considered
  3678. that the RMS is a better approximation of the "perceived loudness" than
  3679. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3680. frames to a constant RMS value, a uniform "perceived loudness" can be
  3681. established. If a target RMS value has been specified, a frame's local gain
  3682. factor is defined as the factor that would result in exactly that RMS value.
  3683. Note, however, that the maximum local gain factor is still restricted by the
  3684. frame's highest magnitude sample, in order to prevent clipping.
  3685. @item coupling, n
  3686. Enable channels coupling. By default is enabled.
  3687. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3688. amount. This means the same gain factor will be applied to all channels, i.e.
  3689. the maximum possible gain factor is determined by the "loudest" channel.
  3690. However, in some recordings, it may happen that the volume of the different
  3691. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3692. In this case, this option can be used to disable the channel coupling. This way,
  3693. the gain factor will be determined independently for each channel, depending
  3694. only on the individual channel's highest magnitude sample. This allows for
  3695. harmonizing the volume of the different channels.
  3696. @item correctdc, c
  3697. Enable DC bias correction. By default is disabled.
  3698. An audio signal (in the time domain) is a sequence of sample values.
  3699. In the Dynamic Audio Normalizer these sample values are represented in the
  3700. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3701. audio signal, or "waveform", should be centered around the zero point.
  3702. That means if we calculate the mean value of all samples in a file, or in a
  3703. single frame, then the result should be 0.0 or at least very close to that
  3704. value. If, however, there is a significant deviation of the mean value from
  3705. 0.0, in either positive or negative direction, this is referred to as a
  3706. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3707. Audio Normalizer provides optional DC bias correction.
  3708. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3709. the mean value, or "DC correction" offset, of each input frame and subtract
  3710. that value from all of the frame's sample values which ensures those samples
  3711. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3712. boundaries, the DC correction offset values will be interpolated smoothly
  3713. between neighbouring frames.
  3714. @item altboundary, b
  3715. Enable alternative boundary mode. By default is disabled.
  3716. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3717. around each frame. This includes the preceding frames as well as the
  3718. subsequent frames. However, for the "boundary" frames, located at the very
  3719. beginning and at the very end of the audio file, not all neighbouring
  3720. frames are available. In particular, for the first few frames in the audio
  3721. file, the preceding frames are not known. And, similarly, for the last few
  3722. frames in the audio file, the subsequent frames are not known. Thus, the
  3723. question arises which gain factors should be assumed for the missing frames
  3724. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3725. to deal with this situation. The default boundary mode assumes a gain factor
  3726. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3727. "fade out" at the beginning and at the end of the input, respectively.
  3728. @item compress, s
  3729. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3730. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3731. compression. This means that signal peaks will not be pruned and thus the
  3732. full dynamic range will be retained within each local neighbourhood. However,
  3733. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3734. normalization algorithm with a more "traditional" compression.
  3735. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3736. (thresholding) function. If (and only if) the compression feature is enabled,
  3737. all input frames will be processed by a soft knee thresholding function prior
  3738. to the actual normalization process. Put simply, the thresholding function is
  3739. going to prune all samples whose magnitude exceeds a certain threshold value.
  3740. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3741. value. Instead, the threshold value will be adjusted for each individual
  3742. frame.
  3743. In general, smaller parameters result in stronger compression, and vice versa.
  3744. Values below 3.0 are not recommended, because audible distortion may appear.
  3745. @item threshold, t
  3746. Set the target threshold value. This specifies the lowest permissible
  3747. magnitude level for the audio input which will be normalized.
  3748. If input frame volume is above this value frame will be normalized.
  3749. Otherwise frame may not be normalized at all. The default value is set
  3750. to 0, which means all input frames will be normalized.
  3751. This option is mostly useful if digital noise is not wanted to be amplified.
  3752. @item channels, h
  3753. Specify which channels to filter, by default all available channels are filtered.
  3754. @item overlap, o
  3755. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3756. Using >0 and <1 values will make less conservative gain adjustments, like
  3757. when framelen option is set to smaller value, if framelen option value is
  3758. compensated for non-zero overlap then gain adjustments will be smoother across time
  3759. compared to zero overlap case.
  3760. @item curve, v
  3761. Specify the peak mapping curve expression which is going to be used when calculating
  3762. gain applied to frames. The max output frame gain will still be limited by other
  3763. options mentioned previously for this filter.
  3764. The expression can contain the following constants:
  3765. @table @option
  3766. @item ch
  3767. current channel number
  3768. @item sn
  3769. current sample number
  3770. @item nb_channels
  3771. number of channels
  3772. @item t
  3773. timestamp expressed in seconds
  3774. @item sr
  3775. sample rate
  3776. @item p
  3777. current frame peak value
  3778. @end table
  3779. @end table
  3780. @subsection Commands
  3781. This filter supports the all above options as @ref{commands}.
  3782. @section earwax
  3783. Make audio easier to listen to on headphones.
  3784. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3785. so that when listened to on headphones the stereo image is moved from
  3786. inside your head (standard for headphones) to outside and in front of
  3787. the listener (standard for speakers).
  3788. Ported from SoX.
  3789. @section equalizer
  3790. Apply a two-pole peaking equalisation (EQ) filter. With this
  3791. filter, the signal-level at and around a selected frequency can
  3792. be increased or decreased, whilst (unlike bandpass and bandreject
  3793. filters) that at all other frequencies is unchanged.
  3794. In order to produce complex equalisation curves, this filter can
  3795. be given several times, each with a different central frequency.
  3796. The filter accepts the following options:
  3797. @table @option
  3798. @item frequency, f
  3799. Set the filter's central frequency in Hz.
  3800. @item width_type, t
  3801. Set method to specify band-width of filter.
  3802. @table @option
  3803. @item h
  3804. Hz
  3805. @item q
  3806. Q-Factor
  3807. @item o
  3808. octave
  3809. @item s
  3810. slope
  3811. @item k
  3812. kHz
  3813. @end table
  3814. @item width, w
  3815. Specify the band-width of a filter in width_type units.
  3816. @item gain, g
  3817. Set the required gain or attenuation in dB.
  3818. Beware of clipping when using a positive gain.
  3819. @item mix, m
  3820. How much to use filtered signal in output. Default is 1.
  3821. Range is between 0 and 1.
  3822. @item channels, c
  3823. Specify which channels to filter, by default all available are filtered.
  3824. @item normalize, n
  3825. Normalize biquad coefficients, by default is disabled.
  3826. Enabling it will normalize magnitude response at DC to 0dB.
  3827. @item transform, a
  3828. Set transform type of IIR filter.
  3829. @table @option
  3830. @item di
  3831. @item dii
  3832. @item tdi
  3833. @item tdii
  3834. @item latt
  3835. @item svf
  3836. @item zdf
  3837. @end table
  3838. @item precision, r
  3839. Set precision of filtering.
  3840. @table @option
  3841. @item auto
  3842. Pick automatic sample format depending on surround filters.
  3843. @item s16
  3844. Always use signed 16-bit.
  3845. @item s32
  3846. Always use signed 32-bit.
  3847. @item f32
  3848. Always use float 32-bit.
  3849. @item f64
  3850. Always use float 64-bit.
  3851. @end table
  3852. @item block_size, b
  3853. Set block size used for reverse IIR processing. If this value is set to high enough
  3854. value (higher than impulse response length truncated when reaches near zero values) filtering
  3855. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3856. Note that filter delay will be exactly this many samples when set to non-zero value.
  3857. @end table
  3858. @subsection Examples
  3859. @itemize
  3860. @item
  3861. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3862. @example
  3863. equalizer=f=1000:t=h:width=200:g=-10
  3864. @end example
  3865. @item
  3866. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3867. @example
  3868. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3869. @end example
  3870. @end itemize
  3871. @subsection Commands
  3872. This filter supports the following commands:
  3873. @table @option
  3874. @item frequency, f
  3875. Change equalizer frequency.
  3876. Syntax for the command is : "@var{frequency}"
  3877. @item width_type, t
  3878. Change equalizer width_type.
  3879. Syntax for the command is : "@var{width_type}"
  3880. @item width, w
  3881. Change equalizer width.
  3882. Syntax for the command is : "@var{width}"
  3883. @item gain, g
  3884. Change equalizer gain.
  3885. Syntax for the command is : "@var{gain}"
  3886. @item mix, m
  3887. Change equalizer mix.
  3888. Syntax for the command is : "@var{mix}"
  3889. @end table
  3890. @section extrastereo
  3891. Linearly increases the difference between left and right channels which
  3892. adds some sort of "live" effect to playback.
  3893. The filter accepts the following options:
  3894. @table @option
  3895. @item m
  3896. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3897. (average of both channels), with 1.0 sound will be unchanged, with
  3898. -1.0 left and right channels will be swapped.
  3899. @item c
  3900. Enable clipping. By default is enabled.
  3901. @end table
  3902. @subsection Commands
  3903. This filter supports the all above options as @ref{commands}.
  3904. @section firequalizer
  3905. Apply FIR Equalization using arbitrary frequency response.
  3906. The filter accepts the following option:
  3907. @table @option
  3908. @item gain
  3909. Set gain curve equation (in dB). The expression can contain variables:
  3910. @table @option
  3911. @item f
  3912. the evaluated frequency
  3913. @item sr
  3914. sample rate
  3915. @item ch
  3916. channel number, set to 0 when multichannels evaluation is disabled
  3917. @item chid
  3918. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3919. multichannels evaluation is disabled
  3920. @item chs
  3921. number of channels
  3922. @item chlayout
  3923. channel_layout, see libavutil/channel_layout.h
  3924. @end table
  3925. and functions:
  3926. @table @option
  3927. @item gain_interpolate(f)
  3928. interpolate gain on frequency f based on gain_entry
  3929. @item cubic_interpolate(f)
  3930. same as gain_interpolate, but smoother
  3931. @end table
  3932. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3933. @item gain_entry
  3934. Set gain entry for gain_interpolate function. The expression can
  3935. contain functions:
  3936. @table @option
  3937. @item entry(f, g)
  3938. store gain entry at frequency f with value g
  3939. @end table
  3940. This option is also available as command.
  3941. @item delay
  3942. Set filter delay in seconds. Higher value means more accurate.
  3943. Default is @code{0.01}.
  3944. @item accuracy
  3945. Set filter accuracy in Hz. Lower value means more accurate.
  3946. Default is @code{5}.
  3947. @item wfunc
  3948. Set window function. Acceptable values are:
  3949. @table @option
  3950. @item rectangular
  3951. rectangular window, useful when gain curve is already smooth
  3952. @item hann
  3953. hann window (default)
  3954. @item hamming
  3955. hamming window
  3956. @item blackman
  3957. blackman window
  3958. @item nuttall3
  3959. 3-terms continuous 1st derivative nuttall window
  3960. @item mnuttall3
  3961. minimum 3-terms discontinuous nuttall window
  3962. @item nuttall
  3963. 4-terms continuous 1st derivative nuttall window
  3964. @item bnuttall
  3965. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3966. @item bharris
  3967. blackman-harris window
  3968. @item tukey
  3969. tukey window
  3970. @end table
  3971. @item fixed
  3972. If enabled, use fixed number of audio samples. This improves speed when
  3973. filtering with large delay. Default is disabled.
  3974. @item multi
  3975. Enable multichannels evaluation on gain. Default is disabled.
  3976. @item zero_phase
  3977. Enable zero phase mode by subtracting timestamp to compensate delay.
  3978. Default is disabled.
  3979. @item scale
  3980. Set scale used by gain. Acceptable values are:
  3981. @table @option
  3982. @item linlin
  3983. linear frequency, linear gain
  3984. @item linlog
  3985. linear frequency, logarithmic (in dB) gain (default)
  3986. @item loglin
  3987. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3988. @item loglog
  3989. logarithmic frequency, logarithmic gain
  3990. @end table
  3991. @item dumpfile
  3992. Set file for dumping, suitable for gnuplot.
  3993. @item dumpscale
  3994. Set scale for dumpfile. Acceptable values are same with scale option.
  3995. Default is linlog.
  3996. @item fft2
  3997. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3998. Default is disabled.
  3999. @item min_phase
  4000. Enable minimum phase impulse response. Default is disabled.
  4001. @end table
  4002. @subsection Examples
  4003. @itemize
  4004. @item
  4005. lowpass at 1000 Hz:
  4006. @example
  4007. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  4008. @end example
  4009. @item
  4010. lowpass at 1000 Hz with gain_entry:
  4011. @example
  4012. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  4013. @end example
  4014. @item
  4015. custom equalization:
  4016. @example
  4017. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  4018. @end example
  4019. @item
  4020. higher delay with zero phase to compensate delay:
  4021. @example
  4022. firequalizer=delay=0.1:fixed=on:zero_phase=on
  4023. @end example
  4024. @item
  4025. lowpass on left channel, highpass on right channel:
  4026. @example
  4027. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  4028. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  4029. @end example
  4030. @end itemize
  4031. @section flanger
  4032. Apply a flanging effect to the audio.
  4033. The filter accepts the following options:
  4034. @table @option
  4035. @item delay
  4036. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  4037. @item depth
  4038. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  4039. @item regen
  4040. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  4041. Default value is 0.
  4042. @item width
  4043. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  4044. Default value is 71.
  4045. @item speed
  4046. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  4047. @item shape
  4048. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  4049. Default value is @var{sinusoidal}.
  4050. @item phase
  4051. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  4052. Default value is 25.
  4053. @item interp
  4054. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  4055. Default is @var{linear}.
  4056. @end table
  4057. @section haas
  4058. Apply Haas effect to audio.
  4059. Note that this makes most sense to apply on mono signals.
  4060. With this filter applied to mono signals it give some directionality and
  4061. stretches its stereo image.
  4062. The filter accepts the following options:
  4063. @table @option
  4064. @item level_in
  4065. Set input level. By default is @var{1}, or 0dB
  4066. @item level_out
  4067. Set output level. By default is @var{1}, or 0dB.
  4068. @item side_gain
  4069. Set gain applied to side part of signal. By default is @var{1}.
  4070. @item middle_source
  4071. Set kind of middle source. Can be one of the following:
  4072. @table @samp
  4073. @item left
  4074. Pick left channel.
  4075. @item right
  4076. Pick right channel.
  4077. @item mid
  4078. Pick middle part signal of stereo image.
  4079. @item side
  4080. Pick side part signal of stereo image.
  4081. @end table
  4082. @item middle_phase
  4083. Change middle phase. By default is disabled.
  4084. @item left_delay
  4085. Set left channel delay. By default is @var{2.05} milliseconds.
  4086. @item left_balance
  4087. Set left channel balance. By default is @var{-1}.
  4088. @item left_gain
  4089. Set left channel gain. By default is @var{1}.
  4090. @item left_phase
  4091. Change left phase. By default is disabled.
  4092. @item right_delay
  4093. Set right channel delay. By defaults is @var{2.12} milliseconds.
  4094. @item right_balance
  4095. Set right channel balance. By default is @var{1}.
  4096. @item right_gain
  4097. Set right channel gain. By default is @var{1}.
  4098. @item right_phase
  4099. Change right phase. By default is enabled.
  4100. @end table
  4101. @section hdcd
  4102. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  4103. embedded HDCD codes is expanded into a 20-bit PCM stream.
  4104. The filter supports the Peak Extend and Low-level Gain Adjustment features
  4105. of HDCD, and detects the Transient Filter flag.
  4106. @example
  4107. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  4108. @end example
  4109. When using the filter with wav, note the default encoding for wav is 16-bit,
  4110. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  4111. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  4112. @example
  4113. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  4114. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  4115. @end example
  4116. The filter accepts the following options:
  4117. @table @option
  4118. @item disable_autoconvert
  4119. Disable any automatic format conversion or resampling in the filter graph.
  4120. @item process_stereo
  4121. Process the stereo channels together. If target_gain does not match between
  4122. channels, consider it invalid and use the last valid target_gain.
  4123. @item cdt_ms
  4124. Set the code detect timer period in ms.
  4125. @item force_pe
  4126. Always extend peaks above -3dBFS even if PE isn't signaled.
  4127. @item analyze_mode
  4128. Replace audio with a solid tone and adjust the amplitude to signal some
  4129. specific aspect of the decoding process. The output file can be loaded in
  4130. an audio editor alongside the original to aid analysis.
  4131. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  4132. Modes are:
  4133. @table @samp
  4134. @item 0, off
  4135. Disabled
  4136. @item 1, lle
  4137. Gain adjustment level at each sample
  4138. @item 2, pe
  4139. Samples where peak extend occurs
  4140. @item 3, cdt
  4141. Samples where the code detect timer is active
  4142. @item 4, tgm
  4143. Samples where the target gain does not match between channels
  4144. @end table
  4145. @end table
  4146. @section headphone
  4147. Apply head-related transfer functions (HRTFs) to create virtual
  4148. loudspeakers around the user for binaural listening via headphones.
  4149. The HRIRs are provided via additional streams, for each channel
  4150. one stereo input stream is needed.
  4151. The filter accepts the following options:
  4152. @table @option
  4153. @item map
  4154. Set mapping of input streams for convolution.
  4155. The argument is a '|'-separated list of channel names in order as they
  4156. are given as additional stream inputs for filter.
  4157. This also specify number of input streams. Number of input streams
  4158. must be not less than number of channels in first stream plus one.
  4159. @item gain
  4160. Set gain applied to audio. Value is in dB. Default is 0.
  4161. @item type
  4162. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4163. processing audio in time domain which is slow.
  4164. @var{freq} is processing audio in frequency domain which is fast.
  4165. Default is @var{freq}.
  4166. @item lfe
  4167. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4168. @item size
  4169. Set size of frame in number of samples which will be processed at once.
  4170. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  4171. @item hrir
  4172. Set format of hrir stream.
  4173. Default value is @var{stereo}. Alternative value is @var{multich}.
  4174. If value is set to @var{stereo}, number of additional streams should
  4175. be greater or equal to number of input channels in first input stream.
  4176. Also each additional stream should have stereo number of channels.
  4177. If value is set to @var{multich}, number of additional streams should
  4178. be exactly one. Also number of input channels of additional stream
  4179. should be equal or greater than twice number of channels of first input
  4180. stream.
  4181. @end table
  4182. @subsection Examples
  4183. @itemize
  4184. @item
  4185. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4186. each amovie filter use stereo file with IR coefficients as input.
  4187. The files give coefficients for each position of virtual loudspeaker:
  4188. @example
  4189. ffmpeg -i input.wav
  4190. -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"
  4191. output.wav
  4192. @end example
  4193. @item
  4194. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4195. but now in @var{multich} @var{hrir} format.
  4196. @example
  4197. 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"
  4198. output.wav
  4199. @end example
  4200. @end itemize
  4201. @section highpass
  4202. Apply a high-pass filter with 3dB point frequency.
  4203. The filter can be either single-pole, or double-pole (the default).
  4204. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4205. The filter accepts the following options:
  4206. @table @option
  4207. @item frequency, f
  4208. Set frequency in Hz. Default is 3000.
  4209. @item poles, p
  4210. Set number of poles. Default is 2.
  4211. @item width_type, t
  4212. Set method to specify band-width of filter.
  4213. @table @option
  4214. @item h
  4215. Hz
  4216. @item q
  4217. Q-Factor
  4218. @item o
  4219. octave
  4220. @item s
  4221. slope
  4222. @item k
  4223. kHz
  4224. @end table
  4225. @item width, w
  4226. Specify the band-width of a filter in width_type units.
  4227. Applies only to double-pole filter.
  4228. The default is 0.707q and gives a Butterworth response.
  4229. @item mix, m
  4230. How much to use filtered signal in output. Default is 1.
  4231. Range is between 0 and 1.
  4232. @item channels, c
  4233. Specify which channels to filter, by default all available are filtered.
  4234. @item normalize, n
  4235. Normalize biquad coefficients, by default is disabled.
  4236. Enabling it will normalize magnitude response at DC to 0dB.
  4237. @item transform, a
  4238. Set transform type of IIR filter.
  4239. @table @option
  4240. @item di
  4241. @item dii
  4242. @item tdi
  4243. @item tdii
  4244. @item latt
  4245. @item svf
  4246. @item zdf
  4247. @end table
  4248. @item precision, r
  4249. Set precision of filtering.
  4250. @table @option
  4251. @item auto
  4252. Pick automatic sample format depending on surround filters.
  4253. @item s16
  4254. Always use signed 16-bit.
  4255. @item s32
  4256. Always use signed 32-bit.
  4257. @item f32
  4258. Always use float 32-bit.
  4259. @item f64
  4260. Always use float 64-bit.
  4261. @end table
  4262. @item block_size, b
  4263. Set block size used for reverse IIR processing. If this value is set to high enough
  4264. value (higher than impulse response length truncated when reaches near zero values) filtering
  4265. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4266. Note that filter delay will be exactly this many samples when set to non-zero value.
  4267. @end table
  4268. @subsection Commands
  4269. This filter supports the following commands:
  4270. @table @option
  4271. @item frequency, f
  4272. Change highpass frequency.
  4273. Syntax for the command is : "@var{frequency}"
  4274. @item width_type, t
  4275. Change highpass width_type.
  4276. Syntax for the command is : "@var{width_type}"
  4277. @item width, w
  4278. Change highpass width.
  4279. Syntax for the command is : "@var{width}"
  4280. @item mix, m
  4281. Change highpass mix.
  4282. Syntax for the command is : "@var{mix}"
  4283. @end table
  4284. @section join
  4285. Join multiple input streams into one multi-channel stream.
  4286. It accepts the following parameters:
  4287. @table @option
  4288. @item inputs
  4289. The number of input streams. It defaults to 2.
  4290. @item channel_layout
  4291. The desired output channel layout. It defaults to stereo.
  4292. @item map
  4293. Map channels from inputs to output. The argument is a '|'-separated list of
  4294. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  4295. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  4296. can be either the name of the input channel (e.g. FL for front left) or its
  4297. index in the specified input stream. @var{out_channel} is the name of the output
  4298. channel.
  4299. @end table
  4300. The filter will attempt to guess the mappings when they are not specified
  4301. explicitly. It does so by first trying to find an unused matching input channel
  4302. and if that fails it picks the first unused input channel.
  4303. Join 3 inputs (with properly set channel layouts):
  4304. @example
  4305. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  4306. @end example
  4307. Build a 5.1 output from 6 single-channel streams:
  4308. @example
  4309. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  4310. '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'
  4311. out
  4312. @end example
  4313. @section ladspa
  4314. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  4315. To enable compilation of this filter you need to configure FFmpeg with
  4316. @code{--enable-ladspa}.
  4317. @table @option
  4318. @item file, f
  4319. Specifies the name of LADSPA plugin library to load. If the environment
  4320. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  4321. each one of the directories specified by the colon separated list in
  4322. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  4323. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  4324. @file{/usr/lib/ladspa/}.
  4325. @item plugin, p
  4326. Specifies the plugin within the library. Some libraries contain only
  4327. one plugin, but others contain many of them. If this is not set filter
  4328. will list all available plugins within the specified library.
  4329. @item controls, c
  4330. Set the '|' separated list of controls which are zero or more floating point
  4331. values that determine the behavior of the loaded plugin (for example delay,
  4332. threshold or gain).
  4333. Controls need to be defined using the following syntax:
  4334. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  4335. @var{valuei} is the value set on the @var{i}-th control.
  4336. Alternatively they can be also defined using the following syntax:
  4337. @var{value0}|@var{value1}|@var{value2}|..., where
  4338. @var{valuei} is the value set on the @var{i}-th control.
  4339. If @option{controls} is set to @code{help}, all available controls and
  4340. their valid ranges are printed.
  4341. @item sample_rate, s
  4342. Specify the sample rate, default to 44100. Only used if plugin have
  4343. zero inputs.
  4344. @item nb_samples, n
  4345. Set the number of samples per channel per each output frame, default
  4346. is 1024. Only used if plugin have zero inputs.
  4347. @item duration, d
  4348. Set the minimum duration of the sourced audio. See
  4349. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4350. for the accepted syntax.
  4351. Note that the resulting duration may be greater than the specified duration,
  4352. as the generated audio is always cut at the end of a complete frame.
  4353. If not specified, or the expressed duration is negative, the audio is
  4354. supposed to be generated forever.
  4355. Only used if plugin have zero inputs.
  4356. @item latency, l
  4357. Enable latency compensation, by default is disabled.
  4358. Only used if plugin have inputs.
  4359. @end table
  4360. @subsection Examples
  4361. @itemize
  4362. @item
  4363. List all available plugins within amp (LADSPA example plugin) library:
  4364. @example
  4365. ladspa=file=amp
  4366. @end example
  4367. @item
  4368. List all available controls and their valid ranges for @code{vcf_notch}
  4369. plugin from @code{VCF} library:
  4370. @example
  4371. ladspa=f=vcf:p=vcf_notch:c=help
  4372. @end example
  4373. @item
  4374. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4375. plugin library:
  4376. @example
  4377. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4378. @end example
  4379. @item
  4380. Add reverberation to the audio using TAP-plugins
  4381. (Tom's Audio Processing plugins):
  4382. @example
  4383. ladspa=file=tap_reverb:tap_reverb
  4384. @end example
  4385. @item
  4386. Generate white noise, with 0.2 amplitude:
  4387. @example
  4388. ladspa=file=cmt:noise_source_white:c=c0=.2
  4389. @end example
  4390. @item
  4391. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4392. @code{C* Audio Plugin Suite} (CAPS) library:
  4393. @example
  4394. ladspa=file=caps:Click:c=c1=20'
  4395. @end example
  4396. @item
  4397. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4398. @example
  4399. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4400. @end example
  4401. @item
  4402. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4403. @code{SWH Plugins} collection:
  4404. @example
  4405. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4406. @end example
  4407. @item
  4408. Attenuate low frequencies using Multiband EQ from Steve Harris
  4409. @code{SWH Plugins} collection:
  4410. @example
  4411. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4412. @end example
  4413. @item
  4414. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4415. (CAPS) library:
  4416. @example
  4417. ladspa=caps:Narrower
  4418. @end example
  4419. @item
  4420. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4421. @example
  4422. ladspa=caps:White:.2
  4423. @end example
  4424. @item
  4425. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4426. @example
  4427. ladspa=caps:Fractal:c=c1=1
  4428. @end example
  4429. @item
  4430. Dynamic volume normalization using @code{VLevel} plugin:
  4431. @example
  4432. ladspa=vlevel-ladspa:vlevel_mono
  4433. @end example
  4434. @end itemize
  4435. @subsection Commands
  4436. This filter supports the following commands:
  4437. @table @option
  4438. @item cN
  4439. Modify the @var{N}-th control value.
  4440. If the specified value is not valid, it is ignored and prior one is kept.
  4441. @end table
  4442. @section loudnorm
  4443. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4444. Support for both single pass (livestreams, files) and double pass (files) modes.
  4445. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4446. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4447. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4448. The filter accepts the following options:
  4449. @table @option
  4450. @item I, i
  4451. Set integrated loudness target.
  4452. Range is -70.0 - -5.0. Default value is -24.0.
  4453. @item LRA, lra
  4454. Set loudness range target.
  4455. Range is 1.0 - 50.0. Default value is 7.0.
  4456. @item TP, tp
  4457. Set maximum true peak.
  4458. Range is -9.0 - +0.0. Default value is -2.0.
  4459. @item measured_I, measured_i
  4460. Measured IL of input file.
  4461. Range is -99.0 - +0.0.
  4462. @item measured_LRA, measured_lra
  4463. Measured LRA of input file.
  4464. Range is 0.0 - 99.0.
  4465. @item measured_TP, measured_tp
  4466. Measured true peak of input file.
  4467. Range is -99.0 - +99.0.
  4468. @item measured_thresh
  4469. Measured threshold of input file.
  4470. Range is -99.0 - +0.0.
  4471. @item offset
  4472. Set offset gain. Gain is applied before the true-peak limiter.
  4473. Range is -99.0 - +99.0. Default is +0.0.
  4474. @item linear
  4475. Normalize by linearly scaling the source audio.
  4476. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4477. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4478. be lower than source LRA and the change in integrated loudness shouldn't
  4479. result in a true peak which exceeds the target TP. If any of these
  4480. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4481. Options are @code{true} or @code{false}. Default is @code{true}.
  4482. @item dual_mono
  4483. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4484. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4485. If set to @code{true}, this option will compensate for this effect.
  4486. Multi-channel input files are not affected by this option.
  4487. Options are true or false. Default is false.
  4488. @item print_format
  4489. Set print format for stats. Options are summary, json, or none.
  4490. Default value is none.
  4491. @end table
  4492. @section lowpass
  4493. Apply a low-pass filter with 3dB point frequency.
  4494. The filter can be either single-pole or double-pole (the default).
  4495. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4496. The filter accepts the following options:
  4497. @table @option
  4498. @item frequency, f
  4499. Set frequency in Hz. Default is 500.
  4500. @item poles, p
  4501. Set number of poles. Default is 2.
  4502. @item width_type, t
  4503. Set method to specify band-width of filter.
  4504. @table @option
  4505. @item h
  4506. Hz
  4507. @item q
  4508. Q-Factor
  4509. @item o
  4510. octave
  4511. @item s
  4512. slope
  4513. @item k
  4514. kHz
  4515. @end table
  4516. @item width, w
  4517. Specify the band-width of a filter in width_type units.
  4518. Applies only to double-pole filter.
  4519. The default is 0.707q and gives a Butterworth response.
  4520. @item mix, m
  4521. How much to use filtered signal in output. Default is 1.
  4522. Range is between 0 and 1.
  4523. @item channels, c
  4524. Specify which channels to filter, by default all available are filtered.
  4525. @item normalize, n
  4526. Normalize biquad coefficients, by default is disabled.
  4527. Enabling it will normalize magnitude response at DC to 0dB.
  4528. @item transform, a
  4529. Set transform type of IIR filter.
  4530. @table @option
  4531. @item di
  4532. @item dii
  4533. @item tdi
  4534. @item tdii
  4535. @item latt
  4536. @item svf
  4537. @item zdf
  4538. @end table
  4539. @item precision, r
  4540. Set precision of filtering.
  4541. @table @option
  4542. @item auto
  4543. Pick automatic sample format depending on surround filters.
  4544. @item s16
  4545. Always use signed 16-bit.
  4546. @item s32
  4547. Always use signed 32-bit.
  4548. @item f32
  4549. Always use float 32-bit.
  4550. @item f64
  4551. Always use float 64-bit.
  4552. @end table
  4553. @item block_size, b
  4554. Set block size used for reverse IIR processing. If this value is set to high enough
  4555. value (higher than impulse response length truncated when reaches near zero values) filtering
  4556. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4557. Note that filter delay will be exactly this many samples when set to non-zero value.
  4558. @end table
  4559. @subsection Examples
  4560. @itemize
  4561. @item
  4562. Lowpass only LFE channel, it LFE is not present it does nothing:
  4563. @example
  4564. lowpass=c=LFE
  4565. @end example
  4566. @end itemize
  4567. @subsection Commands
  4568. This filter supports the following commands:
  4569. @table @option
  4570. @item frequency, f
  4571. Change lowpass frequency.
  4572. Syntax for the command is : "@var{frequency}"
  4573. @item width_type, t
  4574. Change lowpass width_type.
  4575. Syntax for the command is : "@var{width_type}"
  4576. @item width, w
  4577. Change lowpass width.
  4578. Syntax for the command is : "@var{width}"
  4579. @item mix, m
  4580. Change lowpass mix.
  4581. Syntax for the command is : "@var{mix}"
  4582. @end table
  4583. @section lv2
  4584. Load a LV2 (LADSPA Version 2) plugin.
  4585. To enable compilation of this filter you need to configure FFmpeg with
  4586. @code{--enable-lv2}.
  4587. @table @option
  4588. @item plugin, p
  4589. Specifies the plugin URI. You may need to escape ':'.
  4590. @item controls, c
  4591. Set the '|' separated list of controls which are zero or more floating point
  4592. values that determine the behavior of the loaded plugin (for example delay,
  4593. threshold or gain).
  4594. If @option{controls} is set to @code{help}, all available controls and
  4595. their valid ranges are printed.
  4596. @item sample_rate, s
  4597. Specify the sample rate, default to 44100. Only used if plugin have
  4598. zero inputs.
  4599. @item nb_samples, n
  4600. Set the number of samples per channel per each output frame, default
  4601. is 1024. Only used if plugin have zero inputs.
  4602. @item duration, d
  4603. Set the minimum duration of the sourced audio. See
  4604. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4605. for the accepted syntax.
  4606. Note that the resulting duration may be greater than the specified duration,
  4607. as the generated audio is always cut at the end of a complete frame.
  4608. If not specified, or the expressed duration is negative, the audio is
  4609. supposed to be generated forever.
  4610. Only used if plugin have zero inputs.
  4611. @end table
  4612. @subsection Examples
  4613. @itemize
  4614. @item
  4615. Apply bass enhancer plugin from Calf:
  4616. @example
  4617. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4618. @end example
  4619. @item
  4620. Apply vinyl plugin from Calf:
  4621. @example
  4622. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4623. @end example
  4624. @item
  4625. Apply bit crusher plugin from ArtyFX:
  4626. @example
  4627. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4628. @end example
  4629. @end itemize
  4630. @subsection Commands
  4631. This filter supports all options that are exported by plugin as commands.
  4632. @section mcompand
  4633. Multiband Compress or expand the audio's dynamic range.
  4634. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4635. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4636. response when absent compander action.
  4637. It accepts the following parameters:
  4638. @table @option
  4639. @item args
  4640. This option syntax is:
  4641. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4642. For explanation of each item refer to compand filter documentation.
  4643. @end table
  4644. @anchor{pan}
  4645. @section pan
  4646. Mix channels with specific gain levels. The filter accepts the output
  4647. channel layout followed by a set of channels definitions.
  4648. This filter is also designed to efficiently remap the channels of an audio
  4649. stream.
  4650. The filter accepts parameters of the form:
  4651. "@var{l}|@var{outdef}|@var{outdef}|..."
  4652. @table @option
  4653. @item l
  4654. output channel layout or number of channels
  4655. @item outdef
  4656. output channel specification, of the form:
  4657. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4658. @item out_name
  4659. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4660. number (c0, c1, etc.)
  4661. @item gain
  4662. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4663. @item in_name
  4664. input channel to use, see out_name for details; it is not possible to mix
  4665. named and numbered input channels
  4666. @end table
  4667. If the `=' in a channel specification is replaced by `<', then the gains for
  4668. that specification will be renormalized so that the total is 1, thus
  4669. avoiding clipping noise.
  4670. @subsection Mixing examples
  4671. For example, if you want to down-mix from stereo to mono, but with a bigger
  4672. factor for the left channel:
  4673. @example
  4674. pan=1c|c0=0.9*c0+0.1*c1
  4675. @end example
  4676. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4677. 7-channels surround:
  4678. @example
  4679. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4680. @end example
  4681. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4682. that should be preferred (see "-ac" option) unless you have very specific
  4683. needs.
  4684. @subsection Remapping examples
  4685. The channel remapping will be effective if, and only if:
  4686. @itemize
  4687. @item gain coefficients are zeroes or ones,
  4688. @item only one input per channel output,
  4689. @end itemize
  4690. If all these conditions are satisfied, the filter will notify the user ("Pure
  4691. channel mapping detected"), and use an optimized and lossless method to do the
  4692. remapping.
  4693. For example, if you have a 5.1 source and want a stereo audio stream by
  4694. dropping the extra channels:
  4695. @example
  4696. pan="stereo| c0=FL | c1=FR"
  4697. @end example
  4698. Given the same source, you can also switch front left and front right channels
  4699. and keep the input channel layout:
  4700. @example
  4701. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4702. @end example
  4703. If the input is a stereo audio stream, you can mute the front left channel (and
  4704. still keep the stereo channel layout) with:
  4705. @example
  4706. pan="stereo|c1=c1"
  4707. @end example
  4708. Still with a stereo audio stream input, you can copy the right channel in both
  4709. front left and right:
  4710. @example
  4711. pan="stereo| c0=FR | c1=FR"
  4712. @end example
  4713. @section replaygain
  4714. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4715. outputs it unchanged.
  4716. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4717. The filter accepts the following exported read-only options:
  4718. @table @option
  4719. @item track_gain
  4720. Exported track gain in dB at end of stream.
  4721. @item track_peak
  4722. Exported track peak at end of stream.
  4723. @end table
  4724. @section resample
  4725. Convert the audio sample format, sample rate and channel layout. It is
  4726. not meant to be used directly.
  4727. @section rubberband
  4728. Apply time-stretching and pitch-shifting with librubberband.
  4729. To enable compilation of this filter, you need to configure FFmpeg with
  4730. @code{--enable-librubberband}.
  4731. The filter accepts the following options:
  4732. @table @option
  4733. @item tempo
  4734. Set tempo scale factor.
  4735. @item pitch
  4736. Set pitch scale factor.
  4737. @item transients
  4738. Set transients detector.
  4739. Possible values are:
  4740. @table @var
  4741. @item crisp
  4742. @item mixed
  4743. @item smooth
  4744. @end table
  4745. @item detector
  4746. Set detector.
  4747. Possible values are:
  4748. @table @var
  4749. @item compound
  4750. @item percussive
  4751. @item soft
  4752. @end table
  4753. @item phase
  4754. Set phase.
  4755. Possible values are:
  4756. @table @var
  4757. @item laminar
  4758. @item independent
  4759. @end table
  4760. @item window
  4761. Set processing window size.
  4762. Possible values are:
  4763. @table @var
  4764. @item standard
  4765. @item short
  4766. @item long
  4767. @end table
  4768. @item smoothing
  4769. Set smoothing.
  4770. Possible values are:
  4771. @table @var
  4772. @item off
  4773. @item on
  4774. @end table
  4775. @item formant
  4776. Enable formant preservation when shift pitching.
  4777. Possible values are:
  4778. @table @var
  4779. @item shifted
  4780. @item preserved
  4781. @end table
  4782. @item pitchq
  4783. Set pitch quality.
  4784. Possible values are:
  4785. @table @var
  4786. @item quality
  4787. @item speed
  4788. @item consistency
  4789. @end table
  4790. @item channels
  4791. Set channels.
  4792. Possible values are:
  4793. @table @var
  4794. @item apart
  4795. @item together
  4796. @end table
  4797. @end table
  4798. @subsection Commands
  4799. This filter supports the following commands:
  4800. @table @option
  4801. @item tempo
  4802. Change filter tempo scale factor.
  4803. Syntax for the command is : "@var{tempo}"
  4804. @item pitch
  4805. Change filter pitch scale factor.
  4806. Syntax for the command is : "@var{pitch}"
  4807. @end table
  4808. @section sidechaincompress
  4809. This filter acts like normal compressor but has the ability to compress
  4810. detected signal using second input signal.
  4811. It needs two input streams and returns one output stream.
  4812. First input stream will be processed depending on second stream signal.
  4813. The filtered signal then can be filtered with other filters in later stages of
  4814. processing. See @ref{pan} and @ref{amerge} filter.
  4815. The filter accepts the following options:
  4816. @table @option
  4817. @item level_in
  4818. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4819. @item mode
  4820. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4821. Default is @code{downward}.
  4822. @item threshold
  4823. If a signal of second stream raises above this level it will affect the gain
  4824. reduction of first stream.
  4825. By default is 0.125. Range is between 0.00097563 and 1.
  4826. @item ratio
  4827. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4828. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4829. Default is 2. Range is between 1 and 20.
  4830. @item attack
  4831. Amount of milliseconds the signal has to rise above the threshold before gain
  4832. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4833. @item release
  4834. Amount of milliseconds the signal has to fall below the threshold before
  4835. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4836. @item makeup
  4837. Set the amount by how much signal will be amplified after processing.
  4838. Default is 1. Range is from 1 to 64.
  4839. @item knee
  4840. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4841. Default is 2.82843. Range is between 1 and 8.
  4842. @item link
  4843. Choose if the @code{average} level between all channels of side-chain stream
  4844. or the louder(@code{maximum}) channel of side-chain stream affects the
  4845. reduction. Default is @code{average}.
  4846. @item detection
  4847. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4848. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4849. @item level_sc
  4850. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4851. @item mix
  4852. How much to use compressed signal in output. Default is 1.
  4853. Range is between 0 and 1.
  4854. @end table
  4855. @subsection Commands
  4856. This filter supports the all above options as @ref{commands}.
  4857. @subsection Examples
  4858. @itemize
  4859. @item
  4860. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4861. depending on the signal of 2nd input and later compressed signal to be
  4862. merged with 2nd input:
  4863. @example
  4864. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4865. @end example
  4866. @end itemize
  4867. @section sidechaingate
  4868. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4869. filter the detected signal before sending it to the gain reduction stage.
  4870. Normally a gate uses the full range signal to detect a level above the
  4871. threshold.
  4872. For example: If you cut all lower frequencies from your sidechain signal
  4873. the gate will decrease the volume of your track only if not enough highs
  4874. appear. With this technique you are able to reduce the resonation of a
  4875. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4876. guitar.
  4877. It needs two input streams and returns one output stream.
  4878. First input stream will be processed depending on second stream signal.
  4879. The filter accepts the following options:
  4880. @table @option
  4881. @item level_in
  4882. Set input level before filtering.
  4883. Default is 1. Allowed range is from 0.015625 to 64.
  4884. @item mode
  4885. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4886. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4887. will be amplified, expanding dynamic range in upward direction.
  4888. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4889. @item range
  4890. Set the level of gain reduction when the signal is below the threshold.
  4891. Default is 0.06125. Allowed range is from 0 to 1.
  4892. Setting this to 0 disables reduction and then filter behaves like expander.
  4893. @item threshold
  4894. If a signal rises above this level the gain reduction is released.
  4895. Default is 0.125. Allowed range is from 0 to 1.
  4896. @item ratio
  4897. Set a ratio about which the signal is reduced.
  4898. Default is 2. Allowed range is from 1 to 9000.
  4899. @item attack
  4900. Amount of milliseconds the signal has to rise above the threshold before gain
  4901. reduction stops.
  4902. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4903. @item release
  4904. Amount of milliseconds the signal has to fall below the threshold before the
  4905. reduction is increased again. Default is 250 milliseconds.
  4906. Allowed range is from 0.01 to 9000.
  4907. @item makeup
  4908. Set amount of amplification of signal after processing.
  4909. Default is 1. Allowed range is from 1 to 64.
  4910. @item knee
  4911. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4912. Default is 2.828427125. Allowed range is from 1 to 8.
  4913. @item detection
  4914. Choose if exact signal should be taken for detection or an RMS like one.
  4915. Default is rms. Can be peak or rms.
  4916. @item link
  4917. Choose if the average level between all channels or the louder channel affects
  4918. the reduction.
  4919. Default is average. Can be average or maximum.
  4920. @item level_sc
  4921. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4922. @end table
  4923. @subsection Commands
  4924. This filter supports the all above options as @ref{commands}.
  4925. @section silencedetect
  4926. Detect silence in an audio stream.
  4927. This filter logs a message when it detects that the input audio volume is less
  4928. or equal to a noise tolerance value for a duration greater or equal to the
  4929. minimum detected noise duration.
  4930. The printed times and duration are expressed in seconds. The
  4931. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4932. is set on the first frame whose timestamp equals or exceeds the detection
  4933. duration and it contains the timestamp of the first frame of the silence.
  4934. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4935. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4936. keys are set on the first frame after the silence. If @option{mono} is
  4937. enabled, and each channel is evaluated separately, the @code{.X}
  4938. suffixed keys are used, and @code{X} corresponds to the channel number.
  4939. The filter accepts the following options:
  4940. @table @option
  4941. @item noise, n
  4942. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4943. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4944. @item duration, d
  4945. Set silence duration until notification (default is 2 seconds). See
  4946. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4947. for the accepted syntax.
  4948. @item mono, m
  4949. Process each channel separately, instead of combined. By default is disabled.
  4950. @end table
  4951. @subsection Examples
  4952. @itemize
  4953. @item
  4954. Detect 5 seconds of silence with -50dB noise tolerance:
  4955. @example
  4956. silencedetect=n=-50dB:d=5
  4957. @end example
  4958. @item
  4959. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4960. tolerance in @file{silence.mp3}:
  4961. @example
  4962. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4963. @end example
  4964. @end itemize
  4965. @section silenceremove
  4966. Remove silence from the beginning, middle or end of the audio.
  4967. The filter accepts the following options:
  4968. @table @option
  4969. @item start_periods
  4970. This value is used to indicate if audio should be trimmed at beginning of
  4971. the audio. A value of zero indicates no silence should be trimmed from the
  4972. beginning. When specifying a non-zero value, it trims audio up until it
  4973. finds non-silence. Normally, when trimming silence from beginning of audio
  4974. the @var{start_periods} will be @code{1} but it can be increased to higher
  4975. values to trim all audio up to specific count of non-silence periods.
  4976. Default value is @code{0}.
  4977. @item start_duration
  4978. Specify the amount of time that non-silence must be detected before it stops
  4979. trimming audio. By increasing the duration, bursts of noises can be treated
  4980. as silence and trimmed off. Default value is @code{0}.
  4981. @item start_threshold
  4982. This indicates what sample value should be treated as silence. For digital
  4983. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4984. you may wish to increase the value to account for background noise.
  4985. Can be specified in dB (in case "dB" is appended to the specified value)
  4986. or amplitude ratio. Default value is @code{0}.
  4987. @item start_silence
  4988. Specify max duration of silence at beginning that will be kept after
  4989. trimming. Default is 0, which is equal to trimming all samples detected
  4990. as silence.
  4991. @item start_mode
  4992. Specify mode of detection of silence end at start of multi-channel audio.
  4993. Can be @var{any} or @var{all}. Default is @var{any}.
  4994. With @var{any}, any sample from any channel that is detected as non-silence
  4995. will trigger end of silence trimming at start of audio stream.
  4996. With @var{all}, only if every sample from every channel is detected as non-silence
  4997. will trigger end of silence trimming at start of audio stream, limited usage.
  4998. @item stop_periods
  4999. Set the count for trimming silence from the end of audio. When specifying a
  5000. positive value, it trims audio after it finds specified silence period.
  5001. To remove silence from the middle of a file, specify a @var{stop_periods}
  5002. that is negative. This value is then treated as a positive value and is
  5003. used to indicate the effect should restart processing as specified by
  5004. @var{stop_periods}, making it suitable for removing periods of silence
  5005. in the middle of the audio.
  5006. Default value is @code{0}.
  5007. @item stop_duration
  5008. Specify a duration of silence that must exist before audio is not copied any
  5009. more. By specifying a higher duration, silence that is wanted can be left in
  5010. the audio.
  5011. Default value is @code{0}.
  5012. @item stop_threshold
  5013. This is the same as @option{start_threshold} but for trimming silence from
  5014. the end of audio.
  5015. Can be specified in dB (in case "dB" is appended to the specified value)
  5016. or amplitude ratio. Default value is @code{0}.
  5017. @item stop_silence
  5018. Specify max duration of silence at end that will be kept after
  5019. trimming. Default is 0, which is equal to trimming all samples detected
  5020. as silence.
  5021. @item stop_mode
  5022. Specify mode of detection of silence start after start of multi-channel audio.
  5023. Can be @var{any} or @var{all}. Default is @var{all}.
  5024. With @var{any}, any sample from any channel that is detected as silence
  5025. will trigger start of silence trimming after start of audio stream, limited usage.
  5026. With @var{all}, only if every sample from every channel is detected as silence
  5027. will trigger start of silence trimming after start of audio stream.
  5028. @item detection
  5029. Set how is silence detected.
  5030. @table @option
  5031. @item avg
  5032. Mean of absolute values of samples in moving window.
  5033. @item rms
  5034. Root squared mean of absolute values of samples in moving window.
  5035. @item peak
  5036. Maximum of absolute values of samples in moving window.
  5037. @item median
  5038. Median of absolute values of samples in moving window.
  5039. @item ptp
  5040. Absolute of max peak to min peak difference of samples in moving window.
  5041. @item dev
  5042. Standard deviation of values of samples in moving window.
  5043. @end table
  5044. Default value is @code{rms}.
  5045. @item window
  5046. Set duration in number of seconds used to calculate size of window in number
  5047. of samples for detecting silence. Using @code{0} will effectively disable
  5048. any windowing and use only single sample per channel for silence detection.
  5049. In that case it may be needed to also set @option{start_silence} and/or
  5050. @option{stop_silence} to nonzero values with also @option{start_duration} and/or
  5051. @option{stop_duration} to nonzero values.
  5052. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  5053. @item timestamp
  5054. Set processing mode of every audio frame output timestamp.
  5055. @table @option
  5056. @item write
  5057. Full timestamps rewrite, keep only the start time for the first output frame.
  5058. @item copy
  5059. Non-dropped frames are left with same timestamp as input audio frame.
  5060. @end table
  5061. Defaults value is @code{write}.
  5062. @end table
  5063. @subsection Examples
  5064. @itemize
  5065. @item
  5066. The following example shows how this filter can be used to start a recording
  5067. that does not contain the delay at the start which usually occurs between
  5068. pressing the record button and the start of the performance:
  5069. @example
  5070. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  5071. @end example
  5072. @item
  5073. Trim all silence encountered from beginning to end where there is more than 1
  5074. second of silence in audio:
  5075. @example
  5076. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  5077. @end example
  5078. @item
  5079. Trim all digital silence samples, using peak detection, from beginning to end
  5080. where there is more than 0 samples of digital silence in audio and digital
  5081. silence is detected in all channels at same positions in stream:
  5082. @example
  5083. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  5084. @end example
  5085. @item
  5086. Trim every 2nd encountered silence period from beginning to end where there is
  5087. more than 1 second of silence per silence period in audio:
  5088. @example
  5089. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB
  5090. @end example
  5091. @item
  5092. Similar as above, but keep maximum of 0.5 seconds of silence from each trimmed period:
  5093. @example
  5094. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB:stop_silence=0.5
  5095. @end example
  5096. @item
  5097. Similar as above, but keep maximum of 1.5 seconds of silence from start of audio:
  5098. @example
  5099. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB:stop_silence=0.5:start_periods=1:start_duration=1:start_silence=1.5:stop_threshold=-90dB
  5100. @end example
  5101. @end itemize
  5102. @subsection Commands
  5103. This filter supports some above options as @ref{commands}.
  5104. @section sofalizer
  5105. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  5106. loudspeakers around the user for binaural listening via headphones (audio
  5107. formats up to 9 channels supported).
  5108. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  5109. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  5110. Austrian Academy of Sciences.
  5111. To enable compilation of this filter you need to configure FFmpeg with
  5112. @code{--enable-libmysofa}.
  5113. The filter accepts the following options:
  5114. @table @option
  5115. @item sofa
  5116. Set the SOFA file used for rendering.
  5117. @item gain
  5118. Set gain applied to audio. Value is in dB. Default is 0.
  5119. @item rotation
  5120. Set rotation of virtual loudspeakers in deg. Default is 0.
  5121. @item elevation
  5122. Set elevation of virtual speakers in deg. Default is 0.
  5123. @item radius
  5124. Set distance in meters between loudspeakers and the listener with near-field
  5125. HRTFs. Default is 1.
  5126. @item type
  5127. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  5128. processing audio in time domain which is slow.
  5129. @var{freq} is processing audio in frequency domain which is fast.
  5130. Default is @var{freq}.
  5131. @item speakers
  5132. Set custom positions of virtual loudspeakers. Syntax for this option is:
  5133. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  5134. Each virtual loudspeaker is described with short channel name following with
  5135. azimuth and elevation in degrees.
  5136. Each virtual loudspeaker description is separated by '|'.
  5137. For example to override front left and front right channel positions use:
  5138. 'speakers=FL 45 15|FR 345 15'.
  5139. Descriptions with unrecognised channel names are ignored.
  5140. @item lfegain
  5141. Set custom gain for LFE channels. Value is in dB. Default is 0.
  5142. @item framesize
  5143. Set custom frame size in number of samples. Default is 1024.
  5144. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  5145. is set to @var{freq}.
  5146. @item normalize
  5147. Should all IRs be normalized upon importing SOFA file.
  5148. By default is enabled.
  5149. @item interpolate
  5150. Should nearest IRs be interpolated with neighbor IRs if exact position
  5151. does not match. By default is disabled.
  5152. @item minphase
  5153. Minphase all IRs upon loading of SOFA file. By default is disabled.
  5154. @item anglestep
  5155. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  5156. @item radstep
  5157. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  5158. @end table
  5159. @subsection Examples
  5160. @itemize
  5161. @item
  5162. Using ClubFritz6 sofa file:
  5163. @example
  5164. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  5165. @end example
  5166. @item
  5167. Using ClubFritz12 sofa file and bigger radius with small rotation:
  5168. @example
  5169. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  5170. @end example
  5171. @item
  5172. Similar as above but with custom speaker positions for front left, front right, back left and back right
  5173. and also with custom gain:
  5174. @example
  5175. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  5176. @end example
  5177. @end itemize
  5178. @section speechnorm
  5179. Speech Normalizer.
  5180. This filter expands or compresses each half-cycle of audio samples
  5181. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  5182. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  5183. The filter accepts the following options:
  5184. @table @option
  5185. @item peak, p
  5186. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  5187. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  5188. @item expansion, e
  5189. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5190. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  5191. would be such that local peak value reaches target peak value but never to surpass it and that
  5192. ratio between new and previous peak value does not surpass this option value.
  5193. @item compression, c
  5194. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5195. This option controls maximum local half-cycle of samples compression. This option is used
  5196. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  5197. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  5198. that peak's half-cycle will be compressed by current compression factor.
  5199. @item threshold, t
  5200. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  5201. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  5202. Any half-cycle samples with their local peak value below or same as this option value will be
  5203. compressed by current compression factor, otherwise, if greater than threshold value they will be
  5204. expanded with expansion factor so that it could reach peak target value but never surpass it.
  5205. @item raise, r
  5206. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  5207. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  5208. each new half-cycle until it reaches @option{expansion} value.
  5209. Setting this options too high may lead to distortions.
  5210. @item fall, f
  5211. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  5212. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  5213. each new half-cycle until it reaches @option{compression} value.
  5214. @item channels, h
  5215. Specify which channels to filter, by default all available channels are filtered.
  5216. @item invert, i
  5217. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  5218. option. When enabled any half-cycle of samples with their local peak value below or same as
  5219. @option{threshold} option will be expanded otherwise it will be compressed.
  5220. @item link, l
  5221. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  5222. When disabled each filtered channel gain calculation is independent, otherwise when this option
  5223. is enabled the minimum of all possible gains for each filtered channel is used.
  5224. @item rms, m
  5225. Set the expansion target RMS value. This specifies the highest allowed RMS level for the normalized
  5226. audio input. Default value is 0.0, thus disabled. Allowed range is from 0.0 to 1.0.
  5227. @end table
  5228. @subsection Commands
  5229. This filter supports the all above options as @ref{commands}.
  5230. @subsection Examples
  5231. @itemize
  5232. @item
  5233. Weak and slow amplification:
  5234. @example
  5235. speechnorm=e=3:r=0.00001:l=1
  5236. @end example
  5237. @item
  5238. Moderate and slow amplification:
  5239. @example
  5240. speechnorm=e=6.25:r=0.00001:l=1
  5241. @end example
  5242. @item
  5243. Strong and fast amplification:
  5244. @example
  5245. speechnorm=e=12.5:r=0.0001:l=1
  5246. @end example
  5247. @item
  5248. Very strong and fast amplification:
  5249. @example
  5250. speechnorm=e=25:r=0.0001:l=1
  5251. @end example
  5252. @item
  5253. Extreme and fast amplification:
  5254. @example
  5255. speechnorm=e=50:r=0.0001:l=1
  5256. @end example
  5257. @end itemize
  5258. @section stereotools
  5259. This filter has some handy utilities to manage stereo signals, for converting
  5260. M/S stereo recordings to L/R signal while having control over the parameters
  5261. or spreading the stereo image of master track.
  5262. The filter accepts the following options:
  5263. @table @option
  5264. @item level_in
  5265. Set input level before filtering for both channels. Defaults is 1.
  5266. Allowed range is from 0.015625 to 64.
  5267. @item level_out
  5268. Set output level after filtering for both channels. Defaults is 1.
  5269. Allowed range is from 0.015625 to 64.
  5270. @item balance_in
  5271. Set input balance between both channels. Default is 0.
  5272. Allowed range is from -1 to 1.
  5273. @item balance_out
  5274. Set output balance between both channels. Default is 0.
  5275. Allowed range is from -1 to 1.
  5276. @item softclip
  5277. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  5278. clipping. Disabled by default.
  5279. @item mutel
  5280. Mute the left channel. Disabled by default.
  5281. @item muter
  5282. Mute the right channel. Disabled by default.
  5283. @item phasel
  5284. Change the phase of the left channel. Disabled by default.
  5285. @item phaser
  5286. Change the phase of the right channel. Disabled by default.
  5287. @item mode
  5288. Set stereo mode. Available values are:
  5289. @table @samp
  5290. @item lr>lr
  5291. Left/Right to Left/Right, this is default.
  5292. @item lr>ms
  5293. Left/Right to Mid/Side.
  5294. @item ms>lr
  5295. Mid/Side to Left/Right.
  5296. @item lr>ll
  5297. Left/Right to Left/Left.
  5298. @item lr>rr
  5299. Left/Right to Right/Right.
  5300. @item lr>l+r
  5301. Left/Right to Left + Right.
  5302. @item lr>rl
  5303. Left/Right to Right/Left.
  5304. @item ms>ll
  5305. Mid/Side to Left/Left.
  5306. @item ms>rr
  5307. Mid/Side to Right/Right.
  5308. @item ms>rl
  5309. Mid/Side to Right/Left.
  5310. @item lr>l-r
  5311. Left/Right to Left - Right.
  5312. @end table
  5313. @item slev
  5314. Set level of side signal. Default is 1.
  5315. Allowed range is from 0.015625 to 64.
  5316. @item sbal
  5317. Set balance of side signal. Default is 0.
  5318. Allowed range is from -1 to 1.
  5319. @item mlev
  5320. Set level of the middle signal. Default is 1.
  5321. Allowed range is from 0.015625 to 64.
  5322. @item mpan
  5323. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  5324. @item base
  5325. Set stereo base between mono and inversed channels. Default is 0.
  5326. Allowed range is from -1 to 1.
  5327. @item delay
  5328. Set delay in milliseconds how much to delay left from right channel and
  5329. vice versa. Default is 0. Allowed range is from -20 to 20.
  5330. @item sclevel
  5331. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  5332. @item phase
  5333. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  5334. @item bmode_in, bmode_out
  5335. Set balance mode for balance_in/balance_out option.
  5336. Can be one of the following:
  5337. @table @samp
  5338. @item balance
  5339. Classic balance mode. Attenuate one channel at time.
  5340. Gain is raised up to 1.
  5341. @item amplitude
  5342. Similar as classic mode above but gain is raised up to 2.
  5343. @item power
  5344. Equal power distribution, from -6dB to +6dB range.
  5345. @end table
  5346. @end table
  5347. @subsection Commands
  5348. This filter supports the all above options as @ref{commands}.
  5349. @subsection Examples
  5350. @itemize
  5351. @item
  5352. Apply karaoke like effect:
  5353. @example
  5354. stereotools=mlev=0.015625
  5355. @end example
  5356. @item
  5357. Convert M/S signal to L/R:
  5358. @example
  5359. "stereotools=mode=ms>lr"
  5360. @end example
  5361. @end itemize
  5362. @section stereowiden
  5363. This filter enhance the stereo effect by suppressing signal common to both
  5364. channels and by delaying the signal of left into right and vice versa,
  5365. thereby widening the stereo effect.
  5366. The filter accepts the following options:
  5367. @table @option
  5368. @item delay
  5369. Time in milliseconds of the delay of left signal into right and vice versa.
  5370. Default is 20 milliseconds.
  5371. @item feedback
  5372. Amount of gain in delayed signal into right and vice versa. Gives a delay
  5373. effect of left signal in right output and vice versa which gives widening
  5374. effect. Default is 0.3.
  5375. @item crossfeed
  5376. Cross feed of left into right with inverted phase. This helps in suppressing
  5377. the mono. If the value is 1 it will cancel all the signal common to both
  5378. channels. Default is 0.3.
  5379. @item drymix
  5380. Set level of input signal of original channel. Default is 0.8.
  5381. @end table
  5382. @subsection Commands
  5383. This filter supports the all above options except @code{delay} as @ref{commands}.
  5384. @section superequalizer
  5385. Apply 18 band equalizer.
  5386. The filter accepts the following options:
  5387. @table @option
  5388. @item 1b
  5389. Set 65Hz band gain.
  5390. @item 2b
  5391. Set 92Hz band gain.
  5392. @item 3b
  5393. Set 131Hz band gain.
  5394. @item 4b
  5395. Set 185Hz band gain.
  5396. @item 5b
  5397. Set 262Hz band gain.
  5398. @item 6b
  5399. Set 370Hz band gain.
  5400. @item 7b
  5401. Set 523Hz band gain.
  5402. @item 8b
  5403. Set 740Hz band gain.
  5404. @item 9b
  5405. Set 1047Hz band gain.
  5406. @item 10b
  5407. Set 1480Hz band gain.
  5408. @item 11b
  5409. Set 2093Hz band gain.
  5410. @item 12b
  5411. Set 2960Hz band gain.
  5412. @item 13b
  5413. Set 4186Hz band gain.
  5414. @item 14b
  5415. Set 5920Hz band gain.
  5416. @item 15b
  5417. Set 8372Hz band gain.
  5418. @item 16b
  5419. Set 11840Hz band gain.
  5420. @item 17b
  5421. Set 16744Hz band gain.
  5422. @item 18b
  5423. Set 20000Hz band gain.
  5424. @end table
  5425. @section surround
  5426. Apply audio surround upmix filter.
  5427. This filter allows to produce multichannel output from audio stream.
  5428. The filter accepts the following options:
  5429. @table @option
  5430. @item chl_out
  5431. Set output channel layout. By default, this is @var{5.1}.
  5432. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5433. for the required syntax.
  5434. @item chl_in
  5435. Set input channel layout. By default, this is @var{stereo}.
  5436. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5437. for the required syntax.
  5438. @item level_in
  5439. Set input volume level. By default, this is @var{1}.
  5440. @item level_out
  5441. Set output volume level. By default, this is @var{1}.
  5442. @item lfe
  5443. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5444. @item lfe_low
  5445. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5446. @item lfe_high
  5447. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5448. @item lfe_mode
  5449. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5450. In @var{add} mode, LFE channel is created from input audio and added to output.
  5451. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5452. also all non-LFE output channels are subtracted with output LFE channel.
  5453. @item smooth
  5454. Set temporal smoothness strength, used to gradually change factors when transforming
  5455. stereo sound in time. Allowed range is from @var{0.0} to @var{1.0}.
  5456. Useful to improve output quality with @var{focus} option values greater than @var{0.0}.
  5457. Default is @var{0.0}. Only values inside this range and without edges are effective.
  5458. @item angle
  5459. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5460. Default is @var{90}.
  5461. @item focus
  5462. Set focus of stereo surround transform, Allowed range is from @var{-1} to @var{1}.
  5463. Default is @var{0}.
  5464. @item fc_in
  5465. Set front center input volume. By default, this is @var{1}.
  5466. @item fc_out
  5467. Set front center output volume. By default, this is @var{1}.
  5468. @item fl_in
  5469. Set front left input volume. By default, this is @var{1}.
  5470. @item fl_out
  5471. Set front left output volume. By default, this is @var{1}.
  5472. @item fr_in
  5473. Set front right input volume. By default, this is @var{1}.
  5474. @item fr_out
  5475. Set front right output volume. By default, this is @var{1}.
  5476. @item sl_in
  5477. Set side left input volume. By default, this is @var{1}.
  5478. @item sl_out
  5479. Set side left output volume. By default, this is @var{1}.
  5480. @item sr_in
  5481. Set side right input volume. By default, this is @var{1}.
  5482. @item sr_out
  5483. Set side right output volume. By default, this is @var{1}.
  5484. @item bl_in
  5485. Set back left input volume. By default, this is @var{1}.
  5486. @item bl_out
  5487. Set back left output volume. By default, this is @var{1}.
  5488. @item br_in
  5489. Set back right input volume. By default, this is @var{1}.
  5490. @item br_out
  5491. Set back right output volume. By default, this is @var{1}.
  5492. @item bc_in
  5493. Set back center input volume. By default, this is @var{1}.
  5494. @item bc_out
  5495. Set back center output volume. By default, this is @var{1}.
  5496. @item lfe_in
  5497. Set LFE input volume. By default, this is @var{1}.
  5498. @item lfe_out
  5499. Set LFE output volume. By default, this is @var{1}.
  5500. @item allx
  5501. Set spread usage of stereo image across X axis for all channels.
  5502. Allowed range is from @var{-1} to @var{15}.
  5503. By default this value is negative @var{-1}, and thus unused.
  5504. @item ally
  5505. Set spread usage of stereo image across Y axis for all channels.
  5506. Allowed range is from @var{-1} to @var{15}.
  5507. By default this value is negative @var{-1}, and thus unused.
  5508. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5509. Set spread usage of stereo image across X axis for each channel.
  5510. Allowed range is from @var{0.06} to @var{15}.
  5511. By default this value is @var{0.5}.
  5512. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5513. Set spread usage of stereo image across Y axis for each channel.
  5514. Allowed range is from @var{0.06} to @var{15}.
  5515. By default this value is @var{0.5}.
  5516. @item win_size
  5517. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5518. @item win_func
  5519. Set window function.
  5520. It accepts the following values:
  5521. @table @samp
  5522. @item rect
  5523. @item bartlett
  5524. @item hann, hanning
  5525. @item hamming
  5526. @item blackman
  5527. @item welch
  5528. @item flattop
  5529. @item bharris
  5530. @item bnuttall
  5531. @item bhann
  5532. @item sine
  5533. @item nuttall
  5534. @item lanczos
  5535. @item gauss
  5536. @item tukey
  5537. @item dolph
  5538. @item cauchy
  5539. @item parzen
  5540. @item poisson
  5541. @item bohman
  5542. @item kaiser
  5543. @end table
  5544. Default is @code{hann}.
  5545. @item overlap
  5546. Set window overlap. If set to 1, the recommended overlap for selected
  5547. window function will be picked. Default is @code{0.5}.
  5548. @end table
  5549. @section tiltshelf
  5550. Boost or cut the lower frequencies and cut or boost higher frequencies
  5551. of the audio using a two-pole shelving filter with a response similar to
  5552. that of a standard hi-fi's tone-controls.
  5553. This is also known as shelving equalisation (EQ).
  5554. The filter accepts the following options:
  5555. @table @option
  5556. @item gain, g
  5557. Give the gain at 0 Hz. Its useful range is about -20
  5558. (for a large cut) to +20 (for a large boost).
  5559. Beware of clipping when using a positive gain.
  5560. @item frequency, f
  5561. Set the filter's central frequency and so can be used
  5562. to extend or reduce the frequency range to be boosted or cut.
  5563. The default value is @code{3000} Hz.
  5564. @item width_type, t
  5565. Set method to specify band-width of filter.
  5566. @table @option
  5567. @item h
  5568. Hz
  5569. @item q
  5570. Q-Factor
  5571. @item o
  5572. octave
  5573. @item s
  5574. slope
  5575. @item k
  5576. kHz
  5577. @end table
  5578. @item width, w
  5579. Determine how steep is the filter's shelf transition.
  5580. @item poles, p
  5581. Set number of poles. Default is 2.
  5582. @item mix, m
  5583. How much to use filtered signal in output. Default is 1.
  5584. Range is between 0 and 1.
  5585. @item channels, c
  5586. Specify which channels to filter, by default all available are filtered.
  5587. @item normalize, n
  5588. Normalize biquad coefficients, by default is disabled.
  5589. Enabling it will normalize magnitude response at DC to 0dB.
  5590. @item transform, a
  5591. Set transform type of IIR filter.
  5592. @table @option
  5593. @item di
  5594. @item dii
  5595. @item tdi
  5596. @item tdii
  5597. @item latt
  5598. @item svf
  5599. @item zdf
  5600. @end table
  5601. @item precision, r
  5602. Set precision of filtering.
  5603. @table @option
  5604. @item auto
  5605. Pick automatic sample format depending on surround filters.
  5606. @item s16
  5607. Always use signed 16-bit.
  5608. @item s32
  5609. Always use signed 32-bit.
  5610. @item f32
  5611. Always use float 32-bit.
  5612. @item f64
  5613. Always use float 64-bit.
  5614. @end table
  5615. @item block_size, b
  5616. Set block size used for reverse IIR processing. If this value is set to high enough
  5617. value (higher than impulse response length truncated when reaches near zero values) filtering
  5618. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5619. Note that filter delay will be exactly this many samples when set to non-zero value.
  5620. @end table
  5621. @subsection Commands
  5622. This filter supports some options as @ref{commands}.
  5623. @section treble, highshelf
  5624. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5625. shelving filter with a response similar to that of a standard
  5626. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5627. The filter accepts the following options:
  5628. @table @option
  5629. @item gain, g
  5630. Give the gain at whichever is the lower of ~22 kHz and the
  5631. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5632. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5633. @item frequency, f
  5634. Set the filter's central frequency and so can be used
  5635. to extend or reduce the frequency range to be boosted or cut.
  5636. The default value is @code{3000} Hz.
  5637. @item width_type, t
  5638. Set method to specify band-width of filter.
  5639. @table @option
  5640. @item h
  5641. Hz
  5642. @item q
  5643. Q-Factor
  5644. @item o
  5645. octave
  5646. @item s
  5647. slope
  5648. @item k
  5649. kHz
  5650. @end table
  5651. @item width, w
  5652. Determine how steep is the filter's shelf transition.
  5653. @item poles, p
  5654. Set number of poles. Default is 2.
  5655. @item mix, m
  5656. How much to use filtered signal in output. Default is 1.
  5657. Range is between 0 and 1.
  5658. @item channels, c
  5659. Specify which channels to filter, by default all available are filtered.
  5660. @item normalize, n
  5661. Normalize biquad coefficients, by default is disabled.
  5662. Enabling it will normalize magnitude response at DC to 0dB.
  5663. @item transform, a
  5664. Set transform type of IIR filter.
  5665. @table @option
  5666. @item di
  5667. @item dii
  5668. @item tdi
  5669. @item tdii
  5670. @item latt
  5671. @item svf
  5672. @item zdf
  5673. @end table
  5674. @item precision, r
  5675. Set precision of filtering.
  5676. @table @option
  5677. @item auto
  5678. Pick automatic sample format depending on surround filters.
  5679. @item s16
  5680. Always use signed 16-bit.
  5681. @item s32
  5682. Always use signed 32-bit.
  5683. @item f32
  5684. Always use float 32-bit.
  5685. @item f64
  5686. Always use float 64-bit.
  5687. @end table
  5688. @item block_size, b
  5689. Set block size used for reverse IIR processing. If this value is set to high enough
  5690. value (higher than impulse response length truncated when reaches near zero values) filtering
  5691. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5692. Note that filter delay will be exactly this many samples when set to non-zero value.
  5693. @end table
  5694. @subsection Commands
  5695. This filter supports the following commands:
  5696. @table @option
  5697. @item frequency, f
  5698. Change treble frequency.
  5699. Syntax for the command is : "@var{frequency}"
  5700. @item width_type, t
  5701. Change treble width_type.
  5702. Syntax for the command is : "@var{width_type}"
  5703. @item width, w
  5704. Change treble width.
  5705. Syntax for the command is : "@var{width}"
  5706. @item gain, g
  5707. Change treble gain.
  5708. Syntax for the command is : "@var{gain}"
  5709. @item mix, m
  5710. Change treble mix.
  5711. Syntax for the command is : "@var{mix}"
  5712. @end table
  5713. @section tremolo
  5714. Sinusoidal amplitude modulation.
  5715. The filter accepts the following options:
  5716. @table @option
  5717. @item f
  5718. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5719. (20 Hz or lower) will result in a tremolo effect.
  5720. This filter may also be used as a ring modulator by specifying
  5721. a modulation frequency higher than 20 Hz.
  5722. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5723. @item d
  5724. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5725. Default value is 0.5.
  5726. @end table
  5727. @section vibrato
  5728. Sinusoidal phase modulation.
  5729. The filter accepts the following options:
  5730. @table @option
  5731. @item f
  5732. Modulation frequency in Hertz.
  5733. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5734. @item d
  5735. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5736. Default value is 0.5.
  5737. @end table
  5738. @section virtualbass
  5739. Apply audio Virtual Bass filter.
  5740. This filter accepts stereo input and produce stereo with LFE (2.1) channels output.
  5741. The newly produced LFE channel have enhanced virtual bass originally obtained from both stereo channels.
  5742. This filter outputs front left and front right channels unchanged as available in stereo input.
  5743. The filter accepts the following options:
  5744. @table @option
  5745. @item cutoff
  5746. Set the virtual bass cutoff frequency. Default value is 250 Hz.
  5747. Allowed range is from 100 to 500 Hz.
  5748. @item strength
  5749. Set the virtual bass strength. Allowed range is from 0.5 to 3.
  5750. Default value is 3.
  5751. @end table
  5752. @section volume
  5753. Adjust the input audio volume.
  5754. It accepts the following parameters:
  5755. @table @option
  5756. @item volume
  5757. Set audio volume expression.
  5758. Output values are clipped to the maximum value.
  5759. The output audio volume is given by the relation:
  5760. @example
  5761. @var{output_volume} = @var{volume} * @var{input_volume}
  5762. @end example
  5763. The default value for @var{volume} is "1.0".
  5764. @item precision
  5765. This parameter represents the mathematical precision.
  5766. It determines which input sample formats will be allowed, which affects the
  5767. precision of the volume scaling.
  5768. @table @option
  5769. @item fixed
  5770. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5771. @item float
  5772. 32-bit floating-point; this limits input sample format to FLT. (default)
  5773. @item double
  5774. 64-bit floating-point; this limits input sample format to DBL.
  5775. @end table
  5776. @item replaygain
  5777. Choose the behaviour on encountering ReplayGain side data in input frames.
  5778. @table @option
  5779. @item drop
  5780. Remove ReplayGain side data, ignoring its contents (the default).
  5781. @item ignore
  5782. Ignore ReplayGain side data, but leave it in the frame.
  5783. @item track
  5784. Prefer the track gain, if present.
  5785. @item album
  5786. Prefer the album gain, if present.
  5787. @end table
  5788. @item replaygain_preamp
  5789. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5790. Default value for @var{replaygain_preamp} is 0.0.
  5791. @item replaygain_noclip
  5792. Prevent clipping by limiting the gain applied.
  5793. Default value for @var{replaygain_noclip} is 1.
  5794. @item eval
  5795. Set when the volume expression is evaluated.
  5796. It accepts the following values:
  5797. @table @samp
  5798. @item once
  5799. only evaluate expression once during the filter initialization, or
  5800. when the @samp{volume} command is sent
  5801. @item frame
  5802. evaluate expression for each incoming frame
  5803. @end table
  5804. Default value is @samp{once}.
  5805. @end table
  5806. The volume expression can contain the following parameters.
  5807. @table @option
  5808. @item n
  5809. frame number (starting at zero)
  5810. @item nb_channels
  5811. number of channels
  5812. @item nb_consumed_samples
  5813. number of samples consumed by the filter
  5814. @item nb_samples
  5815. number of samples in the current frame
  5816. @item pos
  5817. original frame position in the file; deprecated, do not use
  5818. @item pts
  5819. frame PTS
  5820. @item sample_rate
  5821. sample rate
  5822. @item startpts
  5823. PTS at start of stream
  5824. @item startt
  5825. time at start of stream
  5826. @item t
  5827. frame time
  5828. @item tb
  5829. timestamp timebase
  5830. @item volume
  5831. last set volume value
  5832. @end table
  5833. Note that when @option{eval} is set to @samp{once} only the
  5834. @var{sample_rate} and @var{tb} variables are available, all other
  5835. variables will evaluate to NAN.
  5836. @subsection Commands
  5837. This filter supports the following commands:
  5838. @table @option
  5839. @item volume
  5840. Modify the volume expression.
  5841. The command accepts the same syntax of the corresponding option.
  5842. If the specified expression is not valid, it is kept at its current
  5843. value.
  5844. @end table
  5845. @subsection Examples
  5846. @itemize
  5847. @item
  5848. Halve the input audio volume:
  5849. @example
  5850. volume=volume=0.5
  5851. volume=volume=1/2
  5852. volume=volume=-6.0206dB
  5853. @end example
  5854. In all the above example the named key for @option{volume} can be
  5855. omitted, for example like in:
  5856. @example
  5857. volume=0.5
  5858. @end example
  5859. @item
  5860. Increase input audio power by 6 decibels using fixed-point precision:
  5861. @example
  5862. volume=volume=6dB:precision=fixed
  5863. @end example
  5864. @item
  5865. Fade volume after time 10 with an annihilation period of 5 seconds:
  5866. @example
  5867. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5868. @end example
  5869. @end itemize
  5870. @section volumedetect
  5871. Detect the volume of the input video.
  5872. The filter has no parameters. It supports only 16-bit signed integer samples,
  5873. so the input will be converted when needed. Statistics about the volume will
  5874. be printed in the log when the input stream end is reached.
  5875. In particular it will show the mean volume (root mean square), maximum
  5876. volume (on a per-sample basis), and the beginning of a histogram of the
  5877. registered volume values (from the maximum value to a cumulated 1/1000 of
  5878. the samples).
  5879. All volumes are in decibels relative to the maximum PCM value.
  5880. @subsection Examples
  5881. Here is an excerpt of the output:
  5882. @example
  5883. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5884. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5885. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5886. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5887. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5888. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5889. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5890. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5891. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5892. @end example
  5893. It means that:
  5894. @itemize
  5895. @item
  5896. The mean square energy is approximately -27 dB, or 10^-2.7.
  5897. @item
  5898. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5899. @item
  5900. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5901. @end itemize
  5902. In other words, raising the volume by +4 dB does not cause any clipping,
  5903. raising it by +5 dB causes clipping for 6 samples, etc.
  5904. @c man end AUDIO FILTERS
  5905. @chapter Audio Sources
  5906. @c man begin AUDIO SOURCES
  5907. Below is a description of the currently available audio sources.
  5908. @section abuffer
  5909. Buffer audio frames, and make them available to the filter chain.
  5910. This source is mainly intended for a programmatic use, in particular
  5911. through the interface defined in @file{libavfilter/buffersrc.h}.
  5912. It accepts the following parameters:
  5913. @table @option
  5914. @item time_base
  5915. The timebase which will be used for timestamps of submitted frames. It must be
  5916. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5917. @item sample_rate
  5918. The sample rate of the incoming audio buffers.
  5919. @item sample_fmt
  5920. The sample format of the incoming audio buffers.
  5921. Either a sample format name or its corresponding integer representation from
  5922. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5923. @item channel_layout
  5924. The channel layout of the incoming audio buffers.
  5925. Either a channel layout name from channel_layout_map in
  5926. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5927. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5928. @item channels
  5929. The number of channels of the incoming audio buffers.
  5930. If both @var{channels} and @var{channel_layout} are specified, then they
  5931. must be consistent.
  5932. @end table
  5933. @subsection Examples
  5934. @example
  5935. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  5936. @end example
  5937. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  5938. Since the sample format with name "s16p" corresponds to the number
  5939. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  5940. equivalent to:
  5941. @example
  5942. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  5943. @end example
  5944. @section aevalsrc
  5945. Generate an audio signal specified by an expression.
  5946. This source accepts in input one or more expressions (one for each
  5947. channel), which are evaluated and used to generate a corresponding
  5948. audio signal.
  5949. This source accepts the following options:
  5950. @table @option
  5951. @item exprs
  5952. Set the '|'-separated expressions list for each separate channel. In case the
  5953. @option{channel_layout} option is not specified, the selected channel layout
  5954. depends on the number of provided expressions. Otherwise the last
  5955. specified expression is applied to the remaining output channels.
  5956. @item channel_layout, c
  5957. Set the channel layout. The number of channels in the specified layout
  5958. must be equal to the number of specified expressions.
  5959. @item duration, d
  5960. Set the minimum duration of the sourced audio. See
  5961. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5962. for the accepted syntax.
  5963. Note that the resulting duration may be greater than the specified
  5964. duration, as the generated audio is always cut at the end of a
  5965. complete frame.
  5966. If not specified, or the expressed duration is negative, the audio is
  5967. supposed to be generated forever.
  5968. @item nb_samples, n
  5969. Set the number of samples per channel per each output frame,
  5970. default to 1024.
  5971. @item sample_rate, s
  5972. Specify the sample rate, default to 44100.
  5973. @end table
  5974. Each expression in @var{exprs} can contain the following constants:
  5975. @table @option
  5976. @item n
  5977. number of the evaluated sample, starting from 0
  5978. @item t
  5979. time of the evaluated sample expressed in seconds, starting from 0
  5980. @item s
  5981. sample rate
  5982. @end table
  5983. @subsection Examples
  5984. @itemize
  5985. @item
  5986. Generate silence:
  5987. @example
  5988. aevalsrc=0
  5989. @end example
  5990. @item
  5991. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5992. 8000 Hz:
  5993. @example
  5994. aevalsrc="sin(440*2*PI*t):s=8000"
  5995. @end example
  5996. @item
  5997. Generate a two channels signal, specify the channel layout (Front
  5998. Center + Back Center) explicitly:
  5999. @example
  6000. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  6001. @end example
  6002. @item
  6003. Generate white noise:
  6004. @example
  6005. aevalsrc="-2+random(0)"
  6006. @end example
  6007. @item
  6008. Generate an amplitude modulated signal:
  6009. @example
  6010. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  6011. @end example
  6012. @item
  6013. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  6014. @example
  6015. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  6016. @end example
  6017. @end itemize
  6018. @section afdelaysrc
  6019. Generate a fractional delay FIR coefficients.
  6020. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6021. The filter accepts the following options:
  6022. @table @option
  6023. @item delay, d
  6024. Set the fractional delay. Default is 0.
  6025. @item sample_rate, r
  6026. Set the sample rate, default is 44100.
  6027. @item nb_samples, n
  6028. Set the number of samples per each frame. Default is 1024.
  6029. @item taps, t
  6030. Set the number of filter coefficients in output audio stream.
  6031. Default value is 0.
  6032. @item channel_layout, c
  6033. Specifies the channel layout, and can be a string representing a channel layout.
  6034. The default value of @var{channel_layout} is "stereo".
  6035. @end table
  6036. @section afireqsrc
  6037. Generate a FIR equalizer coefficients.
  6038. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6039. The filter accepts the following options:
  6040. @table @option
  6041. @item preset, p
  6042. Set equalizer preset.
  6043. Default preset is @code{flat}.
  6044. Available presets are:
  6045. @table @samp
  6046. @item custom
  6047. @item flat
  6048. @item acoustic
  6049. @item bass
  6050. @item beats
  6051. @item classic
  6052. @item clear
  6053. @item deep bass
  6054. @item dubstep
  6055. @item electronic
  6056. @item hard-style
  6057. @item hip-hop
  6058. @item jazz
  6059. @item metal
  6060. @item movie
  6061. @item pop
  6062. @item r&b
  6063. @item rock
  6064. @item vocal booster
  6065. @end table
  6066. @item gains, g
  6067. Set custom gains for each band. Only used if the preset option is set to @code{custom}.
  6068. Gains are separated by white spaces and each gain is set in dBFS.
  6069. Default is @code{0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}.
  6070. @item bands, b
  6071. Set the custom bands from where custon equalizer gains are set.
  6072. This must be in strictly increasing order. Only used if the preset option is set to @code{custom}.
  6073. Bands are separated by white spaces and each band represent frequency in Hz.
  6074. Default is @code{25 40 63 100 160 250 400 630 1000 1600 2500 4000 6300 10000 16000 24000}.
  6075. @item taps, t
  6076. Set number of filter coefficients in output audio stream.
  6077. Default value is @code{4096}.
  6078. @item sample_rate, r
  6079. Set sample rate of output audio stream, default is @code{44100}.
  6080. @item nb_samples, n
  6081. Set number of samples per each frame in output audio stream. Default is @code{1024}.
  6082. @item interp, i
  6083. Set interpolation method for FIR equalizer coefficients. Can be @code{linear} or @code{cubic}.
  6084. @item phase, h
  6085. Set phase type of FIR filter. Can be @code{linear} or @code{min}: minimum-phase.
  6086. Default is minimum-phase filter.
  6087. @end table
  6088. @section afirsrc
  6089. Generate a FIR coefficients using frequency sampling method.
  6090. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6091. The filter accepts the following options:
  6092. @table @option
  6093. @item taps, t
  6094. Set number of filter coefficients in output audio stream.
  6095. Default value is 1025.
  6096. @item frequency, f
  6097. Set frequency points from where magnitude and phase are set.
  6098. This must be in non decreasing order, and first element must be 0, while last element
  6099. must be 1. Elements are separated by white spaces.
  6100. @item magnitude, m
  6101. Set magnitude value for every frequency point set by @option{frequency}.
  6102. Number of values must be same as number of frequency points.
  6103. Values are separated by white spaces.
  6104. @item phase, p
  6105. Set phase value for every frequency point set by @option{frequency}.
  6106. Number of values must be same as number of frequency points.
  6107. Values are separated by white spaces.
  6108. @item sample_rate, r
  6109. Set sample rate, default is 44100.
  6110. @item nb_samples, n
  6111. Set number of samples per each frame. Default is 1024.
  6112. @item win_func, w
  6113. Set window function. Default is blackman.
  6114. @end table
  6115. @section anullsrc
  6116. The null audio source, return unprocessed audio frames. It is mainly useful
  6117. as a template and to be employed in analysis / debugging tools, or as
  6118. the source for filters which ignore the input data (for example the sox
  6119. synth filter).
  6120. This source accepts the following options:
  6121. @table @option
  6122. @item channel_layout, cl
  6123. Specifies the channel layout, and can be either an integer or a string
  6124. representing a channel layout. The default value of @var{channel_layout}
  6125. is "stereo".
  6126. Check the channel_layout_map definition in
  6127. @file{libavutil/channel_layout.c} for the mapping between strings and
  6128. channel layout values.
  6129. @item sample_rate, r
  6130. Specifies the sample rate, and defaults to 44100.
  6131. @item nb_samples, n
  6132. Set the number of samples per requested frames.
  6133. @item duration, d
  6134. Set the duration of the sourced audio. See
  6135. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  6136. for the accepted syntax.
  6137. If not specified, or the expressed duration is negative, the audio is
  6138. supposed to be generated forever.
  6139. @end table
  6140. @subsection Examples
  6141. @itemize
  6142. @item
  6143. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  6144. @example
  6145. anullsrc=r=48000:cl=4
  6146. @end example
  6147. @item
  6148. Do the same operation with a more obvious syntax:
  6149. @example
  6150. anullsrc=r=48000:cl=mono
  6151. @end example
  6152. @end itemize
  6153. All the parameters need to be explicitly defined.
  6154. @section flite
  6155. Synthesize a voice utterance using the libflite library.
  6156. To enable compilation of this filter you need to configure FFmpeg with
  6157. @code{--enable-libflite}.
  6158. Note that versions of the flite library prior to 2.0 are not thread-safe.
  6159. The filter accepts the following options:
  6160. @table @option
  6161. @item list_voices
  6162. If set to 1, list the names of the available voices and exit
  6163. immediately. Default value is 0.
  6164. @item nb_samples, n
  6165. Set the maximum number of samples per frame. Default value is 512.
  6166. @item textfile
  6167. Set the filename containing the text to speak.
  6168. @item text
  6169. Set the text to speak.
  6170. @item voice, v
  6171. Set the voice to use for the speech synthesis. Default value is
  6172. @code{kal}. See also the @var{list_voices} option.
  6173. @end table
  6174. @subsection Examples
  6175. @itemize
  6176. @item
  6177. Read from file @file{speech.txt}, and synthesize the text using the
  6178. standard flite voice:
  6179. @example
  6180. flite=textfile=speech.txt
  6181. @end example
  6182. @item
  6183. Read the specified text selecting the @code{slt} voice:
  6184. @example
  6185. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  6186. @end example
  6187. @item
  6188. Input text to ffmpeg:
  6189. @example
  6190. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  6191. @end example
  6192. @item
  6193. Make @file{ffplay} speak the specified text, using @code{flite} and
  6194. the @code{lavfi} device:
  6195. @example
  6196. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  6197. @end example
  6198. @end itemize
  6199. For more information about libflite, check:
  6200. @url{http://www.festvox.org/flite/}
  6201. @section anoisesrc
  6202. Generate a noise audio signal.
  6203. The filter accepts the following options:
  6204. @table @option
  6205. @item sample_rate, r
  6206. Specify the sample rate. Default value is 48000 Hz.
  6207. @item amplitude, a
  6208. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  6209. is 1.0.
  6210. @item duration, d
  6211. Specify the duration of the generated audio stream. Not specifying this option
  6212. results in noise with an infinite length.
  6213. @item color, colour, c
  6214. Specify the color of noise. Available noise colors are white, pink, brown,
  6215. blue, violet and velvet. Default color is white.
  6216. @item seed, s
  6217. Specify a value used to seed the PRNG.
  6218. @item nb_samples, n
  6219. Set the number of samples per each output frame, default is 1024.
  6220. @item density
  6221. Set the density (0.0 - 1.0) for the velvet noise generator, default is 0.05.
  6222. @end table
  6223. @subsection Examples
  6224. @itemize
  6225. @item
  6226. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  6227. @example
  6228. anoisesrc=d=60:c=pink:r=44100:a=0.5
  6229. @end example
  6230. @end itemize
  6231. @section hilbert
  6232. Generate odd-tap Hilbert transform FIR coefficients.
  6233. The resulting stream can be used with @ref{afir} filter for phase-shifting
  6234. the signal by 90 degrees.
  6235. This is used in many matrix coding schemes and for analytic signal generation.
  6236. The process is often written as a multiplication by i (or j), the imaginary unit.
  6237. The filter accepts the following options:
  6238. @table @option
  6239. @item sample_rate, s
  6240. Set sample rate, default is 44100.
  6241. @item taps, t
  6242. Set length of FIR filter, default is 22051.
  6243. @item nb_samples, n
  6244. Set number of samples per each frame.
  6245. @item win_func, w
  6246. Set window function to be used when generating FIR coefficients.
  6247. @end table
  6248. @section sinc
  6249. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  6250. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6251. The filter accepts the following options:
  6252. @table @option
  6253. @item sample_rate, r
  6254. Set sample rate, default is 44100.
  6255. @item nb_samples, n
  6256. Set number of samples per each frame. Default is 1024.
  6257. @item hp
  6258. Set high-pass frequency. Default is 0.
  6259. @item lp
  6260. Set low-pass frequency. Default is 0.
  6261. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  6262. is higher than 0 then filter will create band-pass filter coefficients,
  6263. otherwise band-reject filter coefficients.
  6264. @item phase
  6265. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  6266. @item beta
  6267. Set Kaiser window beta.
  6268. @item att
  6269. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  6270. @item round
  6271. Enable rounding, by default is disabled.
  6272. @item hptaps
  6273. Set number of taps for high-pass filter.
  6274. @item lptaps
  6275. Set number of taps for low-pass filter.
  6276. @end table
  6277. @section sine
  6278. Generate an audio signal made of a sine wave with amplitude 1/8.
  6279. The audio signal is bit-exact.
  6280. The filter accepts the following options:
  6281. @table @option
  6282. @item frequency, f
  6283. Set the carrier frequency. Default is 440 Hz.
  6284. @item beep_factor, b
  6285. Enable a periodic beep every second with frequency @var{beep_factor} times
  6286. the carrier frequency. Default is 0, meaning the beep is disabled.
  6287. @item sample_rate, r
  6288. Specify the sample rate, default is 44100.
  6289. @item duration, d
  6290. Specify the duration of the generated audio stream.
  6291. @item samples_per_frame
  6292. Set the number of samples per output frame.
  6293. The expression can contain the following constants:
  6294. @table @option
  6295. @item n
  6296. The (sequential) number of the output audio frame, starting from 0.
  6297. @item pts
  6298. The PTS (Presentation TimeStamp) of the output audio frame,
  6299. expressed in @var{TB} units.
  6300. @item t
  6301. The PTS of the output audio frame, expressed in seconds.
  6302. @item TB
  6303. The timebase of the output audio frames.
  6304. @end table
  6305. Default is @code{1024}.
  6306. @end table
  6307. @subsection Examples
  6308. @itemize
  6309. @item
  6310. Generate a simple 440 Hz sine wave:
  6311. @example
  6312. sine
  6313. @end example
  6314. @item
  6315. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  6316. @example
  6317. sine=220:4:d=5
  6318. sine=f=220:b=4:d=5
  6319. sine=frequency=220:beep_factor=4:duration=5
  6320. @end example
  6321. @item
  6322. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  6323. pattern:
  6324. @example
  6325. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  6326. @end example
  6327. @end itemize
  6328. @c man end AUDIO SOURCES
  6329. @chapter Audio Sinks
  6330. @c man begin AUDIO SINKS
  6331. Below is a description of the currently available audio sinks.
  6332. @section abuffersink
  6333. Buffer audio frames, and make them available to the end of filter chain.
  6334. This sink is mainly intended for programmatic use, in particular
  6335. through the interface defined in @file{libavfilter/buffersink.h}
  6336. or the options system.
  6337. It accepts a pointer to an AVABufferSinkContext structure, which
  6338. defines the incoming buffers' formats, to be passed as the opaque
  6339. parameter to @code{avfilter_init_filter} for initialization.
  6340. @section anullsink
  6341. Null audio sink; do absolutely nothing with the input audio. It is
  6342. mainly useful as a template and for use in analysis / debugging
  6343. tools.
  6344. @c man end AUDIO SINKS
  6345. @chapter Video Filters
  6346. @c man begin VIDEO FILTERS
  6347. When you configure your FFmpeg build, you can disable any of the
  6348. existing filters using @code{--disable-filters}.
  6349. The configure output will show the video filters included in your
  6350. build.
  6351. Below is a description of the currently available video filters.
  6352. @section addroi
  6353. Mark a region of interest in a video frame.
  6354. The frame data is passed through unchanged, but metadata is attached
  6355. to the frame indicating regions of interest which can affect the
  6356. behaviour of later encoding. Multiple regions can be marked by
  6357. applying the filter multiple times.
  6358. @table @option
  6359. @item x
  6360. Region distance in pixels from the left edge of the frame.
  6361. @item y
  6362. Region distance in pixels from the top edge of the frame.
  6363. @item w
  6364. Region width in pixels.
  6365. @item h
  6366. Region height in pixels.
  6367. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  6368. and may contain the following variables:
  6369. @table @option
  6370. @item iw
  6371. Width of the input frame.
  6372. @item ih
  6373. Height of the input frame.
  6374. @end table
  6375. @item qoffset
  6376. Quantisation offset to apply within the region.
  6377. This must be a real value in the range -1 to +1. A value of zero
  6378. indicates no quality change. A negative value asks for better quality
  6379. (less quantisation), while a positive value asks for worse quality
  6380. (greater quantisation).
  6381. The range is calibrated so that the extreme values indicate the
  6382. largest possible offset - if the rest of the frame is encoded with the
  6383. worst possible quality, an offset of -1 indicates that this region
  6384. should be encoded with the best possible quality anyway. Intermediate
  6385. values are then interpolated in some codec-dependent way.
  6386. For example, in 10-bit H.264 the quantisation parameter varies between
  6387. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  6388. this region should be encoded with a QP around one-tenth of the full
  6389. range better than the rest of the frame. So, if most of the frame
  6390. were to be encoded with a QP of around 30, this region would get a QP
  6391. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  6392. An extreme value of -1 would indicate that this region should be
  6393. encoded with the best possible quality regardless of the treatment of
  6394. the rest of the frame - that is, should be encoded at a QP of -12.
  6395. @item clear
  6396. If set to true, remove any existing regions of interest marked on the
  6397. frame before adding the new one.
  6398. @end table
  6399. @subsection Examples
  6400. @itemize
  6401. @item
  6402. Mark the centre quarter of the frame as interesting.
  6403. @example
  6404. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  6405. @end example
  6406. @item
  6407. Mark the 100-pixel-wide region on the left edge of the frame as very
  6408. uninteresting (to be encoded at much lower quality than the rest of
  6409. the frame).
  6410. @example
  6411. addroi=0:0:100:ih:+1/5
  6412. @end example
  6413. @end itemize
  6414. @section alphaextract
  6415. Extract the alpha component from the input as a grayscale video. This
  6416. is especially useful with the @var{alphamerge} filter.
  6417. @section alphamerge
  6418. Add or replace the alpha component of the primary input with the
  6419. grayscale value of a second input. This is intended for use with
  6420. @var{alphaextract} to allow the transmission or storage of frame
  6421. sequences that have alpha in a format that doesn't support an alpha
  6422. channel.
  6423. For example, to reconstruct full frames from a normal YUV-encoded video
  6424. and a separate video created with @var{alphaextract}, you might use:
  6425. @example
  6426. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  6427. @end example
  6428. @section amplify
  6429. Amplify differences between current pixel and pixels of adjacent frames in
  6430. same pixel location.
  6431. This filter accepts the following options:
  6432. @table @option
  6433. @item radius
  6434. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  6435. For example radius of 3 will instruct filter to calculate average of 7 frames.
  6436. @item factor
  6437. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  6438. @item threshold
  6439. Set threshold for difference amplification. Any difference greater or equal to
  6440. this value will not alter source pixel. Default is 10.
  6441. Allowed range is from 0 to 65535.
  6442. @item tolerance
  6443. Set tolerance for difference amplification. Any difference lower to
  6444. this value will not alter source pixel. Default is 0.
  6445. Allowed range is from 0 to 65535.
  6446. @item low
  6447. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6448. This option controls maximum possible value that will decrease source pixel value.
  6449. @item high
  6450. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6451. This option controls maximum possible value that will increase source pixel value.
  6452. @item planes
  6453. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  6454. @end table
  6455. @subsection Commands
  6456. This filter supports the following @ref{commands} that corresponds to option of same name:
  6457. @table @option
  6458. @item factor
  6459. @item threshold
  6460. @item tolerance
  6461. @item low
  6462. @item high
  6463. @item planes
  6464. @end table
  6465. @section ass
  6466. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  6467. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  6468. Substation Alpha) subtitles files.
  6469. This filter accepts the following option in addition to the common options from
  6470. the @ref{subtitles} filter:
  6471. @table @option
  6472. @item shaping
  6473. Set the shaping engine
  6474. Available values are:
  6475. @table @samp
  6476. @item auto
  6477. The default libass shaping engine, which is the best available.
  6478. @item simple
  6479. Fast, font-agnostic shaper that can do only substitutions
  6480. @item complex
  6481. Slower shaper using OpenType for substitutions and positioning
  6482. @end table
  6483. The default is @code{auto}.
  6484. @end table
  6485. @section atadenoise
  6486. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  6487. The filter accepts the following options:
  6488. @table @option
  6489. @item 0a
  6490. Set threshold A for 1st plane. Default is 0.02.
  6491. Valid range is 0 to 0.3.
  6492. @item 0b
  6493. Set threshold B for 1st plane. Default is 0.04.
  6494. Valid range is 0 to 5.
  6495. @item 1a
  6496. Set threshold A for 2nd plane. Default is 0.02.
  6497. Valid range is 0 to 0.3.
  6498. @item 1b
  6499. Set threshold B for 2nd plane. Default is 0.04.
  6500. Valid range is 0 to 5.
  6501. @item 2a
  6502. Set threshold A for 3rd plane. Default is 0.02.
  6503. Valid range is 0 to 0.3.
  6504. @item 2b
  6505. Set threshold B for 3rd plane. Default is 0.04.
  6506. Valid range is 0 to 5.
  6507. Threshold A is designed to react on abrupt changes in the input signal and
  6508. threshold B is designed to react on continuous changes in the input signal.
  6509. @item s
  6510. Set number of frames filter will use for averaging. Default is 9. Must be odd
  6511. number in range [5, 129].
  6512. @item p
  6513. Set what planes of frame filter will use for averaging. Default is all.
  6514. @item a
  6515. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  6516. Alternatively can be set to @code{s} serial.
  6517. Parallel can be faster then serial, while other way around is never true.
  6518. Parallel will abort early on first change being greater then thresholds, while serial
  6519. will continue processing other side of frames if they are equal or below thresholds.
  6520. @item 0s
  6521. @item 1s
  6522. @item 2s
  6523. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  6524. Valid range is from 0 to 32767.
  6525. This options controls weight for each pixel in radius defined by size.
  6526. Default value means every pixel have same weight.
  6527. Setting this option to 0 effectively disables filtering.
  6528. @end table
  6529. @subsection Commands
  6530. This filter supports same @ref{commands} as options except option @code{s}.
  6531. The command accepts the same syntax of the corresponding option.
  6532. @section avgblur
  6533. Apply average blur filter.
  6534. The filter accepts the following options:
  6535. @table @option
  6536. @item sizeX
  6537. Set horizontal radius size.
  6538. @item planes
  6539. Set which planes to filter. By default all planes are filtered.
  6540. @item sizeY
  6541. Set vertical radius size, if zero it will be same as @code{sizeX}.
  6542. Default is @code{0}.
  6543. @end table
  6544. @subsection Commands
  6545. This filter supports same commands as options.
  6546. The command accepts the same syntax of the corresponding option.
  6547. If the specified expression is not valid, it is kept at its current
  6548. value.
  6549. @section backgroundkey
  6550. Turns a static background into transparency.
  6551. The filter accepts the following option:
  6552. @table @option
  6553. @item threshold
  6554. Threshold for scene change detection.
  6555. @item similarity
  6556. Similarity percentage with the background.
  6557. @item blend
  6558. Set the blend amount for pixels that are not similar.
  6559. @end table
  6560. @subsection Commands
  6561. This filter supports the all above options as @ref{commands}.
  6562. @section bbox
  6563. Compute the bounding box for the non-black pixels in the input frame
  6564. luma plane.
  6565. This filter computes the bounding box containing all the pixels with a
  6566. luma value greater than the minimum allowed value.
  6567. The parameters describing the bounding box are printed on the filter
  6568. log.
  6569. The filter accepts the following option:
  6570. @table @option
  6571. @item min_val
  6572. Set the minimal luma value. Default is @code{16}.
  6573. @end table
  6574. @subsection Commands
  6575. This filter supports the all above options as @ref{commands}.
  6576. @section bilateral
  6577. Apply bilateral filter, spatial smoothing while preserving edges.
  6578. The filter accepts the following options:
  6579. @table @option
  6580. @item sigmaS
  6581. Set sigma of gaussian function to calculate spatial weight.
  6582. Allowed range is 0 to 512. Default is 0.1.
  6583. @item sigmaR
  6584. Set sigma of gaussian function to calculate range weight.
  6585. Allowed range is 0 to 1. Default is 0.1.
  6586. @item planes
  6587. Set planes to filter. Default is first only.
  6588. @end table
  6589. @subsection Commands
  6590. This filter supports the all above options as @ref{commands}.
  6591. @section bilateral_cuda
  6592. CUDA accelerated bilateral filter, an edge preserving filter.
  6593. This filter is mathematically accurate thanks to the use of GPU acceleration.
  6594. For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
  6595. The filter accepts the following options:
  6596. @table @option
  6597. @item sigmaS
  6598. Set sigma of gaussian function to calculate spatial weight, also called sigma space.
  6599. Allowed range is 0.1 to 512. Default is 0.1.
  6600. @item sigmaR
  6601. Set sigma of gaussian function to calculate color range weight, also called sigma color.
  6602. Allowed range is 0.1 to 512. Default is 0.1.
  6603. @item window_size
  6604. Set window size of the bilateral function to determine the number of neighbours to loop on.
  6605. If the number entered is even, one will be added automatically.
  6606. Allowed range is 1 to 255. Default is 1.
  6607. @end table
  6608. @subsection Examples
  6609. @itemize
  6610. @item
  6611. Apply the bilateral filter on a video.
  6612. @example
  6613. ./ffmpeg -v verbose \
  6614. -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \
  6615. -init_hw_device cuda \
  6616. -filter_complex \
  6617. " \
  6618. [0:v]scale_cuda=format=yuv444p[scaled_video];
  6619. [scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  6620. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  6621. @end example
  6622. @end itemize
  6623. @section bitplanenoise
  6624. Show and measure bit plane noise.
  6625. The filter accepts the following options:
  6626. @table @option
  6627. @item bitplane
  6628. Set which plane to analyze. Default is @code{1}.
  6629. @item filter
  6630. Filter out noisy pixels from @code{bitplane} set above.
  6631. Default is disabled.
  6632. @end table
  6633. @section blackdetect
  6634. Detect video intervals that are (almost) completely black. Can be
  6635. useful to detect chapter transitions, commercials, or invalid
  6636. recordings.
  6637. The filter outputs its detection analysis to both the log as well as
  6638. frame metadata. If a black segment of at least the specified minimum
  6639. duration is found, a line with the start and end timestamps as well
  6640. as duration is printed to the log with level @code{info}. In addition,
  6641. a log line with level @code{debug} is printed per frame showing the
  6642. black amount detected for that frame.
  6643. The filter also attaches metadata to the first frame of a black
  6644. segment with key @code{lavfi.black_start} and to the first frame
  6645. after the black segment ends with key @code{lavfi.black_end}. The
  6646. value is the frame's timestamp. This metadata is added regardless
  6647. of the minimum duration specified.
  6648. The filter accepts the following options:
  6649. @table @option
  6650. @item black_min_duration, d
  6651. Set the minimum detected black duration expressed in seconds. It must
  6652. be a non-negative floating point number.
  6653. Default value is 2.0.
  6654. @item picture_black_ratio_th, pic_th
  6655. Set the threshold for considering a picture "black".
  6656. Express the minimum value for the ratio:
  6657. @example
  6658. @var{nb_black_pixels} / @var{nb_pixels}
  6659. @end example
  6660. for which a picture is considered black.
  6661. Default value is 0.98.
  6662. @item pixel_black_th, pix_th
  6663. Set the threshold for considering a pixel "black".
  6664. The threshold expresses the maximum pixel luma value for which a
  6665. pixel is considered "black". The provided value is scaled according to
  6666. the following equation:
  6667. @example
  6668. @var{absolute_threshold} = @var{luma_minimum_value} + @var{pixel_black_th} * @var{luma_range_size}
  6669. @end example
  6670. @var{luma_range_size} and @var{luma_minimum_value} depend on
  6671. the input video format, the range is [0-255] for YUV full-range
  6672. formats and [16-235] for YUV non full-range formats.
  6673. Default value is 0.10.
  6674. @end table
  6675. The following example sets the maximum pixel threshold to the minimum
  6676. value, and detects only black intervals of 2 or more seconds:
  6677. @example
  6678. blackdetect=d=2:pix_th=0.00
  6679. @end example
  6680. @section blackframe
  6681. Detect frames that are (almost) completely black. Can be useful to
  6682. detect chapter transitions or commercials. Output lines consist of
  6683. the frame number of the detected frame, the percentage of blackness,
  6684. the position in the file if known or -1 and the timestamp in seconds.
  6685. In order to display the output lines, you need to set the loglevel at
  6686. least to the AV_LOG_INFO value.
  6687. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6688. The value represents the percentage of pixels in the picture that
  6689. are below the threshold value.
  6690. It accepts the following parameters:
  6691. @table @option
  6692. @item amount
  6693. The percentage of the pixels that have to be below the threshold; it defaults to
  6694. @code{98}.
  6695. @item threshold, thresh
  6696. The threshold below which a pixel value is considered black; it defaults to
  6697. @code{32}.
  6698. @end table
  6699. @anchor{blend}
  6700. @section blend
  6701. Blend two video frames into each other.
  6702. The @code{blend} filter takes two input streams and outputs one
  6703. stream, the first input is the "top" layer and second input is
  6704. "bottom" layer. By default, the output terminates when the longest input terminates.
  6705. The @code{tblend} (time blend) filter takes two consecutive frames
  6706. from one single stream, and outputs the result obtained by blending
  6707. the new frame on top of the old frame.
  6708. A description of the accepted options follows.
  6709. @table @option
  6710. @item c0_mode
  6711. @item c1_mode
  6712. @item c2_mode
  6713. @item c3_mode
  6714. @item all_mode
  6715. Set blend mode for specific pixel component or all pixel components in case
  6716. of @var{all_mode}. Default value is @code{normal}.
  6717. Available values for component modes are:
  6718. @table @samp
  6719. @item addition
  6720. @item and
  6721. @item average
  6722. @item bleach
  6723. @item burn
  6724. @item darken
  6725. @item difference
  6726. @item divide
  6727. @item dodge
  6728. @item exclusion
  6729. @item extremity
  6730. @item freeze
  6731. @item geometric
  6732. @item glow
  6733. @item grainextract
  6734. @item grainmerge
  6735. @item hardlight
  6736. @item hardmix
  6737. @item hardoverlay
  6738. @item harmonic
  6739. @item heat
  6740. @item interpolate
  6741. @item lighten
  6742. @item linearlight
  6743. @item multiply
  6744. @item multiply128
  6745. @item negation
  6746. @item normal
  6747. @item or
  6748. @item overlay
  6749. @item phoenix
  6750. @item pinlight
  6751. @item reflect
  6752. @item screen
  6753. @item softdifference
  6754. @item softlight
  6755. @item stain
  6756. @item subtract
  6757. @item vividlight
  6758. @item xor
  6759. @end table
  6760. @item c0_opacity
  6761. @item c1_opacity
  6762. @item c2_opacity
  6763. @item c3_opacity
  6764. @item all_opacity
  6765. Set blend opacity for specific pixel component or all pixel components in case
  6766. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6767. @item c0_expr
  6768. @item c1_expr
  6769. @item c2_expr
  6770. @item c3_expr
  6771. @item all_expr
  6772. Set blend expression for specific pixel component or all pixel components in case
  6773. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6774. The expressions can use the following variables:
  6775. @table @option
  6776. @item N
  6777. The sequential number of the filtered frame, starting from @code{0}.
  6778. @item X
  6779. @item Y
  6780. the coordinates of the current sample
  6781. @item W
  6782. @item H
  6783. the width and height of currently filtered plane
  6784. @item SW
  6785. @item SH
  6786. Width and height scale for the plane being filtered. It is the
  6787. ratio between the dimensions of the current plane to the luma plane,
  6788. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6789. the luma plane and @code{0.5,0.5} for the chroma planes.
  6790. @item T
  6791. Time of the current frame, expressed in seconds.
  6792. @item TOP, A
  6793. Value of pixel component at current location for first video frame (top layer).
  6794. @item BOTTOM, B
  6795. Value of pixel component at current location for second video frame (bottom layer).
  6796. @end table
  6797. @end table
  6798. The @code{blend} filter also supports the @ref{framesync} options.
  6799. @subsection Examples
  6800. @itemize
  6801. @item
  6802. Apply transition from bottom layer to top layer in first 10 seconds:
  6803. @example
  6804. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6805. @end example
  6806. @item
  6807. Apply linear horizontal transition from top layer to bottom layer:
  6808. @example
  6809. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6810. @end example
  6811. @item
  6812. Apply 1x1 checkerboard effect:
  6813. @example
  6814. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6815. @end example
  6816. @item
  6817. Apply uncover left effect:
  6818. @example
  6819. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6820. @end example
  6821. @item
  6822. Apply uncover down effect:
  6823. @example
  6824. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6825. @end example
  6826. @item
  6827. Apply uncover up-left effect:
  6828. @example
  6829. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6830. @end example
  6831. @item
  6832. Split diagonally video and shows top and bottom layer on each side:
  6833. @example
  6834. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6835. @end example
  6836. @item
  6837. Display differences between the current and the previous frame:
  6838. @example
  6839. tblend=all_mode=grainextract
  6840. @end example
  6841. @end itemize
  6842. @subsection Commands
  6843. This filter supports same @ref{commands} as options.
  6844. @anchor{blockdetect}
  6845. @section blockdetect
  6846. Determines blockiness of frames without altering the input frames.
  6847. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference.
  6848. The filter accepts the following options:
  6849. @table @option
  6850. @item period_min
  6851. @item period_max
  6852. Set minimum and maximum values for determining pixel grids (periods).
  6853. Default values are [3,24].
  6854. @item planes
  6855. Set planes to filter. Default is first only.
  6856. @end table
  6857. @subsection Examples
  6858. @itemize
  6859. @item
  6860. Determine blockiness for the first plane and search for periods within [8,32]:
  6861. @example
  6862. blockdetect=period_min=8:period_max=32:planes=1
  6863. @end example
  6864. @end itemize
  6865. @anchor{blurdetect}
  6866. @section blurdetect
  6867. Determines blurriness of frames without altering the input frames.
  6868. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6869. Allows for a block-based abbreviation.
  6870. The filter accepts the following options:
  6871. @table @option
  6872. @item low
  6873. @item high
  6874. Set low and high threshold values used by the Canny thresholding
  6875. algorithm.
  6876. The high threshold selects the "strong" edge pixels, which are then
  6877. connected through 8-connectivity with the "weak" edge pixels selected
  6878. by the low threshold.
  6879. @var{low} and @var{high} threshold values must be chosen in the range
  6880. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6881. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6882. is @code{50/255}.
  6883. @item radius
  6884. Define the radius to search around an edge pixel for local maxima.
  6885. @item block_pct
  6886. Determine blurriness only for the most significant blocks, given in percentage.
  6887. @item block_width
  6888. Determine blurriness for blocks of width @var{block_width}. If set to any value smaller 1, no blocks are used and the whole image is processed as one no matter of @var{block_height}.
  6889. @item block_height
  6890. Determine blurriness for blocks of height @var{block_height}. If set to any value smaller 1, no blocks are used and the whole image is processed as one no matter of @var{block_width}.
  6891. @item planes
  6892. Set planes to filter. Default is first only.
  6893. @end table
  6894. @subsection Examples
  6895. @itemize
  6896. @item
  6897. Determine blur for 80% of most significant 32x32 blocks:
  6898. @example
  6899. blurdetect=block_width=32:block_height=32:block_pct=80
  6900. @end example
  6901. @end itemize
  6902. @section bm3d
  6903. Denoise frames using Block-Matching 3D algorithm.
  6904. The filter accepts the following options.
  6905. @table @option
  6906. @item sigma
  6907. Set denoising strength. Default value is 1.
  6908. Allowed range is from 0 to 999.9.
  6909. The denoising algorithm is very sensitive to sigma, so adjust it
  6910. according to the source.
  6911. @item block
  6912. Set local patch size. This sets dimensions in 2D.
  6913. @item bstep
  6914. Set sliding step for processing blocks. Default value is 4.
  6915. Allowed range is from 1 to 64.
  6916. Smaller values allows processing more reference blocks and is slower.
  6917. @item group
  6918. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6919. When set to 1, no block matching is done. Larger values allows more blocks
  6920. in single group.
  6921. Allowed range is from 1 to 256.
  6922. @item range
  6923. Set radius for search block matching. Default is 9.
  6924. Allowed range is from 1 to INT32_MAX.
  6925. @item mstep
  6926. Set step between two search locations for block matching. Default is 1.
  6927. Allowed range is from 1 to 64. Smaller is slower.
  6928. @item thmse
  6929. Set threshold of mean square error for block matching. Valid range is 0 to
  6930. INT32_MAX.
  6931. @item hdthr
  6932. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6933. Larger values results in stronger hard-thresholding filtering in frequency
  6934. domain.
  6935. @item estim
  6936. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6937. Default is @code{basic}.
  6938. @item ref
  6939. If enabled, filter will use 2nd stream for block matching.
  6940. Default is disabled for @code{basic} value of @var{estim} option,
  6941. and always enabled if value of @var{estim} is @code{final}.
  6942. @item planes
  6943. Set planes to filter. Default is all available except alpha.
  6944. @end table
  6945. @subsection Examples
  6946. @itemize
  6947. @item
  6948. Basic filtering with bm3d:
  6949. @example
  6950. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6951. @end example
  6952. @item
  6953. Same as above, but filtering only luma:
  6954. @example
  6955. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6956. @end example
  6957. @item
  6958. Same as above, but with both estimation modes:
  6959. @example
  6960. 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
  6961. @end example
  6962. @item
  6963. Same as above, but prefilter with @ref{nlmeans} filter instead:
  6964. @example
  6965. 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
  6966. @end example
  6967. @end itemize
  6968. @section boxblur
  6969. Apply a boxblur algorithm to the input video.
  6970. It accepts the following parameters:
  6971. @table @option
  6972. @item luma_radius, lr
  6973. @item luma_power, lp
  6974. @item chroma_radius, cr
  6975. @item chroma_power, cp
  6976. @item alpha_radius, ar
  6977. @item alpha_power, ap
  6978. @end table
  6979. A description of the accepted options follows.
  6980. @table @option
  6981. @item luma_radius, lr
  6982. @item chroma_radius, cr
  6983. @item alpha_radius, ar
  6984. Set an expression for the box radius in pixels used for blurring the
  6985. corresponding input plane.
  6986. The radius value must be a non-negative number, and must not be
  6987. greater than the value of the expression @code{min(w,h)/2} for the
  6988. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  6989. planes.
  6990. Default value for @option{luma_radius} is "2". If not specified,
  6991. @option{chroma_radius} and @option{alpha_radius} default to the
  6992. corresponding value set for @option{luma_radius}.
  6993. The expressions can contain the following constants:
  6994. @table @option
  6995. @item w
  6996. @item h
  6997. The input width and height in pixels.
  6998. @item cw
  6999. @item ch
  7000. The input chroma image width and height in pixels.
  7001. @item hsub
  7002. @item vsub
  7003. The horizontal and vertical chroma subsample values. For example, for the
  7004. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  7005. @end table
  7006. @item luma_power, lp
  7007. @item chroma_power, cp
  7008. @item alpha_power, ap
  7009. Specify how many times the boxblur filter is applied to the
  7010. corresponding plane.
  7011. Default value for @option{luma_power} is 2. If not specified,
  7012. @option{chroma_power} and @option{alpha_power} default to the
  7013. corresponding value set for @option{luma_power}.
  7014. A value of 0 will disable the effect.
  7015. @end table
  7016. @subsection Examples
  7017. @itemize
  7018. @item
  7019. Apply a boxblur filter with the luma, chroma, and alpha radii
  7020. set to 2:
  7021. @example
  7022. boxblur=luma_radius=2:luma_power=1
  7023. boxblur=2:1
  7024. @end example
  7025. @item
  7026. Set the luma radius to 2, and alpha and chroma radius to 0:
  7027. @example
  7028. boxblur=2:1:cr=0:ar=0
  7029. @end example
  7030. @item
  7031. Set the luma and chroma radii to a fraction of the video dimension:
  7032. @example
  7033. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  7034. @end example
  7035. @end itemize
  7036. @anchor{bwdif}
  7037. @section bwdif
  7038. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  7039. Deinterlacing Filter").
  7040. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  7041. interpolation algorithms.
  7042. It accepts the following parameters:
  7043. @table @option
  7044. @item mode
  7045. The interlacing mode to adopt. It accepts one of the following values:
  7046. @table @option
  7047. @item 0, send_frame
  7048. Output one frame for each frame.
  7049. @item 1, send_field
  7050. Output one frame for each field.
  7051. @end table
  7052. The default value is @code{send_field}.
  7053. @item parity
  7054. The picture field parity assumed for the input interlaced video. It accepts one
  7055. of the following values:
  7056. @table @option
  7057. @item 0, tff
  7058. Assume the top field is first.
  7059. @item 1, bff
  7060. Assume the bottom field is first.
  7061. @item -1, auto
  7062. Enable automatic detection of field parity.
  7063. @end table
  7064. The default value is @code{auto}.
  7065. If the interlacing is unknown or the decoder does not export this information,
  7066. top field first will be assumed.
  7067. @item deint
  7068. Specify which frames to deinterlace. Accepts one of the following
  7069. values:
  7070. @table @option
  7071. @item 0, all
  7072. Deinterlace all frames.
  7073. @item 1, interlaced
  7074. Only deinterlace frames marked as interlaced.
  7075. @end table
  7076. The default value is @code{all}.
  7077. @end table
  7078. @section bwdif_cuda
  7079. Deinterlace the input video using the @ref{bwdif} algorithm, but implemented
  7080. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  7081. and/or nvenc.
  7082. It accepts the following parameters:
  7083. @table @option
  7084. @item mode
  7085. The interlacing mode to adopt. It accepts one of the following values:
  7086. @table @option
  7087. @item 0, send_frame
  7088. Output one frame for each frame.
  7089. @item 1, send_field
  7090. Output one frame for each field.
  7091. @end table
  7092. The default value is @code{send_field}.
  7093. @item parity
  7094. The picture field parity assumed for the input interlaced video. It accepts one
  7095. of the following values:
  7096. @table @option
  7097. @item 0, tff
  7098. Assume the top field is first.
  7099. @item 1, bff
  7100. Assume the bottom field is first.
  7101. @item -1, auto
  7102. Enable automatic detection of field parity.
  7103. @end table
  7104. The default value is @code{auto}.
  7105. If the interlacing is unknown or the decoder does not export this information,
  7106. top field first will be assumed.
  7107. @item deint
  7108. Specify which frames to deinterlace. Accepts one of the following
  7109. values:
  7110. @table @option
  7111. @item 0, all
  7112. Deinterlace all frames.
  7113. @item 1, interlaced
  7114. Only deinterlace frames marked as interlaced.
  7115. @end table
  7116. The default value is @code{all}.
  7117. @end table
  7118. @section ccrepack
  7119. Repack CEA-708 closed captioning side data
  7120. This filter fixes various issues seen with commerical encoders
  7121. related to upstream malformed CEA-708 payloads, specifically
  7122. incorrect number of tuples (wrong cc_count for the target FPS),
  7123. and incorrect ordering of tuples (i.e. the CEA-608 tuples are not at
  7124. the first entries in the payload).
  7125. @section cas
  7126. Apply Contrast Adaptive Sharpen filter to video stream.
  7127. The filter accepts the following options:
  7128. @table @option
  7129. @item strength
  7130. Set the sharpening strength. Default value is 0.
  7131. @item planes
  7132. Set planes to filter. Default value is to filter all
  7133. planes except alpha plane.
  7134. @end table
  7135. @subsection Commands
  7136. This filter supports same @ref{commands} as options.
  7137. @section chromahold
  7138. Remove all color information for all colors except for certain one.
  7139. The filter accepts the following options:
  7140. @table @option
  7141. @item color
  7142. The color which will not be replaced with neutral chroma.
  7143. @item similarity
  7144. Similarity percentage with the above color.
  7145. 0.01 matches only the exact key color, while 1.0 matches everything.
  7146. @item blend
  7147. Blend percentage.
  7148. 0.0 makes pixels either fully gray, or not gray at all.
  7149. Higher values result in more preserved color.
  7150. @item yuv
  7151. Signals that the color passed is already in YUV instead of RGB.
  7152. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7153. This can be used to pass exact YUV values as hexadecimal numbers.
  7154. @end table
  7155. @subsection Commands
  7156. This filter supports same @ref{commands} as options.
  7157. The command accepts the same syntax of the corresponding option.
  7158. If the specified expression is not valid, it is kept at its current
  7159. value.
  7160. @anchor{chromakey}
  7161. @section chromakey
  7162. YUV colorspace color/chroma keying.
  7163. The filter accepts the following options:
  7164. @table @option
  7165. @item color
  7166. The color which will be replaced with transparency.
  7167. @item similarity
  7168. Similarity percentage with the key color.
  7169. 0.01 matches only the exact key color, while 1.0 matches everything.
  7170. @item blend
  7171. Blend percentage.
  7172. 0.0 makes pixels either fully transparent, or not transparent at all.
  7173. Higher values result in semi-transparent pixels, with a higher transparency
  7174. the more similar the pixels color is to the key color.
  7175. @item yuv
  7176. Signals that the color passed is already in YUV instead of RGB.
  7177. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7178. This can be used to pass exact YUV values as hexadecimal numbers.
  7179. @end table
  7180. @subsection Commands
  7181. This filter supports same @ref{commands} as options.
  7182. The command accepts the same syntax of the corresponding option.
  7183. If the specified expression is not valid, it is kept at its current
  7184. value.
  7185. @subsection Examples
  7186. @itemize
  7187. @item
  7188. Make every green pixel in the input image transparent:
  7189. @example
  7190. ffmpeg -i input.png -vf chromakey=green out.png
  7191. @end example
  7192. @item
  7193. Overlay a greenscreen-video on top of a static black background.
  7194. @example
  7195. 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
  7196. @end example
  7197. @end itemize
  7198. @section chromakey_cuda
  7199. CUDA accelerated YUV colorspace color/chroma keying.
  7200. This filter works like normal chromakey filter but operates on CUDA frames.
  7201. for more details and parameters see @ref{chromakey}.
  7202. @subsection Examples
  7203. @itemize
  7204. @item
  7205. Make all the green pixels in the input video transparent and use it as an overlay for another video:
  7206. @example
  7207. ./ffmpeg \
  7208. -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
  7209. -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
  7210. -init_hw_device cuda \
  7211. -filter_complex \
  7212. " \
  7213. [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
  7214. [1:v]scale_cuda=format=yuv420p[base]; \
  7215. [base][overlay_video]overlay_cuda" \
  7216. -an -sn -c:v h264_nvenc -cq 20 output.mp4
  7217. @end example
  7218. @item
  7219. Process two software sources, explicitly uploading the frames:
  7220. @example
  7221. ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
  7222. -f lavfi -i color=size=800x600:color=white,format=yuv420p \
  7223. -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
  7224. -filter_complex \
  7225. " \
  7226. [0]hwupload[under]; \
  7227. [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
  7228. [under][over]overlay_cuda" \
  7229. -c:v hevc_nvenc -cq 18 -preset slow output.mp4
  7230. @end example
  7231. @end itemize
  7232. @section chromanr
  7233. Reduce chrominance noise.
  7234. The filter accepts the following options:
  7235. @table @option
  7236. @item thres
  7237. Set threshold for averaging chrominance values.
  7238. Sum of absolute difference of Y, U and V pixel components of current
  7239. pixel and neighbour pixels lower than this threshold will be used in
  7240. averaging. Luma component is left unchanged and is copied to output.
  7241. Default value is 30. Allowed range is from 1 to 200.
  7242. @item sizew
  7243. Set horizontal radius of rectangle used for averaging.
  7244. Allowed range is from 1 to 100. Default value is 5.
  7245. @item sizeh
  7246. Set vertical radius of rectangle used for averaging.
  7247. Allowed range is from 1 to 100. Default value is 5.
  7248. @item stepw
  7249. Set horizontal step when averaging. Default value is 1.
  7250. Allowed range is from 1 to 50.
  7251. Mostly useful to speed-up filtering.
  7252. @item steph
  7253. Set vertical step when averaging. Default value is 1.
  7254. Allowed range is from 1 to 50.
  7255. Mostly useful to speed-up filtering.
  7256. @item threy
  7257. Set Y threshold for averaging chrominance values.
  7258. Set finer control for max allowed difference between Y components
  7259. of current pixel and neigbour pixels.
  7260. Default value is 200. Allowed range is from 1 to 200.
  7261. @item threu
  7262. Set U threshold for averaging chrominance values.
  7263. Set finer control for max allowed difference between U components
  7264. of current pixel and neigbour pixels.
  7265. Default value is 200. Allowed range is from 1 to 200.
  7266. @item threv
  7267. Set V threshold for averaging chrominance values.
  7268. Set finer control for max allowed difference between V components
  7269. of current pixel and neigbour pixels.
  7270. Default value is 200. Allowed range is from 1 to 200.
  7271. @item distance
  7272. Set distance type used in calculations.
  7273. @table @samp
  7274. @item manhattan
  7275. Absolute difference.
  7276. @item euclidean
  7277. Difference squared.
  7278. @end table
  7279. Default distance type is manhattan.
  7280. @end table
  7281. @subsection Commands
  7282. This filter supports same @ref{commands} as options.
  7283. The command accepts the same syntax of the corresponding option.
  7284. @section chromashift
  7285. Shift chroma pixels horizontally and/or vertically.
  7286. The filter accepts the following options:
  7287. @table @option
  7288. @item cbh
  7289. Set amount to shift chroma-blue horizontally.
  7290. @item cbv
  7291. Set amount to shift chroma-blue vertically.
  7292. @item crh
  7293. Set amount to shift chroma-red horizontally.
  7294. @item crv
  7295. Set amount to shift chroma-red vertically.
  7296. @item edge
  7297. Set edge mode, can be @var{smear}, default, or @var{warp}.
  7298. @end table
  7299. @subsection Commands
  7300. This filter supports the all above options as @ref{commands}.
  7301. @section ciescope
  7302. Display CIE color diagram with pixels overlaid onto it.
  7303. The filter accepts the following options:
  7304. @table @option
  7305. @item system
  7306. Set color system.
  7307. @table @samp
  7308. @item ntsc, 470m
  7309. @item ebu, 470bg
  7310. @item smpte
  7311. @item 240m
  7312. @item apple
  7313. @item widergb
  7314. @item cie1931
  7315. @item rec709, hdtv
  7316. @item uhdtv, rec2020
  7317. @item dcip3
  7318. @end table
  7319. @item cie
  7320. Set CIE system.
  7321. @table @samp
  7322. @item xyy
  7323. @item ucs
  7324. @item luv
  7325. @end table
  7326. @item gamuts
  7327. Set what gamuts to draw.
  7328. See @code{system} option for available values.
  7329. @item size, s
  7330. Set ciescope size, by default set to 512.
  7331. @item intensity, i
  7332. Set intensity used to map input pixel values to CIE diagram.
  7333. @item contrast
  7334. Set contrast used to draw tongue colors that are out of active color system gamut.
  7335. @item corrgamma
  7336. Correct gamma displayed on scope, by default enabled.
  7337. @item showwhite
  7338. Show white point on CIE diagram, by default disabled.
  7339. @item gamma
  7340. Set input gamma. Used only with XYZ input color space.
  7341. @item fill
  7342. Fill with CIE colors. By default is enabled.
  7343. @end table
  7344. @section codecview
  7345. Visualize information exported by some codecs.
  7346. Some codecs can export information through frames using side-data or other
  7347. means. For example, some MPEG based codecs export motion vectors through the
  7348. @var{export_mvs} flag in the codec @option{flags2} option.
  7349. The filter accepts the following option:
  7350. @table @option
  7351. @item block
  7352. Display block partition structure using the luma plane.
  7353. @item mv
  7354. Set motion vectors to visualize.
  7355. Available flags for @var{mv} are:
  7356. @table @samp
  7357. @item pf
  7358. forward predicted MVs of P-frames
  7359. @item bf
  7360. forward predicted MVs of B-frames
  7361. @item bb
  7362. backward predicted MVs of B-frames
  7363. @end table
  7364. @item qp
  7365. Display quantization parameters using the chroma planes.
  7366. @item mv_type, mvt
  7367. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  7368. Available flags for @var{mv_type} are:
  7369. @table @samp
  7370. @item fp
  7371. forward predicted MVs
  7372. @item bp
  7373. backward predicted MVs
  7374. @end table
  7375. @item frame_type, ft
  7376. Set frame type to visualize motion vectors of.
  7377. Available flags for @var{frame_type} are:
  7378. @table @samp
  7379. @item if
  7380. intra-coded frames (I-frames)
  7381. @item pf
  7382. predicted frames (P-frames)
  7383. @item bf
  7384. bi-directionally predicted frames (B-frames)
  7385. @end table
  7386. @end table
  7387. @subsection Examples
  7388. @itemize
  7389. @item
  7390. Visualize forward predicted MVs of all frames using @command{ffplay}:
  7391. @example
  7392. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  7393. @end example
  7394. @item
  7395. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  7396. @example
  7397. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  7398. @end example
  7399. @end itemize
  7400. @section colorbalance
  7401. Modify intensity of primary colors (red, green and blue) of input frames.
  7402. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  7403. regions for the red-cyan, green-magenta or blue-yellow balance.
  7404. A positive adjustment value shifts the balance towards the primary color, a negative
  7405. value towards the complementary color.
  7406. The filter accepts the following options:
  7407. @table @option
  7408. @item rs
  7409. @item gs
  7410. @item bs
  7411. Adjust red, green and blue shadows (darkest pixels).
  7412. @item rm
  7413. @item gm
  7414. @item bm
  7415. Adjust red, green and blue midtones (medium pixels).
  7416. @item rh
  7417. @item gh
  7418. @item bh
  7419. Adjust red, green and blue highlights (brightest pixels).
  7420. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7421. @item pl
  7422. Preserve lightness when changing color balance. Default is disabled.
  7423. @end table
  7424. @subsection Examples
  7425. @itemize
  7426. @item
  7427. Add red color cast to shadows:
  7428. @example
  7429. colorbalance=rs=.3
  7430. @end example
  7431. @end itemize
  7432. @subsection Commands
  7433. This filter supports the all above options as @ref{commands}.
  7434. @section colorcontrast
  7435. Adjust color contrast between RGB components.
  7436. The filter accepts the following options:
  7437. @table @option
  7438. @item rc
  7439. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7440. @item gm
  7441. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7442. @item by
  7443. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7444. @item rcw
  7445. @item gmw
  7446. @item byw
  7447. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  7448. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  7449. @item pl
  7450. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  7451. @end table
  7452. @subsection Commands
  7453. This filter supports the all above options as @ref{commands}.
  7454. @section colorcorrect
  7455. Adjust color white balance selectively for blacks and whites.
  7456. This filter operates in YUV colorspace.
  7457. The filter accepts the following options:
  7458. @table @option
  7459. @item rl
  7460. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  7461. Default value is 0.
  7462. @item bl
  7463. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  7464. Default value is 0.
  7465. @item rh
  7466. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7467. Default value is 0.
  7468. @item bh
  7469. Set the blue highlight spot. Allowed range is from -1.0 to 1.0.
  7470. Default value is 0.
  7471. @item saturation
  7472. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  7473. Default value is 1.
  7474. @item analyze
  7475. If set to anything other than @code{manual} it will analyze every frame and use derived
  7476. parameters for filtering output frame.
  7477. Possible values are:
  7478. @table @samp
  7479. @item manual
  7480. @item average
  7481. @item minmax
  7482. @item median
  7483. @end table
  7484. Default value is @code{manual}.
  7485. @end table
  7486. @subsection Commands
  7487. This filter supports the all above options as @ref{commands}.
  7488. @section colorchannelmixer
  7489. Adjust video input frames by re-mixing color channels.
  7490. This filter modifies a color channel by adding the values associated to
  7491. the other channels of the same pixels. For example if the value to
  7492. modify is red, the output value will be:
  7493. @example
  7494. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  7495. @end example
  7496. The filter accepts the following options:
  7497. @table @option
  7498. @item rr
  7499. @item rg
  7500. @item rb
  7501. @item ra
  7502. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  7503. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  7504. @item gr
  7505. @item gg
  7506. @item gb
  7507. @item ga
  7508. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  7509. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  7510. @item br
  7511. @item bg
  7512. @item bb
  7513. @item ba
  7514. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  7515. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  7516. @item ar
  7517. @item ag
  7518. @item ab
  7519. @item aa
  7520. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  7521. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  7522. Allowed ranges for options are @code{[-2.0, 2.0]}.
  7523. @item pc
  7524. Set preserve color mode. The accepted values are:
  7525. @table @samp
  7526. @item none
  7527. Disable color preserving, this is default.
  7528. @item lum
  7529. Preserve luminance.
  7530. @item max
  7531. Preserve max value of RGB triplet.
  7532. @item avg
  7533. Preserve average value of RGB triplet.
  7534. @item sum
  7535. Preserve sum value of RGB triplet.
  7536. @item nrm
  7537. Preserve normalized value of RGB triplet.
  7538. @item pwr
  7539. Preserve power value of RGB triplet.
  7540. @end table
  7541. @item pa
  7542. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  7543. Default is @code{0.0}, thus disabled.
  7544. @end table
  7545. @subsection Examples
  7546. @itemize
  7547. @item
  7548. Convert source to grayscale:
  7549. @example
  7550. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  7551. @end example
  7552. @item
  7553. Simulate sepia tones:
  7554. @example
  7555. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  7556. @end example
  7557. @end itemize
  7558. @subsection Commands
  7559. This filter supports the all above options as @ref{commands}.
  7560. @section colorize
  7561. Overlay a solid color on the video stream.
  7562. The filter accepts the following options:
  7563. @table @option
  7564. @item hue
  7565. Set the color hue. Allowed range is from 0 to 360.
  7566. Default value is 0.
  7567. @item saturation
  7568. Set the color saturation. Allowed range is from 0 to 1.
  7569. Default value is 0.5.
  7570. @item lightness
  7571. Set the color lightness. Allowed range is from 0 to 1.
  7572. Default value is 0.5.
  7573. @item mix
  7574. Set the mix of source lightness. By default is set to 1.0.
  7575. Allowed range is from 0.0 to 1.0.
  7576. @end table
  7577. @subsection Commands
  7578. This filter supports the all above options as @ref{commands}.
  7579. @section colorkey
  7580. RGB colorspace color keying.
  7581. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  7582. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  7583. the similarity radius depends on the value of the blend option.
  7584. The filter accepts the following options:
  7585. @table @option
  7586. @item color
  7587. Set the color for which alpha will be set to 0 (full transparency).
  7588. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7589. Default is @code{black}.
  7590. @item similarity
  7591. Set the radius from the key color within which other colors also have full transparency.
  7592. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  7593. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  7594. around the exact key color, while 1.0 matches everything.
  7595. Default is @code{0.01}.
  7596. @item blend
  7597. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  7598. 0.0 makes pixels either fully transparent or fully opaque.
  7599. Higher values result in semi-transparent pixels, with greater transparency
  7600. the more similar the pixel color is to the key color.
  7601. Range is 0.0 to 1.0. Default is @code{0.0}.
  7602. @end table
  7603. @subsection Examples
  7604. @itemize
  7605. @item
  7606. Make every green pixel in the input image transparent:
  7607. @example
  7608. ffmpeg -i input.png -vf colorkey=green out.png
  7609. @end example
  7610. @item
  7611. Overlay a greenscreen-video on top of a static background image.
  7612. @example
  7613. 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
  7614. @end example
  7615. @end itemize
  7616. @subsection Commands
  7617. This filter supports same @ref{commands} as options.
  7618. The command accepts the same syntax of the corresponding option.
  7619. If the specified expression is not valid, it is kept at its current
  7620. value.
  7621. @section colorhold
  7622. Remove all color information for all RGB colors except for certain one.
  7623. The filter accepts the following options:
  7624. @table @option
  7625. @item color
  7626. The color which will not be replaced with neutral gray.
  7627. @item similarity
  7628. Similarity percentage with the above color.
  7629. 0.01 matches only the exact key color, while 1.0 matches everything.
  7630. @item blend
  7631. Blend percentage. 0.0 makes pixels fully gray.
  7632. Higher values result in more preserved color.
  7633. @end table
  7634. @subsection Commands
  7635. This filter supports same @ref{commands} as options.
  7636. The command accepts the same syntax of the corresponding option.
  7637. If the specified expression is not valid, it is kept at its current
  7638. value.
  7639. @section colorlevels
  7640. Adjust video input frames using levels.
  7641. The filter accepts the following options:
  7642. @table @option
  7643. @item rimin
  7644. @item gimin
  7645. @item bimin
  7646. @item aimin
  7647. Adjust red, green, blue and alpha input black point.
  7648. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7649. @item rimax
  7650. @item gimax
  7651. @item bimax
  7652. @item aimax
  7653. Adjust red, green, blue and alpha input white point.
  7654. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  7655. Input levels are used to lighten highlights (bright tones), darken shadows
  7656. (dark tones), change the balance of bright and dark tones.
  7657. @item romin
  7658. @item gomin
  7659. @item bomin
  7660. @item aomin
  7661. Adjust red, green, blue and alpha output black point.
  7662. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  7663. @item romax
  7664. @item gomax
  7665. @item bomax
  7666. @item aomax
  7667. Adjust red, green, blue and alpha output white point.
  7668. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  7669. Output levels allows manual selection of a constrained output level range.
  7670. @item preserve
  7671. Set preserve color mode. The accepted values are:
  7672. @table @samp
  7673. @item none
  7674. Disable color preserving, this is default.
  7675. @item lum
  7676. Preserve luminance.
  7677. @item max
  7678. Preserve max value of RGB triplet.
  7679. @item avg
  7680. Preserve average value of RGB triplet.
  7681. @item sum
  7682. Preserve sum value of RGB triplet.
  7683. @item nrm
  7684. Preserve normalized value of RGB triplet.
  7685. @item pwr
  7686. Preserve power value of RGB triplet.
  7687. @end table
  7688. @end table
  7689. @subsection Examples
  7690. @itemize
  7691. @item
  7692. Make video output darker:
  7693. @example
  7694. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  7695. @end example
  7696. @item
  7697. Increase contrast:
  7698. @example
  7699. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  7700. @end example
  7701. @item
  7702. Make video output lighter:
  7703. @example
  7704. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  7705. @end example
  7706. @item
  7707. Increase brightness:
  7708. @example
  7709. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  7710. @end example
  7711. @end itemize
  7712. @subsection Commands
  7713. This filter supports the all above options as @ref{commands}.
  7714. @section colormap
  7715. Apply custom color maps to video stream.
  7716. This filter needs three input video streams.
  7717. First stream is video stream that is going to be filtered out.
  7718. Second and third video stream specify color patches for source
  7719. color to target color mapping.
  7720. The filter accepts the following options:
  7721. @table @option
  7722. @item patch_size
  7723. Set the source and target video stream patch size in pixels.
  7724. @item nb_patches
  7725. Set the max number of used patches from source and target video stream.
  7726. Default value is number of patches available in additional video streams.
  7727. Max allowed number of patches is @code{64}.
  7728. @item type
  7729. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  7730. Defaults is @code{absolute}.
  7731. @item kernel
  7732. Set the kernel used to measure color differences between mapped colors.
  7733. The accepted values are:
  7734. @table @samp
  7735. @item euclidean
  7736. @item weuclidean
  7737. @end table
  7738. Default is @code{euclidean}.
  7739. @end table
  7740. @section colormatrix
  7741. Convert color matrix.
  7742. The filter accepts the following options:
  7743. @table @option
  7744. @item src
  7745. @item dst
  7746. Specify the source and destination color matrix. Both values must be
  7747. specified.
  7748. The accepted values are:
  7749. @table @samp
  7750. @item bt709
  7751. BT.709
  7752. @item fcc
  7753. FCC
  7754. @item bt601
  7755. BT.601
  7756. @item bt470
  7757. BT.470
  7758. @item bt470bg
  7759. BT.470BG
  7760. @item smpte170m
  7761. SMPTE-170M
  7762. @item smpte240m
  7763. SMPTE-240M
  7764. @item bt2020
  7765. BT.2020
  7766. @end table
  7767. @end table
  7768. For example to convert from BT.601 to SMPTE-240M, use the command:
  7769. @example
  7770. colormatrix=bt601:smpte240m
  7771. @end example
  7772. @section colorspace
  7773. Convert colorspace, transfer characteristics or color primaries.
  7774. Input video needs to have an even size.
  7775. The filter accepts the following options:
  7776. @table @option
  7777. @anchor{all}
  7778. @item all
  7779. Specify all color properties at once.
  7780. The accepted values are:
  7781. @table @samp
  7782. @item bt470m
  7783. BT.470M
  7784. @item bt470bg
  7785. BT.470BG
  7786. @item bt601-6-525
  7787. BT.601-6 525
  7788. @item bt601-6-625
  7789. BT.601-6 625
  7790. @item bt709
  7791. BT.709
  7792. @item smpte170m
  7793. SMPTE-170M
  7794. @item smpte240m
  7795. SMPTE-240M
  7796. @item bt2020
  7797. BT.2020
  7798. @end table
  7799. @anchor{space}
  7800. @item space
  7801. Specify output colorspace.
  7802. The accepted values are:
  7803. @table @samp
  7804. @item bt709
  7805. BT.709
  7806. @item fcc
  7807. FCC
  7808. @item bt470bg
  7809. BT.470BG or BT.601-6 625
  7810. @item smpte170m
  7811. SMPTE-170M or BT.601-6 525
  7812. @item smpte240m
  7813. SMPTE-240M
  7814. @item ycgco
  7815. YCgCo
  7816. @item bt2020ncl
  7817. BT.2020 with non-constant luminance
  7818. @end table
  7819. @anchor{trc}
  7820. @item trc
  7821. Specify output transfer characteristics.
  7822. The accepted values are:
  7823. @table @samp
  7824. @item bt709
  7825. BT.709
  7826. @item bt470m
  7827. BT.470M
  7828. @item bt470bg
  7829. BT.470BG
  7830. @item gamma22
  7831. Constant gamma of 2.2
  7832. @item gamma28
  7833. Constant gamma of 2.8
  7834. @item smpte170m
  7835. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7836. @item smpte240m
  7837. SMPTE-240M
  7838. @item srgb
  7839. SRGB
  7840. @item iec61966-2-1
  7841. iec61966-2-1
  7842. @item iec61966-2-4
  7843. iec61966-2-4
  7844. @item xvycc
  7845. xvycc
  7846. @item bt2020-10
  7847. BT.2020 for 10-bits content
  7848. @item bt2020-12
  7849. BT.2020 for 12-bits content
  7850. @end table
  7851. @anchor{primaries}
  7852. @item primaries
  7853. Specify output color primaries.
  7854. The accepted values are:
  7855. @table @samp
  7856. @item bt709
  7857. BT.709
  7858. @item bt470m
  7859. BT.470M
  7860. @item bt470bg
  7861. BT.470BG or BT.601-6 625
  7862. @item smpte170m
  7863. SMPTE-170M or BT.601-6 525
  7864. @item smpte240m
  7865. SMPTE-240M
  7866. @item film
  7867. film
  7868. @item smpte431
  7869. SMPTE-431
  7870. @item smpte432
  7871. SMPTE-432
  7872. @item bt2020
  7873. BT.2020
  7874. @item jedec-p22
  7875. JEDEC P22 phosphors
  7876. @end table
  7877. @anchor{range}
  7878. @item range
  7879. Specify output color range.
  7880. The accepted values are:
  7881. @table @samp
  7882. @item tv
  7883. TV (restricted) range
  7884. @item mpeg
  7885. MPEG (restricted) range
  7886. @item pc
  7887. PC (full) range
  7888. @item jpeg
  7889. JPEG (full) range
  7890. @end table
  7891. @item format
  7892. Specify output color format.
  7893. The accepted values are:
  7894. @table @samp
  7895. @item yuv420p
  7896. YUV 4:2:0 planar 8-bits
  7897. @item yuv420p10
  7898. YUV 4:2:0 planar 10-bits
  7899. @item yuv420p12
  7900. YUV 4:2:0 planar 12-bits
  7901. @item yuv422p
  7902. YUV 4:2:2 planar 8-bits
  7903. @item yuv422p10
  7904. YUV 4:2:2 planar 10-bits
  7905. @item yuv422p12
  7906. YUV 4:2:2 planar 12-bits
  7907. @item yuv444p
  7908. YUV 4:4:4 planar 8-bits
  7909. @item yuv444p10
  7910. YUV 4:4:4 planar 10-bits
  7911. @item yuv444p12
  7912. YUV 4:4:4 planar 12-bits
  7913. @end table
  7914. @item fast
  7915. Do a fast conversion, which skips gamma/primary correction. This will take
  7916. significantly less CPU, but will be mathematically incorrect. To get output
  7917. compatible with that produced by the colormatrix filter, use fast=1.
  7918. @item dither
  7919. Specify dithering mode.
  7920. The accepted values are:
  7921. @table @samp
  7922. @item none
  7923. No dithering
  7924. @item fsb
  7925. Floyd-Steinberg dithering
  7926. @end table
  7927. @item wpadapt
  7928. Whitepoint adaptation mode.
  7929. The accepted values are:
  7930. @table @samp
  7931. @item bradford
  7932. Bradford whitepoint adaptation
  7933. @item vonkries
  7934. von Kries whitepoint adaptation
  7935. @item identity
  7936. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7937. @end table
  7938. @item iall
  7939. Override all input properties at once. Same accepted values as @ref{all}.
  7940. @item ispace
  7941. Override input colorspace. Same accepted values as @ref{space}.
  7942. @item iprimaries
  7943. Override input color primaries. Same accepted values as @ref{primaries}.
  7944. @item itrc
  7945. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7946. @item irange
  7947. Override input color range. Same accepted values as @ref{range}.
  7948. @end table
  7949. The filter converts the transfer characteristics, color space and color
  7950. primaries to the specified user values. The output value, if not specified,
  7951. is set to a default value based on the "all" property. If that property is
  7952. also not specified, the filter will log an error. The output color range and
  7953. format default to the same value as the input color range and format. The
  7954. input transfer characteristics, color space, color primaries and color range
  7955. should be set on the input data. If any of these are missing, the filter will
  7956. log an error and no conversion will take place.
  7957. For example to convert the input to SMPTE-240M, use the command:
  7958. @example
  7959. colorspace=smpte240m
  7960. @end example
  7961. @section colorspace_cuda
  7962. CUDA accelerated implementation of the colorspace filter.
  7963. It is by no means feature complete compared to the software colorspace filter,
  7964. and at the current time only supports color range conversion between jpeg/full
  7965. and mpeg/limited range.
  7966. The filter accepts the following options:
  7967. @table @option
  7968. @item range
  7969. Specify output color range.
  7970. The accepted values are:
  7971. @table @samp
  7972. @item tv
  7973. TV (restricted) range
  7974. @item mpeg
  7975. MPEG (restricted) range
  7976. @item pc
  7977. PC (full) range
  7978. @item jpeg
  7979. JPEG (full) range
  7980. @end table
  7981. @end table
  7982. @section colortemperature
  7983. Adjust color temperature in video to simulate variations in ambient color temperature.
  7984. The filter accepts the following options:
  7985. @table @option
  7986. @item temperature
  7987. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7988. Default value is 6500 K.
  7989. @item mix
  7990. Set mixing with filtered output. Allowed range is from 0 to 1.
  7991. Default value is 1.
  7992. @item pl
  7993. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  7994. Default value is 0.
  7995. @end table
  7996. @subsection Commands
  7997. This filter supports same @ref{commands} as options.
  7998. @section convolution
  7999. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  8000. The filter accepts the following options:
  8001. @table @option
  8002. @item 0m
  8003. @item 1m
  8004. @item 2m
  8005. @item 3m
  8006. Set matrix for each plane.
  8007. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  8008. and from 1 to 49 odd number of signed integers in @var{row} mode.
  8009. @item 0rdiv
  8010. @item 1rdiv
  8011. @item 2rdiv
  8012. @item 3rdiv
  8013. Set multiplier for calculated value for each plane.
  8014. If unset or 0, it will be sum of all matrix elements.
  8015. @item 0bias
  8016. @item 1bias
  8017. @item 2bias
  8018. @item 3bias
  8019. Set bias for each plane. This value is added to the result of the multiplication.
  8020. Useful for making the overall image brighter or darker. Default is 0.0.
  8021. @item 0mode
  8022. @item 1mode
  8023. @item 2mode
  8024. @item 3mode
  8025. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  8026. Default is @var{square}.
  8027. @end table
  8028. @subsection Commands
  8029. This filter supports the all above options as @ref{commands}.
  8030. @subsection Examples
  8031. @itemize
  8032. @item
  8033. Apply sharpen:
  8034. @example
  8035. 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"
  8036. @end example
  8037. @item
  8038. Apply blur:
  8039. @example
  8040. 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"
  8041. @end example
  8042. @item
  8043. Apply edge enhance:
  8044. @example
  8045. 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"
  8046. @end example
  8047. @item
  8048. Apply edge detect:
  8049. @example
  8050. 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"
  8051. @end example
  8052. @item
  8053. Apply laplacian edge detector which includes diagonals:
  8054. @example
  8055. 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"
  8056. @end example
  8057. @item
  8058. Apply emboss:
  8059. @example
  8060. 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"
  8061. @end example
  8062. @end itemize
  8063. @section convolve
  8064. Apply 2D convolution of video stream in frequency domain using second stream
  8065. as impulse.
  8066. The filter accepts the following options:
  8067. @table @option
  8068. @item planes
  8069. Set which planes to process.
  8070. @item impulse
  8071. Set which impulse video frames will be processed, can be @var{first}
  8072. or @var{all}. Default is @var{all}.
  8073. @end table
  8074. The @code{convolve} filter also supports the @ref{framesync} options.
  8075. @section copy
  8076. Copy the input video source unchanged to the output. This is mainly useful for
  8077. testing purposes.
  8078. @anchor{coreimage}
  8079. @section coreimage
  8080. Video filtering on GPU using Apple's CoreImage API on OSX.
  8081. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  8082. processed by video hardware. However, software-based OpenGL implementations
  8083. exist which means there is no guarantee for hardware processing. It depends on
  8084. the respective OSX.
  8085. There are many filters and image generators provided by Apple that come with a
  8086. large variety of options. The filter has to be referenced by its name along
  8087. with its options.
  8088. The coreimage filter accepts the following options:
  8089. @table @option
  8090. @item list_filters
  8091. List all available filters and generators along with all their respective
  8092. options as well as possible minimum and maximum values along with the default
  8093. values.
  8094. @example
  8095. list_filters=true
  8096. @end example
  8097. @item filter
  8098. Specify all filters by their respective name and options.
  8099. Use @var{list_filters} to determine all valid filter names and options.
  8100. Numerical options are specified by a float value and are automatically clamped
  8101. to their respective value range. Vector and color options have to be specified
  8102. by a list of space separated float values. Character escaping has to be done.
  8103. A special option name @code{default} is available to use default options for a
  8104. filter.
  8105. It is required to specify either @code{default} or at least one of the filter options.
  8106. All omitted options are used with their default values.
  8107. The syntax of the filter string is as follows:
  8108. @example
  8109. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  8110. @end example
  8111. @item output_rect
  8112. Specify a rectangle where the output of the filter chain is copied into the
  8113. input image. It is given by a list of space separated float values:
  8114. @example
  8115. output_rect=x\ y\ width\ height
  8116. @end example
  8117. If not given, the output rectangle equals the dimensions of the input image.
  8118. The output rectangle is automatically cropped at the borders of the input
  8119. image. Negative values are valid for each component.
  8120. @example
  8121. output_rect=25\ 25\ 100\ 100
  8122. @end example
  8123. @end table
  8124. Several filters can be chained for successive processing without GPU-HOST
  8125. transfers allowing for fast processing of complex filter chains.
  8126. Currently, only filters with zero (generators) or exactly one (filters) input
  8127. image and one output image are supported. Also, transition filters are not yet
  8128. usable as intended.
  8129. Some filters generate output images with additional padding depending on the
  8130. respective filter kernel. The padding is automatically removed to ensure the
  8131. filter output has the same size as the input image.
  8132. For image generators, the size of the output image is determined by the
  8133. previous output image of the filter chain or the input image of the whole
  8134. filterchain, respectively. The generators do not use the pixel information of
  8135. this image to generate their output. However, the generated output is
  8136. blended onto this image, resulting in partial or complete coverage of the
  8137. output image.
  8138. The @ref{coreimagesrc} video source can be used for generating input images
  8139. which are directly fed into the filter chain. By using it, providing input
  8140. images by another video source or an input video is not required.
  8141. @subsection Examples
  8142. @itemize
  8143. @item
  8144. List all filters available:
  8145. @example
  8146. coreimage=list_filters=true
  8147. @end example
  8148. @item
  8149. Use the CIBoxBlur filter with default options to blur an image:
  8150. @example
  8151. coreimage=filter=CIBoxBlur@@default
  8152. @end example
  8153. @item
  8154. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  8155. its center at 100x100 and a radius of 50 pixels:
  8156. @example
  8157. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  8158. @end example
  8159. @item
  8160. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  8161. given as complete and escaped command-line for Apple's standard bash shell:
  8162. @example
  8163. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  8164. @end example
  8165. @end itemize
  8166. @section corr
  8167. Obtain the correlation between two input videos.
  8168. This filter takes two input videos.
  8169. Both input videos must have the same resolution and pixel format for
  8170. this filter to work correctly. Also it assumes that both inputs
  8171. have the same number of frames, which are compared one by one.
  8172. The obtained per component, average, min and max correlation is printed through
  8173. the logging system.
  8174. The filter stores the calculated correlation of each frame in frame metadata.
  8175. This filter also supports the @ref{framesync} options.
  8176. In the below example the input file @file{main.mpg} being processed is compared
  8177. with the reference file @file{ref.mpg}.
  8178. @example
  8179. ffmpeg -i main.mpg -i ref.mpg -lavfi corr -f null -
  8180. @end example
  8181. @section cover_rect
  8182. Cover a rectangular object
  8183. It accepts the following options:
  8184. @table @option
  8185. @item cover
  8186. Filepath of the optional cover image, needs to be in yuv420.
  8187. @item mode
  8188. Set covering mode.
  8189. It accepts the following values:
  8190. @table @samp
  8191. @item cover
  8192. cover it by the supplied image
  8193. @item blur
  8194. cover it by interpolating the surrounding pixels
  8195. @end table
  8196. Default value is @var{blur}.
  8197. @end table
  8198. @subsection Examples
  8199. @itemize
  8200. @item
  8201. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8202. @example
  8203. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8204. @end example
  8205. @end itemize
  8206. @section crop
  8207. Crop the input video to given dimensions.
  8208. It accepts the following parameters:
  8209. @table @option
  8210. @item w, out_w
  8211. The width of the output video. It defaults to @code{iw}.
  8212. This expression is evaluated only once during the filter
  8213. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  8214. @item h, out_h
  8215. The height of the output video. It defaults to @code{ih}.
  8216. This expression is evaluated only once during the filter
  8217. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  8218. @item x
  8219. The horizontal position, in the input video, of the left edge of the output
  8220. video. It defaults to @code{(in_w-out_w)/2}.
  8221. This expression is evaluated per-frame.
  8222. @item y
  8223. The vertical position, in the input video, of the top edge of the output video.
  8224. It defaults to @code{(in_h-out_h)/2}.
  8225. This expression is evaluated per-frame.
  8226. @item keep_aspect
  8227. If set to 1 will force the output display aspect ratio
  8228. to be the same of the input, by changing the output sample aspect
  8229. ratio. It defaults to 0.
  8230. @item exact
  8231. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  8232. width/height/x/y as specified and will not be rounded to nearest smaller value.
  8233. It defaults to 0.
  8234. @end table
  8235. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  8236. expressions containing the following constants:
  8237. @table @option
  8238. @item x
  8239. @item y
  8240. The computed values for @var{x} and @var{y}. They are evaluated for
  8241. each new frame.
  8242. @item in_w
  8243. @item in_h
  8244. The input width and height.
  8245. @item iw
  8246. @item ih
  8247. These are the same as @var{in_w} and @var{in_h}.
  8248. @item out_w
  8249. @item out_h
  8250. The output (cropped) width and height.
  8251. @item ow
  8252. @item oh
  8253. These are the same as @var{out_w} and @var{out_h}.
  8254. @item a
  8255. same as @var{iw} / @var{ih}
  8256. @item sar
  8257. input sample aspect ratio
  8258. @item dar
  8259. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8260. @item hsub
  8261. @item vsub
  8262. horizontal and vertical chroma subsample values. For example for the
  8263. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8264. @item n
  8265. The number of the input frame, starting from 0.
  8266. @item pos
  8267. the position in the file of the input frame, NAN if unknown; deprecated,
  8268. do not use
  8269. @item t
  8270. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  8271. @end table
  8272. The expression for @var{out_w} may depend on the value of @var{out_h},
  8273. and the expression for @var{out_h} may depend on @var{out_w}, but they
  8274. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  8275. evaluated after @var{out_w} and @var{out_h}.
  8276. The @var{x} and @var{y} parameters specify the expressions for the
  8277. position of the top-left corner of the output (non-cropped) area. They
  8278. are evaluated for each frame. If the evaluated value is not valid, it
  8279. is approximated to the nearest valid value.
  8280. The expression for @var{x} may depend on @var{y}, and the expression
  8281. for @var{y} may depend on @var{x}.
  8282. @subsection Examples
  8283. @itemize
  8284. @item
  8285. Crop area with size 100x100 at position (12,34).
  8286. @example
  8287. crop=100:100:12:34
  8288. @end example
  8289. Using named options, the example above becomes:
  8290. @example
  8291. crop=w=100:h=100:x=12:y=34
  8292. @end example
  8293. @item
  8294. Crop the central input area with size 100x100:
  8295. @example
  8296. crop=100:100
  8297. @end example
  8298. @item
  8299. Crop the central input area with size 2/3 of the input video:
  8300. @example
  8301. crop=2/3*in_w:2/3*in_h
  8302. @end example
  8303. @item
  8304. Crop the input video central square:
  8305. @example
  8306. crop=out_w=in_h
  8307. crop=in_h
  8308. @end example
  8309. @item
  8310. Delimit the rectangle with the top-left corner placed at position
  8311. 100:100 and the right-bottom corner corresponding to the right-bottom
  8312. corner of the input image.
  8313. @example
  8314. crop=in_w-100:in_h-100:100:100
  8315. @end example
  8316. @item
  8317. Crop 10 pixels from the left and right borders, and 20 pixels from
  8318. the top and bottom borders
  8319. @example
  8320. crop=in_w-2*10:in_h-2*20
  8321. @end example
  8322. @item
  8323. Keep only the bottom right quarter of the input image:
  8324. @example
  8325. crop=in_w/2:in_h/2:in_w/2:in_h/2
  8326. @end example
  8327. @item
  8328. Crop height for getting Greek harmony:
  8329. @example
  8330. crop=in_w:1/PHI*in_w
  8331. @end example
  8332. @item
  8333. Apply trembling effect:
  8334. @example
  8335. 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)
  8336. @end example
  8337. @item
  8338. Apply erratic camera effect depending on timestamp:
  8339. @example
  8340. 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)
  8341. @end example
  8342. @item
  8343. Set x depending on the value of y:
  8344. @example
  8345. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  8346. @end example
  8347. @end itemize
  8348. @subsection Commands
  8349. This filter supports the following commands:
  8350. @table @option
  8351. @item w, out_w
  8352. @item h, out_h
  8353. @item x
  8354. @item y
  8355. Set width/height of the output video and the horizontal/vertical position
  8356. in the input video.
  8357. The command accepts the same syntax of the corresponding option.
  8358. If the specified expression is not valid, it is kept at its current
  8359. value.
  8360. @end table
  8361. @section cropdetect
  8362. Auto-detect the crop size.
  8363. It calculates the necessary cropping parameters and prints the
  8364. recommended parameters via the logging system. The detected dimensions
  8365. correspond to the non-black or video area of the input video according to @var{mode}.
  8366. It accepts the following parameters:
  8367. @table @option
  8368. @item mode
  8369. Depending on @var{mode} crop detection is based on either the mere black value of surrounding pixels or a combination of motion vectors and edge pixels.
  8370. @table @samp
  8371. @item black
  8372. Detect black pixels surrounding the playing video. For fine control use option @var{limit}.
  8373. @item mvedges
  8374. Detect the playing video by the motion vectors inside the video and scanning for edge pixels typically forming the border of a playing video.
  8375. @end table
  8376. @item limit
  8377. Set higher black value threshold, which can be optionally specified
  8378. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  8379. value greater to the set value is considered non-black. It defaults to 24.
  8380. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  8381. on the bitdepth of the pixel format.
  8382. @item round
  8383. The value which the width/height should be divisible by. It defaults to
  8384. 16. The offset is automatically adjusted to center the video. Use 2 to
  8385. get only even dimensions (needed for 4:2:2 video). 16 is best when
  8386. encoding to most video codecs.
  8387. @item skip
  8388. Set the number of initial frames for which evaluation is skipped.
  8389. Default is 2. Range is 0 to INT_MAX.
  8390. @item reset_count, reset
  8391. Set the counter that determines after how many frames cropdetect will
  8392. reset the previously detected largest video area and start over to
  8393. detect the current optimal crop area. Default value is 0.
  8394. This can be useful when channel logos distort the video area. 0
  8395. indicates 'never reset', and returns the largest area encountered during
  8396. playback.
  8397. @item mv_threshold
  8398. Set motion in pixel units as threshold for motion detection. It defaults to 8.
  8399. @item low
  8400. @item high
  8401. Set low and high threshold values used by the Canny thresholding
  8402. algorithm.
  8403. The high threshold selects the "strong" edge pixels, which are then
  8404. connected through 8-connectivity with the "weak" edge pixels selected
  8405. by the low threshold.
  8406. @var{low} and @var{high} threshold values must be chosen in the range
  8407. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8408. Default value for @var{low} is @code{5/255}, and default value for @var{high}
  8409. is @code{15/255}.
  8410. @end table
  8411. @subsection Examples
  8412. @itemize
  8413. @item
  8414. Find video area surrounded by black borders:
  8415. @example
  8416. ffmpeg -i file.mp4 -vf cropdetect,metadata=mode=print -f null -
  8417. @end example
  8418. @item
  8419. Find an embedded video area, generate motion vectors beforehand:
  8420. @example
  8421. ffmpeg -i file.mp4 -vf mestimate,cropdetect=mode=mvedges,metadata=mode=print -f null -
  8422. @end example
  8423. @item
  8424. Find an embedded video area, use motion vectors from decoder:
  8425. @example
  8426. ffmpeg -flags2 +export_mvs -i file.mp4 -vf cropdetect=mode=mvedges,metadata=mode=print -f null -
  8427. @end example
  8428. @end itemize
  8429. @subsection Commands
  8430. This filter supports the following commands:
  8431. @table @option
  8432. @item limit
  8433. The command accepts the same syntax of the corresponding option.
  8434. If the specified expression is not valid, it is kept at its current value.
  8435. @end table
  8436. @anchor{cue}
  8437. @section cue
  8438. Delay video filtering until a given wallclock timestamp. The filter first
  8439. passes on @option{preroll} amount of frames, then it buffers at most
  8440. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  8441. it forwards the buffered frames and also any subsequent frames coming in its
  8442. input.
  8443. The filter can be used synchronize the output of multiple ffmpeg processes for
  8444. realtime output devices like decklink. By putting the delay in the filtering
  8445. chain and pre-buffering frames the process can pass on data to output almost
  8446. immediately after the target wallclock timestamp is reached.
  8447. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  8448. some use cases.
  8449. @table @option
  8450. @item cue
  8451. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  8452. @item preroll
  8453. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  8454. @item buffer
  8455. The maximum duration of content to buffer before waiting for the cue expressed
  8456. in seconds. Default is 0.
  8457. @end table
  8458. @anchor{curves}
  8459. @section curves
  8460. Apply color adjustments using curves.
  8461. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  8462. component (red, green and blue) has its values defined by @var{N} key points
  8463. tied from each other using a smooth curve. The x-axis represents the pixel
  8464. values from the input frame, and the y-axis the new pixel values to be set for
  8465. the output frame.
  8466. By default, a component curve is defined by the two points @var{(0;0)} and
  8467. @var{(1;1)}. This creates a straight line where each original pixel value is
  8468. "adjusted" to its own value, which means no change to the image.
  8469. The filter allows you to redefine these two points and add some more. A new
  8470. curve will be define to pass smoothly through all these new coordinates. The
  8471. new defined points needs to be strictly increasing over the x-axis, and their
  8472. @var{x} and @var{y} values must be in the @var{[0;1]} interval. The curve is
  8473. formed by using a natural or monotonic cubic spline interpolation, depending
  8474. on the @var{interp} option (default: @code{natural}). The @code{natural}
  8475. spline produces a smoother curve in general while the monotonic (@code{pchip})
  8476. spline guarantees the transitions between the specified points to be
  8477. monotonic. If the computed curves happened to go outside the vector spaces,
  8478. the values will be clipped accordingly.
  8479. The filter accepts the following options:
  8480. @table @option
  8481. @item preset
  8482. Select one of the available color presets. This option can be used in addition
  8483. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  8484. options takes priority on the preset values.
  8485. Available presets are:
  8486. @table @samp
  8487. @item none
  8488. @item color_negative
  8489. @item cross_process
  8490. @item darker
  8491. @item increase_contrast
  8492. @item lighter
  8493. @item linear_contrast
  8494. @item medium_contrast
  8495. @item negative
  8496. @item strong_contrast
  8497. @item vintage
  8498. @end table
  8499. Default is @code{none}.
  8500. @item master, m
  8501. Set the master key points. These points will define a second pass mapping. It
  8502. is sometimes called a "luminance" or "value" mapping. It can be used with
  8503. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  8504. post-processing LUT.
  8505. @item red, r
  8506. Set the key points for the red component.
  8507. @item green, g
  8508. Set the key points for the green component.
  8509. @item blue, b
  8510. Set the key points for the blue component.
  8511. @item all
  8512. Set the key points for all components (not including master).
  8513. Can be used in addition to the other key points component
  8514. options. In this case, the unset component(s) will fallback on this
  8515. @option{all} setting.
  8516. @item psfile
  8517. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  8518. @item plot
  8519. Save Gnuplot script of the curves in specified file.
  8520. @item interp
  8521. Specify the kind of interpolation. Available algorithms are:
  8522. @table @samp
  8523. @item natural
  8524. Natural cubic spline using a piece-wise cubic polynomial that is twice continuously differentiable.
  8525. @item pchip
  8526. Monotonic cubic spline using a piecewise cubic Hermite interpolating polynomial (PCHIP).
  8527. @end table
  8528. @end table
  8529. To avoid some filtergraph syntax conflicts, each key points list need to be
  8530. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  8531. @subsection Commands
  8532. This filter supports same @ref{commands} as options.
  8533. @subsection Examples
  8534. @itemize
  8535. @item
  8536. Increase slightly the middle level of blue:
  8537. @example
  8538. curves=blue='0/0 0.5/0.58 1/1'
  8539. @end example
  8540. @item
  8541. Vintage effect:
  8542. @example
  8543. 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'
  8544. @end example
  8545. Here we obtain the following coordinates for each components:
  8546. @table @var
  8547. @item red
  8548. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  8549. @item green
  8550. @code{(0;0) (0.50;0.48) (1;1)}
  8551. @item blue
  8552. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  8553. @end table
  8554. @item
  8555. The previous example can also be achieved with the associated built-in preset:
  8556. @example
  8557. curves=preset=vintage
  8558. @end example
  8559. @item
  8560. Or simply:
  8561. @example
  8562. curves=vintage
  8563. @end example
  8564. @item
  8565. Use a Photoshop preset and redefine the points of the green component:
  8566. @example
  8567. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  8568. @end example
  8569. @item
  8570. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  8571. and @command{gnuplot}:
  8572. @example
  8573. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  8574. gnuplot -p /tmp/curves.plt
  8575. @end example
  8576. @end itemize
  8577. @section datascope
  8578. Video data analysis filter.
  8579. This filter shows hexadecimal pixel values of part of video.
  8580. The filter accepts the following options:
  8581. @table @option
  8582. @item size, s
  8583. Set output video size.
  8584. @item x
  8585. Set x offset from where to pick pixels.
  8586. @item y
  8587. Set y offset from where to pick pixels.
  8588. @item mode
  8589. Set scope mode, can be one of the following:
  8590. @table @samp
  8591. @item mono
  8592. Draw hexadecimal pixel values with white color on black background.
  8593. @item color
  8594. Draw hexadecimal pixel values with input video pixel color on black
  8595. background.
  8596. @item color2
  8597. Draw hexadecimal pixel values on color background picked from input video,
  8598. the text color is picked in such way so its always visible.
  8599. @end table
  8600. @item axis
  8601. Draw rows and columns numbers on left and top of video.
  8602. @item opacity
  8603. Set background opacity.
  8604. @item format
  8605. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  8606. @item components
  8607. Set pixel components to display. By default all pixel components are displayed.
  8608. @end table
  8609. @subsection Commands
  8610. This filter supports same @ref{commands} as options excluding @code{size} option.
  8611. @section dblur
  8612. Apply Directional blur filter.
  8613. The filter accepts the following options:
  8614. @table @option
  8615. @item angle
  8616. Set angle of directional blur. Default is @code{45}.
  8617. @item radius
  8618. Set radius of directional blur. Default is @code{5}.
  8619. @item planes
  8620. Set which planes to filter. By default all planes are filtered.
  8621. @end table
  8622. @subsection Commands
  8623. This filter supports same @ref{commands} as options.
  8624. The command accepts the same syntax of the corresponding option.
  8625. If the specified expression is not valid, it is kept at its current
  8626. value.
  8627. @section dctdnoiz
  8628. Denoise frames using 2D DCT (frequency domain filtering).
  8629. This filter is not designed for real time.
  8630. The filter accepts the following options:
  8631. @table @option
  8632. @item sigma, s
  8633. Set the noise sigma constant.
  8634. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  8635. coefficient (absolute value) below this threshold with be dropped.
  8636. If you need a more advanced filtering, see @option{expr}.
  8637. Default is @code{0}.
  8638. @item overlap
  8639. Set number overlapping pixels for each block. Since the filter can be slow, you
  8640. may want to reduce this value, at the cost of a less effective filter and the
  8641. risk of various artefacts.
  8642. If the overlapping value doesn't permit processing the whole input width or
  8643. height, a warning will be displayed and according borders won't be denoised.
  8644. Default value is @var{blocksize}-1, which is the best possible setting.
  8645. @item expr, e
  8646. Set the coefficient factor expression.
  8647. For each coefficient of a DCT block, this expression will be evaluated as a
  8648. multiplier value for the coefficient.
  8649. If this is option is set, the @option{sigma} option will be ignored.
  8650. The absolute value of the coefficient can be accessed through the @var{c}
  8651. variable.
  8652. @item n
  8653. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  8654. @var{blocksize}, which is the width and height of the processed blocks.
  8655. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  8656. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  8657. on the speed processing. Also, a larger block size does not necessarily means a
  8658. better de-noising.
  8659. @end table
  8660. @subsection Examples
  8661. Apply a denoise with a @option{sigma} of @code{4.5}:
  8662. @example
  8663. dctdnoiz=4.5
  8664. @end example
  8665. The same operation can be achieved using the expression system:
  8666. @example
  8667. dctdnoiz=e='gte(c, 4.5*3)'
  8668. @end example
  8669. Violent denoise using a block size of @code{16x16}:
  8670. @example
  8671. dctdnoiz=15:n=4
  8672. @end example
  8673. @section deband
  8674. Remove banding artifacts from input video.
  8675. It works by replacing banded pixels with average value of referenced pixels.
  8676. The filter accepts the following options:
  8677. @table @option
  8678. @item 1thr
  8679. @item 2thr
  8680. @item 3thr
  8681. @item 4thr
  8682. Set banding detection threshold for each plane. Default is 0.02.
  8683. Valid range is 0.00003 to 0.5.
  8684. If difference between current pixel and reference pixel is less than threshold,
  8685. it will be considered as banded.
  8686. @item range, r
  8687. Banding detection range in pixels. Default is 16. If positive, random number
  8688. in range 0 to set value will be used. If negative, exact absolute value
  8689. will be used.
  8690. The range defines square of four pixels around current pixel.
  8691. @item direction, d
  8692. Set direction in radians from which four pixel will be compared. If positive,
  8693. random direction from 0 to set direction will be picked. If negative, exact of
  8694. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  8695. will pick only pixels on same row and -PI/2 will pick only pixels on same
  8696. column.
  8697. @item blur, b
  8698. If enabled, current pixel is compared with average value of all four
  8699. surrounding pixels. The default is enabled. If disabled current pixel is
  8700. compared with all four surrounding pixels. The pixel is considered banded
  8701. if only all four differences with surrounding pixels are less than threshold.
  8702. @item coupling, c
  8703. If enabled, current pixel is changed if and only if all pixel components are banded,
  8704. e.g. banding detection threshold is triggered for all color components.
  8705. The default is disabled.
  8706. @end table
  8707. @subsection Commands
  8708. This filter supports the all above options as @ref{commands}.
  8709. @section deblock
  8710. Remove blocking artifacts from input video.
  8711. The filter accepts the following options:
  8712. @table @option
  8713. @item filter
  8714. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  8715. This controls what kind of deblocking is applied.
  8716. @item block
  8717. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  8718. @item alpha
  8719. @item beta
  8720. @item gamma
  8721. @item delta
  8722. Set blocking detection thresholds. Allowed range is 0 to 1.
  8723. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  8724. Using higher threshold gives more deblocking strength.
  8725. Setting @var{alpha} controls threshold detection at exact edge of block.
  8726. Remaining options controls threshold detection near the edge. Each one for
  8727. below/above or left/right. Setting any of those to @var{0} disables
  8728. deblocking.
  8729. @item planes
  8730. Set planes to filter. Default is to filter all available planes.
  8731. @end table
  8732. @subsection Examples
  8733. @itemize
  8734. @item
  8735. Deblock using weak filter and block size of 4 pixels.
  8736. @example
  8737. deblock=filter=weak:block=4
  8738. @end example
  8739. @item
  8740. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  8741. deblocking more edges.
  8742. @example
  8743. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  8744. @end example
  8745. @item
  8746. Similar as above, but filter only first plane.
  8747. @example
  8748. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  8749. @end example
  8750. @item
  8751. Similar as above, but filter only second and third plane.
  8752. @example
  8753. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  8754. @end example
  8755. @end itemize
  8756. @subsection Commands
  8757. This filter supports the all above options as @ref{commands}.
  8758. @anchor{decimate}
  8759. @section decimate
  8760. Drop duplicated frames at regular intervals.
  8761. The filter accepts the following options:
  8762. @table @option
  8763. @item cycle
  8764. Set the number of frames from which one will be dropped. Setting this to
  8765. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  8766. Default is @code{5}.
  8767. @item dupthresh
  8768. Set the threshold for duplicate detection. If the difference metric for a frame
  8769. is less than or equal to this value, then it is declared as duplicate. Default
  8770. is @code{1.1}
  8771. @item scthresh
  8772. Set scene change threshold. Default is @code{15}.
  8773. @item blockx
  8774. @item blocky
  8775. Set the size of the x and y-axis blocks used during metric calculations.
  8776. Larger blocks give better noise suppression, but also give worse detection of
  8777. small movements. Must be a power of two. Default is @code{32}.
  8778. @item ppsrc
  8779. Mark main input as a pre-processed input and activate clean source input
  8780. stream. This allows the input to be pre-processed with various filters to help
  8781. the metrics calculation while keeping the frame selection lossless. When set to
  8782. @code{1}, the first stream is for the pre-processed input, and the second
  8783. stream is the clean source from where the kept frames are chosen. Default is
  8784. @code{0}.
  8785. @item chroma
  8786. Set whether or not chroma is considered in the metric calculations. Default is
  8787. @code{1}.
  8788. @item mixed
  8789. Set whether or not the input only partially contains content to be decimated.
  8790. Default is @code{false}.
  8791. If enabled video output stream will be in variable frame rate.
  8792. @end table
  8793. @section deconvolve
  8794. Apply 2D deconvolution of video stream in frequency domain using second stream
  8795. as impulse.
  8796. The filter accepts the following options:
  8797. @table @option
  8798. @item planes
  8799. Set which planes to process.
  8800. @item impulse
  8801. Set which impulse video frames will be processed, can be @var{first}
  8802. or @var{all}. Default is @var{all}.
  8803. @item noise
  8804. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  8805. and height are not same and not power of 2 or if stream prior to convolving
  8806. had noise.
  8807. @end table
  8808. The @code{deconvolve} filter also supports the @ref{framesync} options.
  8809. @section dedot
  8810. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  8811. It accepts the following options:
  8812. @table @option
  8813. @item m
  8814. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  8815. @var{rainbows} for cross-color reduction.
  8816. @item lt
  8817. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  8818. @item tl
  8819. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  8820. @item tc
  8821. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  8822. @item ct
  8823. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  8824. @end table
  8825. @section deflate
  8826. Apply deflate effect to the video.
  8827. This filter replaces the pixel by the local(3x3) average by taking into account
  8828. only values lower than the pixel.
  8829. It accepts the following options:
  8830. @table @option
  8831. @item threshold0
  8832. @item threshold1
  8833. @item threshold2
  8834. @item threshold3
  8835. Limit the maximum change for each plane, default is 65535.
  8836. If 0, plane will remain unchanged.
  8837. @end table
  8838. @subsection Commands
  8839. This filter supports the all above options as @ref{commands}.
  8840. @section deflicker
  8841. Remove temporal frame luminance variations.
  8842. It accepts the following options:
  8843. @table @option
  8844. @item size, s
  8845. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  8846. @item mode, m
  8847. Set averaging mode to smooth temporal luminance variations.
  8848. Available values are:
  8849. @table @samp
  8850. @item am
  8851. Arithmetic mean
  8852. @item gm
  8853. Geometric mean
  8854. @item hm
  8855. Harmonic mean
  8856. @item qm
  8857. Quadratic mean
  8858. @item cm
  8859. Cubic mean
  8860. @item pm
  8861. Power mean
  8862. @item median
  8863. Median
  8864. @end table
  8865. @item bypass
  8866. Do not actually modify frame. Useful when one only wants metadata.
  8867. @end table
  8868. @section dejudder
  8869. Remove judder produced by partially interlaced telecined content.
  8870. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8871. source was partially telecined content then the output of @code{pullup,dejudder}
  8872. will have a variable frame rate. May change the recorded frame rate of the
  8873. container. Aside from that change, this filter will not affect constant frame
  8874. rate video.
  8875. The option available in this filter is:
  8876. @table @option
  8877. @item cycle
  8878. Specify the length of the window over which the judder repeats.
  8879. Accepts any integer greater than 1. Useful values are:
  8880. @table @samp
  8881. @item 4
  8882. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8883. @item 5
  8884. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8885. @item 20
  8886. If a mixture of the two.
  8887. @end table
  8888. The default is @samp{4}.
  8889. @end table
  8890. @section delogo
  8891. Suppress a TV station logo by a simple interpolation of the surrounding
  8892. pixels. Just set a rectangle covering the logo and watch it disappear
  8893. (and sometimes something even uglier appear - your mileage may vary).
  8894. It accepts the following parameters:
  8895. @table @option
  8896. @item x
  8897. @item y
  8898. Specify the top left corner coordinates of the logo. They must be
  8899. specified.
  8900. @item w
  8901. @item h
  8902. Specify the width and height of the logo to clear. They must be
  8903. specified.
  8904. @item show
  8905. When set to 1, a green rectangle is drawn on the screen to simplify
  8906. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8907. The default value is 0.
  8908. The rectangle is drawn on the outermost pixels which will be (partly)
  8909. replaced with interpolated values. The values of the next pixels
  8910. immediately outside this rectangle in each direction will be used to
  8911. compute the interpolated pixel values inside the rectangle.
  8912. @end table
  8913. @subsection Examples
  8914. @itemize
  8915. @item
  8916. Set a rectangle covering the area with top left corner coordinates 0,0
  8917. and size 100x77:
  8918. @example
  8919. delogo=x=0:y=0:w=100:h=77
  8920. @end example
  8921. @end itemize
  8922. @anchor{derain}
  8923. @section derain
  8924. Remove the rain in the input image/video by applying the derain methods based on
  8925. convolutional neural networks. Supported models:
  8926. @itemize
  8927. @item
  8928. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8929. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8930. @end itemize
  8931. Training as well as model generation scripts are provided in
  8932. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8933. The filter accepts the following options:
  8934. @table @option
  8935. @item filter_type
  8936. Specify which filter to use. This option accepts the following values:
  8937. @table @samp
  8938. @item derain
  8939. Derain filter. To conduct derain filter, you need to use a derain model.
  8940. @item dehaze
  8941. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  8942. @end table
  8943. Default value is @samp{derain}.
  8944. @item dnn_backend
  8945. Specify which DNN backend to use for model loading and execution. This option accepts
  8946. the following values:
  8947. @table @samp
  8948. @item tensorflow
  8949. TensorFlow backend. To enable this backend you
  8950. need to install the TensorFlow for C library (see
  8951. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8952. @code{--enable-libtensorflow}
  8953. @end table
  8954. @item model
  8955. Set path to model file specifying network architecture and its parameters.
  8956. Note that different backends use different file formats. TensorFlow can load files for only its format.
  8957. @end table
  8958. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  8959. @section deshake
  8960. Attempt to fix small changes in horizontal and/or vertical shift. This
  8961. filter helps remove camera shake from hand-holding a camera, bumping a
  8962. tripod, moving on a vehicle, etc.
  8963. The filter accepts the following options:
  8964. @table @option
  8965. @item x
  8966. @item y
  8967. @item w
  8968. @item h
  8969. Specify a rectangular area where to limit the search for motion
  8970. vectors.
  8971. If desired the search for motion vectors can be limited to a
  8972. rectangular area of the frame defined by its top left corner, width
  8973. and height. These parameters have the same meaning as the drawbox
  8974. filter which can be used to visualise the position of the bounding
  8975. box.
  8976. This is useful when simultaneous movement of subjects within the frame
  8977. might be confused for camera motion by the motion vector search.
  8978. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  8979. then the full frame is used. This allows later options to be set
  8980. without specifying the bounding box for the motion vector search.
  8981. Default - search the whole frame.
  8982. @item rx
  8983. @item ry
  8984. Specify the maximum extent of movement in x and y directions in the
  8985. range 0-64 pixels. Default 16.
  8986. @item edge
  8987. Specify how to generate pixels to fill blanks at the edge of the
  8988. frame. Available values are:
  8989. @table @samp
  8990. @item blank, 0
  8991. Fill zeroes at blank locations
  8992. @item original, 1
  8993. Original image at blank locations
  8994. @item clamp, 2
  8995. Extruded edge value at blank locations
  8996. @item mirror, 3
  8997. Mirrored edge at blank locations
  8998. @end table
  8999. Default value is @samp{mirror}.
  9000. @item blocksize
  9001. Specify the blocksize to use for motion search. Range 4-128 pixels,
  9002. default 8.
  9003. @item contrast
  9004. Specify the contrast threshold for blocks. Only blocks with more than
  9005. the specified contrast (difference between darkest and lightest
  9006. pixels) will be considered. Range 1-255, default 125.
  9007. @item search
  9008. Specify the search strategy. Available values are:
  9009. @table @samp
  9010. @item exhaustive, 0
  9011. Set exhaustive search
  9012. @item less, 1
  9013. Set less exhaustive search.
  9014. @end table
  9015. Default value is @samp{exhaustive}.
  9016. @item filename
  9017. If set then a detailed log of the motion search is written to the
  9018. specified file.
  9019. @end table
  9020. @section despill
  9021. Remove unwanted contamination of foreground colors, caused by reflected color of
  9022. greenscreen or bluescreen.
  9023. This filter accepts the following options:
  9024. @table @option
  9025. @item type
  9026. Set what type of despill to use.
  9027. @item mix
  9028. Set how spillmap will be generated.
  9029. @item expand
  9030. Set how much to get rid of still remaining spill.
  9031. @item red
  9032. Controls amount of red in spill area.
  9033. @item green
  9034. Controls amount of green in spill area.
  9035. Should be -1 for greenscreen.
  9036. @item blue
  9037. Controls amount of blue in spill area.
  9038. Should be -1 for bluescreen.
  9039. @item brightness
  9040. Controls brightness of spill area, preserving colors.
  9041. @item alpha
  9042. Modify alpha from generated spillmap.
  9043. @end table
  9044. @subsection Commands
  9045. This filter supports the all above options as @ref{commands}.
  9046. @section detelecine
  9047. Apply an exact inverse of the telecine operation. It requires a predefined
  9048. pattern specified using the pattern option which must be the same as that passed
  9049. to the telecine filter.
  9050. This filter accepts the following options:
  9051. @table @option
  9052. @item first_field
  9053. @table @samp
  9054. @item top, t
  9055. top field first
  9056. @item bottom, b
  9057. bottom field first
  9058. The default value is @code{top}.
  9059. @end table
  9060. @item pattern
  9061. A string of numbers representing the pulldown pattern you wish to apply.
  9062. The default value is @code{23}.
  9063. @item start_frame
  9064. A number representing position of the first frame with respect to the telecine
  9065. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  9066. @end table
  9067. @anchor{dilation}
  9068. @section dilation
  9069. Apply dilation effect to the video.
  9070. This filter replaces the pixel by the local(3x3) maximum.
  9071. It accepts the following options:
  9072. @table @option
  9073. @item threshold0
  9074. @item threshold1
  9075. @item threshold2
  9076. @item threshold3
  9077. Limit the maximum change for each plane, default is 65535.
  9078. If 0, plane will remain unchanged.
  9079. @item coordinates
  9080. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9081. pixels are used.
  9082. Flags to local 3x3 coordinates maps like this:
  9083. 1 2 3
  9084. 4 5
  9085. 6 7 8
  9086. @end table
  9087. @subsection Commands
  9088. This filter supports the all above options as @ref{commands}.
  9089. @section displace
  9090. Displace pixels as indicated by second and third input stream.
  9091. It takes three input streams and outputs one stream, the first input is the
  9092. source, and second and third input are displacement maps.
  9093. The second input specifies how much to displace pixels along the
  9094. x-axis, while the third input specifies how much to displace pixels
  9095. along the y-axis.
  9096. If one of displacement map streams terminates, last frame from that
  9097. displacement map will be used.
  9098. Note that once generated, displacements maps can be reused over and over again.
  9099. A description of the accepted options follows.
  9100. @table @option
  9101. @item edge
  9102. Set displace behavior for pixels that are out of range.
  9103. Available values are:
  9104. @table @samp
  9105. @item blank
  9106. Missing pixels are replaced by black pixels.
  9107. @item smear
  9108. Adjacent pixels will spread out to replace missing pixels.
  9109. @item wrap
  9110. Out of range pixels are wrapped so they point to pixels of other side.
  9111. @item mirror
  9112. Out of range pixels will be replaced with mirrored pixels.
  9113. @end table
  9114. Default is @samp{smear}.
  9115. @end table
  9116. @subsection Examples
  9117. @itemize
  9118. @item
  9119. Add ripple effect to rgb input of video size hd720:
  9120. @example
  9121. 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
  9122. @end example
  9123. @item
  9124. Add wave effect to rgb input of video size hd720:
  9125. @example
  9126. 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
  9127. @end example
  9128. @end itemize
  9129. @section dnn_classify
  9130. Do classification with deep neural networks based on bounding boxes.
  9131. The filter accepts the following options:
  9132. @table @option
  9133. @item dnn_backend
  9134. Specify which DNN backend to use for model loading and execution. This option accepts
  9135. only openvino now, tensorflow backends will be added.
  9136. @item model
  9137. Set path to model file specifying network architecture and its parameters.
  9138. Note that different backends use different file formats.
  9139. @item input
  9140. Set the input name of the dnn network.
  9141. @item output
  9142. Set the output name of the dnn network.
  9143. @item confidence
  9144. Set the confidence threshold (default: 0.5).
  9145. @item labels
  9146. Set path to label file specifying the mapping between label id and name.
  9147. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9148. The first line is the name of label id 0,
  9149. and the second line is the name of label id 1, etc.
  9150. The label id is considered as name if the label file is not provided.
  9151. @item backend_configs
  9152. Set the configs to be passed into backend
  9153. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9154. please use tools/python/tf_sess_config.py to get the configs for your system.
  9155. @end table
  9156. @section dnn_detect
  9157. Do object detection with deep neural networks.
  9158. The filter accepts the following options:
  9159. @table @option
  9160. @item dnn_backend
  9161. Specify which DNN backend to use for model loading and execution. This option accepts
  9162. only openvino now, tensorflow backends will be added.
  9163. @item model
  9164. Set path to model file specifying network architecture and its parameters.
  9165. Note that different backends use different file formats.
  9166. @item input
  9167. Set the input name of the dnn network.
  9168. @item output
  9169. Set the output name of the dnn network.
  9170. @item confidence
  9171. Set the confidence threshold (default: 0.5).
  9172. @item labels
  9173. Set path to label file specifying the mapping between label id and name.
  9174. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9175. The first line is the name of label id 0 (usually it is 'background'),
  9176. and the second line is the name of label id 1, etc.
  9177. The label id is considered as name if the label file is not provided.
  9178. @item backend_configs
  9179. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9180. Roll back to sync execution if the backend does not support async.
  9181. @end table
  9182. @anchor{dnn_processing}
  9183. @section dnn_processing
  9184. Do image processing with deep neural networks. It works together with another filter
  9185. which converts the pixel format of the Frame to what the dnn network requires.
  9186. The filter accepts the following options:
  9187. @table @option
  9188. @item dnn_backend
  9189. Specify which DNN backend to use for model loading and execution. This option accepts
  9190. the following values:
  9191. @table @samp
  9192. @item tensorflow
  9193. TensorFlow backend. To enable this backend you
  9194. need to install the TensorFlow for C library (see
  9195. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  9196. @code{--enable-libtensorflow}
  9197. @item openvino
  9198. OpenVINO backend. To enable this backend you
  9199. need to build and install the OpenVINO for C library (see
  9200. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  9201. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  9202. be needed if the header files and libraries are not installed into system path)
  9203. @end table
  9204. @item model
  9205. Set path to model file specifying network architecture and its parameters.
  9206. Note that different backends use different file formats. TensorFlow, OpenVINO backend can load files for only its format.
  9207. @item input
  9208. Set the input name of the dnn network.
  9209. @item output
  9210. Set the output name of the dnn network.
  9211. @item backend_configs
  9212. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9213. Roll back to sync execution if the backend does not support async.
  9214. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9215. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9216. @end table
  9217. @subsection Examples
  9218. @itemize
  9219. @item
  9220. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  9221. @example
  9222. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  9223. @end example
  9224. @item
  9225. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  9226. @example
  9227. ./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
  9228. @end example
  9229. @item
  9230. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  9231. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9232. @example
  9233. ./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
  9234. @end example
  9235. @end itemize
  9236. @section drawbox
  9237. Draw a colored box on the input image.
  9238. It accepts the following parameters:
  9239. @table @option
  9240. @item x
  9241. @item y
  9242. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  9243. @item width, w
  9244. @item height, h
  9245. The expressions which specify the width and height of the box; if 0 they are interpreted as
  9246. the input width and height. It defaults to 0.
  9247. @item color, c
  9248. Specify the color of the box to write. For the general syntax of this option,
  9249. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9250. value @code{invert} is used, the box edge color is the same as the
  9251. video with inverted luma.
  9252. @item thickness, t
  9253. The expression which sets the thickness of the box edge.
  9254. A value of @code{fill} will create a filled box. Default value is @code{3}.
  9255. See below for the list of accepted constants.
  9256. @item replace
  9257. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  9258. will overwrite the video's color and alpha pixels.
  9259. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  9260. @end table
  9261. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9262. following constants:
  9263. @table @option
  9264. @item dar
  9265. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9266. @item hsub
  9267. @item vsub
  9268. horizontal and vertical chroma subsample values. For example for the
  9269. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9270. @item in_h, ih
  9271. @item in_w, iw
  9272. The input width and height.
  9273. @item sar
  9274. The input sample aspect ratio.
  9275. @item x
  9276. @item y
  9277. The x and y offset coordinates where the box is drawn.
  9278. @item w
  9279. @item h
  9280. The width and height of the drawn box.
  9281. @item box_source
  9282. Box source can be set as side_data_detection_bboxes if you want to use box data in
  9283. detection bboxes of side data.
  9284. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  9285. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  9286. not sure about the box source.
  9287. @item t
  9288. The thickness of the drawn box.
  9289. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9290. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9291. @end table
  9292. @subsection Examples
  9293. @itemize
  9294. @item
  9295. Draw a black box around the edge of the input image:
  9296. @example
  9297. drawbox
  9298. @end example
  9299. @item
  9300. Draw a box with color red and an opacity of 50%:
  9301. @example
  9302. drawbox=10:20:200:60:red@@0.5
  9303. @end example
  9304. The previous example can be specified as:
  9305. @example
  9306. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  9307. @end example
  9308. @item
  9309. Fill the box with pink color:
  9310. @example
  9311. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  9312. @end example
  9313. @item
  9314. Draw a 2-pixel red 2.40:1 mask:
  9315. @example
  9316. 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
  9317. @end example
  9318. @end itemize
  9319. @subsection Commands
  9320. This filter supports same commands as options.
  9321. The command accepts the same syntax of the corresponding option.
  9322. If the specified expression is not valid, it is kept at its current
  9323. value.
  9324. @anchor{drawgraph}
  9325. @section drawgraph
  9326. Draw a graph using input video metadata.
  9327. It accepts the following parameters:
  9328. @table @option
  9329. @item m1
  9330. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  9331. @item fg1
  9332. Set 1st foreground color expression.
  9333. @item m2
  9334. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  9335. @item fg2
  9336. Set 2nd foreground color expression.
  9337. @item m3
  9338. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  9339. @item fg3
  9340. Set 3rd foreground color expression.
  9341. @item m4
  9342. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  9343. @item fg4
  9344. Set 4th foreground color expression.
  9345. @item min
  9346. Set minimal value of metadata value.
  9347. @item max
  9348. Set maximal value of metadata value.
  9349. @item bg
  9350. Set graph background color. Default is white.
  9351. @item mode
  9352. Set graph mode.
  9353. Available values for mode is:
  9354. @table @samp
  9355. @item bar
  9356. @item dot
  9357. @item line
  9358. @end table
  9359. Default is @code{line}.
  9360. @item slide
  9361. Set slide mode.
  9362. Available values for slide is:
  9363. @table @samp
  9364. @item frame
  9365. Draw new frame when right border is reached.
  9366. @item replace
  9367. Replace old columns with new ones.
  9368. @item scroll
  9369. Scroll from right to left.
  9370. @item rscroll
  9371. Scroll from left to right.
  9372. @item picture
  9373. Draw single picture.
  9374. @end table
  9375. Default is @code{frame}.
  9376. @item size
  9377. Set size of graph video. For the syntax of this option, check the
  9378. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9379. The default value is @code{900x256}.
  9380. @item rate, r
  9381. Set the output frame rate. Default value is @code{25}.
  9382. The foreground color expressions can use the following variables:
  9383. @table @option
  9384. @item MIN
  9385. Minimal value of metadata value.
  9386. @item MAX
  9387. Maximal value of metadata value.
  9388. @item VAL
  9389. Current metadata key value.
  9390. @end table
  9391. The color is defined as 0xAABBGGRR.
  9392. @end table
  9393. Example using metadata from @ref{signalstats} filter:
  9394. @example
  9395. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  9396. @end example
  9397. Example using metadata from @ref{ebur128} filter:
  9398. @example
  9399. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  9400. @end example
  9401. @section drawgrid
  9402. Draw a grid on the input image.
  9403. It accepts the following parameters:
  9404. @table @option
  9405. @item x
  9406. @item y
  9407. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  9408. @item width, w
  9409. @item height, h
  9410. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  9411. input width and height, respectively, minus @code{thickness}, so image gets
  9412. framed. Default to 0.
  9413. @item color, c
  9414. Specify the color of the grid. For the general syntax of this option,
  9415. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9416. value @code{invert} is used, the grid color is the same as the
  9417. video with inverted luma.
  9418. @item thickness, t
  9419. The expression which sets the thickness of the grid line. Default value is @code{1}.
  9420. See below for the list of accepted constants.
  9421. @item replace
  9422. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  9423. will overwrite the video's color and alpha pixels.
  9424. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  9425. @end table
  9426. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9427. following constants:
  9428. @table @option
  9429. @item dar
  9430. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9431. @item hsub
  9432. @item vsub
  9433. horizontal and vertical chroma subsample values. For example for the
  9434. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9435. @item in_h, ih
  9436. @item in_w, iw
  9437. The input grid cell width and height.
  9438. @item sar
  9439. The input sample aspect ratio.
  9440. @item x
  9441. @item y
  9442. The x and y coordinates of some point of grid intersection (meant to configure offset).
  9443. @item w
  9444. @item h
  9445. The width and height of the drawn cell.
  9446. @item t
  9447. The thickness of the drawn cell.
  9448. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9449. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9450. @end table
  9451. @subsection Examples
  9452. @itemize
  9453. @item
  9454. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  9455. @example
  9456. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  9457. @end example
  9458. @item
  9459. Draw a white 3x3 grid with an opacity of 50%:
  9460. @example
  9461. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  9462. @end example
  9463. @end itemize
  9464. @subsection Commands
  9465. This filter supports same commands as options.
  9466. The command accepts the same syntax of the corresponding option.
  9467. If the specified expression is not valid, it is kept at its current
  9468. value.
  9469. @anchor{drawtext}
  9470. @section drawtext
  9471. Draw a text string or text from a specified file on top of a video, using the
  9472. libfreetype library.
  9473. To enable compilation of this filter, you need to configure FFmpeg with
  9474. @code{--enable-libfreetype} and @code{--enable-libharfbuzz}.
  9475. To enable default font fallback and the @var{font} option you need to
  9476. configure FFmpeg with @code{--enable-libfontconfig}.
  9477. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  9478. @code{--enable-libfribidi}.
  9479. @subsection Syntax
  9480. It accepts the following parameters:
  9481. @table @option
  9482. @item box
  9483. Used to draw a box around text using the background color.
  9484. The value must be either 1 (enable) or 0 (disable).
  9485. The default value of @var{box} is 0.
  9486. @item boxborderw
  9487. Set the width of the border to be drawn around the box using @var{boxcolor}.
  9488. The value must be specified using one of the following formats:
  9489. @itemize @bullet
  9490. @item @code{boxborderw=10} set the width of all the borders to 10
  9491. @item @code{boxborderw=10|20} set the width of the top and bottom borders to 10
  9492. and the width of the left and right borders to 20
  9493. @item @code{boxborderw=10|20|30} set the width of the top border to 10, the width
  9494. of the bottom border to 30 and the width of the left and right borders to 20
  9495. @item @code{boxborderw=10|20|30|40} set the borders width to 10 (top), 20 (right),
  9496. 30 (bottom), 40 (left)
  9497. @end itemize
  9498. The default value of @var{boxborderw} is "0".
  9499. @item boxcolor
  9500. The color to be used for drawing box around text. For the syntax of this
  9501. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9502. The default value of @var{boxcolor} is "white".
  9503. @item line_spacing
  9504. Set the line spacing in pixels. The default value of @var{line_spacing} is 0.
  9505. @item text_align
  9506. Set the vertical and horizontal alignment of the text with respect to the box boundaries.
  9507. The value is combination of flags, one for the vertical alignment (T=top,
  9508. M=middle, B=bottom) and one for the horizontal alignment (L=left, C=center, R=right).
  9509. Please note that tab characters are only supported with the left horizontal alignment.
  9510. @item y_align
  9511. Specify what the @var{y} value is referred to. Possible values are:
  9512. @itemize @bullet
  9513. @item @code{text} the top of the highest glyph of the first text line is placed at @var{y}
  9514. @item @code{baseline} the baseline of the first text line is placed at @var{y}
  9515. @item @code{font} the baseline of the first text line is placed at @var{y} plus the
  9516. ascent (in pixels) defined in the font metrics
  9517. @end itemize
  9518. The default value of @var{y_align} is "text" for backward compatibility.
  9519. @item borderw
  9520. Set the width of the border to be drawn around the text using @var{bordercolor}.
  9521. The default value of @var{borderw} is 0.
  9522. @item bordercolor
  9523. Set the color to be used for drawing border around text. For the syntax of this
  9524. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9525. The default value of @var{bordercolor} is "black".
  9526. @item expansion
  9527. Select how the @var{text} is expanded. Can be either @code{none},
  9528. @code{strftime} (deprecated) or @code{normal} (default). See the
  9529. @ref{drawtext_expansion, Text expansion} section below for details.
  9530. @item basetime
  9531. Set a start time for the count. Value is in microseconds. Only applied
  9532. in the deprecated @code{strftime} expansion mode. To emulate in normal expansion
  9533. mode use the @code{pts} function, supplying the start time (in seconds)
  9534. as the second argument.
  9535. @item fix_bounds
  9536. If true, check and fix text coords to avoid clipping.
  9537. @item fontcolor
  9538. The color to be used for drawing fonts. For the syntax of this option, check
  9539. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9540. The default value of @var{fontcolor} is "black".
  9541. @item fontcolor_expr
  9542. String which is expanded the same way as @var{text} to obtain dynamic
  9543. @var{fontcolor} value. By default this option has empty value and is not
  9544. processed. When this option is set, it overrides @var{fontcolor} option.
  9545. @item font
  9546. The font family to be used for drawing text. By default Sans.
  9547. @item fontfile
  9548. The font file to be used for drawing text. The path must be included.
  9549. This parameter is mandatory if the fontconfig support is disabled.
  9550. @item alpha
  9551. Draw the text applying alpha blending. The value can
  9552. be a number between 0.0 and 1.0.
  9553. The expression accepts the same variables @var{x, y} as well.
  9554. The default value is 1.
  9555. Please see @var{fontcolor_expr}.
  9556. @item fontsize
  9557. The font size to be used for drawing text.
  9558. The default value of @var{fontsize} is 16.
  9559. @item text_shaping
  9560. If set to 1, attempt to shape the text (for example, reverse the order of
  9561. right-to-left text and join Arabic characters) before drawing it.
  9562. Otherwise, just draw the text exactly as given.
  9563. By default 1 (if supported).
  9564. @item ft_load_flags
  9565. The flags to be used for loading the fonts.
  9566. The flags map the corresponding flags supported by libfreetype, and are
  9567. a combination of the following values:
  9568. @table @var
  9569. @item default
  9570. @item no_scale
  9571. @item no_hinting
  9572. @item render
  9573. @item no_bitmap
  9574. @item vertical_layout
  9575. @item force_autohint
  9576. @item crop_bitmap
  9577. @item pedantic
  9578. @item ignore_global_advance_width
  9579. @item no_recurse
  9580. @item ignore_transform
  9581. @item monochrome
  9582. @item linear_design
  9583. @item no_autohint
  9584. @end table
  9585. Default value is "default".
  9586. For more information consult the documentation for the FT_LOAD_*
  9587. libfreetype flags.
  9588. @item shadowcolor
  9589. The color to be used for drawing a shadow behind the drawn text. For the
  9590. syntax of this option, check the @ref{color syntax,,"Color" section in the
  9591. ffmpeg-utils manual,ffmpeg-utils}.
  9592. The default value of @var{shadowcolor} is "black".
  9593. @item boxw
  9594. Set the width of the box to be drawn around text.
  9595. The default value of @var{boxw} is computed automatically to match the text width
  9596. @item boxh
  9597. Set the height of the box to be drawn around text.
  9598. The default value of @var{boxh} is computed automatically to match the text height
  9599. @item shadowx
  9600. @item shadowy
  9601. The x and y offsets for the text shadow position with respect to the
  9602. position of the text. They can be either positive or negative
  9603. values. The default value for both is "0".
  9604. @item start_number
  9605. The starting frame number for the n/frame_num variable. The default value
  9606. is "0".
  9607. @item tabsize
  9608. The size in number of spaces to use for rendering the tab.
  9609. Default value is 4.
  9610. @item timecode
  9611. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  9612. format. It can be used with or without text parameter. @var{timecode_rate}
  9613. option must be specified.
  9614. @item timecode_rate, rate, r
  9615. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  9616. integer. Minimum value is "1".
  9617. Drop-frame timecode is supported for frame rates 30 & 60.
  9618. @item tc24hmax
  9619. If set to 1, the output of the timecode option will wrap around at 24 hours.
  9620. Default is 0 (disabled).
  9621. @item text
  9622. The text string to be drawn. The text must be a sequence of UTF-8
  9623. encoded characters.
  9624. This parameter is mandatory if no file is specified with the parameter
  9625. @var{textfile}.
  9626. @item textfile
  9627. A text file containing text to be drawn. The text must be a sequence
  9628. of UTF-8 encoded characters.
  9629. This parameter is mandatory if no text string is specified with the
  9630. parameter @var{text}.
  9631. If both @var{text} and @var{textfile} are specified, an error is thrown.
  9632. @item text_source
  9633. Text source should be set as side_data_detection_bboxes if you want to use text data in
  9634. detection bboxes of side data.
  9635. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  9636. text data in detection bboxes of side data. So please do not use this parameter
  9637. if you are not sure about the text source.
  9638. @item reload
  9639. The @var{textfile} will be reloaded at specified frame interval.
  9640. Be sure to update @var{textfile} atomically, or it may be read partially,
  9641. or even fail.
  9642. Range is 0 to INT_MAX. Default is 0.
  9643. @item x
  9644. @item y
  9645. The expressions which specify the offsets where text will be drawn
  9646. within the video frame. They are relative to the top/left border of the
  9647. output image.
  9648. The default value of @var{x} and @var{y} is "0".
  9649. See below for the list of accepted constants and functions.
  9650. @end table
  9651. The parameters for @var{x} and @var{y} are expressions containing the
  9652. following constants and functions:
  9653. @table @option
  9654. @item dar
  9655. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9656. @item hsub
  9657. @item vsub
  9658. horizontal and vertical chroma subsample values. For example for the
  9659. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9660. @item line_h, lh
  9661. the height of each text line
  9662. @item main_h, h, H
  9663. the input height
  9664. @item main_w, w, W
  9665. the input width
  9666. @item max_glyph_a, ascent
  9667. the maximum distance from the baseline to the highest/upper grid
  9668. coordinate used to place a glyph outline point, for all the rendered
  9669. glyphs.
  9670. It is a positive value, due to the grid's orientation with the Y axis
  9671. upwards.
  9672. @item max_glyph_d, descent
  9673. the maximum distance from the baseline to the lowest grid coordinate
  9674. used to place a glyph outline point, for all the rendered glyphs.
  9675. This is a negative value, due to the grid's orientation, with the Y axis
  9676. upwards.
  9677. @item max_glyph_h
  9678. maximum glyph height, that is the maximum height for all the glyphs
  9679. contained in the rendered text, it is equivalent to @var{ascent} -
  9680. @var{descent}.
  9681. @item max_glyph_w
  9682. maximum glyph width, that is the maximum width for all the glyphs
  9683. contained in the rendered text
  9684. @item font_a
  9685. the ascent size defined in the font metrics
  9686. @item font_d
  9687. the descent size defined in the font metrics
  9688. @item top_a
  9689. the maximum ascender of the glyphs of the first text line
  9690. @item bottom_d
  9691. the maximum descender of the glyphs of the last text line
  9692. @item n
  9693. the number of input frame, starting from 0
  9694. @item rand(min, max)
  9695. return a random number included between @var{min} and @var{max}
  9696. @item sar
  9697. The input sample aspect ratio.
  9698. @item t
  9699. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9700. @item text_h, th
  9701. the height of the rendered text
  9702. @item text_w, tw
  9703. the width of the rendered text
  9704. @item x
  9705. @item y
  9706. the x and y offset coordinates where the text is drawn.
  9707. These parameters allow the @var{x} and @var{y} expressions to refer
  9708. to each other, so you can for example specify @code{y=x/dar}.
  9709. @item pict_type
  9710. A one character description of the current frame's picture type.
  9711. @item pkt_pos
  9712. The current packet's position in the input file or stream
  9713. (in bytes, from the start of the input). A value of -1 indicates
  9714. this info is not available.
  9715. @item duration
  9716. The current packet's duration, in seconds.
  9717. @item pkt_size
  9718. The current packet's size (in bytes).
  9719. @end table
  9720. @anchor{drawtext_expansion}
  9721. @subsection Text expansion
  9722. If @option{expansion} is set to @code{strftime}, the filter recognizes
  9723. sequences accepted by the @code{strftime} C function in the provided
  9724. text and expands them accordingly. Check the documentation of
  9725. @code{strftime}. This feature is deprecated in favor of @code{normal}
  9726. expansion with the @code{gmtime} or @code{localtime} expansion
  9727. functions.
  9728. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  9729. If @option{expansion} is set to @code{normal} (which is the default),
  9730. the following expansion mechanism is used.
  9731. The backslash character @samp{\}, followed by any character, always expands to
  9732. the second character.
  9733. Sequences of the form @code{%@{...@}} are expanded. The text between the
  9734. braces is a function name, possibly followed by arguments separated by ':'.
  9735. If the arguments contain special characters or delimiters (':' or '@}'),
  9736. they should be escaped.
  9737. Note that they probably must also be escaped as the value for the @option{text}
  9738. option in the filter argument string and as the filter argument in the
  9739. filtergraph description, and possibly also for the shell, that makes up to four
  9740. levels of escaping; using a text file with the @option{textfile} option avoids
  9741. these problems.
  9742. The following functions are available:
  9743. @table @command
  9744. @item expr, e
  9745. The expression evaluation result.
  9746. It must take one argument specifying the expression to be evaluated,
  9747. which accepts the same constants and functions as the @var{x} and
  9748. @var{y} values. Note that not all constants should be used, for
  9749. example the text size is not known when evaluating the expression, so
  9750. the constants @var{text_w} and @var{text_h} will have an undefined
  9751. value.
  9752. @item expr_int_format, eif
  9753. Evaluate the expression's value and output as formatted integer.
  9754. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  9755. The second argument specifies the output format. Allowed values are @samp{x},
  9756. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  9757. @code{printf} function.
  9758. The third parameter is optional and sets the number of positions taken by the output.
  9759. It can be used to add padding with zeros from the left.
  9760. @item gmtime
  9761. The time at which the filter is running, expressed in UTC.
  9762. It can accept an argument: a @code{strftime} C function format string.
  9763. The format string is extended to support the variable @var{%[1-6]N}
  9764. which prints fractions of the second with optionally specified number of digits.
  9765. @item localtime
  9766. The time at which the filter is running, expressed in the local time zone.
  9767. It can accept an argument: a @code{strftime} C function format string.
  9768. The format string is extended to support the variable @var{%[1-6]N}
  9769. which prints fractions of the second with optionally specified number of digits.
  9770. @item metadata
  9771. Frame metadata. Takes one or two arguments.
  9772. The first argument is mandatory and specifies the metadata key.
  9773. The second argument is optional and specifies a default value, used when the
  9774. metadata key is not found or empty.
  9775. Available metadata can be identified by inspecting entries
  9776. starting with TAG included within each frame section
  9777. printed by running @code{ffprobe -show_frames}.
  9778. String metadata generated in filters leading to
  9779. the drawtext filter are also available.
  9780. @item n, frame_num
  9781. The frame number, starting from 0.
  9782. @item pict_type
  9783. A one character description of the current picture type.
  9784. @item pts
  9785. The timestamp of the current frame.
  9786. It can take up to three arguments.
  9787. The first argument is the format of the timestamp; it defaults to @code{flt}
  9788. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  9789. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  9790. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  9791. @code{localtime} stands for the timestamp of the frame formatted as
  9792. local time zone time.
  9793. The second argument is an offset added to the timestamp.
  9794. If the format is set to @code{hms}, a third argument @code{24HH} may be
  9795. supplied to present the hour part of the formatted timestamp in 24h format
  9796. (00-23).
  9797. If the format is set to @code{localtime} or @code{gmtime}, a third
  9798. argument may be supplied: a @code{strftime} C function format string.
  9799. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  9800. @end table
  9801. @subsection Commands
  9802. This filter supports altering parameters via commands:
  9803. @table @option
  9804. @item reinit
  9805. Alter existing filter parameters.
  9806. Syntax for the argument is the same as for filter invocation, e.g.
  9807. @example
  9808. fontsize=56:fontcolor=green:text='Hello World'
  9809. @end example
  9810. Full filter invocation with sendcmd would look like this:
  9811. @example
  9812. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  9813. @end example
  9814. If the entire argument can't be parsed or applied as valid values then the filter will
  9815. continue with its existing parameters.
  9816. @end table
  9817. The following options are also supported as @ref{commands}:
  9818. @itemize @bullet
  9819. @item x
  9820. @item y
  9821. @item alpha
  9822. @item fontsize
  9823. @item fontcolor
  9824. @item boxcolor
  9825. @item bordercolor
  9826. @item shadowcolor
  9827. @item box
  9828. @item boxw
  9829. @item boxh
  9830. @item boxborderw
  9831. @item line_spacing
  9832. @item text_align
  9833. @item shadowx
  9834. @item shadowy
  9835. @item borderw
  9836. @end itemize
  9837. @subsection Examples
  9838. @itemize
  9839. @item
  9840. Draw "Test Text" with font FreeSerif, using the default values for the
  9841. optional parameters.
  9842. @example
  9843. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  9844. @end example
  9845. @item
  9846. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  9847. and y=50 (counting from the top-left corner of the screen), text is
  9848. yellow with a red box around it. Both the text and the box have an
  9849. opacity of 20%.
  9850. @example
  9851. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  9852. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  9853. @end example
  9854. Note that the double quotes are not necessary if spaces are not used
  9855. within the parameter list.
  9856. @item
  9857. Show the text at the center of the video frame:
  9858. @example
  9859. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  9860. @end example
  9861. @item
  9862. Show the text at a random position, switching to a new position every 30 seconds:
  9863. @example
  9864. 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)"
  9865. @end example
  9866. @item
  9867. Show a text line sliding from right to left in the last row of the video
  9868. frame. The file @file{LONG_LINE} is assumed to contain a single line
  9869. with no newlines.
  9870. @example
  9871. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  9872. @end example
  9873. @item
  9874. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  9875. @example
  9876. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  9877. @end example
  9878. @item
  9879. Draw a single green letter "g", at the center of the input video.
  9880. The glyph baseline is placed at half screen height.
  9881. @example
  9882. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  9883. @end example
  9884. @item
  9885. Show text for 1 second every 3 seconds:
  9886. @example
  9887. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  9888. @end example
  9889. @item
  9890. Use fontconfig to set the font. Note that the colons need to be escaped.
  9891. @example
  9892. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  9893. @end example
  9894. @item
  9895. Draw "Test Text" with font size dependent on height of the video.
  9896. @example
  9897. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  9898. @end example
  9899. @item
  9900. Print the date of a real-time encoding (see documentation for the
  9901. @code{strftime} C function):
  9902. @example
  9903. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  9904. @end example
  9905. @item
  9906. Show text fading in and out (appearing/disappearing):
  9907. @example
  9908. #!/bin/sh
  9909. DS=1.0 # display start
  9910. DE=10.0 # display end
  9911. FID=1.5 # fade in duration
  9912. FOD=5 # fade out duration
  9913. 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 @}"
  9914. @end example
  9915. @item
  9916. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9917. and the @option{fontsize} value are included in the @option{y} offset.
  9918. @example
  9919. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9920. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9921. @end example
  9922. @item
  9923. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9924. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9925. must have option @option{-export_path_metadata 1} for the special metadata fields
  9926. to be available for filters.
  9927. @example
  9928. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  9929. @end example
  9930. @end itemize
  9931. For more information about libfreetype, check:
  9932. @url{http://www.freetype.org/}.
  9933. For more information about fontconfig, check:
  9934. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  9935. For more information about libfribidi, check:
  9936. @url{http://fribidi.org/}.
  9937. For more information about libharfbuzz, check:
  9938. @url{https://github.com/harfbuzz/harfbuzz}.
  9939. @section edgedetect
  9940. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  9941. The filter accepts the following options:
  9942. @table @option
  9943. @item low
  9944. @item high
  9945. Set low and high threshold values used by the Canny thresholding
  9946. algorithm.
  9947. The high threshold selects the "strong" edge pixels, which are then
  9948. connected through 8-connectivity with the "weak" edge pixels selected
  9949. by the low threshold.
  9950. @var{low} and @var{high} threshold values must be chosen in the range
  9951. [0,1], and @var{low} should be lesser or equal to @var{high}.
  9952. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  9953. is @code{50/255}.
  9954. @item mode
  9955. Define the drawing mode.
  9956. @table @samp
  9957. @item wires
  9958. Draw white/gray wires on black background.
  9959. @item colormix
  9960. Mix the colors to create a paint/cartoon effect.
  9961. @item canny
  9962. Apply Canny edge detector on all selected planes.
  9963. @end table
  9964. Default value is @var{wires}.
  9965. @item planes
  9966. Select planes for filtering. By default all available planes are filtered.
  9967. @end table
  9968. @subsection Examples
  9969. @itemize
  9970. @item
  9971. Standard edge detection with custom values for the hysteresis thresholding:
  9972. @example
  9973. edgedetect=low=0.1:high=0.4
  9974. @end example
  9975. @item
  9976. Painting effect without thresholding:
  9977. @example
  9978. edgedetect=mode=colormix:high=0
  9979. @end example
  9980. @end itemize
  9981. @section elbg
  9982. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  9983. For each input image, the filter will compute the optimal mapping from
  9984. the input to the output given the codebook length, that is the number
  9985. of distinct output colors.
  9986. This filter accepts the following options.
  9987. @table @option
  9988. @item codebook_length, l
  9989. Set codebook length. The value must be a positive integer, and
  9990. represents the number of distinct output colors. Default value is 256.
  9991. @item nb_steps, n
  9992. Set the maximum number of iterations to apply for computing the optimal
  9993. mapping. The higher the value the better the result and the higher the
  9994. computation time. Default value is 1.
  9995. @item seed, s
  9996. Set a random seed, must be an integer included between 0 and
  9997. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  9998. will try to use a good random seed on a best effort basis.
  9999. @item pal8
  10000. Set pal8 output pixel format. This option does not work with codebook
  10001. length greater than 256. Default is disabled.
  10002. @item use_alpha
  10003. Include alpha values in the quantization calculation. Allows creating
  10004. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  10005. @end table
  10006. @section entropy
  10007. Measure graylevel entropy in histogram of color channels of video frames.
  10008. It accepts the following parameters:
  10009. @table @option
  10010. @item mode
  10011. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  10012. @var{diff} mode measures entropy of histogram delta values, absolute differences
  10013. between neighbour histogram values.
  10014. @end table
  10015. @section epx
  10016. Apply the EPX magnification filter which is designed for pixel art.
  10017. It accepts the following option:
  10018. @table @option
  10019. @item n
  10020. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  10021. @code{3xEPX}.
  10022. Default is @code{3}.
  10023. @end table
  10024. @section eq
  10025. Set brightness, contrast, saturation and approximate gamma adjustment.
  10026. The filter accepts the following options:
  10027. @table @option
  10028. @item contrast
  10029. Set the contrast expression. The value must be a float value in range
  10030. @code{-1000.0} to @code{1000.0}. The default value is "1".
  10031. @item brightness
  10032. Set the brightness expression. The value must be a float value in
  10033. range @code{-1.0} to @code{1.0}. The default value is "0".
  10034. @item saturation
  10035. Set the saturation expression. The value must be a float in
  10036. range @code{0.0} to @code{3.0}. The default value is "1".
  10037. @item gamma
  10038. Set the gamma expression. The value must be a float in range
  10039. @code{0.1} to @code{10.0}. The default value is "1".
  10040. @item gamma_r
  10041. Set the gamma expression for red. The value must be a float in
  10042. range @code{0.1} to @code{10.0}. The default value is "1".
  10043. @item gamma_g
  10044. Set the gamma expression for green. The value must be a float in range
  10045. @code{0.1} to @code{10.0}. The default value is "1".
  10046. @item gamma_b
  10047. Set the gamma expression for blue. The value must be a float in range
  10048. @code{0.1} to @code{10.0}. The default value is "1".
  10049. @item gamma_weight
  10050. Set the gamma weight expression. It can be used to reduce the effect
  10051. of a high gamma value on bright image areas, e.g. keep them from
  10052. getting overamplified and just plain white. The value must be a float
  10053. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  10054. gamma correction all the way down while @code{1.0} leaves it at its
  10055. full strength. Default is "1".
  10056. @item eval
  10057. Set when the expressions for brightness, contrast, saturation and
  10058. gamma expressions are evaluated.
  10059. It accepts the following values:
  10060. @table @samp
  10061. @item init
  10062. only evaluate expressions once during the filter initialization or
  10063. when a command is processed
  10064. @item frame
  10065. evaluate expressions for each incoming frame
  10066. @end table
  10067. Default value is @samp{init}.
  10068. @end table
  10069. The expressions accept the following parameters:
  10070. @table @option
  10071. @item n
  10072. frame count of the input frame starting from 0
  10073. @item pos
  10074. byte position of the corresponding packet in the input file, NAN if
  10075. unspecified; deprecated, do not use
  10076. @item r
  10077. frame rate of the input video, NAN if the input frame rate is unknown
  10078. @item t
  10079. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10080. @end table
  10081. @subsection Commands
  10082. The filter supports the following commands:
  10083. @table @option
  10084. @item contrast
  10085. Set the contrast expression.
  10086. @item brightness
  10087. Set the brightness expression.
  10088. @item saturation
  10089. Set the saturation expression.
  10090. @item gamma
  10091. Set the gamma expression.
  10092. @item gamma_r
  10093. Set the gamma_r expression.
  10094. @item gamma_g
  10095. Set gamma_g expression.
  10096. @item gamma_b
  10097. Set gamma_b expression.
  10098. @item gamma_weight
  10099. Set gamma_weight expression.
  10100. The command accepts the same syntax of the corresponding option.
  10101. If the specified expression is not valid, it is kept at its current
  10102. value.
  10103. @end table
  10104. @anchor{erosion}
  10105. @section erosion
  10106. Apply erosion effect to the video.
  10107. This filter replaces the pixel by the local(3x3) minimum.
  10108. It accepts the following options:
  10109. @table @option
  10110. @item threshold0
  10111. @item threshold1
  10112. @item threshold2
  10113. @item threshold3
  10114. Limit the maximum change for each plane, default is 65535.
  10115. If 0, plane will remain unchanged.
  10116. @item coordinates
  10117. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  10118. pixels are used.
  10119. Flags to local 3x3 coordinates maps like this:
  10120. 1 2 3
  10121. 4 5
  10122. 6 7 8
  10123. @end table
  10124. @subsection Commands
  10125. This filter supports the all above options as @ref{commands}.
  10126. @section estdif
  10127. Deinterlace the input video ("estdif" stands for "Edge Slope
  10128. Tracing Deinterlacing Filter").
  10129. Spatial only filter that uses edge slope tracing algorithm
  10130. to interpolate missing lines.
  10131. It accepts the following parameters:
  10132. @table @option
  10133. @item mode
  10134. The interlacing mode to adopt. It accepts one of the following values:
  10135. @table @option
  10136. @item frame
  10137. Output one frame for each frame.
  10138. @item field
  10139. Output one frame for each field.
  10140. @end table
  10141. The default value is @code{field}.
  10142. @item parity
  10143. The picture field parity assumed for the input interlaced video. It accepts one
  10144. of the following values:
  10145. @table @option
  10146. @item tff
  10147. Assume the top field is first.
  10148. @item bff
  10149. Assume the bottom field is first.
  10150. @item auto
  10151. Enable automatic detection of field parity.
  10152. @end table
  10153. The default value is @code{auto}.
  10154. If the interlacing is unknown or the decoder does not export this information,
  10155. top field first will be assumed.
  10156. @item deint
  10157. Specify which frames to deinterlace. Accepts one of the following
  10158. values:
  10159. @table @option
  10160. @item all
  10161. Deinterlace all frames.
  10162. @item interlaced
  10163. Only deinterlace frames marked as interlaced.
  10164. @end table
  10165. The default value is @code{all}.
  10166. @item rslope
  10167. Specify the search radius for edge slope tracing. Default value is 1.
  10168. Allowed range is from 1 to 15.
  10169. @item redge
  10170. Specify the search radius for best edge matching. Default value is 2.
  10171. Allowed range is from 0 to 15.
  10172. @item ecost
  10173. Specify the edge cost for edge matching. Default value is 2.
  10174. Allowed range is from 0 to 50.
  10175. @item mcost
  10176. Specify the middle cost for edge matching. Default value is 1.
  10177. Allowed range is from 0 to 50.
  10178. @item dcost
  10179. Specify the distance cost for edge matching. Default value is 1.
  10180. Allowed range is from 0 to 50.
  10181. @item interp
  10182. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  10183. of the following values:
  10184. @table @option
  10185. @item 2p
  10186. Two-point interpolation.
  10187. @item 4p
  10188. Four-point interpolation.
  10189. @item 6p
  10190. Six-point interpolation.
  10191. @end table
  10192. @end table
  10193. @subsection Commands
  10194. This filter supports same @ref{commands} as options.
  10195. @section exposure
  10196. Adjust exposure of the video stream.
  10197. The filter accepts the following options:
  10198. @table @option
  10199. @item exposure
  10200. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  10201. Default value is 0 EV.
  10202. @item black
  10203. Set the black level correction. Allowed range is from -1.0 to 1.0.
  10204. Default value is 0.
  10205. @end table
  10206. @subsection Commands
  10207. This filter supports same @ref{commands} as options.
  10208. @section extractplanes
  10209. Extract color channel components from input video stream into
  10210. separate grayscale video streams.
  10211. The filter accepts the following option:
  10212. @table @option
  10213. @item planes
  10214. Set plane(s) to extract.
  10215. Available values for planes are:
  10216. @table @samp
  10217. @item y
  10218. @item u
  10219. @item v
  10220. @item a
  10221. @item r
  10222. @item g
  10223. @item b
  10224. @end table
  10225. Choosing planes not available in the input will result in an error.
  10226. That means you cannot select @code{r}, @code{g}, @code{b} planes
  10227. with @code{y}, @code{u}, @code{v} planes at same time.
  10228. @end table
  10229. @subsection Examples
  10230. @itemize
  10231. @item
  10232. Extract luma, u and v color channel component from input video frame
  10233. into 3 grayscale outputs:
  10234. @example
  10235. 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
  10236. @end example
  10237. @end itemize
  10238. @section fade
  10239. Apply a fade-in/out effect to the input video.
  10240. It accepts the following parameters:
  10241. @table @option
  10242. @item type, t
  10243. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  10244. effect.
  10245. Default is @code{in}.
  10246. @item start_frame, s
  10247. Specify the number of the frame to start applying the fade
  10248. effect at. Default is 0.
  10249. @item nb_frames, n
  10250. The number of frames that the fade effect lasts. At the end of the
  10251. fade-in effect, the output video will have the same intensity as the input video.
  10252. At the end of the fade-out transition, the output video will be filled with the
  10253. selected @option{color}.
  10254. Default is 25.
  10255. @item alpha
  10256. If set to 1, fade only alpha channel, if one exists on the input.
  10257. Default value is 0.
  10258. @item start_time, st
  10259. Specify the timestamp (in seconds) of the frame to start to apply the fade
  10260. effect. If both start_frame and start_time are specified, the fade will start at
  10261. whichever comes last. Default is 0.
  10262. @item duration, d
  10263. The number of seconds for which the fade effect has to last. At the end of the
  10264. fade-in effect the output video will have the same intensity as the input video,
  10265. at the end of the fade-out transition the output video will be filled with the
  10266. selected @option{color}.
  10267. If both duration and nb_frames are specified, duration is used. Default is 0
  10268. (nb_frames is used by default).
  10269. @item color, c
  10270. Specify the color of the fade. Default is "black".
  10271. @end table
  10272. @subsection Examples
  10273. @itemize
  10274. @item
  10275. Fade in the first 30 frames of video:
  10276. @example
  10277. fade=in:0:30
  10278. @end example
  10279. The command above is equivalent to:
  10280. @example
  10281. fade=t=in:s=0:n=30
  10282. @end example
  10283. @item
  10284. Fade out the last 45 frames of a 200-frame video:
  10285. @example
  10286. fade=out:155:45
  10287. fade=type=out:start_frame=155:nb_frames=45
  10288. @end example
  10289. @item
  10290. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  10291. @example
  10292. fade=in:0:25, fade=out:975:25
  10293. @end example
  10294. @item
  10295. Make the first 5 frames yellow, then fade in from frame 5-24:
  10296. @example
  10297. fade=in:5:20:color=yellow
  10298. @end example
  10299. @item
  10300. Fade in alpha over first 25 frames of video:
  10301. @example
  10302. fade=in:0:25:alpha=1
  10303. @end example
  10304. @item
  10305. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  10306. @example
  10307. fade=t=in:st=5.5:d=0.5
  10308. @end example
  10309. @end itemize
  10310. @section feedback
  10311. Apply feedback video filter.
  10312. This filter pass cropped input frames to 2nd output.
  10313. From there it can be filtered with other video filters.
  10314. After filter receives frame from 2nd input, that frame
  10315. is combined on top of original frame from 1st input and passed
  10316. to 1st output.
  10317. The typical usage is filter only part of frame.
  10318. The filter accepts the following options:
  10319. @table @option
  10320. @item x
  10321. @item y
  10322. Set the top left crop position.
  10323. @item w
  10324. @item h
  10325. Set the crop size.
  10326. @end table
  10327. @subsection Examples
  10328. @itemize
  10329. @item
  10330. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  10331. @example
  10332. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  10333. @end example
  10334. @item
  10335. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  10336. @example
  10337. [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]
  10338. @end example
  10339. @item
  10340. Pixelize rectangular part of video frame of size 100x100 with pixelize filter.
  10341. @example
  10342. [in][blurin]feedback=x=320:y=240:w=100:h=100[out][blurout];[blurout]pixelize[blurin]
  10343. @end example
  10344. @end itemize
  10345. @section fftdnoiz
  10346. Denoise frames using 3D FFT (frequency domain filtering).
  10347. The filter accepts the following options:
  10348. @table @option
  10349. @item sigma
  10350. Set the noise sigma constant. This sets denoising strength.
  10351. Default value is 1. Allowed range is from 0 to 30.
  10352. Using very high sigma with low overlap may give blocking artifacts.
  10353. @item amount
  10354. Set amount of denoising. By default all detected noise is reduced.
  10355. Default value is 1. Allowed range is from 0 to 1.
  10356. @item block
  10357. Set size of block in pixels, Default is 32, can be 8 to 256.
  10358. @item overlap
  10359. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  10360. @item method
  10361. Set denoising method. Default is @code{wiener}, can also be @code{hard}.
  10362. @item prev
  10363. Set number of previous frames to use for denoising. By default is set to 0.
  10364. @item next
  10365. Set number of next frames to to use for denoising. By default is set to 0.
  10366. @item planes
  10367. Set planes which will be filtered, by default are all available filtered
  10368. except alpha.
  10369. @end table
  10370. @section fftfilt
  10371. Apply arbitrary expressions to samples in frequency domain
  10372. @table @option
  10373. @item dc_Y
  10374. Adjust the dc value (gain) of the luma plane of the image. The filter
  10375. accepts an integer value in range @code{0} to @code{1000}. The default
  10376. value is set to @code{0}.
  10377. @item dc_U
  10378. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  10379. filter accepts an integer value in range @code{0} to @code{1000}. The
  10380. default value is set to @code{0}.
  10381. @item dc_V
  10382. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  10383. filter accepts an integer value in range @code{0} to @code{1000}. The
  10384. default value is set to @code{0}.
  10385. @item weight_Y
  10386. Set the frequency domain weight expression for the luma plane.
  10387. @item weight_U
  10388. Set the frequency domain weight expression for the 1st chroma plane.
  10389. @item weight_V
  10390. Set the frequency domain weight expression for the 2nd chroma plane.
  10391. @item eval
  10392. Set when the expressions are evaluated.
  10393. It accepts the following values:
  10394. @table @samp
  10395. @item init
  10396. Only evaluate expressions once during the filter initialization.
  10397. @item frame
  10398. Evaluate expressions for each incoming frame.
  10399. @end table
  10400. Default value is @samp{init}.
  10401. The filter accepts the following variables:
  10402. @item X
  10403. @item Y
  10404. The coordinates of the current sample.
  10405. @item W
  10406. @item H
  10407. The width and height of the image.
  10408. @item N
  10409. The number of input frame, starting from 0.
  10410. @item WS
  10411. @item HS
  10412. The size of FFT array for horizontal and vertical processing.
  10413. @end table
  10414. @subsection Examples
  10415. @itemize
  10416. @item
  10417. High-pass:
  10418. @example
  10419. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  10420. @end example
  10421. @item
  10422. Low-pass:
  10423. @example
  10424. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  10425. @end example
  10426. @item
  10427. Sharpen:
  10428. @example
  10429. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  10430. @end example
  10431. @item
  10432. Blur:
  10433. @example
  10434. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  10435. @end example
  10436. @end itemize
  10437. @section field
  10438. Extract a single field from an interlaced image using stride
  10439. arithmetic to avoid wasting CPU time. The output frames are marked as
  10440. non-interlaced.
  10441. The filter accepts the following options:
  10442. @table @option
  10443. @item type
  10444. Specify whether to extract the top (if the value is @code{0} or
  10445. @code{top}) or the bottom field (if the value is @code{1} or
  10446. @code{bottom}).
  10447. @end table
  10448. @section fieldhint
  10449. Create new frames by copying the top and bottom fields from surrounding frames
  10450. supplied as numbers by the hint file.
  10451. @table @option
  10452. @item hint
  10453. Set file containing hints: absolute/relative frame numbers.
  10454. There must be one line for each frame in a clip. Each line must contain two
  10455. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  10456. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  10457. is current frame number for @code{absolute} mode or out of [-1, 1] range
  10458. for @code{relative} mode. First number tells from which frame to pick up top
  10459. field and second number tells from which frame to pick up bottom field.
  10460. If optionally followed by @code{+} output frame will be marked as interlaced,
  10461. else if followed by @code{-} output frame will be marked as progressive, else
  10462. it will be marked same as input frame.
  10463. If optionally followed by @code{t} output frame will use only top field, or in
  10464. case of @code{b} it will use only bottom field.
  10465. If line starts with @code{#} or @code{;} that line is skipped.
  10466. @item mode
  10467. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  10468. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  10469. are more frames to process than @code{hint} file is seek back to start.
  10470. @end table
  10471. Example of first several lines of @code{hint} file for @code{relative} mode:
  10472. @example
  10473. 0,0 - # first frame
  10474. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  10475. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  10476. 1,0 -
  10477. 0,0 -
  10478. 0,0 -
  10479. 1,0 -
  10480. 1,0 -
  10481. 1,0 -
  10482. 0,0 -
  10483. 0,0 -
  10484. 1,0 -
  10485. 1,0 -
  10486. 1,0 -
  10487. 0,0 -
  10488. @end example
  10489. @section fieldmatch
  10490. Field matching filter for inverse telecine. It is meant to reconstruct the
  10491. progressive frames from a telecined stream. The filter does not drop duplicated
  10492. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  10493. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  10494. The separation of the field matching and the decimation is notably motivated by
  10495. the possibility of inserting a de-interlacing filter fallback between the two.
  10496. If the source has mixed telecined and real interlaced content,
  10497. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  10498. But these remaining combed frames will be marked as interlaced, and thus can be
  10499. de-interlaced by a later filter such as @ref{yadif} before decimation.
  10500. In addition to the various configuration options, @code{fieldmatch} can take an
  10501. optional second stream, activated through the @option{ppsrc} option. If
  10502. enabled, the frames reconstruction will be based on the fields and frames from
  10503. this second stream. This allows the first input to be pre-processed in order to
  10504. help the various algorithms of the filter, while keeping the output lossless
  10505. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  10506. or brightness/contrast adjustments can help.
  10507. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  10508. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  10509. which @code{fieldmatch} is based on. While the semantic and usage are very
  10510. close, some behaviour and options names can differ.
  10511. The @ref{decimate} filter currently only works for constant frame rate input.
  10512. If your input has mixed telecined (30fps) and progressive content with a lower
  10513. framerate like 24fps use the following filterchain to produce the necessary cfr
  10514. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  10515. The filter accepts the following options:
  10516. @table @option
  10517. @item order
  10518. Specify the assumed field order of the input stream. Available values are:
  10519. @table @samp
  10520. @item auto
  10521. Auto detect parity (use FFmpeg's internal parity value).
  10522. @item bff
  10523. Assume bottom field first.
  10524. @item tff
  10525. Assume top field first.
  10526. @end table
  10527. Note that it is sometimes recommended not to trust the parity announced by the
  10528. stream.
  10529. Default value is @var{auto}.
  10530. @item mode
  10531. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  10532. sense that it won't risk creating jerkiness due to duplicate frames when
  10533. possible, but if there are bad edits or blended fields it will end up
  10534. outputting combed frames when a good match might actually exist. On the other
  10535. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  10536. but will almost always find a good frame if there is one. The other values are
  10537. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  10538. jerkiness and creating duplicate frames versus finding good matches in sections
  10539. with bad edits, orphaned fields, blended fields, etc.
  10540. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  10541. Available values are:
  10542. @table @samp
  10543. @item pc
  10544. 2-way matching (p/c)
  10545. @item pc_n
  10546. 2-way matching, and trying 3rd match if still combed (p/c + n)
  10547. @item pc_u
  10548. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  10549. @item pc_n_ub
  10550. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  10551. still combed (p/c + n + u/b)
  10552. @item pcn
  10553. 3-way matching (p/c/n)
  10554. @item pcn_ub
  10555. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  10556. detected as combed (p/c/n + u/b)
  10557. @end table
  10558. The parenthesis at the end indicate the matches that would be used for that
  10559. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  10560. @var{top}).
  10561. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  10562. the slowest.
  10563. Default value is @var{pc_n}.
  10564. @item ppsrc
  10565. Mark the main input stream as a pre-processed input, and enable the secondary
  10566. input stream as the clean source to pick the fields from. See the filter
  10567. introduction for more details. It is similar to the @option{clip2} feature from
  10568. VFM/TFM.
  10569. Default value is @code{0} (disabled).
  10570. @item field
  10571. Set the field to match from. It is recommended to set this to the same value as
  10572. @option{order} unless you experience matching failures with that setting. In
  10573. certain circumstances changing the field that is used to match from can have a
  10574. large impact on matching performance. Available values are:
  10575. @table @samp
  10576. @item auto
  10577. Automatic (same value as @option{order}).
  10578. @item bottom
  10579. Match from the bottom field.
  10580. @item top
  10581. Match from the top field.
  10582. @end table
  10583. Default value is @var{auto}.
  10584. @item mchroma
  10585. Set whether or not chroma is included during the match comparisons. In most
  10586. cases it is recommended to leave this enabled. You should set this to @code{0}
  10587. only if your clip has bad chroma problems such as heavy rainbowing or other
  10588. artifacts. Setting this to @code{0} could also be used to speed things up at
  10589. the cost of some accuracy.
  10590. Default value is @code{1}.
  10591. @item y0
  10592. @item y1
  10593. These define an exclusion band which excludes the lines between @option{y0} and
  10594. @option{y1} from being included in the field matching decision. An exclusion
  10595. band can be used to ignore subtitles, a logo, or other things that may
  10596. interfere with the matching. @option{y0} sets the starting scan line and
  10597. @option{y1} sets the ending line; all lines in between @option{y0} and
  10598. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  10599. @option{y0} and @option{y1} to the same value will disable the feature.
  10600. @option{y0} and @option{y1} defaults to @code{0}.
  10601. @item scthresh
  10602. Set the scene change detection threshold as a percentage of maximum change on
  10603. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  10604. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  10605. @option{scthresh} is @code{[0.0, 100.0]}.
  10606. Default value is @code{12.0}.
  10607. @item combmatch
  10608. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  10609. account the combed scores of matches when deciding what match to use as the
  10610. final match. Available values are:
  10611. @table @samp
  10612. @item none
  10613. No final matching based on combed scores.
  10614. @item sc
  10615. Combed scores are only used when a scene change is detected.
  10616. @item full
  10617. Use combed scores all the time.
  10618. @end table
  10619. Default is @var{sc}.
  10620. @item combdbg
  10621. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  10622. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  10623. Available values are:
  10624. @table @samp
  10625. @item none
  10626. No forced calculation.
  10627. @item pcn
  10628. Force p/c/n calculations.
  10629. @item pcnub
  10630. Force p/c/n/u/b calculations.
  10631. @end table
  10632. Default value is @var{none}.
  10633. @item cthresh
  10634. This is the area combing threshold used for combed frame detection. This
  10635. essentially controls how "strong" or "visible" combing must be to be detected.
  10636. Larger values mean combing must be more visible and smaller values mean combing
  10637. can be less visible or strong and still be detected. Valid settings are from
  10638. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  10639. be detected as combed). This is basically a pixel difference value. A good
  10640. range is @code{[8, 12]}.
  10641. Default value is @code{9}.
  10642. @item chroma
  10643. Sets whether or not chroma is considered in the combed frame decision. Only
  10644. disable this if your source has chroma problems (rainbowing, etc.) that are
  10645. causing problems for the combed frame detection with chroma enabled. Actually,
  10646. using @option{chroma}=@var{0} is usually more reliable, except for the case
  10647. where there is chroma only combing in the source.
  10648. Default value is @code{0}.
  10649. @item blockx
  10650. @item blocky
  10651. Respectively set the x-axis and y-axis size of the window used during combed
  10652. frame detection. This has to do with the size of the area in which
  10653. @option{combpel} pixels are required to be detected as combed for a frame to be
  10654. declared combed. See the @option{combpel} parameter description for more info.
  10655. Possible values are any number that is a power of 2 starting at 4 and going up
  10656. to 512.
  10657. Default value is @code{16}.
  10658. @item combpel
  10659. The number of combed pixels inside any of the @option{blocky} by
  10660. @option{blockx} size blocks on the frame for the frame to be detected as
  10661. combed. While @option{cthresh} controls how "visible" the combing must be, this
  10662. setting controls "how much" combing there must be in any localized area (a
  10663. window defined by the @option{blockx} and @option{blocky} settings) on the
  10664. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  10665. which point no frames will ever be detected as combed). This setting is known
  10666. as @option{MI} in TFM/VFM vocabulary.
  10667. Default value is @code{80}.
  10668. @end table
  10669. @anchor{p/c/n/u/b meaning}
  10670. @subsection p/c/n/u/b meaning
  10671. @subsubsection p/c/n
  10672. We assume the following telecined stream:
  10673. @example
  10674. Top fields: 1 2 2 3 4
  10675. Bottom fields: 1 2 3 4 4
  10676. @end example
  10677. The numbers correspond to the progressive frame the fields relate to. Here, the
  10678. first two frames are progressive, the 3rd and 4th are combed, and so on.
  10679. When @code{fieldmatch} is configured to run a matching from bottom
  10680. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  10681. @example
  10682. Input stream:
  10683. T 1 2 2 3 4
  10684. B 1 2 3 4 4 <-- matching reference
  10685. Matches: c c n n c
  10686. Output stream:
  10687. T 1 2 3 4 4
  10688. B 1 2 3 4 4
  10689. @end example
  10690. As a result of the field matching, we can see that some frames get duplicated.
  10691. To perform a complete inverse telecine, you need to rely on a decimation filter
  10692. after this operation. See for instance the @ref{decimate} filter.
  10693. The same operation now matching from top fields (@option{field}=@var{top})
  10694. looks like this:
  10695. @example
  10696. Input stream:
  10697. T 1 2 2 3 4 <-- matching reference
  10698. B 1 2 3 4 4
  10699. Matches: c c p p c
  10700. Output stream:
  10701. T 1 2 2 3 4
  10702. B 1 2 2 3 4
  10703. @end example
  10704. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  10705. basically, they refer to the frame and field of the opposite parity:
  10706. @itemize
  10707. @item @var{p} matches the field of the opposite parity in the previous frame
  10708. @item @var{c} matches the field of the opposite parity in the current frame
  10709. @item @var{n} matches the field of the opposite parity in the next frame
  10710. @end itemize
  10711. @subsubsection u/b
  10712. The @var{u} and @var{b} matching are a bit special in the sense that they match
  10713. from the opposite parity flag. In the following examples, we assume that we are
  10714. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  10715. 'x' is placed above and below each matched fields.
  10716. With bottom matching (@option{field}=@var{bottom}):
  10717. @example
  10718. Match: c p n b u
  10719. x x x x x
  10720. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10721. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10722. x x x x x
  10723. Output frames:
  10724. 2 1 2 2 2
  10725. 2 2 2 1 3
  10726. @end example
  10727. With top matching (@option{field}=@var{top}):
  10728. @example
  10729. Match: c p n b u
  10730. x x x x x
  10731. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10732. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10733. x x x x x
  10734. Output frames:
  10735. 2 2 2 1 2
  10736. 2 1 3 2 2
  10737. @end example
  10738. @subsection Examples
  10739. Simple IVTC of a top field first telecined stream:
  10740. @example
  10741. fieldmatch=order=tff:combmatch=none, decimate
  10742. @end example
  10743. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  10744. @example
  10745. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  10746. @end example
  10747. @section fieldorder
  10748. Transform the field order of the input video.
  10749. It accepts the following parameters:
  10750. @table @option
  10751. @item order
  10752. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  10753. for bottom field first.
  10754. @end table
  10755. The default value is @samp{tff}.
  10756. The transformation is done by shifting the picture content up or down
  10757. by one line, and filling the remaining line with appropriate picture content.
  10758. This method is consistent with most broadcast field order converters.
  10759. If the input video is not flagged as being interlaced, or it is already
  10760. flagged as being of the required output field order, then this filter does
  10761. not alter the incoming video.
  10762. It is very useful when converting to or from PAL DV material,
  10763. which is bottom field first.
  10764. For example:
  10765. @example
  10766. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  10767. @end example
  10768. @section fifo, afifo
  10769. Buffer input images and send them when they are requested.
  10770. It is mainly useful when auto-inserted by the libavfilter
  10771. framework.
  10772. It does not take parameters.
  10773. @section fillborders
  10774. Fill borders of the input video, without changing video stream dimensions.
  10775. Sometimes video can have garbage at the four edges and you may not want to
  10776. crop video input to keep size multiple of some number.
  10777. This filter accepts the following options:
  10778. @table @option
  10779. @item left
  10780. Number of pixels to fill from left border.
  10781. @item right
  10782. Number of pixels to fill from right border.
  10783. @item top
  10784. Number of pixels to fill from top border.
  10785. @item bottom
  10786. Number of pixels to fill from bottom border.
  10787. @item mode
  10788. Set fill mode.
  10789. It accepts the following values:
  10790. @table @samp
  10791. @item smear
  10792. fill pixels using outermost pixels
  10793. @item mirror
  10794. fill pixels using mirroring (half sample symmetric)
  10795. @item fixed
  10796. fill pixels with constant value
  10797. @item reflect
  10798. fill pixels using reflecting (whole sample symmetric)
  10799. @item wrap
  10800. fill pixels using wrapping
  10801. @item fade
  10802. fade pixels to constant value
  10803. @item margins
  10804. fill pixels at top and bottom with weighted averages pixels near borders
  10805. @end table
  10806. Default is @var{smear}.
  10807. @item color
  10808. Set color for pixels in fixed or fade mode. Default is @var{black}.
  10809. @end table
  10810. @subsection Commands
  10811. This filter supports same @ref{commands} as options.
  10812. The command accepts the same syntax of the corresponding option.
  10813. If the specified expression is not valid, it is kept at its current
  10814. value.
  10815. @section find_rect
  10816. Find a rectangular object in the input video.
  10817. The object to search for must be specified as a gray8 image specified with the
  10818. @option{object} option.
  10819. For each possible match, a score is computed. If the score reaches the specified
  10820. threshold, the object is considered found.
  10821. If the input video contains multiple instances of the object, the filter will
  10822. find only one of them.
  10823. When an object is found, the following metadata entries are set in the matching
  10824. frame:
  10825. @table @option
  10826. @item lavfi.rect.w
  10827. width of object
  10828. @item lavfi.rect.h
  10829. height of object
  10830. @item lavfi.rect.x
  10831. x position of object
  10832. @item lavfi.rect.y
  10833. y position of object
  10834. @item lavfi.rect.score
  10835. match score of the found object
  10836. @end table
  10837. It accepts the following options:
  10838. @table @option
  10839. @item object
  10840. Filepath of the object image, needs to be in gray8.
  10841. @item threshold
  10842. Detection threshold, expressed as a decimal number in the range 0-1.
  10843. A threshold value of 0.01 means only exact matches, a threshold of 0.99 means
  10844. almost everything matches.
  10845. Default value is 0.5.
  10846. @item mipmaps
  10847. Number of mipmaps, default is 3.
  10848. @item xmin, ymin, xmax, ymax
  10849. Specifies the rectangle in which to search.
  10850. @item discard
  10851. Discard frames where object is not detected. Default is disabled.
  10852. @end table
  10853. @subsection Examples
  10854. @itemize
  10855. @item
  10856. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  10857. @example
  10858. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  10859. @end example
  10860. @item
  10861. Find the position of an object in each frame using @command{ffprobe} and write
  10862. it to a log file:
  10863. @example
  10864. ffprobe -f lavfi movie=test.mp4,find_rect=object=object.pgm:threshold=0.3 \
  10865. -show_entries frame=pkt_pts_time:frame_tags=lavfi.rect.x,lavfi.rect.y \
  10866. -of csv -o find_rect.csv
  10867. @end example
  10868. @end itemize
  10869. @section floodfill
  10870. Flood area with values of same pixel components with another values.
  10871. It accepts the following options:
  10872. @table @option
  10873. @item x
  10874. Set pixel x coordinate.
  10875. @item y
  10876. Set pixel y coordinate.
  10877. @item s0
  10878. Set source #0 component value.
  10879. @item s1
  10880. Set source #1 component value.
  10881. @item s2
  10882. Set source #2 component value.
  10883. @item s3
  10884. Set source #3 component value.
  10885. @item d0
  10886. Set destination #0 component value.
  10887. @item d1
  10888. Set destination #1 component value.
  10889. @item d2
  10890. Set destination #2 component value.
  10891. @item d3
  10892. Set destination #3 component value.
  10893. @end table
  10894. @anchor{format}
  10895. @section format
  10896. Convert the input video to one of the specified pixel formats.
  10897. Libavfilter will try to pick one that is suitable as input to
  10898. the next filter.
  10899. It accepts the following parameters:
  10900. @table @option
  10901. @item pix_fmts
  10902. A '|'-separated list of pixel format names, such as
  10903. "pix_fmts=yuv420p|monow|rgb24".
  10904. @end table
  10905. @subsection Examples
  10906. @itemize
  10907. @item
  10908. Convert the input video to the @var{yuv420p} format
  10909. @example
  10910. format=pix_fmts=yuv420p
  10911. @end example
  10912. Convert the input video to any of the formats in the list
  10913. @example
  10914. format=pix_fmts=yuv420p|yuv444p|yuv410p
  10915. @end example
  10916. @end itemize
  10917. @anchor{fps}
  10918. @section fps
  10919. Convert the video to specified constant frame rate by duplicating or dropping
  10920. frames as necessary.
  10921. It accepts the following parameters:
  10922. @table @option
  10923. @item fps
  10924. The desired output frame rate. It accepts expressions containing the following
  10925. constants:
  10926. @table @samp
  10927. @item source_fps
  10928. The input's frame rate
  10929. @item ntsc
  10930. NTSC frame rate of @code{30000/1001}
  10931. @item pal
  10932. PAL frame rate of @code{25.0}
  10933. @item film
  10934. Film frame rate of @code{24.0}
  10935. @item ntsc_film
  10936. NTSC-film frame rate of @code{24000/1001}
  10937. @end table
  10938. The default is @code{25}.
  10939. @item start_time
  10940. Assume the first PTS should be the given value, in seconds. This allows for
  10941. padding/trimming at the start of stream. By default, no assumption is made
  10942. about the first frame's expected PTS, so no padding or trimming is done.
  10943. For example, this could be set to 0 to pad the beginning with duplicates of
  10944. the first frame if a video stream starts after the audio stream or to trim any
  10945. frames with a negative PTS.
  10946. @item round
  10947. Timestamp (PTS) rounding method.
  10948. Possible values are:
  10949. @table @option
  10950. @item zero
  10951. round towards 0
  10952. @item inf
  10953. round away from 0
  10954. @item down
  10955. round towards -infinity
  10956. @item up
  10957. round towards +infinity
  10958. @item near
  10959. round to nearest
  10960. @end table
  10961. The default is @code{near}.
  10962. @item eof_action
  10963. Action performed when reading the last frame.
  10964. Possible values are:
  10965. @table @option
  10966. @item round
  10967. Use same timestamp rounding method as used for other frames.
  10968. @item pass
  10969. Pass through last frame if input duration has not been reached yet.
  10970. @end table
  10971. The default is @code{round}.
  10972. @end table
  10973. Alternatively, the options can be specified as a flat string:
  10974. @var{fps}[:@var{start_time}[:@var{round}]].
  10975. See also the @ref{setpts} filter.
  10976. @subsection Examples
  10977. @itemize
  10978. @item
  10979. A typical usage in order to set the fps to 25:
  10980. @example
  10981. fps=fps=25
  10982. @end example
  10983. @item
  10984. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  10985. @example
  10986. fps=fps=film:round=near
  10987. @end example
  10988. @end itemize
  10989. @section framepack
  10990. Pack two different video streams into a stereoscopic video, setting proper
  10991. metadata on supported codecs. The two views should have the same size and
  10992. framerate and processing will stop when the shorter video ends. Please note
  10993. that you may conveniently adjust view properties with the @ref{scale} and
  10994. @ref{fps} filters.
  10995. It accepts the following parameters:
  10996. @table @option
  10997. @item format
  10998. The desired packing format. Supported values are:
  10999. @table @option
  11000. @item sbs
  11001. The views are next to each other (default).
  11002. @item tab
  11003. The views are on top of each other.
  11004. @item lines
  11005. The views are packed by line.
  11006. @item columns
  11007. The views are packed by column.
  11008. @item frameseq
  11009. The views are temporally interleaved.
  11010. @end table
  11011. @end table
  11012. Some examples:
  11013. @example
  11014. # Convert left and right views into a frame-sequential video
  11015. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  11016. # Convert views into a side-by-side video with the same output resolution as the input
  11017. 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
  11018. @end example
  11019. @section framerate
  11020. Change the frame rate by interpolating new video output frames from the source
  11021. frames.
  11022. This filter is not designed to function correctly with interlaced media. If
  11023. you wish to change the frame rate of interlaced media then you are required
  11024. to deinterlace before this filter and re-interlace after this filter.
  11025. A description of the accepted options follows.
  11026. @table @option
  11027. @item fps
  11028. Specify the output frames per second. This option can also be specified
  11029. as a value alone. The default is @code{50}.
  11030. @item interp_start
  11031. Specify the start of a range where the output frame will be created as a
  11032. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  11033. the default is @code{15}.
  11034. @item interp_end
  11035. Specify the end of a range where the output frame will be created as a
  11036. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  11037. the default is @code{240}.
  11038. @item scene
  11039. Specify the level at which a scene change is detected as a value between
  11040. 0 and 100 to indicate a new scene; a low value reflects a low
  11041. probability for the current frame to introduce a new scene, while a higher
  11042. value means the current frame is more likely to be one.
  11043. The default is @code{8.2}.
  11044. @item flags
  11045. Specify flags influencing the filter process.
  11046. Available value for @var{flags} is:
  11047. @table @option
  11048. @item scene_change_detect, scd
  11049. Enable scene change detection using the value of the option @var{scene}.
  11050. This flag is enabled by default.
  11051. @end table
  11052. @end table
  11053. @section framestep
  11054. Select one frame every N-th frame.
  11055. This filter accepts the following option:
  11056. @table @option
  11057. @item step
  11058. Select frame after every @code{step} frames.
  11059. Allowed values are positive integers higher than 0. Default value is @code{1}.
  11060. @end table
  11061. @section freezedetect
  11062. Detect frozen video.
  11063. This filter logs a message and sets frame metadata when it detects that the
  11064. input video has no significant change in content during a specified duration.
  11065. Video freeze detection calculates the mean average absolute difference of all
  11066. the components of video frames and compares it to a noise floor.
  11067. The printed times and duration are expressed in seconds. The
  11068. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  11069. whose timestamp equals or exceeds the detection duration and it contains the
  11070. timestamp of the first frame of the freeze. The
  11071. @code{lavfi.freezedetect.freeze_duration} and
  11072. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  11073. after the freeze.
  11074. The filter accepts the following options:
  11075. @table @option
  11076. @item noise, n
  11077. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  11078. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  11079. 0.001.
  11080. @item duration, d
  11081. Set freeze duration until notification (default is 2 seconds).
  11082. @end table
  11083. @section freezeframes
  11084. Freeze video frames.
  11085. This filter freezes video frames using frame from 2nd input.
  11086. The filter accepts the following options:
  11087. @table @option
  11088. @item first
  11089. Set number of first frame from which to start freeze.
  11090. @item last
  11091. Set number of last frame from which to end freeze.
  11092. @item replace
  11093. Set number of frame from 2nd input which will be used instead of replaced frames.
  11094. @end table
  11095. @anchor{frei0r}
  11096. @section frei0r
  11097. Apply a frei0r effect to the input video.
  11098. To enable the compilation of this filter, you need to install the frei0r
  11099. header and configure FFmpeg with @code{--enable-frei0r}.
  11100. It accepts the following parameters:
  11101. @table @option
  11102. @item filter_name
  11103. The name of the frei0r effect to load. If the environment variable
  11104. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  11105. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  11106. Otherwise, the standard frei0r paths are searched, in this order:
  11107. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  11108. @file{/usr/lib/frei0r-1/}.
  11109. @item filter_params
  11110. A '|'-separated list of parameters to pass to the frei0r effect.
  11111. @end table
  11112. A frei0r effect parameter can be a boolean (its value is either
  11113. "y" or "n"), a double, a color (specified as
  11114. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  11115. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  11116. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  11117. a position (specified as @var{X}/@var{Y}, where
  11118. @var{X} and @var{Y} are floating point numbers) and/or a string.
  11119. The number and types of parameters depend on the loaded effect. If an
  11120. effect parameter is not specified, the default value is set.
  11121. @subsection Examples
  11122. @itemize
  11123. @item
  11124. Apply the distort0r effect, setting the first two double parameters:
  11125. @example
  11126. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  11127. @end example
  11128. @item
  11129. Apply the colordistance effect, taking a color as the first parameter:
  11130. @example
  11131. frei0r=colordistance:0.2/0.3/0.4
  11132. frei0r=colordistance:violet
  11133. frei0r=colordistance:0x112233
  11134. @end example
  11135. @item
  11136. Apply the perspective effect, specifying the top left and top right image
  11137. positions:
  11138. @example
  11139. frei0r=perspective:0.2/0.2|0.8/0.2
  11140. @end example
  11141. @end itemize
  11142. For more information, see
  11143. @url{http://frei0r.dyne.org}
  11144. @subsection Commands
  11145. This filter supports the @option{filter_params} option as @ref{commands}.
  11146. @section fspp
  11147. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  11148. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  11149. processing filter, one of them is performed once per block, not per pixel.
  11150. This allows for much higher speed.
  11151. The filter accepts the following options:
  11152. @table @option
  11153. @item quality
  11154. Set quality. This option defines the number of levels for averaging. It accepts
  11155. an integer in the range 4-5. Default value is @code{4}.
  11156. @item qp
  11157. Force a constant quantization parameter. It accepts an integer in range 0-63.
  11158. If not set, the filter will use the QP from the video stream (if available).
  11159. @item strength
  11160. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  11161. more details but also more artifacts, while higher values make the image smoother
  11162. but also blurrier. Default value is @code{0} − PSNR optimal.
  11163. @item use_bframe_qp
  11164. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11165. option may cause flicker since the B-Frames have often larger QP. Default is
  11166. @code{0} (not enabled).
  11167. @end table
  11168. @section gblur
  11169. Apply Gaussian blur filter.
  11170. The filter accepts the following options:
  11171. @table @option
  11172. @item sigma
  11173. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  11174. @item steps
  11175. Set number of steps for Gaussian approximation. Default is @code{1}.
  11176. @item planes
  11177. Set which planes to filter. By default all planes are filtered.
  11178. @item sigmaV
  11179. Set vertical sigma, if negative it will be same as @code{sigma}.
  11180. Default is @code{-1}.
  11181. @end table
  11182. @subsection Commands
  11183. This filter supports same commands as options.
  11184. The command accepts the same syntax of the corresponding option.
  11185. If the specified expression is not valid, it is kept at its current
  11186. value.
  11187. @section geq
  11188. Apply generic equation to each pixel.
  11189. The filter accepts the following options:
  11190. @table @option
  11191. @item lum_expr, lum
  11192. Set the luma expression.
  11193. @item cb_expr, cb
  11194. Set the chrominance blue expression.
  11195. @item cr_expr, cr
  11196. Set the chrominance red expression.
  11197. @item alpha_expr, a
  11198. Set the alpha expression.
  11199. @item red_expr, r
  11200. Set the red expression.
  11201. @item green_expr, g
  11202. Set the green expression.
  11203. @item blue_expr, b
  11204. Set the blue expression.
  11205. @end table
  11206. The colorspace is selected according to the specified options. If one
  11207. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  11208. options is specified, the filter will automatically select a YCbCr
  11209. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  11210. @option{blue_expr} options is specified, it will select an RGB
  11211. colorspace.
  11212. If one of the chrominance expression is not defined, it falls back on the other
  11213. one. If no alpha expression is specified it will evaluate to opaque value.
  11214. If none of chrominance expressions are specified, they will evaluate
  11215. to the luma expression.
  11216. The expressions can use the following variables and functions:
  11217. @table @option
  11218. @item N
  11219. The sequential number of the filtered frame, starting from @code{0}.
  11220. @item X
  11221. @item Y
  11222. The coordinates of the current sample.
  11223. @item W
  11224. @item H
  11225. The width and height of the image.
  11226. @item SW
  11227. @item SH
  11228. Width and height scale depending on the currently filtered plane. It is the
  11229. ratio between the corresponding luma plane number of pixels and the current
  11230. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  11231. @code{0.5,0.5} for chroma planes.
  11232. @item T
  11233. Time of the current frame, expressed in seconds.
  11234. @item p(x, y)
  11235. Return the value of the pixel at location (@var{x},@var{y}) of the current
  11236. plane.
  11237. @item lum(x, y)
  11238. Return the value of the pixel at location (@var{x},@var{y}) of the luma
  11239. plane.
  11240. @item cb(x, y)
  11241. Return the value of the pixel at location (@var{x},@var{y}) of the
  11242. blue-difference chroma plane. Return 0 if there is no such plane.
  11243. @item cr(x, y)
  11244. Return the value of the pixel at location (@var{x},@var{y}) of the
  11245. red-difference chroma plane. Return 0 if there is no such plane.
  11246. @item r(x, y)
  11247. @item g(x, y)
  11248. @item b(x, y)
  11249. Return the value of the pixel at location (@var{x},@var{y}) of the
  11250. red/green/blue component. Return 0 if there is no such component.
  11251. @item alpha(x, y)
  11252. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  11253. plane. Return 0 if there is no such plane.
  11254. @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)
  11255. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  11256. sums of samples within a rectangle. See the functions without the sum postfix.
  11257. @item interpolation
  11258. Set one of interpolation methods:
  11259. @table @option
  11260. @item nearest, n
  11261. @item bilinear, b
  11262. @end table
  11263. Default is bilinear.
  11264. @end table
  11265. For functions, if @var{x} and @var{y} are outside the area, the value will be
  11266. automatically clipped to the closer edge.
  11267. Please note that this filter can use multiple threads in which case each slice
  11268. will have its own expression state. If you want to use only a single expression
  11269. state because your expressions depend on previous state then you should limit
  11270. the number of filter threads to 1.
  11271. @subsection Examples
  11272. @itemize
  11273. @item
  11274. Flip the image horizontally:
  11275. @example
  11276. geq=p(W-X\,Y)
  11277. @end example
  11278. @item
  11279. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  11280. wavelength of 100 pixels:
  11281. @example
  11282. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  11283. @end example
  11284. @item
  11285. Generate a fancy enigmatic moving light:
  11286. @example
  11287. 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
  11288. @end example
  11289. @item
  11290. Generate a quick emboss effect:
  11291. @example
  11292. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  11293. @end example
  11294. @item
  11295. Modify RGB components depending on pixel position:
  11296. @example
  11297. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  11298. @end example
  11299. @item
  11300. Create a radial gradient that is the same size as the input (also see
  11301. the @ref{vignette} filter):
  11302. @example
  11303. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  11304. @end example
  11305. @end itemize
  11306. @section gradfun
  11307. Fix the banding artifacts that are sometimes introduced into nearly flat
  11308. regions by truncation to 8-bit color depth.
  11309. Interpolate the gradients that should go where the bands are, and
  11310. dither them.
  11311. It is designed for playback only. Do not use it prior to
  11312. lossy compression, because compression tends to lose the dither and
  11313. bring back the bands.
  11314. It accepts the following parameters:
  11315. @table @option
  11316. @item strength
  11317. The maximum amount by which the filter will change any one pixel. This is also
  11318. the threshold for detecting nearly flat regions. Acceptable values range from
  11319. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  11320. valid range.
  11321. @item radius
  11322. The neighborhood to fit the gradient to. A larger radius makes for smoother
  11323. gradients, but also prevents the filter from modifying the pixels near detailed
  11324. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  11325. values will be clipped to the valid range.
  11326. @end table
  11327. Alternatively, the options can be specified as a flat string:
  11328. @var{strength}[:@var{radius}]
  11329. @subsection Examples
  11330. @itemize
  11331. @item
  11332. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  11333. @example
  11334. gradfun=3.5:8
  11335. @end example
  11336. @item
  11337. Specify radius, omitting the strength (which will fall-back to the default
  11338. value):
  11339. @example
  11340. gradfun=radius=8
  11341. @end example
  11342. @end itemize
  11343. @anchor{graphmonitor}
  11344. @section graphmonitor
  11345. Show various filtergraph stats.
  11346. With this filter one can debug complete filtergraph.
  11347. Especially issues with links filling with queued frames.
  11348. The filter accepts the following options:
  11349. @table @option
  11350. @item size, s
  11351. Set video output size. Default is @var{hd720}.
  11352. @item opacity, o
  11353. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  11354. @item mode, m
  11355. Set output mode flags.
  11356. Available values for flags are:
  11357. @table @samp
  11358. @item full
  11359. No any filtering. Default.
  11360. @item compact
  11361. Show only filters with queued frames.
  11362. @item nozero
  11363. Show only filters with non-zero stats.
  11364. @item noeof
  11365. Show only filters with non-eof stat.
  11366. @item nodisabled
  11367. Show only filters that are enabled in timeline.
  11368. @end table
  11369. @item flags, f
  11370. Set flags which enable which stats are shown in video.
  11371. Available values for flags are:
  11372. @table @samp
  11373. @item none
  11374. All flags turned off.
  11375. @item all
  11376. All flags turned on.
  11377. @item queue
  11378. Display number of queued frames in each link.
  11379. @item frame_count_in
  11380. Display number of frames taken from filter.
  11381. @item frame_count_out
  11382. Display number of frames given out from filter.
  11383. @item frame_count_delta
  11384. Display delta number of frames between above two values.
  11385. @item pts
  11386. Display current filtered frame pts.
  11387. @item pts_delta
  11388. Display pts delta between current and previous frame.
  11389. @item time
  11390. Display current filtered frame time.
  11391. @item time_delta
  11392. Display time delta between current and previous frame.
  11393. @item timebase
  11394. Display time base for filter link.
  11395. @item format
  11396. Display used format for filter link.
  11397. @item size
  11398. Display video size or number of audio channels in case of audio used by filter link.
  11399. @item rate
  11400. Display video frame rate or sample rate in case of audio used by filter link.
  11401. @item eof
  11402. Display link output status.
  11403. @item sample_count_in
  11404. Display number of samples taken from filter.
  11405. @item sample_count_out
  11406. Display number of samples given out from filter.
  11407. @item sample_count_delta
  11408. Display delta number of samples between above two values.
  11409. @item disabled
  11410. Show the timeline filter status.
  11411. @end table
  11412. @item rate, r
  11413. Set upper limit for video rate of output stream, Default value is @var{25}.
  11414. This guarantee that output video frame rate will not be higher than this value.
  11415. @end table
  11416. @section grayworld
  11417. A color constancy filter that applies color correction based on the grayworld assumption
  11418. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  11419. The algorithm uses linear light, so input
  11420. data should be linearized beforehand (and possibly correctly tagged).
  11421. @example
  11422. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  11423. @end example
  11424. @section greyedge
  11425. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  11426. and corrects the scene colors accordingly.
  11427. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  11428. The filter accepts the following options:
  11429. @table @option
  11430. @item difford
  11431. The order of differentiation to be applied on the scene. Must be chosen in the range
  11432. [0,2] and default value is 1.
  11433. @item minknorm
  11434. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  11435. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  11436. max value instead of calculating Minkowski distance.
  11437. @item sigma
  11438. The standard deviation of Gaussian blur to be applied on the scene. Must be
  11439. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  11440. can't be equal to 0 if @var{difford} is greater than 0.
  11441. @end table
  11442. @subsection Examples
  11443. @itemize
  11444. @item
  11445. Grey Edge:
  11446. @example
  11447. greyedge=difford=1:minknorm=5:sigma=2
  11448. @end example
  11449. @item
  11450. Max Edge:
  11451. @example
  11452. greyedge=difford=1:minknorm=0:sigma=2
  11453. @end example
  11454. @end itemize
  11455. @section guided
  11456. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  11457. The filter accepts the following options:
  11458. @table @option
  11459. @item radius
  11460. Set the box radius in pixels.
  11461. Allowed range is 1 to 20. Default is 3.
  11462. @item eps
  11463. Set regularization parameter (with square).
  11464. Allowed range is 0 to 1. Default is 0.01.
  11465. @item mode
  11466. Set filter mode. Can be @code{basic} or @code{fast}.
  11467. Default is @code{basic}.
  11468. @item sub
  11469. Set subsampling ratio for @code{fast} mode.
  11470. Range is 2 to 64. Default is 4.
  11471. No subsampling occurs in @code{basic} mode.
  11472. @item guidance
  11473. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  11474. If @code{off}, single input is required.
  11475. If @code{on}, two inputs of the same resolution and pixel format are required.
  11476. The second input serves as the guidance.
  11477. @item planes
  11478. Set planes to filter. Default is first only.
  11479. @end table
  11480. @subsection Commands
  11481. This filter supports the all above options as @ref{commands}.
  11482. @subsection Examples
  11483. @itemize
  11484. @item
  11485. Edge-preserving smoothing with guided filter:
  11486. @example
  11487. ffmpeg -i in.png -vf guided out.png
  11488. @end example
  11489. @item
  11490. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  11491. For the generation of guidance image, refer to paper "Guided Image Filtering".
  11492. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  11493. @example
  11494. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  11495. @end example
  11496. @end itemize
  11497. @anchor{haldclut}
  11498. @section haldclut
  11499. Apply a Hald CLUT to a video stream.
  11500. First input is the video stream to process, and second one is the Hald CLUT.
  11501. The Hald CLUT input can be a simple picture or a complete video stream.
  11502. The filter accepts the following options:
  11503. @table @option
  11504. @item clut
  11505. Set which CLUT video frames will be processed from second input stream,
  11506. can be @var{first} or @var{all}. Default is @var{all}.
  11507. @item shortest
  11508. Force termination when the shortest input terminates. Default is @code{0}.
  11509. @item repeatlast
  11510. Continue applying the last CLUT after the end of the stream. A value of
  11511. @code{0} disable the filter after the last frame of the CLUT is reached.
  11512. Default is @code{1}.
  11513. @end table
  11514. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  11515. filters share the same internals).
  11516. This filter also supports the @ref{framesync} options.
  11517. More information about the Hald CLUT can be found on Eskil Steenberg's website
  11518. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  11519. @subsection Commands
  11520. This filter supports the @code{interp} option as @ref{commands}.
  11521. @subsection Workflow examples
  11522. @subsubsection Hald CLUT video stream
  11523. Generate an identity Hald CLUT stream altered with various effects:
  11524. @example
  11525. 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
  11526. @end example
  11527. Note: make sure you use a lossless codec.
  11528. Then use it with @code{haldclut} to apply it on some random stream:
  11529. @example
  11530. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  11531. @end example
  11532. The Hald CLUT will be applied to the 10 first seconds (duration of
  11533. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  11534. to the remaining frames of the @code{mandelbrot} stream.
  11535. @subsubsection Hald CLUT with preview
  11536. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  11537. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  11538. biggest possible square starting at the top left of the picture. The remaining
  11539. padding pixels (bottom or right) will be ignored. This area can be used to add
  11540. a preview of the Hald CLUT.
  11541. Typically, the following generated Hald CLUT will be supported by the
  11542. @code{haldclut} filter:
  11543. @example
  11544. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  11545. pad=iw+320 [padded_clut];
  11546. smptebars=s=320x256, split [a][b];
  11547. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  11548. [main][b] overlay=W-320" -frames:v 1 clut.png
  11549. @end example
  11550. It contains the original and a preview of the effect of the CLUT: SMPTE color
  11551. bars are displayed on the right-top, and below the same color bars processed by
  11552. the color changes.
  11553. Then, the effect of this Hald CLUT can be visualized with:
  11554. @example
  11555. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  11556. @end example
  11557. @section hflip
  11558. Flip the input video horizontally.
  11559. For example, to horizontally flip the input video with @command{ffmpeg}:
  11560. @example
  11561. ffmpeg -i in.avi -vf "hflip" out.avi
  11562. @end example
  11563. @section histeq
  11564. This filter applies a global color histogram equalization on a
  11565. per-frame basis.
  11566. It can be used to correct video that has a compressed range of pixel
  11567. intensities. The filter redistributes the pixel intensities to
  11568. equalize their distribution across the intensity range. It may be
  11569. viewed as an "automatically adjusting contrast filter". This filter is
  11570. useful only for correcting degraded or poorly captured source
  11571. video.
  11572. The filter accepts the following options:
  11573. @table @option
  11574. @item strength
  11575. Determine the amount of equalization to be applied. As the strength
  11576. is reduced, the distribution of pixel intensities more-and-more
  11577. approaches that of the input frame. The value must be a float number
  11578. in the range [0,1] and defaults to 0.200.
  11579. @item intensity
  11580. Set the maximum intensity that can generated and scale the output
  11581. values appropriately. The strength should be set as desired and then
  11582. the intensity can be limited if needed to avoid washing-out. The value
  11583. must be a float number in the range [0,1] and defaults to 0.210.
  11584. @item antibanding
  11585. Set the antibanding level. If enabled the filter will randomly vary
  11586. the luminance of output pixels by a small amount to avoid banding of
  11587. the histogram. Possible values are @code{none}, @code{weak} or
  11588. @code{strong}. It defaults to @code{none}.
  11589. @end table
  11590. @anchor{histogram}
  11591. @section histogram
  11592. Compute and draw a color distribution histogram for the input video.
  11593. The computed histogram is a representation of the color component
  11594. distribution in an image.
  11595. Standard histogram displays the color components distribution in an image.
  11596. Displays color graph for each color component. Shows distribution of
  11597. the Y, U, V, A or R, G, B components, depending on input format, in the
  11598. current frame. Below each graph a color component scale meter is shown.
  11599. The filter accepts the following options:
  11600. @table @option
  11601. @item level_height
  11602. Set height of level. Default value is @code{200}.
  11603. Allowed range is [50, 2048].
  11604. @item scale_height
  11605. Set height of color scale. Default value is @code{12}.
  11606. Allowed range is [0, 40].
  11607. @item display_mode
  11608. Set display mode.
  11609. It accepts the following values:
  11610. @table @samp
  11611. @item stack
  11612. Per color component graphs are placed below each other.
  11613. @item parade
  11614. Per color component graphs are placed side by side.
  11615. @item overlay
  11616. Presents information identical to that in the @code{parade}, except
  11617. that the graphs representing color components are superimposed directly
  11618. over one another.
  11619. @end table
  11620. Default is @code{stack}.
  11621. @item levels_mode
  11622. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  11623. Default is @code{linear}.
  11624. @item components
  11625. Set what color components to display.
  11626. Default is @code{7}.
  11627. @item fgopacity
  11628. Set foreground opacity. Default is @code{0.7}.
  11629. @item bgopacity
  11630. Set background opacity. Default is @code{0.5}.
  11631. @item colors_mode
  11632. Set colors mode.
  11633. It accepts the following values:
  11634. @table @samp
  11635. @item whiteonblack
  11636. @item blackonwhite
  11637. @item whiteongray
  11638. @item blackongray
  11639. @item coloronblack
  11640. @item coloronwhite
  11641. @item colorongray
  11642. @item blackoncolor
  11643. @item whiteoncolor
  11644. @item grayoncolor
  11645. @end table
  11646. Default is @code{whiteonblack}.
  11647. @end table
  11648. @subsection Examples
  11649. @itemize
  11650. @item
  11651. Calculate and draw histogram:
  11652. @example
  11653. ffplay -i input -vf histogram
  11654. @end example
  11655. @end itemize
  11656. @anchor{hqdn3d}
  11657. @section hqdn3d
  11658. This is a high precision/quality 3d denoise filter. It aims to reduce
  11659. image noise, producing smooth images and making still images really
  11660. still. It should enhance compressibility.
  11661. It accepts the following optional parameters:
  11662. @table @option
  11663. @item luma_spatial
  11664. A non-negative floating point number which specifies spatial luma strength.
  11665. It defaults to 4.0.
  11666. @item chroma_spatial
  11667. A non-negative floating point number which specifies spatial chroma strength.
  11668. It defaults to 3.0*@var{luma_spatial}/4.0.
  11669. @item luma_tmp
  11670. A floating point number which specifies luma temporal strength. It defaults to
  11671. 6.0*@var{luma_spatial}/4.0.
  11672. @item chroma_tmp
  11673. A floating point number which specifies chroma temporal strength. It defaults to
  11674. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  11675. @end table
  11676. @subsection Commands
  11677. This filter supports same @ref{commands} as options.
  11678. The command accepts the same syntax of the corresponding option.
  11679. If the specified expression is not valid, it is kept at its current
  11680. value.
  11681. @anchor{hwdownload}
  11682. @section hwdownload
  11683. Download hardware frames to system memory.
  11684. The input must be in hardware frames, and the output a non-hardware format.
  11685. Not all formats will be supported on the output - it may be necessary to insert
  11686. an additional @option{format} filter immediately following in the graph to get
  11687. the output in a supported format.
  11688. @section hwmap
  11689. Map hardware frames to system memory or to another device.
  11690. This filter has several different modes of operation; which one is used depends
  11691. on the input and output formats:
  11692. @itemize
  11693. @item
  11694. Hardware frame input, normal frame output
  11695. Map the input frames to system memory and pass them to the output. If the
  11696. original hardware frame is later required (for example, after overlaying
  11697. something else on part of it), the @option{hwmap} filter can be used again
  11698. in the next mode to retrieve it.
  11699. @item
  11700. Normal frame input, hardware frame output
  11701. If the input is actually a software-mapped hardware frame, then unmap it -
  11702. that is, return the original hardware frame.
  11703. Otherwise, a device must be provided. Create new hardware surfaces on that
  11704. device for the output, then map them back to the software format at the input
  11705. and give those frames to the preceding filter. This will then act like the
  11706. @option{hwupload} filter, but may be able to avoid an additional copy when
  11707. the input is already in a compatible format.
  11708. @item
  11709. Hardware frame input and output
  11710. A device must be supplied for the output, either directly or with the
  11711. @option{derive_device} option. The input and output devices must be of
  11712. different types and compatible - the exact meaning of this is
  11713. system-dependent, but typically it means that they must refer to the same
  11714. underlying hardware context (for example, refer to the same graphics card).
  11715. If the input frames were originally created on the output device, then unmap
  11716. to retrieve the original frames.
  11717. Otherwise, map the frames to the output device - create new hardware frames
  11718. on the output corresponding to the frames on the input.
  11719. @end itemize
  11720. The following additional parameters are accepted:
  11721. @table @option
  11722. @item mode
  11723. Set the frame mapping mode. Some combination of:
  11724. @table @var
  11725. @item read
  11726. The mapped frame should be readable.
  11727. @item write
  11728. The mapped frame should be writeable.
  11729. @item overwrite
  11730. The mapping will always overwrite the entire frame.
  11731. This may improve performance in some cases, as the original contents of the
  11732. frame need not be loaded.
  11733. @item direct
  11734. The mapping must not involve any copying.
  11735. Indirect mappings to copies of frames are created in some cases where either
  11736. direct mapping is not possible or it would have unexpected properties.
  11737. Setting this flag ensures that the mapping is direct and will fail if that is
  11738. not possible.
  11739. @end table
  11740. Defaults to @var{read+write} if not specified.
  11741. @item derive_device @var{type}
  11742. Rather than using the device supplied at initialisation, instead derive a new
  11743. device of type @var{type} from the device the input frames exist on.
  11744. @item reverse
  11745. In a hardware to hardware mapping, map in reverse - create frames in the sink
  11746. and map them back to the source. This may be necessary in some cases where
  11747. a mapping in one direction is required but only the opposite direction is
  11748. supported by the devices being used.
  11749. This option is dangerous - it may break the preceding filter in undefined
  11750. ways if there are any additional constraints on that filter's output.
  11751. Do not use it without fully understanding the implications of its use.
  11752. @end table
  11753. @anchor{hwupload}
  11754. @section hwupload
  11755. Upload system memory frames to hardware surfaces.
  11756. The device to upload to must be supplied when the filter is initialised. If
  11757. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  11758. option or with the @option{derive_device} option. The input and output devices
  11759. must be of different types and compatible - the exact meaning of this is
  11760. system-dependent, but typically it means that they must refer to the same
  11761. underlying hardware context (for example, refer to the same graphics card).
  11762. The following additional parameters are accepted:
  11763. @table @option
  11764. @item derive_device @var{type}
  11765. Rather than using the device supplied at initialisation, instead derive a new
  11766. device of type @var{type} from the device the input frames exist on.
  11767. @end table
  11768. @anchor{hwupload_cuda}
  11769. @section hwupload_cuda
  11770. Upload system memory frames to a CUDA device.
  11771. It accepts the following optional parameters:
  11772. @table @option
  11773. @item device
  11774. The number of the CUDA device to use
  11775. @end table
  11776. @section hqx
  11777. Apply a high-quality magnification filter designed for pixel art. This filter
  11778. was originally created by Maxim Stepin.
  11779. It accepts the following option:
  11780. @table @option
  11781. @item n
  11782. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  11783. @code{hq3x} and @code{4} for @code{hq4x}.
  11784. Default is @code{3}.
  11785. @end table
  11786. @anchor{hstack}
  11787. @section hstack
  11788. Stack input videos horizontally.
  11789. All streams must be of same pixel format and of same height.
  11790. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11791. to create same output.
  11792. The filter accepts the following option:
  11793. @table @option
  11794. @item inputs
  11795. Set number of input streams. Default is 2.
  11796. @item shortest
  11797. If set to 1, force the output to terminate when the shortest input
  11798. terminates. Default value is 0.
  11799. @end table
  11800. @section hsvhold
  11801. Turns a certain HSV range into gray values.
  11802. This filter measures color difference between set HSV color in options
  11803. and ones measured in video stream. Depending on options, output
  11804. colors can be changed to be gray or not.
  11805. The filter accepts the following options:
  11806. @table @option
  11807. @item hue
  11808. Set the hue value which will be used in color difference calculation.
  11809. Allowed range is from -360 to 360. Default value is 0.
  11810. @item sat
  11811. Set the saturation value which will be used in color difference calculation.
  11812. Allowed range is from -1 to 1. Default value is 0.
  11813. @item val
  11814. Set the value which will be used in color difference calculation.
  11815. Allowed range is from -1 to 1. Default value is 0.
  11816. @item similarity
  11817. Set similarity percentage with the key color.
  11818. Allowed range is from 0 to 1. Default value is 0.01.
  11819. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11820. @item blend
  11821. Blend percentage.
  11822. Allowed range is from 0 to 1. Default value is 0.
  11823. 0.0 makes pixels either fully gray, or not gray at all.
  11824. Higher values result in more gray pixels, with a higher gray pixel
  11825. the more similar the pixels color is to the key color.
  11826. @end table
  11827. @section hsvkey
  11828. Turns a certain HSV range into transparency.
  11829. This filter measures color difference between set HSV color in options
  11830. and ones measured in video stream. Depending on options, output
  11831. colors can be changed to transparent by adding alpha channel.
  11832. The filter accepts the following options:
  11833. @table @option
  11834. @item hue
  11835. Set the hue value which will be used in color difference calculation.
  11836. Allowed range is from -360 to 360. Default value is 0.
  11837. @item sat
  11838. Set the saturation value which will be used in color difference calculation.
  11839. Allowed range is from -1 to 1. Default value is 0.
  11840. @item val
  11841. Set the value which will be used in color difference calculation.
  11842. Allowed range is from -1 to 1. Default value is 0.
  11843. @item similarity
  11844. Set similarity percentage with the key color.
  11845. Allowed range is from 0 to 1. Default value is 0.01.
  11846. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11847. @item blend
  11848. Blend percentage.
  11849. Allowed range is from 0 to 1. Default value is 0.
  11850. 0.0 makes pixels either fully transparent, or not transparent at all.
  11851. Higher values result in semi-transparent pixels, with a higher transparency
  11852. the more similar the pixels color is to the key color.
  11853. @end table
  11854. @section hue
  11855. Modify the hue and/or the saturation of the input.
  11856. It accepts the following parameters:
  11857. @table @option
  11858. @item h
  11859. Specify the hue angle as a number of degrees. It accepts an expression,
  11860. and defaults to "0".
  11861. @item s
  11862. Specify the saturation in the [-10,10] range. It accepts an expression and
  11863. defaults to "1".
  11864. @item H
  11865. Specify the hue angle as a number of radians. It accepts an
  11866. expression, and defaults to "0".
  11867. @item b
  11868. Specify the brightness in the [-10,10] range. It accepts an expression and
  11869. defaults to "0".
  11870. @end table
  11871. @option{h} and @option{H} are mutually exclusive, and can't be
  11872. specified at the same time.
  11873. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  11874. expressions containing the following constants:
  11875. @table @option
  11876. @item n
  11877. frame count of the input frame starting from 0
  11878. @item pts
  11879. presentation timestamp of the input frame expressed in time base units
  11880. @item r
  11881. frame rate of the input video, NAN if the input frame rate is unknown
  11882. @item t
  11883. timestamp expressed in seconds, NAN if the input timestamp is unknown
  11884. @item tb
  11885. time base of the input video
  11886. @end table
  11887. @subsection Examples
  11888. @itemize
  11889. @item
  11890. Set the hue to 90 degrees and the saturation to 1.0:
  11891. @example
  11892. hue=h=90:s=1
  11893. @end example
  11894. @item
  11895. Same command but expressing the hue in radians:
  11896. @example
  11897. hue=H=PI/2:s=1
  11898. @end example
  11899. @item
  11900. Rotate hue and make the saturation swing between 0
  11901. and 2 over a period of 1 second:
  11902. @example
  11903. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  11904. @end example
  11905. @item
  11906. Apply a 3 seconds saturation fade-in effect starting at 0:
  11907. @example
  11908. hue="s=min(t/3\,1)"
  11909. @end example
  11910. The general fade-in expression can be written as:
  11911. @example
  11912. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  11913. @end example
  11914. @item
  11915. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  11916. @example
  11917. hue="s=max(0\, min(1\, (8-t)/3))"
  11918. @end example
  11919. The general fade-out expression can be written as:
  11920. @example
  11921. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  11922. @end example
  11923. @end itemize
  11924. @subsection Commands
  11925. This filter supports the following commands:
  11926. @table @option
  11927. @item b
  11928. @item s
  11929. @item h
  11930. @item H
  11931. Modify the hue and/or the saturation and/or brightness of the input video.
  11932. The command accepts the same syntax of the corresponding option.
  11933. If the specified expression is not valid, it is kept at its current
  11934. value.
  11935. @end table
  11936. @section huesaturation
  11937. Apply hue-saturation-intensity adjustments to input video stream.
  11938. This filter operates in RGB colorspace.
  11939. This filter accepts the following options:
  11940. @table @option
  11941. @item hue
  11942. Set the hue shift in degrees to apply. Default is 0.
  11943. Allowed range is from -180 to 180.
  11944. @item saturation
  11945. Set the saturation shift. Default is 0.
  11946. Allowed range is from -1 to 1.
  11947. @item intensity
  11948. Set the intensity shift. Default is 0.
  11949. Allowed range is from -1 to 1.
  11950. @item colors
  11951. Set which primary and complementary colors are going to be adjusted.
  11952. This options is set by providing one or multiple values.
  11953. This can select multiple colors at once. By default all colors are selected.
  11954. @table @samp
  11955. @item r
  11956. Adjust reds.
  11957. @item y
  11958. Adjust yellows.
  11959. @item g
  11960. Adjust greens.
  11961. @item c
  11962. Adjust cyans.
  11963. @item b
  11964. Adjust blues.
  11965. @item m
  11966. Adjust magentas.
  11967. @item a
  11968. Adjust all colors.
  11969. @end table
  11970. @item strength
  11971. Set strength of filtering. Allowed range is from 0 to 100.
  11972. Default value is 1.
  11973. @item rw, gw, bw
  11974. Set weight for each RGB component. Allowed range is from 0 to 1.
  11975. By default is set to 0.333, 0.334, 0.333.
  11976. Those options are used in saturation and lightess processing.
  11977. @item lightness
  11978. Set preserving lightness, by default is disabled.
  11979. Adjusting hues can change lightness from original RGB triplet,
  11980. with this option enabled lightness is kept at same value.
  11981. @end table
  11982. @section hysteresis
  11983. Grow first stream into second stream by connecting components.
  11984. This makes it possible to build more robust edge masks.
  11985. This filter accepts the following options:
  11986. @table @option
  11987. @item planes
  11988. Set which planes will be processed as bitmap, unprocessed planes will be
  11989. copied from first stream.
  11990. By default value 0xf, all planes will be processed.
  11991. @item threshold
  11992. Set threshold which is used in filtering. If pixel component value is higher than
  11993. this value filter algorithm for connecting components is activated.
  11994. By default value is 0.
  11995. @end table
  11996. The @code{hysteresis} filter also supports the @ref{framesync} options.
  11997. @section iccdetect
  11998. Detect the colorspace from an embedded ICC profile (if present), and update
  11999. the frame's tags accordingly.
  12000. This filter accepts the following options:
  12001. @table @option
  12002. @item force
  12003. If true, the frame's existing colorspace tags will always be overridden by
  12004. values detected from an ICC profile. Otherwise, they will only be assigned if
  12005. they contain @code{unknown}. Enabled by default.
  12006. @end table
  12007. @section iccgen
  12008. Generate ICC profiles and attach them to frames.
  12009. This filter accepts the following options:
  12010. @table @option
  12011. @item color_primaries
  12012. @item color_trc
  12013. Configure the colorspace that the ICC profile will be generated for. The
  12014. default value of @code{auto} infers the value from the input frame's metadata,
  12015. defaulting to BT.709/sRGB as appropriate.
  12016. See the @ref{setparams} filter for a list of possible values, but note that
  12017. @code{unknown} are not valid values for this filter.
  12018. @item force
  12019. If true, an ICC profile will be generated even if it would overwrite an
  12020. already existing ICC profile. Disabled by default.
  12021. @end table
  12022. @section identity
  12023. Obtain the identity score between two input videos.
  12024. This filter takes two input videos.
  12025. Both input videos must have the same resolution and pixel format for
  12026. this filter to work correctly. Also it assumes that both inputs
  12027. have the same number of frames, which are compared one by one.
  12028. The obtained per component, average, min and max identity score is printed through
  12029. the logging system.
  12030. The filter stores the calculated identity scores of each frame in frame metadata.
  12031. This filter also supports the @ref{framesync} options.
  12032. In the below example the input file @file{main.mpg} being processed is compared
  12033. with the reference file @file{ref.mpg}.
  12034. @example
  12035. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  12036. @end example
  12037. @section idet
  12038. Detect video interlacing type.
  12039. This filter tries to detect if the input frames are interlaced, progressive,
  12040. top or bottom field first. It will also try to detect fields that are
  12041. repeated between adjacent frames (a sign of telecine).
  12042. Single frame detection considers only immediately adjacent frames when classifying each frame.
  12043. Multiple frame detection incorporates the classification history of previous frames.
  12044. The filter will log these metadata values:
  12045. @table @option
  12046. @item single.current_frame
  12047. Detected type of current frame using single-frame detection. One of:
  12048. ``tff'' (top field first), ``bff'' (bottom field first),
  12049. ``progressive'', or ``undetermined''
  12050. @item single.tff
  12051. Cumulative number of frames detected as top field first using single-frame detection.
  12052. @item multiple.tff
  12053. Cumulative number of frames detected as top field first using multiple-frame detection.
  12054. @item single.bff
  12055. Cumulative number of frames detected as bottom field first using single-frame detection.
  12056. @item multiple.current_frame
  12057. Detected type of current frame using multiple-frame detection. One of:
  12058. ``tff'' (top field first), ``bff'' (bottom field first),
  12059. ``progressive'', or ``undetermined''
  12060. @item multiple.bff
  12061. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  12062. @item single.progressive
  12063. Cumulative number of frames detected as progressive using single-frame detection.
  12064. @item multiple.progressive
  12065. Cumulative number of frames detected as progressive using multiple-frame detection.
  12066. @item single.undetermined
  12067. Cumulative number of frames that could not be classified using single-frame detection.
  12068. @item multiple.undetermined
  12069. Cumulative number of frames that could not be classified using multiple-frame detection.
  12070. @item repeated.current_frame
  12071. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  12072. @item repeated.neither
  12073. Cumulative number of frames with no repeated field.
  12074. @item repeated.top
  12075. Cumulative number of frames with the top field repeated from the previous frame's top field.
  12076. @item repeated.bottom
  12077. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  12078. @end table
  12079. The filter accepts the following options:
  12080. @table @option
  12081. @item intl_thres
  12082. Set interlacing threshold.
  12083. @item prog_thres
  12084. Set progressive threshold.
  12085. @item rep_thres
  12086. Threshold for repeated field detection.
  12087. @item half_life
  12088. Number of frames after which a given frame's contribution to the
  12089. statistics is halved (i.e., it contributes only 0.5 to its
  12090. classification). The default of 0 means that all frames seen are given
  12091. full weight of 1.0 forever.
  12092. @item analyze_interlaced_flag
  12093. When this is not 0 then idet will use the specified number of frames to determine
  12094. if the interlaced flag is accurate, it will not count undetermined frames.
  12095. If the flag is found to be accurate it will be used without any further
  12096. computations, if it is found to be inaccurate it will be cleared without any
  12097. further computations. This allows inserting the idet filter as a low computational
  12098. method to clean up the interlaced flag
  12099. @end table
  12100. @section il
  12101. Deinterleave or interleave fields.
  12102. This filter allows one to process interlaced images fields without
  12103. deinterlacing them. Deinterleaving splits the input frame into 2
  12104. fields (so called half pictures). Odd lines are moved to the top
  12105. half of the output image, even lines to the bottom half.
  12106. You can process (filter) them independently and then re-interleave them.
  12107. The filter accepts the following options:
  12108. @table @option
  12109. @item luma_mode, l
  12110. @item chroma_mode, c
  12111. @item alpha_mode, a
  12112. Available values for @var{luma_mode}, @var{chroma_mode} and
  12113. @var{alpha_mode} are:
  12114. @table @samp
  12115. @item none
  12116. Do nothing.
  12117. @item deinterleave, d
  12118. Deinterleave fields, placing one above the other.
  12119. @item interleave, i
  12120. Interleave fields. Reverse the effect of deinterleaving.
  12121. @end table
  12122. Default value is @code{none}.
  12123. @item luma_swap, ls
  12124. @item chroma_swap, cs
  12125. @item alpha_swap, as
  12126. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  12127. @end table
  12128. @subsection Commands
  12129. This filter supports the all above options as @ref{commands}.
  12130. @section inflate
  12131. Apply inflate effect to the video.
  12132. This filter replaces the pixel by the local(3x3) average by taking into account
  12133. only values higher than the pixel.
  12134. It accepts the following options:
  12135. @table @option
  12136. @item threshold0
  12137. @item threshold1
  12138. @item threshold2
  12139. @item threshold3
  12140. Limit the maximum change for each plane, default is 65535.
  12141. If 0, plane will remain unchanged.
  12142. @end table
  12143. @subsection Commands
  12144. This filter supports the all above options as @ref{commands}.
  12145. @section interlace
  12146. Simple interlacing filter from progressive contents. This interleaves upper (or
  12147. lower) lines from odd frames with lower (or upper) lines from even frames,
  12148. halving the frame rate and preserving image height.
  12149. @example
  12150. Original Original New Frame
  12151. Frame 'j' Frame 'j+1' (tff)
  12152. ========== =========== ==================
  12153. Line 0 --------------------> Frame 'j' Line 0
  12154. Line 1 Line 1 ----> Frame 'j+1' Line 1
  12155. Line 2 ---------------------> Frame 'j' Line 2
  12156. Line 3 Line 3 ----> Frame 'j+1' Line 3
  12157. ... ... ...
  12158. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  12159. @end example
  12160. It accepts the following optional parameters:
  12161. @table @option
  12162. @item scan
  12163. This determines whether the interlaced frame is taken from the even
  12164. (tff - default) or odd (bff) lines of the progressive frame.
  12165. @item lowpass
  12166. Vertical lowpass filter to avoid twitter interlacing and
  12167. reduce moire patterns.
  12168. @table @samp
  12169. @item 0, off
  12170. Disable vertical lowpass filter
  12171. @item 1, linear
  12172. Enable linear filter (default)
  12173. @item 2, complex
  12174. Enable complex filter. This will slightly less reduce twitter and moire
  12175. but better retain detail and subjective sharpness impression.
  12176. @end table
  12177. @end table
  12178. @section kerndeint
  12179. Deinterlace input video by applying Donald Graft's adaptive kernel
  12180. deinterling. Work on interlaced parts of a video to produce
  12181. progressive frames.
  12182. The description of the accepted parameters follows.
  12183. @table @option
  12184. @item thresh
  12185. Set the threshold which affects the filter's tolerance when
  12186. determining if a pixel line must be processed. It must be an integer
  12187. in the range [0,255] and defaults to 10. A value of 0 will result in
  12188. applying the process on every pixels.
  12189. @item map
  12190. Paint pixels exceeding the threshold value to white if set to 1.
  12191. Default is 0.
  12192. @item order
  12193. Set the fields order. Swap fields if set to 1, leave fields alone if
  12194. 0. Default is 0.
  12195. @item sharp
  12196. Enable additional sharpening if set to 1. Default is 0.
  12197. @item twoway
  12198. Enable twoway sharpening if set to 1. Default is 0.
  12199. @end table
  12200. @subsection Examples
  12201. @itemize
  12202. @item
  12203. Apply default values:
  12204. @example
  12205. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  12206. @end example
  12207. @item
  12208. Enable additional sharpening:
  12209. @example
  12210. kerndeint=sharp=1
  12211. @end example
  12212. @item
  12213. Paint processed pixels in white:
  12214. @example
  12215. kerndeint=map=1
  12216. @end example
  12217. @end itemize
  12218. @section kirsch
  12219. Apply kirsch operator to input video stream.
  12220. The filter accepts the following option:
  12221. @table @option
  12222. @item planes
  12223. Set which planes will be processed, unprocessed planes will be copied.
  12224. By default value 0xf, all planes will be processed.
  12225. @item scale
  12226. Set value which will be multiplied with filtered result.
  12227. @item delta
  12228. Set value which will be added to filtered result.
  12229. @end table
  12230. @subsection Commands
  12231. This filter supports the all above options as @ref{commands}.
  12232. @section lagfun
  12233. Slowly update darker pixels.
  12234. This filter makes short flashes of light appear longer.
  12235. This filter accepts the following options:
  12236. @table @option
  12237. @item decay
  12238. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  12239. @item planes
  12240. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  12241. @end table
  12242. @subsection Commands
  12243. This filter supports the all above options as @ref{commands}.
  12244. @section lenscorrection
  12245. Correct radial lens distortion
  12246. This filter can be used to correct for radial distortion as can result from the use
  12247. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  12248. one can use tools available for example as part of opencv or simply trial-and-error.
  12249. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  12250. and extract the k1 and k2 coefficients from the resulting matrix.
  12251. Note that effectively the same filter is available in the open-source tools Krita and
  12252. Digikam from the KDE project.
  12253. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  12254. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  12255. brightness distribution, so you may want to use both filters together in certain
  12256. cases, though you will have to take care of ordering, i.e. whether vignetting should
  12257. be applied before or after lens correction.
  12258. @subsection Options
  12259. The filter accepts the following options:
  12260. @table @option
  12261. @item cx
  12262. Relative x-coordinate of the focal point of the image, and thereby the center of the
  12263. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12264. width. Default is 0.5.
  12265. @item cy
  12266. Relative y-coordinate of the focal point of the image, and thereby the center of the
  12267. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12268. height. Default is 0.5.
  12269. @item k1
  12270. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  12271. no correction. Default is 0.
  12272. @item k2
  12273. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  12274. 0 means no correction. Default is 0.
  12275. @item i
  12276. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  12277. Default is @code{nearest}.
  12278. @item fc
  12279. Specify the color of the unmapped pixels. For the syntax of this option,
  12280. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12281. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  12282. @end table
  12283. The formula that generates the correction is:
  12284. @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)
  12285. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  12286. distances from the focal point in the source and target images, respectively.
  12287. @subsection Commands
  12288. This filter supports the all above options as @ref{commands}.
  12289. @section lensfun
  12290. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  12291. The @code{lensfun} filter requires the camera make, camera model, and lens model
  12292. to apply the lens correction. The filter will load the lensfun database and
  12293. query it to find the corresponding camera and lens entries in the database. As
  12294. long as these entries can be found with the given options, the filter can
  12295. perform corrections on frames. Note that incomplete strings will result in the
  12296. filter choosing the best match with the given options, and the filter will
  12297. output the chosen camera and lens models (logged with level "info"). You must
  12298. provide the make, camera model, and lens model as they are required.
  12299. To obtain a list of available makes and models, leave out one or both of @code{make} and
  12300. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  12301. The first column is the make and the second column is the model.
  12302. To obtain a list of available lenses, set any values for make and model and leave out the
  12303. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  12304. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  12305. The filter accepts the following options:
  12306. @table @option
  12307. @item make
  12308. The make of the camera (for example, "Canon"). This option is required.
  12309. @item model
  12310. The model of the camera (for example, "Canon EOS 100D"). This option is
  12311. required.
  12312. @item lens_model
  12313. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  12314. option is required.
  12315. @item db_path
  12316. The full path to the lens database folder. If not set, the filter will attempt to
  12317. load the database from the install path when the library was built. Default is unset.
  12318. @item mode
  12319. The type of correction to apply. The following values are valid options:
  12320. @table @samp
  12321. @item vignetting
  12322. Enables fixing lens vignetting.
  12323. @item geometry
  12324. Enables fixing lens geometry. This is the default.
  12325. @item subpixel
  12326. Enables fixing chromatic aberrations.
  12327. @item vig_geo
  12328. Enables fixing lens vignetting and lens geometry.
  12329. @item vig_subpixel
  12330. Enables fixing lens vignetting and chromatic aberrations.
  12331. @item distortion
  12332. Enables fixing both lens geometry and chromatic aberrations.
  12333. @item all
  12334. Enables all possible corrections.
  12335. @end table
  12336. @item focal_length
  12337. The focal length of the image/video (zoom; expected constant for video). For
  12338. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  12339. range should be chosen when using that lens. Default 18.
  12340. @item aperture
  12341. The aperture of the image/video (expected constant for video). Note that
  12342. aperture is only used for vignetting correction. Default 3.5.
  12343. @item focus_distance
  12344. The focus distance of the image/video (expected constant for video). Note that
  12345. focus distance is only used for vignetting and only slightly affects the
  12346. vignetting correction process. If unknown, leave it at the default value (which
  12347. is 1000).
  12348. @item scale
  12349. The scale factor which is applied after transformation. After correction the
  12350. video is no longer necessarily rectangular. This parameter controls how much of
  12351. the resulting image is visible. The value 0 means that a value will be chosen
  12352. automatically such that there is little or no unmapped area in the output
  12353. image. 1.0 means that no additional scaling is done. Lower values may result
  12354. in more of the corrected image being visible, while higher values may avoid
  12355. unmapped areas in the output.
  12356. @item target_geometry
  12357. The target geometry of the output image/video. The following values are valid
  12358. options:
  12359. @table @samp
  12360. @item rectilinear (default)
  12361. @item fisheye
  12362. @item panoramic
  12363. @item equirectangular
  12364. @item fisheye_orthographic
  12365. @item fisheye_stereographic
  12366. @item fisheye_equisolid
  12367. @item fisheye_thoby
  12368. @end table
  12369. @item reverse
  12370. Apply the reverse of image correction (instead of correcting distortion, apply
  12371. it).
  12372. @item interpolation
  12373. The type of interpolation used when correcting distortion. The following values
  12374. are valid options:
  12375. @table @samp
  12376. @item nearest
  12377. @item linear (default)
  12378. @item lanczos
  12379. @end table
  12380. @end table
  12381. @subsection Examples
  12382. @itemize
  12383. @item
  12384. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  12385. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  12386. aperture of "8.0".
  12387. @example
  12388. 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
  12389. @end example
  12390. @item
  12391. Apply the same as before, but only for the first 5 seconds of video.
  12392. @example
  12393. 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
  12394. @end example
  12395. @end itemize
  12396. @section libplacebo
  12397. Flexible GPU-accelerated processing filter based on libplacebo
  12398. (@url{https://code.videolan.org/videolan/libplacebo}).
  12399. @subsection Options
  12400. The options for this filter are divided into the following sections:
  12401. @subsubsection Output mode
  12402. These options control the overall output mode. By default, libplacebo will try
  12403. to preserve the source colorimetry and size as best as it can, but it will
  12404. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  12405. in source frames.
  12406. @table @option
  12407. @item inputs
  12408. Set the number of inputs. This can be used, alongside the @code{idx} variable,
  12409. to allow placing/blending multiple inputs inside the output frame. This
  12410. effectively enables functionality similar to @ref{hstack}, @ref{overlay}, etc.
  12411. @item w
  12412. @item h
  12413. Set the output video dimension expression. Default values are @code{iw} and
  12414. @code{ih}.
  12415. Allows for the same expressions as the @ref{scale} filter.
  12416. @item crop_x
  12417. @item crop_y
  12418. Set the input crop x/y expressions, default values are @code{(iw-cw)/2} and
  12419. @code{(ih-ch)/2}.
  12420. @item crop_w
  12421. @item crop_h
  12422. Set the input crop width/height expressions, default values are @code{iw} and
  12423. @code{ih}.
  12424. @item pos_x
  12425. @item pos_y
  12426. Set the output placement x/y expressions, default values are @code{(ow-pw)/2}
  12427. and @code{(oh-ph)/2}.
  12428. @item pos_w
  12429. @item pos_h
  12430. Set the output placement width/height expressions, default values are @code{ow}
  12431. and @code{oh}.
  12432. @item fps
  12433. Set the output frame rate. This can be rational, e.g. @code{60000/1001}. If
  12434. set to the special string @code{none} (the default), input timestamps will
  12435. instead be passed through to the output unmodified. Otherwise, the input video
  12436. frames will be interpolated as necessary to rescale the video to the specified
  12437. target framerate, in a manner as determined by the @option{frame_mixer} option.
  12438. @item format
  12439. Set the output format override. If unset (the default), frames will be output
  12440. in the same format as the respective input frames. Otherwise, format conversion
  12441. will be performed.
  12442. @item force_original_aspect_ratio
  12443. @item force_divisible_by
  12444. Work the same as the identical @ref{scale} filter options.
  12445. @item normalize_sar
  12446. If enabled, output frames will always have a pixel aspect ratio of 1:1. This
  12447. will introduce additional padding/cropping as necessary. If disabled (the
  12448. default), any aspect ratio mismatches, including those from e.g. anamorphic
  12449. video sources, are forwarded to the output pixel aspect ratio.
  12450. @item pad_crop_ratio
  12451. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  12452. cropping when the input aspect ratio does not match the output aspect ratio and
  12453. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  12454. content with black borders, while a value of @code{1.0} always crops off parts
  12455. of the content. Intermediate values are possible, leading to a mix of the two
  12456. approaches.
  12457. @item fillcolor
  12458. Set the color used to fill the output area not covered by the output image, for
  12459. example as a result of @option{normalize_sar}. For the general syntax of this
  12460. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12461. manual,ffmpeg-utils}. Defaults to @code{black}.
  12462. @item corner_rounding
  12463. Render frames with rounded corners. The value, given as a float ranging from
  12464. @code{0.0} to @code{1.0}, indicates the relative degree of rounding, from fully
  12465. square to fully circular. In other words, it gives the radius divided by half
  12466. the smaller side length. Defaults to @code{0.0}.
  12467. @item extra_opts
  12468. Pass extra libplacebo internal configuration options. These can be specified
  12469. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  12470. shows how to configure a custom filter kernel ("EWA LanczosSharp") and use it
  12471. to double the input image resolution:
  12472. @example
  12473. -vf "libplacebo=w=iw*2:h=ih*2:extra_opts='upscaler=custom\:upscaler_preset=ewa_lanczos\:upscaler_blur=0.9812505644269356'"
  12474. @end example
  12475. @item colorspace
  12476. @item color_primaries
  12477. @item color_trc
  12478. @item range
  12479. Configure the colorspace that output frames will be delivered in. The default
  12480. value of @code{auto} outputs frames in the same format as the input frames,
  12481. leading to no change. For any other value, conversion will be performed.
  12482. See the @ref{setparams} filter for a list of possible values.
  12483. @item apply_filmgrain
  12484. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  12485. it from the output. Enabled by default.
  12486. @item apply_dolbyvision
  12487. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  12488. the output. Enabled by default. Note that Dolby Vision will always output
  12489. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  12490. picked as the values of @code{auto} for the respective frame output options.
  12491. @end table
  12492. In addition to the expression constants documented for the @ref{scale} filter,
  12493. the @option{crop_w}, @option{crop_h}, @option{crop_x}, @option{crop_y},
  12494. @option{pos_w}, @option{pos_h}, @option{pos_x} and @option{pos_y} options can
  12495. also contain the following constants:
  12496. @table @option
  12497. @item in_idx, idx
  12498. The (0-based) numeric index of the currently active input stream.
  12499. @item crop_w, cw
  12500. @item crop_h, ch
  12501. The computed values of @option{crop_w} and @option{crop_h}.
  12502. @item pos_w, pw
  12503. @item pos_h, ph
  12504. The computed values of @option{pos_w} and @option{pos_h}.
  12505. @item in_t, t
  12506. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12507. @item out_t, ot
  12508. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12509. @item n
  12510. The input frame number, starting with 0.
  12511. @end table
  12512. @subsubsection Scaling
  12513. The options in this section control how libplacebo performs upscaling and (if
  12514. necessary) downscaling. Note that libplacebo will always internally operate on
  12515. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  12516. necessarily be upsampled and downsampled as part of the rendering process. That
  12517. means scaling might be in effect even if the source and destination resolution
  12518. are the same.
  12519. @table @option
  12520. @item upscaler
  12521. @item downscaler
  12522. Configure the filter kernel used for upscaling and downscaling. The respective
  12523. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  12524. values, pass @code{help} to these options. The most important values are:
  12525. @table @samp
  12526. @item none
  12527. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  12528. fast but poor quality, especially when downscaling.
  12529. @item bilinear
  12530. Bilinear interpolation. Can generally be done for free on GPUs, except when
  12531. doing so would lead to aliasing. Fast and low quality.
  12532. @item nearest
  12533. Nearest-neighbour interpolation. Sharp but highly aliasing.
  12534. @item oversample
  12535. Algorithm that looks visually similar to nearest-neighbour interpolation but
  12536. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  12537. minimal distortion of the artistic appearance.
  12538. @item lanczos
  12539. Standard sinc-sinc interpolation kernel.
  12540. @item spline36
  12541. Cubic spline approximation of lanczos. No difference in performance, but has
  12542. very slightly less ringing.
  12543. @item ewa_lanczos
  12544. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  12545. This is also popularly referred to as just "Jinc scaling". Slow but very high
  12546. quality.
  12547. @item gaussian
  12548. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  12549. very blurry.
  12550. @item mitchell
  12551. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  12552. little ringing.
  12553. @end table
  12554. @item frame_mixer
  12555. Controls the kernel used for mixing frames temporally. The default value is
  12556. @code{none}, which disables frame mixing. For a full list of possible values,
  12557. pass @code{help} to this option. The most important values are:
  12558. @table @samp
  12559. @item none
  12560. Disables frame mixing, giving a result equivalent to "nearest neighbour"
  12561. semantics.
  12562. @item oversample
  12563. Oversamples the input video to create a "Smooth Motion"-type effect: if an
  12564. output frame would exactly fall on the transition between two video frames, it
  12565. is blended according to the relative overlap. This is the recommended option
  12566. whenever preserving the original subjective appearance is desired.
  12567. @item mitchell_clamp
  12568. Larger filter kernel that smoothly interpolates multiple frames in a manner
  12569. designed to eliminate ringing and other artefacts as much as possible. This is
  12570. the recommended option wherever maximum visual smoothness is desired.
  12571. @item linear
  12572. Linear blend/fade between frames. Especially useful for constructing e.g.
  12573. slideshows.
  12574. @end table
  12575. @item lut_entries
  12576. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  12577. default of @code{0} will pick libplacebo's internal default, typically
  12578. @code{64}.
  12579. @item antiringing
  12580. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  12581. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  12582. aliasing if set too high. Disabled by default.
  12583. @item sigmoid
  12584. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  12585. Enabled by default.
  12586. @end table
  12587. @subsubsection Debanding
  12588. Libplacebo comes with a built-in debanding filter that is good at counteracting
  12589. many common sources of banding and blocking. Turning this on is highly
  12590. recommended whenever quality is desired.
  12591. @table @option
  12592. @item deband
  12593. Enable (fast) debanding algorithm. Disabled by default.
  12594. @item deband_iterations
  12595. Number of deband iterations of the debanding algorithm. Each iteration is
  12596. performed with progressively increased radius (and diminished threshold).
  12597. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  12598. @item deband_threshold
  12599. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  12600. Defaults to @code{4.0}.
  12601. @item deband_radius
  12602. Debanding filter radius. A higher radius is better for slow gradients, while
  12603. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  12604. @item deband_grain
  12605. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  12606. @code{6.0}.
  12607. @end table
  12608. @subsubsection Color adjustment
  12609. A collection of subjective color controls. Not very rigorous, so the exact
  12610. effect will vary somewhat depending on the input primaries and colorspace.
  12611. @table @option
  12612. @item brightness
  12613. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  12614. @item contrast
  12615. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12616. @item saturation
  12617. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12618. @item hue
  12619. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  12620. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  12621. coefficients for RGB inputs.
  12622. @item gamma
  12623. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12624. @item cones
  12625. Cone model to use for color blindness simulation. Accepts any combination of
  12626. @code{l}, @code{m} and @code{s}. Here are some examples:
  12627. @table @samp
  12628. @item m
  12629. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  12630. @item l
  12631. Protanomaly / protanopia (affecting 1%-2% of the population)
  12632. @item l+m
  12633. Monochromacy (very rare)
  12634. @item l+m+s
  12635. Achromatopsy (complete loss of daytime vision, extremely rare)
  12636. @end table
  12637. @item cone-strength
  12638. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  12639. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  12640. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  12641. above @code{1.0} result in exaggerating the differences between cones, which
  12642. may help compensate for reduced color vision.
  12643. @end table
  12644. @subsubsection Peak detection
  12645. To help deal with sources that only have static HDR10 metadata (or no tagging
  12646. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  12647. analyze source frames and adapt the tone mapping function in realtime. If this
  12648. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  12649. recommended to turn this feature off.
  12650. @table @option
  12651. @item peak_detect
  12652. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  12653. dynamic detection from the input. Note that the detected values do not get
  12654. written back to the output frames, they merely guide the internal tone mapping
  12655. process. Enabled by default.
  12656. @item smoothing_period
  12657. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  12658. values result in peak detection becoming less responsive to changes in the
  12659. input. Defaults to @code{100.0}.
  12660. @item minimum_peak
  12661. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  12662. and @code{100.0}. Defaults to @code{1.0}.
  12663. @item scene_threshold_low
  12664. @item scene_threshold_high
  12665. Lower and upper thresholds for scene change detection. Expressed in a
  12666. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  12667. and @code{10.0}, respectively. Setting either to a negative value disables
  12668. this functionality.
  12669. @item percentile
  12670. Which percentile of the frame brightness histogram to use as the source peak
  12671. for tone-mapping. Defaults to @code{99.995}, a fairly conservative value.
  12672. Setting this to @code{100.0} disables frame histogram measurement and instead
  12673. uses the true peak brightness for tone-mapping.
  12674. @end table
  12675. @subsubsection Tone mapping
  12676. The options in this section control how libplacebo performs tone-mapping and
  12677. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  12678. In general, libplacebo relies on accurate source tagging and mastering display
  12679. gamut information to produce the best results.
  12680. @table @option
  12681. @item gamut_mode
  12682. How to handle out-of-gamut colors that can occur as a result of colorimetric
  12683. gamut mapping.
  12684. @table @samp
  12685. @item clip
  12686. Do nothing, simply clip out-of-range colors to the RGB volume. Low quality but
  12687. extremely fast.
  12688. @item perceptual
  12689. Perceptually soft-clip colors to the gamut volume. This is the default.
  12690. @item relative
  12691. Relative colorimetric hard-clip. Similar to @code{perceptual} but without
  12692. the soft knee.
  12693. @item saturation
  12694. Saturation mapping, maps primaries directly to primaries in RGB space.
  12695. Not recommended except for artificial computer graphics for which a bright,
  12696. saturated display is desired.
  12697. @item absolute
  12698. Absolute colorimetric hard-clip. Performs no adjustment of the white point.
  12699. @item desaturate
  12700. Hard-desaturates out-of-gamut colors towards white, while preserving the
  12701. luminance. Has a tendency to distort the visual appearance of bright objects.
  12702. @item darken
  12703. Linearly reduces content brightness to preserves saturated details, followed by
  12704. clipping the remaining out-of-gamut colors.
  12705. @item warn
  12706. Highlight out-of-gamut pixels (by inverting/marking them).
  12707. @item linear
  12708. Linearly reduces chromaticity of the entire image to make it fit within the
  12709. target color volume. Be careful when using this on BT.2020 sources without
  12710. proper mastering metadata, as doing so will lead to excessive desaturation.
  12711. @end table
  12712. @item tonemapping
  12713. Tone-mapping algorithm to use. Available values are:
  12714. @table @samp
  12715. @item auto
  12716. Automatic selection based on internal heuristics. This is the default.
  12717. @item clip
  12718. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  12719. accuracy for in-range colors but completely destroys out-of-range information.
  12720. Does not perform any black point adaptation. Not configurable.
  12721. @item st2094-40
  12722. EETF from SMPTE ST 2094-40 Annex B, which applies the Bezier curves from HDR10+
  12723. dynamic metadata based on Bezier curves to perform tone-mapping. The OOTF used
  12724. is adjusted based on the ratio between the targeted and actual display peak
  12725. luminances.
  12726. @item st2094-10
  12727. EETF from SMPTE ST 2094-10 Annex B.2, which takes into account the input signal
  12728. average luminance in addition to the maximum/minimum. The configurable contrast
  12729. parameter influences the slope of the linear output segment, defaulting to
  12730. @code{1.0} for no increase/decrease in contrast. Note that this does not
  12731. currently include the subjective gain/offset/gamma controls defined in Annex
  12732. B.3.
  12733. @item bt.2390
  12734. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  12735. segment. The knee point offset is configurable. Note that this parameter
  12736. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  12737. spec.
  12738. @item bt.2446a
  12739. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  12740. sources. Can be used for both forward and inverse tone mapping. Not
  12741. configurable.
  12742. @item spline
  12743. Simple spline consisting of two polynomials, joined by a single pivot point.
  12744. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  12745. Can be used for both forward and inverse tone mapping.
  12746. @item reinhard
  12747. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  12748. local contrast coefficient at the display peak. Essentially, a parameter of
  12749. @code{0.5} implies that the reference white will be about half as bright as
  12750. when clipping. Defaults to @code{0.5}, which results in the simplest
  12751. formulation of this function.
  12752. @item mobius
  12753. Generalization of the reinhard tone mapping algorithm to support an additional
  12754. linear slope near black. The tone mapping parameter indicates the trade-off
  12755. between the linear section and the non-linear section. Essentially, for a given
  12756. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  12757. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  12758. this curve behave like @code{clip}, while values near @code{0.0} make this
  12759. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  12760. provides a good balance between colorimetric accuracy and preserving
  12761. out-of-gamut details.
  12762. @item hable
  12763. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  12764. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  12765. Popularized by its use in video games with HDR rendering. Preserves both dark
  12766. and bright details very well, but comes with the drawback of changing the
  12767. average brightness quite significantly. This is sort of similar to
  12768. @code{reinhard} with parameter @code{0.24}.
  12769. @item gamma
  12770. Fits a gamma (power) function to transfer between the source and target color
  12771. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  12772. linear sections. This preserves details at all scales fairly accurately, but
  12773. can result in an image with a muted or dull appearance. The parameter is used
  12774. as the cutoff point, defaulting to @code{0.5}.
  12775. @item linear
  12776. Linearly stretches the input range to the output range, in PQ space. This will
  12777. preserve all details accurately, but results in a significantly different
  12778. average brightness. Can be used for inverse tone-mapping in addition to regular
  12779. tone-mapping. The parameter can be used as an additional linear gain
  12780. coefficient (defaulting to @code{1.0}).
  12781. @end table
  12782. @item tonemapping_param
  12783. For tunable tone mapping functions, this parameter can be used to fine-tune the
  12784. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  12785. value of @code{0.0} is replaced by the curve's preferred default setting.
  12786. @item inverse_tonemapping
  12787. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  12788. output color volumes. Disabled by default.
  12789. @item tonemapping_lut_size
  12790. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  12791. @code{256}. Note that this figure is squared when combined with
  12792. @code{peak_detect}.
  12793. @item contrast_recovery
  12794. Contrast recovery strength. If set to a value above @code{0.0}, the source
  12795. image will be divided into high-frequency and low-frequency components, and a
  12796. portion of the high-frequency image is added back onto the tone-mapped output.
  12797. May cause excessive ringing artifacts for some HDR sources, but can improve the
  12798. subjective sharpness and detail left over in the image after tone-mapping.
  12799. Defaults to @code{0.30}.
  12800. @item contrast_smoothness
  12801. Contrast recovery lowpass kernel size. Defaults to @code{3.5}. Increasing or
  12802. decreasing this will affect the visual appearance substantially. Has no effect
  12803. when @code{contrast_recovery} is disabled.
  12804. @end table
  12805. @subsubsection Dithering
  12806. By default, libplacebo will dither whenever necessary, which includes rendering
  12807. to any integer format below 16-bit precision. It's recommended to always leave
  12808. this on, since not doing so may result in visible banding in the output, even
  12809. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12810. use @code{ordered_fixed} instead of disabling dithering.
  12811. @table @option
  12812. @item dithering
  12813. Dithering method to use. Accepts the following values:
  12814. @table @samp
  12815. @item none
  12816. Disables dithering completely. May result in visible banding.
  12817. @item blue
  12818. Dither with pseudo-blue noise. This is the default.
  12819. @item ordered
  12820. Tunable ordered dither pattern.
  12821. @item ordered_fixed
  12822. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12823. @item white
  12824. Dither with white noise. Texture-less.
  12825. @end table
  12826. @item dither_lut_size
  12827. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12828. @code{6}, corresponding to a LUT size of @code{64x64}.
  12829. @item dither_temporal
  12830. Enables temporal dithering. Disabled by default.
  12831. @end table
  12832. @subsubsection Custom shaders
  12833. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12834. syntax. A collection of such shaders can be found here:
  12835. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12836. A full description of the mpv shader format is beyond the scope of this
  12837. section, but a summary can be found here:
  12838. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12839. @table @option
  12840. @item custom_shader_path
  12841. Specifies a path to a custom shader file to load at runtime.
  12842. @item custom_shader_bin
  12843. Specifies a complete custom shader as a raw string.
  12844. @end table
  12845. @subsubsection Debugging / performance
  12846. All of the options in this section default off. They may be of assistance when
  12847. attempting to squeeze the maximum performance at the cost of quality.
  12848. @table @option
  12849. @item skip_aa
  12850. Disable anti-aliasing when downscaling.
  12851. @item polar_cutoff
  12852. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  12853. @code{0.0} and @code{1.0}.
  12854. @item disable_linear
  12855. Disable linear light scaling.
  12856. @item disable_builtin
  12857. Disable built-in GPU sampling (forces LUT).
  12858. @item disable_fbos
  12859. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12860. offering the maximum possible speed.
  12861. @end table
  12862. @subsection Commands
  12863. This filter supports almost all of the above options as @ref{commands}.
  12864. @subsection Examples
  12865. @itemize
  12866. @item
  12867. Tone-map input to standard gamut BT.709 output:
  12868. @example
  12869. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12870. @end example
  12871. @item
  12872. Rescale input to fit into standard 1080p, with high quality scaling:
  12873. @example
  12874. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12875. @end example
  12876. @item
  12877. Interpolate low FPS / VFR input to smoothed constant 60 fps output:
  12878. @example
  12879. libplacebo=fps=60:frame_mixer=mitchell_clamp
  12880. @end example
  12881. @item
  12882. Convert input to standard sRGB JPEG:
  12883. @example
  12884. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12885. @end example
  12886. @item
  12887. Use higher quality debanding settings:
  12888. @example
  12889. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  12890. @end example
  12891. @item
  12892. Run this filter on the CPU, on systems with Mesa installed (and with the most
  12893. expensive options disabled):
  12894. @example
  12895. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  12896. @end example
  12897. @item
  12898. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  12899. doing it with this filter. Note that this is only a gain if the frames are
  12900. either already on the GPU, or if you're using libplacebo for other purposes,
  12901. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  12902. @example
  12903. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  12904. @end example
  12905. @item
  12906. Interop with VAAPI hwdec to avoid round-tripping through RAM:
  12907. @example
  12908. ffmpeg -init_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi ... -vf libplacebo
  12909. @end example
  12910. @end itemize
  12911. @anchor{libvmaf}
  12912. @section libvmaf
  12913. Calculate the VMAF (Video Multi-Method Assessment Fusion) score for a
  12914. reference/distorted pair of input videos.
  12915. The first input is the distorted video, and the second input is the reference video.
  12916. The obtained VMAF score is printed through the logging system.
  12917. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12918. After installing the library it can be enabled using:
  12919. @code{./configure --enable-libvmaf}.
  12920. The filter has following options:
  12921. @table @option
  12922. @item model
  12923. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  12924. Default value: @code{"version=vmaf_v0.6.1"}
  12925. @item feature
  12926. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  12927. @item log_path
  12928. Set the file path to be used to store log files.
  12929. @item log_fmt
  12930. Set the format of the log file (xml, json, csv, or sub).
  12931. @item n_threads
  12932. Set number of threads to be used when initializing libvmaf.
  12933. Default value: @code{0}, no threads.
  12934. @item n_subsample
  12935. Set frame subsampling interval to be used.
  12936. @end table
  12937. This filter also supports the @ref{framesync} options.
  12938. @subsection Examples
  12939. @itemize
  12940. @item
  12941. In the examples below, a distorted video @file{distorted.mpg} is
  12942. compared with a reference file @file{reference.mpg}.
  12943. @item
  12944. Basic usage:
  12945. @example
  12946. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  12947. @end example
  12948. @item
  12949. Example with multiple models:
  12950. @example
  12951. 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 -
  12952. @end example
  12953. @item
  12954. Example with multiple additional features:
  12955. @example
  12956. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  12957. @end example
  12958. @item
  12959. Example with options and different containers:
  12960. @example
  12961. 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 -
  12962. @end example
  12963. @end itemize
  12964. @section libvmaf_cuda
  12965. This is the CUDA variant of the @ref{libvmaf} filter. It only accepts CUDA frames.
  12966. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12967. After installing the library it can be enabled using:
  12968. @code{./configure --enable-nonfree --enable-ffnvcodec --enable-libvmaf}.
  12969. @subsection Examples
  12970. @itemize
  12971. @item
  12972. Basic usage showing CUVID hardware decoding and CUDA scaling with @ref{scale_cuda}:
  12973. @example
  12974. ffmpeg \
  12975. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i dis.obu \
  12976. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i ref.obu \
  12977. -filter_complex "
  12978. [0:v]scale_cuda=format=yuv420p[ref]; \
  12979. [1:v]scale_cuda=format=yuv420p[dis]; \
  12980. [dis][ref]libvmaf_cuda=log_fmt=json:log_path=output.json
  12981. " \
  12982. -f null -
  12983. @end example
  12984. @end itemize
  12985. @section limitdiff
  12986. Apply limited difference filter using second and optionally third video stream.
  12987. The filter accepts the following options:
  12988. @table @option
  12989. @item threshold
  12990. Set the threshold to use when allowing certain differences between video streams.
  12991. Any absolute difference value lower or exact than this threshold will pick pixel components from
  12992. first video stream.
  12993. @item elasticity
  12994. Set the elasticity of soft thresholding when processing video streams.
  12995. This value multiplied with first one sets second threshold.
  12996. Any absolute difference value greater or exact than second threshold will pick pixel components
  12997. from second video stream. For values between those two threshold
  12998. linear interpolation between first and second video stream will be used.
  12999. @item reference
  13000. Enable the reference (third) video stream processing. By default is disabled.
  13001. If set, this video stream will be used for calculating absolute difference with first video
  13002. stream.
  13003. @item planes
  13004. Specify which planes will be processed. Defaults to all available.
  13005. @end table
  13006. @subsection Commands
  13007. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  13008. @section limiter
  13009. Limits the pixel components values to the specified range [min, max].
  13010. The filter accepts the following options:
  13011. @table @option
  13012. @item min
  13013. Lower bound. Defaults to the lowest allowed value for the input.
  13014. @item max
  13015. Upper bound. Defaults to the highest allowed value for the input.
  13016. @item planes
  13017. Specify which planes will be processed. Defaults to all available.
  13018. @end table
  13019. @subsection Commands
  13020. This filter supports the all above options as @ref{commands}.
  13021. @section loop
  13022. Loop video frames.
  13023. The filter accepts the following options:
  13024. @table @option
  13025. @item loop
  13026. Set the number of loops. Setting this value to -1 will result in infinite loops.
  13027. Default is 0.
  13028. @item size
  13029. Set maximal size in number of frames. Default is 0.
  13030. @item start
  13031. Set first frame of loop. Default is 0.
  13032. @item time
  13033. Set the time of loop start in seconds.
  13034. Only used if option named @var{start} is set to @code{-1}.
  13035. @end table
  13036. @subsection Examples
  13037. @itemize
  13038. @item
  13039. Loop single first frame infinitely:
  13040. @example
  13041. loop=loop=-1:size=1:start=0
  13042. @end example
  13043. @item
  13044. Loop single first frame 10 times:
  13045. @example
  13046. loop=loop=10:size=1:start=0
  13047. @end example
  13048. @item
  13049. Loop 10 first frames 5 times:
  13050. @example
  13051. loop=loop=5:size=10:start=0
  13052. @end example
  13053. @end itemize
  13054. @section lut1d
  13055. Apply a 1D LUT to an input video.
  13056. The filter accepts the following options:
  13057. @table @option
  13058. @item file
  13059. Set the 1D LUT file name.
  13060. Currently supported formats:
  13061. @table @samp
  13062. @item cube
  13063. Iridas
  13064. @item csp
  13065. cineSpace
  13066. @end table
  13067. @item interp
  13068. Select interpolation mode.
  13069. Available values are:
  13070. @table @samp
  13071. @item nearest
  13072. Use values from the nearest defined point.
  13073. @item linear
  13074. Interpolate values using the linear interpolation.
  13075. @item cosine
  13076. Interpolate values using the cosine interpolation.
  13077. @item cubic
  13078. Interpolate values using the cubic interpolation.
  13079. @item spline
  13080. Interpolate values using the spline interpolation.
  13081. @end table
  13082. @end table
  13083. @subsection Commands
  13084. This filter supports the all above options as @ref{commands}.
  13085. @anchor{lut3d}
  13086. @section lut3d
  13087. Apply a 3D LUT to an input video.
  13088. The filter accepts the following options:
  13089. @table @option
  13090. @item file
  13091. Set the 3D LUT file name.
  13092. Currently supported formats:
  13093. @table @samp
  13094. @item 3dl
  13095. AfterEffects
  13096. @item cube
  13097. Iridas
  13098. @item dat
  13099. DaVinci
  13100. @item m3d
  13101. Pandora
  13102. @item csp
  13103. cineSpace
  13104. @end table
  13105. @item interp
  13106. Select interpolation mode.
  13107. Available values are:
  13108. @table @samp
  13109. @item nearest
  13110. Use values from the nearest defined point.
  13111. @item trilinear
  13112. Interpolate values using the 8 points defining a cube.
  13113. @item tetrahedral
  13114. Interpolate values using a tetrahedron.
  13115. @item pyramid
  13116. Interpolate values using a pyramid.
  13117. @item prism
  13118. Interpolate values using a prism.
  13119. @end table
  13120. @end table
  13121. @subsection Commands
  13122. This filter supports the @code{interp} option as @ref{commands}.
  13123. @section lumakey
  13124. Turn certain luma values into transparency.
  13125. The filter accepts the following options:
  13126. @table @option
  13127. @item threshold
  13128. Set the luma which will be used as base for transparency.
  13129. Default value is @code{0}.
  13130. @item tolerance
  13131. Set the range of luma values to be keyed out.
  13132. Default value is @code{0.01}.
  13133. @item softness
  13134. Set the range of softness. Default value is @code{0}.
  13135. Use this to control gradual transition from zero to full transparency.
  13136. @end table
  13137. @subsection Commands
  13138. This filter supports same @ref{commands} as options.
  13139. The command accepts the same syntax of the corresponding option.
  13140. If the specified expression is not valid, it is kept at its current
  13141. value.
  13142. @section lut, lutrgb, lutyuv
  13143. Compute a look-up table for binding each pixel component input value
  13144. to an output value, and apply it to the input video.
  13145. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  13146. to an RGB input video.
  13147. These filters accept the following parameters:
  13148. @table @option
  13149. @item c0
  13150. set first pixel component expression
  13151. @item c1
  13152. set second pixel component expression
  13153. @item c2
  13154. set third pixel component expression
  13155. @item c3
  13156. set fourth pixel component expression, corresponds to the alpha component
  13157. @item r
  13158. set red component expression
  13159. @item g
  13160. set green component expression
  13161. @item b
  13162. set blue component expression
  13163. @item a
  13164. alpha component expression
  13165. @item y
  13166. set Y/luma component expression
  13167. @item u
  13168. set U/Cb component expression
  13169. @item v
  13170. set V/Cr component expression
  13171. @end table
  13172. Each of them specifies the expression to use for computing the lookup table for
  13173. the corresponding pixel component values.
  13174. The exact component associated to each of the @var{c*} options depends on the
  13175. format in input.
  13176. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  13177. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  13178. The expressions can contain the following constants and functions:
  13179. @table @option
  13180. @item w
  13181. @item h
  13182. The input width and height.
  13183. @item val
  13184. The input value for the pixel component.
  13185. @item clipval
  13186. The input value, clipped to the @var{minval}-@var{maxval} range.
  13187. @item maxval
  13188. The maximum value for the pixel component.
  13189. @item minval
  13190. The minimum value for the pixel component.
  13191. @item negval
  13192. The negated value for the pixel component value, clipped to the
  13193. @var{minval}-@var{maxval} range; it corresponds to the expression
  13194. "maxval-clipval+minval".
  13195. @item clip(val)
  13196. The computed value in @var{val}, clipped to the
  13197. @var{minval}-@var{maxval} range.
  13198. @item gammaval(gamma)
  13199. The computed gamma correction value of the pixel component value,
  13200. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  13201. expression
  13202. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  13203. @end table
  13204. All expressions default to "clipval".
  13205. @subsection Commands
  13206. This filter supports same @ref{commands} as options.
  13207. @subsection Examples
  13208. @itemize
  13209. @item
  13210. Negate input video:
  13211. @example
  13212. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  13213. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  13214. @end example
  13215. The above is the same as:
  13216. @example
  13217. lutrgb="r=negval:g=negval:b=negval"
  13218. lutyuv="y=negval:u=negval:v=negval"
  13219. @end example
  13220. @item
  13221. Negate luma:
  13222. @example
  13223. lutyuv=y=negval
  13224. @end example
  13225. @item
  13226. Remove chroma components, turning the video into a graytone image:
  13227. @example
  13228. lutyuv="u=128:v=128"
  13229. @end example
  13230. @item
  13231. Apply a luma burning effect:
  13232. @example
  13233. lutyuv="y=2*val"
  13234. @end example
  13235. @item
  13236. Remove green and blue components:
  13237. @example
  13238. lutrgb="g=0:b=0"
  13239. @end example
  13240. @item
  13241. Set a constant alpha channel value on input:
  13242. @example
  13243. format=rgba,lutrgb=a="maxval-minval/2"
  13244. @end example
  13245. @item
  13246. Correct luma gamma by a factor of 0.5:
  13247. @example
  13248. lutyuv=y=gammaval(0.5)
  13249. @end example
  13250. @item
  13251. Discard least significant bits of luma:
  13252. @example
  13253. lutyuv=y='bitand(val, 128+64+32)'
  13254. @end example
  13255. @item
  13256. Technicolor like effect:
  13257. @example
  13258. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  13259. @end example
  13260. @end itemize
  13261. @section lut2, tlut2
  13262. The @code{lut2} filter takes two input streams and outputs one
  13263. stream.
  13264. The @code{tlut2} (time lut2) filter takes two consecutive frames
  13265. from one single stream.
  13266. This filter accepts the following parameters:
  13267. @table @option
  13268. @item c0
  13269. set first pixel component expression
  13270. @item c1
  13271. set second pixel component expression
  13272. @item c2
  13273. set third pixel component expression
  13274. @item c3
  13275. set fourth pixel component expression, corresponds to the alpha component
  13276. @item d
  13277. set output bit depth, only available for @code{lut2} filter. By default is 0,
  13278. which means bit depth is automatically picked from first input format.
  13279. @end table
  13280. The @code{lut2} filter also supports the @ref{framesync} options.
  13281. Each of them specifies the expression to use for computing the lookup table for
  13282. the corresponding pixel component values.
  13283. The exact component associated to each of the @var{c*} options depends on the
  13284. format in inputs.
  13285. The expressions can contain the following constants:
  13286. @table @option
  13287. @item w
  13288. @item h
  13289. The input width and height.
  13290. @item x
  13291. The first input value for the pixel component.
  13292. @item y
  13293. The second input value for the pixel component.
  13294. @item bdx
  13295. The first input video bit depth.
  13296. @item bdy
  13297. The second input video bit depth.
  13298. @end table
  13299. All expressions default to "x".
  13300. @subsection Commands
  13301. This filter supports the all above options as @ref{commands} except option @code{d}.
  13302. @subsection Examples
  13303. @itemize
  13304. @item
  13305. Highlight differences between two RGB video streams:
  13306. @example
  13307. 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)'
  13308. @end example
  13309. @item
  13310. Highlight differences between two YUV video streams:
  13311. @example
  13312. 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)'
  13313. @end example
  13314. @item
  13315. Show max difference between two video streams:
  13316. @example
  13317. 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)))'
  13318. @end example
  13319. @end itemize
  13320. @section maskedclamp
  13321. Clamp the first input stream with the second input and third input stream.
  13322. Returns the value of first stream to be between second input
  13323. stream - @code{undershoot} and third input stream + @code{overshoot}.
  13324. This filter accepts the following options:
  13325. @table @option
  13326. @item undershoot
  13327. Default value is @code{0}.
  13328. @item overshoot
  13329. Default value is @code{0}.
  13330. @item planes
  13331. Set which planes will be processed as bitmap, unprocessed planes will be
  13332. copied from first stream.
  13333. By default value 0xf, all planes will be processed.
  13334. @end table
  13335. @subsection Commands
  13336. This filter supports the all above options as @ref{commands}.
  13337. @section maskedmax
  13338. Merge the second and third input stream into output stream using absolute differences
  13339. between second input stream and first input stream and absolute difference between
  13340. third input stream and first input stream. The picked value will be from second input
  13341. stream if second absolute difference is greater than first one or from third input stream
  13342. otherwise.
  13343. This filter accepts the following options:
  13344. @table @option
  13345. @item planes
  13346. Set which planes will be processed as bitmap, unprocessed planes will be
  13347. copied from first stream.
  13348. By default value 0xf, all planes will be processed.
  13349. @end table
  13350. @subsection Commands
  13351. This filter supports the all above options as @ref{commands}.
  13352. @section maskedmerge
  13353. Merge the first input stream with the second input stream using per pixel
  13354. weights in the third input stream.
  13355. A value of 0 in the third stream pixel component means that pixel component
  13356. from first stream is returned unchanged, while maximum value (eg. 255 for
  13357. 8-bit videos) means that pixel component from second stream is returned
  13358. unchanged. Intermediate values define the amount of merging between both
  13359. input stream's pixel components.
  13360. This filter accepts the following options:
  13361. @table @option
  13362. @item planes
  13363. Set which planes will be processed as bitmap, unprocessed planes will be
  13364. copied from first stream.
  13365. By default value 0xf, all planes will be processed.
  13366. @end table
  13367. @subsection Commands
  13368. This filter supports the all above options as @ref{commands}.
  13369. @section maskedmin
  13370. Merge the second and third input stream into output stream using absolute differences
  13371. between second input stream and first input stream and absolute difference between
  13372. third input stream and first input stream. The picked value will be from second input
  13373. stream if second absolute difference is less than first one or from third input stream
  13374. otherwise.
  13375. This filter accepts the following options:
  13376. @table @option
  13377. @item planes
  13378. Set which planes will be processed as bitmap, unprocessed planes will be
  13379. copied from first stream.
  13380. By default value 0xf, all planes will be processed.
  13381. @end table
  13382. @subsection Commands
  13383. This filter supports the all above options as @ref{commands}.
  13384. @section maskedthreshold
  13385. Pick pixels comparing absolute difference of two video streams with fixed
  13386. threshold.
  13387. If absolute difference between pixel component of first and second video
  13388. stream is equal or lower than user supplied threshold than pixel component
  13389. from first video stream is picked, otherwise pixel component from second
  13390. video stream is picked.
  13391. This filter accepts the following options:
  13392. @table @option
  13393. @item threshold
  13394. Set threshold used when picking pixels from absolute difference from two input
  13395. video streams.
  13396. @item planes
  13397. Set which planes will be processed as bitmap, unprocessed planes will be
  13398. copied from second stream.
  13399. By default value 0xf, all planes will be processed.
  13400. @item mode
  13401. Set mode of filter operation. Can be @code{abs} or @code{diff}.
  13402. Default is @code{abs}.
  13403. @end table
  13404. @subsection Commands
  13405. This filter supports the all above options as @ref{commands}.
  13406. @section maskfun
  13407. Create mask from input video.
  13408. For example it is useful to create motion masks after @code{tblend} filter.
  13409. This filter accepts the following options:
  13410. @table @option
  13411. @item low
  13412. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  13413. @item high
  13414. Set high threshold. Any pixel component higher than this value will be set to max value
  13415. allowed for current pixel format.
  13416. @item planes
  13417. Set planes to filter, by default all available planes are filtered.
  13418. @item fill
  13419. Fill all frame pixels with this value.
  13420. @item sum
  13421. Set max average pixel value for frame. If sum of all pixel components is higher that this
  13422. average, output frame will be completely filled with value set by @var{fill} option.
  13423. Typically useful for scene changes when used in combination with @code{tblend} filter.
  13424. @end table
  13425. @subsection Commands
  13426. This filter supports the all above options as @ref{commands}.
  13427. @section mcdeint
  13428. Apply motion-compensation deinterlacing.
  13429. It needs one field per frame as input and must thus be used together
  13430. with yadif=1/3 or equivalent.
  13431. This filter accepts the following options:
  13432. @table @option
  13433. @item mode
  13434. Set the deinterlacing mode.
  13435. It accepts one of the following values:
  13436. @table @samp
  13437. @item fast
  13438. @item medium
  13439. @item slow
  13440. use iterative motion estimation
  13441. @item extra_slow
  13442. like @samp{slow}, but use multiple reference frames.
  13443. @end table
  13444. Default value is @samp{fast}.
  13445. @item parity
  13446. Set the picture field parity assumed for the input video. It must be
  13447. one of the following values:
  13448. @table @samp
  13449. @item 0, tff
  13450. assume top field first
  13451. @item 1, bff
  13452. assume bottom field first
  13453. @end table
  13454. Default value is @samp{bff}.
  13455. @item qp
  13456. Set per-block quantization parameter (QP) used by the internal
  13457. encoder.
  13458. Higher values should result in a smoother motion vector field but less
  13459. optimal individual vectors. Default value is 1.
  13460. @end table
  13461. @section median
  13462. Pick median pixel from certain rectangle defined by radius.
  13463. This filter accepts the following options:
  13464. @table @option
  13465. @item radius
  13466. Set horizontal radius size. Default value is @code{1}.
  13467. Allowed range is integer from 1 to 127.
  13468. @item planes
  13469. Set which planes to process. Default is @code{15}, which is all available planes.
  13470. @item radiusV
  13471. Set vertical radius size. Default value is @code{0}.
  13472. Allowed range is integer from 0 to 127.
  13473. If it is 0, value will be picked from horizontal @code{radius} option.
  13474. @item percentile
  13475. Set median percentile. Default value is @code{0.5}.
  13476. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  13477. minimum values, and @code{1} maximum values.
  13478. @end table
  13479. @subsection Commands
  13480. This filter supports same @ref{commands} as options.
  13481. The command accepts the same syntax of the corresponding option.
  13482. If the specified expression is not valid, it is kept at its current
  13483. value.
  13484. @section mergeplanes
  13485. Merge color channel components from several video streams.
  13486. The filter accepts up to 4 input streams, and merge selected input
  13487. planes to the output video.
  13488. This filter accepts the following options:
  13489. @table @option
  13490. @item mapping
  13491. Set input to output plane mapping. Default is @code{0}.
  13492. The mappings is specified as a bitmap. It should be specified as a
  13493. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  13494. mapping for the first plane of the output stream. 'A' sets the number of
  13495. the input stream to use (from 0 to 3), and 'a' the plane number of the
  13496. corresponding input to use (from 0 to 3). The rest of the mappings is
  13497. similar, 'Bb' describes the mapping for the output stream second
  13498. plane, 'Cc' describes the mapping for the output stream third plane and
  13499. 'Dd' describes the mapping for the output stream fourth plane.
  13500. @item format
  13501. Set output pixel format. Default is @code{yuva444p}.
  13502. @item map0s
  13503. @item map1s
  13504. @item map2s
  13505. @item map3s
  13506. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  13507. @item map0p
  13508. @item map1p
  13509. @item map2p
  13510. @item map3p
  13511. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  13512. @end table
  13513. @subsection Examples
  13514. @itemize
  13515. @item
  13516. Merge three gray video streams of same width and height into single video stream:
  13517. @example
  13518. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  13519. @end example
  13520. @item
  13521. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  13522. @example
  13523. [a0][a1]mergeplanes=0x00010210:yuva444p
  13524. @end example
  13525. @item
  13526. Swap Y and A plane in yuva444p stream:
  13527. @example
  13528. format=yuva444p,mergeplanes=0x03010200:yuva444p
  13529. @end example
  13530. @item
  13531. Swap U and V plane in yuv420p stream:
  13532. @example
  13533. format=yuv420p,mergeplanes=0x000201:yuv420p
  13534. @end example
  13535. @item
  13536. Cast a rgb24 clip to yuv444p:
  13537. @example
  13538. format=rgb24,mergeplanes=0x000102:yuv444p
  13539. @end example
  13540. @end itemize
  13541. @section mestimate
  13542. Estimate and export motion vectors using block matching algorithms.
  13543. Motion vectors are stored in frame side data to be used by other filters.
  13544. This filter accepts the following options:
  13545. @table @option
  13546. @item method
  13547. Specify the motion estimation method. Accepts one of the following values:
  13548. @table @samp
  13549. @item esa
  13550. Exhaustive search algorithm.
  13551. @item tss
  13552. Three step search algorithm.
  13553. @item tdls
  13554. Two dimensional logarithmic search algorithm.
  13555. @item ntss
  13556. New three step search algorithm.
  13557. @item fss
  13558. Four step search algorithm.
  13559. @item ds
  13560. Diamond search algorithm.
  13561. @item hexbs
  13562. Hexagon-based search algorithm.
  13563. @item epzs
  13564. Enhanced predictive zonal search algorithm.
  13565. @item umh
  13566. Uneven multi-hexagon search algorithm.
  13567. @end table
  13568. Default value is @samp{esa}.
  13569. @item mb_size
  13570. Macroblock size. Default @code{16}.
  13571. @item search_param
  13572. Search parameter. Default @code{7}.
  13573. @end table
  13574. @section midequalizer
  13575. Apply Midway Image Equalization effect using two video streams.
  13576. Midway Image Equalization adjusts a pair of images to have the same
  13577. histogram, while maintaining their dynamics as much as possible. It's
  13578. useful for e.g. matching exposures from a pair of stereo cameras.
  13579. This filter has two inputs and one output, which must be of same pixel format, but
  13580. may be of different sizes. The output of filter is first input adjusted with
  13581. midway histogram of both inputs.
  13582. This filter accepts the following option:
  13583. @table @option
  13584. @item planes
  13585. Set which planes to process. Default is @code{15}, which is all available planes.
  13586. @end table
  13587. @section minterpolate
  13588. Convert the video to specified frame rate using motion interpolation.
  13589. This filter accepts the following options:
  13590. @table @option
  13591. @item fps
  13592. 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}.
  13593. @item mi_mode
  13594. Motion interpolation mode. Following values are accepted:
  13595. @table @samp
  13596. @item dup
  13597. Duplicate previous or next frame for interpolating new ones.
  13598. @item blend
  13599. Blend source frames. Interpolated frame is mean of previous and next frames.
  13600. @item mci
  13601. Motion compensated interpolation. Following options are effective when this mode is selected:
  13602. @table @samp
  13603. @item mc_mode
  13604. Motion compensation mode. Following values are accepted:
  13605. @table @samp
  13606. @item obmc
  13607. Overlapped block motion compensation.
  13608. @item aobmc
  13609. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  13610. @end table
  13611. Default mode is @samp{obmc}.
  13612. @item me_mode
  13613. Motion estimation mode. Following values are accepted:
  13614. @table @samp
  13615. @item bidir
  13616. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  13617. @item bilat
  13618. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  13619. @end table
  13620. Default mode is @samp{bilat}.
  13621. @item me
  13622. The algorithm to be used for motion estimation. Following values are accepted:
  13623. @table @samp
  13624. @item esa
  13625. Exhaustive search algorithm.
  13626. @item tss
  13627. Three step search algorithm.
  13628. @item tdls
  13629. Two dimensional logarithmic search algorithm.
  13630. @item ntss
  13631. New three step search algorithm.
  13632. @item fss
  13633. Four step search algorithm.
  13634. @item ds
  13635. Diamond search algorithm.
  13636. @item hexbs
  13637. Hexagon-based search algorithm.
  13638. @item epzs
  13639. Enhanced predictive zonal search algorithm.
  13640. @item umh
  13641. Uneven multi-hexagon search algorithm.
  13642. @end table
  13643. Default algorithm is @samp{epzs}.
  13644. @item mb_size
  13645. Macroblock size. Default @code{16}.
  13646. @item search_param
  13647. Motion estimation search parameter. Default @code{32}.
  13648. @item vsbmc
  13649. 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).
  13650. @end table
  13651. @end table
  13652. @item scd
  13653. 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:
  13654. @table @samp
  13655. @item none
  13656. Disable scene change detection.
  13657. @item fdiff
  13658. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  13659. @end table
  13660. Default method is @samp{fdiff}.
  13661. @item scd_threshold
  13662. Scene change detection threshold. Default is @code{10.}.
  13663. @end table
  13664. @section mix
  13665. Mix several video input streams into one video stream.
  13666. A description of the accepted options follows.
  13667. @table @option
  13668. @item inputs
  13669. The number of inputs. If unspecified, it defaults to 2.
  13670. @item weights
  13671. Specify weight of each input video stream as sequence.
  13672. Each weight is separated by space. If number of weights
  13673. is smaller than number of @var{frames} last specified
  13674. weight will be used for all remaining unset weights.
  13675. @item scale
  13676. Specify scale, if it is set it will be multiplied with sum
  13677. of each weight multiplied with pixel values to give final destination
  13678. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13679. @item planes
  13680. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  13681. @item duration
  13682. Specify how end of stream is determined.
  13683. @table @samp
  13684. @item longest
  13685. The duration of the longest input. (default)
  13686. @item shortest
  13687. The duration of the shortest input.
  13688. @item first
  13689. The duration of the first input.
  13690. @end table
  13691. @end table
  13692. @subsection Commands
  13693. This filter supports the following commands:
  13694. @table @option
  13695. @item weights
  13696. @item scale
  13697. @item planes
  13698. Syntax is same as option with same name.
  13699. @end table
  13700. @section monochrome
  13701. Convert video to gray using custom color filter.
  13702. A description of the accepted options follows.
  13703. @table @option
  13704. @item cb
  13705. Set the chroma blue spot. Allowed range is from -1 to 1.
  13706. Default value is 0.
  13707. @item cr
  13708. Set the chroma red spot. Allowed range is from -1 to 1.
  13709. Default value is 0.
  13710. @item size
  13711. Set the color filter size. Allowed range is from .1 to 10.
  13712. Default value is 1.
  13713. @item high
  13714. Set the highlights strength. Allowed range is from 0 to 1.
  13715. Default value is 0.
  13716. @end table
  13717. @subsection Commands
  13718. This filter supports the all above options as @ref{commands}.
  13719. @section morpho
  13720. This filter allows to apply main morphological grayscale transforms,
  13721. erode and dilate with arbitrary structures set in second input stream.
  13722. Unlike naive implementation and much slower performance in @ref{erosion}
  13723. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  13724. should be used instead.
  13725. A description of accepted options follows,
  13726. @table @option
  13727. @item mode
  13728. Set morphological transform to apply, can be:
  13729. @table @samp
  13730. @item erode
  13731. @item dilate
  13732. @item open
  13733. @item close
  13734. @item gradient
  13735. @item tophat
  13736. @item blackhat
  13737. @end table
  13738. Default is @code{erode}.
  13739. @item planes
  13740. Set planes to filter, by default all planes except alpha are filtered.
  13741. @item structure
  13742. Set which structure video frames will be processed from second input stream,
  13743. can be @var{first} or @var{all}. Default is @var{all}.
  13744. @end table
  13745. The @code{morpho} filter also supports the @ref{framesync} options.
  13746. @subsection Commands
  13747. This filter supports same @ref{commands} as options.
  13748. @section mpdecimate
  13749. Drop frames that do not differ greatly from the previous frame in
  13750. order to reduce frame rate.
  13751. The main use of this filter is for very-low-bitrate encoding
  13752. (e.g. streaming over dialup modem), but it could in theory be used for
  13753. fixing movies that were inverse-telecined incorrectly.
  13754. A description of the accepted options follows.
  13755. @table @option
  13756. @item max
  13757. Set the maximum number of consecutive frames which can be dropped (if
  13758. positive), or the minimum interval between dropped frames (if
  13759. negative). If the value is 0, the frame is dropped disregarding the
  13760. number of previous sequentially dropped frames.
  13761. Default value is 0.
  13762. @item keep
  13763. Set the maximum number of consecutive similar frames to ignore before to start dropping them.
  13764. If the value is 0, the frame is dropped disregarding the
  13765. number of previous sequentially similar frames.
  13766. Default value is 0.
  13767. @item hi
  13768. @item lo
  13769. @item frac
  13770. Set the dropping threshold values.
  13771. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  13772. represent actual pixel value differences, so a threshold of 64
  13773. corresponds to 1 unit of difference for each pixel, or the same spread
  13774. out differently over the block.
  13775. A frame is a candidate for dropping if no 8x8 blocks differ by more
  13776. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  13777. meaning the whole image) differ by more than a threshold of @option{lo}.
  13778. Default value for @option{hi} is 64*12, default value for @option{lo} is
  13779. 64*5, and default value for @option{frac} is 0.33.
  13780. @end table
  13781. @section msad
  13782. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  13783. This filter takes two input videos.
  13784. Both input videos must have the same resolution and pixel format for
  13785. this filter to work correctly. Also it assumes that both inputs
  13786. have the same number of frames, which are compared one by one.
  13787. The obtained per component, average, min and max MSAD is printed through
  13788. the logging system.
  13789. The filter stores the calculated MSAD of each frame in frame metadata.
  13790. This filter also supports the @ref{framesync} options.
  13791. In the below example the input file @file{main.mpg} being processed is compared
  13792. with the reference file @file{ref.mpg}.
  13793. @example
  13794. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  13795. @end example
  13796. @section multiply
  13797. Multiply first video stream pixels values with second video stream pixels values.
  13798. The filter accepts the following options:
  13799. @table @option
  13800. @item scale
  13801. Set the scale applied to second video stream. By default is @code{1}.
  13802. Allowed range is from @code{0} to @code{9}.
  13803. @item offset
  13804. Set the offset applied to second video stream. By default is @code{0.5}.
  13805. Allowed range is from @code{-1} to @code{1}.
  13806. @item planes
  13807. Specify planes from input video stream that will be processed.
  13808. By default all planes are processed.
  13809. @end table
  13810. @subsection Commands
  13811. This filter supports same @ref{commands} as options.
  13812. @section negate
  13813. Negate (invert) the input video.
  13814. It accepts the following option:
  13815. @table @option
  13816. @item components
  13817. Set components to negate.
  13818. Available values for components are:
  13819. @table @samp
  13820. @item y
  13821. @item u
  13822. @item v
  13823. @item a
  13824. @item r
  13825. @item g
  13826. @item b
  13827. @end table
  13828. @item negate_alpha
  13829. With value 1, it negates the alpha component, if present. Default value is 0.
  13830. @end table
  13831. @subsection Commands
  13832. This filter supports same @ref{commands} as options.
  13833. @anchor{nlmeans}
  13834. @section nlmeans
  13835. Denoise frames using Non-Local Means algorithm.
  13836. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13837. context similarity is defined by comparing their surrounding patches of size
  13838. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13839. around the pixel.
  13840. Note that the research area defines centers for patches, which means some
  13841. patches will be made of pixels outside that research area.
  13842. The filter accepts the following options.
  13843. @table @option
  13844. @item s
  13845. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13846. @item p
  13847. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13848. @item pc
  13849. Same as @option{p} but for chroma planes.
  13850. The default value is @var{0} and means automatic.
  13851. @item r
  13852. Set research size. Default is 15. Must be odd number in range [0, 99].
  13853. @item rc
  13854. Same as @option{r} but for chroma planes.
  13855. The default value is @var{0} and means automatic.
  13856. @end table
  13857. @section nnedi
  13858. Deinterlace video using neural network edge directed interpolation.
  13859. This filter accepts the following options:
  13860. @table @option
  13861. @item weights
  13862. Mandatory option, without binary file filter can not work.
  13863. Currently file can be found here:
  13864. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13865. @item deint
  13866. Set which frames to deinterlace, by default it is @code{all}.
  13867. Can be @code{all} or @code{interlaced}.
  13868. @item field
  13869. Set mode of operation.
  13870. Can be one of the following:
  13871. @table @samp
  13872. @item af
  13873. Use frame flags, both fields.
  13874. @item a
  13875. Use frame flags, single field.
  13876. @item t
  13877. Use top field only.
  13878. @item b
  13879. Use bottom field only.
  13880. @item tf
  13881. Use both fields, top first.
  13882. @item bf
  13883. Use both fields, bottom first.
  13884. @end table
  13885. @item planes
  13886. Set which planes to process, by default filter process all frames.
  13887. @item nsize
  13888. Set size of local neighborhood around each pixel, used by the predictor neural
  13889. network.
  13890. Can be one of the following:
  13891. @table @samp
  13892. @item s8x6
  13893. @item s16x6
  13894. @item s32x6
  13895. @item s48x6
  13896. @item s8x4
  13897. @item s16x4
  13898. @item s32x4
  13899. @end table
  13900. @item nns
  13901. Set the number of neurons in predictor neural network.
  13902. Can be one of the following:
  13903. @table @samp
  13904. @item n16
  13905. @item n32
  13906. @item n64
  13907. @item n128
  13908. @item n256
  13909. @end table
  13910. @item qual
  13911. Controls the number of different neural network predictions that are blended
  13912. together to compute the final output value. Can be @code{fast}, default or
  13913. @code{slow}.
  13914. @item etype
  13915. Set which set of weights to use in the predictor.
  13916. Can be one of the following:
  13917. @table @samp
  13918. @item a, abs
  13919. weights trained to minimize absolute error
  13920. @item s, mse
  13921. weights trained to minimize squared error
  13922. @end table
  13923. @item pscrn
  13924. Controls whether or not the prescreener neural network is used to decide
  13925. which pixels should be processed by the predictor neural network and which
  13926. can be handled by simple cubic interpolation.
  13927. The prescreener is trained to know whether cubic interpolation will be
  13928. sufficient for a pixel or whether it should be predicted by the predictor nn.
  13929. The computational complexity of the prescreener nn is much less than that of
  13930. the predictor nn. Since most pixels can be handled by cubic interpolation,
  13931. using the prescreener generally results in much faster processing.
  13932. The prescreener is pretty accurate, so the difference between using it and not
  13933. using it is almost always unnoticeable.
  13934. Can be one of the following:
  13935. @table @samp
  13936. @item none
  13937. @item original
  13938. @item new
  13939. @item new2
  13940. @item new3
  13941. @end table
  13942. Default is @code{new}.
  13943. @end table
  13944. @subsection Commands
  13945. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  13946. @section noformat
  13947. Force libavfilter not to use any of the specified pixel formats for the
  13948. input to the next filter.
  13949. It accepts the following parameters:
  13950. @table @option
  13951. @item pix_fmts
  13952. A '|'-separated list of pixel format names, such as
  13953. pix_fmts=yuv420p|monow|rgb24".
  13954. @end table
  13955. @subsection Examples
  13956. @itemize
  13957. @item
  13958. Force libavfilter to use a format different from @var{yuv420p} for the
  13959. input to the vflip filter:
  13960. @example
  13961. noformat=pix_fmts=yuv420p,vflip
  13962. @end example
  13963. @item
  13964. Convert the input video to any of the formats not contained in the list:
  13965. @example
  13966. noformat=yuv420p|yuv444p|yuv410p
  13967. @end example
  13968. @end itemize
  13969. @section noise
  13970. Add noise on video input frame.
  13971. The filter accepts the following options:
  13972. @table @option
  13973. @item all_seed
  13974. @item c0_seed
  13975. @item c1_seed
  13976. @item c2_seed
  13977. @item c3_seed
  13978. Set noise seed for specific pixel component or all pixel components in case
  13979. of @var{all_seed}. Default value is @code{123457}.
  13980. @item all_strength, alls
  13981. @item c0_strength, c0s
  13982. @item c1_strength, c1s
  13983. @item c2_strength, c2s
  13984. @item c3_strength, c3s
  13985. Set noise strength for specific pixel component or all pixel components in case
  13986. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  13987. @item all_flags, allf
  13988. @item c0_flags, c0f
  13989. @item c1_flags, c1f
  13990. @item c2_flags, c2f
  13991. @item c3_flags, c3f
  13992. Set pixel component flags or set flags for all components if @var{all_flags}.
  13993. Available values for component flags are:
  13994. @table @samp
  13995. @item a
  13996. averaged temporal noise (smoother)
  13997. @item p
  13998. mix random noise with a (semi)regular pattern
  13999. @item t
  14000. temporal noise (noise pattern changes between frames)
  14001. @item u
  14002. uniform noise (gaussian otherwise)
  14003. @end table
  14004. @end table
  14005. @subsection Examples
  14006. Add temporal and uniform noise to input video:
  14007. @example
  14008. noise=alls=20:allf=t+u
  14009. @end example
  14010. @section normalize
  14011. Normalize RGB video (aka histogram stretching, contrast stretching).
  14012. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  14013. For each channel of each frame, the filter computes the input range and maps
  14014. it linearly to the user-specified output range. The output range defaults
  14015. to the full dynamic range from pure black to pure white.
  14016. Temporal smoothing can be used on the input range to reduce flickering (rapid
  14017. changes in brightness) caused when small dark or bright objects enter or leave
  14018. the scene. This is similar to the auto-exposure (automatic gain control) on a
  14019. video camera, and, like a video camera, it may cause a period of over- or
  14020. under-exposure of the video.
  14021. The R,G,B channels can be normalized independently, which may cause some
  14022. color shifting, or linked together as a single channel, which prevents
  14023. color shifting. Linked normalization preserves hue. Independent normalization
  14024. does not, so it can be used to remove some color casts. Independent and linked
  14025. normalization can be combined in any ratio.
  14026. The normalize filter accepts the following options:
  14027. @table @option
  14028. @item blackpt
  14029. @item whitept
  14030. Colors which define the output range. The minimum input value is mapped to
  14031. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  14032. The defaults are black and white respectively. Specifying white for
  14033. @var{blackpt} and black for @var{whitept} will give color-inverted,
  14034. normalized video. Shades of grey can be used to reduce the dynamic range
  14035. (contrast). Specifying saturated colors here can create some interesting
  14036. effects.
  14037. @item smoothing
  14038. The number of previous frames to use for temporal smoothing. The input range
  14039. of each channel is smoothed using a rolling average over the current frame
  14040. and the @var{smoothing} previous frames. The default is 0 (no temporal
  14041. smoothing).
  14042. @item independence
  14043. Controls the ratio of independent (color shifting) channel normalization to
  14044. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  14045. independent. Defaults to 1.0 (fully independent).
  14046. @item strength
  14047. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  14048. expensive no-op. Defaults to 1.0 (full strength).
  14049. @end table
  14050. @subsection Commands
  14051. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  14052. The command accepts the same syntax of the corresponding option.
  14053. If the specified expression is not valid, it is kept at its current
  14054. value.
  14055. @subsection Examples
  14056. Stretch video contrast to use the full dynamic range, with no temporal
  14057. smoothing; may flicker depending on the source content:
  14058. @example
  14059. normalize=blackpt=black:whitept=white:smoothing=0
  14060. @end example
  14061. As above, but with 50 frames of temporal smoothing; flicker should be
  14062. reduced, depending on the source content:
  14063. @example
  14064. normalize=blackpt=black:whitept=white:smoothing=50
  14065. @end example
  14066. As above, but with hue-preserving linked channel normalization:
  14067. @example
  14068. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  14069. @end example
  14070. As above, but with half strength:
  14071. @example
  14072. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  14073. @end example
  14074. Map the darkest input color to red, the brightest input color to cyan:
  14075. @example
  14076. normalize=blackpt=red:whitept=cyan
  14077. @end example
  14078. @section null
  14079. Pass the video source unchanged to the output.
  14080. @section ocr
  14081. Optical Character Recognition
  14082. This filter uses Tesseract for optical character recognition. To enable
  14083. compilation of this filter, you need to configure FFmpeg with
  14084. @code{--enable-libtesseract}.
  14085. It accepts the following options:
  14086. @table @option
  14087. @item datapath
  14088. Set datapath to tesseract data. Default is to use whatever was
  14089. set at installation.
  14090. @item language
  14091. Set language, default is "eng".
  14092. @item whitelist
  14093. Set character whitelist.
  14094. @item blacklist
  14095. Set character blacklist.
  14096. @end table
  14097. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  14098. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  14099. @section ocv
  14100. Apply a video transform using libopencv.
  14101. To enable this filter, install the libopencv library and headers and
  14102. configure FFmpeg with @code{--enable-libopencv}.
  14103. It accepts the following parameters:
  14104. @table @option
  14105. @item filter_name
  14106. The name of the libopencv filter to apply.
  14107. @item filter_params
  14108. The parameters to pass to the libopencv filter. If not specified, the default
  14109. values are assumed.
  14110. @end table
  14111. Refer to the official libopencv documentation for more precise
  14112. information:
  14113. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  14114. Several libopencv filters are supported; see the following subsections.
  14115. @anchor{dilate}
  14116. @subsection dilate
  14117. Dilate an image by using a specific structuring element.
  14118. It corresponds to the libopencv function @code{cvDilate}.
  14119. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  14120. @var{struct_el} represents a structuring element, and has the syntax:
  14121. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  14122. @var{cols} and @var{rows} represent the number of columns and rows of
  14123. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  14124. point, and @var{shape} the shape for the structuring element. @var{shape}
  14125. must be "rect", "cross", "ellipse", or "custom".
  14126. If the value for @var{shape} is "custom", it must be followed by a
  14127. string of the form "=@var{filename}". The file with name
  14128. @var{filename} is assumed to represent a binary image, with each
  14129. printable character corresponding to a bright pixel. When a custom
  14130. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  14131. or columns and rows of the read file are assumed instead.
  14132. The default value for @var{struct_el} is "3x3+0x0/rect".
  14133. @var{nb_iterations} specifies the number of times the transform is
  14134. applied to the image, and defaults to 1.
  14135. Some examples:
  14136. @example
  14137. # Use the default values
  14138. ocv=dilate
  14139. # Dilate using a structuring element with a 5x5 cross, iterating two times
  14140. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  14141. # Read the shape from the file diamond.shape, iterating two times.
  14142. # The file diamond.shape may contain a pattern of characters like this
  14143. # *
  14144. # ***
  14145. # *****
  14146. # ***
  14147. # *
  14148. # The specified columns and rows are ignored
  14149. # but the anchor point coordinates are not
  14150. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  14151. @end example
  14152. @subsection erode
  14153. Erode an image by using a specific structuring element.
  14154. It corresponds to the libopencv function @code{cvErode}.
  14155. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  14156. with the same syntax and semantics as the @ref{dilate} filter.
  14157. @subsection smooth
  14158. Smooth the input video.
  14159. The filter takes the following parameters:
  14160. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  14161. @var{type} is the type of smooth filter to apply, and must be one of
  14162. the following values: "blur", "blur_no_scale", "median", "gaussian",
  14163. or "bilateral". The default value is "gaussian".
  14164. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  14165. depends on the smooth type. @var{param1} and
  14166. @var{param2} accept integer positive values or 0. @var{param3} and
  14167. @var{param4} accept floating point values.
  14168. The default value for @var{param1} is 3. The default value for the
  14169. other parameters is 0.
  14170. These parameters correspond to the parameters assigned to the
  14171. libopencv function @code{cvSmooth}.
  14172. @section oscilloscope
  14173. 2D Video Oscilloscope.
  14174. Useful to measure spatial impulse, step responses, chroma delays, etc.
  14175. It accepts the following parameters:
  14176. @table @option
  14177. @item x
  14178. Set scope center x position.
  14179. @item y
  14180. Set scope center y position.
  14181. @item s
  14182. Set scope size, relative to frame diagonal.
  14183. @item t
  14184. Set scope tilt/rotation.
  14185. @item o
  14186. Set trace opacity.
  14187. @item tx
  14188. Set trace center x position.
  14189. @item ty
  14190. Set trace center y position.
  14191. @item tw
  14192. Set trace width, relative to width of frame.
  14193. @item th
  14194. Set trace height, relative to height of frame.
  14195. @item c
  14196. Set which components to trace. By default it traces first three components.
  14197. @item g
  14198. Draw trace grid. By default is enabled.
  14199. @item st
  14200. Draw some statistics. By default is enabled.
  14201. @item sc
  14202. Draw scope. By default is enabled.
  14203. @end table
  14204. @subsection Commands
  14205. This filter supports same @ref{commands} as options.
  14206. The command accepts the same syntax of the corresponding option.
  14207. If the specified expression is not valid, it is kept at its current
  14208. value.
  14209. @subsection Examples
  14210. @itemize
  14211. @item
  14212. Inspect full first row of video frame.
  14213. @example
  14214. oscilloscope=x=0.5:y=0:s=1
  14215. @end example
  14216. @item
  14217. Inspect full last row of video frame.
  14218. @example
  14219. oscilloscope=x=0.5:y=1:s=1
  14220. @end example
  14221. @item
  14222. Inspect full 5th line of video frame of height 1080.
  14223. @example
  14224. oscilloscope=x=0.5:y=5/1080:s=1
  14225. @end example
  14226. @item
  14227. Inspect full last column of video frame.
  14228. @example
  14229. oscilloscope=x=1:y=0.5:s=1:t=1
  14230. @end example
  14231. @end itemize
  14232. @anchor{overlay}
  14233. @section overlay
  14234. Overlay one video on top of another.
  14235. It takes two inputs and has one output. The first input is the "main"
  14236. video on which the second input is overlaid.
  14237. It accepts the following parameters:
  14238. A description of the accepted options follows.
  14239. @table @option
  14240. @item x
  14241. @item y
  14242. Set the expression for the x and y coordinates of the overlaid video
  14243. on the main video. Default value is "0" for both expressions. In case
  14244. the expression is invalid, it is set to a huge value (meaning that the
  14245. overlay will not be displayed within the output visible area).
  14246. @item eof_action
  14247. See @ref{framesync}.
  14248. @item eval
  14249. Set when the expressions for @option{x}, and @option{y} are evaluated.
  14250. It accepts the following values:
  14251. @table @samp
  14252. @item init
  14253. only evaluate expressions once during the filter initialization or
  14254. when a command is processed
  14255. @item frame
  14256. evaluate expressions for each incoming frame
  14257. @end table
  14258. Default value is @samp{frame}.
  14259. @item shortest
  14260. See @ref{framesync}.
  14261. @item format
  14262. Set the format for the output video.
  14263. It accepts the following values:
  14264. @table @samp
  14265. @item yuv420
  14266. force YUV 4:2:0 8-bit planar output
  14267. @item yuv420p10
  14268. force YUV 4:2:0 10-bit planar output
  14269. @item yuv422
  14270. force YUV 4:2:2 8-bit planar output
  14271. @item yuv422p10
  14272. force YUV 4:2:2 10-bit planar output
  14273. @item yuv444
  14274. force YUV 4:4:4 8-bit planar output
  14275. @item yuv444p10
  14276. force YUV 4:4:4 10-bit planar output
  14277. @item rgb
  14278. force RGB 8-bit packed output
  14279. @item gbrp
  14280. force RGB 8-bit planar output
  14281. @item auto
  14282. automatically pick format
  14283. @end table
  14284. Default value is @samp{yuv420}.
  14285. @item repeatlast
  14286. See @ref{framesync}.
  14287. @item alpha
  14288. Set format of alpha of the overlaid video, it can be @var{straight} or
  14289. @var{premultiplied}. Default is @var{straight}.
  14290. @end table
  14291. The @option{x}, and @option{y} expressions can contain the following
  14292. parameters.
  14293. @table @option
  14294. @item main_w, W
  14295. @item main_h, H
  14296. The main input width and height.
  14297. @item overlay_w, w
  14298. @item overlay_h, h
  14299. The overlay input width and height.
  14300. @item x
  14301. @item y
  14302. The computed values for @var{x} and @var{y}. They are evaluated for
  14303. each new frame.
  14304. @item hsub
  14305. @item vsub
  14306. horizontal and vertical chroma subsample values of the output
  14307. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  14308. @var{vsub} is 1.
  14309. @item n
  14310. the number of input frame, starting from 0
  14311. @item pos
  14312. the position in the file of the input frame, NAN if unknown; deprecated,
  14313. do not use
  14314. @item t
  14315. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  14316. @end table
  14317. This filter also supports the @ref{framesync} options.
  14318. Note that the @var{n}, @var{t} variables are available only
  14319. when evaluation is done @emph{per frame}, and will evaluate to NAN
  14320. when @option{eval} is set to @samp{init}.
  14321. Be aware that frames are taken from each input video in timestamp
  14322. order, hence, if their initial timestamps differ, it is a good idea
  14323. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  14324. have them begin in the same zero timestamp, as the example for
  14325. the @var{movie} filter does.
  14326. You can chain together more overlays but you should test the
  14327. efficiency of such approach.
  14328. @subsection Commands
  14329. This filter supports the following commands:
  14330. @table @option
  14331. @item x
  14332. @item y
  14333. Modify the x and y of the overlay input.
  14334. The command accepts the same syntax of the corresponding option.
  14335. If the specified expression is not valid, it is kept at its current
  14336. value.
  14337. @end table
  14338. @subsection Examples
  14339. @itemize
  14340. @item
  14341. Draw the overlay at 10 pixels from the bottom right corner of the main
  14342. video:
  14343. @example
  14344. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  14345. @end example
  14346. Using named options the example above becomes:
  14347. @example
  14348. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  14349. @end example
  14350. @item
  14351. Insert a transparent PNG logo in the bottom left corner of the input,
  14352. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  14353. @example
  14354. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  14355. @end example
  14356. @item
  14357. Insert 2 different transparent PNG logos (second logo on bottom
  14358. right corner) using the @command{ffmpeg} tool:
  14359. @example
  14360. 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
  14361. @end example
  14362. @item
  14363. Add a transparent color layer on top of the main video; @code{WxH}
  14364. must specify the size of the main input to the overlay filter:
  14365. @example
  14366. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  14367. @end example
  14368. @item
  14369. Play an original video and a filtered version (here with the deshake
  14370. filter) side by side using the @command{ffplay} tool:
  14371. @example
  14372. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  14373. @end example
  14374. The above command is the same as:
  14375. @example
  14376. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  14377. @end example
  14378. @item
  14379. Make a sliding overlay appearing from the left to the right top part of the
  14380. screen starting since time 2:
  14381. @example
  14382. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  14383. @end example
  14384. @item
  14385. Compose output by putting two input videos side to side:
  14386. @example
  14387. ffmpeg -i left.avi -i right.avi -filter_complex "
  14388. nullsrc=size=200x100 [background];
  14389. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  14390. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  14391. [background][left] overlay=shortest=1 [background+left];
  14392. [background+left][right] overlay=shortest=1:x=100 [left+right]
  14393. "
  14394. @end example
  14395. @item
  14396. Mask 10-20 seconds of a video by applying the delogo filter to a section
  14397. @example
  14398. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  14399. -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]'
  14400. masked.avi
  14401. @end example
  14402. @item
  14403. Chain several overlays in cascade:
  14404. @example
  14405. nullsrc=s=200x200 [bg];
  14406. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  14407. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  14408. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  14409. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  14410. [in3] null, [mid2] overlay=100:100 [out0]
  14411. @end example
  14412. @end itemize
  14413. @anchor{overlay_cuda}
  14414. @section overlay_cuda
  14415. Overlay one video on top of another.
  14416. This is the CUDA variant of the @ref{overlay} filter.
  14417. It only accepts CUDA frames. The underlying input pixel formats have to match.
  14418. It takes two inputs and has one output. The first input is the "main"
  14419. video on which the second input is overlaid.
  14420. It accepts the following parameters:
  14421. @table @option
  14422. @item x
  14423. @item y
  14424. Set expressions for the x and y coordinates of the overlaid video
  14425. on the main video.
  14426. They can contain the following parameters:
  14427. @table @option
  14428. @item main_w, W
  14429. @item main_h, H
  14430. The main input width and height.
  14431. @item overlay_w, w
  14432. @item overlay_h, h
  14433. The overlay input width and height.
  14434. @item x
  14435. @item y
  14436. The computed values for @var{x} and @var{y}. They are evaluated for
  14437. each new frame.
  14438. @item n
  14439. The ordinal index of the main input frame, starting from 0.
  14440. @item pos
  14441. The byte offset position in the file of the main input frame, NAN if unknown.
  14442. Deprecated, do not use.
  14443. @item t
  14444. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  14445. @end table
  14446. Default value is "0" for both expressions.
  14447. @item eval
  14448. Set when the expressions for @option{x} and @option{y} are evaluated.
  14449. It accepts the following values:
  14450. @table @option
  14451. @item init
  14452. Evaluate expressions once during filter initialization or
  14453. when a command is processed.
  14454. @item frame
  14455. Evaluate expressions for each incoming frame
  14456. @end table
  14457. Default value is @option{frame}.
  14458. @item eof_action
  14459. See @ref{framesync}.
  14460. @item shortest
  14461. See @ref{framesync}.
  14462. @item repeatlast
  14463. See @ref{framesync}.
  14464. @end table
  14465. This filter also supports the @ref{framesync} options.
  14466. @section owdenoise
  14467. Apply Overcomplete Wavelet denoiser.
  14468. The filter accepts the following options:
  14469. @table @option
  14470. @item depth
  14471. Set depth.
  14472. Larger depth values will denoise lower frequency components more, but
  14473. slow down filtering.
  14474. Must be an int in the range 8-16, default is @code{8}.
  14475. @item luma_strength, ls
  14476. Set luma strength.
  14477. Must be a double value in the range 0-1000, default is @code{1.0}.
  14478. @item chroma_strength, cs
  14479. Set chroma strength.
  14480. Must be a double value in the range 0-1000, default is @code{1.0}.
  14481. @end table
  14482. @anchor{pad}
  14483. @section pad
  14484. Add paddings to the input image, and place the original input at the
  14485. provided @var{x}, @var{y} coordinates.
  14486. It accepts the following parameters:
  14487. @table @option
  14488. @item width, w
  14489. @item height, h
  14490. Specify an expression for the size of the output image with the
  14491. paddings added. If the value for @var{width} or @var{height} is 0, the
  14492. corresponding input size is used for the output.
  14493. The @var{width} expression can reference the value set by the
  14494. @var{height} expression, and vice versa.
  14495. The default value of @var{width} and @var{height} is 0.
  14496. @item x
  14497. @item y
  14498. Specify the offsets to place the input image at within the padded area,
  14499. with respect to the top/left border of the output image.
  14500. The @var{x} expression can reference the value set by the @var{y}
  14501. expression, and vice versa.
  14502. The default value of @var{x} and @var{y} is 0.
  14503. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  14504. so the input image is centered on the padded area.
  14505. @item color
  14506. Specify the color of the padded area. For the syntax of this option,
  14507. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14508. manual,ffmpeg-utils}.
  14509. The default value of @var{color} is "black".
  14510. @item eval
  14511. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  14512. It accepts the following values:
  14513. @table @samp
  14514. @item init
  14515. Only evaluate expressions once during the filter initialization or when
  14516. a command is processed.
  14517. @item frame
  14518. Evaluate expressions for each incoming frame.
  14519. @end table
  14520. Default value is @samp{init}.
  14521. @item aspect
  14522. Pad to aspect instead to a resolution.
  14523. @end table
  14524. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  14525. options are expressions containing the following constants:
  14526. @table @option
  14527. @item in_w
  14528. @item in_h
  14529. The input video width and height.
  14530. @item iw
  14531. @item ih
  14532. These are the same as @var{in_w} and @var{in_h}.
  14533. @item out_w
  14534. @item out_h
  14535. The output width and height (the size of the padded area), as
  14536. specified by the @var{width} and @var{height} expressions.
  14537. @item ow
  14538. @item oh
  14539. These are the same as @var{out_w} and @var{out_h}.
  14540. @item x
  14541. @item y
  14542. The x and y offsets as specified by the @var{x} and @var{y}
  14543. expressions, or NAN if not yet specified.
  14544. @item a
  14545. same as @var{iw} / @var{ih}
  14546. @item sar
  14547. input sample aspect ratio
  14548. @item dar
  14549. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  14550. @item hsub
  14551. @item vsub
  14552. The horizontal and vertical chroma subsample values. For example for the
  14553. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14554. @end table
  14555. @subsection Examples
  14556. @itemize
  14557. @item
  14558. Add paddings with the color "violet" to the input video. The output video
  14559. size is 640x480, and the top-left corner of the input video is placed at
  14560. column 0, row 40
  14561. @example
  14562. pad=640:480:0:40:violet
  14563. @end example
  14564. The example above is equivalent to the following command:
  14565. @example
  14566. pad=width=640:height=480:x=0:y=40:color=violet
  14567. @end example
  14568. @item
  14569. Pad the input to get an output with dimensions increased by 3/2,
  14570. and put the input video at the center of the padded area:
  14571. @example
  14572. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  14573. @end example
  14574. @item
  14575. Pad the input to get a squared output with size equal to the maximum
  14576. value between the input width and height, and put the input video at
  14577. the center of the padded area:
  14578. @example
  14579. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  14580. @end example
  14581. @item
  14582. Pad the input to get a final w/h ratio of 16:9:
  14583. @example
  14584. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  14585. @end example
  14586. @item
  14587. In case of anamorphic video, in order to set the output display aspect
  14588. correctly, it is necessary to use @var{sar} in the expression,
  14589. according to the relation:
  14590. @example
  14591. (ih * X / ih) * sar = output_dar
  14592. X = output_dar / sar
  14593. @end example
  14594. Thus the previous example needs to be modified to:
  14595. @example
  14596. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  14597. @end example
  14598. @item
  14599. Double the output size and put the input video in the bottom-right
  14600. corner of the output padded area:
  14601. @example
  14602. pad="2*iw:2*ih:ow-iw:oh-ih"
  14603. @end example
  14604. @end itemize
  14605. @anchor{palettegen}
  14606. @section palettegen
  14607. Generate one palette for a whole video stream.
  14608. It accepts the following options:
  14609. @table @option
  14610. @item max_colors
  14611. Set the maximum number of colors to quantize in the palette.
  14612. Note: the palette will still contain 256 colors; the unused palette entries
  14613. will be black.
  14614. @item reserve_transparent
  14615. Create a palette of 255 colors maximum and reserve the last one for
  14616. transparency. Reserving the transparency color is useful for GIF optimization.
  14617. If not set, the maximum of colors in the palette will be 256. You probably want
  14618. to disable this option for a standalone image.
  14619. Set by default.
  14620. @item transparency_color
  14621. Set the color that will be used as background for transparency.
  14622. @item stats_mode
  14623. Set statistics mode.
  14624. It accepts the following values:
  14625. @table @samp
  14626. @item full
  14627. Compute full frame histograms.
  14628. @item diff
  14629. Compute histograms only for the part that differs from previous frame. This
  14630. might be relevant to give more importance to the moving part of your input if
  14631. the background is static.
  14632. @item single
  14633. Compute new histogram for each frame.
  14634. @end table
  14635. Default value is @var{full}.
  14636. @end table
  14637. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  14638. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  14639. color quantization of the palette. This information is also visible at
  14640. @var{info} logging level.
  14641. @subsection Examples
  14642. @itemize
  14643. @item
  14644. Generate a representative palette of a given video using @command{ffmpeg}:
  14645. @example
  14646. ffmpeg -i input.mkv -vf palettegen palette.png
  14647. @end example
  14648. @end itemize
  14649. @section paletteuse
  14650. Use a palette to downsample an input video stream.
  14651. The filter takes two inputs: one video stream and a palette. The palette must
  14652. be a 256 pixels image.
  14653. It accepts the following options:
  14654. @table @option
  14655. @item dither
  14656. Select dithering mode. Available algorithms are:
  14657. @table @samp
  14658. @item bayer
  14659. Ordered 8x8 bayer dithering (deterministic)
  14660. @item heckbert
  14661. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  14662. Note: this dithering is sometimes considered "wrong" and is included as a
  14663. reference.
  14664. @item floyd_steinberg
  14665. Floyd and Steingberg dithering (error diffusion)
  14666. @item sierra2
  14667. Frankie Sierra dithering v2 (error diffusion)
  14668. @item sierra2_4a
  14669. Frankie Sierra dithering v2 "Lite" (error diffusion)
  14670. @item sierra3
  14671. Frankie Sierra dithering v3 (error diffusion)
  14672. @item burkes
  14673. Burkes dithering (error diffusion)
  14674. @item atkinson
  14675. Atkinson dithering by Bill Atkinson at Apple Computer (error diffusion)
  14676. @item none
  14677. Disable dithering.
  14678. @end table
  14679. Default is @var{sierra2_4a}.
  14680. @item bayer_scale
  14681. When @var{bayer} dithering is selected, this option defines the scale of the
  14682. pattern (how much the crosshatch pattern is visible). A low value means more
  14683. visible pattern for less banding, and higher value means less visible pattern
  14684. at the cost of more banding.
  14685. The option must be an integer value in the range [0,5]. Default is @var{2}.
  14686. @item diff_mode
  14687. If set, define the zone to process
  14688. @table @samp
  14689. @item rectangle
  14690. Only the changing rectangle will be reprocessed. This is similar to GIF
  14691. cropping/offsetting compression mechanism. This option can be useful for speed
  14692. if only a part of the image is changing, and has use cases such as limiting the
  14693. scope of the error diffusal @option{dither} to the rectangle that bounds the
  14694. moving scene (it leads to more deterministic output if the scene doesn't change
  14695. much, and as a result less moving noise and better GIF compression).
  14696. @end table
  14697. Default is @var{none}.
  14698. @item new
  14699. Take new palette for each output frame.
  14700. @item alpha_threshold
  14701. Sets the alpha threshold for transparency. Alpha values above this threshold
  14702. will be treated as completely opaque, and values below this threshold will be
  14703. treated as completely transparent.
  14704. The option must be an integer value in the range [0,255]. Default is @var{128}.
  14705. @end table
  14706. @subsection Examples
  14707. @itemize
  14708. @item
  14709. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  14710. using @command{ffmpeg}:
  14711. @example
  14712. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  14713. @end example
  14714. @end itemize
  14715. @section perspective
  14716. Correct perspective of video not recorded perpendicular to the screen.
  14717. A description of the accepted parameters follows.
  14718. @table @option
  14719. @item x0
  14720. @item y0
  14721. @item x1
  14722. @item y1
  14723. @item x2
  14724. @item y2
  14725. @item x3
  14726. @item y3
  14727. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  14728. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  14729. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  14730. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  14731. then the corners of the source will be sent to the specified coordinates.
  14732. The expressions can use the following variables:
  14733. @table @option
  14734. @item W
  14735. @item H
  14736. the width and height of video frame.
  14737. @item in
  14738. Input frame count.
  14739. @item on
  14740. Output frame count.
  14741. @end table
  14742. @item interpolation
  14743. Set interpolation for perspective correction.
  14744. It accepts the following values:
  14745. @table @samp
  14746. @item linear
  14747. @item cubic
  14748. @end table
  14749. Default value is @samp{linear}.
  14750. @item sense
  14751. Set interpretation of coordinate options.
  14752. It accepts the following values:
  14753. @table @samp
  14754. @item 0, source
  14755. Send point in the source specified by the given coordinates to
  14756. the corners of the destination.
  14757. @item 1, destination
  14758. Send the corners of the source to the point in the destination specified
  14759. by the given coordinates.
  14760. Default value is @samp{source}.
  14761. @end table
  14762. @item eval
  14763. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  14764. It accepts the following values:
  14765. @table @samp
  14766. @item init
  14767. only evaluate expressions once during the filter initialization or
  14768. when a command is processed
  14769. @item frame
  14770. evaluate expressions for each incoming frame
  14771. @end table
  14772. Default value is @samp{init}.
  14773. @end table
  14774. @section phase
  14775. Delay interlaced video by one field time so that the field order changes.
  14776. The intended use is to fix PAL movies that have been captured with the
  14777. opposite field order to the film-to-video transfer.
  14778. A description of the accepted parameters follows.
  14779. @table @option
  14780. @item mode
  14781. Set phase mode.
  14782. It accepts the following values:
  14783. @table @samp
  14784. @item t
  14785. Capture field order top-first, transfer bottom-first.
  14786. Filter will delay the bottom field.
  14787. @item b
  14788. Capture field order bottom-first, transfer top-first.
  14789. Filter will delay the top field.
  14790. @item p
  14791. Capture and transfer with the same field order. This mode only exists
  14792. for the documentation of the other options to refer to, but if you
  14793. actually select it, the filter will faithfully do nothing.
  14794. @item a
  14795. Capture field order determined automatically by field flags, transfer
  14796. opposite.
  14797. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  14798. basis using field flags. If no field information is available,
  14799. then this works just like @samp{u}.
  14800. @item u
  14801. Capture unknown or varying, transfer opposite.
  14802. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  14803. analyzing the images and selecting the alternative that produces best
  14804. match between the fields.
  14805. @item T
  14806. Capture top-first, transfer unknown or varying.
  14807. Filter selects among @samp{t} and @samp{p} using image analysis.
  14808. @item B
  14809. Capture bottom-first, transfer unknown or varying.
  14810. Filter selects among @samp{b} and @samp{p} using image analysis.
  14811. @item A
  14812. Capture determined by field flags, transfer unknown or varying.
  14813. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  14814. image analysis. If no field information is available, then this works just
  14815. like @samp{U}. This is the default mode.
  14816. @item U
  14817. Both capture and transfer unknown or varying.
  14818. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  14819. @end table
  14820. @end table
  14821. @subsection Commands
  14822. This filter supports the all above options as @ref{commands}.
  14823. @section photosensitivity
  14824. Reduce various flashes in video, so to help users with epilepsy.
  14825. It accepts the following options:
  14826. @table @option
  14827. @item frames, f
  14828. Set how many frames to use when filtering. Default is 30.
  14829. @item threshold, t
  14830. Set detection threshold factor. Default is 1.
  14831. Lower is stricter.
  14832. @item skip
  14833. Set how many pixels to skip when sampling frames. Default is 1.
  14834. Allowed range is from 1 to 1024.
  14835. @item bypass
  14836. Leave frames unchanged. Default is disabled.
  14837. @end table
  14838. @section pixdesctest
  14839. Pixel format descriptor test filter, mainly useful for internal
  14840. testing. The output video should be equal to the input video.
  14841. For example:
  14842. @example
  14843. format=monow, pixdesctest
  14844. @end example
  14845. can be used to test the monowhite pixel format descriptor definition.
  14846. @section pixelize
  14847. Apply pixelization to video stream.
  14848. The filter accepts the following options:
  14849. @table @option
  14850. @item width, w
  14851. @item height, h
  14852. Set block dimensions that will be used for pixelization.
  14853. Default value is @code{16}.
  14854. @item mode, m
  14855. Set the mode of pixelization used.
  14856. Possible values are:
  14857. @table @samp
  14858. @item avg
  14859. @item min
  14860. @item max
  14861. @end table
  14862. Default value is @code{avg}.
  14863. @item planes, p
  14864. Set what planes to filter. Default is to filter all planes.
  14865. @end table
  14866. @subsection Commands
  14867. This filter supports all options as @ref{commands}.
  14868. @section pixscope
  14869. Display sample values of color channels. Mainly useful for checking color
  14870. and levels. Minimum supported resolution is 640x480.
  14871. The filters accept the following options:
  14872. @table @option
  14873. @item x
  14874. Set scope X position, relative offset on X axis.
  14875. @item y
  14876. Set scope Y position, relative offset on Y axis.
  14877. @item w
  14878. Set scope width.
  14879. @item h
  14880. Set scope height.
  14881. @item o
  14882. Set window opacity. This window also holds statistics about pixel area.
  14883. @item wx
  14884. Set window X position, relative offset on X axis.
  14885. @item wy
  14886. Set window Y position, relative offset on Y axis.
  14887. @end table
  14888. @subsection Commands
  14889. This filter supports same @ref{commands} as options.
  14890. @section pp
  14891. Enable the specified chain of postprocessing subfilters using libpostproc. This
  14892. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  14893. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  14894. Each subfilter and some options have a short and a long name that can be used
  14895. interchangeably, i.e. dr/dering are the same.
  14896. The filters accept the following options:
  14897. @table @option
  14898. @item subfilters
  14899. Set postprocessing subfilters string.
  14900. @end table
  14901. All subfilters share common options to determine their scope:
  14902. @table @option
  14903. @item a/autoq
  14904. Honor the quality commands for this subfilter.
  14905. @item c/chrom
  14906. Do chrominance filtering, too (default).
  14907. @item y/nochrom
  14908. Do luma filtering only (no chrominance).
  14909. @item n/noluma
  14910. Do chrominance filtering only (no luma).
  14911. @end table
  14912. These options can be appended after the subfilter name, separated by a '|'.
  14913. Available subfilters are:
  14914. @table @option
  14915. @item hb/hdeblock[|difference[|flatness]]
  14916. Horizontal deblocking filter
  14917. @table @option
  14918. @item difference
  14919. Difference factor where higher values mean more deblocking (default: @code{32}).
  14920. @item flatness
  14921. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14922. @end table
  14923. @item vb/vdeblock[|difference[|flatness]]
  14924. Vertical deblocking filter
  14925. @table @option
  14926. @item difference
  14927. Difference factor where higher values mean more deblocking (default: @code{32}).
  14928. @item flatness
  14929. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14930. @end table
  14931. @item ha/hadeblock[|difference[|flatness]]
  14932. Accurate horizontal deblocking filter
  14933. @table @option
  14934. @item difference
  14935. Difference factor where higher values mean more deblocking (default: @code{32}).
  14936. @item flatness
  14937. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14938. @end table
  14939. @item va/vadeblock[|difference[|flatness]]
  14940. Accurate vertical deblocking filter
  14941. @table @option
  14942. @item difference
  14943. Difference factor where higher values mean more deblocking (default: @code{32}).
  14944. @item flatness
  14945. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14946. @end table
  14947. @end table
  14948. The horizontal and vertical deblocking filters share the difference and
  14949. flatness values so you cannot set different horizontal and vertical
  14950. thresholds.
  14951. @table @option
  14952. @item h1/x1hdeblock
  14953. Experimental horizontal deblocking filter
  14954. @item v1/x1vdeblock
  14955. Experimental vertical deblocking filter
  14956. @item dr/dering
  14957. Deringing filter
  14958. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  14959. @table @option
  14960. @item threshold1
  14961. larger -> stronger filtering
  14962. @item threshold2
  14963. larger -> stronger filtering
  14964. @item threshold3
  14965. larger -> stronger filtering
  14966. @end table
  14967. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  14968. @table @option
  14969. @item f/fullyrange
  14970. Stretch luma to @code{0-255}.
  14971. @end table
  14972. @item lb/linblenddeint
  14973. Linear blend deinterlacing filter that deinterlaces the given block by
  14974. filtering all lines with a @code{(1 2 1)} filter.
  14975. @item li/linipoldeint
  14976. Linear interpolating deinterlacing filter that deinterlaces the given block by
  14977. linearly interpolating every second line.
  14978. @item ci/cubicipoldeint
  14979. Cubic interpolating deinterlacing filter deinterlaces the given block by
  14980. cubically interpolating every second line.
  14981. @item md/mediandeint
  14982. Median deinterlacing filter that deinterlaces the given block by applying a
  14983. median filter to every second line.
  14984. @item fd/ffmpegdeint
  14985. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  14986. second line with a @code{(-1 4 2 4 -1)} filter.
  14987. @item l5/lowpass5
  14988. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  14989. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  14990. @item fq/forceQuant[|quantizer]
  14991. Overrides the quantizer table from the input with the constant quantizer you
  14992. specify.
  14993. @table @option
  14994. @item quantizer
  14995. Quantizer to use
  14996. @end table
  14997. @item de/default
  14998. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  14999. @item fa/fast
  15000. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  15001. @item ac
  15002. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  15003. @end table
  15004. @subsection Examples
  15005. @itemize
  15006. @item
  15007. Apply horizontal and vertical deblocking, deringing and automatic
  15008. brightness/contrast:
  15009. @example
  15010. pp=hb/vb/dr/al
  15011. @end example
  15012. @item
  15013. Apply default filters without brightness/contrast correction:
  15014. @example
  15015. pp=de/-al
  15016. @end example
  15017. @item
  15018. Apply default filters and temporal denoiser:
  15019. @example
  15020. pp=default/tmpnoise|1|2|3
  15021. @end example
  15022. @item
  15023. Apply deblocking on luma only, and switch vertical deblocking on or off
  15024. automatically depending on available CPU time:
  15025. @example
  15026. pp=hb|y/vb|a
  15027. @end example
  15028. @end itemize
  15029. @section pp7
  15030. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  15031. similar to spp = 6 with 7 point DCT, where only the center sample is
  15032. used after IDCT.
  15033. The filter accepts the following options:
  15034. @table @option
  15035. @item qp
  15036. Force a constant quantization parameter. It accepts an integer in range
  15037. 0 to 63. If not set, the filter will use the QP from the video stream
  15038. (if available).
  15039. @item mode
  15040. Set thresholding mode. Available modes are:
  15041. @table @samp
  15042. @item hard
  15043. Set hard thresholding.
  15044. @item soft
  15045. Set soft thresholding (better de-ringing effect, but likely blurrier).
  15046. @item medium
  15047. Set medium thresholding (good results, default).
  15048. @end table
  15049. @end table
  15050. @section premultiply
  15051. Apply alpha premultiply effect to input video stream using first plane
  15052. of second stream as alpha.
  15053. Both streams must have same dimensions and same pixel format.
  15054. The filter accepts the following option:
  15055. @table @option
  15056. @item planes
  15057. Set which planes will be processed, unprocessed planes will be copied.
  15058. By default value 0xf, all planes will be processed.
  15059. @item inplace
  15060. Do not require 2nd input for processing, instead use alpha plane from input stream.
  15061. @end table
  15062. @section prewitt
  15063. Apply prewitt operator to input video stream.
  15064. The filter accepts the following option:
  15065. @table @option
  15066. @item planes
  15067. Set which planes will be processed, unprocessed planes will be copied.
  15068. By default value 0xf, all planes will be processed.
  15069. @item scale
  15070. Set value which will be multiplied with filtered result.
  15071. @item delta
  15072. Set value which will be added to filtered result.
  15073. @end table
  15074. @subsection Commands
  15075. This filter supports the all above options as @ref{commands}.
  15076. @section pseudocolor
  15077. Alter frame colors in video with pseudocolors.
  15078. This filter accepts the following options:
  15079. @table @option
  15080. @item c0
  15081. set pixel first component expression
  15082. @item c1
  15083. set pixel second component expression
  15084. @item c2
  15085. set pixel third component expression
  15086. @item c3
  15087. set pixel fourth component expression, corresponds to the alpha component
  15088. @item index, i
  15089. set component to use as base for altering colors
  15090. @item preset, p
  15091. Pick one of built-in LUTs. By default is set to none.
  15092. Available LUTs:
  15093. @table @samp
  15094. @item magma
  15095. @item inferno
  15096. @item plasma
  15097. @item viridis
  15098. @item turbo
  15099. @item cividis
  15100. @item range1
  15101. @item range2
  15102. @item shadows
  15103. @item highlights
  15104. @item solar
  15105. @item nominal
  15106. @item preferred
  15107. @item total
  15108. @item spectral
  15109. @item cool
  15110. @item heat
  15111. @item fiery
  15112. @item blues
  15113. @item green
  15114. @item helix
  15115. @end table
  15116. @item opacity
  15117. Set opacity of output colors. Allowed range is from 0 to 1.
  15118. Default value is set to 1.
  15119. @end table
  15120. Each of the expression options specifies the expression to use for computing
  15121. the lookup table for the corresponding pixel component values.
  15122. The expressions can contain the following constants and functions:
  15123. @table @option
  15124. @item w
  15125. @item h
  15126. The input width and height.
  15127. @item val
  15128. The input value for the pixel component.
  15129. @item ymin, umin, vmin, amin
  15130. The minimum allowed component value.
  15131. @item ymax, umax, vmax, amax
  15132. The maximum allowed component value.
  15133. @end table
  15134. All expressions default to "val".
  15135. @subsection Commands
  15136. This filter supports the all above options as @ref{commands}.
  15137. @subsection Examples
  15138. @itemize
  15139. @item
  15140. Change too high luma values to gradient:
  15141. @example
  15142. 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'"
  15143. @end example
  15144. @end itemize
  15145. @section psnr
  15146. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  15147. Ratio) between two input videos.
  15148. This filter takes in input two input videos, the first input is
  15149. considered the "main" source and is passed unchanged to the
  15150. output. The second input is used as a "reference" video for computing
  15151. the PSNR.
  15152. Both video inputs must have the same resolution and pixel format for
  15153. this filter to work correctly. Also it assumes that both inputs
  15154. have the same number of frames, which are compared one by one.
  15155. The obtained average PSNR is printed through the logging system.
  15156. The filter stores the accumulated MSE (mean squared error) of each
  15157. frame, and at the end of the processing it is averaged across all frames
  15158. equally, and the following formula is applied to obtain the PSNR:
  15159. @example
  15160. PSNR = 10*log10(MAX^2/MSE)
  15161. @end example
  15162. Where MAX is the average of the maximum values of each component of the
  15163. image.
  15164. The description of the accepted parameters follows.
  15165. @table @option
  15166. @item stats_file, f
  15167. If specified the filter will use the named file to save the PSNR of
  15168. each individual frame. When filename equals "-" the data is sent to
  15169. standard output.
  15170. @item stats_version
  15171. Specifies which version of the stats file format to use. Details of
  15172. each format are written below.
  15173. Default value is 1.
  15174. @item stats_add_max
  15175. Determines whether the max value is output to the stats log.
  15176. Default value is 0.
  15177. Requires stats_version >= 2. If this is set and stats_version < 2,
  15178. the filter will return an error.
  15179. @end table
  15180. This filter also supports the @ref{framesync} options.
  15181. The file printed if @var{stats_file} is selected, contains a sequence of
  15182. key/value pairs of the form @var{key}:@var{value} for each compared
  15183. couple of frames.
  15184. If a @var{stats_version} greater than 1 is specified, a header line precedes
  15185. the list of per-frame-pair stats, with key value pairs following the frame
  15186. format with the following parameters:
  15187. @table @option
  15188. @item psnr_log_version
  15189. The version of the log file format. Will match @var{stats_version}.
  15190. @item fields
  15191. A comma separated list of the per-frame-pair parameters included in
  15192. the log.
  15193. @end table
  15194. A description of each shown per-frame-pair parameter follows:
  15195. @table @option
  15196. @item n
  15197. sequential number of the input frame, starting from 1
  15198. @item mse_avg
  15199. Mean Square Error pixel-by-pixel average difference of the compared
  15200. frames, averaged over all the image components.
  15201. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  15202. Mean Square Error pixel-by-pixel average difference of the compared
  15203. frames for the component specified by the suffix.
  15204. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  15205. Peak Signal to Noise ratio of the compared frames for the component
  15206. specified by the suffix.
  15207. @item max_avg, max_y, max_u, max_v
  15208. Maximum allowed value for each channel, and average over all
  15209. channels.
  15210. @end table
  15211. @subsection Examples
  15212. @itemize
  15213. @item
  15214. For example:
  15215. @example
  15216. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  15217. [main][ref] psnr="stats_file=stats.log" [out]
  15218. @end example
  15219. On this example the input file being processed is compared with the
  15220. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  15221. is stored in @file{stats.log}.
  15222. @item
  15223. Another example with different containers:
  15224. @example
  15225. 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 -
  15226. @end example
  15227. @end itemize
  15228. @anchor{pullup}
  15229. @section pullup
  15230. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  15231. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  15232. content.
  15233. The pullup filter is designed to take advantage of future context in making
  15234. its decisions. This filter is stateless in the sense that it does not lock
  15235. onto a pattern to follow, but it instead looks forward to the following
  15236. fields in order to identify matches and rebuild progressive frames.
  15237. To produce content with an even framerate, insert the fps filter after
  15238. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  15239. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  15240. The filter accepts the following options:
  15241. @table @option
  15242. @item jl
  15243. @item jr
  15244. @item jt
  15245. @item jb
  15246. These options set the amount of "junk" to ignore at the left, right, top, and
  15247. bottom of the image, respectively. Left and right are in units of 8 pixels,
  15248. while top and bottom are in units of 2 lines.
  15249. The default is 8 pixels on each side.
  15250. @item sb
  15251. Set the strict breaks. Setting this option to 1 will reduce the chances of
  15252. filter generating an occasional mismatched frame, but it may also cause an
  15253. excessive number of frames to be dropped during high motion sequences.
  15254. Conversely, setting it to -1 will make filter match fields more easily.
  15255. This may help processing of video where there is slight blurring between
  15256. the fields, but may also cause there to be interlaced frames in the output.
  15257. Default value is @code{0}.
  15258. @item mp
  15259. Set the metric plane to use. It accepts the following values:
  15260. @table @samp
  15261. @item l
  15262. Use luma plane.
  15263. @item u
  15264. Use chroma blue plane.
  15265. @item v
  15266. Use chroma red plane.
  15267. @end table
  15268. This option may be set to use chroma plane instead of the default luma plane
  15269. for doing filter's computations. This may improve accuracy on very clean
  15270. source material, but more likely will decrease accuracy, especially if there
  15271. is chroma noise (rainbow effect) or any grayscale video.
  15272. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  15273. load and make pullup usable in realtime on slow machines.
  15274. @end table
  15275. For best results (without duplicated frames in the output file) it is
  15276. necessary to change the output frame rate. For example, to inverse
  15277. telecine NTSC input:
  15278. @example
  15279. ffmpeg -i input -vf pullup -r 24000/1001 ...
  15280. @end example
  15281. @section qp
  15282. Change video quantization parameters (QP).
  15283. The filter accepts the following option:
  15284. @table @option
  15285. @item qp
  15286. Set expression for quantization parameter.
  15287. @end table
  15288. The expression is evaluated through the eval API and can contain, among others,
  15289. the following constants:
  15290. @table @var
  15291. @item known
  15292. 1 if index is not 129, 0 otherwise.
  15293. @item qp
  15294. Sequential index starting from -129 to 128.
  15295. @end table
  15296. @subsection Examples
  15297. @itemize
  15298. @item
  15299. Some equation like:
  15300. @example
  15301. qp=2+2*sin(PI*qp)
  15302. @end example
  15303. @end itemize
  15304. @section random
  15305. Flush video frames from internal cache of frames into a random order.
  15306. No frame is discarded.
  15307. Inspired by @ref{frei0r} nervous filter.
  15308. @table @option
  15309. @item frames
  15310. Set size in number of frames of internal cache, in range from @code{2} to
  15311. @code{512}. Default is @code{30}.
  15312. @item seed
  15313. Set seed for random number generator, must be an integer included between
  15314. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15315. less than @code{0}, the filter will try to use a good random seed on a
  15316. best effort basis.
  15317. @end table
  15318. @section readeia608
  15319. Read closed captioning (EIA-608) information from the top lines of a video frame.
  15320. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  15321. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  15322. with EIA-608 data (starting from 0). A description of each metadata value follows:
  15323. @table @option
  15324. @item lavfi.readeia608.X.cc
  15325. The two bytes stored as EIA-608 data (printed in hexadecimal).
  15326. @item lavfi.readeia608.X.line
  15327. The number of the line on which the EIA-608 data was identified and read.
  15328. @end table
  15329. This filter accepts the following options:
  15330. @table @option
  15331. @item scan_min
  15332. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  15333. @item scan_max
  15334. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  15335. @item spw
  15336. Set the ratio of width reserved for sync code detection.
  15337. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  15338. @item chp
  15339. Enable checking the parity bit. In the event of a parity error, the filter will output
  15340. @code{0x00} for that character. Default is false.
  15341. @item lp
  15342. Lowpass lines prior to further processing. Default is enabled.
  15343. @end table
  15344. @subsection Commands
  15345. This filter supports the all above options as @ref{commands}.
  15346. @subsection Examples
  15347. @itemize
  15348. @item
  15349. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  15350. @example
  15351. 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
  15352. @end example
  15353. @end itemize
  15354. @section readvitc
  15355. Read vertical interval timecode (VITC) information from the top lines of a
  15356. video frame.
  15357. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  15358. timecode value, if a valid timecode has been detected. Further metadata key
  15359. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  15360. timecode data has been found or not.
  15361. This filter accepts the following options:
  15362. @table @option
  15363. @item scan_max
  15364. Set the maximum number of lines to scan for VITC data. If the value is set to
  15365. @code{-1} the full video frame is scanned. Default is @code{45}.
  15366. @item thr_b
  15367. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  15368. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  15369. @item thr_w
  15370. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  15371. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  15372. @end table
  15373. @subsection Examples
  15374. @itemize
  15375. @item
  15376. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  15377. draw @code{--:--:--:--} as a placeholder:
  15378. @example
  15379. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  15380. @end example
  15381. @end itemize
  15382. @section remap
  15383. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  15384. Destination pixel at position (X, Y) will be picked from source (x, y) position
  15385. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  15386. value for pixel will be used for destination pixel.
  15387. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  15388. will have Xmap/Ymap video stream dimensions.
  15389. Xmap and Ymap input video streams are 16bit depth, single channel.
  15390. @table @option
  15391. @item format
  15392. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  15393. Default is @code{color}.
  15394. @item fill
  15395. Specify the color of the unmapped pixels. For the syntax of this option,
  15396. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  15397. manual,ffmpeg-utils}. Default color is @code{black}.
  15398. @end table
  15399. @section removegrain
  15400. The removegrain filter is a spatial denoiser for progressive video.
  15401. @table @option
  15402. @item m0
  15403. Set mode for the first plane.
  15404. @item m1
  15405. Set mode for the second plane.
  15406. @item m2
  15407. Set mode for the third plane.
  15408. @item m3
  15409. Set mode for the fourth plane.
  15410. @end table
  15411. Range of mode is from 0 to 24. Description of each mode follows:
  15412. @table @var
  15413. @item 0
  15414. Leave input plane unchanged. Default.
  15415. @item 1
  15416. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  15417. @item 2
  15418. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  15419. @item 3
  15420. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  15421. @item 4
  15422. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  15423. This is equivalent to a median filter.
  15424. @item 5
  15425. Line-sensitive clipping giving the minimal change.
  15426. @item 6
  15427. Line-sensitive clipping, intermediate.
  15428. @item 7
  15429. Line-sensitive clipping, intermediate.
  15430. @item 8
  15431. Line-sensitive clipping, intermediate.
  15432. @item 9
  15433. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  15434. @item 10
  15435. Replaces the target pixel with the closest neighbour.
  15436. @item 11
  15437. [1 2 1] horizontal and vertical kernel blur.
  15438. @item 12
  15439. Same as mode 11.
  15440. @item 13
  15441. Bob mode, interpolates top field from the line where the neighbours
  15442. pixels are the closest.
  15443. @item 14
  15444. Bob mode, interpolates bottom field from the line where the neighbours
  15445. pixels are the closest.
  15446. @item 15
  15447. Bob mode, interpolates top field. Same as 13 but with a more complicated
  15448. interpolation formula.
  15449. @item 16
  15450. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  15451. interpolation formula.
  15452. @item 17
  15453. Clips the pixel with the minimum and maximum of respectively the maximum and
  15454. minimum of each pair of opposite neighbour pixels.
  15455. @item 18
  15456. Line-sensitive clipping using opposite neighbours whose greatest distance from
  15457. the current pixel is minimal.
  15458. @item 19
  15459. Replaces the pixel with the average of its 8 neighbours.
  15460. @item 20
  15461. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  15462. @item 21
  15463. Clips pixels using the averages of opposite neighbour.
  15464. @item 22
  15465. Same as mode 21 but simpler and faster.
  15466. @item 23
  15467. Small edge and halo removal, but reputed useless.
  15468. @item 24
  15469. Similar as 23.
  15470. @end table
  15471. @section removelogo
  15472. Suppress a TV station logo, using an image file to determine which
  15473. pixels comprise the logo. It works by filling in the pixels that
  15474. comprise the logo with neighboring pixels.
  15475. The filter accepts the following options:
  15476. @table @option
  15477. @item filename, f
  15478. Set the filter bitmap file, which can be any image format supported by
  15479. libavformat. The width and height of the image file must match those of the
  15480. video stream being processed.
  15481. @end table
  15482. Pixels in the provided bitmap image with a value of zero are not
  15483. considered part of the logo, non-zero pixels are considered part of
  15484. the logo. If you use white (255) for the logo and black (0) for the
  15485. rest, you will be safe. For making the filter bitmap, it is
  15486. recommended to take a screen capture of a black frame with the logo
  15487. visible, and then using a threshold filter followed by the erode
  15488. filter once or twice.
  15489. If needed, little splotches can be fixed manually. Remember that if
  15490. logo pixels are not covered, the filter quality will be much
  15491. reduced. Marking too many pixels as part of the logo does not hurt as
  15492. much, but it will increase the amount of blurring needed to cover over
  15493. the image and will destroy more information than necessary, and extra
  15494. pixels will slow things down on a large logo.
  15495. @section repeatfields
  15496. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  15497. fields based on its value.
  15498. @section reverse
  15499. Reverse a video clip.
  15500. Warning: This filter requires memory to buffer the entire clip, so trimming
  15501. is suggested.
  15502. @subsection Examples
  15503. @itemize
  15504. @item
  15505. Take the first 5 seconds of a clip, and reverse it.
  15506. @example
  15507. trim=end=5,reverse
  15508. @end example
  15509. @end itemize
  15510. @section rgbashift
  15511. Shift R/G/B/A pixels horizontally and/or vertically.
  15512. The filter accepts the following options:
  15513. @table @option
  15514. @item rh
  15515. Set amount to shift red horizontally.
  15516. @item rv
  15517. Set amount to shift red vertically.
  15518. @item gh
  15519. Set amount to shift green horizontally.
  15520. @item gv
  15521. Set amount to shift green vertically.
  15522. @item bh
  15523. Set amount to shift blue horizontally.
  15524. @item bv
  15525. Set amount to shift blue vertically.
  15526. @item ah
  15527. Set amount to shift alpha horizontally.
  15528. @item av
  15529. Set amount to shift alpha vertically.
  15530. @item edge
  15531. Set edge mode, can be @var{smear}, default, or @var{warp}.
  15532. @end table
  15533. @subsection Commands
  15534. This filter supports the all above options as @ref{commands}.
  15535. @section roberts
  15536. Apply roberts cross operator to input video stream.
  15537. The filter accepts the following option:
  15538. @table @option
  15539. @item planes
  15540. Set which planes will be processed, unprocessed planes will be copied.
  15541. By default value 0xf, all planes will be processed.
  15542. @item scale
  15543. Set value which will be multiplied with filtered result.
  15544. @item delta
  15545. Set value which will be added to filtered result.
  15546. @end table
  15547. @subsection Commands
  15548. This filter supports the all above options as @ref{commands}.
  15549. @section rotate
  15550. Rotate video by an arbitrary angle expressed in radians.
  15551. The filter accepts the following options:
  15552. A description of the optional parameters follows.
  15553. @table @option
  15554. @item angle, a
  15555. Set an expression for the angle by which to rotate the input video
  15556. clockwise, expressed as a number of radians. A negative value will
  15557. result in a counter-clockwise rotation. By default it is set to "0".
  15558. This expression is evaluated for each frame.
  15559. @item out_w, ow
  15560. Set the output width expression, default value is "iw".
  15561. This expression is evaluated just once during configuration.
  15562. @item out_h, oh
  15563. Set the output height expression, default value is "ih".
  15564. This expression is evaluated just once during configuration.
  15565. @item bilinear
  15566. Enable bilinear interpolation if set to 1, a value of 0 disables
  15567. it. Default value is 1.
  15568. @item fillcolor, c
  15569. Set the color used to fill the output area not covered by the rotated
  15570. image. For the general syntax of this option, check the
  15571. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15572. If the special value "none" is selected then no
  15573. background is printed (useful for example if the background is never shown).
  15574. Default value is "black".
  15575. @end table
  15576. The expressions for the angle and the output size can contain the
  15577. following constants and functions:
  15578. @table @option
  15579. @item n
  15580. sequential number of the input frame, starting from 0. It is always NAN
  15581. before the first frame is filtered.
  15582. @item t
  15583. time in seconds of the input frame, it is set to 0 when the filter is
  15584. configured. It is always NAN before the first frame is filtered.
  15585. @item hsub
  15586. @item vsub
  15587. horizontal and vertical chroma subsample values. For example for the
  15588. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15589. @item in_w, iw
  15590. @item in_h, ih
  15591. the input video width and height
  15592. @item out_w, ow
  15593. @item out_h, oh
  15594. the output width and height, that is the size of the padded area as
  15595. specified by the @var{width} and @var{height} expressions
  15596. @item rotw(a)
  15597. @item roth(a)
  15598. the minimal width/height required for completely containing the input
  15599. video rotated by @var{a} radians.
  15600. These are only available when computing the @option{out_w} and
  15601. @option{out_h} expressions.
  15602. @end table
  15603. @subsection Examples
  15604. @itemize
  15605. @item
  15606. Rotate the input by PI/6 radians clockwise:
  15607. @example
  15608. rotate=PI/6
  15609. @end example
  15610. @item
  15611. Rotate the input by PI/6 radians counter-clockwise:
  15612. @example
  15613. rotate=-PI/6
  15614. @end example
  15615. @item
  15616. Rotate the input by 45 degrees clockwise:
  15617. @example
  15618. rotate=45*PI/180
  15619. @end example
  15620. @item
  15621. Apply a constant rotation with period T, starting from an angle of PI/3:
  15622. @example
  15623. rotate=PI/3+2*PI*t/T
  15624. @end example
  15625. @item
  15626. Make the input video rotation oscillating with a period of T
  15627. seconds and an amplitude of A radians:
  15628. @example
  15629. rotate=A*sin(2*PI/T*t)
  15630. @end example
  15631. @item
  15632. Rotate the video, output size is chosen so that the whole rotating
  15633. input video is always completely contained in the output:
  15634. @example
  15635. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  15636. @end example
  15637. @item
  15638. Rotate the video, reduce the output size so that no background is ever
  15639. shown:
  15640. @example
  15641. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  15642. @end example
  15643. @end itemize
  15644. @subsection Commands
  15645. The filter supports the following commands:
  15646. @table @option
  15647. @item a, angle
  15648. Set the angle expression.
  15649. The command accepts the same syntax of the corresponding option.
  15650. If the specified expression is not valid, it is kept at its current
  15651. value.
  15652. @end table
  15653. @section sab
  15654. Apply Shape Adaptive Blur.
  15655. The filter accepts the following options:
  15656. @table @option
  15657. @item luma_radius, lr
  15658. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  15659. value is 1.0. A greater value will result in a more blurred image, and
  15660. in slower processing.
  15661. @item luma_pre_filter_radius, lpfr
  15662. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  15663. value is 1.0.
  15664. @item luma_strength, ls
  15665. Set luma maximum difference between pixels to still be considered, must
  15666. be a value in the 0.1-100.0 range, default value is 1.0.
  15667. @item chroma_radius, cr
  15668. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  15669. greater value will result in a more blurred image, and in slower
  15670. processing.
  15671. @item chroma_pre_filter_radius, cpfr
  15672. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  15673. @item chroma_strength, cs
  15674. Set chroma maximum difference between pixels to still be considered,
  15675. must be a value in the -0.9-100.0 range.
  15676. @end table
  15677. Each chroma option value, if not explicitly specified, is set to the
  15678. corresponding luma option value.
  15679. @anchor{scale}
  15680. @section scale
  15681. Scale (resize) the input video, using the libswscale library.
  15682. The scale filter forces the output display aspect ratio to be the same
  15683. of the input, by changing the output sample aspect ratio.
  15684. If the input image format is different from the format requested by
  15685. the next filter, the scale filter will convert the input to the
  15686. requested format.
  15687. @subsection Options
  15688. The filter accepts the following options, or any of the options
  15689. supported by the libswscale scaler.
  15690. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  15691. the complete list of scaler options.
  15692. @table @option
  15693. @item width, w
  15694. @item height, h
  15695. Set the output video dimension expression. Default value is the input
  15696. dimension.
  15697. If the @var{width} or @var{w} value is 0, the input width is used for
  15698. the output. If the @var{height} or @var{h} value is 0, the input height
  15699. is used for the output.
  15700. If one and only one of the values is -n with n >= 1, the scale filter
  15701. will use a value that maintains the aspect ratio of the input image,
  15702. calculated from the other specified dimension. After that it will,
  15703. however, make sure that the calculated dimension is divisible by n and
  15704. adjust the value if necessary.
  15705. If both values are -n with n >= 1, the behavior will be identical to
  15706. both values being set to 0 as previously detailed.
  15707. See below for the list of accepted constants for use in the dimension
  15708. expression.
  15709. @item eval
  15710. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15711. @table @samp
  15712. @item init
  15713. Only evaluate expressions once during the filter initialization or when a command is processed.
  15714. @item frame
  15715. Evaluate expressions for each incoming frame.
  15716. @end table
  15717. Default value is @samp{init}.
  15718. @item interl
  15719. Set the interlacing mode. It accepts the following values:
  15720. @table @samp
  15721. @item 1
  15722. Force interlaced aware scaling.
  15723. @item 0
  15724. Do not apply interlaced scaling.
  15725. @item -1
  15726. Select interlaced aware scaling depending on whether the source frames
  15727. are flagged as interlaced or not.
  15728. @end table
  15729. Default value is @samp{0}.
  15730. @item flags
  15731. Set libswscale scaling flags. See
  15732. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15733. complete list of values. If not explicitly specified the filter applies
  15734. the default flags.
  15735. @item param0, param1
  15736. Set libswscale input parameters for scaling algorithms that need them. See
  15737. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15738. complete documentation. If not explicitly specified the filter applies
  15739. empty parameters.
  15740. @item size, s
  15741. Set the video size. For the syntax of this option, check the
  15742. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15743. @item in_color_matrix
  15744. @item out_color_matrix
  15745. Set in/output YCbCr color space type.
  15746. This allows the autodetected value to be overridden as well as allows forcing
  15747. a specific value used for the output and encoder.
  15748. If not specified, the color space type depends on the pixel format.
  15749. Possible values:
  15750. @table @samp
  15751. @item auto
  15752. Choose automatically.
  15753. @item bt709
  15754. Format conforming to International Telecommunication Union (ITU)
  15755. Recommendation BT.709.
  15756. @item fcc
  15757. Set color space conforming to the United States Federal Communications
  15758. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  15759. @item bt601
  15760. @item bt470
  15761. @item smpte170m
  15762. Set color space conforming to:
  15763. @itemize
  15764. @item
  15765. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  15766. @item
  15767. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  15768. @item
  15769. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  15770. @end itemize
  15771. @item smpte240m
  15772. Set color space conforming to SMPTE ST 240:1999.
  15773. @item bt2020
  15774. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  15775. @end table
  15776. @item in_range
  15777. @item out_range
  15778. Set in/output YCbCr sample range.
  15779. This allows the autodetected value to be overridden as well as allows forcing
  15780. a specific value used for the output and encoder. If not specified, the
  15781. range depends on the pixel format. Possible values:
  15782. @table @samp
  15783. @item auto/unknown
  15784. Choose automatically.
  15785. @item jpeg/full/pc
  15786. Set full range (0-255 in case of 8-bit luma).
  15787. @item mpeg/limited/tv
  15788. Set "MPEG" range (16-235 in case of 8-bit luma).
  15789. @end table
  15790. @item force_original_aspect_ratio
  15791. Enable decreasing or increasing output video width or height if necessary to
  15792. keep the original aspect ratio. Possible values:
  15793. @table @samp
  15794. @item disable
  15795. Scale the video as specified and disable this feature.
  15796. @item decrease
  15797. The output video dimensions will automatically be decreased if needed.
  15798. @item increase
  15799. The output video dimensions will automatically be increased if needed.
  15800. @end table
  15801. One useful instance of this option is that when you know a specific device's
  15802. maximum allowed resolution, you can use this to limit the output video to
  15803. that, while retaining the aspect ratio. For example, device A allows
  15804. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15805. decrease) and specifying 1280x720 to the command line makes the output
  15806. 1280x533.
  15807. Please note that this is a different thing than specifying -1 for @option{w}
  15808. or @option{h}, you still need to specify the output resolution for this option
  15809. to work.
  15810. @item force_divisible_by
  15811. Ensures that both the output dimensions, width and height, are divisible by the
  15812. given integer when used together with @option{force_original_aspect_ratio}. This
  15813. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15814. This option respects the value set for @option{force_original_aspect_ratio},
  15815. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15816. may be slightly modified.
  15817. This option can be handy if you need to have a video fit within or exceed
  15818. a defined resolution using @option{force_original_aspect_ratio} but also have
  15819. encoder restrictions on width or height divisibility.
  15820. @end table
  15821. The values of the @option{w} and @option{h} options are expressions
  15822. containing the following constants:
  15823. @table @var
  15824. @item in_w
  15825. @item in_h
  15826. The input width and height
  15827. @item iw
  15828. @item ih
  15829. These are the same as @var{in_w} and @var{in_h}.
  15830. @item out_w
  15831. @item out_h
  15832. The output (scaled) width and height
  15833. @item ow
  15834. @item oh
  15835. These are the same as @var{out_w} and @var{out_h}
  15836. @item a
  15837. The same as @var{iw} / @var{ih}
  15838. @item sar
  15839. input sample aspect ratio
  15840. @item dar
  15841. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15842. @item hsub
  15843. @item vsub
  15844. horizontal and vertical input chroma subsample values. For example for the
  15845. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15846. @item ohsub
  15847. @item ovsub
  15848. horizontal and vertical output chroma subsample values. For example for the
  15849. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15850. @item n
  15851. The (sequential) number of the input frame, starting from 0.
  15852. Only available with @code{eval=frame}.
  15853. @item t
  15854. The presentation timestamp of the input frame, expressed as a number of
  15855. seconds. Only available with @code{eval=frame}.
  15856. @item pos
  15857. The position (byte offset) of the frame in the input stream, or NaN if
  15858. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15859. Only available with @code{eval=frame}.
  15860. Deprecated, do not use.
  15861. @end table
  15862. @subsection Examples
  15863. @itemize
  15864. @item
  15865. Scale the input video to a size of 200x100
  15866. @example
  15867. scale=w=200:h=100
  15868. @end example
  15869. This is equivalent to:
  15870. @example
  15871. scale=200:100
  15872. @end example
  15873. or:
  15874. @example
  15875. scale=200x100
  15876. @end example
  15877. @item
  15878. Specify a size abbreviation for the output size:
  15879. @example
  15880. scale=qcif
  15881. @end example
  15882. which can also be written as:
  15883. @example
  15884. scale=size=qcif
  15885. @end example
  15886. @item
  15887. Scale the input to 2x:
  15888. @example
  15889. scale=w=2*iw:h=2*ih
  15890. @end example
  15891. @item
  15892. The above is the same as:
  15893. @example
  15894. scale=2*in_w:2*in_h
  15895. @end example
  15896. @item
  15897. Scale the input to 2x with forced interlaced scaling:
  15898. @example
  15899. scale=2*iw:2*ih:interl=1
  15900. @end example
  15901. @item
  15902. Scale the input to half size:
  15903. @example
  15904. scale=w=iw/2:h=ih/2
  15905. @end example
  15906. @item
  15907. Increase the width, and set the height to the same size:
  15908. @example
  15909. scale=3/2*iw:ow
  15910. @end example
  15911. @item
  15912. Seek Greek harmony:
  15913. @example
  15914. scale=iw:1/PHI*iw
  15915. scale=ih*PHI:ih
  15916. @end example
  15917. @item
  15918. Increase the height, and set the width to 3/2 of the height:
  15919. @example
  15920. scale=w=3/2*oh:h=3/5*ih
  15921. @end example
  15922. @item
  15923. Increase the size, making the size a multiple of the chroma
  15924. subsample values:
  15925. @example
  15926. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  15927. @end example
  15928. @item
  15929. Increase the width to a maximum of 500 pixels,
  15930. keeping the same aspect ratio as the input:
  15931. @example
  15932. scale=w='min(500\, iw*3/2):h=-1'
  15933. @end example
  15934. @item
  15935. Make pixels square by combining scale and setsar:
  15936. @example
  15937. scale='trunc(ih*dar):ih',setsar=1/1
  15938. @end example
  15939. @item
  15940. Make pixels square by combining scale and setsar,
  15941. making sure the resulting resolution is even (required by some codecs):
  15942. @example
  15943. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  15944. @end example
  15945. @end itemize
  15946. @subsection Commands
  15947. This filter supports the following commands:
  15948. @table @option
  15949. @item width, w
  15950. @item height, h
  15951. Set the output video dimension expression.
  15952. The command accepts the same syntax of the corresponding option.
  15953. If the specified expression is not valid, it is kept at its current
  15954. value.
  15955. @end table
  15956. @anchor{scale_cuda}
  15957. @section scale_cuda
  15958. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  15959. Setting the output width and height works in the same way as for the @ref{scale} filter.
  15960. The filter accepts the following options:
  15961. @table @option
  15962. @item w
  15963. @item h
  15964. Set the output video dimension expression. Default value is the input dimension.
  15965. Allows for the same expressions as the @ref{scale} filter.
  15966. @item interp_algo
  15967. Sets the algorithm used for scaling:
  15968. @table @var
  15969. @item nearest
  15970. Nearest neighbour
  15971. Used by default if input parameters match the desired output.
  15972. @item bilinear
  15973. Bilinear
  15974. @item bicubic
  15975. Bicubic
  15976. This is the default.
  15977. @item lanczos
  15978. Lanczos
  15979. @end table
  15980. @item format
  15981. Controls the output pixel format. By default, or if none is specified, the input
  15982. pixel format is used.
  15983. The filter does not support converting between YUV and RGB pixel formats.
  15984. @item passthrough
  15985. If set to 0, every frame is processed, even if no conversion is necessary.
  15986. This mode can be useful to use the filter as a buffer for a downstream
  15987. frame-consumer that exhausts the limited decoder frame pool.
  15988. If set to 1, frames are passed through as-is if they match the desired output
  15989. parameters. This is the default behaviour.
  15990. @item param
  15991. Algorithm-Specific parameter.
  15992. Affects the curves of the bicubic algorithm.
  15993. @item force_original_aspect_ratio
  15994. @item force_divisible_by
  15995. Work the same as the identical @ref{scale} filter options.
  15996. @end table
  15997. @subsection Examples
  15998. @itemize
  15999. @item
  16000. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  16001. @example
  16002. scale_cuda=-2:720:format=yuv420p
  16003. @end example
  16004. @item
  16005. Upscale to 4K using nearest neighbour algorithm.
  16006. @example
  16007. scale_cuda=4096:2160:interp_algo=nearest
  16008. @end example
  16009. @item
  16010. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  16011. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  16012. decoders frame pool.
  16013. @example
  16014. scale_cuda=passthrough=0
  16015. @end example
  16016. @end itemize
  16017. @anchor{scale_npp}
  16018. @section scale_npp
  16019. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  16020. format conversion on CUDA video frames. Setting the output width and height
  16021. works in the same way as for the @var{scale} filter.
  16022. The following additional options are accepted:
  16023. @table @option
  16024. @item format
  16025. The pixel format of the output CUDA frames. If set to the string "same" (the
  16026. default), the input format will be kept. Note that automatic format negotiation
  16027. and conversion is not yet supported for hardware frames
  16028. @item interp_algo
  16029. The interpolation algorithm used for resizing. One of the following:
  16030. @table @option
  16031. @item nn
  16032. Nearest neighbour.
  16033. @item linear
  16034. @item cubic
  16035. @item cubic2p_bspline
  16036. 2-parameter cubic (B=1, C=0)
  16037. @item cubic2p_catmullrom
  16038. 2-parameter cubic (B=0, C=1/2)
  16039. @item cubic2p_b05c03
  16040. 2-parameter cubic (B=1/2, C=3/10)
  16041. @item super
  16042. Supersampling
  16043. @item lanczos
  16044. @end table
  16045. @item force_original_aspect_ratio
  16046. Enable decreasing or increasing output video width or height if necessary to
  16047. keep the original aspect ratio. Possible values:
  16048. @table @samp
  16049. @item disable
  16050. Scale the video as specified and disable this feature.
  16051. @item decrease
  16052. The output video dimensions will automatically be decreased if needed.
  16053. @item increase
  16054. The output video dimensions will automatically be increased if needed.
  16055. @end table
  16056. One useful instance of this option is that when you know a specific device's
  16057. maximum allowed resolution, you can use this to limit the output video to
  16058. that, while retaining the aspect ratio. For example, device A allows
  16059. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  16060. decrease) and specifying 1280x720 to the command line makes the output
  16061. 1280x533.
  16062. Please note that this is a different thing than specifying -1 for @option{w}
  16063. or @option{h}, you still need to specify the output resolution for this option
  16064. to work.
  16065. @item force_divisible_by
  16066. Ensures that both the output dimensions, width and height, are divisible by the
  16067. given integer when used together with @option{force_original_aspect_ratio}. This
  16068. works similar to using @code{-n} in the @option{w} and @option{h} options.
  16069. This option respects the value set for @option{force_original_aspect_ratio},
  16070. increasing or decreasing the resolution accordingly. The video's aspect ratio
  16071. may be slightly modified.
  16072. This option can be handy if you need to have a video fit within or exceed
  16073. a defined resolution using @option{force_original_aspect_ratio} but also have
  16074. encoder restrictions on width or height divisibility.
  16075. @item eval
  16076. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  16077. @table @samp
  16078. @item init
  16079. Only evaluate expressions once during the filter initialization or when a command is processed.
  16080. @item frame
  16081. Evaluate expressions for each incoming frame.
  16082. @end table
  16083. @end table
  16084. The values of the @option{w} and @option{h} options are expressions
  16085. containing the following constants:
  16086. @table @var
  16087. @item in_w
  16088. @item in_h
  16089. The input width and height
  16090. @item iw
  16091. @item ih
  16092. These are the same as @var{in_w} and @var{in_h}.
  16093. @item out_w
  16094. @item out_h
  16095. The output (scaled) width and height
  16096. @item ow
  16097. @item oh
  16098. These are the same as @var{out_w} and @var{out_h}
  16099. @item a
  16100. The same as @var{iw} / @var{ih}
  16101. @item sar
  16102. input sample aspect ratio
  16103. @item dar
  16104. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16105. @item n
  16106. The (sequential) number of the input frame, starting from 0.
  16107. Only available with @code{eval=frame}.
  16108. @item t
  16109. The presentation timestamp of the input frame, expressed as a number of
  16110. seconds. Only available with @code{eval=frame}.
  16111. @item pos
  16112. The position (byte offset) of the frame in the input stream, or NaN if
  16113. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16114. Only available with @code{eval=frame}.
  16115. Deprecated, do not use.
  16116. @end table
  16117. @section scale2ref
  16118. Scale (resize) the input video, based on a reference video.
  16119. See the scale filter for available options, scale2ref supports the same but
  16120. uses the reference video instead of the main input as basis. scale2ref also
  16121. supports the following additional constants for the @option{w} and
  16122. @option{h} options:
  16123. @table @var
  16124. @item main_w
  16125. @item main_h
  16126. The main input video's width and height
  16127. @item main_a
  16128. The same as @var{main_w} / @var{main_h}
  16129. @item main_sar
  16130. The main input video's sample aspect ratio
  16131. @item main_dar, mdar
  16132. The main input video's display aspect ratio. Calculated from
  16133. @code{(main_w / main_h) * main_sar}.
  16134. @item main_hsub
  16135. @item main_vsub
  16136. The main input video's horizontal and vertical chroma subsample values.
  16137. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  16138. is 1.
  16139. @item main_n
  16140. The (sequential) number of the main input frame, starting from 0.
  16141. Only available with @code{eval=frame}.
  16142. @item main_t
  16143. The presentation timestamp of the main input frame, expressed as a number of
  16144. seconds. Only available with @code{eval=frame}.
  16145. @item main_pos
  16146. The position (byte offset) of the frame in the main input stream, or NaN if
  16147. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16148. Only available with @code{eval=frame}.
  16149. @end table
  16150. @subsection Examples
  16151. @itemize
  16152. @item
  16153. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  16154. @example
  16155. 'scale2ref[b][a];[a][b]overlay'
  16156. @end example
  16157. @item
  16158. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  16159. @example
  16160. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  16161. @end example
  16162. @end itemize
  16163. @subsection Commands
  16164. This filter supports the following commands:
  16165. @table @option
  16166. @item width, w
  16167. @item height, h
  16168. Set the output video dimension expression.
  16169. The command accepts the same syntax of the corresponding option.
  16170. If the specified expression is not valid, it is kept at its current
  16171. value.
  16172. @end table
  16173. @section scale2ref_npp
  16174. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  16175. video, based on a reference video.
  16176. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  16177. but uses the reference video instead of the main input as basis. scale2ref_npp
  16178. also supports the following additional constants for the @option{w} and
  16179. @option{h} options:
  16180. @table @var
  16181. @item main_w
  16182. @item main_h
  16183. The main input video's width and height
  16184. @item main_a
  16185. The same as @var{main_w} / @var{main_h}
  16186. @item main_sar
  16187. The main input video's sample aspect ratio
  16188. @item main_dar, mdar
  16189. The main input video's display aspect ratio. Calculated from
  16190. @code{(main_w / main_h) * main_sar}.
  16191. @item main_n
  16192. The (sequential) number of the main input frame, starting from 0.
  16193. Only available with @code{eval=frame}.
  16194. @item main_t
  16195. The presentation timestamp of the main input frame, expressed as a number of
  16196. seconds. Only available with @code{eval=frame}.
  16197. @item main_pos
  16198. The position (byte offset) of the frame in the main input stream, or NaN if
  16199. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16200. Only available with @code{eval=frame}.
  16201. @end table
  16202. @subsection Examples
  16203. @itemize
  16204. @item
  16205. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  16206. @example
  16207. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  16208. @end example
  16209. @item
  16210. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  16211. @example
  16212. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  16213. @end example
  16214. @end itemize
  16215. @section scale_vt
  16216. Scale and convert the color parameters using VTPixelTransferSession.
  16217. The filter accepts the following options:
  16218. @table @option
  16219. @item w
  16220. @item h
  16221. Set the output video dimension expression. Default value is the input dimension.
  16222. @item color_matrix
  16223. Set the output colorspace matrix.
  16224. @item color_primaries
  16225. Set the output color primaries.
  16226. @item color_transfer
  16227. Set the output transfer characteristics.
  16228. @end table
  16229. @section scharr
  16230. Apply scharr operator to input video stream.
  16231. The filter accepts the following option:
  16232. @table @option
  16233. @item planes
  16234. Set which planes will be processed, unprocessed planes will be copied.
  16235. By default value 0xf, all planes will be processed.
  16236. @item scale
  16237. Set value which will be multiplied with filtered result.
  16238. @item delta
  16239. Set value which will be added to filtered result.
  16240. @end table
  16241. @subsection Commands
  16242. This filter supports the all above options as @ref{commands}.
  16243. @section scroll
  16244. Scroll input video horizontally and/or vertically by constant speed.
  16245. The filter accepts the following options:
  16246. @table @option
  16247. @item horizontal, h
  16248. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16249. Negative values changes scrolling direction.
  16250. @item vertical, v
  16251. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16252. Negative values changes scrolling direction.
  16253. @item hpos
  16254. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  16255. @item vpos
  16256. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  16257. @end table
  16258. @subsection Commands
  16259. This filter supports the following @ref{commands}:
  16260. @table @option
  16261. @item horizontal, h
  16262. Set the horizontal scrolling speed.
  16263. @item vertical, v
  16264. Set the vertical scrolling speed.
  16265. @end table
  16266. @anchor{scdet}
  16267. @section scdet
  16268. Detect video scene change.
  16269. This filter sets frame metadata with mafd between frame, the scene score, and
  16270. forward the frame to the next filter, so they can use these metadata to detect
  16271. scene change or others.
  16272. In addition, this filter logs a message and sets frame metadata when it detects
  16273. a scene change by @option{threshold}.
  16274. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  16275. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  16276. to detect scene change.
  16277. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  16278. detect scene change with @option{threshold}.
  16279. The filter accepts the following options:
  16280. @table @option
  16281. @item threshold, t
  16282. Set the scene change detection threshold as a percentage of maximum change. Good
  16283. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  16284. @code{[0., 100.]}.
  16285. Default value is @code{10.}.
  16286. @item sc_pass, s
  16287. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  16288. You can enable it if you want to get snapshot of scene change frames only.
  16289. @end table
  16290. @anchor{selectivecolor}
  16291. @section selectivecolor
  16292. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  16293. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  16294. by the "purity" of the color (that is, how saturated it already is).
  16295. This filter is similar to the Adobe Photoshop Selective Color tool.
  16296. The filter accepts the following options:
  16297. @table @option
  16298. @item correction_method
  16299. Select color correction method.
  16300. Available values are:
  16301. @table @samp
  16302. @item absolute
  16303. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  16304. component value).
  16305. @item relative
  16306. Specified adjustments are relative to the original component value.
  16307. @end table
  16308. Default is @code{absolute}.
  16309. @item reds
  16310. Adjustments for red pixels (pixels where the red component is the maximum)
  16311. @item yellows
  16312. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  16313. @item greens
  16314. Adjustments for green pixels (pixels where the green component is the maximum)
  16315. @item cyans
  16316. Adjustments for cyan pixels (pixels where the red component is the minimum)
  16317. @item blues
  16318. Adjustments for blue pixels (pixels where the blue component is the maximum)
  16319. @item magentas
  16320. Adjustments for magenta pixels (pixels where the green component is the minimum)
  16321. @item whites
  16322. Adjustments for white pixels (pixels where all components are greater than 128)
  16323. @item neutrals
  16324. Adjustments for all pixels except pure black and pure white
  16325. @item blacks
  16326. Adjustments for black pixels (pixels where all components are lesser than 128)
  16327. @item psfile
  16328. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  16329. @end table
  16330. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  16331. 4 space separated floating point adjustment values in the [-1,1] range,
  16332. respectively to adjust the amount of cyan, magenta, yellow and black for the
  16333. pixels of its range.
  16334. @subsection Examples
  16335. @itemize
  16336. @item
  16337. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  16338. increase magenta by 27% in blue areas:
  16339. @example
  16340. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  16341. @end example
  16342. @item
  16343. Use a Photoshop selective color preset:
  16344. @example
  16345. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  16346. @end example
  16347. @end itemize
  16348. @anchor{separatefields}
  16349. @section separatefields
  16350. The @code{separatefields} takes a frame-based video input and splits
  16351. each frame into its components fields, producing a new half height clip
  16352. with twice the frame rate and twice the frame count.
  16353. This filter use field-dominance information in frame to decide which
  16354. of each pair of fields to place first in the output.
  16355. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  16356. @section setdar, setsar
  16357. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  16358. output video.
  16359. This is done by changing the specified Sample (aka Pixel) Aspect
  16360. Ratio, according to the following equation:
  16361. @example
  16362. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  16363. @end example
  16364. Keep in mind that the @code{setdar} filter does not modify the pixel
  16365. dimensions of the video frame. Also, the display aspect ratio set by
  16366. this filter may be changed by later filters in the filterchain,
  16367. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  16368. applied.
  16369. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  16370. the filter output video.
  16371. Note that as a consequence of the application of this filter, the
  16372. output display aspect ratio will change according to the equation
  16373. above.
  16374. Keep in mind that the sample aspect ratio set by the @code{setsar}
  16375. filter may be changed by later filters in the filterchain, e.g. if
  16376. another "setsar" or a "setdar" filter is applied.
  16377. It accepts the following parameters:
  16378. @table @option
  16379. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  16380. Set the aspect ratio used by the filter.
  16381. The parameter can be a floating point number string, or an expression. If the
  16382. parameter is not specified, the value "0" is assumed, meaning that the same
  16383. input value is used.
  16384. @item max
  16385. Set the maximum integer value to use for expressing numerator and
  16386. denominator when reducing the expressed aspect ratio to a rational.
  16387. Default value is @code{100}.
  16388. @end table
  16389. The parameter @var{sar} is an expression containing the following constants:
  16390. @table @option
  16391. @item w, h
  16392. The input width and height.
  16393. @item a
  16394. Same as @var{w} / @var{h}.
  16395. @item sar
  16396. The input sample aspect ratio.
  16397. @item dar
  16398. The input display aspect ratio. It is the same as
  16399. (@var{w} / @var{h}) * @var{sar}.
  16400. @item hsub, vsub
  16401. Horizontal and vertical chroma subsample values. For example, for the
  16402. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16403. @end table
  16404. @subsection Examples
  16405. @itemize
  16406. @item
  16407. To change the display aspect ratio to 16:9, specify one of the following:
  16408. @example
  16409. setdar=dar=1.77777
  16410. setdar=dar=16/9
  16411. @end example
  16412. @item
  16413. To change the sample aspect ratio to 10:11, specify:
  16414. @example
  16415. setsar=sar=10/11
  16416. @end example
  16417. @item
  16418. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  16419. 1000 in the aspect ratio reduction, use the command:
  16420. @example
  16421. setdar=ratio=16/9:max=1000
  16422. @end example
  16423. @end itemize
  16424. @anchor{setfield}
  16425. @section setfield
  16426. Force field for the output video frame.
  16427. The @code{setfield} filter marks the interlace type field for the
  16428. output frames. It does not change the input frame, but only sets the
  16429. corresponding property, which affects how the frame is treated by
  16430. following filters (e.g. @code{fieldorder} or @code{yadif}).
  16431. The filter accepts the following options:
  16432. @table @option
  16433. @item mode
  16434. Available values are:
  16435. @table @samp
  16436. @item auto
  16437. Keep the same field property.
  16438. @item bff
  16439. Mark the frame as bottom-field-first.
  16440. @item tff
  16441. Mark the frame as top-field-first.
  16442. @item prog
  16443. Mark the frame as progressive.
  16444. @end table
  16445. @end table
  16446. @anchor{setparams}
  16447. @section setparams
  16448. Force frame parameter for the output video frame.
  16449. The @code{setparams} filter marks interlace and color range for the
  16450. output frames. It does not change the input frame, but only sets the
  16451. corresponding property, which affects how the frame is treated by
  16452. filters/encoders.
  16453. @table @option
  16454. @item field_mode
  16455. Available values are:
  16456. @table @samp
  16457. @item auto
  16458. Keep the same field property (default).
  16459. @item bff
  16460. Mark the frame as bottom-field-first.
  16461. @item tff
  16462. Mark the frame as top-field-first.
  16463. @item prog
  16464. Mark the frame as progressive.
  16465. @end table
  16466. @item range
  16467. Available values are:
  16468. @table @samp
  16469. @item auto
  16470. Keep the same color range property (default).
  16471. @item unspecified, unknown
  16472. Mark the frame as unspecified color range.
  16473. @item limited, tv, mpeg
  16474. Mark the frame as limited range.
  16475. @item full, pc, jpeg
  16476. Mark the frame as full range.
  16477. @end table
  16478. @item color_primaries
  16479. Set the color primaries.
  16480. Available values are:
  16481. @table @samp
  16482. @item auto
  16483. Keep the same color primaries property (default).
  16484. @item bt709
  16485. @item unknown
  16486. @item bt470m
  16487. @item bt470bg
  16488. @item smpte170m
  16489. @item smpte240m
  16490. @item film
  16491. @item bt2020
  16492. @item smpte428
  16493. @item smpte431
  16494. @item smpte432
  16495. @item jedec-p22
  16496. @end table
  16497. @item color_trc
  16498. Set the color transfer.
  16499. Available values are:
  16500. @table @samp
  16501. @item auto
  16502. Keep the same color trc property (default).
  16503. @item bt709
  16504. @item unknown
  16505. @item bt470m
  16506. @item bt470bg
  16507. @item smpte170m
  16508. @item smpte240m
  16509. @item linear
  16510. @item log100
  16511. @item log316
  16512. @item iec61966-2-4
  16513. @item bt1361e
  16514. @item iec61966-2-1
  16515. @item bt2020-10
  16516. @item bt2020-12
  16517. @item smpte2084
  16518. @item smpte428
  16519. @item arib-std-b67
  16520. @end table
  16521. @item colorspace
  16522. Set the colorspace.
  16523. Available values are:
  16524. @table @samp
  16525. @item auto
  16526. Keep the same colorspace property (default).
  16527. @item gbr
  16528. @item bt709
  16529. @item unknown
  16530. @item fcc
  16531. @item bt470bg
  16532. @item smpte170m
  16533. @item smpte240m
  16534. @item ycgco
  16535. @item bt2020nc
  16536. @item bt2020c
  16537. @item smpte2085
  16538. @item chroma-derived-nc
  16539. @item chroma-derived-c
  16540. @item ictcp
  16541. @end table
  16542. @end table
  16543. @section sharpen_npp
  16544. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  16545. border control.
  16546. The following additional options are accepted:
  16547. @table @option
  16548. @item border_type
  16549. Type of sampling to be used ad frame borders. One of the following:
  16550. @table @option
  16551. @item replicate
  16552. Replicate pixel values.
  16553. @end table
  16554. @end table
  16555. @section shear
  16556. Apply shear transform to input video.
  16557. This filter supports the following options:
  16558. @table @option
  16559. @item shx
  16560. Shear factor in X-direction. Default value is 0.
  16561. Allowed range is from -2 to 2.
  16562. @item shy
  16563. Shear factor in Y-direction. Default value is 0.
  16564. Allowed range is from -2 to 2.
  16565. @item fillcolor, c
  16566. Set the color used to fill the output area not covered by the transformed
  16567. video. For the general syntax of this option, check the
  16568. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16569. If the special value "none" is selected then no
  16570. background is printed (useful for example if the background is never shown).
  16571. Default value is "black".
  16572. @item interp
  16573. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  16574. @end table
  16575. @subsection Commands
  16576. This filter supports the all above options as @ref{commands}.
  16577. @section showinfo
  16578. Show a line containing various information for each input video frame.
  16579. The input video is not modified.
  16580. This filter supports the following options:
  16581. @table @option
  16582. @item checksum
  16583. Calculate checksums of each plane. By default enabled.
  16584. @end table
  16585. The shown line contains a sequence of key/value pairs of the form
  16586. @var{key}:@var{value}.
  16587. The following values are shown in the output:
  16588. @table @option
  16589. @item n
  16590. The (sequential) number of the input frame, starting from 0.
  16591. @item pts
  16592. The Presentation TimeStamp of the input frame, expressed as a number of
  16593. time base units. The time base unit depends on the filter input pad.
  16594. @item pts_time
  16595. The Presentation TimeStamp of the input frame, expressed as a number of
  16596. seconds.
  16597. @item fmt
  16598. The pixel format name.
  16599. @item sar
  16600. The sample aspect ratio of the input frame, expressed in the form
  16601. @var{num}/@var{den}.
  16602. @item s
  16603. The size of the input frame. For the syntax of this option, check the
  16604. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16605. @item i
  16606. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  16607. for bottom field first).
  16608. @item iskey
  16609. This is 1 if the frame is a key frame, 0 otherwise.
  16610. @item type
  16611. The picture type of the input frame ("I" for an I-frame, "P" for a
  16612. P-frame, "B" for a B-frame, or "?" for an unknown type).
  16613. Also refer to the documentation of the @code{AVPictureType} enum and of
  16614. the @code{av_get_picture_type_char} function defined in
  16615. @file{libavutil/avutil.h}.
  16616. @item checksum
  16617. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  16618. @item plane_checksum
  16619. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  16620. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  16621. @item mean
  16622. The mean value of pixels in each plane of the input frame, expressed in the form
  16623. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  16624. @item stdev
  16625. The standard deviation of pixel values in each plane of the input frame, expressed
  16626. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  16627. @end table
  16628. @section showpalette
  16629. Displays the 256 colors palette of each frame. This filter is only relevant for
  16630. @var{pal8} pixel format frames.
  16631. It accepts the following option:
  16632. @table @option
  16633. @item s
  16634. Set the size of the box used to represent one palette color entry. Default is
  16635. @code{30} (for a @code{30x30} pixel box).
  16636. @end table
  16637. @section shuffleframes
  16638. Reorder and/or duplicate and/or drop video frames.
  16639. It accepts the following parameters:
  16640. @table @option
  16641. @item mapping
  16642. Set the destination indexes of input frames.
  16643. This is space or '|' separated list of indexes that maps input frames to output
  16644. frames. Number of indexes also sets maximal value that each index may have.
  16645. '-1' index have special meaning and that is to drop frame.
  16646. @end table
  16647. The first frame has the index 0. The default is to keep the input unchanged.
  16648. @subsection Examples
  16649. @itemize
  16650. @item
  16651. Swap second and third frame of every three frames of the input:
  16652. @example
  16653. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  16654. @end example
  16655. @item
  16656. Swap 10th and 1st frame of every ten frames of the input:
  16657. @example
  16658. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  16659. @end example
  16660. @end itemize
  16661. @section shufflepixels
  16662. Reorder pixels in video frames.
  16663. This filter accepts the following options:
  16664. @table @option
  16665. @item direction, d
  16666. Set shuffle direction. Can be forward or inverse direction.
  16667. Default direction is forward.
  16668. @item mode, m
  16669. Set shuffle mode. Can be horizontal, vertical or block mode.
  16670. @item width, w
  16671. @item height, h
  16672. Set shuffle block_size. In case of horizontal shuffle mode only width
  16673. part of size is used, and in case of vertical shuffle mode only height
  16674. part of size is used.
  16675. @item seed, s
  16676. Set random seed used with shuffling pixels. Mainly useful to set to be able
  16677. to reverse filtering process to get original input.
  16678. For example, to reverse forward shuffle you need to use same parameters
  16679. and exact same seed and to set direction to inverse.
  16680. @end table
  16681. @section shuffleplanes
  16682. Reorder and/or duplicate video planes.
  16683. It accepts the following parameters:
  16684. @table @option
  16685. @item map0
  16686. The index of the input plane to be used as the first output plane.
  16687. @item map1
  16688. The index of the input plane to be used as the second output plane.
  16689. @item map2
  16690. The index of the input plane to be used as the third output plane.
  16691. @item map3
  16692. The index of the input plane to be used as the fourth output plane.
  16693. @end table
  16694. The first plane has the index 0. The default is to keep the input unchanged.
  16695. @subsection Examples
  16696. @itemize
  16697. @item
  16698. Swap the second and third planes of the input:
  16699. @example
  16700. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  16701. @end example
  16702. @end itemize
  16703. @anchor{signalstats}
  16704. @section signalstats
  16705. Evaluate various visual metrics that assist in determining issues associated
  16706. with the digitization of analog video media.
  16707. By default the filter will log these metadata values:
  16708. @table @option
  16709. @item YMIN
  16710. Display the minimal Y value contained within the input frame. Expressed in
  16711. range of [0-255].
  16712. @item YLOW
  16713. Display the Y value at the 10% percentile within the input frame. Expressed in
  16714. range of [0-255].
  16715. @item YAVG
  16716. Display the average Y value within the input frame. Expressed in range of
  16717. [0-255].
  16718. @item YHIGH
  16719. Display the Y value at the 90% percentile within the input frame. Expressed in
  16720. range of [0-255].
  16721. @item YMAX
  16722. Display the maximum Y value contained within the input frame. Expressed in
  16723. range of [0-255].
  16724. @item UMIN
  16725. Display the minimal U value contained within the input frame. Expressed in
  16726. range of [0-255].
  16727. @item ULOW
  16728. Display the U value at the 10% percentile within the input frame. Expressed in
  16729. range of [0-255].
  16730. @item UAVG
  16731. Display the average U value within the input frame. Expressed in range of
  16732. [0-255].
  16733. @item UHIGH
  16734. Display the U value at the 90% percentile within the input frame. Expressed in
  16735. range of [0-255].
  16736. @item UMAX
  16737. Display the maximum U value contained within the input frame. Expressed in
  16738. range of [0-255].
  16739. @item VMIN
  16740. Display the minimal V value contained within the input frame. Expressed in
  16741. range of [0-255].
  16742. @item VLOW
  16743. Display the V value at the 10% percentile within the input frame. Expressed in
  16744. range of [0-255].
  16745. @item VAVG
  16746. Display the average V value within the input frame. Expressed in range of
  16747. [0-255].
  16748. @item VHIGH
  16749. Display the V value at the 90% percentile within the input frame. Expressed in
  16750. range of [0-255].
  16751. @item VMAX
  16752. Display the maximum V value contained within the input frame. Expressed in
  16753. range of [0-255].
  16754. @item SATMIN
  16755. Display the minimal saturation value contained within the input frame.
  16756. Expressed in range of [0-~181.02].
  16757. @item SATLOW
  16758. Display the saturation value at the 10% percentile within the input frame.
  16759. Expressed in range of [0-~181.02].
  16760. @item SATAVG
  16761. Display the average saturation value within the input frame. Expressed in range
  16762. of [0-~181.02].
  16763. @item SATHIGH
  16764. Display the saturation value at the 90% percentile within the input frame.
  16765. Expressed in range of [0-~181.02].
  16766. @item SATMAX
  16767. Display the maximum saturation value contained within the input frame.
  16768. Expressed in range of [0-~181.02].
  16769. @item HUEMED
  16770. Display the median value for hue within the input frame. Expressed in range of
  16771. [0-360].
  16772. @item HUEAVG
  16773. Display the average value for hue within the input frame. Expressed in range of
  16774. [0-360].
  16775. @item YDIF
  16776. Display the average of sample value difference between all values of the Y
  16777. plane in the current frame and corresponding values of the previous input frame.
  16778. Expressed in range of [0-255].
  16779. @item UDIF
  16780. Display the average of sample value difference between all values of the U
  16781. plane in the current frame and corresponding values of the previous input frame.
  16782. Expressed in range of [0-255].
  16783. @item VDIF
  16784. Display the average of sample value difference between all values of the V
  16785. plane in the current frame and corresponding values of the previous input frame.
  16786. Expressed in range of [0-255].
  16787. @item YBITDEPTH
  16788. Display bit depth of Y plane in current frame.
  16789. Expressed in range of [0-16].
  16790. @item UBITDEPTH
  16791. Display bit depth of U plane in current frame.
  16792. Expressed in range of [0-16].
  16793. @item VBITDEPTH
  16794. Display bit depth of V plane in current frame.
  16795. Expressed in range of [0-16].
  16796. @end table
  16797. The filter accepts the following options:
  16798. @table @option
  16799. @item stat
  16800. @item out
  16801. @option{stat} specify an additional form of image analysis.
  16802. @option{out} output video with the specified type of pixel highlighted.
  16803. Both options accept the following values:
  16804. @table @samp
  16805. @item tout
  16806. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  16807. unlike the neighboring pixels of the same field. Examples of temporal outliers
  16808. include the results of video dropouts, head clogs, or tape tracking issues.
  16809. @item vrep
  16810. Identify @var{vertical line repetition}. Vertical line repetition includes
  16811. similar rows of pixels within a frame. In born-digital video vertical line
  16812. repetition is common, but this pattern is uncommon in video digitized from an
  16813. analog source. When it occurs in video that results from the digitization of an
  16814. analog source it can indicate concealment from a dropout compensator.
  16815. @item brng
  16816. Identify pixels that fall outside of legal broadcast range.
  16817. @end table
  16818. @item color, c
  16819. Set the highlight color for the @option{out} option. The default color is
  16820. yellow.
  16821. @end table
  16822. @subsection Examples
  16823. @itemize
  16824. @item
  16825. Output data of various video metrics:
  16826. @example
  16827. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  16828. @end example
  16829. @item
  16830. Output specific data about the minimum and maximum values of the Y plane per frame:
  16831. @example
  16832. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  16833. @end example
  16834. @item
  16835. Playback video while highlighting pixels that are outside of broadcast range in red.
  16836. @example
  16837. ffplay example.mov -vf signalstats="out=brng:color=red"
  16838. @end example
  16839. @item
  16840. Playback video with signalstats metadata drawn over the frame.
  16841. @example
  16842. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  16843. @end example
  16844. The contents of signalstat_drawtext.txt used in the command are:
  16845. @example
  16846. time %@{pts:hms@}
  16847. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  16848. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  16849. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  16850. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  16851. @end example
  16852. @end itemize
  16853. @anchor{signature}
  16854. @section signature
  16855. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  16856. input. In this case the matching between the inputs can be calculated additionally.
  16857. The filter always passes through the first input. The signature of each stream can
  16858. be written into a file.
  16859. It accepts the following options:
  16860. @table @option
  16861. @item detectmode
  16862. Enable or disable the matching process.
  16863. Available values are:
  16864. @table @samp
  16865. @item off
  16866. Disable the calculation of a matching (default).
  16867. @item full
  16868. Calculate the matching for the whole video and output whether the whole video
  16869. matches or only parts.
  16870. @item fast
  16871. Calculate only until a matching is found or the video ends. Should be faster in
  16872. some cases.
  16873. @end table
  16874. @item nb_inputs
  16875. Set the number of inputs. The option value must be a non negative integer.
  16876. Default value is 1.
  16877. @item filename
  16878. Set the path to which the output is written. If there is more than one input,
  16879. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  16880. integer), that will be replaced with the input number. If no filename is
  16881. specified, no output will be written. This is the default.
  16882. @item format
  16883. Choose the output format.
  16884. Available values are:
  16885. @table @samp
  16886. @item binary
  16887. Use the specified binary representation (default).
  16888. @item xml
  16889. Use the specified xml representation.
  16890. @end table
  16891. @item th_d
  16892. Set threshold to detect one word as similar. The option value must be an integer
  16893. greater than zero. The default value is 9000.
  16894. @item th_dc
  16895. Set threshold to detect all words as similar. The option value must be an integer
  16896. greater than zero. The default value is 60000.
  16897. @item th_xh
  16898. Set threshold to detect frames as similar. The option value must be an integer
  16899. greater than zero. The default value is 116.
  16900. @item th_di
  16901. Set the minimum length of a sequence in frames to recognize it as matching
  16902. sequence. The option value must be a non negative integer value.
  16903. The default value is 0.
  16904. @item th_it
  16905. Set the minimum relation, that matching frames to all frames must have.
  16906. The option value must be a double value between 0 and 1. The default value is 0.5.
  16907. @end table
  16908. @subsection Examples
  16909. @itemize
  16910. @item
  16911. To calculate the signature of an input video and store it in signature.bin:
  16912. @example
  16913. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  16914. @end example
  16915. @item
  16916. To detect whether two videos match and store the signatures in XML format in
  16917. signature0.xml and signature1.xml:
  16918. @example
  16919. 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 -
  16920. @end example
  16921. @end itemize
  16922. @anchor{siti}
  16923. @section siti
  16924. Calculate Spatial Information (SI) and Temporal Information (TI) scores for a video,
  16925. as defined in ITU-T Rec. P.910 (11/21): Subjective video quality assessment methods
  16926. for multimedia applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
  16927. Note that this is a legacy implementation that corresponds to a superseded recommendation.
  16928. Refer to ITU-T Rec. P.910 (07/22) for the latest version: @url{https://www.itu.int/rec/T-REC-P.910-202207-I/en}
  16929. It accepts the following option:
  16930. @table @option
  16931. @item print_summary
  16932. If set to 1, Summary statistics will be printed to the console. Default 0.
  16933. @end table
  16934. @subsection Examples
  16935. @itemize
  16936. @item
  16937. To calculate SI/TI metrics and print summary:
  16938. @example
  16939. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  16940. @end example
  16941. @end itemize
  16942. @anchor{smartblur}
  16943. @section smartblur
  16944. Blur the input video without impacting the outlines.
  16945. It accepts the following options:
  16946. @table @option
  16947. @item luma_radius, lr
  16948. Set the luma radius. The option value must be a float number in
  16949. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16950. used to blur the image (slower if larger). Default value is 1.0.
  16951. @item luma_strength, ls
  16952. Set the luma strength. The option value must be a float number
  16953. in the range [-1.0,1.0] that configures the blurring. A value included
  16954. in [0.0,1.0] will blur the image whereas a value included in
  16955. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  16956. @item luma_threshold, lt
  16957. Set the luma threshold used as a coefficient to determine
  16958. whether a pixel should be blurred or not. The option value must be an
  16959. integer in the range [-30,30]. A value of 0 will filter all the image,
  16960. a value included in [0,30] will filter flat areas and a value included
  16961. in [-30,0] will filter edges. Default value is 0.
  16962. @item chroma_radius, cr
  16963. Set the chroma radius. The option value must be a float number in
  16964. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16965. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  16966. @item chroma_strength, cs
  16967. Set the chroma strength. The option value must be a float number
  16968. in the range [-1.0,1.0] that configures the blurring. A value included
  16969. in [0.0,1.0] will blur the image whereas a value included in
  16970. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  16971. @item chroma_threshold, ct
  16972. Set the chroma threshold used as a coefficient to determine
  16973. whether a pixel should be blurred or not. The option value must be an
  16974. integer in the range [-30,30]. A value of 0 will filter all the image,
  16975. a value included in [0,30] will filter flat areas and a value included
  16976. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  16977. @end table
  16978. If a chroma option is not explicitly set, the corresponding luma value
  16979. is set.
  16980. @section sobel
  16981. Apply sobel operator to input video stream.
  16982. The filter accepts the following option:
  16983. @table @option
  16984. @item planes
  16985. Set which planes will be processed, unprocessed planes will be copied.
  16986. By default value 0xf, all planes will be processed.
  16987. @item scale
  16988. Set value which will be multiplied with filtered result.
  16989. @item delta
  16990. Set value which will be added to filtered result.
  16991. @end table
  16992. @subsection Commands
  16993. This filter supports the all above options as @ref{commands}.
  16994. @anchor{spp}
  16995. @section spp
  16996. Apply a simple postprocessing filter that compresses and decompresses the image
  16997. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  16998. and average the results.
  16999. The filter accepts the following options:
  17000. @table @option
  17001. @item quality
  17002. Set quality. This option defines the number of levels for averaging. It accepts
  17003. an integer in the range 0-6. If set to @code{0}, the filter will have no
  17004. effect. A value of @code{6} means the higher quality. For each increment of
  17005. that value the speed drops by a factor of approximately 2. Default value is
  17006. @code{3}.
  17007. @item qp
  17008. Force a constant quantization parameter. If not set, the filter will use the QP
  17009. from the video stream (if available).
  17010. @item mode
  17011. Set thresholding mode. Available modes are:
  17012. @table @samp
  17013. @item hard
  17014. Set hard thresholding (default).
  17015. @item soft
  17016. Set soft thresholding (better de-ringing effect, but likely blurrier).
  17017. @end table
  17018. @item use_bframe_qp
  17019. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  17020. option may cause flicker since the B-Frames have often larger QP. Default is
  17021. @code{0} (not enabled).
  17022. @end table
  17023. @subsection Commands
  17024. This filter supports the following commands:
  17025. @table @option
  17026. @item quality, level
  17027. Set quality level. The value @code{max} can be used to set the maximum level,
  17028. currently @code{6}.
  17029. @end table
  17030. @anchor{sr}
  17031. @section sr
  17032. Scale the input by applying one of the super-resolution methods based on
  17033. convolutional neural networks. Supported models:
  17034. @itemize
  17035. @item
  17036. Super-Resolution Convolutional Neural Network model (SRCNN).
  17037. See @url{https://arxiv.org/abs/1501.00092}.
  17038. @item
  17039. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  17040. See @url{https://arxiv.org/abs/1609.05158}.
  17041. @end itemize
  17042. Training scripts as well as scripts for model file (.pb) saving can be found at
  17043. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  17044. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  17045. The filter accepts the following options:
  17046. @table @option
  17047. @item dnn_backend
  17048. Specify which DNN backend to use for model loading and execution. This option accepts
  17049. the following values:
  17050. @table @samp
  17051. @item tensorflow
  17052. TensorFlow backend. To enable this backend you
  17053. need to install the TensorFlow for C library (see
  17054. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  17055. @code{--enable-libtensorflow}
  17056. @end table
  17057. @item model
  17058. Set path to model file specifying network architecture and its parameters.
  17059. Note that different backends use different file formats. TensorFlow, OpenVINO backend
  17060. can load files for only its format.
  17061. @item scale_factor
  17062. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  17063. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  17064. input upscaled using bicubic upscaling with proper scale factor.
  17065. @end table
  17066. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  17067. @section ssim
  17068. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  17069. This filter takes in input two input videos, the first input is
  17070. considered the "main" source and is passed unchanged to the
  17071. output. The second input is used as a "reference" video for computing
  17072. the SSIM.
  17073. Both video inputs must have the same resolution and pixel format for
  17074. this filter to work correctly. Also it assumes that both inputs
  17075. have the same number of frames, which are compared one by one.
  17076. The filter stores the calculated SSIM of each frame.
  17077. The description of the accepted parameters follows.
  17078. @table @option
  17079. @item stats_file, f
  17080. If specified the filter will use the named file to save the SSIM of
  17081. each individual frame. When filename equals "-" the data is sent to
  17082. standard output.
  17083. @end table
  17084. The file printed if @var{stats_file} is selected, contains a sequence of
  17085. key/value pairs of the form @var{key}:@var{value} for each compared
  17086. couple of frames.
  17087. A description of each shown parameter follows:
  17088. @table @option
  17089. @item n
  17090. sequential number of the input frame, starting from 1
  17091. @item Y, U, V, R, G, B
  17092. SSIM of the compared frames for the component specified by the suffix.
  17093. @item All
  17094. SSIM of the compared frames for the whole frame.
  17095. @item dB
  17096. Same as above but in dB representation.
  17097. @end table
  17098. This filter also supports the @ref{framesync} options.
  17099. @subsection Examples
  17100. @itemize
  17101. @item
  17102. For example:
  17103. @example
  17104. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  17105. [main][ref] ssim="stats_file=stats.log" [out]
  17106. @end example
  17107. On this example the input file being processed is compared with the
  17108. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  17109. is stored in @file{stats.log}.
  17110. @item
  17111. Another example with both psnr and ssim at same time:
  17112. @example
  17113. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  17114. @end example
  17115. @item
  17116. Another example with different containers:
  17117. @example
  17118. 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 -
  17119. @end example
  17120. @end itemize
  17121. @section stereo3d
  17122. Convert between different stereoscopic image formats.
  17123. The filters accept the following options:
  17124. @table @option
  17125. @item in
  17126. Set stereoscopic image format of input.
  17127. Available values for input image formats are:
  17128. @table @samp
  17129. @item sbsl
  17130. side by side parallel (left eye left, right eye right)
  17131. @item sbsr
  17132. side by side crosseye (right eye left, left eye right)
  17133. @item sbs2l
  17134. side by side parallel with half width resolution
  17135. (left eye left, right eye right)
  17136. @item sbs2r
  17137. side by side crosseye with half width resolution
  17138. (right eye left, left eye right)
  17139. @item abl
  17140. @item tbl
  17141. above-below (left eye above, right eye below)
  17142. @item abr
  17143. @item tbr
  17144. above-below (right eye above, left eye below)
  17145. @item ab2l
  17146. @item tb2l
  17147. above-below with half height resolution
  17148. (left eye above, right eye below)
  17149. @item ab2r
  17150. @item tb2r
  17151. above-below with half height resolution
  17152. (right eye above, left eye below)
  17153. @item al
  17154. alternating frames (left eye first, right eye second)
  17155. @item ar
  17156. alternating frames (right eye first, left eye second)
  17157. @item irl
  17158. interleaved rows (left eye has top row, right eye starts on next row)
  17159. @item irr
  17160. interleaved rows (right eye has top row, left eye starts on next row)
  17161. @item icl
  17162. interleaved columns, left eye first
  17163. @item icr
  17164. interleaved columns, right eye first
  17165. Default value is @samp{sbsl}.
  17166. @end table
  17167. @item out
  17168. Set stereoscopic image format of output.
  17169. @table @samp
  17170. @item sbsl
  17171. side by side parallel (left eye left, right eye right)
  17172. @item sbsr
  17173. side by side crosseye (right eye left, left eye right)
  17174. @item sbs2l
  17175. side by side parallel with half width resolution
  17176. (left eye left, right eye right)
  17177. @item sbs2r
  17178. side by side crosseye with half width resolution
  17179. (right eye left, left eye right)
  17180. @item abl
  17181. @item tbl
  17182. above-below (left eye above, right eye below)
  17183. @item abr
  17184. @item tbr
  17185. above-below (right eye above, left eye below)
  17186. @item ab2l
  17187. @item tb2l
  17188. above-below with half height resolution
  17189. (left eye above, right eye below)
  17190. @item ab2r
  17191. @item tb2r
  17192. above-below with half height resolution
  17193. (right eye above, left eye below)
  17194. @item al
  17195. alternating frames (left eye first, right eye second)
  17196. @item ar
  17197. alternating frames (right eye first, left eye second)
  17198. @item irl
  17199. interleaved rows (left eye has top row, right eye starts on next row)
  17200. @item irr
  17201. interleaved rows (right eye has top row, left eye starts on next row)
  17202. @item arbg
  17203. anaglyph red/blue gray
  17204. (red filter on left eye, blue filter on right eye)
  17205. @item argg
  17206. anaglyph red/green gray
  17207. (red filter on left eye, green filter on right eye)
  17208. @item arcg
  17209. anaglyph red/cyan gray
  17210. (red filter on left eye, cyan filter on right eye)
  17211. @item arch
  17212. anaglyph red/cyan half colored
  17213. (red filter on left eye, cyan filter on right eye)
  17214. @item arcc
  17215. anaglyph red/cyan color
  17216. (red filter on left eye, cyan filter on right eye)
  17217. @item arcd
  17218. anaglyph red/cyan color optimized with the least squares projection of dubois
  17219. (red filter on left eye, cyan filter on right eye)
  17220. @item agmg
  17221. anaglyph green/magenta gray
  17222. (green filter on left eye, magenta filter on right eye)
  17223. @item agmh
  17224. anaglyph green/magenta half colored
  17225. (green filter on left eye, magenta filter on right eye)
  17226. @item agmc
  17227. anaglyph green/magenta colored
  17228. (green filter on left eye, magenta filter on right eye)
  17229. @item agmd
  17230. anaglyph green/magenta color optimized with the least squares projection of dubois
  17231. (green filter on left eye, magenta filter on right eye)
  17232. @item aybg
  17233. anaglyph yellow/blue gray
  17234. (yellow filter on left eye, blue filter on right eye)
  17235. @item aybh
  17236. anaglyph yellow/blue half colored
  17237. (yellow filter on left eye, blue filter on right eye)
  17238. @item aybc
  17239. anaglyph yellow/blue colored
  17240. (yellow filter on left eye, blue filter on right eye)
  17241. @item aybd
  17242. anaglyph yellow/blue color optimized with the least squares projection of dubois
  17243. (yellow filter on left eye, blue filter on right eye)
  17244. @item ml
  17245. mono output (left eye only)
  17246. @item mr
  17247. mono output (right eye only)
  17248. @item chl
  17249. checkerboard, left eye first
  17250. @item chr
  17251. checkerboard, right eye first
  17252. @item icl
  17253. interleaved columns, left eye first
  17254. @item icr
  17255. interleaved columns, right eye first
  17256. @item hdmi
  17257. HDMI frame pack
  17258. @end table
  17259. Default value is @samp{arcd}.
  17260. @end table
  17261. @subsection Examples
  17262. @itemize
  17263. @item
  17264. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  17265. @example
  17266. stereo3d=sbsl:aybd
  17267. @end example
  17268. @item
  17269. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  17270. @example
  17271. stereo3d=abl:sbsr
  17272. @end example
  17273. @end itemize
  17274. @section streamselect, astreamselect
  17275. Select video or audio streams.
  17276. The filter accepts the following options:
  17277. @table @option
  17278. @item inputs
  17279. Set number of inputs. Default is 2.
  17280. @item map
  17281. Set input indexes to remap to outputs.
  17282. @end table
  17283. @subsection Commands
  17284. The @code{streamselect} and @code{astreamselect} filter supports the following
  17285. commands:
  17286. @table @option
  17287. @item map
  17288. Set input indexes to remap to outputs.
  17289. @end table
  17290. @subsection Examples
  17291. @itemize
  17292. @item
  17293. Select first 5 seconds 1st stream and rest of time 2nd stream:
  17294. @example
  17295. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  17296. @end example
  17297. @item
  17298. Same as above, but for audio:
  17299. @example
  17300. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  17301. @end example
  17302. @end itemize
  17303. @anchor{subtitles}
  17304. @section subtitles
  17305. Draw subtitles on top of input video using the libass library.
  17306. To enable compilation of this filter you need to configure FFmpeg with
  17307. @code{--enable-libass}. This filter also requires a build with libavcodec and
  17308. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  17309. Alpha) subtitles format.
  17310. The filter accepts the following options:
  17311. @table @option
  17312. @item filename, f
  17313. Set the filename of the subtitle file to read. It must be specified.
  17314. @item original_size
  17315. Specify the size of the original video, the video for which the ASS file
  17316. was composed. For the syntax of this option, check the
  17317. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17318. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  17319. correctly scale the fonts if the aspect ratio has been changed.
  17320. @item fontsdir
  17321. Set a directory path containing fonts that can be used by the filter.
  17322. These fonts will be used in addition to whatever the font provider uses.
  17323. @item alpha
  17324. Process alpha channel, by default alpha channel is untouched.
  17325. @item charenc
  17326. Set subtitles input character encoding. @code{subtitles} filter only. Only
  17327. useful if not UTF-8.
  17328. @item stream_index, si
  17329. Set subtitles stream index. @code{subtitles} filter only.
  17330. @item force_style
  17331. Override default style or script info parameters of the subtitles. It accepts a
  17332. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  17333. @item wrap_unicode
  17334. Break lines according to the Unicode Line Breaking Algorithm. Availability requires
  17335. at least libass release 0.17.0 (or LIBASS_VERSION 0x01600010), @emph{and} libass must
  17336. have been built with libunibreak.
  17337. The option is enabled by default except for native ASS.
  17338. @end table
  17339. If the first key is not specified, it is assumed that the first value
  17340. specifies the @option{filename}.
  17341. For example, to render the file @file{sub.srt} on top of the input
  17342. video, use the command:
  17343. @example
  17344. subtitles=sub.srt
  17345. @end example
  17346. which is equivalent to:
  17347. @example
  17348. subtitles=filename=sub.srt
  17349. @end example
  17350. To render the default subtitles stream from file @file{video.mkv}, use:
  17351. @example
  17352. subtitles=video.mkv
  17353. @end example
  17354. To render the second subtitles stream from that file, use:
  17355. @example
  17356. subtitles=video.mkv:si=1
  17357. @end example
  17358. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  17359. @code{DejaVu Serif}, use:
  17360. @example
  17361. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  17362. @end example
  17363. @section super2xsai
  17364. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  17365. Interpolate) pixel art scaling algorithm.
  17366. Useful for enlarging pixel art images without reducing sharpness.
  17367. @section swaprect
  17368. Swap two rectangular objects in video.
  17369. This filter accepts the following options:
  17370. @table @option
  17371. @item w
  17372. Set object width.
  17373. @item h
  17374. Set object height.
  17375. @item x1
  17376. Set 1st rect x coordinate.
  17377. @item y1
  17378. Set 1st rect y coordinate.
  17379. @item x2
  17380. Set 2nd rect x coordinate.
  17381. @item y2
  17382. Set 2nd rect y coordinate.
  17383. All expressions are evaluated once for each frame.
  17384. @end table
  17385. The all options are expressions containing the following constants:
  17386. @table @option
  17387. @item w
  17388. @item h
  17389. The input width and height.
  17390. @item a
  17391. same as @var{w} / @var{h}
  17392. @item sar
  17393. input sample aspect ratio
  17394. @item dar
  17395. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  17396. @item n
  17397. The number of the input frame, starting from 0.
  17398. @item t
  17399. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  17400. @item pos
  17401. the position in the file of the input frame, NAN if unknown; deprecated,
  17402. do not use
  17403. @end table
  17404. @subsection Commands
  17405. This filter supports the all above options as @ref{commands}.
  17406. @section swapuv
  17407. Swap U & V plane.
  17408. @section tblend
  17409. Blend successive video frames.
  17410. See @ref{blend}
  17411. @section telecine
  17412. Apply telecine process to the video.
  17413. This filter accepts the following options:
  17414. @table @option
  17415. @item first_field
  17416. @table @samp
  17417. @item top, t
  17418. top field first
  17419. @item bottom, b
  17420. bottom field first
  17421. The default value is @code{top}.
  17422. @end table
  17423. @item pattern
  17424. A string of numbers representing the pulldown pattern you wish to apply.
  17425. The default value is @code{23}.
  17426. @end table
  17427. @example
  17428. Some typical patterns:
  17429. NTSC output (30i):
  17430. 27.5p: 32222
  17431. 24p: 23 (classic)
  17432. 24p: 2332 (preferred)
  17433. 20p: 33
  17434. 18p: 334
  17435. 16p: 3444
  17436. PAL output (25i):
  17437. 27.5p: 12222
  17438. 24p: 222222222223 ("Euro pulldown")
  17439. 16.67p: 33
  17440. 16p: 33333334
  17441. @end example
  17442. @section thistogram
  17443. Compute and draw a color distribution histogram for the input video across time.
  17444. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  17445. at certain time, this filter shows also past histograms of number of frames defined
  17446. by @code{width} option.
  17447. The computed histogram is a representation of the color component
  17448. distribution in an image.
  17449. The filter accepts the following options:
  17450. @table @option
  17451. @item width, w
  17452. Set width of single color component output. Default value is @code{0}.
  17453. Value of @code{0} means width will be picked from input video.
  17454. This also set number of passed histograms to keep.
  17455. Allowed range is [0, 8192].
  17456. @item display_mode, d
  17457. Set display mode.
  17458. It accepts the following values:
  17459. @table @samp
  17460. @item stack
  17461. Per color component graphs are placed below each other.
  17462. @item parade
  17463. Per color component graphs are placed side by side.
  17464. @item overlay
  17465. Presents information identical to that in the @code{parade}, except
  17466. that the graphs representing color components are superimposed directly
  17467. over one another.
  17468. @end table
  17469. Default is @code{stack}.
  17470. @item levels_mode, m
  17471. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  17472. Default is @code{linear}.
  17473. @item components, c
  17474. Set what color components to display.
  17475. Default is @code{7}.
  17476. @item bgopacity, b
  17477. Set background opacity. Default is @code{0.9}.
  17478. @item envelope, e
  17479. Show envelope. Default is disabled.
  17480. @item ecolor, ec
  17481. Set envelope color. Default is @code{gold}.
  17482. @item slide
  17483. Set slide mode.
  17484. Available values for slide is:
  17485. @table @samp
  17486. @item frame
  17487. Draw new frame when right border is reached.
  17488. @item replace
  17489. Replace old columns with new ones.
  17490. @item scroll
  17491. Scroll from right to left.
  17492. @item rscroll
  17493. Scroll from left to right.
  17494. @item picture
  17495. Draw single picture.
  17496. @end table
  17497. Default is @code{replace}.
  17498. @end table
  17499. @section threshold
  17500. Apply threshold effect to video stream.
  17501. This filter needs four video streams to perform thresholding.
  17502. First stream is stream we are filtering.
  17503. Second stream is holding threshold values, third stream is holding min values,
  17504. and last, fourth stream is holding max values.
  17505. The filter accepts the following option:
  17506. @table @option
  17507. @item planes
  17508. Set which planes will be processed, unprocessed planes will be copied.
  17509. By default value 0xf, all planes will be processed.
  17510. @end table
  17511. For example if first stream pixel's component value is less then threshold value
  17512. of pixel component from 2nd threshold stream, third stream value will picked,
  17513. otherwise fourth stream pixel component value will be picked.
  17514. Using color source filter one can perform various types of thresholding:
  17515. @subsection Commands
  17516. This filter supports the all options as @ref{commands}.
  17517. @subsection Examples
  17518. @itemize
  17519. @item
  17520. Binary threshold, using gray color as threshold:
  17521. @example
  17522. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  17523. @end example
  17524. @item
  17525. Inverted binary threshold, using gray color as threshold:
  17526. @example
  17527. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  17528. @end example
  17529. @item
  17530. Truncate binary threshold, using gray color as threshold:
  17531. @example
  17532. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  17533. @end example
  17534. @item
  17535. Threshold to zero, using gray color as threshold:
  17536. @example
  17537. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  17538. @end example
  17539. @item
  17540. Inverted threshold to zero, using gray color as threshold:
  17541. @example
  17542. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  17543. @end example
  17544. @end itemize
  17545. @section thumbnail
  17546. Select the most representative frame in a given sequence of consecutive frames.
  17547. The filter accepts the following options:
  17548. @table @option
  17549. @item n
  17550. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  17551. will pick one of them, and then handle the next batch of @var{n} frames until
  17552. the end. Default is @code{100}.
  17553. @item log
  17554. Set the log level to display picked frame stats.
  17555. Default is @code{info}.
  17556. @end table
  17557. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  17558. value will result in a higher memory usage, so a high value is not recommended.
  17559. @subsection Examples
  17560. @itemize
  17561. @item
  17562. Extract one picture each 50 frames:
  17563. @example
  17564. thumbnail=50
  17565. @end example
  17566. @item
  17567. Complete example of a thumbnail creation with @command{ffmpeg}:
  17568. @example
  17569. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  17570. @end example
  17571. @end itemize
  17572. @anchor{tile}
  17573. @section tile
  17574. Tile several successive frames together.
  17575. The @ref{untile} filter can do the reverse.
  17576. The filter accepts the following options:
  17577. @table @option
  17578. @item layout
  17579. Set the grid size in the form @code{COLUMNSxROWS}. Range is up to UINT_MAX cells.
  17580. Default is @code{6x5}.
  17581. @item nb_frames
  17582. Set the maximum number of frames to render in the given area. It must be less
  17583. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  17584. the area will be used.
  17585. @item margin
  17586. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  17587. @item padding
  17588. Set the inner border thickness (i.e. the number of pixels between frames). For
  17589. more advanced padding options (such as having different values for the edges),
  17590. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  17591. @item color
  17592. Specify the color of the unused area. For the syntax of this option, check the
  17593. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17594. The default value of @var{color} is "black".
  17595. @item overlap
  17596. Set the number of frames to overlap when tiling several successive frames together.
  17597. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17598. @item init_padding
  17599. Set the number of frames to initially be empty before displaying first output frame.
  17600. This controls how soon will one get first output frame.
  17601. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17602. @end table
  17603. @subsection Examples
  17604. @itemize
  17605. @item
  17606. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  17607. @example
  17608. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  17609. @end example
  17610. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  17611. duplicating each output frame to accommodate the originally detected frame
  17612. rate.
  17613. @item
  17614. Display @code{5} pictures in an area of @code{3x2} frames,
  17615. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  17616. mixed flat and named options:
  17617. @example
  17618. tile=3x2:nb_frames=5:padding=7:margin=2
  17619. @end example
  17620. @end itemize
  17621. @section tinterlace
  17622. Perform various types of temporal field interlacing.
  17623. Frames are counted starting from 1, so the first input frame is
  17624. considered odd.
  17625. The filter accepts the following options:
  17626. @table @option
  17627. @item mode
  17628. Specify the mode of the interlacing. This option can also be specified
  17629. as a value alone. See below for a list of values for this option.
  17630. Available values are:
  17631. @table @samp
  17632. @item merge, 0
  17633. Move odd frames into the upper field, even into the lower field,
  17634. generating a double height frame at half frame rate.
  17635. @example
  17636. ------> time
  17637. Input:
  17638. Frame 1 Frame 2 Frame 3 Frame 4
  17639. 11111 22222 33333 44444
  17640. 11111 22222 33333 44444
  17641. 11111 22222 33333 44444
  17642. 11111 22222 33333 44444
  17643. Output:
  17644. 11111 33333
  17645. 22222 44444
  17646. 11111 33333
  17647. 22222 44444
  17648. 11111 33333
  17649. 22222 44444
  17650. 11111 33333
  17651. 22222 44444
  17652. @end example
  17653. @item drop_even, 1
  17654. Only output odd frames, even frames are dropped, generating a frame with
  17655. unchanged height at half frame rate.
  17656. @example
  17657. ------> time
  17658. Input:
  17659. Frame 1 Frame 2 Frame 3 Frame 4
  17660. 11111 22222 33333 44444
  17661. 11111 22222 33333 44444
  17662. 11111 22222 33333 44444
  17663. 11111 22222 33333 44444
  17664. Output:
  17665. 11111 33333
  17666. 11111 33333
  17667. 11111 33333
  17668. 11111 33333
  17669. @end example
  17670. @item drop_odd, 2
  17671. Only output even frames, odd frames are dropped, generating a frame with
  17672. unchanged height at half frame rate.
  17673. @example
  17674. ------> time
  17675. Input:
  17676. Frame 1 Frame 2 Frame 3 Frame 4
  17677. 11111 22222 33333 44444
  17678. 11111 22222 33333 44444
  17679. 11111 22222 33333 44444
  17680. 11111 22222 33333 44444
  17681. Output:
  17682. 22222 44444
  17683. 22222 44444
  17684. 22222 44444
  17685. 22222 44444
  17686. @end example
  17687. @item pad, 3
  17688. Expand each frame to full height, but pad alternate lines with black,
  17689. generating a frame with double height at the same input frame rate.
  17690. @example
  17691. ------> time
  17692. Input:
  17693. Frame 1 Frame 2 Frame 3 Frame 4
  17694. 11111 22222 33333 44444
  17695. 11111 22222 33333 44444
  17696. 11111 22222 33333 44444
  17697. 11111 22222 33333 44444
  17698. Output:
  17699. 11111 ..... 33333 .....
  17700. ..... 22222 ..... 44444
  17701. 11111 ..... 33333 .....
  17702. ..... 22222 ..... 44444
  17703. 11111 ..... 33333 .....
  17704. ..... 22222 ..... 44444
  17705. 11111 ..... 33333 .....
  17706. ..... 22222 ..... 44444
  17707. @end example
  17708. @item interleave_top, 4
  17709. Interleave the upper field from odd frames with the lower field from
  17710. even frames, generating a frame with unchanged height at half frame rate.
  17711. @example
  17712. ------> time
  17713. Input:
  17714. Frame 1 Frame 2 Frame 3 Frame 4
  17715. 11111<- 22222 33333<- 44444
  17716. 11111 22222<- 33333 44444<-
  17717. 11111<- 22222 33333<- 44444
  17718. 11111 22222<- 33333 44444<-
  17719. Output:
  17720. 11111 33333
  17721. 22222 44444
  17722. 11111 33333
  17723. 22222 44444
  17724. @end example
  17725. @item interleave_bottom, 5
  17726. Interleave the lower field from odd frames with the upper field from
  17727. even frames, generating a frame with unchanged height at half frame rate.
  17728. @example
  17729. ------> time
  17730. Input:
  17731. Frame 1 Frame 2 Frame 3 Frame 4
  17732. 11111 22222<- 33333 44444<-
  17733. 11111<- 22222 33333<- 44444
  17734. 11111 22222<- 33333 44444<-
  17735. 11111<- 22222 33333<- 44444
  17736. Output:
  17737. 22222 44444
  17738. 11111 33333
  17739. 22222 44444
  17740. 11111 33333
  17741. @end example
  17742. @item interlacex2, 6
  17743. Double frame rate with unchanged height. Frames are inserted each
  17744. containing the second temporal field from the previous input frame and
  17745. the first temporal field from the next input frame. This mode relies on
  17746. the top_field_first flag. Useful for interlaced video displays with no
  17747. field synchronisation.
  17748. @example
  17749. ------> time
  17750. Input:
  17751. Frame 1 Frame 2 Frame 3 Frame 4
  17752. 11111 22222 33333 44444
  17753. 11111 22222 33333 44444
  17754. 11111 22222 33333 44444
  17755. 11111 22222 33333 44444
  17756. Output:
  17757. 11111 22222 22222 33333 33333 44444 44444
  17758. 11111 11111 22222 22222 33333 33333 44444
  17759. 11111 22222 22222 33333 33333 44444 44444
  17760. 11111 11111 22222 22222 33333 33333 44444
  17761. @end example
  17762. @item mergex2, 7
  17763. Move odd frames into the upper field, even into the lower field,
  17764. generating a double height frame at same frame rate.
  17765. @example
  17766. ------> time
  17767. Input:
  17768. Frame 1 Frame 2 Frame 3 Frame 4
  17769. 11111 22222 33333 44444
  17770. 11111 22222 33333 44444
  17771. 11111 22222 33333 44444
  17772. 11111 22222 33333 44444
  17773. Output:
  17774. 11111 33333 33333 55555
  17775. 22222 22222 44444 44444
  17776. 11111 33333 33333 55555
  17777. 22222 22222 44444 44444
  17778. 11111 33333 33333 55555
  17779. 22222 22222 44444 44444
  17780. 11111 33333 33333 55555
  17781. 22222 22222 44444 44444
  17782. @end example
  17783. @end table
  17784. Numeric values are deprecated but are accepted for backward
  17785. compatibility reasons.
  17786. Default mode is @code{merge}.
  17787. @item flags
  17788. Specify flags influencing the filter process.
  17789. Available value for @var{flags} is:
  17790. @table @option
  17791. @item low_pass_filter, vlpf
  17792. Enable linear vertical low-pass filtering in the filter.
  17793. Vertical low-pass filtering is required when creating an interlaced
  17794. destination from a progressive source which contains high-frequency
  17795. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  17796. patterning.
  17797. @item complex_filter, cvlpf
  17798. Enable complex vertical low-pass filtering.
  17799. This will slightly less reduce interlace 'twitter' and Moire
  17800. patterning but better retain detail and subjective sharpness impression.
  17801. @item bypass_il
  17802. Bypass already interlaced frames, only adjust the frame rate.
  17803. @end table
  17804. Vertical low-pass filtering and bypassing already interlaced frames can only be
  17805. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  17806. @end table
  17807. @section tmedian
  17808. Pick median pixels from several successive input video frames.
  17809. The filter accepts the following options:
  17810. @table @option
  17811. @item radius
  17812. Set radius of median filter.
  17813. Default is 1. Allowed range is from 1 to 127.
  17814. @item planes
  17815. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  17816. @item percentile
  17817. Set median percentile. Default value is @code{0.5}.
  17818. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  17819. minimum values, and @code{1} maximum values.
  17820. @end table
  17821. @subsection Commands
  17822. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  17823. @section tmidequalizer
  17824. Apply Temporal Midway Video Equalization effect.
  17825. Midway Video Equalization adjusts a sequence of video frames to have the same
  17826. histograms, while maintaining their dynamics as much as possible. It's
  17827. useful for e.g. matching exposures from a video frames sequence.
  17828. This filter accepts the following option:
  17829. @table @option
  17830. @item radius
  17831. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  17832. @item sigma
  17833. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  17834. Setting this option to 0 effectively does nothing.
  17835. @item planes
  17836. Set which planes to process. Default is @code{15}, which is all available planes.
  17837. @end table
  17838. @section tmix
  17839. Mix successive video frames.
  17840. A description of the accepted options follows.
  17841. @table @option
  17842. @item frames
  17843. The number of successive frames to mix. If unspecified, it defaults to 3.
  17844. @item weights
  17845. Specify weight of each input video frame.
  17846. Each weight is separated by space. If number of weights is smaller than
  17847. number of @var{frames} last specified weight will be used for all remaining
  17848. unset weights.
  17849. @item scale
  17850. Specify scale, if it is set it will be multiplied with sum
  17851. of each weight multiplied with pixel values to give final destination
  17852. pixel value. By default @var{scale} is auto scaled to sum of weights.
  17853. @item planes
  17854. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  17855. @end table
  17856. @subsection Examples
  17857. @itemize
  17858. @item
  17859. Average 7 successive frames:
  17860. @example
  17861. tmix=frames=7:weights="1 1 1 1 1 1 1"
  17862. @end example
  17863. @item
  17864. Apply simple temporal convolution:
  17865. @example
  17866. tmix=frames=3:weights="-1 3 -1"
  17867. @end example
  17868. @item
  17869. Similar as above but only showing temporal differences:
  17870. @example
  17871. tmix=frames=3:weights="-1 2 -1":scale=1
  17872. @end example
  17873. @end itemize
  17874. @subsection Commands
  17875. This filter supports the following commands:
  17876. @table @option
  17877. @item weights
  17878. @item scale
  17879. @item planes
  17880. Syntax is same as option with same name.
  17881. @end table
  17882. @anchor{tonemap}
  17883. @section tonemap
  17884. Tone map colors from different dynamic ranges.
  17885. This filter expects data in single precision floating point, as it needs to
  17886. operate on (and can output) out-of-range values. Another filter, such as
  17887. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  17888. The tonemapping algorithms implemented only work on linear light, so input
  17889. data should be linearized beforehand (and possibly correctly tagged).
  17890. @example
  17891. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  17892. @end example
  17893. @subsection Options
  17894. The filter accepts the following options.
  17895. @table @option
  17896. @item tonemap
  17897. Set the tone map algorithm to use.
  17898. Possible values are:
  17899. @table @var
  17900. @item none
  17901. Do not apply any tone map, only desaturate overbright pixels.
  17902. @item clip
  17903. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  17904. in-range values, while distorting out-of-range values.
  17905. @item linear
  17906. Stretch the entire reference gamut to a linear multiple of the display.
  17907. @item gamma
  17908. Fit a logarithmic transfer between the tone curves.
  17909. @item reinhard
  17910. Preserve overall image brightness with a simple curve, using nonlinear
  17911. contrast, which results in flattening details and degrading color accuracy.
  17912. @item hable
  17913. Preserve both dark and bright details better than @var{reinhard}, at the cost
  17914. of slightly darkening everything. Use it when detail preservation is more
  17915. important than color and brightness accuracy.
  17916. @item mobius
  17917. Smoothly map out-of-range values, while retaining contrast and colors for
  17918. in-range material as much as possible. Use it when color accuracy is more
  17919. important than detail preservation.
  17920. @end table
  17921. Default is none.
  17922. @item param
  17923. Tune the tone mapping algorithm.
  17924. This affects the following algorithms:
  17925. @table @var
  17926. @item none
  17927. Ignored.
  17928. @item linear
  17929. Specifies the scale factor to use while stretching.
  17930. Default to 1.0.
  17931. @item gamma
  17932. Specifies the exponent of the function.
  17933. Default to 1.8.
  17934. @item clip
  17935. Specify an extra linear coefficient to multiply into the signal before clipping.
  17936. Default to 1.0.
  17937. @item reinhard
  17938. Specify the local contrast coefficient at the display peak.
  17939. Default to 0.5, which means that in-gamut values will be about half as bright
  17940. as when clipping.
  17941. @item hable
  17942. Ignored.
  17943. @item mobius
  17944. Specify the transition point from linear to mobius transform. Every value
  17945. below this point is guaranteed to be mapped 1:1. The higher the value, the
  17946. more accurate the result will be, at the cost of losing bright details.
  17947. Default to 0.3, which due to the steep initial slope still preserves in-range
  17948. colors fairly accurately.
  17949. @end table
  17950. @item desat
  17951. Apply desaturation for highlights that exceed this level of brightness. The
  17952. higher the parameter, the more color information will be preserved. This
  17953. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17954. (smoothly) turning into white instead. This makes images feel more natural,
  17955. at the cost of reducing information about out-of-range colors.
  17956. The default of 2.0 is somewhat conservative and will mostly just apply to
  17957. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  17958. This option works only if the input frame has a supported color tag.
  17959. @item peak
  17960. Override signal/nominal/reference peak with this value. Useful when the
  17961. embedded peak information in display metadata is not reliable or when tone
  17962. mapping from a lower range to a higher range.
  17963. @end table
  17964. @section tpad
  17965. Temporarily pad video frames.
  17966. The filter accepts the following options:
  17967. @table @option
  17968. @item start
  17969. Specify number of delay frames before input video stream. Default is 0.
  17970. @item stop
  17971. Specify number of padding frames after input video stream.
  17972. Set to -1 to pad indefinitely. Default is 0.
  17973. @item start_mode
  17974. Set kind of frames added to beginning of stream.
  17975. Can be either @var{add} or @var{clone}.
  17976. With @var{add} frames of solid-color are added.
  17977. With @var{clone} frames are clones of first frame.
  17978. Default is @var{add}.
  17979. @item stop_mode
  17980. Set kind of frames added to end of stream.
  17981. Can be either @var{add} or @var{clone}.
  17982. With @var{add} frames of solid-color are added.
  17983. With @var{clone} frames are clones of last frame.
  17984. Default is @var{add}.
  17985. @item start_duration, stop_duration
  17986. Specify the duration of the start/stop delay. See
  17987. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17988. for the accepted syntax.
  17989. These options override @var{start} and @var{stop}. Default is 0.
  17990. @item color
  17991. Specify the color of the padded area. For the syntax of this option,
  17992. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17993. manual,ffmpeg-utils}.
  17994. The default value of @var{color} is "black".
  17995. @end table
  17996. @anchor{transpose}
  17997. @section transpose
  17998. Transpose rows with columns in the input video and optionally flip it.
  17999. It accepts the following parameters:
  18000. @table @option
  18001. @item dir
  18002. Specify the transposition direction.
  18003. Can assume the following values:
  18004. @table @samp
  18005. @item 0, 4, cclock_flip
  18006. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  18007. @example
  18008. L.R L.l
  18009. . . -> . .
  18010. l.r R.r
  18011. @end example
  18012. @item 1, 5, clock
  18013. Rotate by 90 degrees clockwise, that is:
  18014. @example
  18015. L.R l.L
  18016. . . -> . .
  18017. l.r r.R
  18018. @end example
  18019. @item 2, 6, cclock
  18020. Rotate by 90 degrees counterclockwise, that is:
  18021. @example
  18022. L.R R.r
  18023. . . -> . .
  18024. l.r L.l
  18025. @end example
  18026. @item 3, 7, clock_flip
  18027. Rotate by 90 degrees clockwise and vertically flip, that is:
  18028. @example
  18029. L.R r.R
  18030. . . -> . .
  18031. l.r l.L
  18032. @end example
  18033. @end table
  18034. For values between 4-7, the transposition is only done if the input
  18035. video geometry is portrait and not landscape. These values are
  18036. deprecated, the @code{passthrough} option should be used instead.
  18037. Numerical values are deprecated, and should be dropped in favor of
  18038. symbolic constants.
  18039. @item passthrough
  18040. Do not apply the transposition if the input geometry matches the one
  18041. specified by the specified value. It accepts the following values:
  18042. @table @samp
  18043. @item none
  18044. Always apply transposition.
  18045. @item portrait
  18046. Preserve portrait geometry (when @var{height} >= @var{width}).
  18047. @item landscape
  18048. Preserve landscape geometry (when @var{width} >= @var{height}).
  18049. @end table
  18050. Default value is @code{none}.
  18051. @end table
  18052. For example to rotate by 90 degrees clockwise and preserve portrait
  18053. layout:
  18054. @example
  18055. transpose=dir=1:passthrough=portrait
  18056. @end example
  18057. The command above can also be specified as:
  18058. @example
  18059. transpose=1:portrait
  18060. @end example
  18061. @section transpose_npp
  18062. Transpose rows with columns in the input video and optionally flip it.
  18063. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  18064. It accepts the following parameters:
  18065. @table @option
  18066. @item dir
  18067. Specify the transposition direction.
  18068. Can assume the following values:
  18069. @table @samp
  18070. @item cclock_flip
  18071. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  18072. @item clock
  18073. Rotate by 90 degrees clockwise.
  18074. @item cclock
  18075. Rotate by 90 degrees counterclockwise.
  18076. @item clock_flip
  18077. Rotate by 90 degrees clockwise and vertically flip.
  18078. @end table
  18079. @item passthrough
  18080. Do not apply the transposition if the input geometry matches the one
  18081. specified by the specified value. It accepts the following values:
  18082. @table @samp
  18083. @item none
  18084. Always apply transposition. (default)
  18085. @item portrait
  18086. Preserve portrait geometry (when @var{height} >= @var{width}).
  18087. @item landscape
  18088. Preserve landscape geometry (when @var{width} >= @var{height}).
  18089. @end table
  18090. @end table
  18091. @section trim
  18092. Trim the input so that the output contains one continuous subpart of the input.
  18093. It accepts the following parameters:
  18094. @table @option
  18095. @item start
  18096. Specify the time of the start of the kept section, i.e. the frame with the
  18097. timestamp @var{start} will be the first frame in the output.
  18098. @item end
  18099. Specify the time of the first frame that will be dropped, i.e. the frame
  18100. immediately preceding the one with the timestamp @var{end} will be the last
  18101. frame in the output.
  18102. @item start_pts
  18103. This is the same as @var{start}, except this option sets the start timestamp
  18104. in timebase units instead of seconds.
  18105. @item end_pts
  18106. This is the same as @var{end}, except this option sets the end timestamp
  18107. in timebase units instead of seconds.
  18108. @item duration
  18109. The maximum duration of the output in seconds.
  18110. @item start_frame
  18111. The number of the first frame that should be passed to the output.
  18112. @item end_frame
  18113. The number of the first frame that should be dropped.
  18114. @end table
  18115. @option{start}, @option{end}, and @option{duration} are expressed as time
  18116. duration specifications; see
  18117. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18118. for the accepted syntax.
  18119. Note that the first two sets of the start/end options and the @option{duration}
  18120. option look at the frame timestamp, while the _frame variants simply count the
  18121. frames that pass through the filter. Also note that this filter does not modify
  18122. the timestamps. If you wish for the output timestamps to start at zero, insert a
  18123. setpts filter after the trim filter.
  18124. If multiple start or end options are set, this filter tries to be greedy and
  18125. keep all the frames that match at least one of the specified constraints. To keep
  18126. only the part that matches all the constraints at once, chain multiple trim
  18127. filters.
  18128. The defaults are such that all the input is kept. So it is possible to set e.g.
  18129. just the end values to keep everything before the specified time.
  18130. Examples:
  18131. @itemize
  18132. @item
  18133. Drop everything except the second minute of input:
  18134. @example
  18135. ffmpeg -i INPUT -vf trim=60:120
  18136. @end example
  18137. @item
  18138. Keep only the first second:
  18139. @example
  18140. ffmpeg -i INPUT -vf trim=duration=1
  18141. @end example
  18142. @end itemize
  18143. @section unpremultiply
  18144. Apply alpha unpremultiply effect to input video stream using first plane
  18145. of second stream as alpha.
  18146. Both streams must have same dimensions and same pixel format.
  18147. The filter accepts the following option:
  18148. @table @option
  18149. @item planes
  18150. Set which planes will be processed, unprocessed planes will be copied.
  18151. By default value 0xf, all planes will be processed.
  18152. If the format has 1 or 2 components, then luma is bit 0.
  18153. If the format has 3 or 4 components:
  18154. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  18155. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  18156. If present, the alpha channel is always the last bit.
  18157. @item inplace
  18158. Do not require 2nd input for processing, instead use alpha plane from input stream.
  18159. @end table
  18160. @anchor{unsharp}
  18161. @section unsharp
  18162. Sharpen or blur the input video.
  18163. It accepts the following parameters:
  18164. @table @option
  18165. @item luma_msize_x, lx
  18166. Set the luma matrix horizontal size. It must be an odd integer between
  18167. 3 and 23. The default value is 5.
  18168. @item luma_msize_y, ly
  18169. Set the luma matrix vertical size. It must be an odd integer between 3
  18170. and 23. The default value is 5.
  18171. @item luma_amount, la
  18172. Set the luma effect strength. It must be a floating point number, reasonable
  18173. values lay between -1.5 and 1.5.
  18174. Negative values will blur the input video, while positive values will
  18175. sharpen it, a value of zero will disable the effect.
  18176. Default value is 1.0.
  18177. @item chroma_msize_x, cx
  18178. Set the chroma matrix horizontal size. It must be an odd integer
  18179. between 3 and 23. The default value is 5.
  18180. @item chroma_msize_y, cy
  18181. Set the chroma matrix vertical size. It must be an odd integer
  18182. between 3 and 23. The default value is 5.
  18183. @item chroma_amount, ca
  18184. Set the chroma effect strength. It must be a floating point number, reasonable
  18185. values lay between -1.5 and 1.5.
  18186. Negative values will blur the input video, while positive values will
  18187. sharpen it, a value of zero will disable the effect.
  18188. Default value is 0.0.
  18189. @item alpha_msize_x, ax
  18190. Set the alpha matrix horizontal size. It must be an odd integer
  18191. between 3 and 23. The default value is 5.
  18192. @item alpha_msize_y, ay
  18193. Set the alpha matrix vertical size. It must be an odd integer
  18194. between 3 and 23. The default value is 5.
  18195. @item alpha_amount, aa
  18196. Set the alpha effect strength. It must be a floating point number, reasonable
  18197. values lay between -1.5 and 1.5.
  18198. Negative values will blur the input video, while positive values will
  18199. sharpen it, a value of zero will disable the effect.
  18200. Default value is 0.0.
  18201. @end table
  18202. All parameters are optional and default to the equivalent of the
  18203. string '5:5:1.0:5:5:0.0'.
  18204. @subsection Examples
  18205. @itemize
  18206. @item
  18207. Apply strong luma sharpen effect:
  18208. @example
  18209. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  18210. @end example
  18211. @item
  18212. Apply a strong blur of both luma and chroma parameters:
  18213. @example
  18214. unsharp=7:7:-2:7:7:-2
  18215. @end example
  18216. @end itemize
  18217. @anchor{untile}
  18218. @section untile
  18219. Decompose a video made of tiled images into the individual images.
  18220. The frame rate of the output video is the frame rate of the input video
  18221. multiplied by the number of tiles.
  18222. This filter does the reverse of @ref{tile}.
  18223. The filter accepts the following options:
  18224. @table @option
  18225. @item layout
  18226. Set the grid size (i.e. the number of lines and columns). For the syntax of
  18227. this option, check the
  18228. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18229. @end table
  18230. @subsection Examples
  18231. @itemize
  18232. @item
  18233. Produce a 1-second video from a still image file made of 25 frames stacked
  18234. vertically, like an analogic film reel:
  18235. @example
  18236. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  18237. @end example
  18238. @end itemize
  18239. @section uspp
  18240. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  18241. the image at several (or - in the case of @option{quality} level @code{8} - all)
  18242. shifts and average the results.
  18243. The way this differs from the behavior of spp is that uspp actually encodes &
  18244. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  18245. DCT similar to MJPEG.
  18246. This filter is only available in ffmpeg version 4.4 or earlier.
  18247. The filter accepts the following options:
  18248. @table @option
  18249. @item quality
  18250. Set quality. This option defines the number of levels for averaging. It accepts
  18251. an integer in the range 0-8. If set to @code{0}, the filter will have no
  18252. effect. A value of @code{8} means the higher quality. For each increment of
  18253. that value the speed drops by a factor of approximately 2. Default value is
  18254. @code{3}.
  18255. @item qp
  18256. Force a constant quantization parameter. If not set, the filter will use the QP
  18257. from the video stream (if available).
  18258. @item codec
  18259. Use specified codec instead of snow.
  18260. @end table
  18261. @section v360
  18262. Convert 360 videos between various formats.
  18263. The filter accepts the following options:
  18264. @table @option
  18265. @item input
  18266. @item output
  18267. Set format of the input/output video.
  18268. Available formats:
  18269. @table @samp
  18270. @item e
  18271. @item equirect
  18272. Equirectangular projection.
  18273. @item c3x2
  18274. @item c6x1
  18275. @item c1x6
  18276. Cubemap with 3x2/6x1/1x6 layout.
  18277. Format specific options:
  18278. @table @option
  18279. @item in_pad
  18280. @item out_pad
  18281. Set padding proportion for the input/output cubemap. Values in decimals.
  18282. Example values:
  18283. @table @samp
  18284. @item 0
  18285. No padding.
  18286. @item 0.01
  18287. 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)
  18288. @end table
  18289. Default value is @b{@samp{0}}.
  18290. Maximum value is @b{@samp{0.1}}.
  18291. @item fin_pad
  18292. @item fout_pad
  18293. Set fixed padding for the input/output cubemap. Values in pixels.
  18294. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  18295. @item in_forder
  18296. @item out_forder
  18297. Set order of faces for the input/output cubemap. Choose one direction for each position.
  18298. Designation of directions:
  18299. @table @samp
  18300. @item r
  18301. right
  18302. @item l
  18303. left
  18304. @item u
  18305. up
  18306. @item d
  18307. down
  18308. @item f
  18309. forward
  18310. @item b
  18311. back
  18312. @end table
  18313. Default value is @b{@samp{rludfb}}.
  18314. @item in_frot
  18315. @item out_frot
  18316. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  18317. Designation of angles:
  18318. @table @samp
  18319. @item 0
  18320. 0 degrees clockwise
  18321. @item 1
  18322. 90 degrees clockwise
  18323. @item 2
  18324. 180 degrees clockwise
  18325. @item 3
  18326. 270 degrees clockwise
  18327. @end table
  18328. Default value is @b{@samp{000000}}.
  18329. @end table
  18330. @item eac
  18331. Equi-Angular Cubemap.
  18332. @item flat
  18333. @item gnomonic
  18334. @item rectilinear
  18335. Regular video.
  18336. Format specific options:
  18337. @table @option
  18338. @item h_fov
  18339. @item v_fov
  18340. @item d_fov
  18341. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18342. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18343. @item ih_fov
  18344. @item iv_fov
  18345. @item id_fov
  18346. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18347. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18348. @end table
  18349. @item dfisheye
  18350. Dual fisheye.
  18351. Format specific options:
  18352. @table @option
  18353. @item h_fov
  18354. @item v_fov
  18355. @item d_fov
  18356. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18357. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18358. @item ih_fov
  18359. @item iv_fov
  18360. @item id_fov
  18361. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18362. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18363. @end table
  18364. @item barrel
  18365. @item fb
  18366. @item barrelsplit
  18367. Facebook's 360 formats.
  18368. @item sg
  18369. Stereographic format.
  18370. Format specific options:
  18371. @table @option
  18372. @item h_fov
  18373. @item v_fov
  18374. @item d_fov
  18375. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18376. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18377. @item ih_fov
  18378. @item iv_fov
  18379. @item id_fov
  18380. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18381. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18382. @end table
  18383. @item mercator
  18384. Mercator format.
  18385. @item ball
  18386. Ball format, gives significant distortion toward the back.
  18387. @item hammer
  18388. Hammer-Aitoff map projection format.
  18389. @item sinusoidal
  18390. Sinusoidal map projection format.
  18391. @item fisheye
  18392. Fisheye projection.
  18393. Format specific options:
  18394. @table @option
  18395. @item h_fov
  18396. @item v_fov
  18397. @item d_fov
  18398. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18399. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18400. @item ih_fov
  18401. @item iv_fov
  18402. @item id_fov
  18403. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18404. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18405. @end table
  18406. @item pannini
  18407. Pannini projection.
  18408. Format specific options:
  18409. @table @option
  18410. @item h_fov
  18411. Set output pannini parameter.
  18412. @item ih_fov
  18413. Set input pannini parameter.
  18414. @end table
  18415. @item cylindrical
  18416. Cylindrical projection.
  18417. Format specific options:
  18418. @table @option
  18419. @item h_fov
  18420. @item v_fov
  18421. @item d_fov
  18422. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18423. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18424. @item ih_fov
  18425. @item iv_fov
  18426. @item id_fov
  18427. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18428. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18429. @end table
  18430. @item perspective
  18431. Perspective projection. @i{(output only)}
  18432. Format specific options:
  18433. @table @option
  18434. @item v_fov
  18435. Set perspective parameter.
  18436. @end table
  18437. @item tetrahedron
  18438. Tetrahedron projection.
  18439. @item tsp
  18440. Truncated square pyramid projection.
  18441. @item he
  18442. @item hequirect
  18443. Half equirectangular projection.
  18444. @item equisolid
  18445. Equisolid format.
  18446. Format specific options:
  18447. @table @option
  18448. @item h_fov
  18449. @item v_fov
  18450. @item d_fov
  18451. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18452. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18453. @item ih_fov
  18454. @item iv_fov
  18455. @item id_fov
  18456. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18457. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18458. @end table
  18459. @item og
  18460. Orthographic format.
  18461. Format specific options:
  18462. @table @option
  18463. @item h_fov
  18464. @item v_fov
  18465. @item d_fov
  18466. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18467. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18468. @item ih_fov
  18469. @item iv_fov
  18470. @item id_fov
  18471. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18472. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18473. @end table
  18474. @item octahedron
  18475. Octahedron projection.
  18476. @item cylindricalea
  18477. Cylindrical Equal Area projection.
  18478. @end table
  18479. @item interp
  18480. Set interpolation method.@*
  18481. @i{Note: more complex interpolation methods require much more memory to run.}
  18482. Available methods:
  18483. @table @samp
  18484. @item near
  18485. @item nearest
  18486. Nearest neighbour.
  18487. @item line
  18488. @item linear
  18489. Bilinear interpolation.
  18490. @item lagrange9
  18491. Lagrange9 interpolation.
  18492. @item cube
  18493. @item cubic
  18494. Bicubic interpolation.
  18495. @item lanc
  18496. @item lanczos
  18497. Lanczos interpolation.
  18498. @item sp16
  18499. @item spline16
  18500. Spline16 interpolation.
  18501. @item gauss
  18502. @item gaussian
  18503. Gaussian interpolation.
  18504. @item mitchell
  18505. Mitchell interpolation.
  18506. @end table
  18507. Default value is @b{@samp{line}}.
  18508. @item w
  18509. @item h
  18510. Set the output video resolution.
  18511. Default resolution depends on formats.
  18512. @item in_stereo
  18513. @item out_stereo
  18514. Set the input/output stereo format.
  18515. @table @samp
  18516. @item 2d
  18517. 2D mono
  18518. @item sbs
  18519. Side by side
  18520. @item tb
  18521. Top bottom
  18522. @end table
  18523. Default value is @b{@samp{2d}} for input and output format.
  18524. @item yaw
  18525. @item pitch
  18526. @item roll
  18527. Set rotation for the output video. Values in degrees.
  18528. @item rorder
  18529. Set rotation order for the output video. Choose one item for each position.
  18530. @table @samp
  18531. @item y, Y
  18532. yaw
  18533. @item p, P
  18534. pitch
  18535. @item r, R
  18536. roll
  18537. @end table
  18538. Default value is @b{@samp{ypr}}.
  18539. @item h_flip
  18540. @item v_flip
  18541. @item d_flip
  18542. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  18543. @item ih_flip
  18544. @item iv_flip
  18545. Set if input video is flipped horizontally/vertically. Boolean values.
  18546. @item in_trans
  18547. Set if input video is transposed. Boolean value, by default disabled.
  18548. @item out_trans
  18549. Set if output video needs to be transposed. Boolean value, by default disabled.
  18550. @item h_offset
  18551. @item v_offset
  18552. Set output horizontal/vertical off-axis offset. Default is set to 0.
  18553. Allowed range is from -1 to 1.
  18554. @item alpha_mask
  18555. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  18556. @item reset_rot
  18557. Reset rotation of output video. Boolean value, by default disabled.
  18558. @end table
  18559. @subsection Examples
  18560. @itemize
  18561. @item
  18562. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  18563. @example
  18564. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  18565. @end example
  18566. @item
  18567. Extract back view of Equi-Angular Cubemap:
  18568. @example
  18569. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  18570. @end example
  18571. @item
  18572. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  18573. @example
  18574. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  18575. @end example
  18576. @end itemize
  18577. @subsection Commands
  18578. This filter supports subset of above options as @ref{commands}.
  18579. @section vaguedenoiser
  18580. Apply a wavelet based denoiser.
  18581. It transforms each frame from the video input into the wavelet domain,
  18582. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  18583. the obtained coefficients. It does an inverse wavelet transform after.
  18584. Due to wavelet properties, it should give a nice smoothed result, and
  18585. reduced noise, without blurring picture features.
  18586. This filter accepts the following options:
  18587. @table @option
  18588. @item threshold
  18589. The filtering strength. The higher, the more filtered the video will be.
  18590. Hard thresholding can use a higher threshold than soft thresholding
  18591. before the video looks overfiltered. Default value is 2.
  18592. @item method
  18593. The filtering method the filter will use.
  18594. It accepts the following values:
  18595. @table @samp
  18596. @item hard
  18597. All values under the threshold will be zeroed.
  18598. @item soft
  18599. All values under the threshold will be zeroed. All values above will be
  18600. reduced by the threshold.
  18601. @item garrote
  18602. Scales or nullifies coefficients - intermediary between (more) soft and
  18603. (less) hard thresholding.
  18604. @end table
  18605. Default is garrote.
  18606. @item nsteps
  18607. Number of times, the wavelet will decompose the picture. Picture can't
  18608. be decomposed beyond a particular point (typically, 8 for a 640x480
  18609. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  18610. @item percent
  18611. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  18612. @item planes
  18613. A list of the planes to process. By default all planes are processed.
  18614. @item type
  18615. The threshold type the filter will use.
  18616. It accepts the following values:
  18617. @table @samp
  18618. @item universal
  18619. Threshold used is same for all decompositions.
  18620. @item bayes
  18621. Threshold used depends also on each decomposition coefficients.
  18622. @end table
  18623. Default is universal.
  18624. @end table
  18625. @section varblur
  18626. Apply variable blur filter by using 2nd video stream to set blur radius.
  18627. The 2nd stream must have the same dimensions.
  18628. This filter accepts the following options:
  18629. @table @option
  18630. @item min_r
  18631. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  18632. @item max_r
  18633. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  18634. @item planes
  18635. Set which planes to process. By default, all are used.
  18636. @end table
  18637. The @code{varblur} filter also supports the @ref{framesync} options.
  18638. @subsection Commands
  18639. This filter supports all the above options as @ref{commands}.
  18640. @section vectorscope
  18641. Display 2 color component values in the two dimensional graph (which is called
  18642. a vectorscope).
  18643. This filter accepts the following options:
  18644. @table @option
  18645. @item mode, m
  18646. Set vectorscope mode.
  18647. It accepts the following values:
  18648. @table @samp
  18649. @item gray
  18650. @item tint
  18651. Gray values are displayed on graph, higher brightness means more pixels have
  18652. same component color value on location in graph. This is the default mode.
  18653. @item color
  18654. Gray values are displayed on graph. Surrounding pixels values which are not
  18655. present in video frame are drawn in gradient of 2 color components which are
  18656. set by option @code{x} and @code{y}. The 3rd color component is static.
  18657. @item color2
  18658. Actual color components values present in video frame are displayed on graph.
  18659. @item color3
  18660. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  18661. on graph increases value of another color component, which is luminance by
  18662. default values of @code{x} and @code{y}.
  18663. @item color4
  18664. Actual colors present in video frame are displayed on graph. If two different
  18665. colors map to same position on graph then color with higher value of component
  18666. not present in graph is picked.
  18667. @item color5
  18668. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  18669. component picked from radial gradient.
  18670. @end table
  18671. @item x
  18672. Set which color component will be represented on X-axis. Default is @code{1}.
  18673. @item y
  18674. Set which color component will be represented on Y-axis. Default is @code{2}.
  18675. @item intensity, i
  18676. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  18677. of color component which represents frequency of (X, Y) location in graph.
  18678. @item envelope, e
  18679. @table @samp
  18680. @item none
  18681. No envelope, this is default.
  18682. @item instant
  18683. Instant envelope, even darkest single pixel will be clearly highlighted.
  18684. @item peak
  18685. Hold maximum and minimum values presented in graph over time. This way you
  18686. can still spot out of range values without constantly looking at vectorscope.
  18687. @item peak+instant
  18688. Peak and instant envelope combined together.
  18689. @end table
  18690. @item graticule, g
  18691. Set what kind of graticule to draw.
  18692. @table @samp
  18693. @item none
  18694. @item green
  18695. @item color
  18696. @item invert
  18697. @end table
  18698. @item opacity, o
  18699. Set graticule opacity.
  18700. @item flags, f
  18701. Set graticule flags.
  18702. @table @samp
  18703. @item white
  18704. Draw graticule for white point.
  18705. @item black
  18706. Draw graticule for black point.
  18707. @item name
  18708. Draw color points short names.
  18709. @end table
  18710. @item bgopacity, b
  18711. Set background opacity.
  18712. @item lthreshold, l
  18713. Set low threshold for color component not represented on X or Y axis.
  18714. Values lower than this value will be ignored. Default is 0.
  18715. Note this value is multiplied with actual max possible value one pixel component
  18716. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  18717. is 0.1 * 255 = 25.
  18718. @item hthreshold, h
  18719. Set high threshold for color component not represented on X or Y axis.
  18720. Values higher than this value will be ignored. Default is 1.
  18721. Note this value is multiplied with actual max possible value one pixel component
  18722. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  18723. is 0.9 * 255 = 230.
  18724. @item colorspace, c
  18725. Set what kind of colorspace to use when drawing graticule.
  18726. @table @samp
  18727. @item auto
  18728. @item 601
  18729. @item 709
  18730. @end table
  18731. Default is auto.
  18732. @item tint0, t0
  18733. @item tint1, t1
  18734. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  18735. This means no tint, and output will remain gray.
  18736. @end table
  18737. @anchor{vidstabdetect}
  18738. @section vidstabdetect
  18739. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  18740. @ref{vidstabtransform} for pass 2.
  18741. This filter generates a file with relative translation and rotation
  18742. transform information about subsequent frames, which is then used by
  18743. the @ref{vidstabtransform} filter.
  18744. To enable compilation of this filter you need to configure FFmpeg with
  18745. @code{--enable-libvidstab}.
  18746. This filter accepts the following options:
  18747. @table @option
  18748. @item result
  18749. Set the path to the file used to write the transforms information.
  18750. Default value is @file{transforms.trf}.
  18751. @item shakiness
  18752. Set how shaky the video is and how quick the camera is. It accepts an
  18753. integer in the range 1-10, a value of 1 means little shakiness, a
  18754. value of 10 means strong shakiness. Default value is 5.
  18755. @item accuracy
  18756. Set the accuracy of the detection process. It must be a value in the
  18757. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  18758. accuracy. Default value is 15.
  18759. @item stepsize
  18760. Set stepsize of the search process. The region around minimum is
  18761. scanned with 1 pixel resolution. Default value is 6.
  18762. @item mincontrast
  18763. Set minimum contrast. Below this value a local measurement field is
  18764. discarded. Must be a floating point value in the range 0-1. Default
  18765. value is 0.3.
  18766. @item tripod
  18767. Set reference frame number for tripod mode.
  18768. If enabled, the motion of the frames is compared to a reference frame
  18769. in the filtered stream, identified by the specified number. The idea
  18770. is to compensate all movements in a more-or-less static scene and keep
  18771. the camera view absolutely still.
  18772. If set to 0, it is disabled. The frames are counted starting from 1.
  18773. @item show
  18774. Show fields and transforms in the resulting frames. It accepts an
  18775. integer in the range 0-2. Default value is 0, which disables any
  18776. visualization.
  18777. @item fileformat
  18778. Format for the transforms data file to be written.
  18779. Acceptable values are
  18780. @table @samp
  18781. @item ascii
  18782. Human-readable plain text
  18783. @item binary
  18784. Binary format, roughly 40% smaller than @code{ascii}. (@emph{default})
  18785. @end table
  18786. @end table
  18787. @subsection Examples
  18788. @itemize
  18789. @item
  18790. Use default values:
  18791. @example
  18792. vidstabdetect
  18793. @end example
  18794. @item
  18795. Analyze strongly shaky movie and put the results in file
  18796. @file{mytransforms.trf}:
  18797. @example
  18798. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  18799. @end example
  18800. @item
  18801. Visualize the result of internal transformations in the resulting
  18802. video:
  18803. @example
  18804. vidstabdetect=show=1
  18805. @end example
  18806. @item
  18807. Analyze a video with medium shakiness using @command{ffmpeg}:
  18808. @example
  18809. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  18810. @end example
  18811. @end itemize
  18812. @anchor{vidstabtransform}
  18813. @section vidstabtransform
  18814. Video stabilization/deshaking: pass 2 of 2,
  18815. see @ref{vidstabdetect} for pass 1.
  18816. Read a file with transform information for each frame and
  18817. apply/compensate them. Together with the @ref{vidstabdetect}
  18818. filter this can be used to deshake videos. See also
  18819. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  18820. the @ref{unsharp} filter, see below.
  18821. To enable compilation of this filter you need to configure FFmpeg with
  18822. @code{--enable-libvidstab}.
  18823. @subsection Options
  18824. @table @option
  18825. @item input
  18826. Set path to the file used to read the transforms. Default value is
  18827. @file{transforms.trf}.
  18828. @item smoothing
  18829. Set the number of frames (value*2 + 1) used for lowpass filtering the
  18830. camera movements. Default value is 10.
  18831. For example a number of 10 means that 21 frames are used (10 in the
  18832. past and 10 in the future) to smoothen the motion in the video. A
  18833. larger value leads to a smoother video, but limits the acceleration of
  18834. the camera (pan/tilt movements). 0 is a special case where a static
  18835. camera is simulated.
  18836. @item optalgo
  18837. Set the camera path optimization algorithm.
  18838. Accepted values are:
  18839. @table @samp
  18840. @item gauss
  18841. gaussian kernel low-pass filter on camera motion (default)
  18842. @item avg
  18843. averaging on transformations
  18844. @end table
  18845. @item maxshift
  18846. Set maximal number of pixels to translate frames. Default value is -1,
  18847. meaning no limit.
  18848. @item maxangle
  18849. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  18850. value is -1, meaning no limit.
  18851. @item crop
  18852. Specify how to deal with borders that may be visible due to movement
  18853. compensation.
  18854. Available values are:
  18855. @table @samp
  18856. @item keep
  18857. keep image information from previous frame (default)
  18858. @item black
  18859. fill the border black
  18860. @end table
  18861. @item invert
  18862. Invert transforms if set to 1. Default value is 0.
  18863. @item relative
  18864. Consider transforms as relative to previous frame if set to 1,
  18865. absolute if set to 0. Default value is 0.
  18866. @item zoom
  18867. Set percentage to zoom. A positive value will result in a zoom-in
  18868. effect, a negative value in a zoom-out effect. Default value is 0 (no
  18869. zoom).
  18870. @item optzoom
  18871. Set optimal zooming to avoid borders.
  18872. Accepted values are:
  18873. @table @samp
  18874. @item 0
  18875. disabled
  18876. @item 1
  18877. optimal static zoom value is determined (only very strong movements
  18878. will lead to visible borders) (default)
  18879. @item 2
  18880. optimal adaptive zoom value is determined (no borders will be
  18881. visible), see @option{zoomspeed}
  18882. @end table
  18883. Note that the value given at zoom is added to the one calculated here.
  18884. @item zoomspeed
  18885. Set percent to zoom maximally each frame (enabled when
  18886. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  18887. 0.25.
  18888. @item interpol
  18889. Specify type of interpolation.
  18890. Available values are:
  18891. @table @samp
  18892. @item no
  18893. no interpolation
  18894. @item linear
  18895. linear only horizontal
  18896. @item bilinear
  18897. linear in both directions (default)
  18898. @item bicubic
  18899. cubic in both directions (slow)
  18900. @end table
  18901. @item tripod
  18902. Enable virtual tripod mode if set to 1, which is equivalent to
  18903. @code{relative=0:smoothing=0}. Default value is 0.
  18904. Use also @code{tripod} option of @ref{vidstabdetect}.
  18905. @item debug
  18906. Increase log verbosity if set to 1. Also the detected global motions
  18907. are written to the temporary file @file{global_motions.trf}. Default
  18908. value is 0.
  18909. @end table
  18910. @subsection Examples
  18911. @itemize
  18912. @item
  18913. Use @command{ffmpeg} for a typical stabilization with default values:
  18914. @example
  18915. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  18916. @end example
  18917. Note the use of the @ref{unsharp} filter which is always recommended.
  18918. @item
  18919. Zoom in a bit more and load transform data from a given file:
  18920. @example
  18921. vidstabtransform=zoom=5:input="mytransforms.trf"
  18922. @end example
  18923. @item
  18924. Smoothen the video even more:
  18925. @example
  18926. vidstabtransform=smoothing=30
  18927. @end example
  18928. @end itemize
  18929. @section vflip
  18930. Flip the input video vertically.
  18931. For example, to vertically flip a video with @command{ffmpeg}:
  18932. @example
  18933. ffmpeg -i in.avi -vf "vflip" out.avi
  18934. @end example
  18935. @section vfrdet
  18936. Detect variable frame rate video.
  18937. This filter tries to detect if the input is variable or constant frame rate.
  18938. At end it will output number of frames detected as having variable delta pts,
  18939. and ones with constant delta pts.
  18940. If there was frames with variable delta, than it will also show min, max and
  18941. average delta encountered.
  18942. @section vibrance
  18943. Boost or alter saturation.
  18944. The filter accepts the following options:
  18945. @table @option
  18946. @item intensity
  18947. Set strength of boost if positive value or strength of alter if negative value.
  18948. Default is 0. Allowed range is from -2 to 2.
  18949. @item rbal
  18950. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  18951. @item gbal
  18952. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  18953. @item bbal
  18954. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  18955. @item rlum
  18956. Set the red luma coefficient.
  18957. @item glum
  18958. Set the green luma coefficient.
  18959. @item blum
  18960. Set the blue luma coefficient.
  18961. @item alternate
  18962. If @code{intensity} is negative and this is set to 1, colors will change,
  18963. otherwise colors will be less saturated, more towards gray.
  18964. @end table
  18965. @subsection Commands
  18966. This filter supports the all above options as @ref{commands}.
  18967. @section vif
  18968. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  18969. This filter takes two input videos.
  18970. Both input videos must have the same resolution and pixel format for
  18971. this filter to work correctly. Also it assumes that both inputs
  18972. have the same number of frames, which are compared one by one.
  18973. The obtained average VIF score is printed through the logging system.
  18974. The filter stores the calculated VIF score of each frame.
  18975. This filter also supports the @ref{framesync} options.
  18976. In the below example the input file @file{main.mpg} being processed is compared
  18977. with the reference file @file{ref.mpg}.
  18978. @example
  18979. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  18980. @end example
  18981. @anchor{vignette}
  18982. @section vignette
  18983. Make or reverse a natural vignetting effect.
  18984. The filter accepts the following options:
  18985. @table @option
  18986. @item angle, a
  18987. Set lens angle expression as a number of radians.
  18988. The value is clipped in the @code{[0,PI/2]} range.
  18989. Default value: @code{"PI/5"}
  18990. @item x0
  18991. @item y0
  18992. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  18993. by default.
  18994. @item mode
  18995. Set forward/backward mode.
  18996. Available modes are:
  18997. @table @samp
  18998. @item forward
  18999. The larger the distance from the central point, the darker the image becomes.
  19000. @item backward
  19001. The larger the distance from the central point, the brighter the image becomes.
  19002. This can be used to reverse a vignette effect, though there is no automatic
  19003. detection to extract the lens @option{angle} and other settings (yet). It can
  19004. also be used to create a burning effect.
  19005. @end table
  19006. Default value is @samp{forward}.
  19007. @item eval
  19008. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  19009. It accepts the following values:
  19010. @table @samp
  19011. @item init
  19012. Evaluate expressions only once during the filter initialization.
  19013. @item frame
  19014. Evaluate expressions for each incoming frame. This is way slower than the
  19015. @samp{init} mode since it requires all the scalers to be re-computed, but it
  19016. allows advanced dynamic expressions.
  19017. @end table
  19018. Default value is @samp{init}.
  19019. @item dither
  19020. Set dithering to reduce the circular banding effects. Default is @code{1}
  19021. (enabled).
  19022. @item aspect
  19023. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  19024. Setting this value to the SAR of the input will make a rectangular vignetting
  19025. following the dimensions of the video.
  19026. Default is @code{1/1}.
  19027. @end table
  19028. @subsection Expressions
  19029. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  19030. following parameters.
  19031. @table @option
  19032. @item w
  19033. @item h
  19034. input width and height
  19035. @item n
  19036. the number of input frame, starting from 0
  19037. @item pts
  19038. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  19039. @var{TB} units, NAN if undefined
  19040. @item r
  19041. frame rate of the input video, NAN if the input frame rate is unknown
  19042. @item t
  19043. the PTS (Presentation TimeStamp) of the filtered video frame,
  19044. expressed in seconds, NAN if undefined
  19045. @item tb
  19046. time base of the input video
  19047. @end table
  19048. @subsection Examples
  19049. @itemize
  19050. @item
  19051. Apply simple strong vignetting effect:
  19052. @example
  19053. vignette=PI/4
  19054. @end example
  19055. @item
  19056. Make a flickering vignetting:
  19057. @example
  19058. vignette='PI/4+random(1)*PI/50':eval=frame
  19059. @end example
  19060. @end itemize
  19061. @section vmafmotion
  19062. Obtain the average VMAF motion score of a video.
  19063. It is one of the component metrics of VMAF.
  19064. The obtained average motion score is printed through the logging system.
  19065. The filter accepts the following options:
  19066. @table @option
  19067. @item stats_file
  19068. If specified, the filter will use the named file to save the motion score of
  19069. each frame with respect to the previous frame.
  19070. When filename equals "-" the data is sent to standard output.
  19071. @end table
  19072. Example:
  19073. @example
  19074. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  19075. @end example
  19076. @anchor{vstack}
  19077. @section vstack
  19078. Stack input videos vertically.
  19079. All streams must be of same pixel format and of same width.
  19080. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  19081. to create same output.
  19082. The filter accepts the following options:
  19083. @table @option
  19084. @item inputs
  19085. Set number of input streams. Default is 2.
  19086. @item shortest
  19087. If set to 1, force the output to terminate when the shortest input
  19088. terminates. Default value is 0.
  19089. @end table
  19090. @section w3fdif
  19091. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  19092. Deinterlacing Filter").
  19093. Based on the process described by Martin Weston for BBC R&D, and
  19094. implemented based on the de-interlace algorithm written by Jim
  19095. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  19096. uses filter coefficients calculated by BBC R&D.
  19097. This filter uses field-dominance information in frame to decide which
  19098. of each pair of fields to place first in the output.
  19099. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  19100. There are two sets of filter coefficients, so called "simple"
  19101. and "complex". Which set of filter coefficients is used can
  19102. be set by passing an optional parameter:
  19103. @table @option
  19104. @item filter
  19105. Set the interlacing filter coefficients. Accepts one of the following values:
  19106. @table @samp
  19107. @item simple
  19108. Simple filter coefficient set.
  19109. @item complex
  19110. More-complex filter coefficient set.
  19111. @end table
  19112. Default value is @samp{complex}.
  19113. @item mode
  19114. The interlacing mode to adopt. It accepts one of the following values:
  19115. @table @option
  19116. @item frame
  19117. Output one frame for each frame.
  19118. @item field
  19119. Output one frame for each field.
  19120. @end table
  19121. The default value is @code{field}.
  19122. @item parity
  19123. The picture field parity assumed for the input interlaced video. It accepts one
  19124. of the following values:
  19125. @table @option
  19126. @item tff
  19127. Assume the top field is first.
  19128. @item bff
  19129. Assume the bottom field is first.
  19130. @item auto
  19131. Enable automatic detection of field parity.
  19132. @end table
  19133. The default value is @code{auto}.
  19134. If the interlacing is unknown or the decoder does not export this information,
  19135. top field first will be assumed.
  19136. @item deint
  19137. Specify which frames to deinterlace. Accepts one of the following values:
  19138. @table @samp
  19139. @item all
  19140. Deinterlace all frames,
  19141. @item interlaced
  19142. Only deinterlace frames marked as interlaced.
  19143. @end table
  19144. Default value is @samp{all}.
  19145. @end table
  19146. @subsection Commands
  19147. This filter supports same @ref{commands} as options.
  19148. @section waveform
  19149. Video waveform monitor.
  19150. The waveform monitor plots color component intensity. By default luma
  19151. only. Each column of the waveform corresponds to a column of pixels in the
  19152. source video.
  19153. It accepts the following options:
  19154. @table @option
  19155. @item mode, m
  19156. Can be either @code{row}, or @code{column}. Default is @code{column}.
  19157. In row mode, the graph on the left side represents color component value 0 and
  19158. the right side represents value = 255. In column mode, the top side represents
  19159. color component value = 0 and bottom side represents value = 255.
  19160. @item intensity, i
  19161. Set intensity. Smaller values are useful to find out how many values of the same
  19162. luminance are distributed across input rows/columns.
  19163. Default value is @code{0.04}. Allowed range is [0, 1].
  19164. @item mirror, r
  19165. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  19166. In mirrored mode, higher values will be represented on the left
  19167. side for @code{row} mode and at the top for @code{column} mode. Default is
  19168. @code{1} (mirrored).
  19169. @item display, d
  19170. Set display mode.
  19171. It accepts the following values:
  19172. @table @samp
  19173. @item overlay
  19174. Presents information identical to that in the @code{parade}, except
  19175. that the graphs representing color components are superimposed directly
  19176. over one another.
  19177. This display mode makes it easier to spot relative differences or similarities
  19178. in overlapping areas of the color components that are supposed to be identical,
  19179. such as neutral whites, grays, or blacks.
  19180. @item stack
  19181. Display separate graph for the color components side by side in
  19182. @code{row} mode or one below the other in @code{column} mode.
  19183. @item parade
  19184. Display separate graph for the color components side by side in
  19185. @code{column} mode or one below the other in @code{row} mode.
  19186. Using this display mode makes it easy to spot color casts in the highlights
  19187. and shadows of an image, by comparing the contours of the top and the bottom
  19188. graphs of each waveform. Since whites, grays, and blacks are characterized
  19189. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  19190. should display three waveforms of roughly equal width/height. If not, the
  19191. correction is easy to perform by making level adjustments the three waveforms.
  19192. @end table
  19193. Default is @code{stack}.
  19194. @item components, c
  19195. Set which color components to display. Default is 1, which means only luma
  19196. or red color component if input is in RGB colorspace. If is set for example to
  19197. 7 it will display all 3 (if) available color components.
  19198. @item envelope, e
  19199. @table @samp
  19200. @item none
  19201. No envelope, this is default.
  19202. @item instant
  19203. Instant envelope, minimum and maximum values presented in graph will be easily
  19204. visible even with small @code{step} value.
  19205. @item peak
  19206. Hold minimum and maximum values presented in graph across time. This way you
  19207. can still spot out of range values without constantly looking at waveforms.
  19208. @item peak+instant
  19209. Peak and instant envelope combined together.
  19210. @end table
  19211. @item filter, f
  19212. @table @samp
  19213. @item lowpass
  19214. No filtering, this is default.
  19215. @item flat
  19216. Luma and chroma combined together.
  19217. @item aflat
  19218. Similar as above, but shows difference between blue and red chroma.
  19219. @item xflat
  19220. Similar as above, but use different colors.
  19221. @item yflat
  19222. Similar as above, but again with different colors.
  19223. @item chroma
  19224. Displays only chroma.
  19225. @item color
  19226. Displays actual color value on waveform.
  19227. @item acolor
  19228. Similar as above, but with luma showing frequency of chroma values.
  19229. @end table
  19230. @item graticule, g
  19231. Set which graticule to display.
  19232. @table @samp
  19233. @item none
  19234. Do not display graticule.
  19235. @item green
  19236. Display green graticule showing legal broadcast ranges.
  19237. @item orange
  19238. Display orange graticule showing legal broadcast ranges.
  19239. @item invert
  19240. Display invert graticule showing legal broadcast ranges.
  19241. @end table
  19242. @item opacity, o
  19243. Set graticule opacity.
  19244. @item flags, fl
  19245. Set graticule flags.
  19246. @table @samp
  19247. @item numbers
  19248. Draw numbers above lines. By default enabled.
  19249. @item dots
  19250. Draw dots instead of lines.
  19251. @end table
  19252. @item scale, s
  19253. Set scale used for displaying graticule.
  19254. @table @samp
  19255. @item digital
  19256. @item millivolts
  19257. @item ire
  19258. @end table
  19259. Default is digital.
  19260. @item bgopacity, b
  19261. Set background opacity.
  19262. @item tint0, t0
  19263. @item tint1, t1
  19264. Set tint for output.
  19265. Only used with lowpass filter and when display is not overlay and input
  19266. pixel formats are not RGB.
  19267. @item fitmode, fm
  19268. Set sample aspect ratio of video output frames.
  19269. Can be used to configure waveform so it is not
  19270. streched too much in one of directions.
  19271. @table @samp
  19272. @item none
  19273. Set sample aspect ration to 1/1.
  19274. @item size
  19275. Set sample aspect ratio to match input size of video
  19276. @end table
  19277. Default is @samp{none}.
  19278. @item input
  19279. Set input formats for filter to pick from.
  19280. Can be @samp{all}, for selecting from all available formats,
  19281. or @samp{first}, for selecting first available format.
  19282. Default is @samp{first}.
  19283. @end table
  19284. @section weave, doubleweave
  19285. The @code{weave} takes a field-based video input and join
  19286. each two sequential fields into single frame, producing a new double
  19287. height clip with half the frame rate and half the frame count.
  19288. The @code{doubleweave} works same as @code{weave} but without
  19289. halving frame rate and frame count.
  19290. It accepts the following option:
  19291. @table @option
  19292. @item first_field
  19293. Set first field. Available values are:
  19294. @table @samp
  19295. @item top, t
  19296. Set the frame as top-field-first.
  19297. @item bottom, b
  19298. Set the frame as bottom-field-first.
  19299. @end table
  19300. @end table
  19301. @subsection Examples
  19302. @itemize
  19303. @item
  19304. Interlace video using @ref{select} and @ref{separatefields} filter:
  19305. @example
  19306. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  19307. @end example
  19308. @end itemize
  19309. @section xbr
  19310. Apply the xBR high-quality magnification filter which is designed for pixel
  19311. art. It follows a set of edge-detection rules, see
  19312. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  19313. It accepts the following option:
  19314. @table @option
  19315. @item n
  19316. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  19317. @code{3xBR} and @code{4} for @code{4xBR}.
  19318. Default is @code{3}.
  19319. @end table
  19320. @section xcorrelate
  19321. Apply normalized cross-correlation between first and second input video stream.
  19322. Second input video stream dimensions must be lower than first input video stream.
  19323. The filter accepts the following options:
  19324. @table @option
  19325. @item planes
  19326. Set which planes to process.
  19327. @item secondary
  19328. Set which secondary video frames will be processed from second input video stream,
  19329. can be @var{first} or @var{all}. Default is @var{all}.
  19330. @end table
  19331. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  19332. @section xfade
  19333. Apply cross fade from one input video stream to another input video stream.
  19334. The cross fade is applied for specified duration.
  19335. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  19336. frame rate and timebase.
  19337. The filter accepts the following options:
  19338. @table @option
  19339. @item transition
  19340. Set one of available transition effects:
  19341. @table @samp
  19342. @item custom
  19343. @item fade
  19344. @item wipeleft
  19345. @item wiperight
  19346. @item wipeup
  19347. @item wipedown
  19348. @item slideleft
  19349. @item slideright
  19350. @item slideup
  19351. @item slidedown
  19352. @item circlecrop
  19353. @item rectcrop
  19354. @item distance
  19355. @item fadeblack
  19356. @item fadewhite
  19357. @item radial
  19358. @item smoothleft
  19359. @item smoothright
  19360. @item smoothup
  19361. @item smoothdown
  19362. @item circleopen
  19363. @item circleclose
  19364. @item vertopen
  19365. @item vertclose
  19366. @item horzopen
  19367. @item horzclose
  19368. @item dissolve
  19369. @item pixelize
  19370. @item diagtl
  19371. @item diagtr
  19372. @item diagbl
  19373. @item diagbr
  19374. @item hlslice
  19375. @item hrslice
  19376. @item vuslice
  19377. @item vdslice
  19378. @item hblur
  19379. @item fadegrays
  19380. @item wipetl
  19381. @item wipetr
  19382. @item wipebl
  19383. @item wipebr
  19384. @item squeezeh
  19385. @item squeezev
  19386. @item zoomin
  19387. @item fadefast
  19388. @item fadeslow
  19389. @item hlwind
  19390. @item hrwind
  19391. @item vuwind
  19392. @item vdwind
  19393. @item coverleft
  19394. @item coverright
  19395. @item coverup
  19396. @item coverdown
  19397. @item revealleft
  19398. @item revealright
  19399. @item revealup
  19400. @item revealdown
  19401. @end table
  19402. Default transition effect is fade.
  19403. @item duration
  19404. Set cross fade duration in seconds.
  19405. Range is 0 to 60 seconds.
  19406. Default duration is 1 second.
  19407. @item offset
  19408. Set cross fade start relative to first input stream in seconds.
  19409. Default offset is 0.
  19410. @item expr
  19411. Set expression for custom transition effect.
  19412. The expressions can use the following variables and functions:
  19413. @table @option
  19414. @item X
  19415. @item Y
  19416. The coordinates of the current sample.
  19417. @item W
  19418. @item H
  19419. The width and height of the image.
  19420. @item P
  19421. Progress of transition effect.
  19422. @item PLANE
  19423. Currently processed plane.
  19424. @item A
  19425. Return value of first input at current location and plane.
  19426. @item B
  19427. Return value of second input at current location and plane.
  19428. @item a0(x, y)
  19429. @item a1(x, y)
  19430. @item a2(x, y)
  19431. @item a3(x, y)
  19432. Return the value of the pixel at location (@var{x},@var{y}) of the
  19433. first/second/third/fourth component of first input.
  19434. @item b0(x, y)
  19435. @item b1(x, y)
  19436. @item b2(x, y)
  19437. @item b3(x, y)
  19438. Return the value of the pixel at location (@var{x},@var{y}) of the
  19439. first/second/third/fourth component of second input.
  19440. @end table
  19441. @end table
  19442. @subsection Examples
  19443. @itemize
  19444. @item
  19445. Cross fade from one input video to another input video, with fade transition and duration of transition
  19446. of 2 seconds starting at offset of 5 seconds:
  19447. @example
  19448. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  19449. @end example
  19450. @end itemize
  19451. @section xmedian
  19452. Pick median pixels from several input videos.
  19453. The filter accepts the following options:
  19454. @table @option
  19455. @item inputs
  19456. Set number of inputs.
  19457. Default is 3. Allowed range is from 3 to 255.
  19458. If number of inputs is even number, than result will be mean value between two median values.
  19459. @item planes
  19460. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  19461. @item percentile
  19462. Set median percentile. Default value is @code{0.5}.
  19463. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  19464. minimum values, and @code{1} maximum values.
  19465. @end table
  19466. @subsection Commands
  19467. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  19468. @anchor{xstack}
  19469. @section xstack
  19470. Stack video inputs into custom layout.
  19471. All streams must be of same pixel format.
  19472. The filter accepts the following options:
  19473. @table @option
  19474. @item inputs
  19475. Set number of input streams. Default is 2.
  19476. @item layout
  19477. Specify layout of inputs.
  19478. This option requires the desired layout configuration to be explicitly set by the user.
  19479. This sets position of each video input in output. Each input
  19480. is separated by '|'.
  19481. The first number represents the column, and the second number represents the row.
  19482. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  19483. where X is video input from which to take width or height.
  19484. Multiple values can be used when separated by '+'. In such
  19485. case values are summed together.
  19486. Note that if inputs are of different sizes gaps may appear, as not all of
  19487. the output video frame will be filled. Similarly, videos can overlap each
  19488. other if their position doesn't leave enough space for the full frame of
  19489. adjoining videos.
  19490. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  19491. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  19492. the user. Either @code{grid} or @code{layout} can be specified at a time.
  19493. Specifying both will result in an error.
  19494. @item grid
  19495. Specify a fixed size grid of inputs.
  19496. This option is used to create a fixed size grid of the input streams. Set the
  19497. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  19498. input streams and they will be arranged as a grid with @code{ROWS} rows and
  19499. @code{COLUMNS} columns. When using this option, each input stream within a row
  19500. must have the same height and all the rows must have the same width.
  19501. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  19502. set to @code{ROWS * COLUMNS}.
  19503. For 2 inputs, a default grid of @code{2x1} (equivalent to
  19504. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  19505. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  19506. Specifying both will result in an error.
  19507. @item shortest
  19508. If set to 1, force the output to terminate when the shortest input
  19509. terminates. Default value is 0.
  19510. @item fill
  19511. If set to valid color, all unused pixels will be filled with that color.
  19512. By default fill is set to none, so it is disabled.
  19513. @end table
  19514. @subsection Examples
  19515. @itemize
  19516. @item
  19517. Display 4 inputs into 2x2 grid.
  19518. Layout:
  19519. @example
  19520. input1(0, 0) | input3(w0, 0)
  19521. input2(0, h0) | input4(w0, h0)
  19522. @end example
  19523. @example
  19524. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  19525. @end example
  19526. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19527. @item
  19528. Display 4 inputs into 1x4 grid.
  19529. Layout:
  19530. @example
  19531. input1(0, 0)
  19532. input2(0, h0)
  19533. input3(0, h0+h1)
  19534. input4(0, h0+h1+h2)
  19535. @end example
  19536. @example
  19537. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  19538. @end example
  19539. Note that if inputs are of different widths, unused space will appear.
  19540. @item
  19541. Display 9 inputs into 3x3 grid.
  19542. Layout:
  19543. @example
  19544. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  19545. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  19546. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  19547. @end example
  19548. @example
  19549. 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
  19550. @end example
  19551. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19552. @item
  19553. Display 16 inputs into 4x4 grid.
  19554. Layout:
  19555. @example
  19556. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  19557. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  19558. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  19559. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  19560. @end example
  19561. @example
  19562. 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|
  19563. 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
  19564. @end example
  19565. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19566. @end itemize
  19567. @anchor{yadif}
  19568. @section yadif
  19569. Deinterlace the input video ("yadif" means "yet another deinterlacing
  19570. filter").
  19571. It accepts the following parameters:
  19572. @table @option
  19573. @item mode
  19574. The interlacing mode to adopt. It accepts one of the following values:
  19575. @table @option
  19576. @item 0, send_frame
  19577. Output one frame for each frame.
  19578. @item 1, send_field
  19579. Output one frame for each field.
  19580. @item 2, send_frame_nospatial
  19581. Like @code{send_frame}, but it skips the spatial interlacing check.
  19582. @item 3, send_field_nospatial
  19583. Like @code{send_field}, but it skips the spatial interlacing check.
  19584. @end table
  19585. The default value is @code{send_frame}.
  19586. @item parity
  19587. The picture field parity assumed for the input interlaced video. It accepts one
  19588. of the following values:
  19589. @table @option
  19590. @item 0, tff
  19591. Assume the top field is first.
  19592. @item 1, bff
  19593. Assume the bottom field is first.
  19594. @item -1, auto
  19595. Enable automatic detection of field parity.
  19596. @end table
  19597. The default value is @code{auto}.
  19598. If the interlacing is unknown or the decoder does not export this information,
  19599. top field first will be assumed.
  19600. @item deint
  19601. Specify which frames to deinterlace. Accepts one of the following
  19602. values:
  19603. @table @option
  19604. @item 0, all
  19605. Deinterlace all frames.
  19606. @item 1, interlaced
  19607. Only deinterlace frames marked as interlaced.
  19608. @end table
  19609. The default value is @code{all}.
  19610. @end table
  19611. @section yadif_cuda
  19612. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  19613. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  19614. and/or nvenc.
  19615. It accepts the following parameters:
  19616. @table @option
  19617. @item mode
  19618. The interlacing mode to adopt. It accepts one of the following values:
  19619. @table @option
  19620. @item 0, send_frame
  19621. Output one frame for each frame.
  19622. @item 1, send_field
  19623. Output one frame for each field.
  19624. @item 2, send_frame_nospatial
  19625. Like @code{send_frame}, but it skips the spatial interlacing check.
  19626. @item 3, send_field_nospatial
  19627. Like @code{send_field}, but it skips the spatial interlacing check.
  19628. @end table
  19629. The default value is @code{send_frame}.
  19630. @item parity
  19631. The picture field parity assumed for the input interlaced video. It accepts one
  19632. of the following values:
  19633. @table @option
  19634. @item 0, tff
  19635. Assume the top field is first.
  19636. @item 1, bff
  19637. Assume the bottom field is first.
  19638. @item -1, auto
  19639. Enable automatic detection of field parity.
  19640. @end table
  19641. The default value is @code{auto}.
  19642. If the interlacing is unknown or the decoder does not export this information,
  19643. top field first will be assumed.
  19644. @item deint
  19645. Specify which frames to deinterlace. Accepts one of the following
  19646. values:
  19647. @table @option
  19648. @item 0, all
  19649. Deinterlace all frames.
  19650. @item 1, interlaced
  19651. Only deinterlace frames marked as interlaced.
  19652. @end table
  19653. The default value is @code{all}.
  19654. @end table
  19655. @section yaepblur
  19656. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  19657. The algorithm is described in
  19658. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  19659. It accepts the following parameters:
  19660. @table @option
  19661. @item radius, r
  19662. Set the window radius. Default value is 3.
  19663. @item planes, p
  19664. Set which planes to filter. Default is only the first plane.
  19665. @item sigma, s
  19666. Set blur strength. Default value is 128.
  19667. @end table
  19668. @subsection Commands
  19669. This filter supports same @ref{commands} as options.
  19670. @section zoompan
  19671. Apply Zoom & Pan effect.
  19672. This filter accepts the following options:
  19673. @table @option
  19674. @item zoom, z
  19675. Set the zoom expression. Range is 1-10. Default is 1.
  19676. @item x
  19677. @item y
  19678. Set the x and y expression. Default is 0.
  19679. @item d
  19680. Set the duration expression in number of frames.
  19681. This sets for how many number of frames effect will last for
  19682. single input image. Default is 90.
  19683. @item s
  19684. Set the output image size, default is 'hd720'.
  19685. @item fps
  19686. Set the output frame rate, default is '25'.
  19687. @end table
  19688. Each expression can contain the following constants:
  19689. @table @option
  19690. @item in_w, iw
  19691. Input width.
  19692. @item in_h, ih
  19693. Input height.
  19694. @item out_w, ow
  19695. Output width.
  19696. @item out_h, oh
  19697. Output height.
  19698. @item in
  19699. Input frame count.
  19700. @item on
  19701. Output frame count.
  19702. @item in_time, it
  19703. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  19704. @item out_time, time, ot
  19705. The output timestamp expressed in seconds.
  19706. @item x
  19707. @item y
  19708. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  19709. for current input frame.
  19710. @item px
  19711. @item py
  19712. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  19713. not yet such frame (first input frame).
  19714. @item zoom
  19715. Last calculated zoom from 'z' expression for current input frame.
  19716. @item pzoom
  19717. Last calculated zoom of last output frame of previous input frame.
  19718. @item duration
  19719. Number of output frames for current input frame. Calculated from 'd' expression
  19720. for each input frame.
  19721. @item pduration
  19722. number of output frames created for previous input frame
  19723. @item a
  19724. Rational number: input width / input height
  19725. @item sar
  19726. sample aspect ratio
  19727. @item dar
  19728. display aspect ratio
  19729. @end table
  19730. @subsection Examples
  19731. @itemize
  19732. @item
  19733. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  19734. @example
  19735. 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
  19736. @end example
  19737. @item
  19738. Zoom in up to 1.5x and pan always at center of picture:
  19739. @example
  19740. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19741. @end example
  19742. @item
  19743. Same as above but without pausing:
  19744. @example
  19745. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19746. @end example
  19747. @item
  19748. Zoom in 2x into center of picture only for the first second of the input video:
  19749. @example
  19750. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19751. @end example
  19752. @end itemize
  19753. @anchor{zscale}
  19754. @section zscale
  19755. Scale (resize) the input video, using the z.lib library:
  19756. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  19757. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  19758. The zscale filter forces the output display aspect ratio to be the same
  19759. as the input, by changing the output sample aspect ratio.
  19760. If the input image format is different from the format requested by
  19761. the next filter, the zscale filter will convert the input to the
  19762. requested format.
  19763. @subsection Options
  19764. The filter accepts the following options.
  19765. @table @option
  19766. @item width, w
  19767. @item height, h
  19768. Set the output video dimension expression. Default value is the input
  19769. dimension.
  19770. If the @var{width} or @var{w} value is 0, the input width is used for
  19771. the output. If the @var{height} or @var{h} value is 0, the input height
  19772. is used for the output.
  19773. If one and only one of the values is -n with n >= 1, the zscale filter
  19774. will use a value that maintains the aspect ratio of the input image,
  19775. calculated from the other specified dimension. After that it will,
  19776. however, make sure that the calculated dimension is divisible by n and
  19777. adjust the value if necessary.
  19778. If both values are -n with n >= 1, the behavior will be identical to
  19779. both values being set to 0 as previously detailed.
  19780. See below for the list of accepted constants for use in the dimension
  19781. expression.
  19782. @item size, s
  19783. Set the video size. For the syntax of this option, check the
  19784. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19785. @item dither, d
  19786. Set the dither type.
  19787. Possible values are:
  19788. @table @var
  19789. @item none
  19790. @item ordered
  19791. @item random
  19792. @item error_diffusion
  19793. @end table
  19794. Default is none.
  19795. @item filter, f
  19796. Set the resize filter type.
  19797. Possible values are:
  19798. @table @var
  19799. @item point
  19800. @item bilinear
  19801. @item bicubic
  19802. @item spline16
  19803. @item spline36
  19804. @item lanczos
  19805. @end table
  19806. Default is bilinear.
  19807. @item range, r
  19808. Set the color range.
  19809. Possible values are:
  19810. @table @var
  19811. @item input
  19812. @item limited
  19813. @item full
  19814. @end table
  19815. Default is same as input.
  19816. @item primaries, p
  19817. Set the color primaries.
  19818. Possible values are:
  19819. @table @var
  19820. @item input
  19821. @item 709
  19822. @item unspecified
  19823. @item 170m
  19824. @item 240m
  19825. @item 2020
  19826. @end table
  19827. Default is same as input.
  19828. @item transfer, t
  19829. Set the transfer characteristics.
  19830. Possible values are:
  19831. @table @var
  19832. @item input
  19833. @item 709
  19834. @item unspecified
  19835. @item 601
  19836. @item linear
  19837. @item 2020_10
  19838. @item 2020_12
  19839. @item smpte2084
  19840. @item iec61966-2-1
  19841. @item arib-std-b67
  19842. @end table
  19843. Default is same as input.
  19844. @item matrix, m
  19845. Set the colorspace matrix.
  19846. Possible value are:
  19847. @table @var
  19848. @item input
  19849. @item 709
  19850. @item unspecified
  19851. @item 470bg
  19852. @item 170m
  19853. @item 2020_ncl
  19854. @item 2020_cl
  19855. @end table
  19856. Default is same as input.
  19857. @item rangein, rin
  19858. Set the input color range.
  19859. Possible values are:
  19860. @table @var
  19861. @item input
  19862. @item limited
  19863. @item full
  19864. @end table
  19865. Default is same as input.
  19866. @item primariesin, pin
  19867. Set the input color primaries.
  19868. Possible values are:
  19869. @table @var
  19870. @item input
  19871. @item 709
  19872. @item unspecified
  19873. @item 170m
  19874. @item 240m
  19875. @item 2020
  19876. @end table
  19877. Default is same as input.
  19878. @item transferin, tin
  19879. Set the input transfer characteristics.
  19880. Possible values are:
  19881. @table @var
  19882. @item input
  19883. @item 709
  19884. @item unspecified
  19885. @item 601
  19886. @item linear
  19887. @item 2020_10
  19888. @item 2020_12
  19889. @end table
  19890. Default is same as input.
  19891. @item matrixin, min
  19892. Set the input colorspace matrix.
  19893. Possible value are:
  19894. @table @var
  19895. @item input
  19896. @item 709
  19897. @item unspecified
  19898. @item 470bg
  19899. @item 170m
  19900. @item 2020_ncl
  19901. @item 2020_cl
  19902. @end table
  19903. @item chromal, c
  19904. Set the output chroma location.
  19905. Possible values are:
  19906. @table @var
  19907. @item input
  19908. @item left
  19909. @item center
  19910. @item topleft
  19911. @item top
  19912. @item bottomleft
  19913. @item bottom
  19914. @end table
  19915. @item chromalin, cin
  19916. Set the input chroma location.
  19917. Possible values are:
  19918. @table @var
  19919. @item input
  19920. @item left
  19921. @item center
  19922. @item topleft
  19923. @item top
  19924. @item bottomleft
  19925. @item bottom
  19926. @end table
  19927. @item npl
  19928. Set the nominal peak luminance.
  19929. @item param_a
  19930. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  19931. filter taps for lanczos.
  19932. @item param_b
  19933. Parameter B for scaling filters. Parameter "c" for bicubic.
  19934. @end table
  19935. The values of the @option{w} and @option{h} options are expressions
  19936. containing the following constants:
  19937. @table @var
  19938. @item in_w
  19939. @item in_h
  19940. The input width and height
  19941. @item iw
  19942. @item ih
  19943. These are the same as @var{in_w} and @var{in_h}.
  19944. @item out_w
  19945. @item out_h
  19946. The output (scaled) width and height
  19947. @item ow
  19948. @item oh
  19949. These are the same as @var{out_w} and @var{out_h}
  19950. @item a
  19951. The same as @var{iw} / @var{ih}
  19952. @item sar
  19953. input sample aspect ratio
  19954. @item dar
  19955. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  19956. @item hsub
  19957. @item vsub
  19958. horizontal and vertical input chroma subsample values. For example for the
  19959. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19960. @item ohsub
  19961. @item ovsub
  19962. horizontal and vertical output chroma subsample values. For example for the
  19963. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19964. @end table
  19965. @subsection Commands
  19966. This filter supports the following commands:
  19967. @table @option
  19968. @item width, w
  19969. @item height, h
  19970. Set the output video dimension expression.
  19971. The command accepts the same syntax of the corresponding option.
  19972. If the specified expression is not valid, it is kept at its current
  19973. value.
  19974. @end table
  19975. @c man end VIDEO FILTERS
  19976. @chapter OpenCL Video Filters
  19977. @c man begin OPENCL VIDEO FILTERS
  19978. Below is a description of the currently available OpenCL video filters.
  19979. To enable compilation of these filters you need to configure FFmpeg with
  19980. @code{--enable-opencl}.
  19981. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  19982. @table @option
  19983. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  19984. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  19985. given device parameters.
  19986. @item -filter_hw_device @var{name}
  19987. Pass the hardware device called @var{name} to all filters in any filter graph.
  19988. @end table
  19989. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  19990. @itemize
  19991. @item
  19992. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  19993. @example
  19994. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  19995. @end example
  19996. @end itemize
  19997. 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.
  19998. @section avgblur_opencl
  19999. Apply average blur filter.
  20000. The filter accepts the following options:
  20001. @table @option
  20002. @item sizeX
  20003. Set horizontal radius size.
  20004. Range is @code{[1, 1024]} and default value is @code{1}.
  20005. @item planes
  20006. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20007. @item sizeY
  20008. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  20009. @end table
  20010. @subsection Example
  20011. @itemize
  20012. @item
  20013. 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.
  20014. @example
  20015. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  20016. @end example
  20017. @end itemize
  20018. @section boxblur_opencl
  20019. Apply a boxblur algorithm to the input video.
  20020. It accepts the following parameters:
  20021. @table @option
  20022. @item luma_radius, lr
  20023. @item luma_power, lp
  20024. @item chroma_radius, cr
  20025. @item chroma_power, cp
  20026. @item alpha_radius, ar
  20027. @item alpha_power, ap
  20028. @end table
  20029. A description of the accepted options follows.
  20030. @table @option
  20031. @item luma_radius, lr
  20032. @item chroma_radius, cr
  20033. @item alpha_radius, ar
  20034. Set an expression for the box radius in pixels used for blurring the
  20035. corresponding input plane.
  20036. The radius value must be a non-negative number, and must not be
  20037. greater than the value of the expression @code{min(w,h)/2} for the
  20038. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  20039. planes.
  20040. Default value for @option{luma_radius} is "2". If not specified,
  20041. @option{chroma_radius} and @option{alpha_radius} default to the
  20042. corresponding value set for @option{luma_radius}.
  20043. The expressions can contain the following constants:
  20044. @table @option
  20045. @item w
  20046. @item h
  20047. The input width and height in pixels.
  20048. @item cw
  20049. @item ch
  20050. The input chroma image width and height in pixels.
  20051. @item hsub
  20052. @item vsub
  20053. The horizontal and vertical chroma subsample values. For example, for the
  20054. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  20055. @end table
  20056. @item luma_power, lp
  20057. @item chroma_power, cp
  20058. @item alpha_power, ap
  20059. Specify how many times the boxblur filter is applied to the
  20060. corresponding plane.
  20061. Default value for @option{luma_power} is 2. If not specified,
  20062. @option{chroma_power} and @option{alpha_power} default to the
  20063. corresponding value set for @option{luma_power}.
  20064. A value of 0 will disable the effect.
  20065. @end table
  20066. @subsection Examples
  20067. 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.
  20068. @itemize
  20069. @item
  20070. Apply a boxblur filter with the luma, chroma, and alpha radius
  20071. 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.
  20072. @example
  20073. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  20074. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  20075. @end example
  20076. @item
  20077. 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.
  20078. For the luma plane, a 2x2 box radius will be run once.
  20079. For the chroma plane, a 4x4 box radius will be run 5 times.
  20080. For the alpha plane, a 3x3 box radius will be run 7 times.
  20081. @example
  20082. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  20083. @end example
  20084. @end itemize
  20085. @section colorkey_opencl
  20086. RGB colorspace color keying.
  20087. The filter accepts the following options:
  20088. @table @option
  20089. @item color
  20090. The color which will be replaced with transparency.
  20091. @item similarity
  20092. Similarity percentage with the key color.
  20093. 0.01 matches only the exact key color, while 1.0 matches everything.
  20094. @item blend
  20095. Blend percentage.
  20096. 0.0 makes pixels either fully transparent, or not transparent at all.
  20097. Higher values result in semi-transparent pixels, with a higher transparency
  20098. the more similar the pixels color is to the key color.
  20099. @end table
  20100. @subsection Examples
  20101. @itemize
  20102. @item
  20103. Make every semi-green pixel in the input transparent with some slight blending:
  20104. @example
  20105. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  20106. @end example
  20107. @end itemize
  20108. @section convolution_opencl
  20109. Apply convolution of 3x3, 5x5, 7x7 matrix.
  20110. The filter accepts the following options:
  20111. @table @option
  20112. @item 0m
  20113. @item 1m
  20114. @item 2m
  20115. @item 3m
  20116. Set matrix for each plane.
  20117. Matrix is sequence of 9, 25 or 49 signed numbers.
  20118. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  20119. @item 0rdiv
  20120. @item 1rdiv
  20121. @item 2rdiv
  20122. @item 3rdiv
  20123. Set multiplier for calculated value for each plane.
  20124. If unset or 0, it will be sum of all matrix elements.
  20125. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  20126. @item 0bias
  20127. @item 1bias
  20128. @item 2bias
  20129. @item 3bias
  20130. Set bias for each plane. This value is added to the result of the multiplication.
  20131. Useful for making the overall image brighter or darker.
  20132. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  20133. @end table
  20134. @subsection Examples
  20135. @itemize
  20136. @item
  20137. Apply sharpen:
  20138. @example
  20139. -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
  20140. @end example
  20141. @item
  20142. Apply blur:
  20143. @example
  20144. -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
  20145. @end example
  20146. @item
  20147. Apply edge enhance:
  20148. @example
  20149. -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
  20150. @end example
  20151. @item
  20152. Apply edge detect:
  20153. @example
  20154. -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
  20155. @end example
  20156. @item
  20157. Apply laplacian edge detector which includes diagonals:
  20158. @example
  20159. -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
  20160. @end example
  20161. @item
  20162. Apply emboss:
  20163. @example
  20164. -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
  20165. @end example
  20166. @end itemize
  20167. @section erosion_opencl
  20168. Apply erosion effect to the video.
  20169. This filter replaces the pixel by the local(3x3) minimum.
  20170. It accepts the following options:
  20171. @table @option
  20172. @item threshold0
  20173. @item threshold1
  20174. @item threshold2
  20175. @item threshold3
  20176. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20177. If @code{0}, plane will remain unchanged.
  20178. @item coordinates
  20179. Flag which specifies the pixel to refer to.
  20180. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20181. Flags to local 3x3 coordinates region centered on @code{x}:
  20182. 1 2 3
  20183. 4 x 5
  20184. 6 7 8
  20185. @end table
  20186. @subsection Example
  20187. @itemize
  20188. @item
  20189. 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.
  20190. @example
  20191. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20192. @end example
  20193. @end itemize
  20194. @section deshake_opencl
  20195. Feature-point based video stabilization filter.
  20196. The filter accepts the following options:
  20197. @table @option
  20198. @item tripod
  20199. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  20200. @item debug
  20201. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  20202. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  20203. Viewing point matches in the output video is only supported for RGB input.
  20204. Defaults to @code{0}.
  20205. @item adaptive_crop
  20206. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  20207. Defaults to @code{1}.
  20208. @item refine_features
  20209. Whether or not feature points should be refined at a sub-pixel level.
  20210. This can be turned off for a slight performance gain at the cost of precision.
  20211. Defaults to @code{1}.
  20212. @item smooth_strength
  20213. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  20214. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  20215. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  20216. Defaults to @code{0.0}.
  20217. @item smooth_window_multiplier
  20218. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  20219. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  20220. Acceptable values range from @code{0.1} to @code{10.0}.
  20221. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  20222. potentially improving smoothness, but also increase latency and memory usage.
  20223. Defaults to @code{2.0}.
  20224. @end table
  20225. @subsection Examples
  20226. @itemize
  20227. @item
  20228. Stabilize a video with a fixed, medium smoothing strength:
  20229. @example
  20230. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  20231. @end example
  20232. @item
  20233. Stabilize a video with debugging (both in console and in rendered video):
  20234. @example
  20235. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  20236. @end example
  20237. @end itemize
  20238. @section dilation_opencl
  20239. Apply dilation effect to the video.
  20240. This filter replaces the pixel by the local(3x3) maximum.
  20241. It accepts the following options:
  20242. @table @option
  20243. @item threshold0
  20244. @item threshold1
  20245. @item threshold2
  20246. @item threshold3
  20247. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20248. If @code{0}, plane will remain unchanged.
  20249. @item coordinates
  20250. Flag which specifies the pixel to refer to.
  20251. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20252. Flags to local 3x3 coordinates region centered on @code{x}:
  20253. 1 2 3
  20254. 4 x 5
  20255. 6 7 8
  20256. @end table
  20257. @subsection Example
  20258. @itemize
  20259. @item
  20260. 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.
  20261. @example
  20262. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20263. @end example
  20264. @end itemize
  20265. @anchor{nlmeans_opencl}
  20266. @section nlmeans_opencl
  20267. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  20268. @section overlay_opencl
  20269. Overlay one video on top of another.
  20270. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20271. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  20272. The filter accepts the following options:
  20273. @table @option
  20274. @item x
  20275. Set the x coordinate of the overlaid video on the main video.
  20276. Default value is @code{0}.
  20277. @item y
  20278. Set the y coordinate of the overlaid video on the main video.
  20279. Default value is @code{0}.
  20280. @end table
  20281. @subsection Examples
  20282. @itemize
  20283. @item
  20284. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  20285. @example
  20286. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20287. @end example
  20288. @item
  20289. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20290. @example
  20291. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20292. @end example
  20293. @end itemize
  20294. @section pad_opencl
  20295. Add paddings to the input image, and place the original input at the
  20296. provided @var{x}, @var{y} coordinates.
  20297. It accepts the following options:
  20298. @table @option
  20299. @item width, w
  20300. @item height, h
  20301. Specify an expression for the size of the output image with the
  20302. paddings added. If the value for @var{width} or @var{height} is 0, the
  20303. corresponding input size is used for the output.
  20304. The @var{width} expression can reference the value set by the
  20305. @var{height} expression, and vice versa.
  20306. The default value of @var{width} and @var{height} is 0.
  20307. @item x
  20308. @item y
  20309. Specify the offsets to place the input image at within the padded area,
  20310. with respect to the top/left border of the output image.
  20311. The @var{x} expression can reference the value set by the @var{y}
  20312. expression, and vice versa.
  20313. The default value of @var{x} and @var{y} is 0.
  20314. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  20315. so the input image is centered on the padded area.
  20316. @item color
  20317. Specify the color of the padded area. For the syntax of this option,
  20318. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  20319. manual,ffmpeg-utils}.
  20320. @item aspect
  20321. Pad to an aspect instead to a resolution.
  20322. @end table
  20323. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  20324. options are expressions containing the following constants:
  20325. @table @option
  20326. @item in_w
  20327. @item in_h
  20328. The input video width and height.
  20329. @item iw
  20330. @item ih
  20331. These are the same as @var{in_w} and @var{in_h}.
  20332. @item out_w
  20333. @item out_h
  20334. The output width and height (the size of the padded area), as
  20335. specified by the @var{width} and @var{height} expressions.
  20336. @item ow
  20337. @item oh
  20338. These are the same as @var{out_w} and @var{out_h}.
  20339. @item x
  20340. @item y
  20341. The x and y offsets as specified by the @var{x} and @var{y}
  20342. expressions, or NAN if not yet specified.
  20343. @item a
  20344. same as @var{iw} / @var{ih}
  20345. @item sar
  20346. input sample aspect ratio
  20347. @item dar
  20348. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  20349. @end table
  20350. @section prewitt_opencl
  20351. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  20352. The filter accepts the following option:
  20353. @table @option
  20354. @item planes
  20355. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20356. @item scale
  20357. Set value which will be multiplied with filtered result.
  20358. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20359. @item delta
  20360. Set value which will be added to filtered result.
  20361. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20362. @end table
  20363. @subsection Example
  20364. @itemize
  20365. @item
  20366. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  20367. @example
  20368. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20369. @end example
  20370. @end itemize
  20371. @anchor{program_opencl}
  20372. @section program_opencl
  20373. Filter video using an OpenCL program.
  20374. @table @option
  20375. @item source
  20376. OpenCL program source file.
  20377. @item kernel
  20378. Kernel name in program.
  20379. @item inputs
  20380. Number of inputs to the filter. Defaults to 1.
  20381. @item size, s
  20382. Size of output frames. Defaults to the same as the first input.
  20383. @end table
  20384. The @code{program_opencl} filter also supports the @ref{framesync} options.
  20385. The program source file must contain a kernel function with the given name,
  20386. which will be run once for each plane of the output. Each run on a plane
  20387. gets enqueued as a separate 2D global NDRange with one work-item for each
  20388. pixel to be generated. The global ID offset for each work-item is therefore
  20389. the coordinates of a pixel in the destination image.
  20390. The kernel function needs to take the following arguments:
  20391. @itemize
  20392. @item
  20393. Destination image, @var{__write_only image2d_t}.
  20394. This image will become the output; the kernel should write all of it.
  20395. @item
  20396. Frame index, @var{unsigned int}.
  20397. This is a counter starting from zero and increasing by one for each frame.
  20398. @item
  20399. Source images, @var{__read_only image2d_t}.
  20400. These are the most recent images on each input. The kernel may read from
  20401. them to generate the output, but they can't be written to.
  20402. @end itemize
  20403. Example programs:
  20404. @itemize
  20405. @item
  20406. Copy the input to the output (output must be the same size as the input).
  20407. @verbatim
  20408. __kernel void copy(__write_only image2d_t destination,
  20409. unsigned int index,
  20410. __read_only image2d_t source)
  20411. {
  20412. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  20413. int2 location = (int2)(get_global_id(0), get_global_id(1));
  20414. float4 value = read_imagef(source, sampler, location);
  20415. write_imagef(destination, location, value);
  20416. }
  20417. @end verbatim
  20418. @item
  20419. Apply a simple transformation, rotating the input by an amount increasing
  20420. with the index counter. Pixel values are linearly interpolated by the
  20421. sampler, and the output need not have the same dimensions as the input.
  20422. @verbatim
  20423. __kernel void rotate_image(__write_only image2d_t dst,
  20424. unsigned int index,
  20425. __read_only image2d_t src)
  20426. {
  20427. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20428. CLK_FILTER_LINEAR);
  20429. float angle = (float)index / 100.0f;
  20430. float2 dst_dim = convert_float2(get_image_dim(dst));
  20431. float2 src_dim = convert_float2(get_image_dim(src));
  20432. float2 dst_cen = dst_dim / 2.0f;
  20433. float2 src_cen = src_dim / 2.0f;
  20434. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  20435. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  20436. float2 src_pos = {
  20437. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  20438. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  20439. };
  20440. src_pos = src_pos * src_dim / dst_dim;
  20441. float2 src_loc = src_pos + src_cen;
  20442. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  20443. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  20444. write_imagef(dst, dst_loc, 0.5f);
  20445. else
  20446. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  20447. }
  20448. @end verbatim
  20449. @item
  20450. Blend two inputs together, with the amount of each input used varying
  20451. with the index counter.
  20452. @verbatim
  20453. __kernel void blend_images(__write_only image2d_t dst,
  20454. unsigned int index,
  20455. __read_only image2d_t src1,
  20456. __read_only image2d_t src2)
  20457. {
  20458. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20459. CLK_FILTER_LINEAR);
  20460. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  20461. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  20462. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  20463. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  20464. float4 val1 = read_imagef(src1, sampler, src1_loc);
  20465. float4 val2 = read_imagef(src2, sampler, src2_loc);
  20466. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  20467. }
  20468. @end verbatim
  20469. @end itemize
  20470. @section remap_opencl
  20471. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  20472. Destination pixel at position (X, Y) will be picked from source (x, y) position
  20473. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  20474. value for pixel will be used for destination pixel.
  20475. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  20476. will have Xmap/Ymap video stream dimensions.
  20477. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  20478. @table @option
  20479. @item interp
  20480. Specify interpolation used for remapping of pixels.
  20481. Allowed values are @code{near} and @code{linear}.
  20482. Default value is @code{linear}.
  20483. @item fill
  20484. Specify the color of the unmapped pixels. For the syntax of this option,
  20485. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  20486. manual,ffmpeg-utils}. Default color is @code{black}.
  20487. @end table
  20488. @section roberts_opencl
  20489. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  20490. The filter accepts the following option:
  20491. @table @option
  20492. @item planes
  20493. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20494. @item scale
  20495. Set value which will be multiplied with filtered result.
  20496. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20497. @item delta
  20498. Set value which will be added to filtered result.
  20499. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20500. @end table
  20501. @subsection Example
  20502. @itemize
  20503. @item
  20504. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  20505. @example
  20506. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20507. @end example
  20508. @end itemize
  20509. @section sobel_opencl
  20510. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  20511. The filter accepts the following option:
  20512. @table @option
  20513. @item planes
  20514. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20515. @item scale
  20516. Set value which will be multiplied with filtered result.
  20517. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20518. @item delta
  20519. Set value which will be added to filtered result.
  20520. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20521. @end table
  20522. @subsection Example
  20523. @itemize
  20524. @item
  20525. Apply sobel operator with scale set to 2 and delta set to 10
  20526. @example
  20527. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20528. @end example
  20529. @end itemize
  20530. @section tonemap_opencl
  20531. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  20532. It accepts the following parameters:
  20533. @table @option
  20534. @item tonemap
  20535. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  20536. @item param
  20537. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  20538. @item desat
  20539. Apply desaturation for highlights that exceed this level of brightness. The
  20540. higher the parameter, the more color information will be preserved. This
  20541. setting helps prevent unnaturally blown-out colors for super-highlights, by
  20542. (smoothly) turning into white instead. This makes images feel more natural,
  20543. at the cost of reducing information about out-of-range colors.
  20544. The default value is 0.5, and the algorithm here is a little different from
  20545. the cpu version tonemap currently. A setting of 0.0 disables this option.
  20546. @item threshold
  20547. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  20548. is used to detect whether the scene has changed or not. If the distance between
  20549. the current frame average brightness and the current running average exceeds
  20550. a threshold value, we would re-calculate scene average and peak brightness.
  20551. The default value is 0.2.
  20552. @item format
  20553. Specify the output pixel format.
  20554. Currently supported formats are:
  20555. @table @var
  20556. @item p010
  20557. @item nv12
  20558. @end table
  20559. @item range, r
  20560. Set the output color range.
  20561. Possible values are:
  20562. @table @var
  20563. @item tv/mpeg
  20564. @item pc/jpeg
  20565. @end table
  20566. Default is same as input.
  20567. @item primaries, p
  20568. Set the output color primaries.
  20569. Possible values are:
  20570. @table @var
  20571. @item bt709
  20572. @item bt2020
  20573. @end table
  20574. Default is same as input.
  20575. @item transfer, t
  20576. Set the output transfer characteristics.
  20577. Possible values are:
  20578. @table @var
  20579. @item bt709
  20580. @item bt2020
  20581. @end table
  20582. Default is bt709.
  20583. @item matrix, m
  20584. Set the output colorspace matrix.
  20585. Possible value are:
  20586. @table @var
  20587. @item bt709
  20588. @item bt2020
  20589. @end table
  20590. Default is same as input.
  20591. @end table
  20592. @subsection Example
  20593. @itemize
  20594. @item
  20595. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  20596. @example
  20597. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  20598. @end example
  20599. @end itemize
  20600. @section unsharp_opencl
  20601. Sharpen or blur the input video.
  20602. It accepts the following parameters:
  20603. @table @option
  20604. @item luma_msize_x, lx
  20605. Set the luma matrix horizontal size.
  20606. Range is @code{[1, 23]} and default value is @code{5}.
  20607. @item luma_msize_y, ly
  20608. Set the luma matrix vertical size.
  20609. Range is @code{[1, 23]} and default value is @code{5}.
  20610. @item luma_amount, la
  20611. Set the luma effect strength.
  20612. Range is @code{[-10, 10]} and default value is @code{1.0}.
  20613. Negative values will blur the input video, while positive values will
  20614. sharpen it, a value of zero will disable the effect.
  20615. @item chroma_msize_x, cx
  20616. Set the chroma matrix horizontal size.
  20617. Range is @code{[1, 23]} and default value is @code{5}.
  20618. @item chroma_msize_y, cy
  20619. Set the chroma matrix vertical size.
  20620. Range is @code{[1, 23]} and default value is @code{5}.
  20621. @item chroma_amount, ca
  20622. Set the chroma effect strength.
  20623. Range is @code{[-10, 10]} and default value is @code{0.0}.
  20624. Negative values will blur the input video, while positive values will
  20625. sharpen it, a value of zero will disable the effect.
  20626. @end table
  20627. All parameters are optional and default to the equivalent of the
  20628. string '5:5:1.0:5:5:0.0'.
  20629. @subsection Examples
  20630. @itemize
  20631. @item
  20632. Apply strong luma sharpen effect:
  20633. @example
  20634. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  20635. @end example
  20636. @item
  20637. Apply a strong blur of both luma and chroma parameters:
  20638. @example
  20639. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  20640. @end example
  20641. @end itemize
  20642. @section xfade_opencl
  20643. Cross fade two videos with custom transition effect by using OpenCL.
  20644. It accepts the following options:
  20645. @table @option
  20646. @item transition
  20647. Set one of possible transition effects.
  20648. @table @option
  20649. @item custom
  20650. Select custom transition effect, the actual transition description
  20651. will be picked from source and kernel options.
  20652. @item fade
  20653. @item wipeleft
  20654. @item wiperight
  20655. @item wipeup
  20656. @item wipedown
  20657. @item slideleft
  20658. @item slideright
  20659. @item slideup
  20660. @item slidedown
  20661. Default transition is fade.
  20662. @end table
  20663. @item source
  20664. OpenCL program source file for custom transition.
  20665. @item kernel
  20666. Set name of kernel to use for custom transition from program source file.
  20667. @item duration
  20668. Set duration of video transition.
  20669. @item offset
  20670. Set time of start of transition relative to first video.
  20671. @end table
  20672. The program source file must contain a kernel function with the given name,
  20673. which will be run once for each plane of the output. Each run on a plane
  20674. gets enqueued as a separate 2D global NDRange with one work-item for each
  20675. pixel to be generated. The global ID offset for each work-item is therefore
  20676. the coordinates of a pixel in the destination image.
  20677. The kernel function needs to take the following arguments:
  20678. @itemize
  20679. @item
  20680. Destination image, @var{__write_only image2d_t}.
  20681. This image will become the output; the kernel should write all of it.
  20682. @item
  20683. First Source image, @var{__read_only image2d_t}.
  20684. Second Source image, @var{__read_only image2d_t}.
  20685. These are the most recent images on each input. The kernel may read from
  20686. them to generate the output, but they can't be written to.
  20687. @item
  20688. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  20689. @end itemize
  20690. Example programs:
  20691. @itemize
  20692. @item
  20693. Apply dots curtain transition effect:
  20694. @verbatim
  20695. __kernel void blend_images(__write_only image2d_t dst,
  20696. __read_only image2d_t src1,
  20697. __read_only image2d_t src2,
  20698. float progress)
  20699. {
  20700. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20701. CLK_FILTER_LINEAR);
  20702. int2 p = (int2)(get_global_id(0), get_global_id(1));
  20703. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  20704. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  20705. rp = rp / dim;
  20706. float2 dots = (float2)(20.0, 20.0);
  20707. float2 center = (float2)(0,0);
  20708. float2 unused;
  20709. float4 val1 = read_imagef(src1, sampler, p);
  20710. float4 val2 = read_imagef(src2, sampler, p);
  20711. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  20712. write_imagef(dst, p, next ? val1 : val2);
  20713. }
  20714. @end verbatim
  20715. @end itemize
  20716. @c man end OPENCL VIDEO FILTERS
  20717. @chapter VAAPI Video Filters
  20718. @c man begin VAAPI VIDEO FILTERS
  20719. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  20720. To enable compilation of these filters you need to configure FFmpeg with
  20721. @code{--enable-vaapi}.
  20722. 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}
  20723. @section overlay_vaapi
  20724. Overlay one video on the top of another.
  20725. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20726. The filter accepts the following options:
  20727. @table @option
  20728. @item x
  20729. @item y
  20730. Set expressions for the x and y coordinates of the overlaid video
  20731. on the main video.
  20732. Default value is "0" for both expressions.
  20733. @item w
  20734. @item h
  20735. Set expressions for the width and height the overlaid video
  20736. on the main video.
  20737. Default values are 'overlay_iw' for 'w' and 'overlay_ih*w/overlay_iw' for 'h'.
  20738. The expressions can contain the following parameters:
  20739. @table @option
  20740. @item main_w, W
  20741. @item main_h, H
  20742. The main input width and height.
  20743. @item overlay_iw
  20744. @item overlay_ih
  20745. The overlay input width and height.
  20746. @item overlay_w, w
  20747. @item overlay_h, h
  20748. The overlay output width and height.
  20749. @item overlay_x, x
  20750. @item overlay_y, y
  20751. Position of the overlay layer inside of main
  20752. @end table
  20753. @item alpha
  20754. Set transparency of overlaid video. Allowed range is 0.0 to 1.0.
  20755. Higher value means lower transparency.
  20756. Default value is @code{1.0}.
  20757. @item eof_action
  20758. See @ref{framesync}.
  20759. @item shortest
  20760. See @ref{framesync}.
  20761. @item repeatlast
  20762. See @ref{framesync}.
  20763. @end table
  20764. This filter also supports the @ref{framesync} options.
  20765. @subsection Examples
  20766. @itemize
  20767. @item
  20768. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  20769. @example
  20770. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  20771. @end example
  20772. @item
  20773. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  20774. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20775. @example
  20776. -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
  20777. @end example
  20778. @end itemize
  20779. @section tonemap_vaapi
  20780. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  20781. It maps the dynamic range of HDR10 content to the SDR content.
  20782. It currently only accepts HDR10 as input.
  20783. It accepts the following parameters:
  20784. @table @option
  20785. @item format
  20786. Specify the output pixel format.
  20787. Currently supported formats are:
  20788. @table @var
  20789. @item p010
  20790. @item nv12
  20791. @end table
  20792. Default is nv12.
  20793. @item primaries, p
  20794. Set the output color primaries.
  20795. Default is same as input.
  20796. @item transfer, t
  20797. Set the output transfer characteristics.
  20798. Default is bt709.
  20799. @item matrix, m
  20800. Set the output colorspace matrix.
  20801. Default is same as input.
  20802. @end table
  20803. @subsection Example
  20804. @itemize
  20805. @item
  20806. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  20807. @example
  20808. tonemap_vaapi=format=p010:t=bt2020-10
  20809. @end example
  20810. @end itemize
  20811. @section hstack_vaapi
  20812. Stack input videos horizontally.
  20813. This is the VA-API variant of the @ref{hstack} filter, each input stream may
  20814. have different height, this filter will scale down/up each input stream while
  20815. keeping the original aspect.
  20816. It accepts the following options:
  20817. @table @option
  20818. @item inputs
  20819. See @ref{hstack}.
  20820. @item shortest
  20821. See @ref{hstack}.
  20822. @item height
  20823. Set height of output. If set to 0, this filter will set height of output to
  20824. height of the first input stream. Default value is 0.
  20825. @end table
  20826. @section vstack_vaapi
  20827. Stack input videos vertically.
  20828. This is the VA-API variant of the @ref{vstack} filter, each input stream may
  20829. have different width, this filter will scale down/up each input stream while
  20830. keeping the original aspect.
  20831. It accepts the following options:
  20832. @table @option
  20833. @item inputs
  20834. See @ref{vstack}.
  20835. @item shortest
  20836. See @ref{vstack}.
  20837. @item width
  20838. Set width of output. If set to 0, this filter will set width of output to
  20839. width of the first input stream. Default value is 0.
  20840. @end table
  20841. @section xstack_vaapi
  20842. Stack video inputs into custom layout.
  20843. This is the VA-API variant of the @ref{xstack} filter, each input stream may
  20844. have different size, this filter will scale down/up each input stream to the
  20845. given output size, or the size of the first input stream.
  20846. It accepts the following options:
  20847. @table @option
  20848. @item inputs
  20849. See @ref{xstack}.
  20850. @item shortest
  20851. See @ref{xstack}.
  20852. @item layout
  20853. See @ref{xstack}.
  20854. Moreover, this permits the user to supply output size for each input stream.
  20855. @example
  20856. xstack_vaapi=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  20857. @end example
  20858. @item grid
  20859. See @ref{xstack}.
  20860. @item grid_tile_size
  20861. Set output size for each input stream when @option{grid} is set. If this option
  20862. is not set, this filter will set output size by default to the size of the
  20863. first input stream. For the syntax of this option, check the
  20864. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20865. @item fill
  20866. See @ref{xstack}.
  20867. @end table
  20868. @c man end VAAPI VIDEO FILTERS
  20869. @chapter Vulkan Video Filters
  20870. @c man begin VULKAN VIDEO FILTERS
  20871. Below is a description of the currently available Vulkan video filters.
  20872. To enable compilation of these filters you need to configure FFmpeg with
  20873. @code{--enable-vulkan} and either @code{--enable-libglslang} or @code{--enable-libshaderc}.
  20874. Running Vulkan filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  20875. @table @option
  20876. @item -init_hw_device vulkan[=@var{name}][:@var{device}[,@var{key=value}...]]
  20877. Initialise a new hardware device of type @var{vulkan} called @var{name}, using the
  20878. given device parameters and options in @var{key=value}. The following options
  20879. are supported:
  20880. @table @option
  20881. @item debug
  20882. Switches validation layers on if set to 1.
  20883. @item linear_images
  20884. Allocates linear images. Does not apply to decoding.
  20885. @item disable_multiplane
  20886. Disables multiplane images. Does not apply to decoding.
  20887. @end table
  20888. @item -filter_hw_device @var{name}
  20889. Pass the hardware device called @var{name} to all filters in any filter graph.
  20890. @end table
  20891. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  20892. @itemize
  20893. @item
  20894. Example of choosing the first device and running nlmeans_vulkan filter with default parameters on it.
  20895. @example
  20896. -init_hw_device vulkan=vk:0 -filter_hw_device vk -i INPUT -vf "hwupload,nlmeans_vulkan,hwdownload" OUTPUT
  20897. @end example
  20898. @end itemize
  20899. As Vulkan 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 frame 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 is usually necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
  20900. @section avgblur_vulkan
  20901. Apply an average blur filter, implemented on the GPU using Vulkan.
  20902. The filter accepts the following options:
  20903. @table @option
  20904. @item sizeX
  20905. Set horizontal radius size.
  20906. Range is @code{[1, 32]} and default value is @code{3}.
  20907. @item sizeY
  20908. Set vertical radius size. Range is @code{[1, 32]} and default value is @code{3}.
  20909. @item planes
  20910. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20911. @end table
  20912. @section blend_vulkan
  20913. Blend two Vulkan frames into each other.
  20914. The @code{blend} filter takes two input streams and outputs one
  20915. stream, the first input is the "top" layer and second input is
  20916. "bottom" layer. By default, the output terminates when the longest input terminates.
  20917. A description of the accepted options follows.
  20918. @table @option
  20919. @item c0_mode
  20920. @item c1_mode
  20921. @item c2_mode
  20922. @item c3_mode
  20923. @item all_mode
  20924. Set blend mode for specific pixel component or all pixel components in case
  20925. of @var{all_mode}. Default value is @code{normal}.
  20926. Available values for component modes are:
  20927. @table @samp
  20928. @item normal
  20929. @item multiply
  20930. @end table
  20931. @end table
  20932. @section bwdif_vulkan
  20933. Deinterlacer using @ref{bwdif}, the "Bob Weaver Deinterlacing Filter" algorithm, implemented
  20934. on the GPU using Vulkan.
  20935. It accepts the following parameters:
  20936. @table @option
  20937. @item mode
  20938. The interlacing mode to adopt. It accepts one of the following values:
  20939. @table @option
  20940. @item 0, send_frame
  20941. Output one frame for each frame.
  20942. @item 1, send_field
  20943. Output one frame for each field.
  20944. @end table
  20945. The default value is @code{send_field}.
  20946. @item parity
  20947. The picture field parity assumed for the input interlaced video. It accepts one
  20948. of the following values:
  20949. @table @option
  20950. @item 0, tff
  20951. Assume the top field is first.
  20952. @item 1, bff
  20953. Assume the bottom field is first.
  20954. @item -1, auto
  20955. Enable automatic detection of field parity.
  20956. @end table
  20957. The default value is @code{auto}.
  20958. If the interlacing is unknown or the decoder does not export this information,
  20959. top field first will be assumed.
  20960. @item deint
  20961. Specify which frames to deinterlace. Accepts one of the following
  20962. values:
  20963. @table @option
  20964. @item 0, all
  20965. Deinterlace all frames.
  20966. @item 1, interlaced
  20967. Only deinterlace frames marked as interlaced.
  20968. @end table
  20969. The default value is @code{all}.
  20970. @end table
  20971. @section chromaber_vulkan
  20972. Apply an effect that emulates chromatic aberration. Works best with RGB inputs,
  20973. but provides a similar effect with YCbCr inputs too.
  20974. @table @option
  20975. @item dist_x
  20976. Horizontal displacement multiplier. Each chroma pixel's position will be multiplied
  20977. by this amount, starting from the center of the image. Default is @code{0}.
  20978. @item dist_y
  20979. Similarly, this sets the vertical displacement multiplier. Default is @code{0}.
  20980. @end table
  20981. @section color_vulkan
  20982. Video source that creates a Vulkan frame of a solid color.
  20983. Useful for benchmarking, or overlaying.
  20984. It accepts the following parameters:
  20985. @table @option
  20986. @item color
  20987. The color to use. Either a name, or a hexadecimal value.
  20988. The default value is @code{black}.
  20989. @item size
  20990. The size of the output frame. Default value is @code{1920x1080}.
  20991. @item rate
  20992. The framerate to output at. Default value is @code{60} frames per second.
  20993. @item duration
  20994. The video duration. Default value is @code{-0.000001}.
  20995. @item sar
  20996. The video signal aspect ratio. Default value is @code{1/1}.
  20997. @item format
  20998. The pixel format of the output Vulkan frames. Default value is @code{yuv444p}.
  20999. @item out_range
  21000. Set the output YCbCr sample range.
  21001. This allows the autodetected value to be overridden as well as allows forcing
  21002. a specific value used for the output and encoder. If not specified, the
  21003. range depends on the pixel format. Possible values:
  21004. @table @samp
  21005. @item auto/unknown
  21006. Choose automatically.
  21007. @item jpeg/full/pc
  21008. Set full range (0-255 in case of 8-bit luma).
  21009. @item mpeg/limited/tv
  21010. Set "MPEG" range (16-235 in case of 8-bit luma).
  21011. @end table
  21012. @end table
  21013. @section vflip_vulkan
  21014. Flips an image vertically.
  21015. @section hflip_vulkan
  21016. Flips an image horizontally.
  21017. @section flip_vulkan
  21018. Flips an image along both the vertical and horizontal axis.
  21019. @section gblur_vulkan
  21020. Apply Gaussian blur filter on Vulkan frames.
  21021. The filter accepts the following options:
  21022. @table @option
  21023. @item sigma
  21024. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  21025. @item sigmaV
  21026. Set vertical sigma, if negative it will be same as @code{sigma}.
  21027. Default is @code{-1}.
  21028. @item planes
  21029. Set which planes to filter. By default all planes are filtered.
  21030. @item size
  21031. Set the kernel size along the horizontal axis. Default is @code{19}.
  21032. @item sizeV
  21033. Set the kernel size along the vertical axis. Default is @code{0},
  21034. which sets to use the same value as @var{size}.
  21035. @end table
  21036. @section nlmeans_vulkan
  21037. Denoise frames using Non-Local Means algorithm, implemented on the GPU using
  21038. Vulkan.
  21039. Supports more pixel formats than @ref{nlmeans} or @ref{nlmeans_opencl}, including
  21040. alpha channel support.
  21041. The filter accepts the following options.
  21042. @table @option
  21043. @item s
  21044. Set denoising strength for all components. Default is 1.0. Must be in range [1.0, 100.0].
  21045. @item p
  21046. Set patch size for all planes. Default is 7. Must be odd number in range [0, 99].
  21047. @item r
  21048. Set research size. Default is 15. Must be odd number in range [0, 99].
  21049. @item t
  21050. Set parallelism. Default is 36. Must be a number in the range [1, 168].
  21051. Larger values may speed up processing, at the cost of more VRAM.
  21052. Lower values will slow it down, reducing VRAM usage.
  21053. Only supported on GPUs with atomic float operations (RDNA3+, Ampere+).
  21054. @item s0
  21055. @item s1
  21056. @item s2
  21057. @item s3
  21058. Set denoising strength for a specific component. Default is @var{1}, equal to @option{s}.
  21059. Must be odd number in range [1, 100].
  21060. @item p0
  21061. @item p1
  21062. @item p2
  21063. @item p3
  21064. Set patch size for a specific component. Default is @var{7}, equal to @option{p}.
  21065. Must be odd number in range [0, 99].
  21066. @end table
  21067. @section overlay_vulkan
  21068. Overlay one video on top of another.
  21069. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21070. This filter requires all inputs to use the same pixel format. So, format conversion may be needed.
  21071. The filter accepts the following options:
  21072. @table @option
  21073. @item x
  21074. Set the x coordinate of the overlaid video on the main video.
  21075. Default value is @code{0}.
  21076. @item y
  21077. Set the y coordinate of the overlaid video on the main video.
  21078. Default value is @code{0}.
  21079. @end table
  21080. @section transpose_vt
  21081. Transpose rows with columns in the input video and optionally flip it.
  21082. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21083. It accepts the following parameters:
  21084. @table @option
  21085. @item dir
  21086. Specify the transposition direction.
  21087. Can assume the following values:
  21088. @table @samp
  21089. @item cclock_flip
  21090. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21091. @item clock
  21092. Rotate by 90 degrees clockwise.
  21093. @item cclock
  21094. Rotate by 90 degrees counterclockwise.
  21095. @item clock_flip
  21096. Rotate by 90 degrees clockwise and vertically flip.
  21097. @item hflip
  21098. Flip the input video horizontally.
  21099. @item vflip
  21100. Flip the input video vertically.
  21101. @end table
  21102. @item passthrough
  21103. Do not apply the transposition if the input geometry matches the one
  21104. specified by the specified value. It accepts the following values:
  21105. @table @samp
  21106. @item none
  21107. Always apply transposition. (default)
  21108. @item portrait
  21109. Preserve portrait geometry (when @var{height} >= @var{width}).
  21110. @item landscape
  21111. Preserve landscape geometry (when @var{width} >= @var{height}).
  21112. @end table
  21113. @end table
  21114. @section transpose_vulkan
  21115. Transpose rows with columns in the input video and optionally flip it.
  21116. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21117. It accepts the following parameters:
  21118. @table @option
  21119. @item dir
  21120. Specify the transposition direction.
  21121. Can assume the following values:
  21122. @table @samp
  21123. @item cclock_flip
  21124. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21125. @item clock
  21126. Rotate by 90 degrees clockwise.
  21127. @item cclock
  21128. Rotate by 90 degrees counterclockwise.
  21129. @item clock_flip
  21130. Rotate by 90 degrees clockwise and vertically flip.
  21131. @end table
  21132. @item passthrough
  21133. Do not apply the transposition if the input geometry matches the one
  21134. specified by the specified value. It accepts the following values:
  21135. @table @samp
  21136. @item none
  21137. Always apply transposition. (default)
  21138. @item portrait
  21139. Preserve portrait geometry (when @var{height} >= @var{width}).
  21140. @item landscape
  21141. Preserve landscape geometry (when @var{width} >= @var{height}).
  21142. @end table
  21143. @end table
  21144. @c man end VULKAN VIDEO FILTERS
  21145. @chapter QSV Video Filters
  21146. @c man begin QSV VIDEO FILTERS
  21147. Below is a description of the currently available QSV video filters.
  21148. To enable compilation of these filters you need to configure FFmpeg with
  21149. @code{--enable-libmfx} or @code{--enable-libvpl}.
  21150. To use QSV filters, you need to setup the QSV device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/QuickSync}
  21151. @section hstack_qsv
  21152. Stack input videos horizontally.
  21153. This is the QSV variant of the @ref{hstack} filter, each input stream may
  21154. have different height, this filter will scale down/up each input stream while
  21155. keeping the original aspect.
  21156. It accepts the following options:
  21157. @table @option
  21158. @item inputs
  21159. See @ref{hstack}.
  21160. @item shortest
  21161. See @ref{hstack}.
  21162. @item height
  21163. Set height of output. If set to 0, this filter will set height of output to
  21164. height of the first input stream. Default value is 0.
  21165. @end table
  21166. @section vstack_qsv
  21167. Stack input videos vertically.
  21168. This is the QSV variant of the @ref{vstack} filter, each input stream may
  21169. have different width, this filter will scale down/up each input stream while
  21170. keeping the original aspect.
  21171. It accepts the following options:
  21172. @table @option
  21173. @item inputs
  21174. See @ref{vstack}.
  21175. @item shortest
  21176. See @ref{vstack}.
  21177. @item width
  21178. Set width of output. If set to 0, this filter will set width of output to
  21179. width of the first input stream. Default value is 0.
  21180. @end table
  21181. @section xstack_qsv
  21182. Stack video inputs into custom layout.
  21183. This is the QSV variant of the @ref{xstack} filter.
  21184. It accepts the following options:
  21185. @table @option
  21186. @item inputs
  21187. See @ref{xstack}.
  21188. @item shortest
  21189. See @ref{xstack}.
  21190. @item layout
  21191. See @ref{xstack}.
  21192. Moreover, this permits the user to supply output size for each input stream.
  21193. @example
  21194. xstack_qsv=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  21195. @end example
  21196. @item grid
  21197. See @ref{xstack}.
  21198. @item grid_tile_size
  21199. Set output size for each input stream when @option{grid} is set. If this option
  21200. is not set, this filter will set output size by default to the size of the
  21201. first input stream. For the syntax of this option, check the
  21202. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21203. @item fill
  21204. See @ref{xstack}.
  21205. @end table
  21206. @c man end QSV VIDEO FILTERS
  21207. @chapter Video Sources
  21208. @c man begin VIDEO SOURCES
  21209. Below is a description of the currently available video sources.
  21210. @section buffer
  21211. Buffer video frames, and make them available to the filter chain.
  21212. This source is mainly intended for a programmatic use, in particular
  21213. through the interface defined in @file{libavfilter/buffersrc.h}.
  21214. It accepts the following parameters:
  21215. @table @option
  21216. @item video_size
  21217. Specify the size (width and height) of the buffered video frames. For the
  21218. syntax of this option, check the
  21219. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21220. @item width
  21221. The input video width.
  21222. @item height
  21223. The input video height.
  21224. @item pix_fmt
  21225. A string representing the pixel format of the buffered video frames.
  21226. It may be a number corresponding to a pixel format, or a pixel format
  21227. name.
  21228. @item time_base
  21229. Specify the timebase assumed by the timestamps of the buffered frames.
  21230. @item frame_rate
  21231. Specify the frame rate expected for the video stream.
  21232. @item pixel_aspect, sar
  21233. The sample (pixel) aspect ratio of the input video.
  21234. @item hw_frames_ctx
  21235. When using a hardware pixel format, this should be a reference to an
  21236. AVHWFramesContext describing input frames.
  21237. @end table
  21238. For example:
  21239. @example
  21240. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  21241. @end example
  21242. will instruct the source to accept video frames with size 320x240 and
  21243. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  21244. square pixels (1:1 sample aspect ratio).
  21245. Since the pixel format with name "yuv410p" corresponds to the number 6
  21246. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  21247. this example corresponds to:
  21248. @example
  21249. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  21250. @end example
  21251. Alternatively, the options can be specified as a flat string, but this
  21252. syntax is deprecated:
  21253. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  21254. @section cellauto
  21255. Create a pattern generated by an elementary cellular automaton.
  21256. The initial state of the cellular automaton can be defined through the
  21257. @option{filename} and @option{pattern} options. If such options are
  21258. not specified an initial state is created randomly.
  21259. At each new frame a new row in the video is filled with the result of
  21260. the cellular automaton next generation. The behavior when the whole
  21261. frame is filled is defined by the @option{scroll} option.
  21262. This source accepts the following options:
  21263. @table @option
  21264. @item filename, f
  21265. Read the initial cellular automaton state, i.e. the starting row, from
  21266. the specified file.
  21267. In the file, each non-whitespace character is considered an alive
  21268. cell, a newline will terminate the row, and further characters in the
  21269. file will be ignored.
  21270. @item pattern, p
  21271. Read the initial cellular automaton state, i.e. the starting row, from
  21272. the specified string.
  21273. Each non-whitespace character in the string is considered an alive
  21274. cell, a newline will terminate the row, and further characters in the
  21275. string will be ignored.
  21276. @item rate, r
  21277. Set the video rate, that is the number of frames generated per second.
  21278. Default is 25.
  21279. @item random_fill_ratio, ratio
  21280. Set the random fill ratio for the initial cellular automaton row. It
  21281. is a floating point number value ranging from 0 to 1, defaults to
  21282. 1/PHI.
  21283. This option is ignored when a file or a pattern is specified.
  21284. @item random_seed, seed
  21285. Set the seed for filling randomly the initial row, must be an integer
  21286. included between 0 and UINT32_MAX. If not specified, or if explicitly
  21287. set to -1, the filter will try to use a good random seed on a best
  21288. effort basis.
  21289. @item rule
  21290. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  21291. Default value is 110.
  21292. @item size, s
  21293. Set the size of the output video. For the syntax of this option, check the
  21294. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21295. If @option{filename} or @option{pattern} is specified, the size is set
  21296. by default to the width of the specified initial state row, and the
  21297. height is set to @var{width} * PHI.
  21298. If @option{size} is set, it must contain the width of the specified
  21299. pattern string, and the specified pattern will be centered in the
  21300. larger row.
  21301. If a filename or a pattern string is not specified, the size value
  21302. defaults to "320x518" (used for a randomly generated initial state).
  21303. @item scroll
  21304. If set to 1, scroll the output upward when all the rows in the output
  21305. have been already filled. If set to 0, the new generated row will be
  21306. written over the top row just after the bottom row is filled.
  21307. Defaults to 1.
  21308. @item start_full, full
  21309. If set to 1, completely fill the output with generated rows before
  21310. outputting the first frame.
  21311. This is the default behavior, for disabling set the value to 0.
  21312. @item stitch
  21313. If set to 1, stitch the left and right row edges together.
  21314. This is the default behavior, for disabling set the value to 0.
  21315. @end table
  21316. @subsection Examples
  21317. @itemize
  21318. @item
  21319. Read the initial state from @file{pattern}, and specify an output of
  21320. size 200x400.
  21321. @example
  21322. cellauto=f=pattern:s=200x400
  21323. @end example
  21324. @item
  21325. Generate a random initial row with a width of 200 cells, with a fill
  21326. ratio of 2/3:
  21327. @example
  21328. cellauto=ratio=2/3:s=200x200
  21329. @end example
  21330. @item
  21331. Create a pattern generated by rule 18 starting by a single alive cell
  21332. centered on an initial row with width 100:
  21333. @example
  21334. cellauto=p=@@:s=100x400:full=0:rule=18
  21335. @end example
  21336. @item
  21337. Specify a more elaborated initial pattern:
  21338. @example
  21339. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  21340. @end example
  21341. @end itemize
  21342. @anchor{coreimagesrc}
  21343. @section coreimagesrc
  21344. Video source generated on GPU using Apple's CoreImage API on OSX.
  21345. This video source is a specialized version of the @ref{coreimage} video filter.
  21346. Use a core image generator at the beginning of the applied filterchain to
  21347. generate the content.
  21348. The coreimagesrc video source accepts the following options:
  21349. @table @option
  21350. @item list_generators
  21351. List all available generators along with all their respective options as well as
  21352. possible minimum and maximum values along with the default values.
  21353. @example
  21354. list_generators=true
  21355. @end example
  21356. @item size, s
  21357. Specify the size of the sourced video. For the syntax of this option, check the
  21358. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21359. The default value is @code{320x240}.
  21360. @item rate, r
  21361. Specify the frame rate of the sourced video, as the number of frames
  21362. generated per second. It has to be a string in the format
  21363. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  21364. number or a valid video frame rate abbreviation. The default value is
  21365. "25".
  21366. @item sar
  21367. Set the sample aspect ratio of the sourced video.
  21368. @item duration, d
  21369. Set the duration of the sourced video. See
  21370. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21371. for the accepted syntax.
  21372. If not specified, or the expressed duration is negative, the video is
  21373. supposed to be generated forever.
  21374. @end table
  21375. Additionally, all options of the @ref{coreimage} video filter are accepted.
  21376. A complete filterchain can be used for further processing of the
  21377. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  21378. and examples for details.
  21379. @subsection Examples
  21380. @itemize
  21381. @item
  21382. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  21383. given as complete and escaped command-line for Apple's standard bash shell:
  21384. @example
  21385. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  21386. @end example
  21387. This example is equivalent to the QRCode example of @ref{coreimage} without the
  21388. need for a nullsrc video source.
  21389. @end itemize
  21390. @section ddagrab
  21391. Captures the Windows Desktop via Desktop Duplication API.
  21392. The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding
  21393. or processing. So an explicit @ref{hwdownload} is needed for any kind of
  21394. software processing.
  21395. It accepts the following options:
  21396. @table @option
  21397. @item output_idx
  21398. DXGI Output Index to capture.
  21399. Usually corresponds to the index Windows has given the screen minus one,
  21400. so it's starting at 0.
  21401. Defaults to output 0.
  21402. @item draw_mouse
  21403. Whether to draw the mouse cursor.
  21404. Defaults to true.
  21405. Only affects hardware cursors. If a game or application renders its own cursor,
  21406. it'll always be captured.
  21407. @item framerate
  21408. Framerate at which the desktop will be captured.
  21409. Defaults to 30 FPS.
  21410. @item video_size
  21411. Specify the size of the captured video.
  21412. Defaults to the full size of the screen.
  21413. Cropped from the bottom/right if smaller than screen size.
  21414. @item offset_x
  21415. Horizontal offset of the captured video.
  21416. @item offset_y
  21417. Vertical offset of the captured video.
  21418. @item output_fmt
  21419. Desired filter output format.
  21420. Defaults to 8 Bit BGRA.
  21421. It accepts the following values:
  21422. @table @samp
  21423. @item auto
  21424. Passes all supported output formats to DDA and returns what DDA decides to use.
  21425. @item 8bit
  21426. @item bgra
  21427. 8 Bit formats always work, and DDA will convert to them if necessary.
  21428. @item 10bit
  21429. @item x2bgr10
  21430. Filter initialization will fail if 10 bit format is requested but unavailable.
  21431. @end table
  21432. @end table
  21433. @subsection Examples
  21434. Capture primary screen and encode using nvenc:
  21435. @example
  21436. ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4
  21437. @end example
  21438. You can also skip the lavfi device and directly use the filter.
  21439. Also demonstrates downloading the frame and encoding with libx264.
  21440. Explicit output format specification is required in this case:
  21441. @example
  21442. ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4
  21443. @end example
  21444. If you want to capture only a subsection of the desktop, this can be achieved
  21445. by specifying a smaller size and its offsets into the screen:
  21446. @example
  21447. ddagrab=video_size=800x600:offset_x=100:offset_y=100
  21448. @end example
  21449. @section gradients
  21450. Generate several gradients.
  21451. @table @option
  21452. @item size, s
  21453. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  21454. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  21455. @item rate, r
  21456. Set frame rate, expressed as number of frames per second. Default
  21457. value is "25".
  21458. @item c0, c1, c2, c3, c4, c5, c6, c7
  21459. Set 8 colors. Default values for colors is to pick random one.
  21460. @item x0, y0, y0, y1
  21461. Set gradient line source and destination points. If negative or out of range, random ones
  21462. are picked.
  21463. @item nb_colors, n
  21464. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  21465. @item seed
  21466. Set seed for picking gradient line points.
  21467. @item duration, d
  21468. Set the duration of the sourced video. See
  21469. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21470. for the accepted syntax.
  21471. If not specified, or the expressed duration is negative, the video is
  21472. supposed to be generated forever.
  21473. @item speed
  21474. Set speed of gradients rotation.
  21475. @item type, t
  21476. Set type of gradients, can be @code{linear} or @code{radial} or @code{circular} or @code{spiral}.
  21477. @end table
  21478. @section mandelbrot
  21479. Generate a Mandelbrot set fractal, and progressively zoom towards the
  21480. point specified with @var{start_x} and @var{start_y}.
  21481. This source accepts the following options:
  21482. @table @option
  21483. @item end_pts
  21484. Set the terminal pts value. Default value is 400.
  21485. @item end_scale
  21486. Set the terminal scale value.
  21487. Must be a floating point value. Default value is 0.3.
  21488. @item inner
  21489. Set the inner coloring mode, that is the algorithm used to draw the
  21490. Mandelbrot fractal internal region.
  21491. It shall assume one of the following values:
  21492. @table @option
  21493. @item black
  21494. Set black mode.
  21495. @item convergence
  21496. Show time until convergence.
  21497. @item mincol
  21498. Set color based on point closest to the origin of the iterations.
  21499. @item period
  21500. Set period mode.
  21501. @end table
  21502. Default value is @var{mincol}.
  21503. @item bailout
  21504. Set the bailout value. Default value is 10.0.
  21505. @item maxiter
  21506. Set the maximum of iterations performed by the rendering
  21507. algorithm. Default value is 7189.
  21508. @item outer
  21509. Set outer coloring mode.
  21510. It shall assume one of following values:
  21511. @table @option
  21512. @item iteration_count
  21513. Set iteration count mode.
  21514. @item normalized_iteration_count
  21515. set normalized iteration count mode.
  21516. @end table
  21517. Default value is @var{normalized_iteration_count}.
  21518. @item rate, r
  21519. Set frame rate, expressed as number of frames per second. Default
  21520. value is "25".
  21521. @item size, s
  21522. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  21523. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  21524. @item start_scale
  21525. Set the initial scale value. Default value is 3.0.
  21526. @item start_x
  21527. Set the initial x position. Must be a floating point value between
  21528. -100 and 100. Default value is -0.743643887037158704752191506114774.
  21529. @item start_y
  21530. Set the initial y position. Must be a floating point value between
  21531. -100 and 100. Default value is -0.131825904205311970493132056385139.
  21532. @end table
  21533. @section mptestsrc
  21534. Generate various test patterns, as generated by the MPlayer test filter.
  21535. The size of the generated video is fixed, and is 256x256.
  21536. This source is useful in particular for testing encoding features.
  21537. This source accepts the following options:
  21538. @table @option
  21539. @item rate, r
  21540. Specify the frame rate of the sourced video, as the number of frames
  21541. generated per second. It has to be a string in the format
  21542. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  21543. number or a valid video frame rate abbreviation. The default value is
  21544. "25".
  21545. @item duration, d
  21546. Set the duration of the sourced video. See
  21547. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21548. for the accepted syntax.
  21549. If not specified, or the expressed duration is negative, the video is
  21550. supposed to be generated forever.
  21551. @item test, t
  21552. Set the number or the name of the test to perform. Supported tests are:
  21553. @table @option
  21554. @item dc_luma
  21555. @item dc_chroma
  21556. @item freq_luma
  21557. @item freq_chroma
  21558. @item amp_luma
  21559. @item amp_chroma
  21560. @item cbp
  21561. @item mv
  21562. @item ring1
  21563. @item ring2
  21564. @item all
  21565. @item max_frames, m
  21566. Set the maximum number of frames generated for each test, default value is 30.
  21567. @end table
  21568. Default value is "all", which will cycle through the list of all tests.
  21569. @end table
  21570. Some examples:
  21571. @example
  21572. mptestsrc=t=dc_luma
  21573. @end example
  21574. will generate a "dc_luma" test pattern.
  21575. @section frei0r_src
  21576. Provide a frei0r source.
  21577. To enable compilation of this filter you need to install the frei0r
  21578. header and configure FFmpeg with @code{--enable-frei0r}.
  21579. This source accepts the following parameters:
  21580. @table @option
  21581. @item size
  21582. The size of the video to generate. For the syntax of this option, check the
  21583. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21584. @item framerate
  21585. The framerate of the generated video. It may be a string of the form
  21586. @var{num}/@var{den} or a frame rate abbreviation.
  21587. @item filter_name
  21588. The name to the frei0r source to load. For more information regarding frei0r and
  21589. how to set the parameters, read the @ref{frei0r} section in the video filters
  21590. documentation.
  21591. @item filter_params
  21592. A '|'-separated list of parameters to pass to the frei0r source.
  21593. @end table
  21594. For example, to generate a frei0r partik0l source with size 200x200
  21595. and frame rate 10 which is overlaid on the overlay filter main input:
  21596. @example
  21597. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  21598. @end example
  21599. @section life
  21600. Generate a life pattern.
  21601. This source is based on a generalization of John Conway's life game.
  21602. The sourced input represents a life grid, each pixel represents a cell
  21603. which can be in one of two possible states, alive or dead. Every cell
  21604. interacts with its eight neighbours, which are the cells that are
  21605. horizontally, vertically, or diagonally adjacent.
  21606. At each interaction the grid evolves according to the adopted rule,
  21607. which specifies the number of neighbor alive cells which will make a
  21608. cell stay alive or born. The @option{rule} option allows one to specify
  21609. the rule to adopt.
  21610. This source accepts the following options:
  21611. @table @option
  21612. @item filename, f
  21613. Set the file from which to read the initial grid state. In the file,
  21614. each non-whitespace character is considered an alive cell, and newline
  21615. is used to delimit the end of each row.
  21616. If this option is not specified, the initial grid is generated
  21617. randomly.
  21618. @item rate, r
  21619. Set the video rate, that is the number of frames generated per second.
  21620. Default is 25.
  21621. @item random_fill_ratio, ratio
  21622. Set the random fill ratio for the initial random grid. It is a
  21623. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  21624. It is ignored when a file is specified.
  21625. @item random_seed, seed
  21626. Set the seed for filling the initial random grid, must be an integer
  21627. included between 0 and UINT32_MAX. If not specified, or if explicitly
  21628. set to -1, the filter will try to use a good random seed on a best
  21629. effort basis.
  21630. @item rule
  21631. Set the life rule.
  21632. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  21633. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  21634. @var{NS} specifies the number of alive neighbor cells which make a
  21635. live cell stay alive, and @var{NB} the number of alive neighbor cells
  21636. which make a dead cell to become alive (i.e. to "born").
  21637. "s" and "b" can be used in place of "S" and "B", respectively.
  21638. Alternatively a rule can be specified by an 18-bits integer. The 9
  21639. high order bits are used to encode the next cell state if it is alive
  21640. for each number of neighbor alive cells, the low order bits specify
  21641. the rule for "borning" new cells. Higher order bits encode for an
  21642. higher number of neighbor cells.
  21643. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  21644. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  21645. Default value is "S23/B3", which is the original Conway's game of life
  21646. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  21647. cells, and will born a new cell if there are three alive cells around
  21648. a dead cell.
  21649. @item size, s
  21650. Set the size of the output video. For the syntax of this option, check the
  21651. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21652. If @option{filename} is specified, the size is set by default to the
  21653. same size of the input file. If @option{size} is set, it must contain
  21654. the size specified in the input file, and the initial grid defined in
  21655. that file is centered in the larger resulting area.
  21656. If a filename is not specified, the size value defaults to "320x240"
  21657. (used for a randomly generated initial grid).
  21658. @item stitch
  21659. If set to 1, stitch the left and right grid edges together, and the
  21660. top and bottom edges also. Defaults to 1.
  21661. @item mold
  21662. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  21663. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  21664. value from 0 to 255.
  21665. @item life_color
  21666. Set the color of living (or new born) cells.
  21667. @item death_color
  21668. Set the color of dead cells. If @option{mold} is set, this is the first color
  21669. used to represent a dead cell.
  21670. @item mold_color
  21671. Set mold color, for definitely dead and moldy cells.
  21672. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  21673. ffmpeg-utils manual,ffmpeg-utils}.
  21674. @end table
  21675. @subsection Examples
  21676. @itemize
  21677. @item
  21678. Read a grid from @file{pattern}, and center it on a grid of size
  21679. 300x300 pixels:
  21680. @example
  21681. life=f=pattern:s=300x300
  21682. @end example
  21683. @item
  21684. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  21685. @example
  21686. life=ratio=2/3:s=200x200
  21687. @end example
  21688. @item
  21689. Specify a custom rule for evolving a randomly generated grid:
  21690. @example
  21691. life=rule=S14/B34
  21692. @end example
  21693. @item
  21694. Full example with slow death effect (mold) using @command{ffplay}:
  21695. @example
  21696. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  21697. @end example
  21698. @end itemize
  21699. @anchor{allrgb}
  21700. @anchor{allyuv}
  21701. @anchor{color}
  21702. @anchor{colorchart}
  21703. @anchor{colorspectrum}
  21704. @anchor{haldclutsrc}
  21705. @anchor{nullsrc}
  21706. @anchor{pal75bars}
  21707. @anchor{pal100bars}
  21708. @anchor{rgbtestsrc}
  21709. @anchor{smptebars}
  21710. @anchor{smptehdbars}
  21711. @anchor{testsrc}
  21712. @anchor{testsrc2}
  21713. @anchor{yuvtestsrc}
  21714. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  21715. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  21716. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  21717. The @code{color} source provides an uniformly colored input.
  21718. The @code{colorchart} source provides a colors checker chart.
  21719. The @code{colorspectrum} source provides a color spectrum input.
  21720. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  21721. @ref{haldclut} filter.
  21722. The @code{nullsrc} source returns unprocessed video frames. It is
  21723. mainly useful to be employed in analysis / debugging tools, or as the
  21724. source for filters which ignore the input data.
  21725. The @code{pal75bars} source generates a color bars pattern, based on
  21726. EBU PAL recommendations with 75% color levels.
  21727. The @code{pal100bars} source generates a color bars pattern, based on
  21728. EBU PAL recommendations with 100% color levels.
  21729. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  21730. detecting RGB vs BGR issues. You should see a red, green and blue
  21731. stripe from top to bottom.
  21732. The @code{smptebars} source generates a color bars pattern, based on
  21733. the SMPTE Engineering Guideline EG 1-1990.
  21734. The @code{smptehdbars} source generates a color bars pattern, based on
  21735. the SMPTE RP 219-2002.
  21736. The @code{testsrc} source generates a test video pattern, showing a
  21737. color pattern, a scrolling gradient and a timestamp. This is mainly
  21738. intended for testing purposes.
  21739. The @code{testsrc2} source is similar to testsrc, but supports more
  21740. pixel formats instead of just @code{rgb24}. This allows using it as an
  21741. input for other tests without requiring a format conversion.
  21742. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  21743. see a y, cb and cr stripe from top to bottom.
  21744. The sources accept the following parameters:
  21745. @table @option
  21746. @item level
  21747. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  21748. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  21749. pixels to be used as identity matrix for 3D lookup tables. Each component is
  21750. coded on a @code{1/(N*N)} scale.
  21751. @item color, c
  21752. Specify the color of the source, only available in the @code{color}
  21753. source. For the syntax of this option, check the
  21754. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21755. @item size, s
  21756. Specify the size of the sourced video. For the syntax of this option, check the
  21757. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21758. The default value is @code{320x240}.
  21759. This option is not available with the @code{allrgb}, @code{allyuv}, and
  21760. @code{haldclutsrc} filters.
  21761. @item rate, r
  21762. Specify the frame rate of the sourced video, as the number of frames
  21763. generated per second. It has to be a string in the format
  21764. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  21765. number or a valid video frame rate abbreviation. The default value is
  21766. "25".
  21767. @item duration, d
  21768. Set the duration of the sourced video. See
  21769. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21770. for the accepted syntax.
  21771. If not specified, or the expressed duration is negative, the video is
  21772. supposed to be generated forever.
  21773. Since the frame rate is used as time base, all frames including the last one
  21774. will have their full duration. If the specified duration is not a multiple
  21775. of the frame duration, it will be rounded up.
  21776. @item sar
  21777. Set the sample aspect ratio of the sourced video.
  21778. @item alpha
  21779. Specify the alpha (opacity) of the background, only available in the
  21780. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  21781. 255 (fully opaque, the default).
  21782. @item decimals, n
  21783. Set the number of decimals to show in the timestamp, only available in the
  21784. @code{testsrc} source.
  21785. The displayed timestamp value will correspond to the original
  21786. timestamp value multiplied by the power of 10 of the specified
  21787. value. Default value is 0.
  21788. @item type
  21789. Set the type of the color spectrum, only available in the
  21790. @code{colorspectrum} source. Can be one of the following:
  21791. @table @samp
  21792. @item black
  21793. @item white
  21794. @item all
  21795. @end table
  21796. @item patch_size
  21797. Set patch size of single color patch, only available in the
  21798. @code{colorchart} source. Default is @code{64x64}.
  21799. @item preset
  21800. Set colorchecker colors preset, only available in the
  21801. @code{colorchart} source.
  21802. Available values are:
  21803. @table @samp
  21804. @item reference
  21805. @item skintones
  21806. @end table
  21807. Default value is @code{reference}.
  21808. @end table
  21809. @subsection Examples
  21810. @itemize
  21811. @item
  21812. Generate a video with a duration of 5.3 seconds, with size
  21813. 176x144 and a frame rate of 10 frames per second:
  21814. @example
  21815. testsrc=duration=5.3:size=qcif:rate=10
  21816. @end example
  21817. @item
  21818. The following graph description will generate a red source
  21819. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  21820. frames per second:
  21821. @example
  21822. color=c=red@@0.2:s=qcif:r=10
  21823. @end example
  21824. @item
  21825. If the input content is to be ignored, @code{nullsrc} can be used. The
  21826. following command generates noise in the luma plane by employing
  21827. the @code{geq} filter:
  21828. @example
  21829. nullsrc=s=256x256, geq=random(1)*255:128:128
  21830. @end example
  21831. @end itemize
  21832. @subsection Commands
  21833. The @code{color} source supports the following commands:
  21834. @table @option
  21835. @item c, color
  21836. Set the color of the created image. Accepts the same syntax of the
  21837. corresponding @option{color} option.
  21838. @end table
  21839. @section openclsrc
  21840. Generate video using an OpenCL program.
  21841. @table @option
  21842. @item source
  21843. OpenCL program source file.
  21844. @item kernel
  21845. Kernel name in program.
  21846. @item size, s
  21847. Size of frames to generate. This must be set.
  21848. @item format
  21849. Pixel format to use for the generated frames. This must be set.
  21850. @item rate, r
  21851. Number of frames generated every second. Default value is '25'.
  21852. @end table
  21853. For details of how the program loading works, see the @ref{program_opencl}
  21854. filter.
  21855. Example programs:
  21856. @itemize
  21857. @item
  21858. Generate a colour ramp by setting pixel values from the position of the pixel
  21859. in the output image. (Note that this will work with all pixel formats, but
  21860. the generated output will not be the same.)
  21861. @verbatim
  21862. __kernel void ramp(__write_only image2d_t dst,
  21863. unsigned int index)
  21864. {
  21865. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  21866. float4 val;
  21867. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  21868. write_imagef(dst, loc, val);
  21869. }
  21870. @end verbatim
  21871. @item
  21872. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  21873. @verbatim
  21874. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  21875. unsigned int index)
  21876. {
  21877. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  21878. float4 value = 0.0f;
  21879. int x = loc.x + index;
  21880. int y = loc.y + index;
  21881. while (x > 0 || y > 0) {
  21882. if (x % 3 == 1 && y % 3 == 1) {
  21883. value = 1.0f;
  21884. break;
  21885. }
  21886. x /= 3;
  21887. y /= 3;
  21888. }
  21889. write_imagef(dst, loc, value);
  21890. }
  21891. @end verbatim
  21892. @end itemize
  21893. @section sierpinski
  21894. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  21895. This source accepts the following options:
  21896. @table @option
  21897. @item size, s
  21898. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  21899. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  21900. @item rate, r
  21901. Set frame rate, expressed as number of frames per second. Default
  21902. value is "25".
  21903. @item seed
  21904. Set seed which is used for random panning.
  21905. @item jump
  21906. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  21907. @item type
  21908. Set fractal type, can be default @code{carpet} or @code{triangle}.
  21909. @end table
  21910. @section zoneplate
  21911. Generate a zoneplate test video pattern.
  21912. This source accepts the following options:
  21913. @table @option
  21914. @item size, s
  21915. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  21916. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "320x240".
  21917. @item rate, r
  21918. Set frame rate, expressed as number of frames per second. Default
  21919. value is "25".
  21920. @item duration, d
  21921. Set the duration of the sourced video. See
  21922. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21923. for the accepted syntax.
  21924. If not specified, or the expressed duration is negative, the video is
  21925. supposed to be generated forever.
  21926. @item sar
  21927. Set the sample aspect ratio of the sourced video.
  21928. @item precision
  21929. Set precision in bits for look-up table for sine calculations. Default value is 10.
  21930. Allowed range is from 4 to 16.
  21931. @item xo
  21932. Set horizontal axis offset for output signal. Default value is 0.
  21933. @item yo
  21934. Set vertical axis offset for output signal. Default value is 0.
  21935. @item to
  21936. Set time axis offset for output signal. Default value is 0.
  21937. @item k0
  21938. Set 0-order, constant added to signal phase. Default value is 0.
  21939. @item kx
  21940. Set 1-order, phase factor multiplier for horizontal axis. Default value is 0.
  21941. @item ky
  21942. Set 1-order, phase factor multiplier for vertical axis. Default value is 0.
  21943. @item kt
  21944. Set 1-order, phase factor multiplier for time axis. Default value is 0.
  21945. @item kxt, kyt, kxy
  21946. Set phase factor multipliers for combination of spatial and temporal axis.
  21947. Default value is 0.
  21948. @item kx2
  21949. Set 2-order, phase factor multiplier for horizontal axis. Default value is 0.
  21950. @item ky2
  21951. Set 2-order, phase factor multiplier for vertical axis. Default value is 0.
  21952. @item kt2
  21953. Set 2-order, phase factor multiplier for time axis. Default value is 0.
  21954. @item ku
  21955. Set the constant added to final phase to produce chroma-blue component of signal.
  21956. Default value is 0.
  21957. @item kv
  21958. Set the constant added to final phase to produce chroma-red component of signal.
  21959. Default value is 0.
  21960. @end table
  21961. @subsection Commands
  21962. This source supports the some above options as @ref{commands}.
  21963. @subsection Examples
  21964. @itemize
  21965. @item
  21966. Generate horizontal color sine sweep:
  21967. @example
  21968. zoneplate=ku=512:kv=0:kt2=0:kx2=256:s=wvga:xo=-426:kt=11
  21969. @end example
  21970. @item
  21971. Generate vertical color sine sweep:
  21972. @example
  21973. zoneplate=ku=512:kv=0:kt2=0:ky2=156:s=wvga:yo=-240:kt=11
  21974. @end example
  21975. @item
  21976. Generate circular zone-plate:
  21977. @example
  21978. zoneplate=ku=512:kv=100:kt2=0:ky2=256:kx2=556:s=wvga:yo=0:kt=11
  21979. @end example
  21980. @end itemize
  21981. @c man end VIDEO SOURCES
  21982. @chapter Video Sinks
  21983. @c man begin VIDEO SINKS
  21984. Below is a description of the currently available video sinks.
  21985. @section buffersink
  21986. Buffer video frames, and make them available to the end of the filter
  21987. graph.
  21988. This sink is mainly intended for programmatic use, in particular
  21989. through the interface defined in @file{libavfilter/buffersink.h}
  21990. or the options system.
  21991. It accepts a pointer to an AVBufferSinkContext structure, which
  21992. defines the incoming buffers' formats, to be passed as the opaque
  21993. parameter to @code{avfilter_init_filter} for initialization.
  21994. @section nullsink
  21995. Null video sink: do absolutely nothing with the input video. It is
  21996. mainly useful as a template and for use in analysis / debugging
  21997. tools.
  21998. @c man end VIDEO SINKS
  21999. @chapter Multimedia Filters
  22000. @c man begin MULTIMEDIA FILTERS
  22001. Below is a description of the currently available multimedia filters.
  22002. @section a3dscope
  22003. Convert input audio to 3d scope video output.
  22004. The filter accepts the following options:
  22005. @table @option
  22006. @item rate, r
  22007. Set frame rate, expressed as number of frames per second. Default
  22008. value is "25".
  22009. @item size, s
  22010. Specify the video size for the output. For the syntax of this option, check the
  22011. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22012. Default value is @code{hd720}.
  22013. @item fov
  22014. Set the camera field of view. Default is 90 degrees.
  22015. Allowed range is from 40 to 150.
  22016. @item roll
  22017. Set the camera roll.
  22018. @item pitch
  22019. Set the camera pitch.
  22020. @item yaw
  22021. Set the camera yaw.
  22022. @item xzoom
  22023. Set the camera zoom on X-axis.
  22024. @item yzoom
  22025. Set the camera zoom on Y-axis.
  22026. @item zzoom
  22027. Set the camera zoom on Z-axis.
  22028. @item xpos
  22029. Set the camera position on X-axis.
  22030. @item ypos
  22031. Set the camera position on Y-axis.
  22032. @item zpos
  22033. Set the camera position on Z-axis.
  22034. @item length
  22035. Set the length of displayed audio waves in number of frames.
  22036. @end table
  22037. @subsection Commands
  22038. Filter supports the some above options as @ref{commands}.
  22039. @section abitscope
  22040. Convert input audio to a video output, displaying the audio bit scope.
  22041. The filter accepts the following options:
  22042. @table @option
  22043. @item rate, r
  22044. Set frame rate, expressed as number of frames per second. Default
  22045. value is "25".
  22046. @item size, s
  22047. Specify the video size for the output. For the syntax of this option, check the
  22048. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22049. Default value is @code{1024x256}.
  22050. @item colors
  22051. Specify list of colors separated by space or by '|' which will be used to
  22052. draw channels. Unrecognized or missing colors will be replaced
  22053. by white color.
  22054. @item mode, m
  22055. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  22056. @end table
  22057. @section adrawgraph
  22058. Draw a graph using input audio metadata.
  22059. See @ref{drawgraph}
  22060. @section agraphmonitor
  22061. See @ref{graphmonitor}.
  22062. @section ahistogram
  22063. Convert input audio to a video output, displaying the volume histogram.
  22064. The filter accepts the following options:
  22065. @table @option
  22066. @item dmode
  22067. Specify how histogram is calculated.
  22068. It accepts the following values:
  22069. @table @samp
  22070. @item single
  22071. Use single histogram for all channels.
  22072. @item separate
  22073. Use separate histogram for each channel.
  22074. @end table
  22075. Default is @code{single}.
  22076. @item rate, r
  22077. Set frame rate, expressed as number of frames per second. Default
  22078. value is "25".
  22079. @item size, s
  22080. Specify the video size for the output. For the syntax of this option, check the
  22081. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22082. Default value is @code{hd720}.
  22083. @item scale
  22084. Set display scale.
  22085. It accepts the following values:
  22086. @table @samp
  22087. @item log
  22088. logarithmic
  22089. @item sqrt
  22090. square root
  22091. @item cbrt
  22092. cubic root
  22093. @item lin
  22094. linear
  22095. @item rlog
  22096. reverse logarithmic
  22097. @end table
  22098. Default is @code{log}.
  22099. @item ascale
  22100. Set amplitude scale.
  22101. It accepts the following values:
  22102. @table @samp
  22103. @item log
  22104. logarithmic
  22105. @item lin
  22106. linear
  22107. @end table
  22108. Default is @code{log}.
  22109. @item acount
  22110. Set how much frames to accumulate in histogram.
  22111. Default is 1. Setting this to -1 accumulates all frames.
  22112. @item rheight
  22113. Set histogram ratio of window height.
  22114. @item slide
  22115. Set sonogram sliding.
  22116. It accepts the following values:
  22117. @table @samp
  22118. @item replace
  22119. replace old rows with new ones.
  22120. @item scroll
  22121. scroll from top to bottom.
  22122. @end table
  22123. Default is @code{replace}.
  22124. @item hmode
  22125. Set histogram mode.
  22126. It accepts the following values:
  22127. @table @samp
  22128. @item abs
  22129. Use absolute values of samples.
  22130. @item sign
  22131. Use untouched values of samples.
  22132. @end table
  22133. Default is @code{abs}.
  22134. @end table
  22135. @section aphasemeter
  22136. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  22137. representing mean phase of current audio frame. A video output can also be produced and is
  22138. enabled by default. The audio is passed through as first output.
  22139. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  22140. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  22141. and @code{1} means channels are in phase.
  22142. The filter accepts the following options, all related to its video output:
  22143. @table @option
  22144. @item rate, r
  22145. Set the output frame rate. Default value is @code{25}.
  22146. @item size, s
  22147. Set the video size for the output. For the syntax of this option, check the
  22148. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22149. Default value is @code{800x400}.
  22150. @item rc
  22151. @item gc
  22152. @item bc
  22153. Specify the red, green, blue contrast. Default values are @code{2},
  22154. @code{7} and @code{1}.
  22155. Allowed range is @code{[0, 255]}.
  22156. @item mpc
  22157. Set color which will be used for drawing median phase. If color is
  22158. @code{none} which is default, no median phase value will be drawn.
  22159. @item video
  22160. Enable video output. Default is enabled.
  22161. @end table
  22162. @subsection phasing detection
  22163. The filter also detects out of phase and mono sequences in stereo streams.
  22164. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  22165. The filter accepts the following options for this detection:
  22166. @table @option
  22167. @item phasing
  22168. Enable mono and out of phase detection. Default is disabled.
  22169. @item tolerance, t
  22170. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  22171. Allowed range is @code{[0, 1]}.
  22172. @item angle, a
  22173. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  22174. Allowed range is @code{[90, 180]}.
  22175. @item duration, d
  22176. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  22177. @end table
  22178. @subsection Examples
  22179. @itemize
  22180. @item
  22181. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  22182. @example
  22183. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  22184. @end example
  22185. @end itemize
  22186. @section avectorscope
  22187. Convert input audio to a video output, representing the audio vector
  22188. scope.
  22189. The filter is used to measure the difference between channels of stereo
  22190. audio stream. A monaural signal, consisting of identical left and right
  22191. signal, results in straight vertical line. Any stereo separation is visible
  22192. as a deviation from this line, creating a Lissajous figure.
  22193. If the straight (or deviation from it) but horizontal line appears this
  22194. indicates that the left and right channels are out of phase.
  22195. The filter accepts the following options:
  22196. @table @option
  22197. @item mode, m
  22198. Set the vectorscope mode.
  22199. Available values are:
  22200. @table @samp
  22201. @item lissajous
  22202. Lissajous rotated by 45 degrees.
  22203. @item lissajous_xy
  22204. Same as above but not rotated.
  22205. @item polar
  22206. Shape resembling half of circle.
  22207. @end table
  22208. Default value is @samp{lissajous}.
  22209. @item size, s
  22210. Set the video size for the output. For the syntax of this option, check the
  22211. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22212. Default value is @code{400x400}.
  22213. @item rate, r
  22214. Set the output frame rate. Default value is @code{25}.
  22215. @item rc
  22216. @item gc
  22217. @item bc
  22218. @item ac
  22219. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  22220. @code{160}, @code{80} and @code{255}.
  22221. Allowed range is @code{[0, 255]}.
  22222. @item rf
  22223. @item gf
  22224. @item bf
  22225. @item af
  22226. Specify the red, green, blue and alpha fade. Default values are @code{15},
  22227. @code{10}, @code{5} and @code{5}.
  22228. Allowed range is @code{[0, 255]}.
  22229. @item zoom
  22230. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  22231. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  22232. @item draw
  22233. Set the vectorscope drawing mode.
  22234. Available values are:
  22235. @table @samp
  22236. @item dot
  22237. Draw dot for each sample.
  22238. @item line
  22239. Draw line between previous and current sample.
  22240. @item aaline
  22241. Draw anti-aliased line between previous and current sample.
  22242. @end table
  22243. Default value is @samp{dot}.
  22244. @item scale
  22245. Specify amplitude scale of audio samples.
  22246. Available values are:
  22247. @table @samp
  22248. @item lin
  22249. Linear.
  22250. @item sqrt
  22251. Square root.
  22252. @item cbrt
  22253. Cubic root.
  22254. @item log
  22255. Logarithmic.
  22256. @end table
  22257. @item swap
  22258. Swap left channel axis with right channel axis.
  22259. @item mirror
  22260. Mirror axis.
  22261. @table @samp
  22262. @item none
  22263. No mirror.
  22264. @item x
  22265. Mirror only x axis.
  22266. @item y
  22267. Mirror only y axis.
  22268. @item xy
  22269. Mirror both axis.
  22270. @end table
  22271. @end table
  22272. @subsection Examples
  22273. @itemize
  22274. @item
  22275. Complete example using @command{ffplay}:
  22276. @example
  22277. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  22278. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  22279. @end example
  22280. @end itemize
  22281. @subsection Commands
  22282. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  22283. @section bench, abench
  22284. Benchmark part of a filtergraph.
  22285. The filter accepts the following options:
  22286. @table @option
  22287. @item action
  22288. Start or stop a timer.
  22289. Available values are:
  22290. @table @samp
  22291. @item start
  22292. Get the current time, set it as frame metadata (using the key
  22293. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  22294. @item stop
  22295. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  22296. the input frame metadata to get the time difference. Time difference, average,
  22297. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  22298. @code{min}) are then printed. The timestamps are expressed in seconds.
  22299. @end table
  22300. @end table
  22301. @subsection Examples
  22302. @itemize
  22303. @item
  22304. Benchmark @ref{selectivecolor} filter:
  22305. @example
  22306. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  22307. @end example
  22308. @end itemize
  22309. @section concat
  22310. Concatenate audio and video streams, joining them together one after the
  22311. other.
  22312. The filter works on segments of synchronized video and audio streams. All
  22313. segments must have the same number of streams of each type, and that will
  22314. also be the number of streams at output.
  22315. The filter accepts the following options:
  22316. @table @option
  22317. @item n
  22318. Set the number of segments. Default is 2.
  22319. @item v
  22320. Set the number of output video streams, that is also the number of video
  22321. streams in each segment. Default is 1.
  22322. @item a
  22323. Set the number of output audio streams, that is also the number of audio
  22324. streams in each segment. Default is 0.
  22325. @item unsafe
  22326. Activate unsafe mode: do not fail if segments have a different format.
  22327. @end table
  22328. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  22329. @var{a} audio outputs.
  22330. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  22331. segment, in the same order as the outputs, then the inputs for the second
  22332. segment, etc.
  22333. Related streams do not always have exactly the same duration, for various
  22334. reasons including codec frame size or sloppy authoring. For that reason,
  22335. related synchronized streams (e.g. a video and its audio track) should be
  22336. concatenated at once. The concat filter will use the duration of the longest
  22337. stream in each segment (except the last one), and if necessary pad shorter
  22338. audio streams with silence.
  22339. For this filter to work correctly, all segments must start at timestamp 0.
  22340. All corresponding streams must have the same parameters in all segments; the
  22341. filtering system will automatically select a common pixel format for video
  22342. streams, and a common sample format, sample rate and channel layout for
  22343. audio streams, but other settings, such as resolution, must be converted
  22344. explicitly by the user.
  22345. Different frame rates are acceptable but will result in variable frame rate
  22346. at output; be sure to configure the output file to handle it.
  22347. @subsection Examples
  22348. @itemize
  22349. @item
  22350. Concatenate an opening, an episode and an ending, all in bilingual version
  22351. (video in stream 0, audio in streams 1 and 2):
  22352. @example
  22353. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  22354. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  22355. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  22356. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  22357. @end example
  22358. @item
  22359. Concatenate two parts, handling audio and video separately, using the
  22360. (a)movie sources, and adjusting the resolution:
  22361. @example
  22362. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  22363. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  22364. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  22365. @end example
  22366. Note that a desync will happen at the stitch if the audio and video streams
  22367. do not have exactly the same duration in the first file.
  22368. @end itemize
  22369. @subsection Commands
  22370. This filter supports the following commands:
  22371. @table @option
  22372. @item next
  22373. Close the current segment and step to the next one
  22374. @end table
  22375. @anchor{ebur128}
  22376. @section ebur128
  22377. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  22378. level. By default, it logs a message at a frequency of 10Hz with the
  22379. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  22380. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  22381. The filter can only analyze streams which have
  22382. sample format is double-precision floating point. The input stream will be converted to
  22383. this specification, if needed. Users may need to insert aformat and/or aresample filters
  22384. after this filter to obtain the original parameters.
  22385. The filter also has a video output (see the @var{video} option) with a real
  22386. time graph to observe the loudness evolution. The graphic contains the logged
  22387. message mentioned above, so it is not printed anymore when this option is set,
  22388. unless the verbose logging is set. The main graphing area contains the
  22389. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  22390. the momentary loudness (400 milliseconds), but can optionally be configured
  22391. to instead display short-term loudness (see @var{gauge}).
  22392. The green area marks a +/- 1LU target range around the target loudness
  22393. (-23LUFS by default, unless modified through @var{target}).
  22394. More information about the Loudness Recommendation EBU R128 on
  22395. @url{http://tech.ebu.ch/loudness}.
  22396. The filter accepts the following options:
  22397. @table @option
  22398. @item video
  22399. Activate the video output. The audio stream is passed unchanged whether this
  22400. option is set or no. The video stream will be the first output stream if
  22401. activated. Default is @code{0}.
  22402. @item size
  22403. Set the video size. This option is for video only. For the syntax of this
  22404. option, check the
  22405. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22406. Default and minimum resolution is @code{640x480}.
  22407. @item meter
  22408. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  22409. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  22410. other integer value between this range is allowed.
  22411. @item metadata
  22412. Set metadata injection. If set to @code{1}, the audio input will be segmented
  22413. into 100ms output frames, each of them containing various loudness information
  22414. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  22415. Default is @code{0}.
  22416. @item framelog
  22417. Force the frame logging level.
  22418. Available values are:
  22419. @table @samp
  22420. @item quiet
  22421. logging disabled
  22422. @item info
  22423. information logging level
  22424. @item verbose
  22425. verbose logging level
  22426. @end table
  22427. By default, the logging level is set to @var{info}. If the @option{video} or
  22428. the @option{metadata} options are set, it switches to @var{verbose}.
  22429. @item peak
  22430. Set peak mode(s).
  22431. Available modes can be cumulated (the option is a @code{flag} type). Possible
  22432. values are:
  22433. @table @samp
  22434. @item none
  22435. Disable any peak mode (default).
  22436. @item sample
  22437. Enable sample-peak mode.
  22438. Simple peak mode looking for the higher sample value. It logs a message
  22439. for sample-peak (identified by @code{SPK}).
  22440. @item true
  22441. Enable true-peak mode.
  22442. If enabled, the peak lookup is done on an over-sampled version of the input
  22443. stream for better peak accuracy. It logs a message for true-peak.
  22444. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  22445. This mode requires a build with @code{libswresample}.
  22446. @end table
  22447. @item dualmono
  22448. Treat mono input files as "dual mono". If a mono file is intended for playback
  22449. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  22450. If set to @code{true}, this option will compensate for this effect.
  22451. Multi-channel input files are not affected by this option.
  22452. @item panlaw
  22453. Set a specific pan law to be used for the measurement of dual mono files.
  22454. This parameter is optional, and has a default value of -3.01dB.
  22455. @item target
  22456. Set a specific target level (in LUFS) used as relative zero in the visualization.
  22457. This parameter is optional and has a default value of -23LUFS as specified
  22458. by EBU R128. However, material published online may prefer a level of -16LUFS
  22459. (e.g. for use with podcasts or video platforms).
  22460. @item gauge
  22461. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  22462. @code{shortterm}. By default the momentary value will be used, but in certain
  22463. scenarios it may be more useful to observe the short term value instead (e.g.
  22464. live mixing).
  22465. @item scale
  22466. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  22467. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  22468. video output, not the summary or continuous log output.
  22469. @item integrated
  22470. Read-only exported value for measured integrated loudness, in LUFS.
  22471. @item range
  22472. Read-only exported value for measured loudness range, in LU.
  22473. @item lra_low
  22474. Read-only exported value for measured LRA low, in LUFS.
  22475. @item lra_high
  22476. Read-only exported value for measured LRA high, in LUFS.
  22477. @item sample_peak
  22478. Read-only exported value for measured sample peak, in dBFS.
  22479. @item true_peak
  22480. Read-only exported value for measured true peak, in dBFS.
  22481. @end table
  22482. @subsection Examples
  22483. @itemize
  22484. @item
  22485. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  22486. @example
  22487. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  22488. @end example
  22489. @item
  22490. Run an analysis with @command{ffmpeg}:
  22491. @example
  22492. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  22493. @end example
  22494. @end itemize
  22495. @section interleave, ainterleave
  22496. Temporally interleave frames from several inputs.
  22497. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  22498. These filters read frames from several inputs and send the oldest
  22499. queued frame to the output.
  22500. Input streams must have well defined, monotonically increasing frame
  22501. timestamp values.
  22502. In order to submit one frame to output, these filters need to enqueue
  22503. at least one frame for each input, so they cannot work in case one
  22504. input is not yet terminated and will not receive incoming frames.
  22505. For example consider the case when one input is a @code{select} filter
  22506. which always drops input frames. The @code{interleave} filter will keep
  22507. reading from that input, but it will never be able to send new frames
  22508. to output until the input sends an end-of-stream signal.
  22509. Also, depending on inputs synchronization, the filters will drop
  22510. frames in case one input receives more frames than the other ones, and
  22511. the queue is already filled.
  22512. These filters accept the following options:
  22513. @table @option
  22514. @item nb_inputs, n
  22515. Set the number of different inputs, it is 2 by default.
  22516. @item duration
  22517. How to determine the end-of-stream.
  22518. @table @option
  22519. @item longest
  22520. The duration of the longest input. (default)
  22521. @item shortest
  22522. The duration of the shortest input.
  22523. @item first
  22524. The duration of the first input.
  22525. @end table
  22526. @end table
  22527. @subsection Examples
  22528. @itemize
  22529. @item
  22530. Interleave frames belonging to different streams using @command{ffmpeg}:
  22531. @example
  22532. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  22533. @end example
  22534. @item
  22535. Add flickering blur effect:
  22536. @example
  22537. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  22538. @end example
  22539. @end itemize
  22540. @section latency, alatency
  22541. Measure filtering latency.
  22542. Report previous filter filtering latency, delay in number of audio samples for audio filters
  22543. or number of video frames for video filters.
  22544. On end of input stream, filter will report min and max measured latency for previous running filter
  22545. in filtergraph.
  22546. @section metadata, ametadata
  22547. Manipulate frame metadata.
  22548. This filter accepts the following options:
  22549. @table @option
  22550. @item mode
  22551. Set mode of operation of the filter.
  22552. Can be one of the following:
  22553. @table @samp
  22554. @item select
  22555. If both @code{value} and @code{key} is set, select frames
  22556. which have such metadata. If only @code{key} is set, select
  22557. every frame that has such key in metadata.
  22558. @item add
  22559. Add new metadata @code{key} and @code{value}. If key is already available
  22560. do nothing.
  22561. @item modify
  22562. Modify value of already present key.
  22563. @item delete
  22564. If @code{value} is set, delete only keys that have such value.
  22565. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  22566. the frame.
  22567. @item print
  22568. Print key and its value if metadata was found. If @code{key} is not set print all
  22569. metadata values available in frame.
  22570. @end table
  22571. @item key
  22572. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  22573. @item value
  22574. Set metadata value which will be used. This option is mandatory for
  22575. @code{modify} and @code{add} mode.
  22576. @item function
  22577. Which function to use when comparing metadata value and @code{value}.
  22578. Can be one of following:
  22579. @table @samp
  22580. @item same_str
  22581. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  22582. @item starts_with
  22583. Values are interpreted as strings, returns true if metadata value starts with
  22584. the @code{value} option string.
  22585. @item less
  22586. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  22587. @item equal
  22588. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  22589. @item greater
  22590. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  22591. @item expr
  22592. Values are interpreted as floats, returns true if expression from option @code{expr}
  22593. evaluates to true.
  22594. @item ends_with
  22595. Values are interpreted as strings, returns true if metadata value ends with
  22596. the @code{value} option string.
  22597. @end table
  22598. @item expr
  22599. Set expression which is used when @code{function} is set to @code{expr}.
  22600. The expression is evaluated through the eval API and can contain the following
  22601. constants:
  22602. @table @option
  22603. @item VALUE1, FRAMEVAL
  22604. Float representation of @code{value} from metadata key.
  22605. @item VALUE2, USERVAL
  22606. Float representation of @code{value} as supplied by user in @code{value} option.
  22607. @end table
  22608. @item file
  22609. If specified in @code{print} mode, output is written to the named file. Instead of
  22610. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  22611. for standard output. If @code{file} option is not set, output is written to the log
  22612. with AV_LOG_INFO loglevel.
  22613. @item direct
  22614. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  22615. @end table
  22616. @subsection Examples
  22617. @itemize
  22618. @item
  22619. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  22620. between 0 and 1.
  22621. @example
  22622. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  22623. @end example
  22624. @item
  22625. Print silencedetect output to file @file{metadata.txt}.
  22626. @example
  22627. silencedetect,ametadata=mode=print:file=metadata.txt
  22628. @end example
  22629. @item
  22630. Direct all metadata to a pipe with file descriptor 4.
  22631. @example
  22632. metadata=mode=print:file='pipe\:4'
  22633. @end example
  22634. @end itemize
  22635. @section perms, aperms
  22636. Set read/write permissions for the output frames.
  22637. These filters are mainly aimed at developers to test direct path in the
  22638. following filter in the filtergraph.
  22639. The filters accept the following options:
  22640. @table @option
  22641. @item mode
  22642. Select the permissions mode.
  22643. It accepts the following values:
  22644. @table @samp
  22645. @item none
  22646. Do nothing. This is the default.
  22647. @item ro
  22648. Set all the output frames read-only.
  22649. @item rw
  22650. Set all the output frames directly writable.
  22651. @item toggle
  22652. Make the frame read-only if writable, and writable if read-only.
  22653. @item random
  22654. Set each output frame read-only or writable randomly.
  22655. @end table
  22656. @item seed
  22657. Set the seed for the @var{random} mode, must be an integer included between
  22658. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  22659. @code{-1}, the filter will try to use a good random seed on a best effort
  22660. basis.
  22661. @end table
  22662. Note: in case of auto-inserted filter between the permission filter and the
  22663. following one, the permission might not be received as expected in that
  22664. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  22665. perms/aperms filter can avoid this problem.
  22666. @section realtime, arealtime
  22667. Slow down filtering to match real time approximately.
  22668. These filters will pause the filtering for a variable amount of time to
  22669. match the output rate with the input timestamps.
  22670. They are similar to the @option{re} option to @code{ffmpeg}.
  22671. They accept the following options:
  22672. @table @option
  22673. @item limit
  22674. Time limit for the pauses. Any pause longer than that will be considered
  22675. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  22676. @item speed
  22677. Speed factor for processing. The value must be a float larger than zero.
  22678. Values larger than 1.0 will result in faster than realtime processing,
  22679. smaller will slow processing down. The @var{limit} is automatically adapted
  22680. accordingly. Default is 1.0.
  22681. A processing speed faster than what is possible without these filters cannot
  22682. be achieved.
  22683. @end table
  22684. @subsection Commands
  22685. Both filters supports the all above options as @ref{commands}.
  22686. @section segment, asegment
  22687. Split single input stream into multiple streams.
  22688. This filter does opposite of concat filters.
  22689. @code{segment} works on video frames, @code{asegment} on audio samples.
  22690. This filter accepts the following options:
  22691. @table @option
  22692. @item timestamps
  22693. Timestamps of output segments separated by '|'. The first segment will run
  22694. from the beginning of the input stream. The last segment will run until
  22695. the end of the input stream
  22696. @item frames, samples
  22697. Exact frame/sample count to split the segments.
  22698. @end table
  22699. In all cases, prefixing an each segment with '+' will make it relative to the
  22700. previous segment.
  22701. @subsection Examples
  22702. @itemize
  22703. @item
  22704. Split input audio stream into three output audio streams, starting at start of input audio stream
  22705. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  22706. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  22707. @example
  22708. asegment=timestamps="60|150"
  22709. @end example
  22710. @end itemize
  22711. @anchor{select}
  22712. @section select, aselect
  22713. Select frames to pass in output.
  22714. This filter accepts the following options:
  22715. @table @option
  22716. @item expr, e
  22717. Set expression, which is evaluated for each input frame.
  22718. If the expression is evaluated to zero, the frame is discarded.
  22719. If the evaluation result is negative or NaN, the frame is sent to the
  22720. first output; otherwise it is sent to the output with index
  22721. @code{ceil(val)-1}, assuming that the input index starts from 0.
  22722. For example a value of @code{1.2} corresponds to the output with index
  22723. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  22724. @item outputs, n
  22725. Set the number of outputs. The output to which to send the selected
  22726. frame is based on the result of the evaluation. Default value is 1.
  22727. @end table
  22728. The expression can contain the following constants:
  22729. @table @option
  22730. @item n
  22731. The (sequential) number of the filtered frame, starting from 0.
  22732. @item selected_n
  22733. The (sequential) number of the selected frame, starting from 0.
  22734. @item prev_selected_n
  22735. The sequential number of the last selected frame. It's NAN if undefined.
  22736. @item TB
  22737. The timebase of the input timestamps.
  22738. @item pts
  22739. The PTS (Presentation TimeStamp) of the filtered frame,
  22740. expressed in @var{TB} units. It's NAN if undefined.
  22741. @item t
  22742. The PTS of the filtered frame,
  22743. expressed in seconds. It's NAN if undefined.
  22744. @item prev_pts
  22745. The PTS of the previously filtered frame. It's NAN if undefined.
  22746. @item prev_selected_pts
  22747. The PTS of the last previously filtered frame. It's NAN if undefined.
  22748. @item prev_selected_t
  22749. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  22750. @item start_pts
  22751. The first PTS in the stream which is not NAN. It remains NAN if not found.
  22752. @item start_t
  22753. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  22754. @item pict_type @emph{(video only)}
  22755. The type of the filtered frame. It can assume one of the following
  22756. values:
  22757. @table @option
  22758. @item I
  22759. @item P
  22760. @item B
  22761. @item S
  22762. @item SI
  22763. @item SP
  22764. @item BI
  22765. @end table
  22766. @item interlace_type @emph{(video only)}
  22767. The frame interlace type. It can assume one of the following values:
  22768. @table @option
  22769. @item PROGRESSIVE
  22770. The frame is progressive (not interlaced).
  22771. @item TOPFIRST
  22772. The frame is top-field-first.
  22773. @item BOTTOMFIRST
  22774. The frame is bottom-field-first.
  22775. @end table
  22776. @item consumed_sample_n @emph{(audio only)}
  22777. the number of selected samples before the current frame
  22778. @item samples_n @emph{(audio only)}
  22779. the number of samples in the current frame
  22780. @item sample_rate @emph{(audio only)}
  22781. the input sample rate
  22782. @item key
  22783. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  22784. @item pos
  22785. the position in the file of the filtered frame, -1 if the information
  22786. is not available (e.g. for synthetic video); deprecated, do not use
  22787. @item scene @emph{(video only)}
  22788. value between 0 and 1 to indicate a new scene; a low value reflects a low
  22789. probability for the current frame to introduce a new scene, while a higher
  22790. value means the current frame is more likely to be one (see the example below)
  22791. @item concatdec_select
  22792. The concat demuxer can select only part of a concat input file by setting an
  22793. inpoint and an outpoint, but the output packets may not be entirely contained
  22794. in the selected interval. By using this variable, it is possible to skip frames
  22795. generated by the concat demuxer which are not exactly contained in the selected
  22796. interval.
  22797. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  22798. and the @var{lavf.concat.duration} packet metadata values which are also
  22799. present in the decoded frames.
  22800. The @var{concatdec_select} variable is -1 if the frame pts is at least
  22801. start_time and either the duration metadata is missing or the frame pts is less
  22802. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  22803. missing.
  22804. That basically means that an input frame is selected if its pts is within the
  22805. interval set by the concat demuxer.
  22806. @end table
  22807. The default value of the select expression is "1".
  22808. @subsection Examples
  22809. @itemize
  22810. @item
  22811. Select all frames in input:
  22812. @example
  22813. select
  22814. @end example
  22815. The example above is the same as:
  22816. @example
  22817. select=1
  22818. @end example
  22819. @item
  22820. Skip all frames:
  22821. @example
  22822. select=0
  22823. @end example
  22824. @item
  22825. Select only I-frames:
  22826. @example
  22827. select='eq(pict_type\,I)'
  22828. @end example
  22829. @item
  22830. Select one frame every 100:
  22831. @example
  22832. select='not(mod(n\,100))'
  22833. @end example
  22834. @item
  22835. Select only frames contained in the 10-20 time interval:
  22836. @example
  22837. select=between(t\,10\,20)
  22838. @end example
  22839. @item
  22840. Select only I-frames contained in the 10-20 time interval:
  22841. @example
  22842. select=between(t\,10\,20)*eq(pict_type\,I)
  22843. @end example
  22844. @item
  22845. Select frames with a minimum distance of 10 seconds:
  22846. @example
  22847. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  22848. @end example
  22849. @item
  22850. Use aselect to select only audio frames with samples number > 100:
  22851. @example
  22852. aselect='gt(samples_n\,100)'
  22853. @end example
  22854. @item
  22855. Create a mosaic of the first scenes:
  22856. @example
  22857. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  22858. @end example
  22859. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  22860. choice.
  22861. @item
  22862. Send even and odd frames to separate outputs, and compose them:
  22863. @example
  22864. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  22865. @end example
  22866. @item
  22867. Select useful frames from an ffconcat file which is using inpoints and
  22868. outpoints but where the source files are not intra frame only.
  22869. @example
  22870. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  22871. @end example
  22872. @end itemize
  22873. @section sendcmd, asendcmd
  22874. Send commands to filters in the filtergraph.
  22875. These filters read commands to be sent to other filters in the
  22876. filtergraph.
  22877. @code{sendcmd} must be inserted between two video filters,
  22878. @code{asendcmd} must be inserted between two audio filters, but apart
  22879. from that they act the same way.
  22880. The specification of commands can be provided in the filter arguments
  22881. with the @var{commands} option, or in a file specified by the
  22882. @var{filename} option.
  22883. These filters accept the following options:
  22884. @table @option
  22885. @item commands, c
  22886. Set the commands to be read and sent to the other filters.
  22887. @item filename, f
  22888. Set the filename of the commands to be read and sent to the other
  22889. filters.
  22890. @end table
  22891. @subsection Commands syntax
  22892. A commands description consists of a sequence of interval
  22893. specifications, comprising a list of commands to be executed when a
  22894. particular event related to that interval occurs. The occurring event
  22895. is typically the current frame time entering or leaving a given time
  22896. interval.
  22897. An interval is specified by the following syntax:
  22898. @example
  22899. @var{START}[-@var{END}] @var{COMMANDS};
  22900. @end example
  22901. The time interval is specified by the @var{START} and @var{END} times.
  22902. @var{END} is optional and defaults to the maximum time.
  22903. The current frame time is considered within the specified interval if
  22904. it is included in the interval [@var{START}, @var{END}), that is when
  22905. the time is greater or equal to @var{START} and is lesser than
  22906. @var{END}.
  22907. @var{COMMANDS} consists of a sequence of one or more command
  22908. specifications, separated by ",", relating to that interval. The
  22909. syntax of a command specification is given by:
  22910. @example
  22911. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  22912. @end example
  22913. @var{FLAGS} is optional and specifies the type of events relating to
  22914. the time interval which enable sending the specified command, and must
  22915. be a non-null sequence of identifier flags separated by "+" or "|" and
  22916. enclosed between "[" and "]".
  22917. The following flags are recognized:
  22918. @table @option
  22919. @item enter
  22920. The command is sent when the current frame timestamp enters the
  22921. specified interval. In other words, the command is sent when the
  22922. previous frame timestamp was not in the given interval, and the
  22923. current is.
  22924. @item leave
  22925. The command is sent when the current frame timestamp leaves the
  22926. specified interval. In other words, the command is sent when the
  22927. previous frame timestamp was in the given interval, and the
  22928. current is not.
  22929. @item expr
  22930. The command @var{ARG} is interpreted as expression and result of
  22931. expression is passed as @var{ARG}.
  22932. The expression is evaluated through the eval API and can contain the following
  22933. constants:
  22934. @table @option
  22935. @item POS
  22936. Original position in the file of the frame, or undefined if undefined
  22937. for the current frame. Deprecated, do not use.
  22938. @item PTS
  22939. The presentation timestamp in input.
  22940. @item N
  22941. The count of the input frame for video or audio, starting from 0.
  22942. @item T
  22943. The time in seconds of the current frame.
  22944. @item TS
  22945. The start time in seconds of the current command interval.
  22946. @item TE
  22947. The end time in seconds of the current command interval.
  22948. @item TI
  22949. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  22950. @item W
  22951. The video frame width.
  22952. @item H
  22953. The video frame height.
  22954. @end table
  22955. @end table
  22956. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  22957. assumed.
  22958. @var{TARGET} specifies the target of the command, usually the name of
  22959. the filter class or a specific filter instance name.
  22960. @var{COMMAND} specifies the name of the command for the target filter.
  22961. @var{ARG} is optional and specifies the optional list of argument for
  22962. the given @var{COMMAND}.
  22963. Between one interval specification and another, whitespaces, or
  22964. sequences of characters starting with @code{#} until the end of line,
  22965. are ignored and can be used to annotate comments.
  22966. A simplified BNF description of the commands specification syntax
  22967. follows:
  22968. @example
  22969. @var{COMMAND_FLAG} ::= "enter" | "leave"
  22970. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  22971. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  22972. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  22973. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  22974. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  22975. @end example
  22976. @subsection Examples
  22977. @itemize
  22978. @item
  22979. Specify audio tempo change at second 4:
  22980. @example
  22981. asendcmd=c='4.0 atempo tempo 1.5',atempo
  22982. @end example
  22983. @item
  22984. Target a specific filter instance:
  22985. @example
  22986. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  22987. @end example
  22988. @item
  22989. Specify a list of drawtext and hue commands in a file.
  22990. @example
  22991. # show text in the interval 5-10
  22992. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  22993. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  22994. # desaturate the image in the interval 15-20
  22995. 15.0-20.0 [enter] hue s 0,
  22996. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  22997. [leave] hue s 1,
  22998. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  22999. # apply an exponential saturation fade-out effect, starting from time 25
  23000. 25 [enter] hue s exp(25-t)
  23001. @end example
  23002. A filtergraph allowing to read and process the above command list
  23003. stored in a file @file{test.cmd}, can be specified with:
  23004. @example
  23005. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  23006. @end example
  23007. @end itemize
  23008. @anchor{setpts}
  23009. @section setpts, asetpts
  23010. Change the PTS (presentation timestamp) of the input frames.
  23011. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  23012. This filter accepts the following options:
  23013. @table @option
  23014. @item expr
  23015. The expression which is evaluated for each frame to construct its timestamp.
  23016. @end table
  23017. The expression is evaluated through the eval API and can contain the following
  23018. constants:
  23019. @table @option
  23020. @item FRAME_RATE, FR
  23021. frame rate, only defined for constant frame-rate video
  23022. @item PTS
  23023. The presentation timestamp in input
  23024. @item N
  23025. The count of the input frame for video or the number of consumed samples,
  23026. not including the current frame for audio, starting from 0.
  23027. @item NB_CONSUMED_SAMPLES
  23028. The number of consumed samples, not including the current frame (only
  23029. audio)
  23030. @item NB_SAMPLES, S
  23031. The number of samples in the current frame (only audio)
  23032. @item SAMPLE_RATE, SR
  23033. The audio sample rate.
  23034. @item STARTPTS
  23035. The PTS of the first frame.
  23036. @item STARTT
  23037. the time in seconds of the first frame
  23038. @item INTERLACED
  23039. State whether the current frame is interlaced.
  23040. @item T
  23041. the time in seconds of the current frame
  23042. @item POS
  23043. original position in the file of the frame, or undefined if undefined
  23044. for the current frame; deprecated, do not use
  23045. @item PREV_INPTS
  23046. The previous input PTS.
  23047. @item PREV_INT
  23048. previous input time in seconds
  23049. @item PREV_OUTPTS
  23050. The previous output PTS.
  23051. @item PREV_OUTT
  23052. previous output time in seconds
  23053. @item RTCTIME
  23054. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  23055. instead.
  23056. @item RTCSTART
  23057. The wallclock (RTC) time at the start of the movie in microseconds.
  23058. @item TB
  23059. The timebase of the input timestamps.
  23060. @item T_CHANGE
  23061. Time of the first frame after command was applied or time of the first frame if no commands.
  23062. @end table
  23063. @subsection Examples
  23064. @itemize
  23065. @item
  23066. Start counting PTS from zero
  23067. @example
  23068. setpts=PTS-STARTPTS
  23069. @end example
  23070. @item
  23071. Apply fast motion effect:
  23072. @example
  23073. setpts=0.5*PTS
  23074. @end example
  23075. @item
  23076. Apply slow motion effect:
  23077. @example
  23078. setpts=2.0*PTS
  23079. @end example
  23080. @item
  23081. Set fixed rate of 25 frames per second:
  23082. @example
  23083. setpts=N/(25*TB)
  23084. @end example
  23085. @item
  23086. Set fixed rate 25 fps with some jitter:
  23087. @example
  23088. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  23089. @end example
  23090. @item
  23091. Apply an offset of 10 seconds to the input PTS:
  23092. @example
  23093. setpts=PTS+10/TB
  23094. @end example
  23095. @item
  23096. Generate timestamps from a "live source" and rebase onto the current timebase:
  23097. @example
  23098. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  23099. @end example
  23100. @item
  23101. Generate timestamps by counting samples:
  23102. @example
  23103. asetpts=N/SR/TB
  23104. @end example
  23105. @end itemize
  23106. @subsection Commands
  23107. Both filters support all above options as @ref{commands}.
  23108. @section setrange
  23109. Force color range for the output video frame.
  23110. The @code{setrange} filter marks the color range property for the
  23111. output frames. It does not change the input frame, but only sets the
  23112. corresponding property, which affects how the frame is treated by
  23113. following filters.
  23114. The filter accepts the following options:
  23115. @table @option
  23116. @item range
  23117. Available values are:
  23118. @table @samp
  23119. @item auto
  23120. Keep the same color range property.
  23121. @item unspecified, unknown
  23122. Set the color range as unspecified.
  23123. @item limited, tv, mpeg
  23124. Set the color range as limited.
  23125. @item full, pc, jpeg
  23126. Set the color range as full.
  23127. @end table
  23128. @end table
  23129. @section settb, asettb
  23130. Set the timebase to use for the output frames timestamps.
  23131. It is mainly useful for testing timebase configuration.
  23132. It accepts the following parameters:
  23133. @table @option
  23134. @item expr, tb
  23135. The expression which is evaluated into the output timebase.
  23136. @end table
  23137. The value for @option{tb} is an arithmetic expression representing a
  23138. rational. The expression can contain the constants "AVTB" (the default
  23139. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  23140. audio only). Default value is "intb".
  23141. @subsection Examples
  23142. @itemize
  23143. @item
  23144. Set the timebase to 1/25:
  23145. @example
  23146. settb=expr=1/25
  23147. @end example
  23148. @item
  23149. Set the timebase to 1/10:
  23150. @example
  23151. settb=expr=0.1
  23152. @end example
  23153. @item
  23154. Set the timebase to 1001/1000:
  23155. @example
  23156. settb=1+0.001
  23157. @end example
  23158. @item
  23159. Set the timebase to 2*intb:
  23160. @example
  23161. settb=2*intb
  23162. @end example
  23163. @item
  23164. Set the default timebase value:
  23165. @example
  23166. settb=AVTB
  23167. @end example
  23168. @end itemize
  23169. @section showcqt
  23170. Convert input audio to a video output representing frequency spectrum
  23171. logarithmically using Brown-Puckette constant Q transform algorithm with
  23172. direct frequency domain coefficient calculation (but the transform itself
  23173. is not really constant Q, instead the Q factor is actually variable/clamped),
  23174. with musical tone scale, from E0 to D#10.
  23175. The filter accepts the following options:
  23176. @table @option
  23177. @item size, s
  23178. Specify the video size for the output. It must be even. For the syntax of this option,
  23179. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23180. Default value is @code{1920x1080}.
  23181. @item fps, rate, r
  23182. Set the output frame rate. Default value is @code{25}.
  23183. @item bar_h
  23184. Set the bargraph height. It must be even. Default value is @code{-1} which
  23185. computes the bargraph height automatically.
  23186. @item axis_h
  23187. Set the axis height. It must be even. Default value is @code{-1} which computes
  23188. the axis height automatically.
  23189. @item sono_h
  23190. Set the sonogram height. It must be even. Default value is @code{-1} which
  23191. computes the sonogram height automatically.
  23192. @item fullhd
  23193. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  23194. instead. Default value is @code{1}.
  23195. @item sono_v, volume
  23196. Specify the sonogram volume expression. It can contain variables:
  23197. @table @option
  23198. @item bar_v
  23199. the @var{bar_v} evaluated expression
  23200. @item frequency, freq, f
  23201. the frequency where it is evaluated
  23202. @item timeclamp, tc
  23203. the value of @var{timeclamp} option
  23204. @end table
  23205. and functions:
  23206. @table @option
  23207. @item a_weighting(f)
  23208. A-weighting of equal loudness
  23209. @item b_weighting(f)
  23210. B-weighting of equal loudness
  23211. @item c_weighting(f)
  23212. C-weighting of equal loudness.
  23213. @end table
  23214. Default value is @code{16}.
  23215. @item bar_v, volume2
  23216. Specify the bargraph volume expression. It can contain variables:
  23217. @table @option
  23218. @item sono_v
  23219. the @var{sono_v} evaluated expression
  23220. @item frequency, freq, f
  23221. the frequency where it is evaluated
  23222. @item timeclamp, tc
  23223. the value of @var{timeclamp} option
  23224. @end table
  23225. and functions:
  23226. @table @option
  23227. @item a_weighting(f)
  23228. A-weighting of equal loudness
  23229. @item b_weighting(f)
  23230. B-weighting of equal loudness
  23231. @item c_weighting(f)
  23232. C-weighting of equal loudness.
  23233. @end table
  23234. Default value is @code{sono_v}.
  23235. @item sono_g, gamma
  23236. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  23237. higher gamma makes the spectrum having more range. Default value is @code{3}.
  23238. Acceptable range is @code{[1, 7]}.
  23239. @item bar_g, gamma2
  23240. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  23241. @code{[1, 7]}.
  23242. @item bar_t
  23243. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  23244. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  23245. @item timeclamp, tc
  23246. Specify the transform timeclamp. At low frequency, there is trade-off between
  23247. accuracy in time domain and frequency domain. If timeclamp is lower,
  23248. event in time domain is represented more accurately (such as fast bass drum),
  23249. otherwise event in frequency domain is represented more accurately
  23250. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  23251. @item attack
  23252. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  23253. limits future samples by applying asymmetric windowing in time domain, useful
  23254. when low latency is required. Accepted range is @code{[0, 1]}.
  23255. @item basefreq
  23256. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  23257. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  23258. @item endfreq
  23259. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  23260. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  23261. @item coeffclamp
  23262. This option is deprecated and ignored.
  23263. @item tlength
  23264. Specify the transform length in time domain. Use this option to control accuracy
  23265. trade-off between time domain and frequency domain at every frequency sample.
  23266. It can contain variables:
  23267. @table @option
  23268. @item frequency, freq, f
  23269. the frequency where it is evaluated
  23270. @item timeclamp, tc
  23271. the value of @var{timeclamp} option.
  23272. @end table
  23273. Default value is @code{384*tc/(384+tc*f)}.
  23274. @item count
  23275. Specify the transform count for every video frame. Default value is @code{6}.
  23276. Acceptable range is @code{[1, 30]}.
  23277. @item fcount
  23278. Specify the transform count for every single pixel. Default value is @code{0},
  23279. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  23280. @item fontfile
  23281. Specify font file for use with freetype to draw the axis. If not specified,
  23282. use embedded font. Note that drawing with font file or embedded font is not
  23283. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  23284. option instead.
  23285. @item font
  23286. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  23287. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  23288. escaping.
  23289. @item fontcolor
  23290. Specify font color expression. This is arithmetic expression that should return
  23291. integer value 0xRRGGBB. It can contain variables:
  23292. @table @option
  23293. @item frequency, freq, f
  23294. the frequency where it is evaluated
  23295. @item timeclamp, tc
  23296. the value of @var{timeclamp} option
  23297. @end table
  23298. and functions:
  23299. @table @option
  23300. @item midi(f)
  23301. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  23302. @item r(x), g(x), b(x)
  23303. red, green, and blue value of intensity x.
  23304. @end table
  23305. Default value is @code{st(0, (midi(f)-59.5)/12);
  23306. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  23307. r(1-ld(1)) + b(ld(1))}.
  23308. @item axisfile
  23309. Specify image file to draw the axis. This option override @var{fontfile} and
  23310. @var{fontcolor} option.
  23311. @item axis, text
  23312. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  23313. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  23314. Default value is @code{1}.
  23315. @item csp
  23316. Set colorspace. The accepted values are:
  23317. @table @samp
  23318. @item unspecified
  23319. Unspecified (default)
  23320. @item bt709
  23321. BT.709
  23322. @item fcc
  23323. FCC
  23324. @item bt470bg
  23325. BT.470BG or BT.601-6 625
  23326. @item smpte170m
  23327. SMPTE-170M or BT.601-6 525
  23328. @item smpte240m
  23329. SMPTE-240M
  23330. @item bt2020ncl
  23331. BT.2020 with non-constant luminance
  23332. @end table
  23333. @item cscheme
  23334. Set spectrogram color scheme. This is list of floating point values with format
  23335. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  23336. The default is @code{1|0.5|0|0|0.5|1}.
  23337. @end table
  23338. @subsection Examples
  23339. @itemize
  23340. @item
  23341. Playing audio while showing the spectrum:
  23342. @example
  23343. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  23344. @end example
  23345. @item
  23346. Same as above, but with frame rate 30 fps:
  23347. @example
  23348. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  23349. @end example
  23350. @item
  23351. Playing at 1280x720:
  23352. @example
  23353. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  23354. @end example
  23355. @item
  23356. Disable sonogram display:
  23357. @example
  23358. sono_h=0
  23359. @end example
  23360. @item
  23361. A1 and its harmonics: A1, A2, (near)E3, A3:
  23362. @example
  23363. 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),
  23364. asplit[a][out1]; [a] showcqt [out0]'
  23365. @end example
  23366. @item
  23367. Same as above, but with more accuracy in frequency domain:
  23368. @example
  23369. 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),
  23370. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  23371. @end example
  23372. @item
  23373. Custom volume:
  23374. @example
  23375. bar_v=10:sono_v=bar_v*a_weighting(f)
  23376. @end example
  23377. @item
  23378. Custom gamma, now spectrum is linear to the amplitude.
  23379. @example
  23380. bar_g=2:sono_g=2
  23381. @end example
  23382. @item
  23383. Custom tlength equation:
  23384. @example
  23385. 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)))'
  23386. @end example
  23387. @item
  23388. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  23389. @example
  23390. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  23391. @end example
  23392. @item
  23393. Custom font using fontconfig:
  23394. @example
  23395. font='Courier New,Monospace,mono|bold'
  23396. @end example
  23397. @item
  23398. Custom frequency range with custom axis using image file:
  23399. @example
  23400. axisfile=myaxis.png:basefreq=40:endfreq=10000
  23401. @end example
  23402. @end itemize
  23403. @section showcwt
  23404. Convert input audio to video output representing frequency spectrum
  23405. using Continuous Wavelet Transform and Morlet wavelet.
  23406. The filter accepts the following options:
  23407. @table @option
  23408. @item size, s
  23409. Specify the video size for the output. For the syntax of this option,
  23410. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23411. Default value is @code{640x512}.
  23412. @item rate, r
  23413. Set the output frame rate. Default value is @code{25}.
  23414. @item scale
  23415. Set the frequency scale used. Allowed values are:
  23416. @table @option
  23417. @item linear
  23418. @item log
  23419. @item bark
  23420. @item mel
  23421. @item erbs
  23422. @item sqrt
  23423. @item cbrt
  23424. @item qdrt
  23425. @item fm
  23426. @end table
  23427. Default value is @code{linear}.
  23428. @item iscale
  23429. Set the intensity scale used. Allowed values are:
  23430. @table @option
  23431. @item linear
  23432. @item log
  23433. @item sqrt
  23434. @item cbrt
  23435. @item qdrt
  23436. @end table
  23437. Default value is @code{log}.
  23438. @item min
  23439. Set the minimum frequency that will be used in output.
  23440. Default is @code{20} Hz.
  23441. @item max
  23442. Set the maximum frequency that will be used in output.
  23443. Default is @code{20000} Hz. The real frequency upper limit
  23444. depends on input audio's sample rate and such will be enforced
  23445. on this value when it is set to value greater than Nyquist frequency.
  23446. @item imin
  23447. Set the minimum intensity that will be used in output.
  23448. @item imax
  23449. Set the maximum intensity that will be used in output.
  23450. @item logb
  23451. Set the logarithmic basis for brightness strength when
  23452. mapping calculated magnitude values to pixel values.
  23453. Allowed range is from @code{0} to @code{1}.
  23454. Default value is @code{0.0001}.
  23455. @item deviation
  23456. Set the frequency deviation.
  23457. Lower values than @code{1} are more frequency oriented,
  23458. while higher values than @code{1} are more time oriented.
  23459. Allowed range is from @code{0} to @code{10}.
  23460. Default value is @code{1}.
  23461. @item pps
  23462. Set the number of pixel output per each second in one row.
  23463. Allowed range is from @code{1} to @code{1024}.
  23464. Default value is @code{64}.
  23465. @item mode
  23466. Set the output visual mode. Allowed values are:
  23467. @table @option
  23468. @item magnitude
  23469. Show magnitude.
  23470. @item phase
  23471. Show only phase.
  23472. @item magphase
  23473. Show combination of magnitude and phase.
  23474. Magnitude is mapped to brightness and phase to color.
  23475. @item channel
  23476. Show unique color per channel magnitude.
  23477. @item stereo
  23478. Show unique color per stereo difference.
  23479. @end table
  23480. Default value is @code{magnitude}.
  23481. @item slide
  23482. Set the output slide method. Allowed values are:
  23483. @table @option
  23484. @item replace
  23485. @item scroll
  23486. @item frame
  23487. @end table
  23488. @item direction
  23489. Set the direction method for output slide method. Allowed values are:
  23490. @table @option
  23491. @item lr
  23492. Direction from left to right.
  23493. @item rl
  23494. Direction from right to left.
  23495. @item ud
  23496. Direction from up to down.
  23497. @item du
  23498. Direction from down to up.
  23499. @end table
  23500. @item bar
  23501. Set the ratio of bargraph display to display size. Default is 0.
  23502. @item rotation
  23503. Set color rotation, must be in [-1.0, 1.0] range.
  23504. Default value is @code{0}.
  23505. @end table
  23506. @section showfreqs
  23507. Convert input audio to video output representing the audio power spectrum.
  23508. Audio amplitude is on Y-axis while frequency is on X-axis.
  23509. The filter accepts the following options:
  23510. @table @option
  23511. @item size, s
  23512. Specify size of video. For the syntax of this option, check the
  23513. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23514. Default is @code{1024x512}.
  23515. @item rate, r
  23516. Set video rate. Default is @code{25}.
  23517. @item mode
  23518. Set display mode.
  23519. This set how each frequency bin will be represented.
  23520. It accepts the following values:
  23521. @table @samp
  23522. @item line
  23523. @item bar
  23524. @item dot
  23525. @end table
  23526. Default is @code{bar}.
  23527. @item ascale
  23528. Set amplitude scale.
  23529. It accepts the following values:
  23530. @table @samp
  23531. @item lin
  23532. Linear scale.
  23533. @item sqrt
  23534. Square root scale.
  23535. @item cbrt
  23536. Cubic root scale.
  23537. @item log
  23538. Logarithmic scale.
  23539. @end table
  23540. Default is @code{log}.
  23541. @item fscale
  23542. Set frequency scale.
  23543. It accepts the following values:
  23544. @table @samp
  23545. @item lin
  23546. Linear scale.
  23547. @item log
  23548. Logarithmic scale.
  23549. @item rlog
  23550. Reverse logarithmic scale.
  23551. @end table
  23552. Default is @code{lin}.
  23553. @item win_size
  23554. Set window size. Allowed range is from 16 to 65536.
  23555. Default is @code{2048}
  23556. @item win_func
  23557. Set windowing function.
  23558. It accepts the following values:
  23559. @table @samp
  23560. @item rect
  23561. @item bartlett
  23562. @item hanning
  23563. @item hamming
  23564. @item blackman
  23565. @item welch
  23566. @item flattop
  23567. @item bharris
  23568. @item bnuttall
  23569. @item bhann
  23570. @item sine
  23571. @item nuttall
  23572. @item lanczos
  23573. @item gauss
  23574. @item tukey
  23575. @item dolph
  23576. @item cauchy
  23577. @item parzen
  23578. @item poisson
  23579. @item bohman
  23580. @item kaiser
  23581. @end table
  23582. Default is @code{hanning}.
  23583. @item overlap
  23584. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  23585. which means optimal overlap for selected window function will be picked.
  23586. @item averaging
  23587. Set time averaging. Setting this to 0 will display current maximal peaks.
  23588. Default is @code{1}, which means time averaging is disabled.
  23589. @item colors
  23590. Specify list of colors separated by space or by '|' which will be used to
  23591. draw channel frequencies. Unrecognized or missing colors will be replaced
  23592. by white color.
  23593. @item cmode
  23594. Set channel display mode.
  23595. It accepts the following values:
  23596. @table @samp
  23597. @item combined
  23598. @item separate
  23599. @end table
  23600. Default is @code{combined}.
  23601. @item minamp
  23602. Set minimum amplitude used in @code{log} amplitude scaler.
  23603. @item data
  23604. Set data display mode.
  23605. It accepts the following values:
  23606. @table @samp
  23607. @item magnitude
  23608. @item phase
  23609. @item delay
  23610. @end table
  23611. Default is @code{magnitude}.
  23612. @item channels
  23613. Set channels to use when processing audio. By default all are processed.
  23614. @end table
  23615. @section showspatial
  23616. Convert stereo input audio to a video output, representing the spatial relationship
  23617. between two channels.
  23618. The filter accepts the following options:
  23619. @table @option
  23620. @item size, s
  23621. Specify the video size for the output. For the syntax of this option, check the
  23622. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23623. Default value is @code{512x512}.
  23624. @item win_size
  23625. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  23626. @item win_func
  23627. Set window function.
  23628. It accepts the following values:
  23629. @table @samp
  23630. @item rect
  23631. @item bartlett
  23632. @item hann
  23633. @item hanning
  23634. @item hamming
  23635. @item blackman
  23636. @item welch
  23637. @item flattop
  23638. @item bharris
  23639. @item bnuttall
  23640. @item bhann
  23641. @item sine
  23642. @item nuttall
  23643. @item lanczos
  23644. @item gauss
  23645. @item tukey
  23646. @item dolph
  23647. @item cauchy
  23648. @item parzen
  23649. @item poisson
  23650. @item bohman
  23651. @item kaiser
  23652. @end table
  23653. Default value is @code{hann}.
  23654. @item rate, r
  23655. Set output framerate.
  23656. @end table
  23657. @anchor{showspectrum}
  23658. @section showspectrum
  23659. Convert input audio to a video output, representing the audio frequency
  23660. spectrum.
  23661. The filter accepts the following options:
  23662. @table @option
  23663. @item size, s
  23664. Specify the video size for the output. For the syntax of this option, check the
  23665. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23666. Default value is @code{640x512}.
  23667. @item slide
  23668. Specify how the spectrum should slide along the window.
  23669. It accepts the following values:
  23670. @table @samp
  23671. @item replace
  23672. the samples start again on the left when they reach the right
  23673. @item scroll
  23674. the samples scroll from right to left
  23675. @item fullframe
  23676. frames are only produced when the samples reach the right
  23677. @item rscroll
  23678. the samples scroll from left to right
  23679. @item lreplace
  23680. the samples start again on the right when they reach the left
  23681. @end table
  23682. Default value is @code{replace}.
  23683. @item mode
  23684. Specify display mode.
  23685. It accepts the following values:
  23686. @table @samp
  23687. @item combined
  23688. all channels are displayed in the same row
  23689. @item separate
  23690. all channels are displayed in separate rows
  23691. @end table
  23692. Default value is @samp{combined}.
  23693. @item color
  23694. Specify display color mode.
  23695. It accepts the following values:
  23696. @table @samp
  23697. @item channel
  23698. each channel is displayed in a separate color
  23699. @item intensity
  23700. each channel is displayed using the same color scheme
  23701. @item rainbow
  23702. each channel is displayed using the rainbow color scheme
  23703. @item moreland
  23704. each channel is displayed using the moreland color scheme
  23705. @item nebulae
  23706. each channel is displayed using the nebulae color scheme
  23707. @item fire
  23708. each channel is displayed using the fire color scheme
  23709. @item fiery
  23710. each channel is displayed using the fiery color scheme
  23711. @item fruit
  23712. each channel is displayed using the fruit color scheme
  23713. @item cool
  23714. each channel is displayed using the cool color scheme
  23715. @item magma
  23716. each channel is displayed using the magma color scheme
  23717. @item green
  23718. each channel is displayed using the green color scheme
  23719. @item viridis
  23720. each channel is displayed using the viridis color scheme
  23721. @item plasma
  23722. each channel is displayed using the plasma color scheme
  23723. @item cividis
  23724. each channel is displayed using the cividis color scheme
  23725. @item terrain
  23726. each channel is displayed using the terrain color scheme
  23727. @end table
  23728. Default value is @samp{channel}.
  23729. @item scale
  23730. Specify scale used for calculating intensity color values.
  23731. It accepts the following values:
  23732. @table @samp
  23733. @item lin
  23734. linear
  23735. @item sqrt
  23736. square root, default
  23737. @item cbrt
  23738. cubic root
  23739. @item log
  23740. logarithmic
  23741. @item 4thrt
  23742. 4th root
  23743. @item 5thrt
  23744. 5th root
  23745. @end table
  23746. Default value is @samp{sqrt}.
  23747. @item fscale
  23748. Specify frequency scale.
  23749. It accepts the following values:
  23750. @table @samp
  23751. @item lin
  23752. linear
  23753. @item log
  23754. logarithmic
  23755. @end table
  23756. Default value is @samp{lin}.
  23757. @item saturation
  23758. Set saturation modifier for displayed colors. Negative values provide
  23759. alternative color scheme. @code{0} is no saturation at all.
  23760. Saturation must be in [-10.0, 10.0] range.
  23761. Default value is @code{1}.
  23762. @item win_func
  23763. Set window function.
  23764. It accepts the following values:
  23765. @table @samp
  23766. @item rect
  23767. @item bartlett
  23768. @item hann
  23769. @item hanning
  23770. @item hamming
  23771. @item blackman
  23772. @item welch
  23773. @item flattop
  23774. @item bharris
  23775. @item bnuttall
  23776. @item bhann
  23777. @item sine
  23778. @item nuttall
  23779. @item lanczos
  23780. @item gauss
  23781. @item tukey
  23782. @item dolph
  23783. @item cauchy
  23784. @item parzen
  23785. @item poisson
  23786. @item bohman
  23787. @item kaiser
  23788. @end table
  23789. Default value is @code{hann}.
  23790. @item orientation
  23791. Set orientation of time vs frequency axis. Can be @code{vertical} or
  23792. @code{horizontal}. Default is @code{vertical}.
  23793. @item overlap
  23794. Set ratio of overlap window. Default value is @code{0}.
  23795. When value is @code{1} overlap is set to recommended size for specific
  23796. window function currently used.
  23797. @item gain
  23798. Set scale gain for calculating intensity color values.
  23799. Default value is @code{1}.
  23800. @item data
  23801. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  23802. or unwrapped phase: @code{uphase}.
  23803. @item rotation
  23804. Set color rotation, must be in [-1.0, 1.0] range.
  23805. Default value is @code{0}.
  23806. @item start
  23807. Set start frequency from which to display spectrogram. Default is @code{0}.
  23808. @item stop
  23809. Set stop frequency to which to display spectrogram. Default is @code{0}.
  23810. @item fps
  23811. Set upper frame rate limit. Default is @code{auto}, unlimited.
  23812. @item legend
  23813. Draw time and frequency axes and legends. Default is disabled.
  23814. @item drange
  23815. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  23816. Allowed range is from 10 to 200.
  23817. @item limit
  23818. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  23819. Allowed range is from -100 to 100.
  23820. @item opacity
  23821. Set opacity strength when using pixel format output with alpha component.
  23822. @end table
  23823. The usage is very similar to the showwaves filter; see the examples in that
  23824. section.
  23825. @subsection Examples
  23826. @itemize
  23827. @item
  23828. Large window with logarithmic color scaling:
  23829. @example
  23830. showspectrum=s=1280x480:scale=log
  23831. @end example
  23832. @item
  23833. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  23834. @example
  23835. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  23836. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  23837. @end example
  23838. @end itemize
  23839. @section showspectrumpic
  23840. Convert input audio to a single video frame, representing the audio frequency
  23841. spectrum.
  23842. The filter accepts the following options:
  23843. @table @option
  23844. @item size, s
  23845. Specify the video size for the output. For the syntax of this option, check the
  23846. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23847. Default value is @code{4096x2048}.
  23848. @item mode
  23849. Specify display mode.
  23850. It accepts the following values:
  23851. @table @samp
  23852. @item combined
  23853. all channels are displayed in the same row
  23854. @item separate
  23855. all channels are displayed in separate rows
  23856. @end table
  23857. Default value is @samp{combined}.
  23858. @item color
  23859. Specify display color mode.
  23860. It accepts the following values:
  23861. @table @samp
  23862. @item channel
  23863. each channel is displayed in a separate color
  23864. @item intensity
  23865. each channel is displayed using the same color scheme
  23866. @item rainbow
  23867. each channel is displayed using the rainbow color scheme
  23868. @item moreland
  23869. each channel is displayed using the moreland color scheme
  23870. @item nebulae
  23871. each channel is displayed using the nebulae color scheme
  23872. @item fire
  23873. each channel is displayed using the fire color scheme
  23874. @item fiery
  23875. each channel is displayed using the fiery color scheme
  23876. @item fruit
  23877. each channel is displayed using the fruit color scheme
  23878. @item cool
  23879. each channel is displayed using the cool color scheme
  23880. @item magma
  23881. each channel is displayed using the magma color scheme
  23882. @item green
  23883. each channel is displayed using the green color scheme
  23884. @item viridis
  23885. each channel is displayed using the viridis color scheme
  23886. @item plasma
  23887. each channel is displayed using the plasma color scheme
  23888. @item cividis
  23889. each channel is displayed using the cividis color scheme
  23890. @item terrain
  23891. each channel is displayed using the terrain color scheme
  23892. @end table
  23893. Default value is @samp{intensity}.
  23894. @item scale
  23895. Specify scale used for calculating intensity color values.
  23896. It accepts the following values:
  23897. @table @samp
  23898. @item lin
  23899. linear
  23900. @item sqrt
  23901. square root, default
  23902. @item cbrt
  23903. cubic root
  23904. @item log
  23905. logarithmic
  23906. @item 4thrt
  23907. 4th root
  23908. @item 5thrt
  23909. 5th root
  23910. @end table
  23911. Default value is @samp{log}.
  23912. @item fscale
  23913. Specify frequency scale.
  23914. It accepts the following values:
  23915. @table @samp
  23916. @item lin
  23917. linear
  23918. @item log
  23919. logarithmic
  23920. @end table
  23921. Default value is @samp{lin}.
  23922. @item saturation
  23923. Set saturation modifier for displayed colors. Negative values provide
  23924. alternative color scheme. @code{0} is no saturation at all.
  23925. Saturation must be in [-10.0, 10.0] range.
  23926. Default value is @code{1}.
  23927. @item win_func
  23928. Set window function.
  23929. It accepts the following values:
  23930. @table @samp
  23931. @item rect
  23932. @item bartlett
  23933. @item hann
  23934. @item hanning
  23935. @item hamming
  23936. @item blackman
  23937. @item welch
  23938. @item flattop
  23939. @item bharris
  23940. @item bnuttall
  23941. @item bhann
  23942. @item sine
  23943. @item nuttall
  23944. @item lanczos
  23945. @item gauss
  23946. @item tukey
  23947. @item dolph
  23948. @item cauchy
  23949. @item parzen
  23950. @item poisson
  23951. @item bohman
  23952. @item kaiser
  23953. @end table
  23954. Default value is @code{hann}.
  23955. @item orientation
  23956. Set orientation of time vs frequency axis. Can be @code{vertical} or
  23957. @code{horizontal}. Default is @code{vertical}.
  23958. @item gain
  23959. Set scale gain for calculating intensity color values.
  23960. Default value is @code{1}.
  23961. @item legend
  23962. Draw time and frequency axes and legends. Default is enabled.
  23963. @item rotation
  23964. Set color rotation, must be in [-1.0, 1.0] range.
  23965. Default value is @code{0}.
  23966. @item start
  23967. Set start frequency from which to display spectrogram. Default is @code{0}.
  23968. @item stop
  23969. Set stop frequency to which to display spectrogram. Default is @code{0}.
  23970. @item drange
  23971. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  23972. Allowed range is from 10 to 200.
  23973. @item limit
  23974. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  23975. Allowed range is from -100 to 100.
  23976. @item opacity
  23977. Set opacity strength when using pixel format output with alpha component.
  23978. @end table
  23979. @subsection Examples
  23980. @itemize
  23981. @item
  23982. Extract an audio spectrogram of a whole audio track
  23983. in a 1024x1024 picture using @command{ffmpeg}:
  23984. @example
  23985. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  23986. @end example
  23987. @end itemize
  23988. @section showvolume
  23989. Convert input audio volume to a video output.
  23990. The filter accepts the following options:
  23991. @table @option
  23992. @item rate, r
  23993. Set video rate.
  23994. @item b
  23995. Set border width, allowed range is [0, 5]. Default is 1.
  23996. @item w
  23997. Set channel width, allowed range is [80, 8192]. Default is 400.
  23998. @item h
  23999. Set channel height, allowed range is [1, 900]. Default is 20.
  24000. @item f
  24001. Set fade, allowed range is [0, 1]. Default is 0.95.
  24002. @item c
  24003. Set volume color expression.
  24004. The expression can use the following variables:
  24005. @table @option
  24006. @item VOLUME
  24007. Current max volume of channel in dB.
  24008. @item PEAK
  24009. Current peak.
  24010. @item CHANNEL
  24011. Current channel number, starting from 0.
  24012. @end table
  24013. @item t
  24014. If set, displays channel names. Default is enabled.
  24015. @item v
  24016. If set, displays volume values. Default is enabled.
  24017. @item o
  24018. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  24019. default is @code{h}.
  24020. @item s
  24021. Set step size, allowed range is [0, 5]. Default is 0, which means
  24022. step is disabled.
  24023. @item p
  24024. Set background opacity, allowed range is [0, 1]. Default is 0.
  24025. @item m
  24026. Set metering mode, can be peak: @code{p} or rms: @code{r},
  24027. default is @code{p}.
  24028. @item ds
  24029. Set display scale, can be linear: @code{lin} or log: @code{log},
  24030. default is @code{lin}.
  24031. @item dm
  24032. In second.
  24033. If set to > 0., display a line for the max level
  24034. in the previous seconds.
  24035. default is disabled: @code{0.}
  24036. @item dmc
  24037. The color of the max line. Use when @code{dm} option is set to > 0.
  24038. default is: @code{orange}
  24039. @end table
  24040. @section showwaves
  24041. Convert input audio to a video output, representing the samples waves.
  24042. The filter accepts the following options:
  24043. @table @option
  24044. @item size, s
  24045. Specify the video size for the output. For the syntax of this option, check the
  24046. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24047. Default value is @code{600x240}.
  24048. @item mode
  24049. Set display mode.
  24050. Available values are:
  24051. @table @samp
  24052. @item point
  24053. Draw a point for each sample.
  24054. @item line
  24055. Draw a vertical line for each sample.
  24056. @item p2p
  24057. Draw a point for each sample and a line between them.
  24058. @item cline
  24059. Draw a centered vertical line for each sample.
  24060. @end table
  24061. Default value is @code{point}.
  24062. @item n
  24063. Set the number of samples which are printed on the same column. A
  24064. larger value will decrease the frame rate. Must be a positive
  24065. integer. This option can be set only if the value for @var{rate}
  24066. is not explicitly specified.
  24067. @item rate, r
  24068. Set the (approximate) output frame rate. This is done by setting the
  24069. option @var{n}. Default value is "25".
  24070. @item split_channels
  24071. Set if channels should be drawn separately or overlap. Default value is 0.
  24072. @item colors
  24073. Set colors separated by '|' which are going to be used for drawing of each channel.
  24074. @item scale
  24075. Set amplitude scale.
  24076. Available values are:
  24077. @table @samp
  24078. @item lin
  24079. Linear.
  24080. @item log
  24081. Logarithmic.
  24082. @item sqrt
  24083. Square root.
  24084. @item cbrt
  24085. Cubic root.
  24086. @end table
  24087. Default is linear.
  24088. @item draw
  24089. Set the draw mode. This is mostly useful to set for high @var{n}.
  24090. Available values are:
  24091. @table @samp
  24092. @item scale
  24093. Scale pixel values for each drawn sample.
  24094. @item full
  24095. Draw every sample directly.
  24096. @end table
  24097. Default value is @code{scale}.
  24098. @end table
  24099. @subsection Examples
  24100. @itemize
  24101. @item
  24102. Output the input file audio and the corresponding video representation
  24103. at the same time:
  24104. @example
  24105. amovie=a.mp3,asplit[out0],showwaves[out1]
  24106. @end example
  24107. @item
  24108. Create a synthetic signal and show it with showwaves, forcing a
  24109. frame rate of 30 frames per second:
  24110. @example
  24111. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  24112. @end example
  24113. @end itemize
  24114. @section showwavespic
  24115. Convert input audio to a single video frame, representing the samples waves.
  24116. The filter accepts the following options:
  24117. @table @option
  24118. @item size, s
  24119. Specify the video size for the output. For the syntax of this option, check the
  24120. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24121. Default value is @code{600x240}.
  24122. @item split_channels
  24123. Set if channels should be drawn separately or overlap. Default value is 0.
  24124. @item colors
  24125. Set colors separated by '|' which are going to be used for drawing of each channel.
  24126. @item scale
  24127. Set amplitude scale.
  24128. Available values are:
  24129. @table @samp
  24130. @item lin
  24131. Linear.
  24132. @item log
  24133. Logarithmic.
  24134. @item sqrt
  24135. Square root.
  24136. @item cbrt
  24137. Cubic root.
  24138. @end table
  24139. Default is linear.
  24140. @item draw
  24141. Set the draw mode.
  24142. Available values are:
  24143. @table @samp
  24144. @item scale
  24145. Scale pixel values for each drawn sample.
  24146. @item full
  24147. Draw every sample directly.
  24148. @end table
  24149. Default value is @code{scale}.
  24150. @item filter
  24151. Set the filter mode.
  24152. Available values are:
  24153. @table @samp
  24154. @item average
  24155. Use average samples values for each drawn sample.
  24156. @item peak
  24157. Use peak samples values for each drawn sample.
  24158. @end table
  24159. Default value is @code{average}.
  24160. @end table
  24161. @subsection Examples
  24162. @itemize
  24163. @item
  24164. Extract a channel split representation of the wave form of a whole audio track
  24165. in a 1024x800 picture using @command{ffmpeg}:
  24166. @example
  24167. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  24168. @end example
  24169. @end itemize
  24170. @section sidedata, asidedata
  24171. Delete frame side data, or select frames based on it.
  24172. This filter accepts the following options:
  24173. @table @option
  24174. @item mode
  24175. Set mode of operation of the filter.
  24176. Can be one of the following:
  24177. @table @samp
  24178. @item select
  24179. Select every frame with side data of @code{type}.
  24180. @item delete
  24181. Delete side data of @code{type}. If @code{type} is not set, delete all side
  24182. data in the frame.
  24183. @end table
  24184. @item type
  24185. Set side data type used with all modes. Must be set for @code{select} mode. For
  24186. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  24187. in @file{libavutil/frame.h}. For example, to choose
  24188. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  24189. @end table
  24190. @section spectrumsynth
  24191. Synthesize audio from 2 input video spectrums, first input stream represents
  24192. magnitude across time and second represents phase across time.
  24193. The filter will transform from frequency domain as displayed in videos back
  24194. to time domain as presented in audio output.
  24195. This filter is primarily created for reversing processed @ref{showspectrum}
  24196. filter outputs, but can synthesize sound from other spectrograms too.
  24197. But in such case results are going to be poor if the phase data is not
  24198. available, because in such cases phase data need to be recreated, usually
  24199. it's just recreated from random noise.
  24200. For best results use gray only output (@code{channel} color mode in
  24201. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  24202. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  24203. @code{data} option. Inputs videos should generally use @code{fullframe}
  24204. slide mode as that saves resources needed for decoding video.
  24205. The filter accepts the following options:
  24206. @table @option
  24207. @item sample_rate
  24208. Specify sample rate of output audio, the sample rate of audio from which
  24209. spectrum was generated may differ.
  24210. @item channels
  24211. Set number of channels represented in input video spectrums.
  24212. @item scale
  24213. Set scale which was used when generating magnitude input spectrum.
  24214. Can be @code{lin} or @code{log}. Default is @code{log}.
  24215. @item slide
  24216. Set slide which was used when generating inputs spectrums.
  24217. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  24218. Default is @code{fullframe}.
  24219. @item win_func
  24220. Set window function used for resynthesis.
  24221. @item overlap
  24222. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  24223. which means optimal overlap for selected window function will be picked.
  24224. @item orientation
  24225. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  24226. Default is @code{vertical}.
  24227. @end table
  24228. @subsection Examples
  24229. @itemize
  24230. @item
  24231. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  24232. then resynthesize videos back to audio with spectrumsynth:
  24233. @example
  24234. 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
  24235. 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
  24236. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  24237. @end example
  24238. @end itemize
  24239. @section split, asplit
  24240. Split input into several identical outputs.
  24241. @code{asplit} works with audio input, @code{split} with video.
  24242. The filter accepts a single parameter which specifies the number of outputs. If
  24243. unspecified, it defaults to 2.
  24244. @subsection Examples
  24245. @itemize
  24246. @item
  24247. Create two separate outputs from the same input:
  24248. @example
  24249. [in] split [out0][out1]
  24250. @end example
  24251. @item
  24252. To create 3 or more outputs, you need to specify the number of
  24253. outputs, like in:
  24254. @example
  24255. [in] asplit=3 [out0][out1][out2]
  24256. @end example
  24257. @item
  24258. Create two separate outputs from the same input, one cropped and
  24259. one padded:
  24260. @example
  24261. [in] split [splitout1][splitout2];
  24262. [splitout1] crop=100:100:0:0 [cropout];
  24263. [splitout2] pad=200:200:100:100 [padout];
  24264. @end example
  24265. @item
  24266. Create 5 copies of the input audio with @command{ffmpeg}:
  24267. @example
  24268. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  24269. @end example
  24270. @end itemize
  24271. @section zmq, azmq
  24272. Receive commands sent through a libzmq client, and forward them to
  24273. filters in the filtergraph.
  24274. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  24275. must be inserted between two video filters, @code{azmq} between two
  24276. audio filters. Both are capable to send messages to any filter type.
  24277. To enable these filters you need to install the libzmq library and
  24278. headers and configure FFmpeg with @code{--enable-libzmq}.
  24279. For more information about libzmq see:
  24280. @url{http://www.zeromq.org/}
  24281. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  24282. receives messages sent through a network interface defined by the
  24283. @option{bind_address} (or the abbreviation "@option{b}") option.
  24284. Default value of this option is @file{tcp://localhost:5555}. You may
  24285. want to alter this value to your needs, but do not forget to escape any
  24286. ':' signs (see @ref{filtergraph escaping}).
  24287. The received message must be in the form:
  24288. @example
  24289. @var{TARGET} @var{COMMAND} [@var{ARG}]
  24290. @end example
  24291. @var{TARGET} specifies the target of the command, usually the name of
  24292. the filter class or a specific filter instance name. The default
  24293. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  24294. but you can override this by using the @samp{filter_name@@id} syntax
  24295. (see @ref{Filtergraph syntax}).
  24296. @var{COMMAND} specifies the name of the command for the target filter.
  24297. @var{ARG} is optional and specifies the optional argument list for the
  24298. given @var{COMMAND}.
  24299. Upon reception, the message is processed and the corresponding command
  24300. is injected into the filtergraph. Depending on the result, the filter
  24301. will send a reply to the client, adopting the format:
  24302. @example
  24303. @var{ERROR_CODE} @var{ERROR_REASON}
  24304. @var{MESSAGE}
  24305. @end example
  24306. @var{MESSAGE} is optional.
  24307. @subsection Examples
  24308. Look at @file{tools/zmqsend} for an example of a zmq client which can
  24309. be used to send commands processed by these filters.
  24310. Consider the following filtergraph generated by @command{ffplay}.
  24311. In this example the last overlay filter has an instance name. All other
  24312. filters will have default instance names.
  24313. @example
  24314. ffplay -dumpgraph 1 -f lavfi "
  24315. color=s=100x100:c=red [l];
  24316. color=s=100x100:c=blue [r];
  24317. nullsrc=s=200x100, zmq [bg];
  24318. [bg][l] overlay [bg+l];
  24319. [bg+l][r] overlay@@my=x=100 "
  24320. @end example
  24321. To change the color of the left side of the video, the following
  24322. command can be used:
  24323. @example
  24324. echo Parsed_color_0 c yellow | tools/zmqsend
  24325. @end example
  24326. To change the right side:
  24327. @example
  24328. echo Parsed_color_1 c pink | tools/zmqsend
  24329. @end example
  24330. To change the position of the right side:
  24331. @example
  24332. echo overlay@@my x 150 | tools/zmqsend
  24333. @end example
  24334. @c man end MULTIMEDIA FILTERS
  24335. @chapter Multimedia Sources
  24336. @c man begin MULTIMEDIA SOURCES
  24337. Below is a description of the currently available multimedia sources.
  24338. @section amovie
  24339. This is the same as @ref{movie} source, except it selects an audio
  24340. stream by default.
  24341. @section avsynctest
  24342. Generate an Audio/Video Sync Test.
  24343. Generated stream periodically shows flash video frame and emits beep in audio.
  24344. Useful to inspect A/V sync issues.
  24345. It accepts the following options:
  24346. @table @option
  24347. @item size, s
  24348. Set output video size. Default value is @code{hd720}.
  24349. @item framerate, fr
  24350. Set output video frame rate. Default value is @code{30}.
  24351. @item samplerate, sr
  24352. Set output audio sample rate. Default value is @code{44100}.
  24353. @item amplitude, a
  24354. Set output audio beep amplitude. Default value is @code{0.7}.
  24355. @item period, p
  24356. Set output audio beep period in seconds. Default value is @code{3}.
  24357. @item delay, dl
  24358. Set output video flash delay in number of frames. Default value is @code{0}.
  24359. @item cycle, c
  24360. Enable cycling of video delays, by default is disabled.
  24361. @item duration, d
  24362. Set stream output duration. By default duration is unlimited.
  24363. @item fg, bg, ag
  24364. Set foreground/background/additional color.
  24365. @end table
  24366. @subsection Commands
  24367. This source supports the some above options as @ref{commands}.
  24368. @anchor{movie}
  24369. @section movie
  24370. Read audio and/or video stream(s) from a movie container.
  24371. It accepts the following parameters:
  24372. @table @option
  24373. @item filename
  24374. The name of the resource to read (not necessarily a file; it can also be a
  24375. device or a stream accessed through some protocol).
  24376. @item format_name, f
  24377. Specifies the format assumed for the movie to read, and can be either
  24378. the name of a container or an input device. If not specified, the
  24379. format is guessed from @var{movie_name} or by probing.
  24380. @item seek_point, sp
  24381. Specifies the seek point in seconds. The frames will be output
  24382. starting from this seek point. The parameter is evaluated with
  24383. @code{av_strtod}, so the numerical value may be suffixed by an IS
  24384. postfix. The default value is "0".
  24385. @item streams, s
  24386. Specifies the streams to read. Several streams can be specified,
  24387. separated by "+". The source will then have as many outputs, in the
  24388. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  24389. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  24390. respectively the default (best suited) video and audio stream. Default
  24391. is "dv", or "da" if the filter is called as "amovie".
  24392. @item stream_index, si
  24393. Specifies the index of the video stream to read. If the value is -1,
  24394. the most suitable video stream will be automatically selected. The default
  24395. value is "-1". Deprecated. If the filter is called "amovie", it will select
  24396. audio instead of video.
  24397. @item loop
  24398. Specifies how many times to read the stream in sequence.
  24399. If the value is 0, the stream will be looped infinitely.
  24400. Default value is "1".
  24401. Note that when the movie is looped the source timestamps are not
  24402. changed, so it will generate non monotonically increasing timestamps.
  24403. @item discontinuity
  24404. Specifies the time difference between frames above which the point is
  24405. considered a timestamp discontinuity which is removed by adjusting the later
  24406. timestamps.
  24407. @item dec_threads
  24408. Specifies the number of threads for decoding
  24409. @item format_opts
  24410. Specify format options for the opened file. Format options can be specified
  24411. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  24412. shows how to add protocol_whitelist and protocol_blacklist options:
  24413. @example
  24414. ffplay -f lavfi
  24415. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  24416. @end example
  24417. @end table
  24418. It allows overlaying a second video on top of the main input of
  24419. a filtergraph, as shown in this graph:
  24420. @example
  24421. input -----------> deltapts0 --> overlay --> output
  24422. ^
  24423. |
  24424. movie --> scale--> deltapts1 -------+
  24425. @end example
  24426. @subsection Examples
  24427. @itemize
  24428. @item
  24429. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  24430. on top of the input labelled "in":
  24431. @example
  24432. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  24433. [in] setpts=PTS-STARTPTS [main];
  24434. [main][over] overlay=16:16 [out]
  24435. @end example
  24436. @item
  24437. Read from a video4linux2 device, and overlay it on top of the input
  24438. labelled "in":
  24439. @example
  24440. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  24441. [in] setpts=PTS-STARTPTS [main];
  24442. [main][over] overlay=16:16 [out]
  24443. @end example
  24444. @item
  24445. Read the first video stream and the audio stream with id 0x81 from
  24446. dvd.vob; the video is connected to the pad named "video" and the audio is
  24447. connected to the pad named "audio":
  24448. @example
  24449. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  24450. @end example
  24451. @end itemize
  24452. @subsection Commands
  24453. Both movie and amovie support the following commands:
  24454. @table @option
  24455. @item seek
  24456. Perform seek using "av_seek_frame".
  24457. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  24458. @itemize
  24459. @item
  24460. @var{stream_index}: If stream_index is -1, a default
  24461. stream is selected, and @var{timestamp} is automatically converted
  24462. from AV_TIME_BASE units to the stream specific time_base.
  24463. @item
  24464. @var{timestamp}: Timestamp in AVStream.time_base units
  24465. or, if no stream is specified, in AV_TIME_BASE units.
  24466. @item
  24467. @var{flags}: Flags which select direction and seeking mode.
  24468. @end itemize
  24469. @item get_duration
  24470. Get movie duration in AV_TIME_BASE units.
  24471. @end table
  24472. @c man end MULTIMEDIA SOURCES