filters.texi 859 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177
  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 cut
  816. Cut frequencies above detection threshold.
  817. @item boost
  818. Boost frequencies bellow detection threshold.
  819. @end table
  820. Default mode is @samp{cut}.
  821. @item dftype
  822. Set the type of detection filter, can be one of the following:
  823. @table @samp
  824. @item bandpass
  825. @item lowpass
  826. @item highpass
  827. @item peak
  828. @end table
  829. Default type is @samp{bandpass}.
  830. @item tftype
  831. Set the type of target filter, can be one of the following:
  832. @table @samp
  833. @item bell
  834. @item lowshelf
  835. @item highshelf
  836. @end table
  837. Default type is @samp{bell}.
  838. @item direction
  839. Set processing direction relative to threshold.
  840. @table @samp
  841. @item downward
  842. Boost/Cut if threshold is higher/lower than detected volume.
  843. @item upward
  844. Boost/Cut if threshold is lower/higher than detected volume.
  845. @end table
  846. Default direction is @samp{downward}.
  847. @item auto
  848. Automatically gather threshold from detection filter. By default
  849. is @samp{disabled}.
  850. This option is useful to detect threshold in certain time frame of
  851. input audio stream, in such case option value is changed at runtime.
  852. Available values are:
  853. @table @samp
  854. @item disabled
  855. Disable using automatically gathered threshold value.
  856. @item off
  857. Stop picking threshold value.
  858. @item on
  859. Start picking threshold value.
  860. @end table
  861. @item precision
  862. Set which precision to use when processing samples.
  863. @table @option
  864. @item auto
  865. Auto pick internal sample format depending on other filters.
  866. @item float
  867. Always use single-floating point precision sample format.
  868. @item double
  869. Always use double-floating point precision sample format.
  870. @end table
  871. @end table
  872. @subsection Commands
  873. This filter supports the all above options as @ref{commands}.
  874. @section adynamicsmooth
  875. Apply dynamic smoothing to input audio stream.
  876. A description of the accepted options follows.
  877. @table @option
  878. @item sensitivity
  879. Set an amount of sensitivity to frequency fluctations. Default is 2.
  880. Allowed range is from 0 to 1e+06.
  881. @item basefreq
  882. Set a base frequency for smoothing. Default value is 22050.
  883. Allowed range is from 2 to 1e+06.
  884. @end table
  885. @subsection Commands
  886. This filter supports the all above options as @ref{commands}.
  887. @section aecho
  888. Apply echoing to the input audio.
  889. Echoes are reflected sound and can occur naturally amongst mountains
  890. (and sometimes large buildings) when talking or shouting; digital echo
  891. effects emulate this behaviour and are often used to help fill out the
  892. sound of a single instrument or vocal. The time difference between the
  893. original signal and the reflection is the @code{delay}, and the
  894. loudness of the reflected signal is the @code{decay}.
  895. Multiple echoes can have different delays and decays.
  896. A description of the accepted parameters follows.
  897. @table @option
  898. @item in_gain
  899. Set input gain of reflected signal. Default is @code{0.6}.
  900. @item out_gain
  901. Set output gain of reflected signal. Default is @code{0.3}.
  902. @item delays
  903. Set list of time intervals in milliseconds between original signal and reflections
  904. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  905. Default is @code{1000}.
  906. @item decays
  907. Set list of loudness of reflected signals separated by '|'.
  908. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  909. Default is @code{0.5}.
  910. @end table
  911. @subsection Examples
  912. @itemize
  913. @item
  914. Make it sound as if there are twice as many instruments as are actually playing:
  915. @example
  916. aecho=0.8:0.88:60:0.4
  917. @end example
  918. @item
  919. If delay is very short, then it sounds like a (metallic) robot playing music:
  920. @example
  921. aecho=0.8:0.88:6:0.4
  922. @end example
  923. @item
  924. A longer delay will sound like an open air concert in the mountains:
  925. @example
  926. aecho=0.8:0.9:1000:0.3
  927. @end example
  928. @item
  929. Same as above but with one more mountain:
  930. @example
  931. aecho=0.8:0.9:1000|1800:0.3|0.25
  932. @end example
  933. @end itemize
  934. @section aemphasis
  935. Audio emphasis filter creates or restores material directly taken from LPs or
  936. emphased CDs with different filter curves. E.g. to store music on vinyl the
  937. signal has to be altered by a filter first to even out the disadvantages of
  938. this recording medium.
  939. Once the material is played back the inverse filter has to be applied to
  940. restore the distortion of the frequency response.
  941. The filter accepts the following options:
  942. @table @option
  943. @item level_in
  944. Set input gain.
  945. @item level_out
  946. Set output gain.
  947. @item mode
  948. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  949. use @code{production} mode. Default is @code{reproduction} mode.
  950. @item type
  951. Set filter type. Selects medium. Can be one of the following:
  952. @table @option
  953. @item col
  954. select Columbia.
  955. @item emi
  956. select EMI.
  957. @item bsi
  958. select BSI (78RPM).
  959. @item riaa
  960. select RIAA.
  961. @item cd
  962. select Compact Disc (CD).
  963. @item 50fm
  964. select 50µs (FM).
  965. @item 75fm
  966. select 75µs (FM).
  967. @item 50kf
  968. select 50µs (FM-KF).
  969. @item 75kf
  970. select 75µs (FM-KF).
  971. @end table
  972. @end table
  973. @subsection Commands
  974. This filter supports the all above options as @ref{commands}.
  975. @section aeval
  976. Modify an audio signal according to the specified expressions.
  977. This filter accepts one or more expressions (one for each channel),
  978. which are evaluated and used to modify a corresponding audio signal.
  979. It accepts the following parameters:
  980. @table @option
  981. @item exprs
  982. Set the '|'-separated expressions list for each separate channel. If
  983. the number of input channels is greater than the number of
  984. expressions, the last specified expression is used for the remaining
  985. output channels.
  986. @item channel_layout, c
  987. Set output channel layout. If not specified, the channel layout is
  988. specified by the number of expressions. If set to @samp{same}, it will
  989. use by default the same input channel layout.
  990. @end table
  991. Each expression in @var{exprs} can contain the following constants and functions:
  992. @table @option
  993. @item ch
  994. channel number of the current expression
  995. @item n
  996. number of the evaluated sample, starting from 0
  997. @item s
  998. sample rate
  999. @item t
  1000. time of the evaluated sample expressed in seconds
  1001. @item nb_in_channels
  1002. @item nb_out_channels
  1003. input and output number of channels
  1004. @item val(CH)
  1005. the value of input channel with number @var{CH}
  1006. @end table
  1007. Note: this filter is slow. For faster processing you should use a
  1008. dedicated filter.
  1009. @subsection Examples
  1010. @itemize
  1011. @item
  1012. Half volume:
  1013. @example
  1014. aeval=val(ch)/2:c=same
  1015. @end example
  1016. @item
  1017. Invert phase of the second channel:
  1018. @example
  1019. aeval=val(0)|-val(1)
  1020. @end example
  1021. @end itemize
  1022. @section aexciter
  1023. An exciter is used to produce high sound that is not present in the
  1024. original signal. This is done by creating harmonic distortions of the
  1025. signal which are restricted in range and added to the original signal.
  1026. An Exciter raises the upper end of an audio signal without simply raising
  1027. the higher frequencies like an equalizer would do to create a more
  1028. "crisp" or "brilliant" sound.
  1029. The filter accepts the following options:
  1030. @table @option
  1031. @item level_in
  1032. Set input level prior processing of signal.
  1033. Allowed range is from 0 to 64.
  1034. Default value is 1.
  1035. @item level_out
  1036. Set output level after processing of signal.
  1037. Allowed range is from 0 to 64.
  1038. Default value is 1.
  1039. @item amount
  1040. Set the amount of harmonics added to original signal.
  1041. Allowed range is from 0 to 64.
  1042. Default value is 1.
  1043. @item drive
  1044. Set the amount of newly created harmonics.
  1045. Allowed range is from 0.1 to 10.
  1046. Default value is 8.5.
  1047. @item blend
  1048. Set the octave of newly created harmonics.
  1049. Allowed range is from -10 to 10.
  1050. Default value is 0.
  1051. @item freq
  1052. Set the lower frequency limit of producing harmonics in Hz.
  1053. Allowed range is from 2000 to 12000 Hz.
  1054. Default is 7500 Hz.
  1055. @item ceil
  1056. Set the upper frequency limit of producing harmonics.
  1057. Allowed range is from 9999 to 20000 Hz.
  1058. If value is lower than 10000 Hz no limit is applied.
  1059. @item listen
  1060. Mute the original signal and output only added harmonics.
  1061. By default is disabled.
  1062. @end table
  1063. @subsection Commands
  1064. This filter supports the all above options as @ref{commands}.
  1065. @anchor{afade}
  1066. @section afade
  1067. Apply fade-in/out effect to input audio.
  1068. A description of the accepted parameters follows.
  1069. @table @option
  1070. @item type, t
  1071. Specify the effect type, can be either @code{in} for fade-in, or
  1072. @code{out} for a fade-out effect. Default is @code{in}.
  1073. @item start_sample, ss
  1074. Specify the number of the start sample for starting to apply the fade
  1075. effect. Default is 0.
  1076. @item nb_samples, ns
  1077. Specify the number of samples for which the fade effect has to last. At
  1078. the end of the fade-in effect the output audio will have the same
  1079. volume as the input audio, at the end of the fade-out transition
  1080. the output audio will be silence. Default is 44100.
  1081. @item start_time, st
  1082. Specify the start time of the fade effect. Default is 0.
  1083. The value must be specified as a time duration; see
  1084. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1085. for the accepted syntax.
  1086. If set this option is used instead of @var{start_sample}.
  1087. @item duration, d
  1088. Specify the duration of the fade effect. See
  1089. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1090. for the accepted syntax.
  1091. At the end of the fade-in effect the output audio will have the same
  1092. volume as the input audio, at the end of the fade-out transition
  1093. the output audio will be silence.
  1094. By default the duration is determined by @var{nb_samples}.
  1095. If set this option is used instead of @var{nb_samples}.
  1096. @item curve
  1097. Set curve for fade transition.
  1098. It accepts the following values:
  1099. @table @option
  1100. @item tri
  1101. select triangular, linear slope (default)
  1102. @item qsin
  1103. select quarter of sine wave
  1104. @item hsin
  1105. select half of sine wave
  1106. @item esin
  1107. select exponential sine wave
  1108. @item log
  1109. select logarithmic
  1110. @item ipar
  1111. select inverted parabola
  1112. @item qua
  1113. select quadratic
  1114. @item cub
  1115. select cubic
  1116. @item squ
  1117. select square root
  1118. @item cbr
  1119. select cubic root
  1120. @item par
  1121. select parabola
  1122. @item exp
  1123. select exponential
  1124. @item iqsin
  1125. select inverted quarter of sine wave
  1126. @item ihsin
  1127. select inverted half of sine wave
  1128. @item dese
  1129. select double-exponential seat
  1130. @item desi
  1131. select double-exponential sigmoid
  1132. @item losi
  1133. select logistic sigmoid
  1134. @item sinc
  1135. select sine cardinal function
  1136. @item isinc
  1137. select inverted sine cardinal function
  1138. @item quat
  1139. select quartic
  1140. @item quatr
  1141. select quartic root
  1142. @item qsin2
  1143. select squared quarter of sine wave
  1144. @item hsin2
  1145. select squared half of sine wave
  1146. @item nofade
  1147. no fade applied
  1148. @end table
  1149. @item silence
  1150. Set the initial gain for fade-in or final gain for fade-out.
  1151. Default value is @code{0.0}.
  1152. @item unity
  1153. Set the initial gain for fade-out or final gain for fade-in.
  1154. Default value is @code{1.0}.
  1155. @end table
  1156. @subsection Commands
  1157. This filter supports the all above options as @ref{commands}.
  1158. @subsection Examples
  1159. @itemize
  1160. @item
  1161. Fade in first 15 seconds of audio:
  1162. @example
  1163. afade=t=in:ss=0:d=15
  1164. @end example
  1165. @item
  1166. Fade out last 25 seconds of a 900 seconds audio:
  1167. @example
  1168. afade=t=out:st=875:d=25
  1169. @end example
  1170. @end itemize
  1171. @section afftdn
  1172. Denoise audio samples with FFT.
  1173. A description of the accepted parameters follows.
  1174. @table @option
  1175. @item noise_reduction, nr
  1176. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1177. Default value is 12 dB.
  1178. @item noise_floor, nf
  1179. Set the noise floor in dB, allowed range is -80 to -20.
  1180. Default value is -50 dB.
  1181. @item noise_type, nt
  1182. Set the noise type.
  1183. It accepts the following values:
  1184. @table @option
  1185. @item white, w
  1186. Select white noise.
  1187. @item vinyl, v
  1188. Select vinyl noise.
  1189. @item shellac, s
  1190. Select shellac noise.
  1191. @item custom, c
  1192. Select custom noise, defined in @code{bn} option.
  1193. Default value is white noise.
  1194. @end table
  1195. @item band_noise, bn
  1196. Set custom band noise profile for every one of 15 bands.
  1197. Bands are separated by ' ' or '|'.
  1198. @item residual_floor, rf
  1199. Set the residual floor in dB, allowed range is -80 to -20.
  1200. Default value is -38 dB.
  1201. @item track_noise, tn
  1202. Enable noise floor tracking. By default is disabled.
  1203. With this enabled, noise floor is automatically adjusted.
  1204. @item track_residual, tr
  1205. Enable residual tracking. By default is disabled.
  1206. @item output_mode, om
  1207. Set the output mode.
  1208. It accepts the following values:
  1209. @table @option
  1210. @item input, i
  1211. Pass input unchanged.
  1212. @item output, o
  1213. Pass noise filtered out.
  1214. @item noise, n
  1215. Pass only noise.
  1216. Default value is @var{output}.
  1217. @end table
  1218. @item adaptivity, ad
  1219. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1220. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1221. react much slower.
  1222. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1223. @item floor_offset, fo
  1224. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1225. noise floor. It is only effective when noise floor tracking is enabled.
  1226. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1227. @item noise_link, nl
  1228. Set the noise link used for multichannel audio.
  1229. It accepts the following values:
  1230. @table @option
  1231. @item none
  1232. Use unchanged channel's noise floor.
  1233. @item min
  1234. Use measured min noise floor of all channels.
  1235. @item max
  1236. Use measured max noise floor of all channels.
  1237. @item average
  1238. Use measured average noise floor of all channels.
  1239. Default value is @var{min}.
  1240. @end table
  1241. @item band_multiplier, bm
  1242. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1243. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1244. @item sample_noise, sn
  1245. Toggle capturing and measurement of noise profile from input audio.
  1246. It accepts the following values:
  1247. @table @option
  1248. @item start, begin
  1249. Start sample noise capture.
  1250. @item stop, end
  1251. Stop sample noise capture and measure new noise band profile.
  1252. Default value is @code{none}.
  1253. @end table
  1254. @item gain_smooth, gs
  1255. Set gain smooth spatial radius, used to smooth gains applied to each frequency bin.
  1256. Useful to reduce random music noise artefacts.
  1257. Higher values increases smoothing of gains.
  1258. Allowed range is from @code{0} to @code{50}.
  1259. Default value is @code{0}.
  1260. @end table
  1261. @subsection Commands
  1262. This filter supports the some above mentioned options as @ref{commands}.
  1263. @subsection Examples
  1264. @itemize
  1265. @item
  1266. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1267. @example
  1268. afftdn=nr=10:nf=-40
  1269. @end example
  1270. @item
  1271. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1272. tracking of noise floor so noise floor will gradually change during processing:
  1273. @example
  1274. afftdn=nr=10:nf=-80:tn=1
  1275. @end example
  1276. @item
  1277. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1278. of first 0.4 seconds of input audio:
  1279. @example
  1280. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1281. @end example
  1282. @end itemize
  1283. @section afftfilt
  1284. Apply arbitrary expressions to samples in frequency domain.
  1285. @table @option
  1286. @item real
  1287. Set frequency domain real expression for each separate channel separated
  1288. by '|'. Default is "re".
  1289. If the number of input channels is greater than the number of
  1290. expressions, the last specified expression is used for the remaining
  1291. output channels.
  1292. @item imag
  1293. Set frequency domain imaginary expression for each separate channel
  1294. separated by '|'. Default is "im".
  1295. Each expression in @var{real} and @var{imag} can contain the following
  1296. constants and functions:
  1297. @table @option
  1298. @item sr
  1299. sample rate
  1300. @item b
  1301. current frequency bin number
  1302. @item nb
  1303. number of available bins
  1304. @item ch
  1305. channel number of the current expression
  1306. @item chs
  1307. number of channels
  1308. @item pts
  1309. current frame pts
  1310. @item re
  1311. current real part of frequency bin of current channel
  1312. @item im
  1313. current imaginary part of frequency bin of current channel
  1314. @item real(b, ch)
  1315. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1316. @item imag(b, ch)
  1317. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1318. @end table
  1319. @item win_size
  1320. Set window size. Allowed range is from 16 to 131072.
  1321. Default is @code{4096}
  1322. @item win_func
  1323. Set window function.
  1324. It accepts the following values:
  1325. @table @samp
  1326. @item rect
  1327. @item bartlett
  1328. @item hann, hanning
  1329. @item hamming
  1330. @item blackman
  1331. @item welch
  1332. @item flattop
  1333. @item bharris
  1334. @item bnuttall
  1335. @item bhann
  1336. @item sine
  1337. @item nuttall
  1338. @item lanczos
  1339. @item gauss
  1340. @item tukey
  1341. @item dolph
  1342. @item cauchy
  1343. @item parzen
  1344. @item poisson
  1345. @item bohman
  1346. @item kaiser
  1347. @end table
  1348. Default is @code{hann}.
  1349. @item overlap
  1350. Set window overlap. If set to 1, the recommended overlap for selected
  1351. window function will be picked. Default is @code{0.75}.
  1352. @end table
  1353. @subsection Examples
  1354. @itemize
  1355. @item
  1356. Leave almost only low frequencies in audio:
  1357. @example
  1358. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1359. @end example
  1360. @item
  1361. Apply robotize effect:
  1362. @example
  1363. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1364. @end example
  1365. @item
  1366. Apply whisper effect:
  1367. @example
  1368. 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"
  1369. @end example
  1370. @item
  1371. Apply phase shift:
  1372. @example
  1373. afftfilt="real=re*cos(1)-im*sin(1):imag=re*sin(1)+im*cos(1)"
  1374. @end example
  1375. @end itemize
  1376. @anchor{afir}
  1377. @section afir
  1378. Apply an arbitrary Finite Impulse Response filter.
  1379. This filter is designed for applying long FIR filters,
  1380. up to 60 seconds long.
  1381. It can be used as component for digital crossover filters,
  1382. room equalization, cross talk cancellation, wavefield synthesis,
  1383. auralization, ambiophonics, ambisonics and spatialization.
  1384. This filter uses the streams higher than first one as FIR coefficients.
  1385. If the non-first stream holds a single channel, it will be used
  1386. for all input channels in the first stream, otherwise
  1387. the number of channels in the non-first stream must be same as
  1388. the number of channels in the first stream.
  1389. It accepts the following parameters:
  1390. @table @option
  1391. @item dry
  1392. Set dry gain. This sets input gain.
  1393. @item wet
  1394. Set wet gain. This sets final output gain.
  1395. @item length
  1396. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1397. @item gtype
  1398. Enable applying gain measured from power of IR.
  1399. Set which approach to use for auto gain measurement.
  1400. @table @option
  1401. @item none
  1402. Do not apply any gain.
  1403. @item peak
  1404. select peak gain, very conservative approach. This is default value.
  1405. @item dc
  1406. select DC gain, limited application.
  1407. @item gn
  1408. select gain to noise approach, this is most popular one.
  1409. @item ac
  1410. select AC gain.
  1411. @item rms
  1412. select RMS gain.
  1413. @end table
  1414. @item irgain
  1415. Set gain to be applied to IR coefficients before filtering.
  1416. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1417. @item irfmt
  1418. Set format of IR stream. Can be @code{mono} or @code{input}.
  1419. Default is @code{input}.
  1420. @item maxir
  1421. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1422. Allowed range is 0.1 to 60 seconds.
  1423. @item response
  1424. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1425. By default it is disabled.
  1426. @item channel
  1427. Set for which IR channel to display frequency response. By default is first channel
  1428. displayed. This option is used only when @var{response} is enabled.
  1429. @item size
  1430. Set video stream size. This option is used only when @var{response} is enabled.
  1431. @item rate
  1432. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1433. @item minp
  1434. Set minimal partition size used for convolution. Default is @var{8192}.
  1435. Allowed range is from @var{1} to @var{65536}.
  1436. Lower values decreases latency at cost of higher CPU usage.
  1437. @item maxp
  1438. Set maximal partition size used for convolution. Default is @var{8192}.
  1439. Allowed range is from @var{8} to @var{65536}.
  1440. Lower values may increase CPU usage.
  1441. @item nbirs
  1442. Set number of input impulse responses streams which will be switchable at runtime.
  1443. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1444. @item ir
  1445. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1446. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1447. This option can be changed at runtime via @ref{commands}.
  1448. @item precision
  1449. Set which precision to use when processing samples.
  1450. @table @option
  1451. @item auto
  1452. Auto pick internal sample format depending on other filters.
  1453. @item float
  1454. Always use single-floating point precision sample format.
  1455. @item double
  1456. Always use double-floating point precision sample format.
  1457. @end table
  1458. Default value is auto.
  1459. @item irload
  1460. Set when to load IR stream. Can be @code{init} or @code{access}.
  1461. First one load and prepares all IRs on initialization, second one
  1462. once on first access of specific IR.
  1463. Default is @code{init}.
  1464. @end table
  1465. @subsection Examples
  1466. @itemize
  1467. @item
  1468. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1469. @example
  1470. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1471. @end example
  1472. @item
  1473. Apply true stereo processing given input stereo stream, and two stereo impulse responses for left and right channel,
  1474. the impulse response files are files with names l_ir.wav and r_ir.wav:
  1475. @example
  1476. "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:gtype=gn:irgain=-5dB,pan=stereo|FL<c0+c2|FR<c1+c3"
  1477. @end example
  1478. @end itemize
  1479. @anchor{aformat}
  1480. @section aformat
  1481. Set output format constraints for the input audio. The framework will
  1482. negotiate the most appropriate format to minimize conversions.
  1483. It accepts the following parameters:
  1484. @table @option
  1485. @item sample_fmts, f
  1486. A '|'-separated list of requested sample formats.
  1487. @item sample_rates, r
  1488. A '|'-separated list of requested sample rates.
  1489. @item channel_layouts, cl
  1490. A '|'-separated list of requested channel layouts.
  1491. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1492. for the required syntax.
  1493. @end table
  1494. If a parameter is omitted, all values are allowed.
  1495. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1496. @example
  1497. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1498. @end example
  1499. @section afreqshift
  1500. Apply frequency shift to input audio samples.
  1501. The filter accepts the following options:
  1502. @table @option
  1503. @item shift
  1504. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1505. Default value is 0.0.
  1506. @item level
  1507. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1508. Default value is 1.0.
  1509. @item order
  1510. Set filter order used for filtering. Allowed range is from 1 to 16.
  1511. Default value is 8.
  1512. @end table
  1513. @subsection Commands
  1514. This filter supports the all above options as @ref{commands}.
  1515. @section afwtdn
  1516. Reduce broadband noise from input samples using Wavelets.
  1517. A description of the accepted options follows.
  1518. @table @option
  1519. @item sigma
  1520. Set the noise sigma, allowed range is from 0 to 1.
  1521. Default value is 0.
  1522. This option controls strength of denoising applied to input samples.
  1523. Most useful way to set this option is via decibels, eg. -45dB.
  1524. @item levels
  1525. Set the number of wavelet levels of decomposition.
  1526. Allowed range is from 1 to 12.
  1527. Default value is 10.
  1528. Setting this too low make denoising performance very poor.
  1529. @item wavet
  1530. Set wavelet type for decomposition of input frame.
  1531. They are sorted by number of coefficients, from lowest to highest.
  1532. More coefficients means worse filtering speed, but overall better quality.
  1533. Available wavelets are:
  1534. @table @samp
  1535. @item sym2
  1536. @item sym4
  1537. @item rbior68
  1538. @item deb10
  1539. @item sym10
  1540. @item coif5
  1541. @item bl3
  1542. @end table
  1543. @item percent
  1544. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1545. Default value is 85 percent or partial denoising.
  1546. @item profile
  1547. If enabled, first input frame will be used as noise profile.
  1548. If first frame samples contain non-noise performance will be very poor.
  1549. @item adaptive
  1550. If enabled, input frames are analyzed for presence of noise.
  1551. If noise is detected with high possibility then input frame profile will be
  1552. used for processing following frames, until new noise frame is detected.
  1553. @item samples
  1554. Set size of single frame in number of samples. Allowed range is from 512 to
  1555. 65536. Default frame size is 8192 samples.
  1556. @item softness
  1557. Set softness applied inside thresholding function. Allowed range is from 0 to
  1558. 10. Default softness is 1.
  1559. @end table
  1560. @subsection Commands
  1561. This filter supports the all above options as @ref{commands}.
  1562. @section agate
  1563. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1564. processing reduces disturbing noise between useful signals.
  1565. Gating is done by detecting the volume below a chosen level @var{threshold}
  1566. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1567. floor is set via @var{range}. Because an exact manipulation of the signal
  1568. would cause distortion of the waveform the reduction can be levelled over
  1569. time. This is done by setting @var{attack} and @var{release}.
  1570. @var{attack} determines how long the signal has to fall below the threshold
  1571. before any reduction will occur and @var{release} sets the time the signal
  1572. has to rise above the threshold to reduce the reduction again.
  1573. Shorter signals than the chosen attack time will be left untouched.
  1574. @table @option
  1575. @item level_in
  1576. Set input level before filtering.
  1577. Default is 1. Allowed range is from 0.015625 to 64.
  1578. @item mode
  1579. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1580. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1581. will be amplified, expanding dynamic range in upward direction.
  1582. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1583. @item range
  1584. Set the level of gain reduction when the signal is below the threshold.
  1585. Default is 0.06125. Allowed range is from 0 to 1.
  1586. Setting this to 0 disables reduction and then filter behaves like expander.
  1587. @item threshold
  1588. If a signal rises above this level the gain reduction is released.
  1589. Default is 0.125. Allowed range is from 0 to 1.
  1590. @item ratio
  1591. Set a ratio by which the signal is reduced.
  1592. Default is 2. Allowed range is from 1 to 9000.
  1593. @item attack
  1594. Amount of milliseconds the signal has to rise above the threshold before gain
  1595. reduction stops.
  1596. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1597. @item release
  1598. Amount of milliseconds the signal has to fall below the threshold before the
  1599. reduction is increased again. Default is 250 milliseconds.
  1600. Allowed range is from 0.01 to 9000.
  1601. @item makeup
  1602. Set amount of amplification of signal after processing.
  1603. Default is 1. Allowed range is from 1 to 64.
  1604. @item knee
  1605. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1606. Default is 2.828427125. Allowed range is from 1 to 8.
  1607. @item detection
  1608. Choose if exact signal should be taken for detection or an RMS like one.
  1609. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1610. @item link
  1611. Choose if the average level between all channels or the louder channel affects
  1612. the reduction.
  1613. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1614. @end table
  1615. @subsection Commands
  1616. This filter supports the all above options as @ref{commands}.
  1617. @section aiir
  1618. Apply an arbitrary Infinite Impulse Response filter.
  1619. It accepts the following parameters:
  1620. @table @option
  1621. @item zeros, z
  1622. Set B/numerator/zeros/reflection coefficients.
  1623. @item poles, p
  1624. Set A/denominator/poles/ladder coefficients.
  1625. @item gains, k
  1626. Set channels gains.
  1627. @item dry_gain
  1628. Set input gain.
  1629. @item wet_gain
  1630. Set output gain.
  1631. @item format, f
  1632. Set coefficients format.
  1633. @table @samp
  1634. @item ll
  1635. lattice-ladder function
  1636. @item sf
  1637. analog transfer function
  1638. @item tf
  1639. digital transfer function
  1640. @item zp
  1641. Z-plane zeros/poles, cartesian (default)
  1642. @item pr
  1643. Z-plane zeros/poles, polar radians
  1644. @item pd
  1645. Z-plane zeros/poles, polar degrees
  1646. @item sp
  1647. S-plane zeros/poles
  1648. @end table
  1649. @item process, r
  1650. Set type of processing.
  1651. @table @samp
  1652. @item d
  1653. direct processing
  1654. @item s
  1655. serial processing
  1656. @item p
  1657. parallel processing
  1658. @end table
  1659. @item precision, e
  1660. Set filtering precision.
  1661. @table @samp
  1662. @item dbl
  1663. double-precision floating-point (default)
  1664. @item flt
  1665. single-precision floating-point
  1666. @item i32
  1667. 32-bit integers
  1668. @item i16
  1669. 16-bit integers
  1670. @end table
  1671. @item normalize, n
  1672. Normalize filter coefficients, by default is enabled.
  1673. Enabling it will normalize magnitude response at DC to 0dB.
  1674. @item mix
  1675. How much to use filtered signal in output. Default is 1.
  1676. Range is between 0 and 1.
  1677. @item response
  1678. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1679. By default it is disabled.
  1680. @item channel
  1681. Set for which IR channel to display frequency response. By default is first channel
  1682. displayed. This option is used only when @var{response} is enabled.
  1683. @item size
  1684. Set video stream size. This option is used only when @var{response} is enabled.
  1685. @end table
  1686. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1687. order.
  1688. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1689. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1690. imaginary unit.
  1691. Different coefficients and gains can be provided for every channel, in such case
  1692. use '|' to separate coefficients or gains. Last provided coefficients will be
  1693. used for all remaining channels.
  1694. @subsection Examples
  1695. @itemize
  1696. @item
  1697. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1698. @example
  1699. 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
  1700. @end example
  1701. @item
  1702. Same as above but in @code{zp} format:
  1703. @example
  1704. 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
  1705. @end example
  1706. @item
  1707. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1708. @example
  1709. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1710. @end example
  1711. @end itemize
  1712. @section alimiter
  1713. The limiter prevents an input signal from rising over a desired threshold.
  1714. This limiter uses lookahead technology to prevent your signal from distorting.
  1715. It means that there is a small delay after the signal is processed. Keep in mind
  1716. that the delay it produces is the attack time you set.
  1717. The filter accepts the following options:
  1718. @table @option
  1719. @item level_in
  1720. Set input gain. Default is 1.
  1721. @item level_out
  1722. Set output gain. Default is 1.
  1723. @item limit
  1724. Don't let signals above this level pass the limiter. Default is 1.
  1725. @item attack
  1726. The limiter will reach its attenuation level in this amount of time in
  1727. milliseconds. Default is 5 milliseconds.
  1728. @item release
  1729. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1730. Default is 50 milliseconds.
  1731. @item asc
  1732. When gain reduction is always needed ASC takes care of releasing to an
  1733. average reduction level rather than reaching a reduction of 0 in the release
  1734. time.
  1735. @item asc_level
  1736. Select how much the release time is affected by ASC, 0 means nearly no changes
  1737. in release time while 1 produces higher release times.
  1738. @item level
  1739. Auto level output signal. Default is enabled.
  1740. This normalizes audio back to 0dB if enabled.
  1741. @item latency
  1742. Compensate the delay introduced by using the lookahead buffer set with attack
  1743. parameter. Also flush the valid audio data in the lookahead buffer when the
  1744. stream hits EOF.
  1745. @end table
  1746. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1747. with @ref{aresample} before applying this filter.
  1748. @section allpass
  1749. Apply a two-pole all-pass filter with central frequency (in Hz)
  1750. @var{frequency}, and filter-width @var{width}.
  1751. An all-pass filter changes the audio's frequency to phase relationship
  1752. without changing its frequency to amplitude relationship.
  1753. The filter accepts the following options:
  1754. @table @option
  1755. @item frequency, f
  1756. Set frequency in Hz.
  1757. @item width_type, t
  1758. Set method to specify band-width of filter.
  1759. @table @option
  1760. @item h
  1761. Hz
  1762. @item q
  1763. Q-Factor
  1764. @item o
  1765. octave
  1766. @item s
  1767. slope
  1768. @item k
  1769. kHz
  1770. @end table
  1771. @item width, w
  1772. Specify the band-width of a filter in width_type units.
  1773. @item mix, m
  1774. How much to use filtered signal in output. Default is 1.
  1775. Range is between 0 and 1.
  1776. @item channels, c
  1777. Specify which channels to filter, by default all available are filtered.
  1778. @item normalize, n
  1779. Normalize biquad coefficients, by default is disabled.
  1780. Enabling it will normalize magnitude response at DC to 0dB.
  1781. @item order, o
  1782. Set the filter order, can be 1 or 2. Default is 2.
  1783. @item transform, a
  1784. Set transform type of IIR filter.
  1785. @table @option
  1786. @item di
  1787. @item dii
  1788. @item tdi
  1789. @item tdii
  1790. @item latt
  1791. @item svf
  1792. @item zdf
  1793. @end table
  1794. @item precision, r
  1795. Set precison of filtering.
  1796. @table @option
  1797. @item auto
  1798. Pick automatic sample format depending on surround filters.
  1799. @item s16
  1800. Always use signed 16-bit.
  1801. @item s32
  1802. Always use signed 32-bit.
  1803. @item f32
  1804. Always use float 32-bit.
  1805. @item f64
  1806. Always use float 64-bit.
  1807. @end table
  1808. @end table
  1809. @subsection Commands
  1810. This filter supports the following commands:
  1811. @table @option
  1812. @item frequency, f
  1813. Change allpass frequency.
  1814. Syntax for the command is : "@var{frequency}"
  1815. @item width_type, t
  1816. Change allpass width_type.
  1817. Syntax for the command is : "@var{width_type}"
  1818. @item width, w
  1819. Change allpass width.
  1820. Syntax for the command is : "@var{width}"
  1821. @item mix, m
  1822. Change allpass mix.
  1823. Syntax for the command is : "@var{mix}"
  1824. @end table
  1825. @section aloop
  1826. Loop audio samples.
  1827. The filter accepts the following options:
  1828. @table @option
  1829. @item loop
  1830. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1831. Default is 0.
  1832. @item size
  1833. Set maximal number of samples. Default is 0.
  1834. @item start
  1835. Set first sample of loop. Default is 0.
  1836. @item time
  1837. Set the time of loop start in seconds.
  1838. Only used if option named @var{start} is set to @code{-1}.
  1839. @end table
  1840. @anchor{amerge}
  1841. @section amerge
  1842. Merge two or more audio streams into a single multi-channel stream.
  1843. The filter accepts the following options:
  1844. @table @option
  1845. @item inputs
  1846. Set the number of inputs. Default is 2.
  1847. @end table
  1848. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1849. the channel layout of the output will be set accordingly and the channels
  1850. will be reordered as necessary. If the channel layouts of the inputs are not
  1851. disjoint, the output will have all the channels of the first input then all
  1852. the channels of the second input, in that order, and the channel layout of
  1853. the output will be the default value corresponding to the total number of
  1854. channels.
  1855. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1856. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1857. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1858. first input, b1 is the first channel of the second input).
  1859. On the other hand, if both input are in stereo, the output channels will be
  1860. in the default order: a1, a2, b1, b2, and the channel layout will be
  1861. arbitrarily set to 4.0, which may or may not be the expected value.
  1862. All inputs must have the same sample rate, and format.
  1863. If inputs do not have the same duration, the output will stop with the
  1864. shortest.
  1865. @subsection Examples
  1866. @itemize
  1867. @item
  1868. Merge two mono files into a stereo stream:
  1869. @example
  1870. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1871. @end example
  1872. @item
  1873. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1874. @example
  1875. 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
  1876. @end example
  1877. @end itemize
  1878. @section amix
  1879. Mixes multiple audio inputs into a single output.
  1880. Note that this filter only supports float samples (the @var{amerge}
  1881. and @var{pan} audio filters support many formats). If the @var{amix}
  1882. input has integer samples then @ref{aresample} will be automatically
  1883. inserted to perform the conversion to float samples.
  1884. It accepts the following parameters:
  1885. @table @option
  1886. @item inputs
  1887. The number of inputs. If unspecified, it defaults to 2.
  1888. @item duration
  1889. How to determine the end-of-stream.
  1890. @table @option
  1891. @item longest
  1892. The duration of the longest input. (default)
  1893. @item shortest
  1894. The duration of the shortest input.
  1895. @item first
  1896. The duration of the first input.
  1897. @end table
  1898. @item dropout_transition
  1899. The transition time, in seconds, for volume renormalization when an input
  1900. stream ends. The default value is 2 seconds.
  1901. @item weights
  1902. Specify weight of each input audio stream as a sequence of numbers separated
  1903. by a space. If fewer weights are specified compared to number of inputs, the
  1904. last weight is assigned to the remaining inputs.
  1905. Default weight for each input is 1.
  1906. @item normalize
  1907. Always scale inputs instead of only doing summation of samples.
  1908. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1909. by this filter if this option is disabled. By default is enabled.
  1910. @end table
  1911. @subsection Examples
  1912. @itemize
  1913. @item
  1914. This will mix 3 input audio streams to a single output with the same duration as the
  1915. first input and a dropout transition time of 3 seconds:
  1916. @example
  1917. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1918. @end example
  1919. @item
  1920. This will mix one vocal and one music input audio stream to a single output with the same duration as the
  1921. longest input. The music will have quarter the weight as the vocals, and the inputs are not normalized:
  1922. @example
  1923. ffmpeg -i VOCALS -i MUSIC -filter_complex amix=inputs=2:duration=longest:dropout_transition=0:weights="1 0.25":normalize=0 OUTPUT
  1924. @end example
  1925. @end itemize
  1926. @subsection Commands
  1927. This filter supports the following commands:
  1928. @table @option
  1929. @item weights
  1930. @item normalize
  1931. Syntax is same as option with same name.
  1932. @end table
  1933. @section amultiply
  1934. Multiply first audio stream with second audio stream and store result
  1935. in output audio stream. Multiplication is done by multiplying each
  1936. sample from first stream with sample at same position from second stream.
  1937. With this element-wise multiplication one can create amplitude fades and
  1938. amplitude modulations.
  1939. @section anequalizer
  1940. High-order parametric multiband equalizer for each channel.
  1941. It accepts the following parameters:
  1942. @table @option
  1943. @item params
  1944. This option string is in format:
  1945. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1946. Each equalizer band is separated by '|'.
  1947. @table @option
  1948. @item chn
  1949. Set channel number to which equalization will be applied.
  1950. If input doesn't have that channel the entry is ignored.
  1951. @item f
  1952. Set central frequency for band.
  1953. If input doesn't have that frequency the entry is ignored.
  1954. @item w
  1955. Set band width in Hertz.
  1956. @item g
  1957. Set band gain in dB.
  1958. @item t
  1959. Set filter type for band, optional, can be:
  1960. @table @samp
  1961. @item 0
  1962. Butterworth, this is default.
  1963. @item 1
  1964. Chebyshev type 1.
  1965. @item 2
  1966. Chebyshev type 2.
  1967. @end table
  1968. @end table
  1969. @item curves
  1970. With this option activated frequency response of anequalizer is displayed
  1971. in video stream.
  1972. @item size
  1973. Set video stream size. Only useful if curves option is activated.
  1974. @item mgain
  1975. Set max gain that will be displayed. Only useful if curves option is activated.
  1976. Setting this to a reasonable value makes it possible to display gain which is derived from
  1977. neighbour bands which are too close to each other and thus produce higher gain
  1978. when both are activated.
  1979. @item fscale
  1980. Set frequency scale used to draw frequency response in video output.
  1981. Can be linear or logarithmic. Default is logarithmic.
  1982. @item colors
  1983. Set color for each channel curve which is going to be displayed in video stream.
  1984. This is list of color names separated by space or by '|'.
  1985. Unrecognised or missing colors will be replaced by white color.
  1986. @end table
  1987. @subsection Examples
  1988. @itemize
  1989. @item
  1990. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1991. for first 2 channels using Chebyshev type 1 filter:
  1992. @example
  1993. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1994. @end example
  1995. @end itemize
  1996. @subsection Commands
  1997. This filter supports the following commands:
  1998. @table @option
  1999. @item change
  2000. Alter existing filter parameters.
  2001. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  2002. @var{fN} is existing filter number, starting from 0, if no such filter is available
  2003. error is returned.
  2004. @var{freq} set new frequency parameter.
  2005. @var{width} set new width parameter in Hertz.
  2006. @var{gain} set new gain parameter in dB.
  2007. Full filter invocation with asendcmd may look like this:
  2008. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  2009. @end table
  2010. @section anlmdn
  2011. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  2012. Each sample is adjusted by looking for other samples with similar contexts. This
  2013. context similarity is defined by comparing their surrounding patches of size
  2014. @option{p}. Patches are searched in an area of @option{r} around the sample.
  2015. The filter accepts the following options:
  2016. @table @option
  2017. @item strength, s
  2018. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  2019. @item patch, p
  2020. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  2021. Default value is 2 milliseconds.
  2022. @item research, r
  2023. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  2024. Default value is 6 milliseconds.
  2025. @item output, o
  2026. Set the output mode.
  2027. It accepts the following values:
  2028. @table @option
  2029. @item i
  2030. Pass input unchanged.
  2031. @item o
  2032. Pass noise filtered out.
  2033. @item n
  2034. Pass only noise.
  2035. Default value is @var{o}.
  2036. @end table
  2037. @item smooth, m
  2038. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  2039. @end table
  2040. @subsection Commands
  2041. This filter supports the all above options as @ref{commands}.
  2042. @section anlmf, anlms
  2043. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  2044. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  2045. relate to producing the least mean square of the error signal (difference between the desired,
  2046. 2nd input audio stream and the actual signal, the 1st input audio stream).
  2047. A description of the accepted options follows.
  2048. @table @option
  2049. @item order
  2050. Set filter order.
  2051. @item mu
  2052. Set filter mu.
  2053. @item eps
  2054. Set the filter eps.
  2055. @item leakage
  2056. Set the filter leakage.
  2057. @item out_mode
  2058. It accepts the following values:
  2059. @table @option
  2060. @item i
  2061. Pass the 1st input.
  2062. @item d
  2063. Pass the 2nd input.
  2064. @item o
  2065. Pass difference between desired, 2nd input and error signal estimate.
  2066. @item n
  2067. Pass difference between input, 1st input and error signal estimate.
  2068. @item e
  2069. Pass error signal estimated samples.
  2070. Default value is @var{o}.
  2071. @end table
  2072. @end table
  2073. @subsection Examples
  2074. @itemize
  2075. @item
  2076. One of many usages of this filter is noise reduction, input audio is filtered
  2077. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  2078. @example
  2079. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  2080. @end example
  2081. @end itemize
  2082. @subsection Commands
  2083. This filter supports the same commands as options, excluding option @code{order}.
  2084. @section anull
  2085. Pass the audio source unchanged to the output.
  2086. @section apad
  2087. Pad the end of an audio stream with silence.
  2088. This can be used together with @command{ffmpeg} @option{-shortest} to
  2089. extend audio streams to the same length as the video stream.
  2090. A description of the accepted options follows.
  2091. @table @option
  2092. @item packet_size
  2093. Set silence packet size. Default value is 4096.
  2094. @item pad_len
  2095. Set the number of samples of silence to add to the end. After the
  2096. value is reached, the stream is terminated. This option is mutually
  2097. exclusive with @option{whole_len}.
  2098. @item whole_len
  2099. Set the minimum total number of samples in the output audio stream. If
  2100. the value is longer than the input audio length, silence is added to
  2101. the end, until the value is reached. This option is mutually exclusive
  2102. with @option{pad_len}.
  2103. @item pad_dur
  2104. Specify the duration of samples of silence to add. See
  2105. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2106. for the accepted syntax. Used only if set to non-negative value.
  2107. @item whole_dur
  2108. Specify the minimum total duration in the output audio stream. See
  2109. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2110. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  2111. the input audio length, silence is added to the end, until the value is reached.
  2112. This option is mutually exclusive with @option{pad_dur}
  2113. @end table
  2114. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  2115. nor @option{whole_dur} option is set, the filter will add silence to the end of
  2116. the input stream indefinitely.
  2117. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  2118. @option{whole_dur} also caused the filter to add silence indefinitely.
  2119. @subsection Examples
  2120. @itemize
  2121. @item
  2122. Add 1024 samples of silence to the end of the input:
  2123. @example
  2124. apad=pad_len=1024
  2125. @end example
  2126. @item
  2127. Make sure the audio output will contain at least 10000 samples, pad
  2128. the input with silence if required:
  2129. @example
  2130. apad=whole_len=10000
  2131. @end example
  2132. @item
  2133. Use @command{ffmpeg} to pad the audio input with silence, so that the
  2134. video stream will always result the shortest and will be converted
  2135. until the end in the output file when using the @option{shortest}
  2136. option:
  2137. @example
  2138. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  2139. @end example
  2140. @end itemize
  2141. @section aphaser
  2142. Add a phasing effect to the input audio.
  2143. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  2144. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  2145. A description of the accepted parameters follows.
  2146. @table @option
  2147. @item in_gain
  2148. Set input gain. Default is 0.4.
  2149. @item out_gain
  2150. Set output gain. Default is 0.74
  2151. @item delay
  2152. Set delay in milliseconds. Default is 3.0.
  2153. @item decay
  2154. Set decay. Default is 0.4.
  2155. @item speed
  2156. Set modulation speed in Hz. Default is 0.5.
  2157. @item type
  2158. Set modulation type. Default is triangular.
  2159. It accepts the following values:
  2160. @table @samp
  2161. @item triangular, t
  2162. @item sinusoidal, s
  2163. @end table
  2164. @end table
  2165. @section aphaseshift
  2166. Apply phase shift to input audio samples.
  2167. The filter accepts the following options:
  2168. @table @option
  2169. @item shift
  2170. Specify phase shift. Allowed range is from -1.0 to 1.0.
  2171. Default value is 0.0.
  2172. @item level
  2173. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  2174. Default value is 1.0.
  2175. @item order
  2176. Set filter order used for filtering. Allowed range is from 1 to 16.
  2177. Default value is 8.
  2178. @end table
  2179. @subsection Commands
  2180. This filter supports the all above options as @ref{commands}.
  2181. @section apsnr
  2182. Measure Audio Peak Signal-to-Noise Ratio.
  2183. This filter takes two audio streams for input, and outputs first
  2184. audio stream.
  2185. Results are in dB per channel at end of either input.
  2186. @section apsyclip
  2187. Apply Psychoacoustic clipper to input audio stream.
  2188. The filter accepts the following options:
  2189. @table @option
  2190. @item level_in
  2191. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2192. @item level_out
  2193. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2194. @item clip
  2195. Set the clipping start value. Default value is 0dBFS or 1.
  2196. @item diff
  2197. Output only difference samples, useful to hear introduced distortions.
  2198. By default is disabled.
  2199. @item adaptive
  2200. Set strength of adaptive distortion applied. Default value is 0.5.
  2201. Allowed range is from 0 to 1.
  2202. @item iterations
  2203. Set number of iterations of psychoacoustic clipper.
  2204. Allowed range is from 1 to 20. Default value is 10.
  2205. @item level
  2206. Auto level output signal. Default is disabled.
  2207. This normalizes audio back to 0dBFS if enabled.
  2208. @end table
  2209. @subsection Commands
  2210. This filter supports the all above options as @ref{commands}.
  2211. @section apulsator
  2212. Audio pulsator is something between an autopanner and a tremolo.
  2213. But it can produce funny stereo effects as well. Pulsator changes the volume
  2214. of the left and right channel based on a LFO (low frequency oscillator) with
  2215. different waveforms and shifted phases.
  2216. This filter have the ability to define an offset between left and right
  2217. channel. An offset of 0 means that both LFO shapes match each other.
  2218. The left and right channel are altered equally - a conventional tremolo.
  2219. An offset of 50% means that the shape of the right channel is exactly shifted
  2220. in phase (or moved backwards about half of the frequency) - pulsator acts as
  2221. an autopanner. At 1 both curves match again. Every setting in between moves the
  2222. phase shift gapless between all stages and produces some "bypassing" sounds with
  2223. sine and triangle waveforms. The more you set the offset near 1 (starting from
  2224. the 0.5) the faster the signal passes from the left to the right speaker.
  2225. The filter accepts the following options:
  2226. @table @option
  2227. @item level_in
  2228. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2229. @item level_out
  2230. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2231. @item mode
  2232. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  2233. sawup or sawdown. Default is sine.
  2234. @item amount
  2235. Set modulation. Define how much of original signal is affected by the LFO.
  2236. @item offset_l
  2237. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2238. @item offset_r
  2239. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2240. @item width
  2241. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2242. @item timing
  2243. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2244. @item bpm
  2245. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2246. is set to bpm.
  2247. @item ms
  2248. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2249. is set to ms.
  2250. @item hz
  2251. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2252. if timing is set to hz.
  2253. @end table
  2254. @anchor{aresample}
  2255. @section aresample
  2256. Resample the input audio to the specified parameters, using the
  2257. libswresample library. If none are specified then the filter will
  2258. automatically convert between its input and output.
  2259. This filter is also able to stretch/squeeze the audio data to make it match
  2260. the timestamps or to inject silence / cut out audio to make it match the
  2261. timestamps, do a combination of both or do neither.
  2262. The filter accepts the syntax
  2263. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2264. expresses a sample rate and @var{resampler_options} is a list of
  2265. @var{key}=@var{value} pairs, separated by ":". See the
  2266. @ref{Resampler Options,,"Resampler Options" section in the
  2267. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2268. for the complete list of supported options.
  2269. @subsection Examples
  2270. @itemize
  2271. @item
  2272. Resample the input audio to 44100Hz:
  2273. @example
  2274. aresample=44100
  2275. @end example
  2276. @item
  2277. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2278. samples per second compensation:
  2279. @example
  2280. aresample=async=1000
  2281. @end example
  2282. @end itemize
  2283. @section areverse
  2284. Reverse an audio clip.
  2285. Warning: This filter requires memory to buffer the entire clip, so trimming
  2286. is suggested.
  2287. @subsection Examples
  2288. @itemize
  2289. @item
  2290. Take the first 5 seconds of a clip, and reverse it.
  2291. @example
  2292. atrim=end=5,areverse
  2293. @end example
  2294. @end itemize
  2295. @section arls
  2296. Apply Recursive Least Squares algorithm to the first audio stream using the second audio stream.
  2297. This adaptive filter is used to mimic a desired filter by recursively finding the filter coefficients that
  2298. relate to producing the minimal weighted linear least squares cost function of the error signal (difference
  2299. between the desired, 2nd input audio stream and the actual signal, the 1st input audio stream).
  2300. A description of the accepted options follows.
  2301. @table @option
  2302. @item order
  2303. Set the filter order.
  2304. @item lambda
  2305. Set the forgetting factor.
  2306. @item delta
  2307. Set the coefficient to initialize internal covariance matrix.
  2308. @item out_mode
  2309. Set the filter output samples. It accepts the following values:
  2310. @table @option
  2311. @item i
  2312. Pass the 1st input.
  2313. @item d
  2314. Pass the 2nd input.
  2315. @item o
  2316. Pass difference between desired, 2nd input and error signal estimate.
  2317. @item n
  2318. Pass difference between input, 1st input and error signal estimate.
  2319. @item e
  2320. Pass error signal estimated samples.
  2321. Default value is @var{o}.
  2322. @end table
  2323. @end table
  2324. @section arnndn
  2325. Reduce noise from speech using Recurrent Neural Networks.
  2326. This filter accepts the following options:
  2327. @table @option
  2328. @item model, m
  2329. Set train model file to load. This option is always required.
  2330. @item mix
  2331. Set how much to mix filtered samples into final output.
  2332. Allowed range is from -1 to 1. Default value is 1.
  2333. Negative values are special, they set how much to keep filtered noise
  2334. in the final filter output. Set this option to -1 to hear actual
  2335. noise removed from input signal.
  2336. @end table
  2337. @subsection Commands
  2338. This filter supports the all above options as @ref{commands}.
  2339. @section asdr
  2340. Measure Audio Signal-to-Distortion Ratio.
  2341. This filter takes two audio streams for input, and outputs first
  2342. audio stream.
  2343. Results are in dB per channel at end of either input.
  2344. @section asetnsamples
  2345. Set the number of samples per each output audio frame.
  2346. The last output packet may contain a different number of samples, as
  2347. the filter will flush all the remaining samples when the input audio
  2348. signals its end.
  2349. The filter accepts the following options:
  2350. @table @option
  2351. @item nb_out_samples, n
  2352. Set the number of frames per each output audio frame. The number is
  2353. intended as the number of samples @emph{per each channel}.
  2354. Default value is 1024.
  2355. @item pad, p
  2356. If set to 1, the filter will pad the last audio frame with zeroes, so
  2357. that the last frame will contain the same number of samples as the
  2358. previous ones. Default value is 1.
  2359. @end table
  2360. For example, to set the number of per-frame samples to 1234 and
  2361. disable padding for the last frame, use:
  2362. @example
  2363. asetnsamples=n=1234:p=0
  2364. @end example
  2365. @section asetrate
  2366. Set the sample rate without altering the PCM data.
  2367. This will result in a change of speed and pitch.
  2368. The filter accepts the following options:
  2369. @table @option
  2370. @item sample_rate, r
  2371. Set the output sample rate. Default is 44100 Hz.
  2372. @end table
  2373. @section ashowinfo
  2374. Show a line containing various information for each input audio frame.
  2375. The input audio is not modified.
  2376. The shown line contains a sequence of key/value pairs of the form
  2377. @var{key}:@var{value}.
  2378. The following values are shown in the output:
  2379. @table @option
  2380. @item n
  2381. The (sequential) number of the input frame, starting from 0.
  2382. @item pts
  2383. The presentation timestamp of the input frame, in time base units; the time base
  2384. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2385. @item pts_time
  2386. The presentation timestamp of the input frame in seconds.
  2387. @item fmt
  2388. The sample format.
  2389. @item chlayout
  2390. The channel layout.
  2391. @item rate
  2392. The sample rate for the audio frame.
  2393. @item nb_samples
  2394. The number of samples (per channel) in the frame.
  2395. @item checksum
  2396. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2397. audio, the data is treated as if all the planes were concatenated.
  2398. @item plane_checksums
  2399. A list of Adler-32 checksums for each data plane.
  2400. @end table
  2401. @section asisdr
  2402. Measure Audio Scaled-Invariant Signal-to-Distortion Ratio.
  2403. This filter takes two audio streams for input, and outputs first
  2404. audio stream.
  2405. Results are in dB per channel at end of either input.
  2406. @section asoftclip
  2407. Apply audio soft clipping.
  2408. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2409. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2410. This filter accepts the following options:
  2411. @table @option
  2412. @item type
  2413. Set type of soft-clipping.
  2414. It accepts the following values:
  2415. @table @option
  2416. @item hard
  2417. @item tanh
  2418. @item atan
  2419. @item cubic
  2420. @item exp
  2421. @item alg
  2422. @item quintic
  2423. @item sin
  2424. @item erf
  2425. @end table
  2426. @item threshold
  2427. Set threshold from where to start clipping. Default value is 0dB or 1.
  2428. @item output
  2429. Set gain applied to output. Default value is 0dB or 1.
  2430. @item param
  2431. Set additional parameter which controls sigmoid function.
  2432. @item oversample
  2433. Set oversampling factor.
  2434. @end table
  2435. @subsection Commands
  2436. This filter supports the all above options as @ref{commands}.
  2437. @section aspectralstats
  2438. Display frequency domain statistical information about the audio channels.
  2439. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2440. It accepts the following option:
  2441. @table @option
  2442. @item win_size
  2443. Set the window length in samples. Default value is 2048.
  2444. Allowed range is from 32 to 65536.
  2445. @item win_func
  2446. Set window function.
  2447. It accepts the following values:
  2448. @table @samp
  2449. @item rect
  2450. @item bartlett
  2451. @item hann, hanning
  2452. @item hamming
  2453. @item blackman
  2454. @item welch
  2455. @item flattop
  2456. @item bharris
  2457. @item bnuttall
  2458. @item bhann
  2459. @item sine
  2460. @item nuttall
  2461. @item lanczos
  2462. @item gauss
  2463. @item tukey
  2464. @item dolph
  2465. @item cauchy
  2466. @item parzen
  2467. @item poisson
  2468. @item bohman
  2469. @item kaiser
  2470. @end table
  2471. Default is @code{hann}.
  2472. @item overlap
  2473. Set window overlap. Allowed range is from @code{0}
  2474. to @code{1}. Default value is @code{0.5}.
  2475. @item measure
  2476. Select the parameters which are measured. The metadata keys can
  2477. be used as flags, default is @option{all} which measures everything.
  2478. @option{none} disables all measurement.
  2479. @end table
  2480. A list of each metadata key follows:
  2481. @table @option
  2482. @item mean
  2483. @item variance
  2484. @item centroid
  2485. @item spread
  2486. @item skewness
  2487. @item kurtosis
  2488. @item entropy
  2489. @item flatness
  2490. @item crest
  2491. @item flux
  2492. @item slope
  2493. @item decrease
  2494. @item rolloff
  2495. @end table
  2496. @section asr
  2497. Automatic Speech Recognition
  2498. This filter uses PocketSphinx for speech recognition. To enable
  2499. compilation of this filter, you need to configure FFmpeg with
  2500. @code{--enable-pocketsphinx}.
  2501. It accepts the following options:
  2502. @table @option
  2503. @item rate
  2504. Set sampling rate of input audio. Defaults is @code{16000}.
  2505. This need to match speech models, otherwise one will get poor results.
  2506. @item hmm
  2507. Set dictionary containing acoustic model files.
  2508. @item dict
  2509. Set pronunciation dictionary.
  2510. @item lm
  2511. Set language model file.
  2512. @item lmctl
  2513. Set language model set.
  2514. @item lmname
  2515. Set which language model to use.
  2516. @item logfn
  2517. Set output for log messages.
  2518. @end table
  2519. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2520. @anchor{astats}
  2521. @section astats
  2522. Display time domain statistical information about the audio channels.
  2523. Statistics are calculated and displayed for each audio channel and,
  2524. where applicable, an overall figure is also given.
  2525. It accepts the following option:
  2526. @table @option
  2527. @item length
  2528. Short window length in seconds, used for peak and trough RMS measurement.
  2529. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2530. @item metadata
  2531. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2532. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2533. disabled.
  2534. Available keys for each channel are:
  2535. @var{Bit_depth}
  2536. @var{Crest_factor}
  2537. @var{DC_offset}
  2538. @var{Dynamic_range}
  2539. @var{Entropy}
  2540. @var{Flat_factor}
  2541. @var{Max_difference}
  2542. @var{Max_level}
  2543. @var{Mean_difference}
  2544. @var{Min_difference}
  2545. @var{Min_level}
  2546. @var{Noise_floor}
  2547. @var{Noise_floor_count}
  2548. @var{Number_of_Infs}
  2549. @var{Number_of_NaNs}
  2550. @var{Number_of_denormals}
  2551. @var{Peak_count}
  2552. @var{Abs_Peak_count}
  2553. @var{Peak_level}
  2554. @var{RMS_difference}
  2555. @var{RMS_peak}
  2556. @var{RMS_trough}
  2557. @var{Zero_crossings}
  2558. @var{Zero_crossings_rate}
  2559. and for @code{Overall}:
  2560. @var{Bit_depth}
  2561. @var{DC_offset}
  2562. @var{Entropy}
  2563. @var{Flat_factor}
  2564. @var{Max_difference}
  2565. @var{Max_level}
  2566. @var{Mean_difference}
  2567. @var{Min_difference}
  2568. @var{Min_level}
  2569. @var{Noise_floor}
  2570. @var{Noise_floor_count}
  2571. @var{Number_of_Infs}
  2572. @var{Number_of_NaNs}
  2573. @var{Number_of_denormals}
  2574. @var{Number_of_samples}
  2575. @var{Peak_count}
  2576. @var{Abs_Peak_count}
  2577. @var{Peak_level}
  2578. @var{RMS_difference}
  2579. @var{RMS_level}
  2580. @var{RMS_peak}
  2581. @var{RMS_trough}
  2582. For example, a full key looks like @code{lavfi.astats.1.DC_offset} or
  2583. @code{lavfi.astats.Overall.Peak_count}.
  2584. Read below for the description of the keys.
  2585. @item reset
  2586. Set the number of frames over which cumulative stats are calculated before
  2587. being reset. Default is disabled.
  2588. @item measure_perchannel
  2589. Select the parameters which are measured per channel. The metadata keys can
  2590. be used as flags, default is @option{all} which measures everything.
  2591. @option{none} disables all per channel measurement.
  2592. @item measure_overall
  2593. Select the parameters which are measured overall. The metadata keys can
  2594. be used as flags, default is @option{all} which measures everything.
  2595. @option{none} disables all overall measurement.
  2596. @end table
  2597. A description of the measure keys follow:
  2598. @table @option
  2599. @item none
  2600. no measures
  2601. @item all
  2602. all measures
  2603. @item Bit_depth
  2604. overall bit depth of audio, i.e. number of bits used for each sample
  2605. @item Crest_factor
  2606. standard ratio of peak to RMS level (note: not in dB)
  2607. @item DC_offset
  2608. mean amplitude displacement from zero
  2609. @item Dynamic_range
  2610. measured dynamic range of audio in dB
  2611. @item Entropy
  2612. entropy measured across whole audio, entropy of value near 1.0 is typically measured for white noise
  2613. @item Flat_factor
  2614. flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2615. (i.e. either @var{Min_level} or @var{Max_level})
  2616. @item Max_difference
  2617. maximal difference between two consecutive samples
  2618. @item Max_level
  2619. maximal sample level
  2620. @item Mean_difference
  2621. mean difference between two consecutive samples, i.e. the average of each difference between two consecutive samples
  2622. @item Min_difference
  2623. minimal difference between two consecutive samples
  2624. @item Min_level
  2625. minimal sample level
  2626. @item Noise_floor
  2627. minimum local peak measured in dBFS over a short window
  2628. @item Noise_floor_count
  2629. number of occasions (not the number of samples) that the signal attained
  2630. @var{Noise floor}
  2631. @item Number_of_Infs
  2632. number of samples with an infinite value
  2633. @item Number_of_NaNs
  2634. number of samples with a NaN (not a number) value
  2635. @item Number_of_denormals
  2636. number of samples with a subnormal value
  2637. @item Number_of_samples
  2638. number of samples
  2639. @item Peak_count
  2640. number of occasions (not the number of samples) that the signal attained either
  2641. @var{Min_level} or @var{Max_level}
  2642. @item Abs_Peak_count
  2643. number of occasions that the absolute samples taken from the signal attained
  2644. max absolute value of @var{Min_level} and @var{Max_level}
  2645. @item Peak_level
  2646. standard peak level measured in dBFS
  2647. @item RMS_difference
  2648. Root Mean Square difference between two consecutive samples
  2649. @item RMS_level
  2650. standard RMS level measured in dBFS
  2651. @item RMS_peak
  2652. @item RMS_trough
  2653. peak and trough values for RMS level measured over a short window,
  2654. measured in dBFS.
  2655. @item Zero crossings
  2656. number of points where the waveform crosses the zero level axis
  2657. @item Zero crossings rate
  2658. rate of Zero crossings and number of audio samples
  2659. @end table
  2660. @section asubboost
  2661. Boost subwoofer frequencies.
  2662. The filter accepts the following options:
  2663. @table @option
  2664. @item dry
  2665. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2666. Default value is 1.0.
  2667. @item wet
  2668. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2669. Default value is 1.0.
  2670. @item boost
  2671. Set max boost factor. Allowed range is from 1 to 12. Default value is 2.
  2672. @item decay
  2673. Set delay line decay gain value. Allowed range is from 0 to 1.
  2674. Default value is 0.0.
  2675. @item feedback
  2676. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2677. Default value is 0.9.
  2678. @item cutoff
  2679. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2680. Default value is 100.
  2681. @item slope
  2682. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2683. Default value is 0.5.
  2684. @item delay
  2685. Set delay. Allowed range is from 1 to 100.
  2686. Default value is 20.
  2687. @item channels
  2688. Set the channels to process. Default value is all available.
  2689. @end table
  2690. @subsection Commands
  2691. This filter supports the all above options as @ref{commands}.
  2692. @section asubcut
  2693. Cut subwoofer frequencies.
  2694. This filter allows to set custom, steeper
  2695. roll off than highpass filter, and thus is able to more attenuate
  2696. frequency content in stop-band.
  2697. The filter accepts the following options:
  2698. @table @option
  2699. @item cutoff
  2700. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2701. Default value is 20.
  2702. @item order
  2703. Set filter order. Available values are from 3 to 20.
  2704. Default value is 10.
  2705. @item level
  2706. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2707. @end table
  2708. @subsection Commands
  2709. This filter supports the all above options as @ref{commands}.
  2710. @section asupercut
  2711. Cut super frequencies.
  2712. The filter accepts the following options:
  2713. @table @option
  2714. @item cutoff
  2715. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2716. Default value is 20000.
  2717. @item order
  2718. Set filter order. Available values are from 3 to 20.
  2719. Default value is 10.
  2720. @item level
  2721. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2722. @end table
  2723. @subsection Commands
  2724. This filter supports the all above options as @ref{commands}.
  2725. @section asuperpass
  2726. Apply high order Butterworth band-pass filter.
  2727. The filter accepts the following options:
  2728. @table @option
  2729. @item centerf
  2730. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2731. Default value is 1000.
  2732. @item order
  2733. Set filter order. Available values are from 4 to 20.
  2734. Default value is 4.
  2735. @item qfactor
  2736. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2737. @item level
  2738. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2739. @end table
  2740. @subsection Commands
  2741. This filter supports the all above options as @ref{commands}.
  2742. @section asuperstop
  2743. Apply high order Butterworth band-stop filter.
  2744. The filter accepts the following options:
  2745. @table @option
  2746. @item centerf
  2747. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2748. Default value is 1000.
  2749. @item order
  2750. Set filter order. Available values are from 4 to 20.
  2751. Default value is 4.
  2752. @item qfactor
  2753. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2754. @item level
  2755. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2756. @end table
  2757. @subsection Commands
  2758. This filter supports the all above options as @ref{commands}.
  2759. @section atempo
  2760. Adjust audio tempo.
  2761. The filter accepts exactly one parameter, the audio tempo. If not
  2762. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2763. be in the [0.5, 100.0] range.
  2764. Note that tempo greater than 2 will skip some samples rather than
  2765. blend them in. If for any reason this is a concern it is always
  2766. possible to daisy-chain several instances of atempo to achieve the
  2767. desired product tempo.
  2768. @subsection Examples
  2769. @itemize
  2770. @item
  2771. Slow down audio to 80% tempo:
  2772. @example
  2773. atempo=0.8
  2774. @end example
  2775. @item
  2776. To speed up audio to 300% tempo:
  2777. @example
  2778. atempo=3
  2779. @end example
  2780. @item
  2781. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2782. @example
  2783. atempo=sqrt(3),atempo=sqrt(3)
  2784. @end example
  2785. @end itemize
  2786. @subsection Commands
  2787. This filter supports the following commands:
  2788. @table @option
  2789. @item tempo
  2790. Change filter tempo scale factor.
  2791. Syntax for the command is : "@var{tempo}"
  2792. @end table
  2793. @section atilt
  2794. Apply spectral tilt filter to audio stream.
  2795. This filter apply any spectral roll-off slope over any specified frequency band.
  2796. The filter accepts the following options:
  2797. @table @option
  2798. @item freq
  2799. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2800. @item slope
  2801. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2802. @item width
  2803. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2804. @item order
  2805. Set order of tilt filter.
  2806. @item level
  2807. Set input volume level. Allowed range is from 0 to 4.
  2808. Defalt is 1.
  2809. @end table
  2810. @subsection Commands
  2811. This filter supports the all above options as @ref{commands}.
  2812. @section atrim
  2813. Trim the input so that the output contains one continuous subpart of the input.
  2814. It accepts the following parameters:
  2815. @table @option
  2816. @item start
  2817. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2818. sample with the timestamp @var{start} will be the first sample in the output.
  2819. @item end
  2820. Specify time of the first audio sample that will be dropped, i.e. the
  2821. audio sample immediately preceding the one with the timestamp @var{end} will be
  2822. the last sample in the output.
  2823. @item start_pts
  2824. Same as @var{start}, except this option sets the start timestamp in samples
  2825. instead of seconds.
  2826. @item end_pts
  2827. Same as @var{end}, except this option sets the end timestamp in samples instead
  2828. of seconds.
  2829. @item duration
  2830. The maximum duration of the output in seconds.
  2831. @item start_sample
  2832. The number of the first sample that should be output.
  2833. @item end_sample
  2834. The number of the first sample that should be dropped.
  2835. @end table
  2836. @option{start}, @option{end}, and @option{duration} are expressed as time
  2837. duration specifications; see
  2838. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2839. Note that the first two sets of the start/end options and the @option{duration}
  2840. option look at the frame timestamp, while the _sample options simply count the
  2841. samples that pass through the filter. So start/end_pts and start/end_sample will
  2842. give different results when the timestamps are wrong, inexact or do not start at
  2843. zero. Also note that this filter does not modify the timestamps. If you wish
  2844. to have the output timestamps start at zero, insert the asetpts filter after the
  2845. atrim filter.
  2846. If multiple start or end options are set, this filter tries to be greedy and
  2847. keep all samples that match at least one of the specified constraints. To keep
  2848. only the part that matches all the constraints at once, chain multiple atrim
  2849. filters.
  2850. The defaults are such that all the input is kept. So it is possible to set e.g.
  2851. just the end values to keep everything before the specified time.
  2852. Examples:
  2853. @itemize
  2854. @item
  2855. Drop everything except the second minute of input:
  2856. @example
  2857. ffmpeg -i INPUT -af atrim=60:120
  2858. @end example
  2859. @item
  2860. Keep only the first 1000 samples:
  2861. @example
  2862. ffmpeg -i INPUT -af atrim=end_sample=1000
  2863. @end example
  2864. @end itemize
  2865. @section axcorrelate
  2866. Calculate normalized windowed cross-correlation between two input audio streams.
  2867. Resulted samples are always between -1 and 1 inclusive.
  2868. If result is 1 it means two input samples are highly correlated in that selected segment.
  2869. Result 0 means they are not correlated at all.
  2870. If result is -1 it means two input samples are out of phase, which means they cancel each
  2871. other.
  2872. The filter accepts the following options:
  2873. @table @option
  2874. @item size
  2875. Set size of segment over which cross-correlation is calculated.
  2876. Default is 256. Allowed range is from 2 to 131072.
  2877. @item algo
  2878. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast} or @code{best}.
  2879. Default is @code{best}. Fast algorithm assumes mean values over any given segment
  2880. are always zero and thus need much less calculations to make.
  2881. This is generally not true, but is valid for typical audio streams.
  2882. @end table
  2883. @subsection Examples
  2884. @itemize
  2885. @item
  2886. Calculate correlation between channels in stereo audio stream:
  2887. @example
  2888. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2889. @end example
  2890. @end itemize
  2891. @section bandpass
  2892. Apply a two-pole Butterworth band-pass filter with central
  2893. frequency @var{frequency}, and (3dB-point) band-width width.
  2894. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2895. instead of the default: constant 0dB peak gain.
  2896. The filter roll off at 6dB per octave (20dB per decade).
  2897. The filter accepts the following options:
  2898. @table @option
  2899. @item frequency, f
  2900. Set the filter's central frequency. Default is @code{3000}.
  2901. @item csg
  2902. Constant skirt gain if set to 1. Defaults to 0.
  2903. @item width_type, t
  2904. Set method to specify band-width of filter.
  2905. @table @option
  2906. @item h
  2907. Hz
  2908. @item q
  2909. Q-Factor
  2910. @item o
  2911. octave
  2912. @item s
  2913. slope
  2914. @item k
  2915. kHz
  2916. @end table
  2917. @item width, w
  2918. Specify the band-width of a filter in width_type units.
  2919. @item mix, m
  2920. How much to use filtered signal in output. Default is 1.
  2921. Range is between 0 and 1.
  2922. @item channels, c
  2923. Specify which channels to filter, by default all available are filtered.
  2924. @item normalize, n
  2925. Normalize biquad coefficients, by default is disabled.
  2926. Enabling it will normalize magnitude response at DC to 0dB.
  2927. @item transform, a
  2928. Set transform type of IIR filter.
  2929. @table @option
  2930. @item di
  2931. @item dii
  2932. @item tdi
  2933. @item tdii
  2934. @item latt
  2935. @item svf
  2936. @item zdf
  2937. @end table
  2938. @item precision, r
  2939. Set precison of filtering.
  2940. @table @option
  2941. @item auto
  2942. Pick automatic sample format depending on surround filters.
  2943. @item s16
  2944. Always use signed 16-bit.
  2945. @item s32
  2946. Always use signed 32-bit.
  2947. @item f32
  2948. Always use float 32-bit.
  2949. @item f64
  2950. Always use float 64-bit.
  2951. @end table
  2952. @item block_size, b
  2953. Set block size used for reverse IIR processing. If this value is set to high enough
  2954. value (higher than impulse response length truncated when reaches near zero values) filtering
  2955. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2956. Note that filter delay will be exactly this many samples when set to non-zero value.
  2957. @end table
  2958. @subsection Commands
  2959. This filter supports the following commands:
  2960. @table @option
  2961. @item frequency, f
  2962. Change bandpass frequency.
  2963. Syntax for the command is : "@var{frequency}"
  2964. @item width_type, t
  2965. Change bandpass width_type.
  2966. Syntax for the command is : "@var{width_type}"
  2967. @item width, w
  2968. Change bandpass width.
  2969. Syntax for the command is : "@var{width}"
  2970. @item mix, m
  2971. Change bandpass mix.
  2972. Syntax for the command is : "@var{mix}"
  2973. @end table
  2974. @section bandreject
  2975. Apply a two-pole Butterworth band-reject filter with central
  2976. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2977. The filter roll off at 6dB per octave (20dB per decade).
  2978. The filter accepts the following options:
  2979. @table @option
  2980. @item frequency, f
  2981. Set the filter's central frequency. Default is @code{3000}.
  2982. @item width_type, t
  2983. Set method to specify band-width of filter.
  2984. @table @option
  2985. @item h
  2986. Hz
  2987. @item q
  2988. Q-Factor
  2989. @item o
  2990. octave
  2991. @item s
  2992. slope
  2993. @item k
  2994. kHz
  2995. @end table
  2996. @item width, w
  2997. Specify the band-width of a filter in width_type units.
  2998. @item mix, m
  2999. How much to use filtered signal in output. Default is 1.
  3000. Range is between 0 and 1.
  3001. @item channels, c
  3002. Specify which channels to filter, by default all available are filtered.
  3003. @item normalize, n
  3004. Normalize biquad coefficients, by default is disabled.
  3005. Enabling it will normalize magnitude response at DC to 0dB.
  3006. @item transform, a
  3007. Set transform type of IIR filter.
  3008. @table @option
  3009. @item di
  3010. @item dii
  3011. @item tdi
  3012. @item tdii
  3013. @item latt
  3014. @item svf
  3015. @item zdf
  3016. @end table
  3017. @item precision, r
  3018. Set precison of filtering.
  3019. @table @option
  3020. @item auto
  3021. Pick automatic sample format depending on surround filters.
  3022. @item s16
  3023. Always use signed 16-bit.
  3024. @item s32
  3025. Always use signed 32-bit.
  3026. @item f32
  3027. Always use float 32-bit.
  3028. @item f64
  3029. Always use float 64-bit.
  3030. @end table
  3031. @item block_size, b
  3032. Set block size used for reverse IIR processing. If this value is set to high enough
  3033. value (higher than impulse response length truncated when reaches near zero values) filtering
  3034. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3035. Note that filter delay will be exactly this many samples when set to non-zero value.
  3036. @end table
  3037. @subsection Commands
  3038. This filter supports the following commands:
  3039. @table @option
  3040. @item frequency, f
  3041. Change bandreject frequency.
  3042. Syntax for the command is : "@var{frequency}"
  3043. @item width_type, t
  3044. Change bandreject width_type.
  3045. Syntax for the command is : "@var{width_type}"
  3046. @item width, w
  3047. Change bandreject width.
  3048. Syntax for the command is : "@var{width}"
  3049. @item mix, m
  3050. Change bandreject mix.
  3051. Syntax for the command is : "@var{mix}"
  3052. @end table
  3053. @section bass, lowshelf
  3054. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  3055. shelving filter with a response similar to that of a standard
  3056. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3057. The filter accepts the following options:
  3058. @table @option
  3059. @item gain, g
  3060. Give the gain at 0 Hz. Its useful range is about -20
  3061. (for a large cut) to +20 (for a large boost).
  3062. Beware of clipping when using a positive gain.
  3063. @item frequency, f
  3064. Set the filter's central frequency and so can be used
  3065. to extend or reduce the frequency range to be boosted or cut.
  3066. The default value is @code{100} Hz.
  3067. @item width_type, t
  3068. Set method to specify band-width of filter.
  3069. @table @option
  3070. @item h
  3071. Hz
  3072. @item q
  3073. Q-Factor
  3074. @item o
  3075. octave
  3076. @item s
  3077. slope
  3078. @item k
  3079. kHz
  3080. @end table
  3081. @item width, w
  3082. Determine how steep is the filter's shelf transition.
  3083. @item poles, p
  3084. Set number of poles. Default is 2.
  3085. @item mix, m
  3086. How much to use filtered signal in output. Default is 1.
  3087. Range is between 0 and 1.
  3088. @item channels, c
  3089. Specify which channels to filter, by default all available are filtered.
  3090. @item normalize, n
  3091. Normalize biquad coefficients, by default is disabled.
  3092. Enabling it will normalize magnitude response at DC to 0dB.
  3093. @item transform, a
  3094. Set transform type of IIR filter.
  3095. @table @option
  3096. @item di
  3097. @item dii
  3098. @item tdi
  3099. @item tdii
  3100. @item latt
  3101. @item svf
  3102. @item zdf
  3103. @end table
  3104. @item precision, r
  3105. Set precison of filtering.
  3106. @table @option
  3107. @item auto
  3108. Pick automatic sample format depending on surround filters.
  3109. @item s16
  3110. Always use signed 16-bit.
  3111. @item s32
  3112. Always use signed 32-bit.
  3113. @item f32
  3114. Always use float 32-bit.
  3115. @item f64
  3116. Always use float 64-bit.
  3117. @end table
  3118. @item block_size, b
  3119. Set block size used for reverse IIR processing. If this value is set to high enough
  3120. value (higher than impulse response length truncated when reaches near zero values) filtering
  3121. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3122. Note that filter delay will be exactly this many samples when set to non-zero value.
  3123. @end table
  3124. @subsection Commands
  3125. This filter supports the following commands:
  3126. @table @option
  3127. @item frequency, f
  3128. Change bass frequency.
  3129. Syntax for the command is : "@var{frequency}"
  3130. @item width_type, t
  3131. Change bass width_type.
  3132. Syntax for the command is : "@var{width_type}"
  3133. @item width, w
  3134. Change bass width.
  3135. Syntax for the command is : "@var{width}"
  3136. @item gain, g
  3137. Change bass gain.
  3138. Syntax for the command is : "@var{gain}"
  3139. @item mix, m
  3140. Change bass mix.
  3141. Syntax for the command is : "@var{mix}"
  3142. @end table
  3143. @section biquad
  3144. Apply a biquad IIR filter with the given coefficients.
  3145. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  3146. are the numerator and denominator coefficients respectively.
  3147. and @var{channels}, @var{c} specify which channels to filter, by default all
  3148. available are filtered.
  3149. @subsection Commands
  3150. This filter supports the following commands:
  3151. @table @option
  3152. @item a0
  3153. @item a1
  3154. @item a2
  3155. @item b0
  3156. @item b1
  3157. @item b2
  3158. Change biquad parameter.
  3159. Syntax for the command is : "@var{value}"
  3160. @item mix, m
  3161. How much to use filtered signal in output. Default is 1.
  3162. Range is between 0 and 1.
  3163. @item channels, c
  3164. Specify which channels to filter, by default all available are filtered.
  3165. @item normalize, n
  3166. Normalize biquad coefficients, by default is disabled.
  3167. Enabling it will normalize magnitude response at DC to 0dB.
  3168. @item transform, a
  3169. Set transform type of IIR filter.
  3170. @table @option
  3171. @item di
  3172. @item dii
  3173. @item tdi
  3174. @item tdii
  3175. @item latt
  3176. @item svf
  3177. @item zdf
  3178. @end table
  3179. @item precision, r
  3180. Set precison of filtering.
  3181. @table @option
  3182. @item auto
  3183. Pick automatic sample format depending on surround filters.
  3184. @item s16
  3185. Always use signed 16-bit.
  3186. @item s32
  3187. Always use signed 32-bit.
  3188. @item f32
  3189. Always use float 32-bit.
  3190. @item f64
  3191. Always use float 64-bit.
  3192. @end table
  3193. @item block_size, b
  3194. Set block size used for reverse IIR processing. If this value is set to high enough
  3195. value (higher than impulse response length truncated when reaches near zero values) filtering
  3196. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3197. Note that filter delay will be exactly this many samples when set to non-zero value.
  3198. @end table
  3199. @section bs2b
  3200. Bauer stereo to binaural transformation, which improves headphone listening of
  3201. stereo audio records.
  3202. To enable compilation of this filter you need to configure FFmpeg with
  3203. @code{--enable-libbs2b}.
  3204. It accepts the following parameters:
  3205. @table @option
  3206. @item profile
  3207. Pre-defined crossfeed level.
  3208. @table @option
  3209. @item default
  3210. Default level (fcut=700, feed=50).
  3211. @item cmoy
  3212. Chu Moy circuit (fcut=700, feed=60).
  3213. @item jmeier
  3214. Jan Meier circuit (fcut=650, feed=95).
  3215. @end table
  3216. @item fcut
  3217. Cut frequency (in Hz).
  3218. @item feed
  3219. Feed level (in Hz).
  3220. @end table
  3221. @section channelmap
  3222. Remap input channels to new locations.
  3223. It accepts the following parameters:
  3224. @table @option
  3225. @item map
  3226. Map channels from input to output. The argument is a '|'-separated list of
  3227. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  3228. @var{in_channel} form. @var{in_channel} can be either the name of the input
  3229. channel (e.g. FL for front left) or its index in the input channel layout.
  3230. @var{out_channel} is the name of the output channel or its index in the output
  3231. channel layout. If @var{out_channel} is not given then it is implicitly an
  3232. index, starting with zero and increasing by one for each mapping.
  3233. @item channel_layout
  3234. The channel layout of the output stream.
  3235. @end table
  3236. If no mapping is present, the filter will implicitly map input channels to
  3237. output channels, preserving indices.
  3238. @subsection Examples
  3239. @itemize
  3240. @item
  3241. For example, assuming a 5.1+downmix input MOV file,
  3242. @example
  3243. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  3244. @end example
  3245. will create an output WAV file tagged as stereo from the downmix channels of
  3246. the input.
  3247. @item
  3248. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  3249. @example
  3250. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  3251. @end example
  3252. @end itemize
  3253. @section channelsplit
  3254. Split each channel from an input audio stream into a separate output stream.
  3255. It accepts the following parameters:
  3256. @table @option
  3257. @item channel_layout
  3258. The channel layout of the input stream. The default is "stereo".
  3259. @item channels
  3260. A channel layout describing the channels to be extracted as separate output streams
  3261. or "all" to extract each input channel as a separate stream. The default is "all".
  3262. Choosing channels not present in channel layout in the input will result in an error.
  3263. @end table
  3264. @subsection Examples
  3265. @itemize
  3266. @item
  3267. For example, assuming a stereo input MP3 file,
  3268. @example
  3269. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  3270. @end example
  3271. will create an output Matroska file with two audio streams, one containing only
  3272. the left channel and the other the right channel.
  3273. @item
  3274. Split a 5.1 WAV file into per-channel files:
  3275. @example
  3276. ffmpeg -i in.wav -filter_complex
  3277. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  3278. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  3279. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  3280. side_right.wav
  3281. @end example
  3282. @item
  3283. Extract only LFE from a 5.1 WAV file:
  3284. @example
  3285. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  3286. -map '[LFE]' lfe.wav
  3287. @end example
  3288. @end itemize
  3289. @section chorus
  3290. Add a chorus effect to the audio.
  3291. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  3292. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  3293. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  3294. The modulation depth defines the range the modulated delay is played before or after
  3295. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  3296. sound tuned around the original one, like in a chorus where some vocals are slightly
  3297. off key.
  3298. It accepts the following parameters:
  3299. @table @option
  3300. @item in_gain
  3301. Set input gain. Default is 0.4.
  3302. @item out_gain
  3303. Set output gain. Default is 0.4.
  3304. @item delays
  3305. Set delays. A typical delay is around 40ms to 60ms.
  3306. @item decays
  3307. Set decays.
  3308. @item speeds
  3309. Set speeds.
  3310. @item depths
  3311. Set depths.
  3312. @end table
  3313. @subsection Examples
  3314. @itemize
  3315. @item
  3316. A single delay:
  3317. @example
  3318. chorus=0.7:0.9:55:0.4:0.25:2
  3319. @end example
  3320. @item
  3321. Two delays:
  3322. @example
  3323. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3324. @end example
  3325. @item
  3326. Fuller sounding chorus with three delays:
  3327. @example
  3328. 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
  3329. @end example
  3330. @end itemize
  3331. @section compand
  3332. Compress or expand the audio's dynamic range.
  3333. It accepts the following parameters:
  3334. @table @option
  3335. @item attacks
  3336. @item decays
  3337. A list of times in seconds for each channel over which the instantaneous level
  3338. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3339. increase of volume and @var{decays} refers to decrease of volume. For most
  3340. situations, the attack time (response to the audio getting louder) should be
  3341. shorter than the decay time, because the human ear is more sensitive to sudden
  3342. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3343. a typical value for decay is 0.8 seconds.
  3344. If specified number of attacks & decays is lower than number of channels, the last
  3345. set attack/decay will be used for all remaining channels.
  3346. @item points
  3347. A list of points for the transfer function, specified in dB relative to the
  3348. maximum possible signal amplitude. Each key points list must be defined using
  3349. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3350. @code{x0/y0 x1/y1 x2/y2 ....}
  3351. The input values must be in strictly increasing order but the transfer function
  3352. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3353. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3354. function are @code{-70/-70|-60/-20|1/0}.
  3355. @item soft-knee
  3356. Set the curve radius in dB for all joints. It defaults to 0.01.
  3357. @item gain
  3358. Set the additional gain in dB to be applied at all points on the transfer
  3359. function. This allows for easy adjustment of the overall gain.
  3360. It defaults to 0.
  3361. @item volume
  3362. Set an initial volume, in dB, to be assumed for each channel when filtering
  3363. starts. This permits the user to supply a nominal level initially, so that, for
  3364. example, a very large gain is not applied to initial signal levels before the
  3365. companding has begun to operate. A typical value for audio which is initially
  3366. quiet is -90 dB. It defaults to 0.
  3367. @item delay
  3368. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3369. delayed before being fed to the volume adjuster. Specifying a delay
  3370. approximately equal to the attack/decay times allows the filter to effectively
  3371. operate in predictive rather than reactive mode. It defaults to 0.
  3372. @end table
  3373. @subsection Examples
  3374. @itemize
  3375. @item
  3376. Make music with both quiet and loud passages suitable for listening to in a
  3377. noisy environment:
  3378. @example
  3379. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3380. @end example
  3381. Another example for audio with whisper and explosion parts:
  3382. @example
  3383. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3384. @end example
  3385. @item
  3386. A noise gate for when the noise is at a lower level than the signal:
  3387. @example
  3388. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3389. @end example
  3390. @item
  3391. Here is another noise gate, this time for when the noise is at a higher level
  3392. than the signal (making it, in some ways, similar to squelch):
  3393. @example
  3394. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3395. @end example
  3396. @item
  3397. 2:1 compression starting at -6dB:
  3398. @example
  3399. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3400. @end example
  3401. @item
  3402. 2:1 compression starting at -9dB:
  3403. @example
  3404. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3405. @end example
  3406. @item
  3407. 2:1 compression starting at -12dB:
  3408. @example
  3409. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3410. @end example
  3411. @item
  3412. 2:1 compression starting at -18dB:
  3413. @example
  3414. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3415. @end example
  3416. @item
  3417. 3:1 compression starting at -15dB:
  3418. @example
  3419. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3420. @end example
  3421. @item
  3422. Compressor/Gate:
  3423. @example
  3424. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3425. @end example
  3426. @item
  3427. Expander:
  3428. @example
  3429. 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
  3430. @end example
  3431. @item
  3432. Hard limiter at -6dB:
  3433. @example
  3434. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3435. @end example
  3436. @item
  3437. Hard limiter at -12dB:
  3438. @example
  3439. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3440. @end example
  3441. @item
  3442. Hard noise gate at -35 dB:
  3443. @example
  3444. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3445. @end example
  3446. @item
  3447. Soft limiter:
  3448. @example
  3449. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3450. @end example
  3451. @end itemize
  3452. @section compensationdelay
  3453. Compensation Delay Line is a metric based delay to compensate differing
  3454. positions of microphones or speakers.
  3455. For example, you have recorded guitar with two microphones placed in
  3456. different locations. Because the front of sound wave has fixed speed in
  3457. normal conditions, the phasing of microphones can vary and depends on
  3458. their location and interposition. The best sound mix can be achieved when
  3459. these microphones are in phase (synchronized). Note that a distance of
  3460. ~30 cm between microphones makes one microphone capture the signal in
  3461. antiphase to the other microphone. That makes the final mix sound moody.
  3462. This filter helps to solve phasing problems by adding different delays
  3463. to each microphone track and make them synchronized.
  3464. The best result can be reached when you take one track as base and
  3465. synchronize other tracks one by one with it.
  3466. Remember that synchronization/delay tolerance depends on sample rate, too.
  3467. Higher sample rates will give more tolerance.
  3468. The filter accepts the following parameters:
  3469. @table @option
  3470. @item mm
  3471. Set millimeters distance. This is compensation distance for fine tuning.
  3472. Default is 0.
  3473. @item cm
  3474. Set cm distance. This is compensation distance for tightening distance setup.
  3475. Default is 0.
  3476. @item m
  3477. Set meters distance. This is compensation distance for hard distance setup.
  3478. Default is 0.
  3479. @item dry
  3480. Set dry amount. Amount of unprocessed (dry) signal.
  3481. Default is 0.
  3482. @item wet
  3483. Set wet amount. Amount of processed (wet) signal.
  3484. Default is 1.
  3485. @item temp
  3486. Set temperature in degrees Celsius. This is the temperature of the environment.
  3487. Default is 20.
  3488. @end table
  3489. @subsection Commands
  3490. This filter supports the all above options as @ref{commands}.
  3491. @section crossfeed
  3492. Apply headphone crossfeed filter.
  3493. Crossfeed is the process of blending the left and right channels of stereo
  3494. audio recording.
  3495. It is mainly used to reduce extreme stereo separation of low frequencies.
  3496. The intent is to produce more speaker like sound to the listener.
  3497. The filter accepts the following options:
  3498. @table @option
  3499. @item strength
  3500. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3501. This sets gain of low shelf filter for side part of stereo image.
  3502. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3503. @item range
  3504. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3505. This sets cut off frequency of low shelf filter. Default is cut off near
  3506. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3507. @item slope
  3508. Set curve slope of low shelf filter. Default is 0.5.
  3509. Allowed range is from 0.01 to 1.
  3510. @item level_in
  3511. Set input gain. Default is 0.9.
  3512. @item level_out
  3513. Set output gain. Default is 1.
  3514. @item block_size
  3515. Set block size used for reverse IIR processing. If this value is set to high enough
  3516. value (higher than impulse response length truncated when reaches near zero values) filtering
  3517. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3518. Note that filter delay will be exactly this many samples when set to non-zero value.
  3519. @end table
  3520. @subsection Commands
  3521. This filter supports the all above options as @ref{commands}.
  3522. @section crystalizer
  3523. Simple algorithm for audio noise sharpening.
  3524. This filter linearly increases differences betweeen each audio sample.
  3525. The filter accepts the following options:
  3526. @table @option
  3527. @item i
  3528. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3529. (unchanged sound) to 10.0 (maximum effect).
  3530. To inverse filtering use negative value.
  3531. @item c
  3532. Enable clipping. By default is enabled.
  3533. @end table
  3534. @subsection Commands
  3535. This filter supports the all above options as @ref{commands}.
  3536. @section dcshift
  3537. Apply a DC shift to the audio.
  3538. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3539. in the recording chain) from the audio. The effect of a DC offset is reduced
  3540. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3541. a signal has a DC offset.
  3542. @table @option
  3543. @item shift
  3544. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3545. the audio.
  3546. @item limitergain
  3547. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3548. used to prevent clipping.
  3549. @end table
  3550. @section deesser
  3551. Apply de-essing to the audio samples.
  3552. @table @option
  3553. @item i
  3554. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3555. Default is 0.
  3556. @item m
  3557. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3558. Default is 0.5.
  3559. @item f
  3560. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3561. Default is 0.5.
  3562. @item s
  3563. Set the output mode.
  3564. It accepts the following values:
  3565. @table @option
  3566. @item i
  3567. Pass input unchanged.
  3568. @item o
  3569. Pass ess filtered out.
  3570. @item e
  3571. Pass only ess.
  3572. Default value is @var{o}.
  3573. @end table
  3574. @end table
  3575. @section dialoguenhance
  3576. Enhance dialogue in stereo audio.
  3577. This filter accepts stereo input and produce surround (3.0) channels output.
  3578. The newly produced front center channel have enhanced speech dialogue originally
  3579. available in both stereo channels.
  3580. This filter outputs front left and front right channels same as available in stereo input.
  3581. The filter accepts the following options:
  3582. @table @option
  3583. @item original
  3584. Set the original center factor to keep in front center channel output.
  3585. Allowed range is from 0 to 1. Default value is 1.
  3586. @item enhance
  3587. Set the dialogue enhance factor to put in front center channel output.
  3588. Allowed range is from 0 to 3. Default value is 1.
  3589. @item voice
  3590. Set the voice detection factor.
  3591. Allowed range is from 2 to 32. Default value is 2.
  3592. @end table
  3593. @subsection Commands
  3594. This filter supports the all above options as @ref{commands}.
  3595. @section drmeter
  3596. Measure audio dynamic range.
  3597. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3598. is found in transition material. And anything less that 8 have very poor dynamics
  3599. and is very compressed.
  3600. The filter accepts the following options:
  3601. @table @option
  3602. @item length
  3603. Set window length in seconds used to split audio into segments of equal length.
  3604. Default is 3 seconds.
  3605. @end table
  3606. @section dynaudnorm
  3607. Dynamic Audio Normalizer.
  3608. This filter applies a certain amount of gain to the input audio in order
  3609. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3610. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3611. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3612. This allows for applying extra gain to the "quiet" sections of the audio
  3613. while avoiding distortions or clipping the "loud" sections. In other words:
  3614. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3615. sections, in the sense that the volume of each section is brought to the
  3616. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3617. this goal *without* applying "dynamic range compressing". It will retain 100%
  3618. of the dynamic range *within* each section of the audio file.
  3619. @table @option
  3620. @item framelen, f
  3621. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3622. Default is 500 milliseconds.
  3623. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3624. referred to as frames. This is required, because a peak magnitude has no
  3625. meaning for just a single sample value. Instead, we need to determine the
  3626. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3627. normalizer would simply use the peak magnitude of the complete file, the
  3628. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3629. frame. The length of a frame is specified in milliseconds. By default, the
  3630. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3631. been found to give good results with most files.
  3632. Note that the exact frame length, in number of samples, will be determined
  3633. automatically, based on the sampling rate of the individual input audio file.
  3634. @item gausssize, g
  3635. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3636. number. Default is 31.
  3637. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3638. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3639. is specified in frames, centered around the current frame. For the sake of
  3640. simplicity, this must be an odd number. Consequently, the default value of 31
  3641. takes into account the current frame, as well as the 15 preceding frames and
  3642. the 15 subsequent frames. Using a larger window results in a stronger
  3643. smoothing effect and thus in less gain variation, i.e. slower gain
  3644. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3645. effect and thus in more gain variation, i.e. faster gain adaptation.
  3646. In other words, the more you increase this value, the more the Dynamic Audio
  3647. Normalizer will behave like a "traditional" normalization filter. On the
  3648. contrary, the more you decrease this value, the more the Dynamic Audio
  3649. Normalizer will behave like a dynamic range compressor.
  3650. @item peak, p
  3651. Set the target peak value. This specifies the highest permissible magnitude
  3652. level for the normalized audio input. This filter will try to approach the
  3653. target peak magnitude as closely as possible, but at the same time it also
  3654. makes sure that the normalized signal will never exceed the peak magnitude.
  3655. A frame's maximum local gain factor is imposed directly by the target peak
  3656. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3657. It is not recommended to go above this value.
  3658. @item maxgain, m
  3659. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3660. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3661. factor for each input frame, i.e. the maximum gain factor that does not
  3662. result in clipping or distortion. The maximum gain factor is determined by
  3663. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3664. additionally bounds the frame's maximum gain factor by a predetermined
  3665. (global) maximum gain factor. This is done in order to avoid excessive gain
  3666. factors in "silent" or almost silent frames. By default, the maximum gain
  3667. factor is 10.0, For most inputs the default value should be sufficient and
  3668. it usually is not recommended to increase this value. Though, for input
  3669. with an extremely low overall volume level, it may be necessary to allow even
  3670. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3671. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3672. Instead, a "sigmoid" threshold function will be applied. This way, the
  3673. gain factors will smoothly approach the threshold value, but never exceed that
  3674. value.
  3675. @item targetrms, r
  3676. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3677. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3678. This means that the maximum local gain factor for each frame is defined
  3679. (only) by the frame's highest magnitude sample. This way, the samples can
  3680. be amplified as much as possible without exceeding the maximum signal
  3681. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3682. Normalizer can also take into account the frame's root mean square,
  3683. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3684. determine the power of a time-varying signal. It is therefore considered
  3685. that the RMS is a better approximation of the "perceived loudness" than
  3686. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3687. frames to a constant RMS value, a uniform "perceived loudness" can be
  3688. established. If a target RMS value has been specified, a frame's local gain
  3689. factor is defined as the factor that would result in exactly that RMS value.
  3690. Note, however, that the maximum local gain factor is still restricted by the
  3691. frame's highest magnitude sample, in order to prevent clipping.
  3692. @item coupling, n
  3693. Enable channels coupling. By default is enabled.
  3694. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3695. amount. This means the same gain factor will be applied to all channels, i.e.
  3696. the maximum possible gain factor is determined by the "loudest" channel.
  3697. However, in some recordings, it may happen that the volume of the different
  3698. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3699. In this case, this option can be used to disable the channel coupling. This way,
  3700. the gain factor will be determined independently for each channel, depending
  3701. only on the individual channel's highest magnitude sample. This allows for
  3702. harmonizing the volume of the different channels.
  3703. @item correctdc, c
  3704. Enable DC bias correction. By default is disabled.
  3705. An audio signal (in the time domain) is a sequence of sample values.
  3706. In the Dynamic Audio Normalizer these sample values are represented in the
  3707. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3708. audio signal, or "waveform", should be centered around the zero point.
  3709. That means if we calculate the mean value of all samples in a file, or in a
  3710. single frame, then the result should be 0.0 or at least very close to that
  3711. value. If, however, there is a significant deviation of the mean value from
  3712. 0.0, in either positive or negative direction, this is referred to as a
  3713. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3714. Audio Normalizer provides optional DC bias correction.
  3715. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3716. the mean value, or "DC correction" offset, of each input frame and subtract
  3717. that value from all of the frame's sample values which ensures those samples
  3718. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3719. boundaries, the DC correction offset values will be interpolated smoothly
  3720. between neighbouring frames.
  3721. @item altboundary, b
  3722. Enable alternative boundary mode. By default is disabled.
  3723. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3724. around each frame. This includes the preceding frames as well as the
  3725. subsequent frames. However, for the "boundary" frames, located at the very
  3726. beginning and at the very end of the audio file, not all neighbouring
  3727. frames are available. In particular, for the first few frames in the audio
  3728. file, the preceding frames are not known. And, similarly, for the last few
  3729. frames in the audio file, the subsequent frames are not known. Thus, the
  3730. question arises which gain factors should be assumed for the missing frames
  3731. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3732. to deal with this situation. The default boundary mode assumes a gain factor
  3733. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3734. "fade out" at the beginning and at the end of the input, respectively.
  3735. @item compress, s
  3736. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3737. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3738. compression. This means that signal peaks will not be pruned and thus the
  3739. full dynamic range will be retained within each local neighbourhood. However,
  3740. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3741. normalization algorithm with a more "traditional" compression.
  3742. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3743. (thresholding) function. If (and only if) the compression feature is enabled,
  3744. all input frames will be processed by a soft knee thresholding function prior
  3745. to the actual normalization process. Put simply, the thresholding function is
  3746. going to prune all samples whose magnitude exceeds a certain threshold value.
  3747. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3748. value. Instead, the threshold value will be adjusted for each individual
  3749. frame.
  3750. In general, smaller parameters result in stronger compression, and vice versa.
  3751. Values below 3.0 are not recommended, because audible distortion may appear.
  3752. @item threshold, t
  3753. Set the target threshold value. This specifies the lowest permissible
  3754. magnitude level for the audio input which will be normalized.
  3755. If input frame volume is above this value frame will be normalized.
  3756. Otherwise frame may not be normalized at all. The default value is set
  3757. to 0, which means all input frames will be normalized.
  3758. This option is mostly useful if digital noise is not wanted to be amplified.
  3759. @item channels, h
  3760. Specify which channels to filter, by default all available channels are filtered.
  3761. @item overlap, o
  3762. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3763. Using >0 and <1 values will make less conservative gain adjustments, like
  3764. when framelen option is set to smaller value, if framelen option value is
  3765. compensated for non-zero overlap then gain adjustments will be smoother across time
  3766. compared to zero overlap case.
  3767. @item curve, v
  3768. Specify the peak mapping curve expression which is going to be used when calculating
  3769. gain applied to frames. The max output frame gain will still be limited by other
  3770. options mentioned previously for this filter.
  3771. The expression can contain the following constants:
  3772. @table @option
  3773. @item ch
  3774. current channel number
  3775. @item sn
  3776. current sample number
  3777. @item nb_channels
  3778. number of channels
  3779. @item t
  3780. timestamp expressed in seconds
  3781. @item sr
  3782. sample rate
  3783. @item p
  3784. current frame peak value
  3785. @end table
  3786. @end table
  3787. @subsection Commands
  3788. This filter supports the all above options as @ref{commands}.
  3789. @section earwax
  3790. Make audio easier to listen to on headphones.
  3791. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3792. so that when listened to on headphones the stereo image is moved from
  3793. inside your head (standard for headphones) to outside and in front of
  3794. the listener (standard for speakers).
  3795. Ported from SoX.
  3796. @section equalizer
  3797. Apply a two-pole peaking equalisation (EQ) filter. With this
  3798. filter, the signal-level at and around a selected frequency can
  3799. be increased or decreased, whilst (unlike bandpass and bandreject
  3800. filters) that at all other frequencies is unchanged.
  3801. In order to produce complex equalisation curves, this filter can
  3802. be given several times, each with a different central frequency.
  3803. The filter accepts the following options:
  3804. @table @option
  3805. @item frequency, f
  3806. Set the filter's central frequency in Hz.
  3807. @item width_type, t
  3808. Set method to specify band-width of filter.
  3809. @table @option
  3810. @item h
  3811. Hz
  3812. @item q
  3813. Q-Factor
  3814. @item o
  3815. octave
  3816. @item s
  3817. slope
  3818. @item k
  3819. kHz
  3820. @end table
  3821. @item width, w
  3822. Specify the band-width of a filter in width_type units.
  3823. @item gain, g
  3824. Set the required gain or attenuation in dB.
  3825. Beware of clipping when using a positive gain.
  3826. @item mix, m
  3827. How much to use filtered signal in output. Default is 1.
  3828. Range is between 0 and 1.
  3829. @item channels, c
  3830. Specify which channels to filter, by default all available are filtered.
  3831. @item normalize, n
  3832. Normalize biquad coefficients, by default is disabled.
  3833. Enabling it will normalize magnitude response at DC to 0dB.
  3834. @item transform, a
  3835. Set transform type of IIR filter.
  3836. @table @option
  3837. @item di
  3838. @item dii
  3839. @item tdi
  3840. @item tdii
  3841. @item latt
  3842. @item svf
  3843. @item zdf
  3844. @end table
  3845. @item precision, r
  3846. Set precison of filtering.
  3847. @table @option
  3848. @item auto
  3849. Pick automatic sample format depending on surround filters.
  3850. @item s16
  3851. Always use signed 16-bit.
  3852. @item s32
  3853. Always use signed 32-bit.
  3854. @item f32
  3855. Always use float 32-bit.
  3856. @item f64
  3857. Always use float 64-bit.
  3858. @end table
  3859. @item block_size, b
  3860. Set block size used for reverse IIR processing. If this value is set to high enough
  3861. value (higher than impulse response length truncated when reaches near zero values) filtering
  3862. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3863. Note that filter delay will be exactly this many samples when set to non-zero value.
  3864. @end table
  3865. @subsection Examples
  3866. @itemize
  3867. @item
  3868. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3869. @example
  3870. equalizer=f=1000:t=h:width=200:g=-10
  3871. @end example
  3872. @item
  3873. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3874. @example
  3875. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3876. @end example
  3877. @end itemize
  3878. @subsection Commands
  3879. This filter supports the following commands:
  3880. @table @option
  3881. @item frequency, f
  3882. Change equalizer frequency.
  3883. Syntax for the command is : "@var{frequency}"
  3884. @item width_type, t
  3885. Change equalizer width_type.
  3886. Syntax for the command is : "@var{width_type}"
  3887. @item width, w
  3888. Change equalizer width.
  3889. Syntax for the command is : "@var{width}"
  3890. @item gain, g
  3891. Change equalizer gain.
  3892. Syntax for the command is : "@var{gain}"
  3893. @item mix, m
  3894. Change equalizer mix.
  3895. Syntax for the command is : "@var{mix}"
  3896. @end table
  3897. @section extrastereo
  3898. Linearly increases the difference between left and right channels which
  3899. adds some sort of "live" effect to playback.
  3900. The filter accepts the following options:
  3901. @table @option
  3902. @item m
  3903. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3904. (average of both channels), with 1.0 sound will be unchanged, with
  3905. -1.0 left and right channels will be swapped.
  3906. @item c
  3907. Enable clipping. By default is enabled.
  3908. @end table
  3909. @subsection Commands
  3910. This filter supports the all above options as @ref{commands}.
  3911. @section firequalizer
  3912. Apply FIR Equalization using arbitrary frequency response.
  3913. The filter accepts the following option:
  3914. @table @option
  3915. @item gain
  3916. Set gain curve equation (in dB). The expression can contain variables:
  3917. @table @option
  3918. @item f
  3919. the evaluated frequency
  3920. @item sr
  3921. sample rate
  3922. @item ch
  3923. channel number, set to 0 when multichannels evaluation is disabled
  3924. @item chid
  3925. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3926. multichannels evaluation is disabled
  3927. @item chs
  3928. number of channels
  3929. @item chlayout
  3930. channel_layout, see libavutil/channel_layout.h
  3931. @end table
  3932. and functions:
  3933. @table @option
  3934. @item gain_interpolate(f)
  3935. interpolate gain on frequency f based on gain_entry
  3936. @item cubic_interpolate(f)
  3937. same as gain_interpolate, but smoother
  3938. @end table
  3939. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3940. @item gain_entry
  3941. Set gain entry for gain_interpolate function. The expression can
  3942. contain functions:
  3943. @table @option
  3944. @item entry(f, g)
  3945. store gain entry at frequency f with value g
  3946. @end table
  3947. This option is also available as command.
  3948. @item delay
  3949. Set filter delay in seconds. Higher value means more accurate.
  3950. Default is @code{0.01}.
  3951. @item accuracy
  3952. Set filter accuracy in Hz. Lower value means more accurate.
  3953. Default is @code{5}.
  3954. @item wfunc
  3955. Set window function. Acceptable values are:
  3956. @table @option
  3957. @item rectangular
  3958. rectangular window, useful when gain curve is already smooth
  3959. @item hann
  3960. hann window (default)
  3961. @item hamming
  3962. hamming window
  3963. @item blackman
  3964. blackman window
  3965. @item nuttall3
  3966. 3-terms continuous 1st derivative nuttall window
  3967. @item mnuttall3
  3968. minimum 3-terms discontinuous nuttall window
  3969. @item nuttall
  3970. 4-terms continuous 1st derivative nuttall window
  3971. @item bnuttall
  3972. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3973. @item bharris
  3974. blackman-harris window
  3975. @item tukey
  3976. tukey window
  3977. @end table
  3978. @item fixed
  3979. If enabled, use fixed number of audio samples. This improves speed when
  3980. filtering with large delay. Default is disabled.
  3981. @item multi
  3982. Enable multichannels evaluation on gain. Default is disabled.
  3983. @item zero_phase
  3984. Enable zero phase mode by subtracting timestamp to compensate delay.
  3985. Default is disabled.
  3986. @item scale
  3987. Set scale used by gain. Acceptable values are:
  3988. @table @option
  3989. @item linlin
  3990. linear frequency, linear gain
  3991. @item linlog
  3992. linear frequency, logarithmic (in dB) gain (default)
  3993. @item loglin
  3994. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3995. @item loglog
  3996. logarithmic frequency, logarithmic gain
  3997. @end table
  3998. @item dumpfile
  3999. Set file for dumping, suitable for gnuplot.
  4000. @item dumpscale
  4001. Set scale for dumpfile. Acceptable values are same with scale option.
  4002. Default is linlog.
  4003. @item fft2
  4004. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  4005. Default is disabled.
  4006. @item min_phase
  4007. Enable minimum phase impulse response. Default is disabled.
  4008. @end table
  4009. @subsection Examples
  4010. @itemize
  4011. @item
  4012. lowpass at 1000 Hz:
  4013. @example
  4014. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  4015. @end example
  4016. @item
  4017. lowpass at 1000 Hz with gain_entry:
  4018. @example
  4019. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  4020. @end example
  4021. @item
  4022. custom equalization:
  4023. @example
  4024. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  4025. @end example
  4026. @item
  4027. higher delay with zero phase to compensate delay:
  4028. @example
  4029. firequalizer=delay=0.1:fixed=on:zero_phase=on
  4030. @end example
  4031. @item
  4032. lowpass on left channel, highpass on right channel:
  4033. @example
  4034. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  4035. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  4036. @end example
  4037. @end itemize
  4038. @section flanger
  4039. Apply a flanging effect to the audio.
  4040. The filter accepts the following options:
  4041. @table @option
  4042. @item delay
  4043. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  4044. @item depth
  4045. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  4046. @item regen
  4047. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  4048. Default value is 0.
  4049. @item width
  4050. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  4051. Default value is 71.
  4052. @item speed
  4053. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  4054. @item shape
  4055. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  4056. Default value is @var{sinusoidal}.
  4057. @item phase
  4058. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  4059. Default value is 25.
  4060. @item interp
  4061. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  4062. Default is @var{linear}.
  4063. @end table
  4064. @section haas
  4065. Apply Haas effect to audio.
  4066. Note that this makes most sense to apply on mono signals.
  4067. With this filter applied to mono signals it give some directionality and
  4068. stretches its stereo image.
  4069. The filter accepts the following options:
  4070. @table @option
  4071. @item level_in
  4072. Set input level. By default is @var{1}, or 0dB
  4073. @item level_out
  4074. Set output level. By default is @var{1}, or 0dB.
  4075. @item side_gain
  4076. Set gain applied to side part of signal. By default is @var{1}.
  4077. @item middle_source
  4078. Set kind of middle source. Can be one of the following:
  4079. @table @samp
  4080. @item left
  4081. Pick left channel.
  4082. @item right
  4083. Pick right channel.
  4084. @item mid
  4085. Pick middle part signal of stereo image.
  4086. @item side
  4087. Pick side part signal of stereo image.
  4088. @end table
  4089. @item middle_phase
  4090. Change middle phase. By default is disabled.
  4091. @item left_delay
  4092. Set left channel delay. By default is @var{2.05} milliseconds.
  4093. @item left_balance
  4094. Set left channel balance. By default is @var{-1}.
  4095. @item left_gain
  4096. Set left channel gain. By default is @var{1}.
  4097. @item left_phase
  4098. Change left phase. By default is disabled.
  4099. @item right_delay
  4100. Set right channel delay. By defaults is @var{2.12} milliseconds.
  4101. @item right_balance
  4102. Set right channel balance. By default is @var{1}.
  4103. @item right_gain
  4104. Set right channel gain. By default is @var{1}.
  4105. @item right_phase
  4106. Change right phase. By default is enabled.
  4107. @end table
  4108. @section hdcd
  4109. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  4110. embedded HDCD codes is expanded into a 20-bit PCM stream.
  4111. The filter supports the Peak Extend and Low-level Gain Adjustment features
  4112. of HDCD, and detects the Transient Filter flag.
  4113. @example
  4114. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  4115. @end example
  4116. When using the filter with wav, note the default encoding for wav is 16-bit,
  4117. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  4118. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  4119. @example
  4120. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  4121. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  4122. @end example
  4123. The filter accepts the following options:
  4124. @table @option
  4125. @item disable_autoconvert
  4126. Disable any automatic format conversion or resampling in the filter graph.
  4127. @item process_stereo
  4128. Process the stereo channels together. If target_gain does not match between
  4129. channels, consider it invalid and use the last valid target_gain.
  4130. @item cdt_ms
  4131. Set the code detect timer period in ms.
  4132. @item force_pe
  4133. Always extend peaks above -3dBFS even if PE isn't signaled.
  4134. @item analyze_mode
  4135. Replace audio with a solid tone and adjust the amplitude to signal some
  4136. specific aspect of the decoding process. The output file can be loaded in
  4137. an audio editor alongside the original to aid analysis.
  4138. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  4139. Modes are:
  4140. @table @samp
  4141. @item 0, off
  4142. Disabled
  4143. @item 1, lle
  4144. Gain adjustment level at each sample
  4145. @item 2, pe
  4146. Samples where peak extend occurs
  4147. @item 3, cdt
  4148. Samples where the code detect timer is active
  4149. @item 4, tgm
  4150. Samples where the target gain does not match between channels
  4151. @end table
  4152. @end table
  4153. @section headphone
  4154. Apply head-related transfer functions (HRTFs) to create virtual
  4155. loudspeakers around the user for binaural listening via headphones.
  4156. The HRIRs are provided via additional streams, for each channel
  4157. one stereo input stream is needed.
  4158. The filter accepts the following options:
  4159. @table @option
  4160. @item map
  4161. Set mapping of input streams for convolution.
  4162. The argument is a '|'-separated list of channel names in order as they
  4163. are given as additional stream inputs for filter.
  4164. This also specify number of input streams. Number of input streams
  4165. must be not less than number of channels in first stream plus one.
  4166. @item gain
  4167. Set gain applied to audio. Value is in dB. Default is 0.
  4168. @item type
  4169. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4170. processing audio in time domain which is slow.
  4171. @var{freq} is processing audio in frequency domain which is fast.
  4172. Default is @var{freq}.
  4173. @item lfe
  4174. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4175. @item size
  4176. Set size of frame in number of samples which will be processed at once.
  4177. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  4178. @item hrir
  4179. Set format of hrir stream.
  4180. Default value is @var{stereo}. Alternative value is @var{multich}.
  4181. If value is set to @var{stereo}, number of additional streams should
  4182. be greater or equal to number of input channels in first input stream.
  4183. Also each additional stream should have stereo number of channels.
  4184. If value is set to @var{multich}, number of additional streams should
  4185. be exactly one. Also number of input channels of additional stream
  4186. should be equal or greater than twice number of channels of first input
  4187. stream.
  4188. @end table
  4189. @subsection Examples
  4190. @itemize
  4191. @item
  4192. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4193. each amovie filter use stereo file with IR coefficients as input.
  4194. The files give coefficients for each position of virtual loudspeaker:
  4195. @example
  4196. ffmpeg -i input.wav
  4197. -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"
  4198. output.wav
  4199. @end example
  4200. @item
  4201. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4202. but now in @var{multich} @var{hrir} format.
  4203. @example
  4204. 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"
  4205. output.wav
  4206. @end example
  4207. @end itemize
  4208. @section highpass
  4209. Apply a high-pass filter with 3dB point frequency.
  4210. The filter can be either single-pole, or double-pole (the default).
  4211. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4212. The filter accepts the following options:
  4213. @table @option
  4214. @item frequency, f
  4215. Set frequency in Hz. Default is 3000.
  4216. @item poles, p
  4217. Set number of poles. Default is 2.
  4218. @item width_type, t
  4219. Set method to specify band-width of filter.
  4220. @table @option
  4221. @item h
  4222. Hz
  4223. @item q
  4224. Q-Factor
  4225. @item o
  4226. octave
  4227. @item s
  4228. slope
  4229. @item k
  4230. kHz
  4231. @end table
  4232. @item width, w
  4233. Specify the band-width of a filter in width_type units.
  4234. Applies only to double-pole filter.
  4235. The default is 0.707q and gives a Butterworth response.
  4236. @item mix, m
  4237. How much to use filtered signal in output. Default is 1.
  4238. Range is between 0 and 1.
  4239. @item channels, c
  4240. Specify which channels to filter, by default all available are filtered.
  4241. @item normalize, n
  4242. Normalize biquad coefficients, by default is disabled.
  4243. Enabling it will normalize magnitude response at DC to 0dB.
  4244. @item transform, a
  4245. Set transform type of IIR filter.
  4246. @table @option
  4247. @item di
  4248. @item dii
  4249. @item tdi
  4250. @item tdii
  4251. @item latt
  4252. @item svf
  4253. @item zdf
  4254. @end table
  4255. @item precision, r
  4256. Set precison of filtering.
  4257. @table @option
  4258. @item auto
  4259. Pick automatic sample format depending on surround filters.
  4260. @item s16
  4261. Always use signed 16-bit.
  4262. @item s32
  4263. Always use signed 32-bit.
  4264. @item f32
  4265. Always use float 32-bit.
  4266. @item f64
  4267. Always use float 64-bit.
  4268. @end table
  4269. @item block_size, b
  4270. Set block size used for reverse IIR processing. If this value is set to high enough
  4271. value (higher than impulse response length truncated when reaches near zero values) filtering
  4272. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4273. Note that filter delay will be exactly this many samples when set to non-zero value.
  4274. @end table
  4275. @subsection Commands
  4276. This filter supports the following commands:
  4277. @table @option
  4278. @item frequency, f
  4279. Change highpass frequency.
  4280. Syntax for the command is : "@var{frequency}"
  4281. @item width_type, t
  4282. Change highpass width_type.
  4283. Syntax for the command is : "@var{width_type}"
  4284. @item width, w
  4285. Change highpass width.
  4286. Syntax for the command is : "@var{width}"
  4287. @item mix, m
  4288. Change highpass mix.
  4289. Syntax for the command is : "@var{mix}"
  4290. @end table
  4291. @section join
  4292. Join multiple input streams into one multi-channel stream.
  4293. It accepts the following parameters:
  4294. @table @option
  4295. @item inputs
  4296. The number of input streams. It defaults to 2.
  4297. @item channel_layout
  4298. The desired output channel layout. It defaults to stereo.
  4299. @item map
  4300. Map channels from inputs to output. The argument is a '|'-separated list of
  4301. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  4302. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  4303. can be either the name of the input channel (e.g. FL for front left) or its
  4304. index in the specified input stream. @var{out_channel} is the name of the output
  4305. channel.
  4306. @end table
  4307. The filter will attempt to guess the mappings when they are not specified
  4308. explicitly. It does so by first trying to find an unused matching input channel
  4309. and if that fails it picks the first unused input channel.
  4310. Join 3 inputs (with properly set channel layouts):
  4311. @example
  4312. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  4313. @end example
  4314. Build a 5.1 output from 6 single-channel streams:
  4315. @example
  4316. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  4317. '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'
  4318. out
  4319. @end example
  4320. @section ladspa
  4321. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  4322. To enable compilation of this filter you need to configure FFmpeg with
  4323. @code{--enable-ladspa}.
  4324. @table @option
  4325. @item file, f
  4326. Specifies the name of LADSPA plugin library to load. If the environment
  4327. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  4328. each one of the directories specified by the colon separated list in
  4329. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  4330. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  4331. @file{/usr/lib/ladspa/}.
  4332. @item plugin, p
  4333. Specifies the plugin within the library. Some libraries contain only
  4334. one plugin, but others contain many of them. If this is not set filter
  4335. will list all available plugins within the specified library.
  4336. @item controls, c
  4337. Set the '|' separated list of controls which are zero or more floating point
  4338. values that determine the behavior of the loaded plugin (for example delay,
  4339. threshold or gain).
  4340. Controls need to be defined using the following syntax:
  4341. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  4342. @var{valuei} is the value set on the @var{i}-th control.
  4343. Alternatively they can be also defined using the following syntax:
  4344. @var{value0}|@var{value1}|@var{value2}|..., where
  4345. @var{valuei} is the value set on the @var{i}-th control.
  4346. If @option{controls} is set to @code{help}, all available controls and
  4347. their valid ranges are printed.
  4348. @item sample_rate, s
  4349. Specify the sample rate, default to 44100. Only used if plugin have
  4350. zero inputs.
  4351. @item nb_samples, n
  4352. Set the number of samples per channel per each output frame, default
  4353. is 1024. Only used if plugin have zero inputs.
  4354. @item duration, d
  4355. Set the minimum duration of the sourced audio. See
  4356. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4357. for the accepted syntax.
  4358. Note that the resulting duration may be greater than the specified duration,
  4359. as the generated audio is always cut at the end of a complete frame.
  4360. If not specified, or the expressed duration is negative, the audio is
  4361. supposed to be generated forever.
  4362. Only used if plugin have zero inputs.
  4363. @item latency, l
  4364. Enable latency compensation, by default is disabled.
  4365. Only used if plugin have inputs.
  4366. @end table
  4367. @subsection Examples
  4368. @itemize
  4369. @item
  4370. List all available plugins within amp (LADSPA example plugin) library:
  4371. @example
  4372. ladspa=file=amp
  4373. @end example
  4374. @item
  4375. List all available controls and their valid ranges for @code{vcf_notch}
  4376. plugin from @code{VCF} library:
  4377. @example
  4378. ladspa=f=vcf:p=vcf_notch:c=help
  4379. @end example
  4380. @item
  4381. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4382. plugin library:
  4383. @example
  4384. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4385. @end example
  4386. @item
  4387. Add reverberation to the audio using TAP-plugins
  4388. (Tom's Audio Processing plugins):
  4389. @example
  4390. ladspa=file=tap_reverb:tap_reverb
  4391. @end example
  4392. @item
  4393. Generate white noise, with 0.2 amplitude:
  4394. @example
  4395. ladspa=file=cmt:noise_source_white:c=c0=.2
  4396. @end example
  4397. @item
  4398. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4399. @code{C* Audio Plugin Suite} (CAPS) library:
  4400. @example
  4401. ladspa=file=caps:Click:c=c1=20'
  4402. @end example
  4403. @item
  4404. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4405. @example
  4406. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4407. @end example
  4408. @item
  4409. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4410. @code{SWH Plugins} collection:
  4411. @example
  4412. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4413. @end example
  4414. @item
  4415. Attenuate low frequencies using Multiband EQ from Steve Harris
  4416. @code{SWH Plugins} collection:
  4417. @example
  4418. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4419. @end example
  4420. @item
  4421. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4422. (CAPS) library:
  4423. @example
  4424. ladspa=caps:Narrower
  4425. @end example
  4426. @item
  4427. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4428. @example
  4429. ladspa=caps:White:.2
  4430. @end example
  4431. @item
  4432. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4433. @example
  4434. ladspa=caps:Fractal:c=c1=1
  4435. @end example
  4436. @item
  4437. Dynamic volume normalization using @code{VLevel} plugin:
  4438. @example
  4439. ladspa=vlevel-ladspa:vlevel_mono
  4440. @end example
  4441. @end itemize
  4442. @subsection Commands
  4443. This filter supports the following commands:
  4444. @table @option
  4445. @item cN
  4446. Modify the @var{N}-th control value.
  4447. If the specified value is not valid, it is ignored and prior one is kept.
  4448. @end table
  4449. @section loudnorm
  4450. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4451. Support for both single pass (livestreams, files) and double pass (files) modes.
  4452. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4453. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4454. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4455. The filter accepts the following options:
  4456. @table @option
  4457. @item I, i
  4458. Set integrated loudness target.
  4459. Range is -70.0 - -5.0. Default value is -24.0.
  4460. @item LRA, lra
  4461. Set loudness range target.
  4462. Range is 1.0 - 50.0. Default value is 7.0.
  4463. @item TP, tp
  4464. Set maximum true peak.
  4465. Range is -9.0 - +0.0. Default value is -2.0.
  4466. @item measured_I, measured_i
  4467. Measured IL of input file.
  4468. Range is -99.0 - +0.0.
  4469. @item measured_LRA, measured_lra
  4470. Measured LRA of input file.
  4471. Range is 0.0 - 99.0.
  4472. @item measured_TP, measured_tp
  4473. Measured true peak of input file.
  4474. Range is -99.0 - +99.0.
  4475. @item measured_thresh
  4476. Measured threshold of input file.
  4477. Range is -99.0 - +0.0.
  4478. @item offset
  4479. Set offset gain. Gain is applied before the true-peak limiter.
  4480. Range is -99.0 - +99.0. Default is +0.0.
  4481. @item linear
  4482. Normalize by linearly scaling the source audio.
  4483. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4484. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4485. be lower than source LRA and the change in integrated loudness shouldn't
  4486. result in a true peak which exceeds the target TP. If any of these
  4487. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4488. Options are @code{true} or @code{false}. Default is @code{true}.
  4489. @item dual_mono
  4490. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4491. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4492. If set to @code{true}, this option will compensate for this effect.
  4493. Multi-channel input files are not affected by this option.
  4494. Options are true or false. Default is false.
  4495. @item print_format
  4496. Set print format for stats. Options are summary, json, or none.
  4497. Default value is none.
  4498. @end table
  4499. @section lowpass
  4500. Apply a low-pass filter with 3dB point frequency.
  4501. The filter can be either single-pole or double-pole (the default).
  4502. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4503. The filter accepts the following options:
  4504. @table @option
  4505. @item frequency, f
  4506. Set frequency in Hz. Default is 500.
  4507. @item poles, p
  4508. Set number of poles. Default is 2.
  4509. @item width_type, t
  4510. Set method to specify band-width of filter.
  4511. @table @option
  4512. @item h
  4513. Hz
  4514. @item q
  4515. Q-Factor
  4516. @item o
  4517. octave
  4518. @item s
  4519. slope
  4520. @item k
  4521. kHz
  4522. @end table
  4523. @item width, w
  4524. Specify the band-width of a filter in width_type units.
  4525. Applies only to double-pole filter.
  4526. The default is 0.707q and gives a Butterworth response.
  4527. @item mix, m
  4528. How much to use filtered signal in output. Default is 1.
  4529. Range is between 0 and 1.
  4530. @item channels, c
  4531. Specify which channels to filter, by default all available are filtered.
  4532. @item normalize, n
  4533. Normalize biquad coefficients, by default is disabled.
  4534. Enabling it will normalize magnitude response at DC to 0dB.
  4535. @item transform, a
  4536. Set transform type of IIR filter.
  4537. @table @option
  4538. @item di
  4539. @item dii
  4540. @item tdi
  4541. @item tdii
  4542. @item latt
  4543. @item svf
  4544. @item zdf
  4545. @end table
  4546. @item precision, r
  4547. Set precison of filtering.
  4548. @table @option
  4549. @item auto
  4550. Pick automatic sample format depending on surround filters.
  4551. @item s16
  4552. Always use signed 16-bit.
  4553. @item s32
  4554. Always use signed 32-bit.
  4555. @item f32
  4556. Always use float 32-bit.
  4557. @item f64
  4558. Always use float 64-bit.
  4559. @end table
  4560. @item block_size, b
  4561. Set block size used for reverse IIR processing. If this value is set to high enough
  4562. value (higher than impulse response length truncated when reaches near zero values) filtering
  4563. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4564. Note that filter delay will be exactly this many samples when set to non-zero value.
  4565. @end table
  4566. @subsection Examples
  4567. @itemize
  4568. @item
  4569. Lowpass only LFE channel, it LFE is not present it does nothing:
  4570. @example
  4571. lowpass=c=LFE
  4572. @end example
  4573. @end itemize
  4574. @subsection Commands
  4575. This filter supports the following commands:
  4576. @table @option
  4577. @item frequency, f
  4578. Change lowpass frequency.
  4579. Syntax for the command is : "@var{frequency}"
  4580. @item width_type, t
  4581. Change lowpass width_type.
  4582. Syntax for the command is : "@var{width_type}"
  4583. @item width, w
  4584. Change lowpass width.
  4585. Syntax for the command is : "@var{width}"
  4586. @item mix, m
  4587. Change lowpass mix.
  4588. Syntax for the command is : "@var{mix}"
  4589. @end table
  4590. @section lv2
  4591. Load a LV2 (LADSPA Version 2) plugin.
  4592. To enable compilation of this filter you need to configure FFmpeg with
  4593. @code{--enable-lv2}.
  4594. @table @option
  4595. @item plugin, p
  4596. Specifies the plugin URI. You may need to escape ':'.
  4597. @item controls, c
  4598. Set the '|' separated list of controls which are zero or more floating point
  4599. values that determine the behavior of the loaded plugin (for example delay,
  4600. threshold or gain).
  4601. If @option{controls} is set to @code{help}, all available controls and
  4602. their valid ranges are printed.
  4603. @item sample_rate, s
  4604. Specify the sample rate, default to 44100. Only used if plugin have
  4605. zero inputs.
  4606. @item nb_samples, n
  4607. Set the number of samples per channel per each output frame, default
  4608. is 1024. Only used if plugin have zero inputs.
  4609. @item duration, d
  4610. Set the minimum duration of the sourced audio. See
  4611. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4612. for the accepted syntax.
  4613. Note that the resulting duration may be greater than the specified duration,
  4614. as the generated audio is always cut at the end of a complete frame.
  4615. If not specified, or the expressed duration is negative, the audio is
  4616. supposed to be generated forever.
  4617. Only used if plugin have zero inputs.
  4618. @end table
  4619. @subsection Examples
  4620. @itemize
  4621. @item
  4622. Apply bass enhancer plugin from Calf:
  4623. @example
  4624. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4625. @end example
  4626. @item
  4627. Apply vinyl plugin from Calf:
  4628. @example
  4629. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4630. @end example
  4631. @item
  4632. Apply bit crusher plugin from ArtyFX:
  4633. @example
  4634. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4635. @end example
  4636. @end itemize
  4637. @subsection Commands
  4638. This filter supports all options that are exported by plugin as commands.
  4639. @section mcompand
  4640. Multiband Compress or expand the audio's dynamic range.
  4641. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4642. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4643. response when absent compander action.
  4644. It accepts the following parameters:
  4645. @table @option
  4646. @item args
  4647. This option syntax is:
  4648. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4649. For explanation of each item refer to compand filter documentation.
  4650. @end table
  4651. @anchor{pan}
  4652. @section pan
  4653. Mix channels with specific gain levels. The filter accepts the output
  4654. channel layout followed by a set of channels definitions.
  4655. This filter is also designed to efficiently remap the channels of an audio
  4656. stream.
  4657. The filter accepts parameters of the form:
  4658. "@var{l}|@var{outdef}|@var{outdef}|..."
  4659. @table @option
  4660. @item l
  4661. output channel layout or number of channels
  4662. @item outdef
  4663. output channel specification, of the form:
  4664. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4665. @item out_name
  4666. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4667. number (c0, c1, etc.)
  4668. @item gain
  4669. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4670. @item in_name
  4671. input channel to use, see out_name for details; it is not possible to mix
  4672. named and numbered input channels
  4673. @end table
  4674. If the `=' in a channel specification is replaced by `<', then the gains for
  4675. that specification will be renormalized so that the total is 1, thus
  4676. avoiding clipping noise.
  4677. @subsection Mixing examples
  4678. For example, if you want to down-mix from stereo to mono, but with a bigger
  4679. factor for the left channel:
  4680. @example
  4681. pan=1c|c0=0.9*c0+0.1*c1
  4682. @end example
  4683. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4684. 7-channels surround:
  4685. @example
  4686. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4687. @end example
  4688. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4689. that should be preferred (see "-ac" option) unless you have very specific
  4690. needs.
  4691. @subsection Remapping examples
  4692. The channel remapping will be effective if, and only if:
  4693. @itemize
  4694. @item gain coefficients are zeroes or ones,
  4695. @item only one input per channel output,
  4696. @end itemize
  4697. If all these conditions are satisfied, the filter will notify the user ("Pure
  4698. channel mapping detected"), and use an optimized and lossless method to do the
  4699. remapping.
  4700. For example, if you have a 5.1 source and want a stereo audio stream by
  4701. dropping the extra channels:
  4702. @example
  4703. pan="stereo| c0=FL | c1=FR"
  4704. @end example
  4705. Given the same source, you can also switch front left and front right channels
  4706. and keep the input channel layout:
  4707. @example
  4708. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4709. @end example
  4710. If the input is a stereo audio stream, you can mute the front left channel (and
  4711. still keep the stereo channel layout) with:
  4712. @example
  4713. pan="stereo|c1=c1"
  4714. @end example
  4715. Still with a stereo audio stream input, you can copy the right channel in both
  4716. front left and right:
  4717. @example
  4718. pan="stereo| c0=FR | c1=FR"
  4719. @end example
  4720. @section replaygain
  4721. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4722. outputs it unchanged.
  4723. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4724. The filter accepts the following exported read-only options:
  4725. @table @option
  4726. @item track_gain
  4727. Exported track gain in dB at end of stream.
  4728. @item track_peak
  4729. Exported track peak at end of stream.
  4730. @end table
  4731. @section resample
  4732. Convert the audio sample format, sample rate and channel layout. It is
  4733. not meant to be used directly.
  4734. @section rubberband
  4735. Apply time-stretching and pitch-shifting with librubberband.
  4736. To enable compilation of this filter, you need to configure FFmpeg with
  4737. @code{--enable-librubberband}.
  4738. The filter accepts the following options:
  4739. @table @option
  4740. @item tempo
  4741. Set tempo scale factor.
  4742. @item pitch
  4743. Set pitch scale factor.
  4744. @item transients
  4745. Set transients detector.
  4746. Possible values are:
  4747. @table @var
  4748. @item crisp
  4749. @item mixed
  4750. @item smooth
  4751. @end table
  4752. @item detector
  4753. Set detector.
  4754. Possible values are:
  4755. @table @var
  4756. @item compound
  4757. @item percussive
  4758. @item soft
  4759. @end table
  4760. @item phase
  4761. Set phase.
  4762. Possible values are:
  4763. @table @var
  4764. @item laminar
  4765. @item independent
  4766. @end table
  4767. @item window
  4768. Set processing window size.
  4769. Possible values are:
  4770. @table @var
  4771. @item standard
  4772. @item short
  4773. @item long
  4774. @end table
  4775. @item smoothing
  4776. Set smoothing.
  4777. Possible values are:
  4778. @table @var
  4779. @item off
  4780. @item on
  4781. @end table
  4782. @item formant
  4783. Enable formant preservation when shift pitching.
  4784. Possible values are:
  4785. @table @var
  4786. @item shifted
  4787. @item preserved
  4788. @end table
  4789. @item pitchq
  4790. Set pitch quality.
  4791. Possible values are:
  4792. @table @var
  4793. @item quality
  4794. @item speed
  4795. @item consistency
  4796. @end table
  4797. @item channels
  4798. Set channels.
  4799. Possible values are:
  4800. @table @var
  4801. @item apart
  4802. @item together
  4803. @end table
  4804. @end table
  4805. @subsection Commands
  4806. This filter supports the following commands:
  4807. @table @option
  4808. @item tempo
  4809. Change filter tempo scale factor.
  4810. Syntax for the command is : "@var{tempo}"
  4811. @item pitch
  4812. Change filter pitch scale factor.
  4813. Syntax for the command is : "@var{pitch}"
  4814. @end table
  4815. @section sidechaincompress
  4816. This filter acts like normal compressor but has the ability to compress
  4817. detected signal using second input signal.
  4818. It needs two input streams and returns one output stream.
  4819. First input stream will be processed depending on second stream signal.
  4820. The filtered signal then can be filtered with other filters in later stages of
  4821. processing. See @ref{pan} and @ref{amerge} filter.
  4822. The filter accepts the following options:
  4823. @table @option
  4824. @item level_in
  4825. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4826. @item mode
  4827. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4828. Default is @code{downward}.
  4829. @item threshold
  4830. If a signal of second stream raises above this level it will affect the gain
  4831. reduction of first stream.
  4832. By default is 0.125. Range is between 0.00097563 and 1.
  4833. @item ratio
  4834. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4835. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4836. Default is 2. Range is between 1 and 20.
  4837. @item attack
  4838. Amount of milliseconds the signal has to rise above the threshold before gain
  4839. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4840. @item release
  4841. Amount of milliseconds the signal has to fall below the threshold before
  4842. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4843. @item makeup
  4844. Set the amount by how much signal will be amplified after processing.
  4845. Default is 1. Range is from 1 to 64.
  4846. @item knee
  4847. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4848. Default is 2.82843. Range is between 1 and 8.
  4849. @item link
  4850. Choose if the @code{average} level between all channels of side-chain stream
  4851. or the louder(@code{maximum}) channel of side-chain stream affects the
  4852. reduction. Default is @code{average}.
  4853. @item detection
  4854. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4855. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4856. @item level_sc
  4857. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4858. @item mix
  4859. How much to use compressed signal in output. Default is 1.
  4860. Range is between 0 and 1.
  4861. @end table
  4862. @subsection Commands
  4863. This filter supports the all above options as @ref{commands}.
  4864. @subsection Examples
  4865. @itemize
  4866. @item
  4867. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4868. depending on the signal of 2nd input and later compressed signal to be
  4869. merged with 2nd input:
  4870. @example
  4871. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4872. @end example
  4873. @end itemize
  4874. @section sidechaingate
  4875. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4876. filter the detected signal before sending it to the gain reduction stage.
  4877. Normally a gate uses the full range signal to detect a level above the
  4878. threshold.
  4879. For example: If you cut all lower frequencies from your sidechain signal
  4880. the gate will decrease the volume of your track only if not enough highs
  4881. appear. With this technique you are able to reduce the resonation of a
  4882. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4883. guitar.
  4884. It needs two input streams and returns one output stream.
  4885. First input stream will be processed depending on second stream signal.
  4886. The filter accepts the following options:
  4887. @table @option
  4888. @item level_in
  4889. Set input level before filtering.
  4890. Default is 1. Allowed range is from 0.015625 to 64.
  4891. @item mode
  4892. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4893. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4894. will be amplified, expanding dynamic range in upward direction.
  4895. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4896. @item range
  4897. Set the level of gain reduction when the signal is below the threshold.
  4898. Default is 0.06125. Allowed range is from 0 to 1.
  4899. Setting this to 0 disables reduction and then filter behaves like expander.
  4900. @item threshold
  4901. If a signal rises above this level the gain reduction is released.
  4902. Default is 0.125. Allowed range is from 0 to 1.
  4903. @item ratio
  4904. Set a ratio about which the signal is reduced.
  4905. Default is 2. Allowed range is from 1 to 9000.
  4906. @item attack
  4907. Amount of milliseconds the signal has to rise above the threshold before gain
  4908. reduction stops.
  4909. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4910. @item release
  4911. Amount of milliseconds the signal has to fall below the threshold before the
  4912. reduction is increased again. Default is 250 milliseconds.
  4913. Allowed range is from 0.01 to 9000.
  4914. @item makeup
  4915. Set amount of amplification of signal after processing.
  4916. Default is 1. Allowed range is from 1 to 64.
  4917. @item knee
  4918. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4919. Default is 2.828427125. Allowed range is from 1 to 8.
  4920. @item detection
  4921. Choose if exact signal should be taken for detection or an RMS like one.
  4922. Default is rms. Can be peak or rms.
  4923. @item link
  4924. Choose if the average level between all channels or the louder channel affects
  4925. the reduction.
  4926. Default is average. Can be average or maximum.
  4927. @item level_sc
  4928. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4929. @end table
  4930. @subsection Commands
  4931. This filter supports the all above options as @ref{commands}.
  4932. @section silencedetect
  4933. Detect silence in an audio stream.
  4934. This filter logs a message when it detects that the input audio volume is less
  4935. or equal to a noise tolerance value for a duration greater or equal to the
  4936. minimum detected noise duration.
  4937. The printed times and duration are expressed in seconds. The
  4938. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4939. is set on the first frame whose timestamp equals or exceeds the detection
  4940. duration and it contains the timestamp of the first frame of the silence.
  4941. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4942. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4943. keys are set on the first frame after the silence. If @option{mono} is
  4944. enabled, and each channel is evaluated separately, the @code{.X}
  4945. suffixed keys are used, and @code{X} corresponds to the channel number.
  4946. The filter accepts the following options:
  4947. @table @option
  4948. @item noise, n
  4949. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4950. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4951. @item duration, d
  4952. Set silence duration until notification (default is 2 seconds). See
  4953. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4954. for the accepted syntax.
  4955. @item mono, m
  4956. Process each channel separately, instead of combined. By default is disabled.
  4957. @end table
  4958. @subsection Examples
  4959. @itemize
  4960. @item
  4961. Detect 5 seconds of silence with -50dB noise tolerance:
  4962. @example
  4963. silencedetect=n=-50dB:d=5
  4964. @end example
  4965. @item
  4966. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4967. tolerance in @file{silence.mp3}:
  4968. @example
  4969. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4970. @end example
  4971. @end itemize
  4972. @section silenceremove
  4973. Remove silence from the beginning, middle or end of the audio.
  4974. The filter accepts the following options:
  4975. @table @option
  4976. @item start_periods
  4977. This value is used to indicate if audio should be trimmed at beginning of
  4978. the audio. A value of zero indicates no silence should be trimmed from the
  4979. beginning. When specifying a non-zero value, it trims audio up until it
  4980. finds non-silence. Normally, when trimming silence from beginning of audio
  4981. the @var{start_periods} will be @code{1} but it can be increased to higher
  4982. values to trim all audio up to specific count of non-silence periods.
  4983. Default value is @code{0}.
  4984. @item start_duration
  4985. Specify the amount of time that non-silence must be detected before it stops
  4986. trimming audio. By increasing the duration, bursts of noises can be treated
  4987. as silence and trimmed off. Default value is @code{0}.
  4988. @item start_threshold
  4989. This indicates what sample value should be treated as silence. For digital
  4990. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4991. you may wish to increase the value to account for background noise.
  4992. Can be specified in dB (in case "dB" is appended to the specified value)
  4993. or amplitude ratio. Default value is @code{0}.
  4994. @item start_silence
  4995. Specify max duration of silence at beginning that will be kept after
  4996. trimming. Default is 0, which is equal to trimming all samples detected
  4997. as silence.
  4998. @item start_mode
  4999. Specify mode of detection of silence end at start of multi-channel audio.
  5000. Can be @var{any} or @var{all}. Default is @var{any}.
  5001. With @var{any}, any sample from any channel that is detected as non-silence
  5002. will trigger end of silence trimming at start of audio stream.
  5003. With @var{all}, only if every sample from every channel is detected as non-silence
  5004. will trigger end of silence trimming at start of audio stream, limited usage.
  5005. @item stop_periods
  5006. Set the count for trimming silence from the end of audio. When specifying a
  5007. positive value, it trims audio after it finds specified silence period.
  5008. To remove silence from the middle of a file, specify a @var{stop_periods}
  5009. that is negative. This value is then treated as a positive value and is
  5010. used to indicate the effect should restart processing as specified by
  5011. @var{stop_periods}, making it suitable for removing periods of silence
  5012. in the middle of the audio.
  5013. Default value is @code{0}.
  5014. @item stop_duration
  5015. Specify a duration of silence that must exist before audio is not copied any
  5016. more. By specifying a higher duration, silence that is wanted can be left in
  5017. the audio.
  5018. Default value is @code{0}.
  5019. @item stop_threshold
  5020. This is the same as @option{start_threshold} but for trimming silence from
  5021. the end of audio.
  5022. Can be specified in dB (in case "dB" is appended to the specified value)
  5023. or amplitude ratio. Default value is @code{0}.
  5024. @item stop_silence
  5025. Specify max duration of silence at end that will be kept after
  5026. trimming. Default is 0, which is equal to trimming all samples detected
  5027. as silence.
  5028. @item stop_mode
  5029. Specify mode of detection of silence start after start of multi-channel audio.
  5030. Can be @var{any} or @var{all}. Default is @var{all}.
  5031. With @var{any}, any sample from any channel that is detected as silence
  5032. will trigger start of silence trimming after start of audio stream, limited usage.
  5033. With @var{all}, only if every sample from every channel is detected as silence
  5034. will trigger start of silence trimming after start of audio stream.
  5035. @item detection
  5036. Set how is silence detected.
  5037. @table @option
  5038. @item avg
  5039. Mean of absolute values of samples in moving window.
  5040. @item rms
  5041. Root squared mean of absolute values of samples in moving window.
  5042. @item peak
  5043. Maximum of absolute values of samples in moving window.
  5044. @item median
  5045. Median of absolute values of samples in moving window.
  5046. @item ptp
  5047. Absolute of max peak to min peak difference of samples in moving window.
  5048. @item dev
  5049. Standard deviation of values of samples in moving window.
  5050. @end table
  5051. Default value is @code{rms}.
  5052. @item window
  5053. Set duration in number of seconds used to calculate size of window in number
  5054. of samples for detecting silence. Using @code{0} will effectively disable
  5055. any windowing and use only single sample per channel for silence detection.
  5056. In that case it may be needed to also set @option{start_silence} and/or
  5057. @option{stop_silence} to nonzero values with also @option{start_duration} and/or
  5058. @option{stop_duration} to nonzero values.
  5059. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  5060. @item timestamp
  5061. Set processing mode of every audio frame output timestamp.
  5062. @table @option
  5063. @item write
  5064. Full timestamps rewrite, keep only the start time for the first output frame.
  5065. @item copy
  5066. Non-dropped frames are left with same timestamp as input audio frame.
  5067. @end table
  5068. Defaults value is @code{write}.
  5069. @end table
  5070. @subsection Examples
  5071. @itemize
  5072. @item
  5073. The following example shows how this filter can be used to start a recording
  5074. that does not contain the delay at the start which usually occurs between
  5075. pressing the record button and the start of the performance:
  5076. @example
  5077. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  5078. @end example
  5079. @item
  5080. Trim all silence encountered from beginning to end where there is more than 1
  5081. second of silence in audio:
  5082. @example
  5083. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  5084. @end example
  5085. @item
  5086. Trim all digital silence samples, using peak detection, from beginning to end
  5087. where there is more than 0 samples of digital silence in audio and digital
  5088. silence is detected in all channels at same positions in stream:
  5089. @example
  5090. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  5091. @end example
  5092. @item
  5093. Trim every 2nd encountered silence period from beginning to end where there is
  5094. more than 1 second of silence per silence period in audio:
  5095. @example
  5096. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB
  5097. @end example
  5098. @item
  5099. Similar as above, but keep maximum of 0.5 seconds of silence from each trimmed period:
  5100. @example
  5101. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB:stop_silence=0.5
  5102. @end example
  5103. @item
  5104. Similar as above, but keep maximum of 1.5 seconds of silence from start of audio:
  5105. @example
  5106. 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
  5107. @end example
  5108. @end itemize
  5109. @subsection Commands
  5110. This filter supports some above options as @ref{commands}.
  5111. @section sofalizer
  5112. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  5113. loudspeakers around the user for binaural listening via headphones (audio
  5114. formats up to 9 channels supported).
  5115. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  5116. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  5117. Austrian Academy of Sciences.
  5118. To enable compilation of this filter you need to configure FFmpeg with
  5119. @code{--enable-libmysofa}.
  5120. The filter accepts the following options:
  5121. @table @option
  5122. @item sofa
  5123. Set the SOFA file used for rendering.
  5124. @item gain
  5125. Set gain applied to audio. Value is in dB. Default is 0.
  5126. @item rotation
  5127. Set rotation of virtual loudspeakers in deg. Default is 0.
  5128. @item elevation
  5129. Set elevation of virtual speakers in deg. Default is 0.
  5130. @item radius
  5131. Set distance in meters between loudspeakers and the listener with near-field
  5132. HRTFs. Default is 1.
  5133. @item type
  5134. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  5135. processing audio in time domain which is slow.
  5136. @var{freq} is processing audio in frequency domain which is fast.
  5137. Default is @var{freq}.
  5138. @item speakers
  5139. Set custom positions of virtual loudspeakers. Syntax for this option is:
  5140. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  5141. Each virtual loudspeaker is described with short channel name following with
  5142. azimuth and elevation in degrees.
  5143. Each virtual loudspeaker description is separated by '|'.
  5144. For example to override front left and front right channel positions use:
  5145. 'speakers=FL 45 15|FR 345 15'.
  5146. Descriptions with unrecognised channel names are ignored.
  5147. @item lfegain
  5148. Set custom gain for LFE channels. Value is in dB. Default is 0.
  5149. @item framesize
  5150. Set custom frame size in number of samples. Default is 1024.
  5151. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  5152. is set to @var{freq}.
  5153. @item normalize
  5154. Should all IRs be normalized upon importing SOFA file.
  5155. By default is enabled.
  5156. @item interpolate
  5157. Should nearest IRs be interpolated with neighbor IRs if exact position
  5158. does not match. By default is disabled.
  5159. @item minphase
  5160. Minphase all IRs upon loading of SOFA file. By default is disabled.
  5161. @item anglestep
  5162. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  5163. @item radstep
  5164. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  5165. @end table
  5166. @subsection Examples
  5167. @itemize
  5168. @item
  5169. Using ClubFritz6 sofa file:
  5170. @example
  5171. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  5172. @end example
  5173. @item
  5174. Using ClubFritz12 sofa file and bigger radius with small rotation:
  5175. @example
  5176. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  5177. @end example
  5178. @item
  5179. Similar as above but with custom speaker positions for front left, front right, back left and back right
  5180. and also with custom gain:
  5181. @example
  5182. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  5183. @end example
  5184. @end itemize
  5185. @section speechnorm
  5186. Speech Normalizer.
  5187. This filter expands or compresses each half-cycle of audio samples
  5188. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  5189. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  5190. The filter accepts the following options:
  5191. @table @option
  5192. @item peak, p
  5193. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  5194. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  5195. @item expansion, e
  5196. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5197. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  5198. would be such that local peak value reaches target peak value but never to surpass it and that
  5199. ratio between new and previous peak value does not surpass this option value.
  5200. @item compression, c
  5201. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5202. This option controls maximum local half-cycle of samples compression. This option is used
  5203. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  5204. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  5205. that peak's half-cycle will be compressed by current compression factor.
  5206. @item threshold, t
  5207. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  5208. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  5209. Any half-cycle samples with their local peak value below or same as this option value will be
  5210. compressed by current compression factor, otherwise, if greater than threshold value they will be
  5211. expanded with expansion factor so that it could reach peak target value but never surpass it.
  5212. @item raise, r
  5213. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  5214. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  5215. each new half-cycle until it reaches @option{expansion} value.
  5216. Setting this options too high may lead to distortions.
  5217. @item fall, f
  5218. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  5219. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  5220. each new half-cycle until it reaches @option{compression} value.
  5221. @item channels, h
  5222. Specify which channels to filter, by default all available channels are filtered.
  5223. @item invert, i
  5224. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  5225. option. When enabled any half-cycle of samples with their local peak value below or same as
  5226. @option{threshold} option will be expanded otherwise it will be compressed.
  5227. @item link, l
  5228. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  5229. When disabled each filtered channel gain calculation is independent, otherwise when this option
  5230. is enabled the minimum of all possible gains for each filtered channel is used.
  5231. @item rms, m
  5232. Set the expansion target RMS value. This specifies the highest allowed RMS level for the normalized
  5233. audio input. Default value is 0.0, thus disabled. Allowed range is from 0.0 to 1.0.
  5234. @end table
  5235. @subsection Commands
  5236. This filter supports the all above options as @ref{commands}.
  5237. @subsection Examples
  5238. @itemize
  5239. @item
  5240. Weak and slow amplification:
  5241. @example
  5242. speechnorm=e=3:r=0.00001:l=1
  5243. @end example
  5244. @item
  5245. Moderate and slow amplification:
  5246. @example
  5247. speechnorm=e=6.25:r=0.00001:l=1
  5248. @end example
  5249. @item
  5250. Strong and fast amplification:
  5251. @example
  5252. speechnorm=e=12.5:r=0.0001:l=1
  5253. @end example
  5254. @item
  5255. Very strong and fast amplification:
  5256. @example
  5257. speechnorm=e=25:r=0.0001:l=1
  5258. @end example
  5259. @item
  5260. Extreme and fast amplification:
  5261. @example
  5262. speechnorm=e=50:r=0.0001:l=1
  5263. @end example
  5264. @end itemize
  5265. @section stereotools
  5266. This filter has some handy utilities to manage stereo signals, for converting
  5267. M/S stereo recordings to L/R signal while having control over the parameters
  5268. or spreading the stereo image of master track.
  5269. The filter accepts the following options:
  5270. @table @option
  5271. @item level_in
  5272. Set input level before filtering for both channels. Defaults is 1.
  5273. Allowed range is from 0.015625 to 64.
  5274. @item level_out
  5275. Set output level after filtering for both channels. Defaults is 1.
  5276. Allowed range is from 0.015625 to 64.
  5277. @item balance_in
  5278. Set input balance between both channels. Default is 0.
  5279. Allowed range is from -1 to 1.
  5280. @item balance_out
  5281. Set output balance between both channels. Default is 0.
  5282. Allowed range is from -1 to 1.
  5283. @item softclip
  5284. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  5285. clipping. Disabled by default.
  5286. @item mutel
  5287. Mute the left channel. Disabled by default.
  5288. @item muter
  5289. Mute the right channel. Disabled by default.
  5290. @item phasel
  5291. Change the phase of the left channel. Disabled by default.
  5292. @item phaser
  5293. Change the phase of the right channel. Disabled by default.
  5294. @item mode
  5295. Set stereo mode. Available values are:
  5296. @table @samp
  5297. @item lr>lr
  5298. Left/Right to Left/Right, this is default.
  5299. @item lr>ms
  5300. Left/Right to Mid/Side.
  5301. @item ms>lr
  5302. Mid/Side to Left/Right.
  5303. @item lr>ll
  5304. Left/Right to Left/Left.
  5305. @item lr>rr
  5306. Left/Right to Right/Right.
  5307. @item lr>l+r
  5308. Left/Right to Left + Right.
  5309. @item lr>rl
  5310. Left/Right to Right/Left.
  5311. @item ms>ll
  5312. Mid/Side to Left/Left.
  5313. @item ms>rr
  5314. Mid/Side to Right/Right.
  5315. @item ms>rl
  5316. Mid/Side to Right/Left.
  5317. @item lr>l-r
  5318. Left/Right to Left - Right.
  5319. @end table
  5320. @item slev
  5321. Set level of side signal. Default is 1.
  5322. Allowed range is from 0.015625 to 64.
  5323. @item sbal
  5324. Set balance of side signal. Default is 0.
  5325. Allowed range is from -1 to 1.
  5326. @item mlev
  5327. Set level of the middle signal. Default is 1.
  5328. Allowed range is from 0.015625 to 64.
  5329. @item mpan
  5330. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  5331. @item base
  5332. Set stereo base between mono and inversed channels. Default is 0.
  5333. Allowed range is from -1 to 1.
  5334. @item delay
  5335. Set delay in milliseconds how much to delay left from right channel and
  5336. vice versa. Default is 0. Allowed range is from -20 to 20.
  5337. @item sclevel
  5338. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  5339. @item phase
  5340. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  5341. @item bmode_in, bmode_out
  5342. Set balance mode for balance_in/balance_out option.
  5343. Can be one of the following:
  5344. @table @samp
  5345. @item balance
  5346. Classic balance mode. Attenuate one channel at time.
  5347. Gain is raised up to 1.
  5348. @item amplitude
  5349. Similar as classic mode above but gain is raised up to 2.
  5350. @item power
  5351. Equal power distribution, from -6dB to +6dB range.
  5352. @end table
  5353. @end table
  5354. @subsection Commands
  5355. This filter supports the all above options as @ref{commands}.
  5356. @subsection Examples
  5357. @itemize
  5358. @item
  5359. Apply karaoke like effect:
  5360. @example
  5361. stereotools=mlev=0.015625
  5362. @end example
  5363. @item
  5364. Convert M/S signal to L/R:
  5365. @example
  5366. "stereotools=mode=ms>lr"
  5367. @end example
  5368. @end itemize
  5369. @section stereowiden
  5370. This filter enhance the stereo effect by suppressing signal common to both
  5371. channels and by delaying the signal of left into right and vice versa,
  5372. thereby widening the stereo effect.
  5373. The filter accepts the following options:
  5374. @table @option
  5375. @item delay
  5376. Time in milliseconds of the delay of left signal into right and vice versa.
  5377. Default is 20 milliseconds.
  5378. @item feedback
  5379. Amount of gain in delayed signal into right and vice versa. Gives a delay
  5380. effect of left signal in right output and vice versa which gives widening
  5381. effect. Default is 0.3.
  5382. @item crossfeed
  5383. Cross feed of left into right with inverted phase. This helps in suppressing
  5384. the mono. If the value is 1 it will cancel all the signal common to both
  5385. channels. Default is 0.3.
  5386. @item drymix
  5387. Set level of input signal of original channel. Default is 0.8.
  5388. @end table
  5389. @subsection Commands
  5390. This filter supports the all above options except @code{delay} as @ref{commands}.
  5391. @section superequalizer
  5392. Apply 18 band equalizer.
  5393. The filter accepts the following options:
  5394. @table @option
  5395. @item 1b
  5396. Set 65Hz band gain.
  5397. @item 2b
  5398. Set 92Hz band gain.
  5399. @item 3b
  5400. Set 131Hz band gain.
  5401. @item 4b
  5402. Set 185Hz band gain.
  5403. @item 5b
  5404. Set 262Hz band gain.
  5405. @item 6b
  5406. Set 370Hz band gain.
  5407. @item 7b
  5408. Set 523Hz band gain.
  5409. @item 8b
  5410. Set 740Hz band gain.
  5411. @item 9b
  5412. Set 1047Hz band gain.
  5413. @item 10b
  5414. Set 1480Hz band gain.
  5415. @item 11b
  5416. Set 2093Hz band gain.
  5417. @item 12b
  5418. Set 2960Hz band gain.
  5419. @item 13b
  5420. Set 4186Hz band gain.
  5421. @item 14b
  5422. Set 5920Hz band gain.
  5423. @item 15b
  5424. Set 8372Hz band gain.
  5425. @item 16b
  5426. Set 11840Hz band gain.
  5427. @item 17b
  5428. Set 16744Hz band gain.
  5429. @item 18b
  5430. Set 20000Hz band gain.
  5431. @end table
  5432. @section surround
  5433. Apply audio surround upmix filter.
  5434. This filter allows to produce multichannel output from audio stream.
  5435. The filter accepts the following options:
  5436. @table @option
  5437. @item chl_out
  5438. Set output channel layout. By default, this is @var{5.1}.
  5439. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5440. for the required syntax.
  5441. @item chl_in
  5442. Set input channel layout. By default, this is @var{stereo}.
  5443. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5444. for the required syntax.
  5445. @item level_in
  5446. Set input volume level. By default, this is @var{1}.
  5447. @item level_out
  5448. Set output volume level. By default, this is @var{1}.
  5449. @item lfe
  5450. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5451. @item lfe_low
  5452. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5453. @item lfe_high
  5454. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5455. @item lfe_mode
  5456. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5457. In @var{add} mode, LFE channel is created from input audio and added to output.
  5458. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5459. also all non-LFE output channels are subtracted with output LFE channel.
  5460. @item smooth
  5461. Set temporal smoothness strength, used to gradually change factors when transforming
  5462. stereo sound in time. Allowed range is from @var{0.0} to @var{1.0}.
  5463. Useful to improve output quality with @var{focus} option values greater than @var{0.0}.
  5464. Default is @var{0.0}. Only values inside this range and without edges are effective.
  5465. @item angle
  5466. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5467. Default is @var{90}.
  5468. @item focus
  5469. Set focus of stereo surround transform, Allowed range is from @var{-1} to @var{1}.
  5470. Default is @var{0}.
  5471. @item fc_in
  5472. Set front center input volume. By default, this is @var{1}.
  5473. @item fc_out
  5474. Set front center output volume. By default, this is @var{1}.
  5475. @item fl_in
  5476. Set front left input volume. By default, this is @var{1}.
  5477. @item fl_out
  5478. Set front left output volume. By default, this is @var{1}.
  5479. @item fr_in
  5480. Set front right input volume. By default, this is @var{1}.
  5481. @item fr_out
  5482. Set front right output volume. By default, this is @var{1}.
  5483. @item sl_in
  5484. Set side left input volume. By default, this is @var{1}.
  5485. @item sl_out
  5486. Set side left output volume. By default, this is @var{1}.
  5487. @item sr_in
  5488. Set side right input volume. By default, this is @var{1}.
  5489. @item sr_out
  5490. Set side right output volume. By default, this is @var{1}.
  5491. @item bl_in
  5492. Set back left input volume. By default, this is @var{1}.
  5493. @item bl_out
  5494. Set back left output volume. By default, this is @var{1}.
  5495. @item br_in
  5496. Set back right input volume. By default, this is @var{1}.
  5497. @item br_out
  5498. Set back right output volume. By default, this is @var{1}.
  5499. @item bc_in
  5500. Set back center input volume. By default, this is @var{1}.
  5501. @item bc_out
  5502. Set back center output volume. By default, this is @var{1}.
  5503. @item lfe_in
  5504. Set LFE input volume. By default, this is @var{1}.
  5505. @item lfe_out
  5506. Set LFE output volume. By default, this is @var{1}.
  5507. @item allx
  5508. Set spread usage of stereo image across X axis for all channels.
  5509. Allowed range is from @var{-1} to @var{15}.
  5510. By default this value is negative @var{-1}, and thus unused.
  5511. @item ally
  5512. Set spread usage of stereo image across Y axis for all channels.
  5513. Allowed range is from @var{-1} to @var{15}.
  5514. By default this value is negative @var{-1}, and thus unused.
  5515. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5516. Set spread usage of stereo image across X axis for each channel.
  5517. Allowed range is from @var{0.06} to @var{15}.
  5518. By default this value is @var{0.5}.
  5519. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5520. Set spread usage of stereo image across Y axis for each channel.
  5521. Allowed range is from @var{0.06} to @var{15}.
  5522. By default this value is @var{0.5}.
  5523. @item win_size
  5524. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5525. @item win_func
  5526. Set window function.
  5527. It accepts the following values:
  5528. @table @samp
  5529. @item rect
  5530. @item bartlett
  5531. @item hann, hanning
  5532. @item hamming
  5533. @item blackman
  5534. @item welch
  5535. @item flattop
  5536. @item bharris
  5537. @item bnuttall
  5538. @item bhann
  5539. @item sine
  5540. @item nuttall
  5541. @item lanczos
  5542. @item gauss
  5543. @item tukey
  5544. @item dolph
  5545. @item cauchy
  5546. @item parzen
  5547. @item poisson
  5548. @item bohman
  5549. @item kaiser
  5550. @end table
  5551. Default is @code{hann}.
  5552. @item overlap
  5553. Set window overlap. If set to 1, the recommended overlap for selected
  5554. window function will be picked. Default is @code{0.5}.
  5555. @end table
  5556. @section tiltshelf
  5557. Boost or cut the lower frequencies and cut or boost higher frequencies
  5558. of the audio using a two-pole shelving filter with a response similar to
  5559. that of a standard hi-fi's tone-controls.
  5560. This is also known as shelving equalisation (EQ).
  5561. The filter accepts the following options:
  5562. @table @option
  5563. @item gain, g
  5564. Give the gain at 0 Hz. Its useful range is about -20
  5565. (for a large cut) to +20 (for a large boost).
  5566. Beware of clipping when using a positive gain.
  5567. @item frequency, f
  5568. Set the filter's central frequency and so can be used
  5569. to extend or reduce the frequency range to be boosted or cut.
  5570. The default value is @code{3000} Hz.
  5571. @item width_type, t
  5572. Set method to specify band-width of filter.
  5573. @table @option
  5574. @item h
  5575. Hz
  5576. @item q
  5577. Q-Factor
  5578. @item o
  5579. octave
  5580. @item s
  5581. slope
  5582. @item k
  5583. kHz
  5584. @end table
  5585. @item width, w
  5586. Determine how steep is the filter's shelf transition.
  5587. @item poles, p
  5588. Set number of poles. Default is 2.
  5589. @item mix, m
  5590. How much to use filtered signal in output. Default is 1.
  5591. Range is between 0 and 1.
  5592. @item channels, c
  5593. Specify which channels to filter, by default all available are filtered.
  5594. @item normalize, n
  5595. Normalize biquad coefficients, by default is disabled.
  5596. Enabling it will normalize magnitude response at DC to 0dB.
  5597. @item transform, a
  5598. Set transform type of IIR filter.
  5599. @table @option
  5600. @item di
  5601. @item dii
  5602. @item tdi
  5603. @item tdii
  5604. @item latt
  5605. @item svf
  5606. @item zdf
  5607. @end table
  5608. @item precision, r
  5609. Set precison of filtering.
  5610. @table @option
  5611. @item auto
  5612. Pick automatic sample format depending on surround filters.
  5613. @item s16
  5614. Always use signed 16-bit.
  5615. @item s32
  5616. Always use signed 32-bit.
  5617. @item f32
  5618. Always use float 32-bit.
  5619. @item f64
  5620. Always use float 64-bit.
  5621. @end table
  5622. @item block_size, b
  5623. Set block size used for reverse IIR processing. If this value is set to high enough
  5624. value (higher than impulse response length truncated when reaches near zero values) filtering
  5625. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5626. Note that filter delay will be exactly this many samples when set to non-zero value.
  5627. @end table
  5628. @subsection Commands
  5629. This filter supports some options as @ref{commands}.
  5630. @section treble, highshelf
  5631. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5632. shelving filter with a response similar to that of a standard
  5633. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5634. The filter accepts the following options:
  5635. @table @option
  5636. @item gain, g
  5637. Give the gain at whichever is the lower of ~22 kHz and the
  5638. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5639. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5640. @item frequency, f
  5641. Set the filter's central frequency and so can be used
  5642. to extend or reduce the frequency range to be boosted or cut.
  5643. The default value is @code{3000} Hz.
  5644. @item width_type, t
  5645. Set method to specify band-width of filter.
  5646. @table @option
  5647. @item h
  5648. Hz
  5649. @item q
  5650. Q-Factor
  5651. @item o
  5652. octave
  5653. @item s
  5654. slope
  5655. @item k
  5656. kHz
  5657. @end table
  5658. @item width, w
  5659. Determine how steep is the filter's shelf transition.
  5660. @item poles, p
  5661. Set number of poles. Default is 2.
  5662. @item mix, m
  5663. How much to use filtered signal in output. Default is 1.
  5664. Range is between 0 and 1.
  5665. @item channels, c
  5666. Specify which channels to filter, by default all available are filtered.
  5667. @item normalize, n
  5668. Normalize biquad coefficients, by default is disabled.
  5669. Enabling it will normalize magnitude response at DC to 0dB.
  5670. @item transform, a
  5671. Set transform type of IIR filter.
  5672. @table @option
  5673. @item di
  5674. @item dii
  5675. @item tdi
  5676. @item tdii
  5677. @item latt
  5678. @item svf
  5679. @item zdf
  5680. @end table
  5681. @item precision, r
  5682. Set precison of filtering.
  5683. @table @option
  5684. @item auto
  5685. Pick automatic sample format depending on surround filters.
  5686. @item s16
  5687. Always use signed 16-bit.
  5688. @item s32
  5689. Always use signed 32-bit.
  5690. @item f32
  5691. Always use float 32-bit.
  5692. @item f64
  5693. Always use float 64-bit.
  5694. @end table
  5695. @item block_size, b
  5696. Set block size used for reverse IIR processing. If this value is set to high enough
  5697. value (higher than impulse response length truncated when reaches near zero values) filtering
  5698. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5699. Note that filter delay will be exactly this many samples when set to non-zero value.
  5700. @end table
  5701. @subsection Commands
  5702. This filter supports the following commands:
  5703. @table @option
  5704. @item frequency, f
  5705. Change treble frequency.
  5706. Syntax for the command is : "@var{frequency}"
  5707. @item width_type, t
  5708. Change treble width_type.
  5709. Syntax for the command is : "@var{width_type}"
  5710. @item width, w
  5711. Change treble width.
  5712. Syntax for the command is : "@var{width}"
  5713. @item gain, g
  5714. Change treble gain.
  5715. Syntax for the command is : "@var{gain}"
  5716. @item mix, m
  5717. Change treble mix.
  5718. Syntax for the command is : "@var{mix}"
  5719. @end table
  5720. @section tremolo
  5721. Sinusoidal amplitude modulation.
  5722. The filter accepts the following options:
  5723. @table @option
  5724. @item f
  5725. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5726. (20 Hz or lower) will result in a tremolo effect.
  5727. This filter may also be used as a ring modulator by specifying
  5728. a modulation frequency higher than 20 Hz.
  5729. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5730. @item d
  5731. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5732. Default value is 0.5.
  5733. @end table
  5734. @section vibrato
  5735. Sinusoidal phase modulation.
  5736. The filter accepts the following options:
  5737. @table @option
  5738. @item f
  5739. Modulation frequency in Hertz.
  5740. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5741. @item d
  5742. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5743. Default value is 0.5.
  5744. @end table
  5745. @section virtualbass
  5746. Apply audio Virtual Bass filter.
  5747. This filter accepts stereo input and produce stereo with LFE (2.1) channels output.
  5748. The newly produced LFE channel have enhanced virtual bass originally obtained from both stereo channels.
  5749. This filter outputs front left and front right channels unchanged as available in stereo input.
  5750. The filter accepts the following options:
  5751. @table @option
  5752. @item cutoff
  5753. Set the virtual bass cutoff frequency. Default value is 250 Hz.
  5754. Allowed range is from 100 to 500 Hz.
  5755. @item strength
  5756. Set the virtual bass strength. Allowed range is from 0.5 to 3.
  5757. Default value is 3.
  5758. @end table
  5759. @section volume
  5760. Adjust the input audio volume.
  5761. It accepts the following parameters:
  5762. @table @option
  5763. @item volume
  5764. Set audio volume expression.
  5765. Output values are clipped to the maximum value.
  5766. The output audio volume is given by the relation:
  5767. @example
  5768. @var{output_volume} = @var{volume} * @var{input_volume}
  5769. @end example
  5770. The default value for @var{volume} is "1.0".
  5771. @item precision
  5772. This parameter represents the mathematical precision.
  5773. It determines which input sample formats will be allowed, which affects the
  5774. precision of the volume scaling.
  5775. @table @option
  5776. @item fixed
  5777. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5778. @item float
  5779. 32-bit floating-point; this limits input sample format to FLT. (default)
  5780. @item double
  5781. 64-bit floating-point; this limits input sample format to DBL.
  5782. @end table
  5783. @item replaygain
  5784. Choose the behaviour on encountering ReplayGain side data in input frames.
  5785. @table @option
  5786. @item drop
  5787. Remove ReplayGain side data, ignoring its contents (the default).
  5788. @item ignore
  5789. Ignore ReplayGain side data, but leave it in the frame.
  5790. @item track
  5791. Prefer the track gain, if present.
  5792. @item album
  5793. Prefer the album gain, if present.
  5794. @end table
  5795. @item replaygain_preamp
  5796. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5797. Default value for @var{replaygain_preamp} is 0.0.
  5798. @item replaygain_noclip
  5799. Prevent clipping by limiting the gain applied.
  5800. Default value for @var{replaygain_noclip} is 1.
  5801. @item eval
  5802. Set when the volume expression is evaluated.
  5803. It accepts the following values:
  5804. @table @samp
  5805. @item once
  5806. only evaluate expression once during the filter initialization, or
  5807. when the @samp{volume} command is sent
  5808. @item frame
  5809. evaluate expression for each incoming frame
  5810. @end table
  5811. Default value is @samp{once}.
  5812. @end table
  5813. The volume expression can contain the following parameters.
  5814. @table @option
  5815. @item n
  5816. frame number (starting at zero)
  5817. @item nb_channels
  5818. number of channels
  5819. @item nb_consumed_samples
  5820. number of samples consumed by the filter
  5821. @item nb_samples
  5822. number of samples in the current frame
  5823. @item pos
  5824. original frame position in the file; deprecated, do not use
  5825. @item pts
  5826. frame PTS
  5827. @item sample_rate
  5828. sample rate
  5829. @item startpts
  5830. PTS at start of stream
  5831. @item startt
  5832. time at start of stream
  5833. @item t
  5834. frame time
  5835. @item tb
  5836. timestamp timebase
  5837. @item volume
  5838. last set volume value
  5839. @end table
  5840. Note that when @option{eval} is set to @samp{once} only the
  5841. @var{sample_rate} and @var{tb} variables are available, all other
  5842. variables will evaluate to NAN.
  5843. @subsection Commands
  5844. This filter supports the following commands:
  5845. @table @option
  5846. @item volume
  5847. Modify the volume expression.
  5848. The command accepts the same syntax of the corresponding option.
  5849. If the specified expression is not valid, it is kept at its current
  5850. value.
  5851. @end table
  5852. @subsection Examples
  5853. @itemize
  5854. @item
  5855. Halve the input audio volume:
  5856. @example
  5857. volume=volume=0.5
  5858. volume=volume=1/2
  5859. volume=volume=-6.0206dB
  5860. @end example
  5861. In all the above example the named key for @option{volume} can be
  5862. omitted, for example like in:
  5863. @example
  5864. volume=0.5
  5865. @end example
  5866. @item
  5867. Increase input audio power by 6 decibels using fixed-point precision:
  5868. @example
  5869. volume=volume=6dB:precision=fixed
  5870. @end example
  5871. @item
  5872. Fade volume after time 10 with an annihilation period of 5 seconds:
  5873. @example
  5874. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5875. @end example
  5876. @end itemize
  5877. @section volumedetect
  5878. Detect the volume of the input video.
  5879. The filter has no parameters. It supports only 16-bit signed integer samples,
  5880. so the input will be converted when needed. Statistics about the volume will
  5881. be printed in the log when the input stream end is reached.
  5882. In particular it will show the mean volume (root mean square), maximum
  5883. volume (on a per-sample basis), and the beginning of a histogram of the
  5884. registered volume values (from the maximum value to a cumulated 1/1000 of
  5885. the samples).
  5886. All volumes are in decibels relative to the maximum PCM value.
  5887. @subsection Examples
  5888. Here is an excerpt of the output:
  5889. @example
  5890. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5891. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5892. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5893. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5894. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5895. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5896. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5897. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5898. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5899. @end example
  5900. It means that:
  5901. @itemize
  5902. @item
  5903. The mean square energy is approximately -27 dB, or 10^-2.7.
  5904. @item
  5905. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5906. @item
  5907. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5908. @end itemize
  5909. In other words, raising the volume by +4 dB does not cause any clipping,
  5910. raising it by +5 dB causes clipping for 6 samples, etc.
  5911. @c man end AUDIO FILTERS
  5912. @chapter Audio Sources
  5913. @c man begin AUDIO SOURCES
  5914. Below is a description of the currently available audio sources.
  5915. @section abuffer
  5916. Buffer audio frames, and make them available to the filter chain.
  5917. This source is mainly intended for a programmatic use, in particular
  5918. through the interface defined in @file{libavfilter/buffersrc.h}.
  5919. It accepts the following parameters:
  5920. @table @option
  5921. @item time_base
  5922. The timebase which will be used for timestamps of submitted frames. It must be
  5923. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5924. @item sample_rate
  5925. The sample rate of the incoming audio buffers.
  5926. @item sample_fmt
  5927. The sample format of the incoming audio buffers.
  5928. Either a sample format name or its corresponding integer representation from
  5929. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5930. @item channel_layout
  5931. The channel layout of the incoming audio buffers.
  5932. Either a channel layout name from channel_layout_map in
  5933. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5934. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5935. @item channels
  5936. The number of channels of the incoming audio buffers.
  5937. If both @var{channels} and @var{channel_layout} are specified, then they
  5938. must be consistent.
  5939. @end table
  5940. @subsection Examples
  5941. @example
  5942. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  5943. @end example
  5944. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  5945. Since the sample format with name "s16p" corresponds to the number
  5946. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  5947. equivalent to:
  5948. @example
  5949. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  5950. @end example
  5951. @section aevalsrc
  5952. Generate an audio signal specified by an expression.
  5953. This source accepts in input one or more expressions (one for each
  5954. channel), which are evaluated and used to generate a corresponding
  5955. audio signal.
  5956. This source accepts the following options:
  5957. @table @option
  5958. @item exprs
  5959. Set the '|'-separated expressions list for each separate channel. In case the
  5960. @option{channel_layout} option is not specified, the selected channel layout
  5961. depends on the number of provided expressions. Otherwise the last
  5962. specified expression is applied to the remaining output channels.
  5963. @item channel_layout, c
  5964. Set the channel layout. The number of channels in the specified layout
  5965. must be equal to the number of specified expressions.
  5966. @item duration, d
  5967. Set the minimum duration of the sourced audio. See
  5968. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5969. for the accepted syntax.
  5970. Note that the resulting duration may be greater than the specified
  5971. duration, as the generated audio is always cut at the end of a
  5972. complete frame.
  5973. If not specified, or the expressed duration is negative, the audio is
  5974. supposed to be generated forever.
  5975. @item nb_samples, n
  5976. Set the number of samples per channel per each output frame,
  5977. default to 1024.
  5978. @item sample_rate, s
  5979. Specify the sample rate, default to 44100.
  5980. @end table
  5981. Each expression in @var{exprs} can contain the following constants:
  5982. @table @option
  5983. @item n
  5984. number of the evaluated sample, starting from 0
  5985. @item t
  5986. time of the evaluated sample expressed in seconds, starting from 0
  5987. @item s
  5988. sample rate
  5989. @end table
  5990. @subsection Examples
  5991. @itemize
  5992. @item
  5993. Generate silence:
  5994. @example
  5995. aevalsrc=0
  5996. @end example
  5997. @item
  5998. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5999. 8000 Hz:
  6000. @example
  6001. aevalsrc="sin(440*2*PI*t):s=8000"
  6002. @end example
  6003. @item
  6004. Generate a two channels signal, specify the channel layout (Front
  6005. Center + Back Center) explicitly:
  6006. @example
  6007. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  6008. @end example
  6009. @item
  6010. Generate white noise:
  6011. @example
  6012. aevalsrc="-2+random(0)"
  6013. @end example
  6014. @item
  6015. Generate an amplitude modulated signal:
  6016. @example
  6017. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  6018. @end example
  6019. @item
  6020. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  6021. @example
  6022. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  6023. @end example
  6024. @end itemize
  6025. @section afdelaysrc
  6026. Generate a fractional delay FIR coefficients.
  6027. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6028. The filter accepts the following options:
  6029. @table @option
  6030. @item delay, d
  6031. Set the fractional delay. Default is 0.
  6032. @item sample_rate, r
  6033. Set the sample rate, default is 44100.
  6034. @item nb_samples, n
  6035. Set the number of samples per each frame. Default is 1024.
  6036. @item taps, t
  6037. Set the number of filter coefficents in output audio stream.
  6038. Default value is 0.
  6039. @item channel_layout, c
  6040. Specifies the channel layout, and can be a string representing a channel layout.
  6041. The default value of @var{channel_layout} is "stereo".
  6042. @end table
  6043. @section afireqsrc
  6044. Generate a FIR equalizer coefficients.
  6045. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6046. The filter accepts the following options:
  6047. @table @option
  6048. @item preset, p
  6049. Set equalizer preset.
  6050. Default preset is @code{flat}.
  6051. Available presets are:
  6052. @table @samp
  6053. @item custom
  6054. @item flat
  6055. @item acoustic
  6056. @item bass
  6057. @item beats
  6058. @item classic
  6059. @item clear
  6060. @item deep bass
  6061. @item dubstep
  6062. @item electronic
  6063. @item hard-style
  6064. @item hip-hop
  6065. @item jazz
  6066. @item metal
  6067. @item movie
  6068. @item pop
  6069. @item r&b
  6070. @item rock
  6071. @item vocal booster
  6072. @end table
  6073. @item gains, g
  6074. Set custom gains for each band. Only used if the preset option is set to @code{custom}.
  6075. Gains are separated by white spaces and each gain is set in dBFS.
  6076. Default is @code{0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}.
  6077. @item bands, b
  6078. Set the custom bands from where custon equalizer gains are set.
  6079. This must be in strictly increasing order. Only used if the preset option is set to @code{custom}.
  6080. Bands are separated by white spaces and each band represent frequency in Hz.
  6081. Default is @code{25 40 63 100 160 250 400 630 1000 1600 2500 4000 6300 10000 16000 24000}.
  6082. @item taps, t
  6083. Set number of filter coefficents in output audio stream.
  6084. Default value is @code{4096}.
  6085. @item sample_rate, r
  6086. Set sample rate of output audio stream, default is @code{44100}.
  6087. @item nb_samples, n
  6088. Set number of samples per each frame in output audio stream. Default is @code{1024}.
  6089. @item interp, i
  6090. Set interpolation method for FIR equalizer coefficients. Can be @code{linear} or @code{cubic}.
  6091. @item phase, h
  6092. Set phase type of FIR filter. Can be @code{linear} or @code{min}: minimum-phase.
  6093. Default is minimum-phase filter.
  6094. @end table
  6095. @section afirsrc
  6096. Generate a FIR coefficients using frequency sampling method.
  6097. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6098. The filter accepts the following options:
  6099. @table @option
  6100. @item taps, t
  6101. Set number of filter coefficents in output audio stream.
  6102. Default value is 1025.
  6103. @item frequency, f
  6104. Set frequency points from where magnitude and phase are set.
  6105. This must be in non decreasing order, and first element must be 0, while last element
  6106. must be 1. Elements are separated by white spaces.
  6107. @item magnitude, m
  6108. Set magnitude value for every frequency point set by @option{frequency}.
  6109. Number of values must be same as number of frequency points.
  6110. Values are separated by white spaces.
  6111. @item phase, p
  6112. Set phase value for every frequency point set by @option{frequency}.
  6113. Number of values must be same as number of frequency points.
  6114. Values are separated by white spaces.
  6115. @item sample_rate, r
  6116. Set sample rate, default is 44100.
  6117. @item nb_samples, n
  6118. Set number of samples per each frame. Default is 1024.
  6119. @item win_func, w
  6120. Set window function. Default is blackman.
  6121. @end table
  6122. @section anullsrc
  6123. The null audio source, return unprocessed audio frames. It is mainly useful
  6124. as a template and to be employed in analysis / debugging tools, or as
  6125. the source for filters which ignore the input data (for example the sox
  6126. synth filter).
  6127. This source accepts the following options:
  6128. @table @option
  6129. @item channel_layout, cl
  6130. Specifies the channel layout, and can be either an integer or a string
  6131. representing a channel layout. The default value of @var{channel_layout}
  6132. is "stereo".
  6133. Check the channel_layout_map definition in
  6134. @file{libavutil/channel_layout.c} for the mapping between strings and
  6135. channel layout values.
  6136. @item sample_rate, r
  6137. Specifies the sample rate, and defaults to 44100.
  6138. @item nb_samples, n
  6139. Set the number of samples per requested frames.
  6140. @item duration, d
  6141. Set the duration of the sourced audio. See
  6142. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  6143. for the accepted syntax.
  6144. If not specified, or the expressed duration is negative, the audio is
  6145. supposed to be generated forever.
  6146. @end table
  6147. @subsection Examples
  6148. @itemize
  6149. @item
  6150. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  6151. @example
  6152. anullsrc=r=48000:cl=4
  6153. @end example
  6154. @item
  6155. Do the same operation with a more obvious syntax:
  6156. @example
  6157. anullsrc=r=48000:cl=mono
  6158. @end example
  6159. @end itemize
  6160. All the parameters need to be explicitly defined.
  6161. @section flite
  6162. Synthesize a voice utterance using the libflite library.
  6163. To enable compilation of this filter you need to configure FFmpeg with
  6164. @code{--enable-libflite}.
  6165. Note that versions of the flite library prior to 2.0 are not thread-safe.
  6166. The filter accepts the following options:
  6167. @table @option
  6168. @item list_voices
  6169. If set to 1, list the names of the available voices and exit
  6170. immediately. Default value is 0.
  6171. @item nb_samples, n
  6172. Set the maximum number of samples per frame. Default value is 512.
  6173. @item textfile
  6174. Set the filename containing the text to speak.
  6175. @item text
  6176. Set the text to speak.
  6177. @item voice, v
  6178. Set the voice to use for the speech synthesis. Default value is
  6179. @code{kal}. See also the @var{list_voices} option.
  6180. @end table
  6181. @subsection Examples
  6182. @itemize
  6183. @item
  6184. Read from file @file{speech.txt}, and synthesize the text using the
  6185. standard flite voice:
  6186. @example
  6187. flite=textfile=speech.txt
  6188. @end example
  6189. @item
  6190. Read the specified text selecting the @code{slt} voice:
  6191. @example
  6192. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  6193. @end example
  6194. @item
  6195. Input text to ffmpeg:
  6196. @example
  6197. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  6198. @end example
  6199. @item
  6200. Make @file{ffplay} speak the specified text, using @code{flite} and
  6201. the @code{lavfi} device:
  6202. @example
  6203. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  6204. @end example
  6205. @end itemize
  6206. For more information about libflite, check:
  6207. @url{http://www.festvox.org/flite/}
  6208. @section anoisesrc
  6209. Generate a noise audio signal.
  6210. The filter accepts the following options:
  6211. @table @option
  6212. @item sample_rate, r
  6213. Specify the sample rate. Default value is 48000 Hz.
  6214. @item amplitude, a
  6215. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  6216. is 1.0.
  6217. @item duration, d
  6218. Specify the duration of the generated audio stream. Not specifying this option
  6219. results in noise with an infinite length.
  6220. @item color, colour, c
  6221. Specify the color of noise. Available noise colors are white, pink, brown,
  6222. blue, violet and velvet. Default color is white.
  6223. @item seed, s
  6224. Specify a value used to seed the PRNG.
  6225. @item nb_samples, n
  6226. Set the number of samples per each output frame, default is 1024.
  6227. @item density
  6228. Set the density (0.0 - 1.0) for the velvet noise generator, default is 0.05.
  6229. @end table
  6230. @subsection Examples
  6231. @itemize
  6232. @item
  6233. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  6234. @example
  6235. anoisesrc=d=60:c=pink:r=44100:a=0.5
  6236. @end example
  6237. @end itemize
  6238. @section hilbert
  6239. Generate odd-tap Hilbert transform FIR coefficients.
  6240. The resulting stream can be used with @ref{afir} filter for phase-shifting
  6241. the signal by 90 degrees.
  6242. This is used in many matrix coding schemes and for analytic signal generation.
  6243. The process is often written as a multiplication by i (or j), the imaginary unit.
  6244. The filter accepts the following options:
  6245. @table @option
  6246. @item sample_rate, s
  6247. Set sample rate, default is 44100.
  6248. @item taps, t
  6249. Set length of FIR filter, default is 22051.
  6250. @item nb_samples, n
  6251. Set number of samples per each frame.
  6252. @item win_func, w
  6253. Set window function to be used when generating FIR coefficients.
  6254. @end table
  6255. @section sinc
  6256. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  6257. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6258. The filter accepts the following options:
  6259. @table @option
  6260. @item sample_rate, r
  6261. Set sample rate, default is 44100.
  6262. @item nb_samples, n
  6263. Set number of samples per each frame. Default is 1024.
  6264. @item hp
  6265. Set high-pass frequency. Default is 0.
  6266. @item lp
  6267. Set low-pass frequency. Default is 0.
  6268. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  6269. is higher than 0 then filter will create band-pass filter coefficients,
  6270. otherwise band-reject filter coefficients.
  6271. @item phase
  6272. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  6273. @item beta
  6274. Set Kaiser window beta.
  6275. @item att
  6276. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  6277. @item round
  6278. Enable rounding, by default is disabled.
  6279. @item hptaps
  6280. Set number of taps for high-pass filter.
  6281. @item lptaps
  6282. Set number of taps for low-pass filter.
  6283. @end table
  6284. @section sine
  6285. Generate an audio signal made of a sine wave with amplitude 1/8.
  6286. The audio signal is bit-exact.
  6287. The filter accepts the following options:
  6288. @table @option
  6289. @item frequency, f
  6290. Set the carrier frequency. Default is 440 Hz.
  6291. @item beep_factor, b
  6292. Enable a periodic beep every second with frequency @var{beep_factor} times
  6293. the carrier frequency. Default is 0, meaning the beep is disabled.
  6294. @item sample_rate, r
  6295. Specify the sample rate, default is 44100.
  6296. @item duration, d
  6297. Specify the duration of the generated audio stream.
  6298. @item samples_per_frame
  6299. Set the number of samples per output frame.
  6300. The expression can contain the following constants:
  6301. @table @option
  6302. @item n
  6303. The (sequential) number of the output audio frame, starting from 0.
  6304. @item pts
  6305. The PTS (Presentation TimeStamp) of the output audio frame,
  6306. expressed in @var{TB} units.
  6307. @item t
  6308. The PTS of the output audio frame, expressed in seconds.
  6309. @item TB
  6310. The timebase of the output audio frames.
  6311. @end table
  6312. Default is @code{1024}.
  6313. @end table
  6314. @subsection Examples
  6315. @itemize
  6316. @item
  6317. Generate a simple 440 Hz sine wave:
  6318. @example
  6319. sine
  6320. @end example
  6321. @item
  6322. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  6323. @example
  6324. sine=220:4:d=5
  6325. sine=f=220:b=4:d=5
  6326. sine=frequency=220:beep_factor=4:duration=5
  6327. @end example
  6328. @item
  6329. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  6330. pattern:
  6331. @example
  6332. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  6333. @end example
  6334. @end itemize
  6335. @c man end AUDIO SOURCES
  6336. @chapter Audio Sinks
  6337. @c man begin AUDIO SINKS
  6338. Below is a description of the currently available audio sinks.
  6339. @section abuffersink
  6340. Buffer audio frames, and make them available to the end of filter chain.
  6341. This sink is mainly intended for programmatic use, in particular
  6342. through the interface defined in @file{libavfilter/buffersink.h}
  6343. or the options system.
  6344. It accepts a pointer to an AVABufferSinkContext structure, which
  6345. defines the incoming buffers' formats, to be passed as the opaque
  6346. parameter to @code{avfilter_init_filter} for initialization.
  6347. @section anullsink
  6348. Null audio sink; do absolutely nothing with the input audio. It is
  6349. mainly useful as a template and for use in analysis / debugging
  6350. tools.
  6351. @c man end AUDIO SINKS
  6352. @chapter Video Filters
  6353. @c man begin VIDEO FILTERS
  6354. When you configure your FFmpeg build, you can disable any of the
  6355. existing filters using @code{--disable-filters}.
  6356. The configure output will show the video filters included in your
  6357. build.
  6358. Below is a description of the currently available video filters.
  6359. @section addroi
  6360. Mark a region of interest in a video frame.
  6361. The frame data is passed through unchanged, but metadata is attached
  6362. to the frame indicating regions of interest which can affect the
  6363. behaviour of later encoding. Multiple regions can be marked by
  6364. applying the filter multiple times.
  6365. @table @option
  6366. @item x
  6367. Region distance in pixels from the left edge of the frame.
  6368. @item y
  6369. Region distance in pixels from the top edge of the frame.
  6370. @item w
  6371. Region width in pixels.
  6372. @item h
  6373. Region height in pixels.
  6374. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  6375. and may contain the following variables:
  6376. @table @option
  6377. @item iw
  6378. Width of the input frame.
  6379. @item ih
  6380. Height of the input frame.
  6381. @end table
  6382. @item qoffset
  6383. Quantisation offset to apply within the region.
  6384. This must be a real value in the range -1 to +1. A value of zero
  6385. indicates no quality change. A negative value asks for better quality
  6386. (less quantisation), while a positive value asks for worse quality
  6387. (greater quantisation).
  6388. The range is calibrated so that the extreme values indicate the
  6389. largest possible offset - if the rest of the frame is encoded with the
  6390. worst possible quality, an offset of -1 indicates that this region
  6391. should be encoded with the best possible quality anyway. Intermediate
  6392. values are then interpolated in some codec-dependent way.
  6393. For example, in 10-bit H.264 the quantisation parameter varies between
  6394. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  6395. this region should be encoded with a QP around one-tenth of the full
  6396. range better than the rest of the frame. So, if most of the frame
  6397. were to be encoded with a QP of around 30, this region would get a QP
  6398. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  6399. An extreme value of -1 would indicate that this region should be
  6400. encoded with the best possible quality regardless of the treatment of
  6401. the rest of the frame - that is, should be encoded at a QP of -12.
  6402. @item clear
  6403. If set to true, remove any existing regions of interest marked on the
  6404. frame before adding the new one.
  6405. @end table
  6406. @subsection Examples
  6407. @itemize
  6408. @item
  6409. Mark the centre quarter of the frame as interesting.
  6410. @example
  6411. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  6412. @end example
  6413. @item
  6414. Mark the 100-pixel-wide region on the left edge of the frame as very
  6415. uninteresting (to be encoded at much lower quality than the rest of
  6416. the frame).
  6417. @example
  6418. addroi=0:0:100:ih:+1/5
  6419. @end example
  6420. @end itemize
  6421. @section alphaextract
  6422. Extract the alpha component from the input as a grayscale video. This
  6423. is especially useful with the @var{alphamerge} filter.
  6424. @section alphamerge
  6425. Add or replace the alpha component of the primary input with the
  6426. grayscale value of a second input. This is intended for use with
  6427. @var{alphaextract} to allow the transmission or storage of frame
  6428. sequences that have alpha in a format that doesn't support an alpha
  6429. channel.
  6430. For example, to reconstruct full frames from a normal YUV-encoded video
  6431. and a separate video created with @var{alphaextract}, you might use:
  6432. @example
  6433. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  6434. @end example
  6435. @section amplify
  6436. Amplify differences between current pixel and pixels of adjacent frames in
  6437. same pixel location.
  6438. This filter accepts the following options:
  6439. @table @option
  6440. @item radius
  6441. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  6442. For example radius of 3 will instruct filter to calculate average of 7 frames.
  6443. @item factor
  6444. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  6445. @item threshold
  6446. Set threshold for difference amplification. Any difference greater or equal to
  6447. this value will not alter source pixel. Default is 10.
  6448. Allowed range is from 0 to 65535.
  6449. @item tolerance
  6450. Set tolerance for difference amplification. Any difference lower to
  6451. this value will not alter source pixel. Default is 0.
  6452. Allowed range is from 0 to 65535.
  6453. @item low
  6454. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6455. This option controls maximum possible value that will decrease source pixel value.
  6456. @item high
  6457. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6458. This option controls maximum possible value that will increase source pixel value.
  6459. @item planes
  6460. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  6461. @end table
  6462. @subsection Commands
  6463. This filter supports the following @ref{commands} that corresponds to option of same name:
  6464. @table @option
  6465. @item factor
  6466. @item threshold
  6467. @item tolerance
  6468. @item low
  6469. @item high
  6470. @item planes
  6471. @end table
  6472. @section ass
  6473. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  6474. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  6475. Substation Alpha) subtitles files.
  6476. This filter accepts the following option in addition to the common options from
  6477. the @ref{subtitles} filter:
  6478. @table @option
  6479. @item shaping
  6480. Set the shaping engine
  6481. Available values are:
  6482. @table @samp
  6483. @item auto
  6484. The default libass shaping engine, which is the best available.
  6485. @item simple
  6486. Fast, font-agnostic shaper that can do only substitutions
  6487. @item complex
  6488. Slower shaper using OpenType for substitutions and positioning
  6489. @end table
  6490. The default is @code{auto}.
  6491. @end table
  6492. @section atadenoise
  6493. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  6494. The filter accepts the following options:
  6495. @table @option
  6496. @item 0a
  6497. Set threshold A for 1st plane. Default is 0.02.
  6498. Valid range is 0 to 0.3.
  6499. @item 0b
  6500. Set threshold B for 1st plane. Default is 0.04.
  6501. Valid range is 0 to 5.
  6502. @item 1a
  6503. Set threshold A for 2nd plane. Default is 0.02.
  6504. Valid range is 0 to 0.3.
  6505. @item 1b
  6506. Set threshold B for 2nd plane. Default is 0.04.
  6507. Valid range is 0 to 5.
  6508. @item 2a
  6509. Set threshold A for 3rd plane. Default is 0.02.
  6510. Valid range is 0 to 0.3.
  6511. @item 2b
  6512. Set threshold B for 3rd plane. Default is 0.04.
  6513. Valid range is 0 to 5.
  6514. Threshold A is designed to react on abrupt changes in the input signal and
  6515. threshold B is designed to react on continuous changes in the input signal.
  6516. @item s
  6517. Set number of frames filter will use for averaging. Default is 9. Must be odd
  6518. number in range [5, 129].
  6519. @item p
  6520. Set what planes of frame filter will use for averaging. Default is all.
  6521. @item a
  6522. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  6523. Alternatively can be set to @code{s} serial.
  6524. Parallel can be faster then serial, while other way around is never true.
  6525. Parallel will abort early on first change being greater then thresholds, while serial
  6526. will continue processing other side of frames if they are equal or below thresholds.
  6527. @item 0s
  6528. @item 1s
  6529. @item 2s
  6530. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  6531. Valid range is from 0 to 32767.
  6532. This options controls weight for each pixel in radius defined by size.
  6533. Default value means every pixel have same weight.
  6534. Setting this option to 0 effectively disables filtering.
  6535. @end table
  6536. @subsection Commands
  6537. This filter supports same @ref{commands} as options except option @code{s}.
  6538. The command accepts the same syntax of the corresponding option.
  6539. @section avgblur
  6540. Apply average blur filter.
  6541. The filter accepts the following options:
  6542. @table @option
  6543. @item sizeX
  6544. Set horizontal radius size.
  6545. @item planes
  6546. Set which planes to filter. By default all planes are filtered.
  6547. @item sizeY
  6548. Set vertical radius size, if zero it will be same as @code{sizeX}.
  6549. Default is @code{0}.
  6550. @end table
  6551. @subsection Commands
  6552. This filter supports same commands as options.
  6553. The command accepts the same syntax of the corresponding option.
  6554. If the specified expression is not valid, it is kept at its current
  6555. value.
  6556. @section backgroundkey
  6557. Turns a static background into transparency.
  6558. The filter accepts the following option:
  6559. @table @option
  6560. @item threshold
  6561. Threshold for scene change detection.
  6562. @item similarity
  6563. Similarity percentage with the background.
  6564. @item blend
  6565. Set the blend amount for pixels that are not similar.
  6566. @end table
  6567. @subsection Commands
  6568. This filter supports the all above options as @ref{commands}.
  6569. @section bbox
  6570. Compute the bounding box for the non-black pixels in the input frame
  6571. luma plane.
  6572. This filter computes the bounding box containing all the pixels with a
  6573. luma value greater than the minimum allowed value.
  6574. The parameters describing the bounding box are printed on the filter
  6575. log.
  6576. The filter accepts the following option:
  6577. @table @option
  6578. @item min_val
  6579. Set the minimal luma value. Default is @code{16}.
  6580. @end table
  6581. @subsection Commands
  6582. This filter supports the all above options as @ref{commands}.
  6583. @section bilateral
  6584. Apply bilateral filter, spatial smoothing while preserving edges.
  6585. The filter accepts the following options:
  6586. @table @option
  6587. @item sigmaS
  6588. Set sigma of gaussian function to calculate spatial weight.
  6589. Allowed range is 0 to 512. Default is 0.1.
  6590. @item sigmaR
  6591. Set sigma of gaussian function to calculate range weight.
  6592. Allowed range is 0 to 1. Default is 0.1.
  6593. @item planes
  6594. Set planes to filter. Default is first only.
  6595. @end table
  6596. @subsection Commands
  6597. This filter supports the all above options as @ref{commands}.
  6598. @section bilateral_cuda
  6599. CUDA accelerated bilateral filter, an edge preserving filter.
  6600. This filter is mathematically accurate thanks to the use of GPU acceleration.
  6601. For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
  6602. The filter accepts the following options:
  6603. @table @option
  6604. @item sigmaS
  6605. Set sigma of gaussian function to calculate spatial weight, also called sigma space.
  6606. Allowed range is 0.1 to 512. Default is 0.1.
  6607. @item sigmaR
  6608. Set sigma of gaussian function to calculate color range weight, also called sigma color.
  6609. Allowed range is 0.1 to 512. Default is 0.1.
  6610. @item window_size
  6611. Set window size of the bilateral function to determine the number of neighbours to loop on.
  6612. If the number entered is even, one will be added automatically.
  6613. Allowed range is 1 to 255. Default is 1.
  6614. @end table
  6615. @subsection Examples
  6616. @itemize
  6617. @item
  6618. Apply the bilateral filter on a video.
  6619. @example
  6620. ./ffmpeg -v verbose \
  6621. -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \
  6622. -init_hw_device cuda \
  6623. -filter_complex \
  6624. " \
  6625. [0:v]scale_cuda=format=yuv444p[scaled_video];
  6626. [scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  6627. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  6628. @end example
  6629. @end itemize
  6630. @section bitplanenoise
  6631. Show and measure bit plane noise.
  6632. The filter accepts the following options:
  6633. @table @option
  6634. @item bitplane
  6635. Set which plane to analyze. Default is @code{1}.
  6636. @item filter
  6637. Filter out noisy pixels from @code{bitplane} set above.
  6638. Default is disabled.
  6639. @end table
  6640. @section blackdetect
  6641. Detect video intervals that are (almost) completely black. Can be
  6642. useful to detect chapter transitions, commercials, or invalid
  6643. recordings.
  6644. The filter outputs its detection analysis to both the log as well as
  6645. frame metadata. If a black segment of at least the specified minimum
  6646. duration is found, a line with the start and end timestamps as well
  6647. as duration is printed to the log with level @code{info}. In addition,
  6648. a log line with level @code{debug} is printed per frame showing the
  6649. black amount detected for that frame.
  6650. The filter also attaches metadata to the first frame of a black
  6651. segment with key @code{lavfi.black_start} and to the first frame
  6652. after the black segment ends with key @code{lavfi.black_end}. The
  6653. value is the frame's timestamp. This metadata is added regardless
  6654. of the minimum duration specified.
  6655. The filter accepts the following options:
  6656. @table @option
  6657. @item black_min_duration, d
  6658. Set the minimum detected black duration expressed in seconds. It must
  6659. be a non-negative floating point number.
  6660. Default value is 2.0.
  6661. @item picture_black_ratio_th, pic_th
  6662. Set the threshold for considering a picture "black".
  6663. Express the minimum value for the ratio:
  6664. @example
  6665. @var{nb_black_pixels} / @var{nb_pixels}
  6666. @end example
  6667. for which a picture is considered black.
  6668. Default value is 0.98.
  6669. @item pixel_black_th, pix_th
  6670. Set the threshold for considering a pixel "black".
  6671. The threshold expresses the maximum pixel luma value for which a
  6672. pixel is considered "black". The provided value is scaled according to
  6673. the following equation:
  6674. @example
  6675. @var{absolute_threshold} = @var{luma_minimum_value} + @var{pixel_black_th} * @var{luma_range_size}
  6676. @end example
  6677. @var{luma_range_size} and @var{luma_minimum_value} depend on
  6678. the input video format, the range is [0-255] for YUV full-range
  6679. formats and [16-235] for YUV non full-range formats.
  6680. Default value is 0.10.
  6681. @end table
  6682. The following example sets the maximum pixel threshold to the minimum
  6683. value, and detects only black intervals of 2 or more seconds:
  6684. @example
  6685. blackdetect=d=2:pix_th=0.00
  6686. @end example
  6687. @section blackframe
  6688. Detect frames that are (almost) completely black. Can be useful to
  6689. detect chapter transitions or commercials. Output lines consist of
  6690. the frame number of the detected frame, the percentage of blackness,
  6691. the position in the file if known or -1 and the timestamp in seconds.
  6692. In order to display the output lines, you need to set the loglevel at
  6693. least to the AV_LOG_INFO value.
  6694. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6695. The value represents the percentage of pixels in the picture that
  6696. are below the threshold value.
  6697. It accepts the following parameters:
  6698. @table @option
  6699. @item amount
  6700. The percentage of the pixels that have to be below the threshold; it defaults to
  6701. @code{98}.
  6702. @item threshold, thresh
  6703. The threshold below which a pixel value is considered black; it defaults to
  6704. @code{32}.
  6705. @end table
  6706. @anchor{blend}
  6707. @section blend
  6708. Blend two video frames into each other.
  6709. The @code{blend} filter takes two input streams and outputs one
  6710. stream, the first input is the "top" layer and second input is
  6711. "bottom" layer. By default, the output terminates when the longest input terminates.
  6712. The @code{tblend} (time blend) filter takes two consecutive frames
  6713. from one single stream, and outputs the result obtained by blending
  6714. the new frame on top of the old frame.
  6715. A description of the accepted options follows.
  6716. @table @option
  6717. @item c0_mode
  6718. @item c1_mode
  6719. @item c2_mode
  6720. @item c3_mode
  6721. @item all_mode
  6722. Set blend mode for specific pixel component or all pixel components in case
  6723. of @var{all_mode}. Default value is @code{normal}.
  6724. Available values for component modes are:
  6725. @table @samp
  6726. @item addition
  6727. @item and
  6728. @item average
  6729. @item bleach
  6730. @item burn
  6731. @item darken
  6732. @item difference
  6733. @item divide
  6734. @item dodge
  6735. @item exclusion
  6736. @item extremity
  6737. @item freeze
  6738. @item geometric
  6739. @item glow
  6740. @item grainextract
  6741. @item grainmerge
  6742. @item hardlight
  6743. @item hardmix
  6744. @item hardoverlay
  6745. @item harmonic
  6746. @item heat
  6747. @item interpolate
  6748. @item lighten
  6749. @item linearlight
  6750. @item multiply
  6751. @item multiply128
  6752. @item negation
  6753. @item normal
  6754. @item or
  6755. @item overlay
  6756. @item phoenix
  6757. @item pinlight
  6758. @item reflect
  6759. @item screen
  6760. @item softdifference
  6761. @item softlight
  6762. @item stain
  6763. @item subtract
  6764. @item vividlight
  6765. @item xor
  6766. @end table
  6767. @item c0_opacity
  6768. @item c1_opacity
  6769. @item c2_opacity
  6770. @item c3_opacity
  6771. @item all_opacity
  6772. Set blend opacity for specific pixel component or all pixel components in case
  6773. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6774. @item c0_expr
  6775. @item c1_expr
  6776. @item c2_expr
  6777. @item c3_expr
  6778. @item all_expr
  6779. Set blend expression for specific pixel component or all pixel components in case
  6780. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6781. The expressions can use the following variables:
  6782. @table @option
  6783. @item N
  6784. The sequential number of the filtered frame, starting from @code{0}.
  6785. @item X
  6786. @item Y
  6787. the coordinates of the current sample
  6788. @item W
  6789. @item H
  6790. the width and height of currently filtered plane
  6791. @item SW
  6792. @item SH
  6793. Width and height scale for the plane being filtered. It is the
  6794. ratio between the dimensions of the current plane to the luma plane,
  6795. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6796. the luma plane and @code{0.5,0.5} for the chroma planes.
  6797. @item T
  6798. Time of the current frame, expressed in seconds.
  6799. @item TOP, A
  6800. Value of pixel component at current location for first video frame (top layer).
  6801. @item BOTTOM, B
  6802. Value of pixel component at current location for second video frame (bottom layer).
  6803. @end table
  6804. @end table
  6805. The @code{blend} filter also supports the @ref{framesync} options.
  6806. @subsection Examples
  6807. @itemize
  6808. @item
  6809. Apply transition from bottom layer to top layer in first 10 seconds:
  6810. @example
  6811. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6812. @end example
  6813. @item
  6814. Apply linear horizontal transition from top layer to bottom layer:
  6815. @example
  6816. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6817. @end example
  6818. @item
  6819. Apply 1x1 checkerboard effect:
  6820. @example
  6821. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6822. @end example
  6823. @item
  6824. Apply uncover left effect:
  6825. @example
  6826. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6827. @end example
  6828. @item
  6829. Apply uncover down effect:
  6830. @example
  6831. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6832. @end example
  6833. @item
  6834. Apply uncover up-left effect:
  6835. @example
  6836. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6837. @end example
  6838. @item
  6839. Split diagonally video and shows top and bottom layer on each side:
  6840. @example
  6841. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6842. @end example
  6843. @item
  6844. Display differences between the current and the previous frame:
  6845. @example
  6846. tblend=all_mode=grainextract
  6847. @end example
  6848. @end itemize
  6849. @subsection Commands
  6850. This filter supports same @ref{commands} as options.
  6851. @anchor{blockdetect}
  6852. @section blockdetect
  6853. Determines blockiness of frames without altering the input frames.
  6854. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference.
  6855. The filter accepts the following options:
  6856. @table @option
  6857. @item period_min
  6858. @item period_max
  6859. Set minimum and maximum values for determining pixel grids (periods).
  6860. Default values are [3,24].
  6861. @item planes
  6862. Set planes to filter. Default is first only.
  6863. @end table
  6864. @subsection Examples
  6865. @itemize
  6866. @item
  6867. Determine blockiness for the first plane and search for periods within [8,32]:
  6868. @example
  6869. blockdetect=period_min=8:period_max=32:planes=1
  6870. @end example
  6871. @end itemize
  6872. @anchor{blurdetect}
  6873. @section blurdetect
  6874. Determines blurriness of frames without altering the input frames.
  6875. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6876. Allows for a block-based abbreviation.
  6877. The filter accepts the following options:
  6878. @table @option
  6879. @item low
  6880. @item high
  6881. Set low and high threshold values used by the Canny thresholding
  6882. algorithm.
  6883. The high threshold selects the "strong" edge pixels, which are then
  6884. connected through 8-connectivity with the "weak" edge pixels selected
  6885. by the low threshold.
  6886. @var{low} and @var{high} threshold values must be chosen in the range
  6887. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6888. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6889. is @code{50/255}.
  6890. @item radius
  6891. Define the radius to search around an edge pixel for local maxima.
  6892. @item block_pct
  6893. Determine blurriness only for the most significant blocks, given in percentage.
  6894. @item block_width
  6895. 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}.
  6896. @item block_height
  6897. 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}.
  6898. @item planes
  6899. Set planes to filter. Default is first only.
  6900. @end table
  6901. @subsection Examples
  6902. @itemize
  6903. @item
  6904. Determine blur for 80% of most significant 32x32 blocks:
  6905. @example
  6906. blurdetect=block_width=32:block_height=32:block_pct=80
  6907. @end example
  6908. @end itemize
  6909. @section bm3d
  6910. Denoise frames using Block-Matching 3D algorithm.
  6911. The filter accepts the following options.
  6912. @table @option
  6913. @item sigma
  6914. Set denoising strength. Default value is 1.
  6915. Allowed range is from 0 to 999.9.
  6916. The denoising algorithm is very sensitive to sigma, so adjust it
  6917. according to the source.
  6918. @item block
  6919. Set local patch size. This sets dimensions in 2D.
  6920. @item bstep
  6921. Set sliding step for processing blocks. Default value is 4.
  6922. Allowed range is from 1 to 64.
  6923. Smaller values allows processing more reference blocks and is slower.
  6924. @item group
  6925. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6926. When set to 1, no block matching is done. Larger values allows more blocks
  6927. in single group.
  6928. Allowed range is from 1 to 256.
  6929. @item range
  6930. Set radius for search block matching. Default is 9.
  6931. Allowed range is from 1 to INT32_MAX.
  6932. @item mstep
  6933. Set step between two search locations for block matching. Default is 1.
  6934. Allowed range is from 1 to 64. Smaller is slower.
  6935. @item thmse
  6936. Set threshold of mean square error for block matching. Valid range is 0 to
  6937. INT32_MAX.
  6938. @item hdthr
  6939. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6940. Larger values results in stronger hard-thresholding filtering in frequency
  6941. domain.
  6942. @item estim
  6943. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6944. Default is @code{basic}.
  6945. @item ref
  6946. If enabled, filter will use 2nd stream for block matching.
  6947. Default is disabled for @code{basic} value of @var{estim} option,
  6948. and always enabled if value of @var{estim} is @code{final}.
  6949. @item planes
  6950. Set planes to filter. Default is all available except alpha.
  6951. @end table
  6952. @subsection Examples
  6953. @itemize
  6954. @item
  6955. Basic filtering with bm3d:
  6956. @example
  6957. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6958. @end example
  6959. @item
  6960. Same as above, but filtering only luma:
  6961. @example
  6962. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6963. @end example
  6964. @item
  6965. Same as above, but with both estimation modes:
  6966. @example
  6967. 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
  6968. @end example
  6969. @item
  6970. Same as above, but prefilter with @ref{nlmeans} filter instead:
  6971. @example
  6972. 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
  6973. @end example
  6974. @end itemize
  6975. @section boxblur
  6976. Apply a boxblur algorithm to the input video.
  6977. It accepts the following parameters:
  6978. @table @option
  6979. @item luma_radius, lr
  6980. @item luma_power, lp
  6981. @item chroma_radius, cr
  6982. @item chroma_power, cp
  6983. @item alpha_radius, ar
  6984. @item alpha_power, ap
  6985. @end table
  6986. A description of the accepted options follows.
  6987. @table @option
  6988. @item luma_radius, lr
  6989. @item chroma_radius, cr
  6990. @item alpha_radius, ar
  6991. Set an expression for the box radius in pixels used for blurring the
  6992. corresponding input plane.
  6993. The radius value must be a non-negative number, and must not be
  6994. greater than the value of the expression @code{min(w,h)/2} for the
  6995. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  6996. planes.
  6997. Default value for @option{luma_radius} is "2". If not specified,
  6998. @option{chroma_radius} and @option{alpha_radius} default to the
  6999. corresponding value set for @option{luma_radius}.
  7000. The expressions can contain the following constants:
  7001. @table @option
  7002. @item w
  7003. @item h
  7004. The input width and height in pixels.
  7005. @item cw
  7006. @item ch
  7007. The input chroma image width and height in pixels.
  7008. @item hsub
  7009. @item vsub
  7010. The horizontal and vertical chroma subsample values. For example, for the
  7011. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  7012. @end table
  7013. @item luma_power, lp
  7014. @item chroma_power, cp
  7015. @item alpha_power, ap
  7016. Specify how many times the boxblur filter is applied to the
  7017. corresponding plane.
  7018. Default value for @option{luma_power} is 2. If not specified,
  7019. @option{chroma_power} and @option{alpha_power} default to the
  7020. corresponding value set for @option{luma_power}.
  7021. A value of 0 will disable the effect.
  7022. @end table
  7023. @subsection Examples
  7024. @itemize
  7025. @item
  7026. Apply a boxblur filter with the luma, chroma, and alpha radii
  7027. set to 2:
  7028. @example
  7029. boxblur=luma_radius=2:luma_power=1
  7030. boxblur=2:1
  7031. @end example
  7032. @item
  7033. Set the luma radius to 2, and alpha and chroma radius to 0:
  7034. @example
  7035. boxblur=2:1:cr=0:ar=0
  7036. @end example
  7037. @item
  7038. Set the luma and chroma radii to a fraction of the video dimension:
  7039. @example
  7040. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  7041. @end example
  7042. @end itemize
  7043. @anchor{bwdif}
  7044. @section bwdif
  7045. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  7046. Deinterlacing Filter").
  7047. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  7048. interpolation algorithms.
  7049. It accepts the following parameters:
  7050. @table @option
  7051. @item mode
  7052. The interlacing mode to adopt. It accepts one of the following values:
  7053. @table @option
  7054. @item 0, send_frame
  7055. Output one frame for each frame.
  7056. @item 1, send_field
  7057. Output one frame for each field.
  7058. @end table
  7059. The default value is @code{send_field}.
  7060. @item parity
  7061. The picture field parity assumed for the input interlaced video. It accepts one
  7062. of the following values:
  7063. @table @option
  7064. @item 0, tff
  7065. Assume the top field is first.
  7066. @item 1, bff
  7067. Assume the bottom field is first.
  7068. @item -1, auto
  7069. Enable automatic detection of field parity.
  7070. @end table
  7071. The default value is @code{auto}.
  7072. If the interlacing is unknown or the decoder does not export this information,
  7073. top field first will be assumed.
  7074. @item deint
  7075. Specify which frames to deinterlace. Accepts one of the following
  7076. values:
  7077. @table @option
  7078. @item 0, all
  7079. Deinterlace all frames.
  7080. @item 1, interlaced
  7081. Only deinterlace frames marked as interlaced.
  7082. @end table
  7083. The default value is @code{all}.
  7084. @end table
  7085. @section bwdif_cuda
  7086. Deinterlace the input video using the @ref{bwdif} algorithm, but implemented
  7087. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  7088. and/or nvenc.
  7089. It accepts the following parameters:
  7090. @table @option
  7091. @item mode
  7092. The interlacing mode to adopt. It accepts one of the following values:
  7093. @table @option
  7094. @item 0, send_frame
  7095. Output one frame for each frame.
  7096. @item 1, send_field
  7097. Output one frame for each field.
  7098. @end table
  7099. The default value is @code{send_field}.
  7100. @item parity
  7101. The picture field parity assumed for the input interlaced video. It accepts one
  7102. of the following values:
  7103. @table @option
  7104. @item 0, tff
  7105. Assume the top field is first.
  7106. @item 1, bff
  7107. Assume the bottom field is first.
  7108. @item -1, auto
  7109. Enable automatic detection of field parity.
  7110. @end table
  7111. The default value is @code{auto}.
  7112. If the interlacing is unknown or the decoder does not export this information,
  7113. top field first will be assumed.
  7114. @item deint
  7115. Specify which frames to deinterlace. Accepts one of the following
  7116. values:
  7117. @table @option
  7118. @item 0, all
  7119. Deinterlace all frames.
  7120. @item 1, interlaced
  7121. Only deinterlace frames marked as interlaced.
  7122. @end table
  7123. The default value is @code{all}.
  7124. @end table
  7125. @section ccrepack
  7126. Repack CEA-708 closed captioning side data
  7127. This filter fixes various issues seen with commerical encoders
  7128. related to upstream malformed CEA-708 payloads, specifically
  7129. incorrect number of tuples (wrong cc_count for the target FPS),
  7130. and incorrect ordering of tuples (i.e. the CEA-608 tuples are not at
  7131. the first entries in the payload).
  7132. @section cas
  7133. Apply Contrast Adaptive Sharpen filter to video stream.
  7134. The filter accepts the following options:
  7135. @table @option
  7136. @item strength
  7137. Set the sharpening strength. Default value is 0.
  7138. @item planes
  7139. Set planes to filter. Default value is to filter all
  7140. planes except alpha plane.
  7141. @end table
  7142. @subsection Commands
  7143. This filter supports same @ref{commands} as options.
  7144. @section chromahold
  7145. Remove all color information for all colors except for certain one.
  7146. The filter accepts the following options:
  7147. @table @option
  7148. @item color
  7149. The color which will not be replaced with neutral chroma.
  7150. @item similarity
  7151. Similarity percentage with the above color.
  7152. 0.01 matches only the exact key color, while 1.0 matches everything.
  7153. @item blend
  7154. Blend percentage.
  7155. 0.0 makes pixels either fully gray, or not gray at all.
  7156. Higher values result in more preserved color.
  7157. @item yuv
  7158. Signals that the color passed is already in YUV instead of RGB.
  7159. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7160. This can be used to pass exact YUV values as hexadecimal numbers.
  7161. @end table
  7162. @subsection Commands
  7163. This filter supports same @ref{commands} as options.
  7164. The command accepts the same syntax of the corresponding option.
  7165. If the specified expression is not valid, it is kept at its current
  7166. value.
  7167. @anchor{chromakey}
  7168. @section chromakey
  7169. YUV colorspace color/chroma keying.
  7170. The filter accepts the following options:
  7171. @table @option
  7172. @item color
  7173. The color which will be replaced with transparency.
  7174. @item similarity
  7175. Similarity percentage with the key color.
  7176. 0.01 matches only the exact key color, while 1.0 matches everything.
  7177. @item blend
  7178. Blend percentage.
  7179. 0.0 makes pixels either fully transparent, or not transparent at all.
  7180. Higher values result in semi-transparent pixels, with a higher transparency
  7181. the more similar the pixels color is to the key color.
  7182. @item yuv
  7183. Signals that the color passed is already in YUV instead of RGB.
  7184. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7185. This can be used to pass exact YUV values as hexadecimal numbers.
  7186. @end table
  7187. @subsection Commands
  7188. This filter supports same @ref{commands} as options.
  7189. The command accepts the same syntax of the corresponding option.
  7190. If the specified expression is not valid, it is kept at its current
  7191. value.
  7192. @subsection Examples
  7193. @itemize
  7194. @item
  7195. Make every green pixel in the input image transparent:
  7196. @example
  7197. ffmpeg -i input.png -vf chromakey=green out.png
  7198. @end example
  7199. @item
  7200. Overlay a greenscreen-video on top of a static black background.
  7201. @example
  7202. 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
  7203. @end example
  7204. @end itemize
  7205. @section chromakey_cuda
  7206. CUDA accelerated YUV colorspace color/chroma keying.
  7207. This filter works like normal chromakey filter but operates on CUDA frames.
  7208. for more details and parameters see @ref{chromakey}.
  7209. @subsection Examples
  7210. @itemize
  7211. @item
  7212. Make all the green pixels in the input video transparent and use it as an overlay for another video:
  7213. @example
  7214. ./ffmpeg \
  7215. -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
  7216. -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
  7217. -init_hw_device cuda \
  7218. -filter_complex \
  7219. " \
  7220. [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
  7221. [1:v]scale_cuda=format=yuv420p[base]; \
  7222. [base][overlay_video]overlay_cuda" \
  7223. -an -sn -c:v h264_nvenc -cq 20 output.mp4
  7224. @end example
  7225. @item
  7226. Process two software sources, explicitly uploading the frames:
  7227. @example
  7228. ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
  7229. -f lavfi -i color=size=800x600:color=white,format=yuv420p \
  7230. -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
  7231. -filter_complex \
  7232. " \
  7233. [0]hwupload[under]; \
  7234. [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
  7235. [under][over]overlay_cuda" \
  7236. -c:v hevc_nvenc -cq 18 -preset slow output.mp4
  7237. @end example
  7238. @end itemize
  7239. @section chromanr
  7240. Reduce chrominance noise.
  7241. The filter accepts the following options:
  7242. @table @option
  7243. @item thres
  7244. Set threshold for averaging chrominance values.
  7245. Sum of absolute difference of Y, U and V pixel components of current
  7246. pixel and neighbour pixels lower than this threshold will be used in
  7247. averaging. Luma component is left unchanged and is copied to output.
  7248. Default value is 30. Allowed range is from 1 to 200.
  7249. @item sizew
  7250. Set horizontal radius of rectangle used for averaging.
  7251. Allowed range is from 1 to 100. Default value is 5.
  7252. @item sizeh
  7253. Set vertical radius of rectangle used for averaging.
  7254. Allowed range is from 1 to 100. Default value is 5.
  7255. @item stepw
  7256. Set horizontal step when averaging. Default value is 1.
  7257. Allowed range is from 1 to 50.
  7258. Mostly useful to speed-up filtering.
  7259. @item steph
  7260. Set vertical step when averaging. Default value is 1.
  7261. Allowed range is from 1 to 50.
  7262. Mostly useful to speed-up filtering.
  7263. @item threy
  7264. Set Y threshold for averaging chrominance values.
  7265. Set finer control for max allowed difference between Y components
  7266. of current pixel and neigbour pixels.
  7267. Default value is 200. Allowed range is from 1 to 200.
  7268. @item threu
  7269. Set U threshold for averaging chrominance values.
  7270. Set finer control for max allowed difference between U components
  7271. of current pixel and neigbour pixels.
  7272. Default value is 200. Allowed range is from 1 to 200.
  7273. @item threv
  7274. Set V threshold for averaging chrominance values.
  7275. Set finer control for max allowed difference between V components
  7276. of current pixel and neigbour pixels.
  7277. Default value is 200. Allowed range is from 1 to 200.
  7278. @item distance
  7279. Set distance type used in calculations.
  7280. @table @samp
  7281. @item manhattan
  7282. Absolute difference.
  7283. @item euclidean
  7284. Difference squared.
  7285. @end table
  7286. Default distance type is manhattan.
  7287. @end table
  7288. @subsection Commands
  7289. This filter supports same @ref{commands} as options.
  7290. The command accepts the same syntax of the corresponding option.
  7291. @section chromashift
  7292. Shift chroma pixels horizontally and/or vertically.
  7293. The filter accepts the following options:
  7294. @table @option
  7295. @item cbh
  7296. Set amount to shift chroma-blue horizontally.
  7297. @item cbv
  7298. Set amount to shift chroma-blue vertically.
  7299. @item crh
  7300. Set amount to shift chroma-red horizontally.
  7301. @item crv
  7302. Set amount to shift chroma-red vertically.
  7303. @item edge
  7304. Set edge mode, can be @var{smear}, default, or @var{warp}.
  7305. @end table
  7306. @subsection Commands
  7307. This filter supports the all above options as @ref{commands}.
  7308. @section ciescope
  7309. Display CIE color diagram with pixels overlaid onto it.
  7310. The filter accepts the following options:
  7311. @table @option
  7312. @item system
  7313. Set color system.
  7314. @table @samp
  7315. @item ntsc, 470m
  7316. @item ebu, 470bg
  7317. @item smpte
  7318. @item 240m
  7319. @item apple
  7320. @item widergb
  7321. @item cie1931
  7322. @item rec709, hdtv
  7323. @item uhdtv, rec2020
  7324. @item dcip3
  7325. @end table
  7326. @item cie
  7327. Set CIE system.
  7328. @table @samp
  7329. @item xyy
  7330. @item ucs
  7331. @item luv
  7332. @end table
  7333. @item gamuts
  7334. Set what gamuts to draw.
  7335. See @code{system} option for available values.
  7336. @item size, s
  7337. Set ciescope size, by default set to 512.
  7338. @item intensity, i
  7339. Set intensity used to map input pixel values to CIE diagram.
  7340. @item contrast
  7341. Set contrast used to draw tongue colors that are out of active color system gamut.
  7342. @item corrgamma
  7343. Correct gamma displayed on scope, by default enabled.
  7344. @item showwhite
  7345. Show white point on CIE diagram, by default disabled.
  7346. @item gamma
  7347. Set input gamma. Used only with XYZ input color space.
  7348. @item fill
  7349. Fill with CIE colors. By default is enabled.
  7350. @end table
  7351. @section codecview
  7352. Visualize information exported by some codecs.
  7353. Some codecs can export information through frames using side-data or other
  7354. means. For example, some MPEG based codecs export motion vectors through the
  7355. @var{export_mvs} flag in the codec @option{flags2} option.
  7356. The filter accepts the following option:
  7357. @table @option
  7358. @item block
  7359. Display block partition structure using the luma plane.
  7360. @item mv
  7361. Set motion vectors to visualize.
  7362. Available flags for @var{mv} are:
  7363. @table @samp
  7364. @item pf
  7365. forward predicted MVs of P-frames
  7366. @item bf
  7367. forward predicted MVs of B-frames
  7368. @item bb
  7369. backward predicted MVs of B-frames
  7370. @end table
  7371. @item qp
  7372. Display quantization parameters using the chroma planes.
  7373. @item mv_type, mvt
  7374. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  7375. Available flags for @var{mv_type} are:
  7376. @table @samp
  7377. @item fp
  7378. forward predicted MVs
  7379. @item bp
  7380. backward predicted MVs
  7381. @end table
  7382. @item frame_type, ft
  7383. Set frame type to visualize motion vectors of.
  7384. Available flags for @var{frame_type} are:
  7385. @table @samp
  7386. @item if
  7387. intra-coded frames (I-frames)
  7388. @item pf
  7389. predicted frames (P-frames)
  7390. @item bf
  7391. bi-directionally predicted frames (B-frames)
  7392. @end table
  7393. @end table
  7394. @subsection Examples
  7395. @itemize
  7396. @item
  7397. Visualize forward predicted MVs of all frames using @command{ffplay}:
  7398. @example
  7399. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  7400. @end example
  7401. @item
  7402. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  7403. @example
  7404. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  7405. @end example
  7406. @end itemize
  7407. @section colorbalance
  7408. Modify intensity of primary colors (red, green and blue) of input frames.
  7409. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  7410. regions for the red-cyan, green-magenta or blue-yellow balance.
  7411. A positive adjustment value shifts the balance towards the primary color, a negative
  7412. value towards the complementary color.
  7413. The filter accepts the following options:
  7414. @table @option
  7415. @item rs
  7416. @item gs
  7417. @item bs
  7418. Adjust red, green and blue shadows (darkest pixels).
  7419. @item rm
  7420. @item gm
  7421. @item bm
  7422. Adjust red, green and blue midtones (medium pixels).
  7423. @item rh
  7424. @item gh
  7425. @item bh
  7426. Adjust red, green and blue highlights (brightest pixels).
  7427. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7428. @item pl
  7429. Preserve lightness when changing color balance. Default is disabled.
  7430. @end table
  7431. @subsection Examples
  7432. @itemize
  7433. @item
  7434. Add red color cast to shadows:
  7435. @example
  7436. colorbalance=rs=.3
  7437. @end example
  7438. @end itemize
  7439. @subsection Commands
  7440. This filter supports the all above options as @ref{commands}.
  7441. @section colorcontrast
  7442. Adjust color contrast between RGB components.
  7443. The filter accepts the following options:
  7444. @table @option
  7445. @item rc
  7446. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7447. @item gm
  7448. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7449. @item by
  7450. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7451. @item rcw
  7452. @item gmw
  7453. @item byw
  7454. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  7455. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  7456. @item pl
  7457. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  7458. @end table
  7459. @subsection Commands
  7460. This filter supports the all above options as @ref{commands}.
  7461. @section colorcorrect
  7462. Adjust color white balance selectively for blacks and whites.
  7463. This filter operates in YUV colorspace.
  7464. The filter accepts the following options:
  7465. @table @option
  7466. @item rl
  7467. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  7468. Default value is 0.
  7469. @item bl
  7470. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  7471. Default value is 0.
  7472. @item rh
  7473. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7474. Default value is 0.
  7475. @item bh
  7476. Set the blue highlight spot. Allowed range is from -1.0 to 1.0.
  7477. Default value is 0.
  7478. @item saturation
  7479. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  7480. Default value is 1.
  7481. @item analyze
  7482. If set to anything other than @code{manual} it will analyze every frame and use derived
  7483. parameters for filtering output frame.
  7484. Possible values are:
  7485. @table @samp
  7486. @item manual
  7487. @item average
  7488. @item minmax
  7489. @item median
  7490. @end table
  7491. Default value is @code{manual}.
  7492. @end table
  7493. @subsection Commands
  7494. This filter supports the all above options as @ref{commands}.
  7495. @section colorchannelmixer
  7496. Adjust video input frames by re-mixing color channels.
  7497. This filter modifies a color channel by adding the values associated to
  7498. the other channels of the same pixels. For example if the value to
  7499. modify is red, the output value will be:
  7500. @example
  7501. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  7502. @end example
  7503. The filter accepts the following options:
  7504. @table @option
  7505. @item rr
  7506. @item rg
  7507. @item rb
  7508. @item ra
  7509. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  7510. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  7511. @item gr
  7512. @item gg
  7513. @item gb
  7514. @item ga
  7515. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  7516. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  7517. @item br
  7518. @item bg
  7519. @item bb
  7520. @item ba
  7521. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  7522. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  7523. @item ar
  7524. @item ag
  7525. @item ab
  7526. @item aa
  7527. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  7528. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  7529. Allowed ranges for options are @code{[-2.0, 2.0]}.
  7530. @item pc
  7531. Set preserve color mode. The accepted values are:
  7532. @table @samp
  7533. @item none
  7534. Disable color preserving, this is default.
  7535. @item lum
  7536. Preserve luminance.
  7537. @item max
  7538. Preserve max value of RGB triplet.
  7539. @item avg
  7540. Preserve average value of RGB triplet.
  7541. @item sum
  7542. Preserve sum value of RGB triplet.
  7543. @item nrm
  7544. Preserve normalized value of RGB triplet.
  7545. @item pwr
  7546. Preserve power value of RGB triplet.
  7547. @end table
  7548. @item pa
  7549. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  7550. Default is @code{0.0}, thus disabled.
  7551. @end table
  7552. @subsection Examples
  7553. @itemize
  7554. @item
  7555. Convert source to grayscale:
  7556. @example
  7557. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  7558. @end example
  7559. @item
  7560. Simulate sepia tones:
  7561. @example
  7562. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  7563. @end example
  7564. @end itemize
  7565. @subsection Commands
  7566. This filter supports the all above options as @ref{commands}.
  7567. @section colorize
  7568. Overlay a solid color on the video stream.
  7569. The filter accepts the following options:
  7570. @table @option
  7571. @item hue
  7572. Set the color hue. Allowed range is from 0 to 360.
  7573. Default value is 0.
  7574. @item saturation
  7575. Set the color saturation. Allowed range is from 0 to 1.
  7576. Default value is 0.5.
  7577. @item lightness
  7578. Set the color lightness. Allowed range is from 0 to 1.
  7579. Default value is 0.5.
  7580. @item mix
  7581. Set the mix of source lightness. By default is set to 1.0.
  7582. Allowed range is from 0.0 to 1.0.
  7583. @end table
  7584. @subsection Commands
  7585. This filter supports the all above options as @ref{commands}.
  7586. @section colorkey
  7587. RGB colorspace color keying.
  7588. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  7589. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  7590. the similarity radius depends on the value of the blend option.
  7591. The filter accepts the following options:
  7592. @table @option
  7593. @item color
  7594. Set the color for which alpha will be set to 0 (full transparency).
  7595. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7596. Default is @code{black}.
  7597. @item similarity
  7598. Set the radius from the key color within which other colors also have full transparency.
  7599. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  7600. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  7601. around the exact key color, while 1.0 matches everything.
  7602. Default is @code{0.01}.
  7603. @item blend
  7604. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  7605. 0.0 makes pixels either fully transparent or fully opaque.
  7606. Higher values result in semi-transparent pixels, with greater transparency
  7607. the more similar the pixel color is to the key color.
  7608. Range is 0.0 to 1.0. Default is @code{0.0}.
  7609. @end table
  7610. @subsection Examples
  7611. @itemize
  7612. @item
  7613. Make every green pixel in the input image transparent:
  7614. @example
  7615. ffmpeg -i input.png -vf colorkey=green out.png
  7616. @end example
  7617. @item
  7618. Overlay a greenscreen-video on top of a static background image.
  7619. @example
  7620. 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
  7621. @end example
  7622. @end itemize
  7623. @subsection Commands
  7624. This filter supports same @ref{commands} as options.
  7625. The command accepts the same syntax of the corresponding option.
  7626. If the specified expression is not valid, it is kept at its current
  7627. value.
  7628. @section colorhold
  7629. Remove all color information for all RGB colors except for certain one.
  7630. The filter accepts the following options:
  7631. @table @option
  7632. @item color
  7633. The color which will not be replaced with neutral gray.
  7634. @item similarity
  7635. Similarity percentage with the above color.
  7636. 0.01 matches only the exact key color, while 1.0 matches everything.
  7637. @item blend
  7638. Blend percentage. 0.0 makes pixels fully gray.
  7639. Higher values result in more preserved color.
  7640. @end table
  7641. @subsection Commands
  7642. This filter supports same @ref{commands} as options.
  7643. The command accepts the same syntax of the corresponding option.
  7644. If the specified expression is not valid, it is kept at its current
  7645. value.
  7646. @section colorlevels
  7647. Adjust video input frames using levels.
  7648. The filter accepts the following options:
  7649. @table @option
  7650. @item rimin
  7651. @item gimin
  7652. @item bimin
  7653. @item aimin
  7654. Adjust red, green, blue and alpha input black point.
  7655. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7656. @item rimax
  7657. @item gimax
  7658. @item bimax
  7659. @item aimax
  7660. Adjust red, green, blue and alpha input white point.
  7661. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  7662. Input levels are used to lighten highlights (bright tones), darken shadows
  7663. (dark tones), change the balance of bright and dark tones.
  7664. @item romin
  7665. @item gomin
  7666. @item bomin
  7667. @item aomin
  7668. Adjust red, green, blue and alpha output black point.
  7669. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  7670. @item romax
  7671. @item gomax
  7672. @item bomax
  7673. @item aomax
  7674. Adjust red, green, blue and alpha output white point.
  7675. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  7676. Output levels allows manual selection of a constrained output level range.
  7677. @item preserve
  7678. Set preserve color mode. The accepted values are:
  7679. @table @samp
  7680. @item none
  7681. Disable color preserving, this is default.
  7682. @item lum
  7683. Preserve luminance.
  7684. @item max
  7685. Preserve max value of RGB triplet.
  7686. @item avg
  7687. Preserve average value of RGB triplet.
  7688. @item sum
  7689. Preserve sum value of RGB triplet.
  7690. @item nrm
  7691. Preserve normalized value of RGB triplet.
  7692. @item pwr
  7693. Preserve power value of RGB triplet.
  7694. @end table
  7695. @end table
  7696. @subsection Examples
  7697. @itemize
  7698. @item
  7699. Make video output darker:
  7700. @example
  7701. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  7702. @end example
  7703. @item
  7704. Increase contrast:
  7705. @example
  7706. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  7707. @end example
  7708. @item
  7709. Make video output lighter:
  7710. @example
  7711. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  7712. @end example
  7713. @item
  7714. Increase brightness:
  7715. @example
  7716. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  7717. @end example
  7718. @end itemize
  7719. @subsection Commands
  7720. This filter supports the all above options as @ref{commands}.
  7721. @section colormap
  7722. Apply custom color maps to video stream.
  7723. This filter needs three input video streams.
  7724. First stream is video stream that is going to be filtered out.
  7725. Second and third video stream specify color patches for source
  7726. color to target color mapping.
  7727. The filter accepts the following options:
  7728. @table @option
  7729. @item patch_size
  7730. Set the source and target video stream patch size in pixels.
  7731. @item nb_patches
  7732. Set the max number of used patches from source and target video stream.
  7733. Default value is number of patches available in additional video streams.
  7734. Max allowed number of patches is @code{64}.
  7735. @item type
  7736. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  7737. Defaults is @code{absolute}.
  7738. @item kernel
  7739. Set the kernel used to measure color differences between mapped colors.
  7740. The accepted values are:
  7741. @table @samp
  7742. @item euclidean
  7743. @item weuclidean
  7744. @end table
  7745. Default is @code{euclidean}.
  7746. @end table
  7747. @section colormatrix
  7748. Convert color matrix.
  7749. The filter accepts the following options:
  7750. @table @option
  7751. @item src
  7752. @item dst
  7753. Specify the source and destination color matrix. Both values must be
  7754. specified.
  7755. The accepted values are:
  7756. @table @samp
  7757. @item bt709
  7758. BT.709
  7759. @item fcc
  7760. FCC
  7761. @item bt601
  7762. BT.601
  7763. @item bt470
  7764. BT.470
  7765. @item bt470bg
  7766. BT.470BG
  7767. @item smpte170m
  7768. SMPTE-170M
  7769. @item smpte240m
  7770. SMPTE-240M
  7771. @item bt2020
  7772. BT.2020
  7773. @end table
  7774. @end table
  7775. For example to convert from BT.601 to SMPTE-240M, use the command:
  7776. @example
  7777. colormatrix=bt601:smpte240m
  7778. @end example
  7779. @section colorspace
  7780. Convert colorspace, transfer characteristics or color primaries.
  7781. Input video needs to have an even size.
  7782. The filter accepts the following options:
  7783. @table @option
  7784. @anchor{all}
  7785. @item all
  7786. Specify all color properties at once.
  7787. The accepted values are:
  7788. @table @samp
  7789. @item bt470m
  7790. BT.470M
  7791. @item bt470bg
  7792. BT.470BG
  7793. @item bt601-6-525
  7794. BT.601-6 525
  7795. @item bt601-6-625
  7796. BT.601-6 625
  7797. @item bt709
  7798. BT.709
  7799. @item smpte170m
  7800. SMPTE-170M
  7801. @item smpte240m
  7802. SMPTE-240M
  7803. @item bt2020
  7804. BT.2020
  7805. @end table
  7806. @anchor{space}
  7807. @item space
  7808. Specify output colorspace.
  7809. The accepted values are:
  7810. @table @samp
  7811. @item bt709
  7812. BT.709
  7813. @item fcc
  7814. FCC
  7815. @item bt470bg
  7816. BT.470BG or BT.601-6 625
  7817. @item smpte170m
  7818. SMPTE-170M or BT.601-6 525
  7819. @item smpte240m
  7820. SMPTE-240M
  7821. @item ycgco
  7822. YCgCo
  7823. @item bt2020ncl
  7824. BT.2020 with non-constant luminance
  7825. @end table
  7826. @anchor{trc}
  7827. @item trc
  7828. Specify output transfer characteristics.
  7829. The accepted values are:
  7830. @table @samp
  7831. @item bt709
  7832. BT.709
  7833. @item bt470m
  7834. BT.470M
  7835. @item bt470bg
  7836. BT.470BG
  7837. @item gamma22
  7838. Constant gamma of 2.2
  7839. @item gamma28
  7840. Constant gamma of 2.8
  7841. @item smpte170m
  7842. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7843. @item smpte240m
  7844. SMPTE-240M
  7845. @item srgb
  7846. SRGB
  7847. @item iec61966-2-1
  7848. iec61966-2-1
  7849. @item iec61966-2-4
  7850. iec61966-2-4
  7851. @item xvycc
  7852. xvycc
  7853. @item bt2020-10
  7854. BT.2020 for 10-bits content
  7855. @item bt2020-12
  7856. BT.2020 for 12-bits content
  7857. @end table
  7858. @anchor{primaries}
  7859. @item primaries
  7860. Specify output color primaries.
  7861. The accepted values are:
  7862. @table @samp
  7863. @item bt709
  7864. BT.709
  7865. @item bt470m
  7866. BT.470M
  7867. @item bt470bg
  7868. BT.470BG or BT.601-6 625
  7869. @item smpte170m
  7870. SMPTE-170M or BT.601-6 525
  7871. @item smpte240m
  7872. SMPTE-240M
  7873. @item film
  7874. film
  7875. @item smpte431
  7876. SMPTE-431
  7877. @item smpte432
  7878. SMPTE-432
  7879. @item bt2020
  7880. BT.2020
  7881. @item jedec-p22
  7882. JEDEC P22 phosphors
  7883. @end table
  7884. @anchor{range}
  7885. @item range
  7886. Specify output color range.
  7887. The accepted values are:
  7888. @table @samp
  7889. @item tv
  7890. TV (restricted) range
  7891. @item mpeg
  7892. MPEG (restricted) range
  7893. @item pc
  7894. PC (full) range
  7895. @item jpeg
  7896. JPEG (full) range
  7897. @end table
  7898. @item format
  7899. Specify output color format.
  7900. The accepted values are:
  7901. @table @samp
  7902. @item yuv420p
  7903. YUV 4:2:0 planar 8-bits
  7904. @item yuv420p10
  7905. YUV 4:2:0 planar 10-bits
  7906. @item yuv420p12
  7907. YUV 4:2:0 planar 12-bits
  7908. @item yuv422p
  7909. YUV 4:2:2 planar 8-bits
  7910. @item yuv422p10
  7911. YUV 4:2:2 planar 10-bits
  7912. @item yuv422p12
  7913. YUV 4:2:2 planar 12-bits
  7914. @item yuv444p
  7915. YUV 4:4:4 planar 8-bits
  7916. @item yuv444p10
  7917. YUV 4:4:4 planar 10-bits
  7918. @item yuv444p12
  7919. YUV 4:4:4 planar 12-bits
  7920. @end table
  7921. @item fast
  7922. Do a fast conversion, which skips gamma/primary correction. This will take
  7923. significantly less CPU, but will be mathematically incorrect. To get output
  7924. compatible with that produced by the colormatrix filter, use fast=1.
  7925. @item dither
  7926. Specify dithering mode.
  7927. The accepted values are:
  7928. @table @samp
  7929. @item none
  7930. No dithering
  7931. @item fsb
  7932. Floyd-Steinberg dithering
  7933. @end table
  7934. @item wpadapt
  7935. Whitepoint adaptation mode.
  7936. The accepted values are:
  7937. @table @samp
  7938. @item bradford
  7939. Bradford whitepoint adaptation
  7940. @item vonkries
  7941. von Kries whitepoint adaptation
  7942. @item identity
  7943. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7944. @end table
  7945. @item iall
  7946. Override all input properties at once. Same accepted values as @ref{all}.
  7947. @item ispace
  7948. Override input colorspace. Same accepted values as @ref{space}.
  7949. @item iprimaries
  7950. Override input color primaries. Same accepted values as @ref{primaries}.
  7951. @item itrc
  7952. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7953. @item irange
  7954. Override input color range. Same accepted values as @ref{range}.
  7955. @end table
  7956. The filter converts the transfer characteristics, color space and color
  7957. primaries to the specified user values. The output value, if not specified,
  7958. is set to a default value based on the "all" property. If that property is
  7959. also not specified, the filter will log an error. The output color range and
  7960. format default to the same value as the input color range and format. The
  7961. input transfer characteristics, color space, color primaries and color range
  7962. should be set on the input data. If any of these are missing, the filter will
  7963. log an error and no conversion will take place.
  7964. For example to convert the input to SMPTE-240M, use the command:
  7965. @example
  7966. colorspace=smpte240m
  7967. @end example
  7968. @section colorspace_cuda
  7969. CUDA accelerated implementation of the colorspace filter.
  7970. It is by no means feature complete compared to the software colorspace filter,
  7971. and at the current time only supports color range conversion between jpeg/full
  7972. and mpeg/limited range.
  7973. The filter accepts the following options:
  7974. @table @option
  7975. @item range
  7976. Specify output color range.
  7977. The accepted values are:
  7978. @table @samp
  7979. @item tv
  7980. TV (restricted) range
  7981. @item mpeg
  7982. MPEG (restricted) range
  7983. @item pc
  7984. PC (full) range
  7985. @item jpeg
  7986. JPEG (full) range
  7987. @end table
  7988. @end table
  7989. @section colortemperature
  7990. Adjust color temperature in video to simulate variations in ambient color temperature.
  7991. The filter accepts the following options:
  7992. @table @option
  7993. @item temperature
  7994. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7995. Default value is 6500 K.
  7996. @item mix
  7997. Set mixing with filtered output. Allowed range is from 0 to 1.
  7998. Default value is 1.
  7999. @item pl
  8000. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  8001. Default value is 0.
  8002. @end table
  8003. @subsection Commands
  8004. This filter supports same @ref{commands} as options.
  8005. @section convolution
  8006. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  8007. The filter accepts the following options:
  8008. @table @option
  8009. @item 0m
  8010. @item 1m
  8011. @item 2m
  8012. @item 3m
  8013. Set matrix for each plane.
  8014. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  8015. and from 1 to 49 odd number of signed integers in @var{row} mode.
  8016. @item 0rdiv
  8017. @item 1rdiv
  8018. @item 2rdiv
  8019. @item 3rdiv
  8020. Set multiplier for calculated value for each plane.
  8021. If unset or 0, it will be sum of all matrix elements.
  8022. @item 0bias
  8023. @item 1bias
  8024. @item 2bias
  8025. @item 3bias
  8026. Set bias for each plane. This value is added to the result of the multiplication.
  8027. Useful for making the overall image brighter or darker. Default is 0.0.
  8028. @item 0mode
  8029. @item 1mode
  8030. @item 2mode
  8031. @item 3mode
  8032. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  8033. Default is @var{square}.
  8034. @end table
  8035. @subsection Commands
  8036. This filter supports the all above options as @ref{commands}.
  8037. @subsection Examples
  8038. @itemize
  8039. @item
  8040. Apply sharpen:
  8041. @example
  8042. 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"
  8043. @end example
  8044. @item
  8045. Apply blur:
  8046. @example
  8047. 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"
  8048. @end example
  8049. @item
  8050. Apply edge enhance:
  8051. @example
  8052. 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"
  8053. @end example
  8054. @item
  8055. Apply edge detect:
  8056. @example
  8057. 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"
  8058. @end example
  8059. @item
  8060. Apply laplacian edge detector which includes diagonals:
  8061. @example
  8062. 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"
  8063. @end example
  8064. @item
  8065. Apply emboss:
  8066. @example
  8067. 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"
  8068. @end example
  8069. @end itemize
  8070. @section convolve
  8071. Apply 2D convolution of video stream in frequency domain using second stream
  8072. as impulse.
  8073. The filter accepts the following options:
  8074. @table @option
  8075. @item planes
  8076. Set which planes to process.
  8077. @item impulse
  8078. Set which impulse video frames will be processed, can be @var{first}
  8079. or @var{all}. Default is @var{all}.
  8080. @end table
  8081. The @code{convolve} filter also supports the @ref{framesync} options.
  8082. @section copy
  8083. Copy the input video source unchanged to the output. This is mainly useful for
  8084. testing purposes.
  8085. @anchor{coreimage}
  8086. @section coreimage
  8087. Video filtering on GPU using Apple's CoreImage API on OSX.
  8088. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  8089. processed by video hardware. However, software-based OpenGL implementations
  8090. exist which means there is no guarantee for hardware processing. It depends on
  8091. the respective OSX.
  8092. There are many filters and image generators provided by Apple that come with a
  8093. large variety of options. The filter has to be referenced by its name along
  8094. with its options.
  8095. The coreimage filter accepts the following options:
  8096. @table @option
  8097. @item list_filters
  8098. List all available filters and generators along with all their respective
  8099. options as well as possible minimum and maximum values along with the default
  8100. values.
  8101. @example
  8102. list_filters=true
  8103. @end example
  8104. @item filter
  8105. Specify all filters by their respective name and options.
  8106. Use @var{list_filters} to determine all valid filter names and options.
  8107. Numerical options are specified by a float value and are automatically clamped
  8108. to their respective value range. Vector and color options have to be specified
  8109. by a list of space separated float values. Character escaping has to be done.
  8110. A special option name @code{default} is available to use default options for a
  8111. filter.
  8112. It is required to specify either @code{default} or at least one of the filter options.
  8113. All omitted options are used with their default values.
  8114. The syntax of the filter string is as follows:
  8115. @example
  8116. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  8117. @end example
  8118. @item output_rect
  8119. Specify a rectangle where the output of the filter chain is copied into the
  8120. input image. It is given by a list of space separated float values:
  8121. @example
  8122. output_rect=x\ y\ width\ height
  8123. @end example
  8124. If not given, the output rectangle equals the dimensions of the input image.
  8125. The output rectangle is automatically cropped at the borders of the input
  8126. image. Negative values are valid for each component.
  8127. @example
  8128. output_rect=25\ 25\ 100\ 100
  8129. @end example
  8130. @end table
  8131. Several filters can be chained for successive processing without GPU-HOST
  8132. transfers allowing for fast processing of complex filter chains.
  8133. Currently, only filters with zero (generators) or exactly one (filters) input
  8134. image and one output image are supported. Also, transition filters are not yet
  8135. usable as intended.
  8136. Some filters generate output images with additional padding depending on the
  8137. respective filter kernel. The padding is automatically removed to ensure the
  8138. filter output has the same size as the input image.
  8139. For image generators, the size of the output image is determined by the
  8140. previous output image of the filter chain or the input image of the whole
  8141. filterchain, respectively. The generators do not use the pixel information of
  8142. this image to generate their output. However, the generated output is
  8143. blended onto this image, resulting in partial or complete coverage of the
  8144. output image.
  8145. The @ref{coreimagesrc} video source can be used for generating input images
  8146. which are directly fed into the filter chain. By using it, providing input
  8147. images by another video source or an input video is not required.
  8148. @subsection Examples
  8149. @itemize
  8150. @item
  8151. List all filters available:
  8152. @example
  8153. coreimage=list_filters=true
  8154. @end example
  8155. @item
  8156. Use the CIBoxBlur filter with default options to blur an image:
  8157. @example
  8158. coreimage=filter=CIBoxBlur@@default
  8159. @end example
  8160. @item
  8161. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  8162. its center at 100x100 and a radius of 50 pixels:
  8163. @example
  8164. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  8165. @end example
  8166. @item
  8167. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  8168. given as complete and escaped command-line for Apple's standard bash shell:
  8169. @example
  8170. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  8171. @end example
  8172. @end itemize
  8173. @section corr
  8174. Obtain the correlation between two input videos.
  8175. This filter takes two input videos.
  8176. Both input videos must have the same resolution and pixel format for
  8177. this filter to work correctly. Also it assumes that both inputs
  8178. have the same number of frames, which are compared one by one.
  8179. The obtained per component, average, min and max correlation is printed through
  8180. the logging system.
  8181. The filter stores the calculated correlation of each frame in frame metadata.
  8182. This filter also supports the @ref{framesync} options.
  8183. In the below example the input file @file{main.mpg} being processed is compared
  8184. with the reference file @file{ref.mpg}.
  8185. @example
  8186. ffmpeg -i main.mpg -i ref.mpg -lavfi corr -f null -
  8187. @end example
  8188. @section cover_rect
  8189. Cover a rectangular object
  8190. It accepts the following options:
  8191. @table @option
  8192. @item cover
  8193. Filepath of the optional cover image, needs to be in yuv420.
  8194. @item mode
  8195. Set covering mode.
  8196. It accepts the following values:
  8197. @table @samp
  8198. @item cover
  8199. cover it by the supplied image
  8200. @item blur
  8201. cover it by interpolating the surrounding pixels
  8202. @end table
  8203. Default value is @var{blur}.
  8204. @end table
  8205. @subsection Examples
  8206. @itemize
  8207. @item
  8208. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8209. @example
  8210. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8211. @end example
  8212. @end itemize
  8213. @section crop
  8214. Crop the input video to given dimensions.
  8215. It accepts the following parameters:
  8216. @table @option
  8217. @item w, out_w
  8218. The width of the output video. It defaults to @code{iw}.
  8219. This expression is evaluated only once during the filter
  8220. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  8221. @item h, out_h
  8222. The height of the output video. It defaults to @code{ih}.
  8223. This expression is evaluated only once during the filter
  8224. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  8225. @item x
  8226. The horizontal position, in the input video, of the left edge of the output
  8227. video. It defaults to @code{(in_w-out_w)/2}.
  8228. This expression is evaluated per-frame.
  8229. @item y
  8230. The vertical position, in the input video, of the top edge of the output video.
  8231. It defaults to @code{(in_h-out_h)/2}.
  8232. This expression is evaluated per-frame.
  8233. @item keep_aspect
  8234. If set to 1 will force the output display aspect ratio
  8235. to be the same of the input, by changing the output sample aspect
  8236. ratio. It defaults to 0.
  8237. @item exact
  8238. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  8239. width/height/x/y as specified and will not be rounded to nearest smaller value.
  8240. It defaults to 0.
  8241. @end table
  8242. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  8243. expressions containing the following constants:
  8244. @table @option
  8245. @item x
  8246. @item y
  8247. The computed values for @var{x} and @var{y}. They are evaluated for
  8248. each new frame.
  8249. @item in_w
  8250. @item in_h
  8251. The input width and height.
  8252. @item iw
  8253. @item ih
  8254. These are the same as @var{in_w} and @var{in_h}.
  8255. @item out_w
  8256. @item out_h
  8257. The output (cropped) width and height.
  8258. @item ow
  8259. @item oh
  8260. These are the same as @var{out_w} and @var{out_h}.
  8261. @item a
  8262. same as @var{iw} / @var{ih}
  8263. @item sar
  8264. input sample aspect ratio
  8265. @item dar
  8266. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8267. @item hsub
  8268. @item vsub
  8269. horizontal and vertical chroma subsample values. For example for the
  8270. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8271. @item n
  8272. The number of the input frame, starting from 0.
  8273. @item pos
  8274. the position in the file of the input frame, NAN if unknown; deprecated,
  8275. do not use
  8276. @item t
  8277. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  8278. @end table
  8279. The expression for @var{out_w} may depend on the value of @var{out_h},
  8280. and the expression for @var{out_h} may depend on @var{out_w}, but they
  8281. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  8282. evaluated after @var{out_w} and @var{out_h}.
  8283. The @var{x} and @var{y} parameters specify the expressions for the
  8284. position of the top-left corner of the output (non-cropped) area. They
  8285. are evaluated for each frame. If the evaluated value is not valid, it
  8286. is approximated to the nearest valid value.
  8287. The expression for @var{x} may depend on @var{y}, and the expression
  8288. for @var{y} may depend on @var{x}.
  8289. @subsection Examples
  8290. @itemize
  8291. @item
  8292. Crop area with size 100x100 at position (12,34).
  8293. @example
  8294. crop=100:100:12:34
  8295. @end example
  8296. Using named options, the example above becomes:
  8297. @example
  8298. crop=w=100:h=100:x=12:y=34
  8299. @end example
  8300. @item
  8301. Crop the central input area with size 100x100:
  8302. @example
  8303. crop=100:100
  8304. @end example
  8305. @item
  8306. Crop the central input area with size 2/3 of the input video:
  8307. @example
  8308. crop=2/3*in_w:2/3*in_h
  8309. @end example
  8310. @item
  8311. Crop the input video central square:
  8312. @example
  8313. crop=out_w=in_h
  8314. crop=in_h
  8315. @end example
  8316. @item
  8317. Delimit the rectangle with the top-left corner placed at position
  8318. 100:100 and the right-bottom corner corresponding to the right-bottom
  8319. corner of the input image.
  8320. @example
  8321. crop=in_w-100:in_h-100:100:100
  8322. @end example
  8323. @item
  8324. Crop 10 pixels from the left and right borders, and 20 pixels from
  8325. the top and bottom borders
  8326. @example
  8327. crop=in_w-2*10:in_h-2*20
  8328. @end example
  8329. @item
  8330. Keep only the bottom right quarter of the input image:
  8331. @example
  8332. crop=in_w/2:in_h/2:in_w/2:in_h/2
  8333. @end example
  8334. @item
  8335. Crop height for getting Greek harmony:
  8336. @example
  8337. crop=in_w:1/PHI*in_w
  8338. @end example
  8339. @item
  8340. Apply trembling effect:
  8341. @example
  8342. 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)
  8343. @end example
  8344. @item
  8345. Apply erratic camera effect depending on timestamp:
  8346. @example
  8347. 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)
  8348. @end example
  8349. @item
  8350. Set x depending on the value of y:
  8351. @example
  8352. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  8353. @end example
  8354. @end itemize
  8355. @subsection Commands
  8356. This filter supports the following commands:
  8357. @table @option
  8358. @item w, out_w
  8359. @item h, out_h
  8360. @item x
  8361. @item y
  8362. Set width/height of the output video and the horizontal/vertical position
  8363. in the input video.
  8364. The command accepts the same syntax of the corresponding option.
  8365. If the specified expression is not valid, it is kept at its current
  8366. value.
  8367. @end table
  8368. @section cropdetect
  8369. Auto-detect the crop size.
  8370. It calculates the necessary cropping parameters and prints the
  8371. recommended parameters via the logging system. The detected dimensions
  8372. correspond to the non-black or video area of the input video according to @var{mode}.
  8373. It accepts the following parameters:
  8374. @table @option
  8375. @item mode
  8376. 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.
  8377. @table @samp
  8378. @item black
  8379. Detect black pixels surrounding the playing video. For fine control use option @var{limit}.
  8380. @item mvedges
  8381. Detect the playing video by the motion vectors inside the video and scanning for edge pixels typically forming the border of a playing video.
  8382. @end table
  8383. @item limit
  8384. Set higher black value threshold, which can be optionally specified
  8385. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  8386. value greater to the set value is considered non-black. It defaults to 24.
  8387. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  8388. on the bitdepth of the pixel format.
  8389. @item round
  8390. The value which the width/height should be divisible by. It defaults to
  8391. 16. The offset is automatically adjusted to center the video. Use 2 to
  8392. get only even dimensions (needed for 4:2:2 video). 16 is best when
  8393. encoding to most video codecs.
  8394. @item skip
  8395. Set the number of initial frames for which evaluation is skipped.
  8396. Default is 2. Range is 0 to INT_MAX.
  8397. @item reset_count, reset
  8398. Set the counter that determines after how many frames cropdetect will
  8399. reset the previously detected largest video area and start over to
  8400. detect the current optimal crop area. Default value is 0.
  8401. This can be useful when channel logos distort the video area. 0
  8402. indicates 'never reset', and returns the largest area encountered during
  8403. playback.
  8404. @item mv_threshold
  8405. Set motion in pixel units as threshold for motion detection. It defaults to 8.
  8406. @item low
  8407. @item high
  8408. Set low and high threshold values used by the Canny thresholding
  8409. algorithm.
  8410. The high threshold selects the "strong" edge pixels, which are then
  8411. connected through 8-connectivity with the "weak" edge pixels selected
  8412. by the low threshold.
  8413. @var{low} and @var{high} threshold values must be chosen in the range
  8414. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8415. Default value for @var{low} is @code{5/255}, and default value for @var{high}
  8416. is @code{15/255}.
  8417. @end table
  8418. @subsection Examples
  8419. @itemize
  8420. @item
  8421. Find video area surrounded by black borders:
  8422. @example
  8423. ffmpeg -i file.mp4 -vf cropdetect,metadata=mode=print -f null -
  8424. @end example
  8425. @item
  8426. Find an embedded video area, generate motion vectors beforehand:
  8427. @example
  8428. ffmpeg -i file.mp4 -vf mestimate,cropdetect=mode=mvedges,metadata=mode=print -f null -
  8429. @end example
  8430. @item
  8431. Find an embedded video area, use motion vectors from decoder:
  8432. @example
  8433. ffmpeg -flags2 +export_mvs -i file.mp4 -vf cropdetect=mode=mvedges,metadata=mode=print -f null -
  8434. @end example
  8435. @end itemize
  8436. @subsection Commands
  8437. This filter supports the following commands:
  8438. @table @option
  8439. @item limit
  8440. The command accepts the same syntax of the corresponding option.
  8441. If the specified expression is not valid, it is kept at its current value.
  8442. @end table
  8443. @anchor{cue}
  8444. @section cue
  8445. Delay video filtering until a given wallclock timestamp. The filter first
  8446. passes on @option{preroll} amount of frames, then it buffers at most
  8447. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  8448. it forwards the buffered frames and also any subsequent frames coming in its
  8449. input.
  8450. The filter can be used synchronize the output of multiple ffmpeg processes for
  8451. realtime output devices like decklink. By putting the delay in the filtering
  8452. chain and pre-buffering frames the process can pass on data to output almost
  8453. immediately after the target wallclock timestamp is reached.
  8454. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  8455. some use cases.
  8456. @table @option
  8457. @item cue
  8458. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  8459. @item preroll
  8460. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  8461. @item buffer
  8462. The maximum duration of content to buffer before waiting for the cue expressed
  8463. in seconds. Default is 0.
  8464. @end table
  8465. @anchor{curves}
  8466. @section curves
  8467. Apply color adjustments using curves.
  8468. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  8469. component (red, green and blue) has its values defined by @var{N} key points
  8470. tied from each other using a smooth curve. The x-axis represents the pixel
  8471. values from the input frame, and the y-axis the new pixel values to be set for
  8472. the output frame.
  8473. By default, a component curve is defined by the two points @var{(0;0)} and
  8474. @var{(1;1)}. This creates a straight line where each original pixel value is
  8475. "adjusted" to its own value, which means no change to the image.
  8476. The filter allows you to redefine these two points and add some more. A new
  8477. curve will be define to pass smoothly through all these new coordinates. The
  8478. new defined points needs to be strictly increasing over the x-axis, and their
  8479. @var{x} and @var{y} values must be in the @var{[0;1]} interval. The curve is
  8480. formed by using a natural or monotonic cubic spline interpolation, depending
  8481. on the @var{interp} option (default: @code{natural}). The @code{natural}
  8482. spline produces a smoother curve in general while the monotonic (@code{pchip})
  8483. spline guarantees the transitions between the specified points to be
  8484. monotonic. If the computed curves happened to go outside the vector spaces,
  8485. the values will be clipped accordingly.
  8486. The filter accepts the following options:
  8487. @table @option
  8488. @item preset
  8489. Select one of the available color presets. This option can be used in addition
  8490. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  8491. options takes priority on the preset values.
  8492. Available presets are:
  8493. @table @samp
  8494. @item none
  8495. @item color_negative
  8496. @item cross_process
  8497. @item darker
  8498. @item increase_contrast
  8499. @item lighter
  8500. @item linear_contrast
  8501. @item medium_contrast
  8502. @item negative
  8503. @item strong_contrast
  8504. @item vintage
  8505. @end table
  8506. Default is @code{none}.
  8507. @item master, m
  8508. Set the master key points. These points will define a second pass mapping. It
  8509. is sometimes called a "luminance" or "value" mapping. It can be used with
  8510. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  8511. post-processing LUT.
  8512. @item red, r
  8513. Set the key points for the red component.
  8514. @item green, g
  8515. Set the key points for the green component.
  8516. @item blue, b
  8517. Set the key points for the blue component.
  8518. @item all
  8519. Set the key points for all components (not including master).
  8520. Can be used in addition to the other key points component
  8521. options. In this case, the unset component(s) will fallback on this
  8522. @option{all} setting.
  8523. @item psfile
  8524. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  8525. @item plot
  8526. Save Gnuplot script of the curves in specified file.
  8527. @item interp
  8528. Specify the kind of interpolation. Available algorithms are:
  8529. @table @samp
  8530. @item natural
  8531. Natural cubic spline using a piece-wise cubic polynomial that is twice continuously differentiable.
  8532. @item pchip
  8533. Monotonic cubic spline using a piecewise cubic Hermite interpolating polynomial (PCHIP).
  8534. @end table
  8535. @end table
  8536. To avoid some filtergraph syntax conflicts, each key points list need to be
  8537. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  8538. @subsection Commands
  8539. This filter supports same @ref{commands} as options.
  8540. @subsection Examples
  8541. @itemize
  8542. @item
  8543. Increase slightly the middle level of blue:
  8544. @example
  8545. curves=blue='0/0 0.5/0.58 1/1'
  8546. @end example
  8547. @item
  8548. Vintage effect:
  8549. @example
  8550. 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'
  8551. @end example
  8552. Here we obtain the following coordinates for each components:
  8553. @table @var
  8554. @item red
  8555. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  8556. @item green
  8557. @code{(0;0) (0.50;0.48) (1;1)}
  8558. @item blue
  8559. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  8560. @end table
  8561. @item
  8562. The previous example can also be achieved with the associated built-in preset:
  8563. @example
  8564. curves=preset=vintage
  8565. @end example
  8566. @item
  8567. Or simply:
  8568. @example
  8569. curves=vintage
  8570. @end example
  8571. @item
  8572. Use a Photoshop preset and redefine the points of the green component:
  8573. @example
  8574. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  8575. @end example
  8576. @item
  8577. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  8578. and @command{gnuplot}:
  8579. @example
  8580. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  8581. gnuplot -p /tmp/curves.plt
  8582. @end example
  8583. @end itemize
  8584. @section datascope
  8585. Video data analysis filter.
  8586. This filter shows hexadecimal pixel values of part of video.
  8587. The filter accepts the following options:
  8588. @table @option
  8589. @item size, s
  8590. Set output video size.
  8591. @item x
  8592. Set x offset from where to pick pixels.
  8593. @item y
  8594. Set y offset from where to pick pixels.
  8595. @item mode
  8596. Set scope mode, can be one of the following:
  8597. @table @samp
  8598. @item mono
  8599. Draw hexadecimal pixel values with white color on black background.
  8600. @item color
  8601. Draw hexadecimal pixel values with input video pixel color on black
  8602. background.
  8603. @item color2
  8604. Draw hexadecimal pixel values on color background picked from input video,
  8605. the text color is picked in such way so its always visible.
  8606. @end table
  8607. @item axis
  8608. Draw rows and columns numbers on left and top of video.
  8609. @item opacity
  8610. Set background opacity.
  8611. @item format
  8612. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  8613. @item components
  8614. Set pixel components to display. By default all pixel components are displayed.
  8615. @end table
  8616. @subsection Commands
  8617. This filter supports same @ref{commands} as options excluding @code{size} option.
  8618. @section dblur
  8619. Apply Directional blur filter.
  8620. The filter accepts the following options:
  8621. @table @option
  8622. @item angle
  8623. Set angle of directional blur. Default is @code{45}.
  8624. @item radius
  8625. Set radius of directional blur. Default is @code{5}.
  8626. @item planes
  8627. Set which planes to filter. By default all planes are filtered.
  8628. @end table
  8629. @subsection Commands
  8630. This filter supports same @ref{commands} as options.
  8631. The command accepts the same syntax of the corresponding option.
  8632. If the specified expression is not valid, it is kept at its current
  8633. value.
  8634. @section dctdnoiz
  8635. Denoise frames using 2D DCT (frequency domain filtering).
  8636. This filter is not designed for real time.
  8637. The filter accepts the following options:
  8638. @table @option
  8639. @item sigma, s
  8640. Set the noise sigma constant.
  8641. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  8642. coefficient (absolute value) below this threshold with be dropped.
  8643. If you need a more advanced filtering, see @option{expr}.
  8644. Default is @code{0}.
  8645. @item overlap
  8646. Set number overlapping pixels for each block. Since the filter can be slow, you
  8647. may want to reduce this value, at the cost of a less effective filter and the
  8648. risk of various artefacts.
  8649. If the overlapping value doesn't permit processing the whole input width or
  8650. height, a warning will be displayed and according borders won't be denoised.
  8651. Default value is @var{blocksize}-1, which is the best possible setting.
  8652. @item expr, e
  8653. Set the coefficient factor expression.
  8654. For each coefficient of a DCT block, this expression will be evaluated as a
  8655. multiplier value for the coefficient.
  8656. If this is option is set, the @option{sigma} option will be ignored.
  8657. The absolute value of the coefficient can be accessed through the @var{c}
  8658. variable.
  8659. @item n
  8660. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  8661. @var{blocksize}, which is the width and height of the processed blocks.
  8662. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  8663. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  8664. on the speed processing. Also, a larger block size does not necessarily means a
  8665. better de-noising.
  8666. @end table
  8667. @subsection Examples
  8668. Apply a denoise with a @option{sigma} of @code{4.5}:
  8669. @example
  8670. dctdnoiz=4.5
  8671. @end example
  8672. The same operation can be achieved using the expression system:
  8673. @example
  8674. dctdnoiz=e='gte(c, 4.5*3)'
  8675. @end example
  8676. Violent denoise using a block size of @code{16x16}:
  8677. @example
  8678. dctdnoiz=15:n=4
  8679. @end example
  8680. @section deband
  8681. Remove banding artifacts from input video.
  8682. It works by replacing banded pixels with average value of referenced pixels.
  8683. The filter accepts the following options:
  8684. @table @option
  8685. @item 1thr
  8686. @item 2thr
  8687. @item 3thr
  8688. @item 4thr
  8689. Set banding detection threshold for each plane. Default is 0.02.
  8690. Valid range is 0.00003 to 0.5.
  8691. If difference between current pixel and reference pixel is less than threshold,
  8692. it will be considered as banded.
  8693. @item range, r
  8694. Banding detection range in pixels. Default is 16. If positive, random number
  8695. in range 0 to set value will be used. If negative, exact absolute value
  8696. will be used.
  8697. The range defines square of four pixels around current pixel.
  8698. @item direction, d
  8699. Set direction in radians from which four pixel will be compared. If positive,
  8700. random direction from 0 to set direction will be picked. If negative, exact of
  8701. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  8702. will pick only pixels on same row and -PI/2 will pick only pixels on same
  8703. column.
  8704. @item blur, b
  8705. If enabled, current pixel is compared with average value of all four
  8706. surrounding pixels. The default is enabled. If disabled current pixel is
  8707. compared with all four surrounding pixels. The pixel is considered banded
  8708. if only all four differences with surrounding pixels are less than threshold.
  8709. @item coupling, c
  8710. If enabled, current pixel is changed if and only if all pixel components are banded,
  8711. e.g. banding detection threshold is triggered for all color components.
  8712. The default is disabled.
  8713. @end table
  8714. @subsection Commands
  8715. This filter supports the all above options as @ref{commands}.
  8716. @section deblock
  8717. Remove blocking artifacts from input video.
  8718. The filter accepts the following options:
  8719. @table @option
  8720. @item filter
  8721. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  8722. This controls what kind of deblocking is applied.
  8723. @item block
  8724. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  8725. @item alpha
  8726. @item beta
  8727. @item gamma
  8728. @item delta
  8729. Set blocking detection thresholds. Allowed range is 0 to 1.
  8730. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  8731. Using higher threshold gives more deblocking strength.
  8732. Setting @var{alpha} controls threshold detection at exact edge of block.
  8733. Remaining options controls threshold detection near the edge. Each one for
  8734. below/above or left/right. Setting any of those to @var{0} disables
  8735. deblocking.
  8736. @item planes
  8737. Set planes to filter. Default is to filter all available planes.
  8738. @end table
  8739. @subsection Examples
  8740. @itemize
  8741. @item
  8742. Deblock using weak filter and block size of 4 pixels.
  8743. @example
  8744. deblock=filter=weak:block=4
  8745. @end example
  8746. @item
  8747. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  8748. deblocking more edges.
  8749. @example
  8750. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  8751. @end example
  8752. @item
  8753. Similar as above, but filter only first plane.
  8754. @example
  8755. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  8756. @end example
  8757. @item
  8758. Similar as above, but filter only second and third plane.
  8759. @example
  8760. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  8761. @end example
  8762. @end itemize
  8763. @subsection Commands
  8764. This filter supports the all above options as @ref{commands}.
  8765. @anchor{decimate}
  8766. @section decimate
  8767. Drop duplicated frames at regular intervals.
  8768. The filter accepts the following options:
  8769. @table @option
  8770. @item cycle
  8771. Set the number of frames from which one will be dropped. Setting this to
  8772. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  8773. Default is @code{5}.
  8774. @item dupthresh
  8775. Set the threshold for duplicate detection. If the difference metric for a frame
  8776. is less than or equal to this value, then it is declared as duplicate. Default
  8777. is @code{1.1}
  8778. @item scthresh
  8779. Set scene change threshold. Default is @code{15}.
  8780. @item blockx
  8781. @item blocky
  8782. Set the size of the x and y-axis blocks used during metric calculations.
  8783. Larger blocks give better noise suppression, but also give worse detection of
  8784. small movements. Must be a power of two. Default is @code{32}.
  8785. @item ppsrc
  8786. Mark main input as a pre-processed input and activate clean source input
  8787. stream. This allows the input to be pre-processed with various filters to help
  8788. the metrics calculation while keeping the frame selection lossless. When set to
  8789. @code{1}, the first stream is for the pre-processed input, and the second
  8790. stream is the clean source from where the kept frames are chosen. Default is
  8791. @code{0}.
  8792. @item chroma
  8793. Set whether or not chroma is considered in the metric calculations. Default is
  8794. @code{1}.
  8795. @item mixed
  8796. Set whether or not the input only partially contains content to be decimated.
  8797. Default is @code{false}.
  8798. If enabled video output stream will be in variable frame rate.
  8799. @end table
  8800. @section deconvolve
  8801. Apply 2D deconvolution of video stream in frequency domain using second stream
  8802. as impulse.
  8803. The filter accepts the following options:
  8804. @table @option
  8805. @item planes
  8806. Set which planes to process.
  8807. @item impulse
  8808. Set which impulse video frames will be processed, can be @var{first}
  8809. or @var{all}. Default is @var{all}.
  8810. @item noise
  8811. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  8812. and height are not same and not power of 2 or if stream prior to convolving
  8813. had noise.
  8814. @end table
  8815. The @code{deconvolve} filter also supports the @ref{framesync} options.
  8816. @section dedot
  8817. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  8818. It accepts the following options:
  8819. @table @option
  8820. @item m
  8821. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  8822. @var{rainbows} for cross-color reduction.
  8823. @item lt
  8824. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  8825. @item tl
  8826. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  8827. @item tc
  8828. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  8829. @item ct
  8830. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  8831. @end table
  8832. @section deflate
  8833. Apply deflate effect to the video.
  8834. This filter replaces the pixel by the local(3x3) average by taking into account
  8835. only values lower than the pixel.
  8836. It accepts the following options:
  8837. @table @option
  8838. @item threshold0
  8839. @item threshold1
  8840. @item threshold2
  8841. @item threshold3
  8842. Limit the maximum change for each plane, default is 65535.
  8843. If 0, plane will remain unchanged.
  8844. @end table
  8845. @subsection Commands
  8846. This filter supports the all above options as @ref{commands}.
  8847. @section deflicker
  8848. Remove temporal frame luminance variations.
  8849. It accepts the following options:
  8850. @table @option
  8851. @item size, s
  8852. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  8853. @item mode, m
  8854. Set averaging mode to smooth temporal luminance variations.
  8855. Available values are:
  8856. @table @samp
  8857. @item am
  8858. Arithmetic mean
  8859. @item gm
  8860. Geometric mean
  8861. @item hm
  8862. Harmonic mean
  8863. @item qm
  8864. Quadratic mean
  8865. @item cm
  8866. Cubic mean
  8867. @item pm
  8868. Power mean
  8869. @item median
  8870. Median
  8871. @end table
  8872. @item bypass
  8873. Do not actually modify frame. Useful when one only wants metadata.
  8874. @end table
  8875. @section dejudder
  8876. Remove judder produced by partially interlaced telecined content.
  8877. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8878. source was partially telecined content then the output of @code{pullup,dejudder}
  8879. will have a variable frame rate. May change the recorded frame rate of the
  8880. container. Aside from that change, this filter will not affect constant frame
  8881. rate video.
  8882. The option available in this filter is:
  8883. @table @option
  8884. @item cycle
  8885. Specify the length of the window over which the judder repeats.
  8886. Accepts any integer greater than 1. Useful values are:
  8887. @table @samp
  8888. @item 4
  8889. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8890. @item 5
  8891. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8892. @item 20
  8893. If a mixture of the two.
  8894. @end table
  8895. The default is @samp{4}.
  8896. @end table
  8897. @section delogo
  8898. Suppress a TV station logo by a simple interpolation of the surrounding
  8899. pixels. Just set a rectangle covering the logo and watch it disappear
  8900. (and sometimes something even uglier appear - your mileage may vary).
  8901. It accepts the following parameters:
  8902. @table @option
  8903. @item x
  8904. @item y
  8905. Specify the top left corner coordinates of the logo. They must be
  8906. specified.
  8907. @item w
  8908. @item h
  8909. Specify the width and height of the logo to clear. They must be
  8910. specified.
  8911. @item show
  8912. When set to 1, a green rectangle is drawn on the screen to simplify
  8913. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8914. The default value is 0.
  8915. The rectangle is drawn on the outermost pixels which will be (partly)
  8916. replaced with interpolated values. The values of the next pixels
  8917. immediately outside this rectangle in each direction will be used to
  8918. compute the interpolated pixel values inside the rectangle.
  8919. @end table
  8920. @subsection Examples
  8921. @itemize
  8922. @item
  8923. Set a rectangle covering the area with top left corner coordinates 0,0
  8924. and size 100x77:
  8925. @example
  8926. delogo=x=0:y=0:w=100:h=77
  8927. @end example
  8928. @end itemize
  8929. @anchor{derain}
  8930. @section derain
  8931. Remove the rain in the input image/video by applying the derain methods based on
  8932. convolutional neural networks. Supported models:
  8933. @itemize
  8934. @item
  8935. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8936. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8937. @end itemize
  8938. Training as well as model generation scripts are provided in
  8939. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8940. The filter accepts the following options:
  8941. @table @option
  8942. @item filter_type
  8943. Specify which filter to use. This option accepts the following values:
  8944. @table @samp
  8945. @item derain
  8946. Derain filter. To conduct derain filter, you need to use a derain model.
  8947. @item dehaze
  8948. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  8949. @end table
  8950. Default value is @samp{derain}.
  8951. @item dnn_backend
  8952. Specify which DNN backend to use for model loading and execution. This option accepts
  8953. the following values:
  8954. @table @samp
  8955. @item tensorflow
  8956. TensorFlow backend. To enable this backend you
  8957. need to install the TensorFlow for C library (see
  8958. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8959. @code{--enable-libtensorflow}
  8960. @end table
  8961. @item model
  8962. Set path to model file specifying network architecture and its parameters.
  8963. Note that different backends use different file formats. TensorFlow can load files for only its format.
  8964. @end table
  8965. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  8966. @section deshake
  8967. Attempt to fix small changes in horizontal and/or vertical shift. This
  8968. filter helps remove camera shake from hand-holding a camera, bumping a
  8969. tripod, moving on a vehicle, etc.
  8970. The filter accepts the following options:
  8971. @table @option
  8972. @item x
  8973. @item y
  8974. @item w
  8975. @item h
  8976. Specify a rectangular area where to limit the search for motion
  8977. vectors.
  8978. If desired the search for motion vectors can be limited to a
  8979. rectangular area of the frame defined by its top left corner, width
  8980. and height. These parameters have the same meaning as the drawbox
  8981. filter which can be used to visualise the position of the bounding
  8982. box.
  8983. This is useful when simultaneous movement of subjects within the frame
  8984. might be confused for camera motion by the motion vector search.
  8985. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  8986. then the full frame is used. This allows later options to be set
  8987. without specifying the bounding box for the motion vector search.
  8988. Default - search the whole frame.
  8989. @item rx
  8990. @item ry
  8991. Specify the maximum extent of movement in x and y directions in the
  8992. range 0-64 pixels. Default 16.
  8993. @item edge
  8994. Specify how to generate pixels to fill blanks at the edge of the
  8995. frame. Available values are:
  8996. @table @samp
  8997. @item blank, 0
  8998. Fill zeroes at blank locations
  8999. @item original, 1
  9000. Original image at blank locations
  9001. @item clamp, 2
  9002. Extruded edge value at blank locations
  9003. @item mirror, 3
  9004. Mirrored edge at blank locations
  9005. @end table
  9006. Default value is @samp{mirror}.
  9007. @item blocksize
  9008. Specify the blocksize to use for motion search. Range 4-128 pixels,
  9009. default 8.
  9010. @item contrast
  9011. Specify the contrast threshold for blocks. Only blocks with more than
  9012. the specified contrast (difference between darkest and lightest
  9013. pixels) will be considered. Range 1-255, default 125.
  9014. @item search
  9015. Specify the search strategy. Available values are:
  9016. @table @samp
  9017. @item exhaustive, 0
  9018. Set exhaustive search
  9019. @item less, 1
  9020. Set less exhaustive search.
  9021. @end table
  9022. Default value is @samp{exhaustive}.
  9023. @item filename
  9024. If set then a detailed log of the motion search is written to the
  9025. specified file.
  9026. @end table
  9027. @section despill
  9028. Remove unwanted contamination of foreground colors, caused by reflected color of
  9029. greenscreen or bluescreen.
  9030. This filter accepts the following options:
  9031. @table @option
  9032. @item type
  9033. Set what type of despill to use.
  9034. @item mix
  9035. Set how spillmap will be generated.
  9036. @item expand
  9037. Set how much to get rid of still remaining spill.
  9038. @item red
  9039. Controls amount of red in spill area.
  9040. @item green
  9041. Controls amount of green in spill area.
  9042. Should be -1 for greenscreen.
  9043. @item blue
  9044. Controls amount of blue in spill area.
  9045. Should be -1 for bluescreen.
  9046. @item brightness
  9047. Controls brightness of spill area, preserving colors.
  9048. @item alpha
  9049. Modify alpha from generated spillmap.
  9050. @end table
  9051. @subsection Commands
  9052. This filter supports the all above options as @ref{commands}.
  9053. @section detelecine
  9054. Apply an exact inverse of the telecine operation. It requires a predefined
  9055. pattern specified using the pattern option which must be the same as that passed
  9056. to the telecine filter.
  9057. This filter accepts the following options:
  9058. @table @option
  9059. @item first_field
  9060. @table @samp
  9061. @item top, t
  9062. top field first
  9063. @item bottom, b
  9064. bottom field first
  9065. The default value is @code{top}.
  9066. @end table
  9067. @item pattern
  9068. A string of numbers representing the pulldown pattern you wish to apply.
  9069. The default value is @code{23}.
  9070. @item start_frame
  9071. A number representing position of the first frame with respect to the telecine
  9072. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  9073. @end table
  9074. @anchor{dilation}
  9075. @section dilation
  9076. Apply dilation effect to the video.
  9077. This filter replaces the pixel by the local(3x3) maximum.
  9078. It accepts the following options:
  9079. @table @option
  9080. @item threshold0
  9081. @item threshold1
  9082. @item threshold2
  9083. @item threshold3
  9084. Limit the maximum change for each plane, default is 65535.
  9085. If 0, plane will remain unchanged.
  9086. @item coordinates
  9087. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9088. pixels are used.
  9089. Flags to local 3x3 coordinates maps like this:
  9090. 1 2 3
  9091. 4 5
  9092. 6 7 8
  9093. @end table
  9094. @subsection Commands
  9095. This filter supports the all above options as @ref{commands}.
  9096. @section displace
  9097. Displace pixels as indicated by second and third input stream.
  9098. It takes three input streams and outputs one stream, the first input is the
  9099. source, and second and third input are displacement maps.
  9100. The second input specifies how much to displace pixels along the
  9101. x-axis, while the third input specifies how much to displace pixels
  9102. along the y-axis.
  9103. If one of displacement map streams terminates, last frame from that
  9104. displacement map will be used.
  9105. Note that once generated, displacements maps can be reused over and over again.
  9106. A description of the accepted options follows.
  9107. @table @option
  9108. @item edge
  9109. Set displace behavior for pixels that are out of range.
  9110. Available values are:
  9111. @table @samp
  9112. @item blank
  9113. Missing pixels are replaced by black pixels.
  9114. @item smear
  9115. Adjacent pixels will spread out to replace missing pixels.
  9116. @item wrap
  9117. Out of range pixels are wrapped so they point to pixels of other side.
  9118. @item mirror
  9119. Out of range pixels will be replaced with mirrored pixels.
  9120. @end table
  9121. Default is @samp{smear}.
  9122. @end table
  9123. @subsection Examples
  9124. @itemize
  9125. @item
  9126. Add ripple effect to rgb input of video size hd720:
  9127. @example
  9128. 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
  9129. @end example
  9130. @item
  9131. Add wave effect to rgb input of video size hd720:
  9132. @example
  9133. 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
  9134. @end example
  9135. @end itemize
  9136. @section dnn_classify
  9137. Do classification with deep neural networks based on bounding boxes.
  9138. The filter accepts the following options:
  9139. @table @option
  9140. @item dnn_backend
  9141. Specify which DNN backend to use for model loading and execution. This option accepts
  9142. only openvino now, tensorflow backends will be added.
  9143. @item model
  9144. Set path to model file specifying network architecture and its parameters.
  9145. Note that different backends use different file formats.
  9146. @item input
  9147. Set the input name of the dnn network.
  9148. @item output
  9149. Set the output name of the dnn network.
  9150. @item confidence
  9151. Set the confidence threshold (default: 0.5).
  9152. @item labels
  9153. Set path to label file specifying the mapping between label id and name.
  9154. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9155. The first line is the name of label id 0,
  9156. and the second line is the name of label id 1, etc.
  9157. The label id is considered as name if the label file is not provided.
  9158. @item backend_configs
  9159. Set the configs to be passed into backend
  9160. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9161. please use tools/python/tf_sess_config.py to get the configs for your system.
  9162. @end table
  9163. @section dnn_detect
  9164. Do object detection with deep neural networks.
  9165. The filter accepts the following options:
  9166. @table @option
  9167. @item dnn_backend
  9168. Specify which DNN backend to use for model loading and execution. This option accepts
  9169. only openvino now, tensorflow backends will be added.
  9170. @item model
  9171. Set path to model file specifying network architecture and its parameters.
  9172. Note that different backends use different file formats.
  9173. @item input
  9174. Set the input name of the dnn network.
  9175. @item output
  9176. Set the output name of the dnn network.
  9177. @item confidence
  9178. Set the confidence threshold (default: 0.5).
  9179. @item labels
  9180. Set path to label file specifying the mapping between label id and name.
  9181. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9182. The first line is the name of label id 0 (usually it is 'background'),
  9183. and the second line is the name of label id 1, etc.
  9184. The label id is considered as name if the label file is not provided.
  9185. @item backend_configs
  9186. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9187. Roll back to sync execution if the backend does not support async.
  9188. @end table
  9189. @anchor{dnn_processing}
  9190. @section dnn_processing
  9191. Do image processing with deep neural networks. It works together with another filter
  9192. which converts the pixel format of the Frame to what the dnn network requires.
  9193. The filter accepts the following options:
  9194. @table @option
  9195. @item dnn_backend
  9196. Specify which DNN backend to use for model loading and execution. This option accepts
  9197. the following values:
  9198. @table @samp
  9199. @item tensorflow
  9200. TensorFlow backend. To enable this backend you
  9201. need to install the TensorFlow for C library (see
  9202. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  9203. @code{--enable-libtensorflow}
  9204. @item openvino
  9205. OpenVINO backend. To enable this backend you
  9206. need to build and install the OpenVINO for C library (see
  9207. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  9208. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  9209. be needed if the header files and libraries are not installed into system path)
  9210. @end table
  9211. @item model
  9212. Set path to model file specifying network architecture and its parameters.
  9213. Note that different backends use different file formats. TensorFlow, OpenVINO backend can load files for only its format.
  9214. @item input
  9215. Set the input name of the dnn network.
  9216. @item output
  9217. Set the output name of the dnn network.
  9218. @item backend_configs
  9219. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9220. Roll back to sync execution if the backend does not support async.
  9221. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9222. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9223. @end table
  9224. @subsection Examples
  9225. @itemize
  9226. @item
  9227. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  9228. @example
  9229. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  9230. @end example
  9231. @item
  9232. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  9233. @example
  9234. ./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
  9235. @end example
  9236. @item
  9237. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  9238. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9239. @example
  9240. ./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
  9241. @end example
  9242. @end itemize
  9243. @section drawbox
  9244. Draw a colored box on the input image.
  9245. It accepts the following parameters:
  9246. @table @option
  9247. @item x
  9248. @item y
  9249. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  9250. @item width, w
  9251. @item height, h
  9252. The expressions which specify the width and height of the box; if 0 they are interpreted as
  9253. the input width and height. It defaults to 0.
  9254. @item color, c
  9255. Specify the color of the box to write. For the general syntax of this option,
  9256. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9257. value @code{invert} is used, the box edge color is the same as the
  9258. video with inverted luma.
  9259. @item thickness, t
  9260. The expression which sets the thickness of the box edge.
  9261. A value of @code{fill} will create a filled box. Default value is @code{3}.
  9262. See below for the list of accepted constants.
  9263. @item replace
  9264. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  9265. will overwrite the video's color and alpha pixels.
  9266. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  9267. @end table
  9268. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9269. following constants:
  9270. @table @option
  9271. @item dar
  9272. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9273. @item hsub
  9274. @item vsub
  9275. horizontal and vertical chroma subsample values. For example for the
  9276. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9277. @item in_h, ih
  9278. @item in_w, iw
  9279. The input width and height.
  9280. @item sar
  9281. The input sample aspect ratio.
  9282. @item x
  9283. @item y
  9284. The x and y offset coordinates where the box is drawn.
  9285. @item w
  9286. @item h
  9287. The width and height of the drawn box.
  9288. @item box_source
  9289. Box source can be set as side_data_detection_bboxes if you want to use box data in
  9290. detection bboxes of side data.
  9291. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  9292. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  9293. not sure about the box source.
  9294. @item t
  9295. The thickness of the drawn box.
  9296. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9297. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9298. @end table
  9299. @subsection Examples
  9300. @itemize
  9301. @item
  9302. Draw a black box around the edge of the input image:
  9303. @example
  9304. drawbox
  9305. @end example
  9306. @item
  9307. Draw a box with color red and an opacity of 50%:
  9308. @example
  9309. drawbox=10:20:200:60:red@@0.5
  9310. @end example
  9311. The previous example can be specified as:
  9312. @example
  9313. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  9314. @end example
  9315. @item
  9316. Fill the box with pink color:
  9317. @example
  9318. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  9319. @end example
  9320. @item
  9321. Draw a 2-pixel red 2.40:1 mask:
  9322. @example
  9323. 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
  9324. @end example
  9325. @end itemize
  9326. @subsection Commands
  9327. This filter supports same commands as options.
  9328. The command accepts the same syntax of the corresponding option.
  9329. If the specified expression is not valid, it is kept at its current
  9330. value.
  9331. @anchor{drawgraph}
  9332. @section drawgraph
  9333. Draw a graph using input video metadata.
  9334. It accepts the following parameters:
  9335. @table @option
  9336. @item m1
  9337. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  9338. @item fg1
  9339. Set 1st foreground color expression.
  9340. @item m2
  9341. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  9342. @item fg2
  9343. Set 2nd foreground color expression.
  9344. @item m3
  9345. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  9346. @item fg3
  9347. Set 3rd foreground color expression.
  9348. @item m4
  9349. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  9350. @item fg4
  9351. Set 4th foreground color expression.
  9352. @item min
  9353. Set minimal value of metadata value.
  9354. @item max
  9355. Set maximal value of metadata value.
  9356. @item bg
  9357. Set graph background color. Default is white.
  9358. @item mode
  9359. Set graph mode.
  9360. Available values for mode is:
  9361. @table @samp
  9362. @item bar
  9363. @item dot
  9364. @item line
  9365. @end table
  9366. Default is @code{line}.
  9367. @item slide
  9368. Set slide mode.
  9369. Available values for slide is:
  9370. @table @samp
  9371. @item frame
  9372. Draw new frame when right border is reached.
  9373. @item replace
  9374. Replace old columns with new ones.
  9375. @item scroll
  9376. Scroll from right to left.
  9377. @item rscroll
  9378. Scroll from left to right.
  9379. @item picture
  9380. Draw single picture.
  9381. @end table
  9382. Default is @code{frame}.
  9383. @item size
  9384. Set size of graph video. For the syntax of this option, check the
  9385. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9386. The default value is @code{900x256}.
  9387. @item rate, r
  9388. Set the output frame rate. Default value is @code{25}.
  9389. The foreground color expressions can use the following variables:
  9390. @table @option
  9391. @item MIN
  9392. Minimal value of metadata value.
  9393. @item MAX
  9394. Maximal value of metadata value.
  9395. @item VAL
  9396. Current metadata key value.
  9397. @end table
  9398. The color is defined as 0xAABBGGRR.
  9399. @end table
  9400. Example using metadata from @ref{signalstats} filter:
  9401. @example
  9402. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  9403. @end example
  9404. Example using metadata from @ref{ebur128} filter:
  9405. @example
  9406. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  9407. @end example
  9408. @section drawgrid
  9409. Draw a grid on the input image.
  9410. It accepts the following parameters:
  9411. @table @option
  9412. @item x
  9413. @item y
  9414. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  9415. @item width, w
  9416. @item height, h
  9417. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  9418. input width and height, respectively, minus @code{thickness}, so image gets
  9419. framed. Default to 0.
  9420. @item color, c
  9421. Specify the color of the grid. For the general syntax of this option,
  9422. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9423. value @code{invert} is used, the grid color is the same as the
  9424. video with inverted luma.
  9425. @item thickness, t
  9426. The expression which sets the thickness of the grid line. Default value is @code{1}.
  9427. See below for the list of accepted constants.
  9428. @item replace
  9429. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  9430. will overwrite the video's color and alpha pixels.
  9431. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  9432. @end table
  9433. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9434. following constants:
  9435. @table @option
  9436. @item dar
  9437. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9438. @item hsub
  9439. @item vsub
  9440. horizontal and vertical chroma subsample values. For example for the
  9441. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9442. @item in_h, ih
  9443. @item in_w, iw
  9444. The input grid cell width and height.
  9445. @item sar
  9446. The input sample aspect ratio.
  9447. @item x
  9448. @item y
  9449. The x and y coordinates of some point of grid intersection (meant to configure offset).
  9450. @item w
  9451. @item h
  9452. The width and height of the drawn cell.
  9453. @item t
  9454. The thickness of the drawn cell.
  9455. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9456. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9457. @end table
  9458. @subsection Examples
  9459. @itemize
  9460. @item
  9461. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  9462. @example
  9463. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  9464. @end example
  9465. @item
  9466. Draw a white 3x3 grid with an opacity of 50%:
  9467. @example
  9468. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  9469. @end example
  9470. @end itemize
  9471. @subsection Commands
  9472. This filter supports same commands as options.
  9473. The command accepts the same syntax of the corresponding option.
  9474. If the specified expression is not valid, it is kept at its current
  9475. value.
  9476. @anchor{drawtext}
  9477. @section drawtext
  9478. Draw a text string or text from a specified file on top of a video, using the
  9479. libfreetype library.
  9480. To enable compilation of this filter, you need to configure FFmpeg with
  9481. @code{--enable-libfreetype} and @code{--enable-libharfbuzz}.
  9482. To enable default font fallback and the @var{font} option you need to
  9483. configure FFmpeg with @code{--enable-libfontconfig}.
  9484. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  9485. @code{--enable-libfribidi}.
  9486. @subsection Syntax
  9487. It accepts the following parameters:
  9488. @table @option
  9489. @item box
  9490. Used to draw a box around text using the background color.
  9491. The value must be either 1 (enable) or 0 (disable).
  9492. The default value of @var{box} is 0.
  9493. @item boxborderw
  9494. Set the width of the border to be drawn around the box using @var{boxcolor}.
  9495. The value must be specified using one of the following formats:
  9496. @itemize @bullet
  9497. @item @code{boxborderw=10} set the width of all the borders to 10
  9498. @item @code{boxborderw=10|20} set the width of the top and bottom borders to 10
  9499. and the width of the left and right borders to 20
  9500. @item @code{boxborderw=10|20|30} set the width of the top border to 10, the width
  9501. of the bottom border to 30 and the width of the left and right borders to 20
  9502. @item @code{boxborderw=10|20|30|40} set the borders width to 10 (top), 20 (right),
  9503. 30 (bottom), 40 (left)
  9504. @end itemize
  9505. The default value of @var{boxborderw} is "0".
  9506. @item boxcolor
  9507. The color to be used for drawing box around text. For the syntax of this
  9508. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9509. The default value of @var{boxcolor} is "white".
  9510. @item line_spacing
  9511. Set the line spacing in pixels. The default value of @var{line_spacing} is 0.
  9512. @item text_align
  9513. Set the vertical and horizontal alignment of the text with respect to the box boundaries.
  9514. The value is combination of flags, one for the vertical alignment (T=top,
  9515. M=middle, B=bottom) and one for the horizontal alignment (L=left, C=center, R=right).
  9516. Please note that tab characters are only supported with the left horizontal alignment.
  9517. @item y_align
  9518. Specify what the @var{y} value is referred to. Possible values are:
  9519. @itemize @bullet
  9520. @item @code{text} the top of the highest glyph of the first text line is placed at @var{y}
  9521. @item @code{baseline} the baseline of the first text line is placed at @var{y}
  9522. @item @code{font} the baseline of the first text line is placed at @var{y} plus the
  9523. ascent (in pixels) defined in the font metrics
  9524. @end itemize
  9525. The default value of @var{y_align} is "text" for backward compatibility.
  9526. @item borderw
  9527. Set the width of the border to be drawn around the text using @var{bordercolor}.
  9528. The default value of @var{borderw} is 0.
  9529. @item bordercolor
  9530. Set the color to be used for drawing border around text. For the syntax of this
  9531. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9532. The default value of @var{bordercolor} is "black".
  9533. @item expansion
  9534. Select how the @var{text} is expanded. Can be either @code{none},
  9535. @code{strftime} (deprecated) or @code{normal} (default). See the
  9536. @ref{drawtext_expansion, Text expansion} section below for details.
  9537. @item basetime
  9538. Set a start time for the count. Value is in microseconds. Only applied
  9539. in the deprecated @code{strftime} expansion mode. To emulate in normal expansion
  9540. mode use the @code{pts} function, supplying the start time (in seconds)
  9541. as the second argument.
  9542. @item fix_bounds
  9543. If true, check and fix text coords to avoid clipping.
  9544. @item fontcolor
  9545. The color to be used for drawing fonts. For the syntax of this option, check
  9546. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9547. The default value of @var{fontcolor} is "black".
  9548. @item fontcolor_expr
  9549. String which is expanded the same way as @var{text} to obtain dynamic
  9550. @var{fontcolor} value. By default this option has empty value and is not
  9551. processed. When this option is set, it overrides @var{fontcolor} option.
  9552. @item font
  9553. The font family to be used for drawing text. By default Sans.
  9554. @item fontfile
  9555. The font file to be used for drawing text. The path must be included.
  9556. This parameter is mandatory if the fontconfig support is disabled.
  9557. @item alpha
  9558. Draw the text applying alpha blending. The value can
  9559. be a number between 0.0 and 1.0.
  9560. The expression accepts the same variables @var{x, y} as well.
  9561. The default value is 1.
  9562. Please see @var{fontcolor_expr}.
  9563. @item fontsize
  9564. The font size to be used for drawing text.
  9565. The default value of @var{fontsize} is 16.
  9566. @item text_shaping
  9567. If set to 1, attempt to shape the text (for example, reverse the order of
  9568. right-to-left text and join Arabic characters) before drawing it.
  9569. Otherwise, just draw the text exactly as given.
  9570. By default 1 (if supported).
  9571. @item ft_load_flags
  9572. The flags to be used for loading the fonts.
  9573. The flags map the corresponding flags supported by libfreetype, and are
  9574. a combination of the following values:
  9575. @table @var
  9576. @item default
  9577. @item no_scale
  9578. @item no_hinting
  9579. @item render
  9580. @item no_bitmap
  9581. @item vertical_layout
  9582. @item force_autohint
  9583. @item crop_bitmap
  9584. @item pedantic
  9585. @item ignore_global_advance_width
  9586. @item no_recurse
  9587. @item ignore_transform
  9588. @item monochrome
  9589. @item linear_design
  9590. @item no_autohint
  9591. @end table
  9592. Default value is "default".
  9593. For more information consult the documentation for the FT_LOAD_*
  9594. libfreetype flags.
  9595. @item shadowcolor
  9596. The color to be used for drawing a shadow behind the drawn text. For the
  9597. syntax of this option, check the @ref{color syntax,,"Color" section in the
  9598. ffmpeg-utils manual,ffmpeg-utils}.
  9599. The default value of @var{shadowcolor} is "black".
  9600. @item boxw
  9601. Set the width of the box to be drawn around text.
  9602. The default value of @var{boxw} is computed automatically to match the text width
  9603. @item boxh
  9604. Set the height of the box to be drawn around text.
  9605. The default value of @var{boxh} is computed automatically to match the text height
  9606. @item shadowx
  9607. @item shadowy
  9608. The x and y offsets for the text shadow position with respect to the
  9609. position of the text. They can be either positive or negative
  9610. values. The default value for both is "0".
  9611. @item start_number
  9612. The starting frame number for the n/frame_num variable. The default value
  9613. is "0".
  9614. @item tabsize
  9615. The size in number of spaces to use for rendering the tab.
  9616. Default value is 4.
  9617. @item timecode
  9618. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  9619. format. It can be used with or without text parameter. @var{timecode_rate}
  9620. option must be specified.
  9621. @item timecode_rate, rate, r
  9622. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  9623. integer. Minimum value is "1".
  9624. Drop-frame timecode is supported for frame rates 30 & 60.
  9625. @item tc24hmax
  9626. If set to 1, the output of the timecode option will wrap around at 24 hours.
  9627. Default is 0 (disabled).
  9628. @item text
  9629. The text string to be drawn. The text must be a sequence of UTF-8
  9630. encoded characters.
  9631. This parameter is mandatory if no file is specified with the parameter
  9632. @var{textfile}.
  9633. @item textfile
  9634. A text file containing text to be drawn. The text must be a sequence
  9635. of UTF-8 encoded characters.
  9636. This parameter is mandatory if no text string is specified with the
  9637. parameter @var{text}.
  9638. If both @var{text} and @var{textfile} are specified, an error is thrown.
  9639. @item text_source
  9640. Text source should be set as side_data_detection_bboxes if you want to use text data in
  9641. detection bboxes of side data.
  9642. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  9643. text data in detection bboxes of side data. So please do not use this parameter
  9644. if you are not sure about the text source.
  9645. @item reload
  9646. The @var{textfile} will be reloaded at specified frame interval.
  9647. Be sure to update @var{textfile} atomically, or it may be read partially,
  9648. or even fail.
  9649. Range is 0 to INT_MAX. Default is 0.
  9650. @item x
  9651. @item y
  9652. The expressions which specify the offsets where text will be drawn
  9653. within the video frame. They are relative to the top/left border of the
  9654. output image.
  9655. The default value of @var{x} and @var{y} is "0".
  9656. See below for the list of accepted constants and functions.
  9657. @end table
  9658. The parameters for @var{x} and @var{y} are expressions containing the
  9659. following constants and functions:
  9660. @table @option
  9661. @item dar
  9662. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9663. @item hsub
  9664. @item vsub
  9665. horizontal and vertical chroma subsample values. For example for the
  9666. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9667. @item line_h, lh
  9668. the height of each text line
  9669. @item main_h, h, H
  9670. the input height
  9671. @item main_w, w, W
  9672. the input width
  9673. @item max_glyph_a, ascent
  9674. the maximum distance from the baseline to the highest/upper grid
  9675. coordinate used to place a glyph outline point, for all the rendered
  9676. glyphs.
  9677. It is a positive value, due to the grid's orientation with the Y axis
  9678. upwards.
  9679. @item max_glyph_d, descent
  9680. the maximum distance from the baseline to the lowest grid coordinate
  9681. used to place a glyph outline point, for all the rendered glyphs.
  9682. This is a negative value, due to the grid's orientation, with the Y axis
  9683. upwards.
  9684. @item max_glyph_h
  9685. maximum glyph height, that is the maximum height for all the glyphs
  9686. contained in the rendered text, it is equivalent to @var{ascent} -
  9687. @var{descent}.
  9688. @item max_glyph_w
  9689. maximum glyph width, that is the maximum width for all the glyphs
  9690. contained in the rendered text
  9691. @item font_a
  9692. the ascent size defined in the font metrics
  9693. @item font_d
  9694. the descent size defined in the font metrics
  9695. @item top_a
  9696. the maximum ascender of the glyphs of the first text line
  9697. @item bottom_d
  9698. the maximum descender of the glyphs of the last text line
  9699. @item n
  9700. the number of input frame, starting from 0
  9701. @item rand(min, max)
  9702. return a random number included between @var{min} and @var{max}
  9703. @item sar
  9704. The input sample aspect ratio.
  9705. @item t
  9706. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9707. @item text_h, th
  9708. the height of the rendered text
  9709. @item text_w, tw
  9710. the width of the rendered text
  9711. @item x
  9712. @item y
  9713. the x and y offset coordinates where the text is drawn.
  9714. These parameters allow the @var{x} and @var{y} expressions to refer
  9715. to each other, so you can for example specify @code{y=x/dar}.
  9716. @item pict_type
  9717. A one character description of the current frame's picture type.
  9718. @item pkt_pos
  9719. The current packet's position in the input file or stream
  9720. (in bytes, from the start of the input). A value of -1 indicates
  9721. this info is not available.
  9722. @item duration
  9723. The current packet's duration, in seconds.
  9724. @item pkt_size
  9725. The current packet's size (in bytes).
  9726. @end table
  9727. @anchor{drawtext_expansion}
  9728. @subsection Text expansion
  9729. If @option{expansion} is set to @code{strftime}, the filter recognizes
  9730. sequences accepted by the @code{strftime} C function in the provided
  9731. text and expands them accordingly. Check the documentation of
  9732. @code{strftime}. This feature is deprecated in favor of @code{normal}
  9733. expansion with the @code{gmtime} or @code{localtime} expansion
  9734. functions.
  9735. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  9736. If @option{expansion} is set to @code{normal} (which is the default),
  9737. the following expansion mechanism is used.
  9738. The backslash character @samp{\}, followed by any character, always expands to
  9739. the second character.
  9740. Sequences of the form @code{%@{...@}} are expanded. The text between the
  9741. braces is a function name, possibly followed by arguments separated by ':'.
  9742. If the arguments contain special characters or delimiters (':' or '@}'),
  9743. they should be escaped.
  9744. Note that they probably must also be escaped as the value for the @option{text}
  9745. option in the filter argument string and as the filter argument in the
  9746. filtergraph description, and possibly also for the shell, that makes up to four
  9747. levels of escaping; using a text file with the @option{textfile} option avoids
  9748. these problems.
  9749. The following functions are available:
  9750. @table @command
  9751. @item expr, e
  9752. The expression evaluation result.
  9753. It must take one argument specifying the expression to be evaluated,
  9754. which accepts the same constants and functions as the @var{x} and
  9755. @var{y} values. Note that not all constants should be used, for
  9756. example the text size is not known when evaluating the expression, so
  9757. the constants @var{text_w} and @var{text_h} will have an undefined
  9758. value.
  9759. @item expr_int_format, eif
  9760. Evaluate the expression's value and output as formatted integer.
  9761. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  9762. The second argument specifies the output format. Allowed values are @samp{x},
  9763. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  9764. @code{printf} function.
  9765. The third parameter is optional and sets the number of positions taken by the output.
  9766. It can be used to add padding with zeros from the left.
  9767. @item gmtime
  9768. The time at which the filter is running, expressed in UTC.
  9769. It can accept an argument: a @code{strftime} C function format string.
  9770. The format string is extended to support the variable @var{%[1-6]N}
  9771. which prints fractions of the second with optionally specified number of digits.
  9772. @item localtime
  9773. The time at which the filter is running, expressed in the local time zone.
  9774. It can accept an argument: a @code{strftime} C function format string.
  9775. The format string is extended to support the variable @var{%[1-6]N}
  9776. which prints fractions of the second with optionally specified number of digits.
  9777. @item metadata
  9778. Frame metadata. Takes one or two arguments.
  9779. The first argument is mandatory and specifies the metadata key.
  9780. The second argument is optional and specifies a default value, used when the
  9781. metadata key is not found or empty.
  9782. Available metadata can be identified by inspecting entries
  9783. starting with TAG included within each frame section
  9784. printed by running @code{ffprobe -show_frames}.
  9785. String metadata generated in filters leading to
  9786. the drawtext filter are also available.
  9787. @item n, frame_num
  9788. The frame number, starting from 0.
  9789. @item pict_type
  9790. A one character description of the current picture type.
  9791. @item pts
  9792. The timestamp of the current frame.
  9793. It can take up to three arguments.
  9794. The first argument is the format of the timestamp; it defaults to @code{flt}
  9795. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  9796. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  9797. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  9798. @code{localtime} stands for the timestamp of the frame formatted as
  9799. local time zone time.
  9800. The second argument is an offset added to the timestamp.
  9801. If the format is set to @code{hms}, a third argument @code{24HH} may be
  9802. supplied to present the hour part of the formatted timestamp in 24h format
  9803. (00-23).
  9804. If the format is set to @code{localtime} or @code{gmtime}, a third
  9805. argument may be supplied: a @code{strftime} C function format string.
  9806. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  9807. @end table
  9808. @subsection Commands
  9809. This filter supports altering parameters via commands:
  9810. @table @option
  9811. @item reinit
  9812. Alter existing filter parameters.
  9813. Syntax for the argument is the same as for filter invocation, e.g.
  9814. @example
  9815. fontsize=56:fontcolor=green:text='Hello World'
  9816. @end example
  9817. Full filter invocation with sendcmd would look like this:
  9818. @example
  9819. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  9820. @end example
  9821. If the entire argument can't be parsed or applied as valid values then the filter will
  9822. continue with its existing parameters.
  9823. @end table
  9824. The following options are also supported as @ref{commands}:
  9825. @itemize @bullet
  9826. @item x
  9827. @item y
  9828. @item alpha
  9829. @item fontsize
  9830. @item fontcolor
  9831. @item boxcolor
  9832. @item bordercolor
  9833. @item shadowcolor
  9834. @item box
  9835. @item boxw
  9836. @item boxh
  9837. @item boxborderw
  9838. @item line_spacing
  9839. @item text_align
  9840. @item shadowx
  9841. @item shadowy
  9842. @item borderw
  9843. @end itemize
  9844. @subsection Examples
  9845. @itemize
  9846. @item
  9847. Draw "Test Text" with font FreeSerif, using the default values for the
  9848. optional parameters.
  9849. @example
  9850. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  9851. @end example
  9852. @item
  9853. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  9854. and y=50 (counting from the top-left corner of the screen), text is
  9855. yellow with a red box around it. Both the text and the box have an
  9856. opacity of 20%.
  9857. @example
  9858. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  9859. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  9860. @end example
  9861. Note that the double quotes are not necessary if spaces are not used
  9862. within the parameter list.
  9863. @item
  9864. Show the text at the center of the video frame:
  9865. @example
  9866. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  9867. @end example
  9868. @item
  9869. Show the text at a random position, switching to a new position every 30 seconds:
  9870. @example
  9871. 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)"
  9872. @end example
  9873. @item
  9874. Show a text line sliding from right to left in the last row of the video
  9875. frame. The file @file{LONG_LINE} is assumed to contain a single line
  9876. with no newlines.
  9877. @example
  9878. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  9879. @end example
  9880. @item
  9881. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  9882. @example
  9883. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  9884. @end example
  9885. @item
  9886. Draw a single green letter "g", at the center of the input video.
  9887. The glyph baseline is placed at half screen height.
  9888. @example
  9889. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  9890. @end example
  9891. @item
  9892. Show text for 1 second every 3 seconds:
  9893. @example
  9894. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  9895. @end example
  9896. @item
  9897. Use fontconfig to set the font. Note that the colons need to be escaped.
  9898. @example
  9899. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  9900. @end example
  9901. @item
  9902. Draw "Test Text" with font size dependent on height of the video.
  9903. @example
  9904. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  9905. @end example
  9906. @item
  9907. Print the date of a real-time encoding (see documentation for the
  9908. @code{strftime} C function):
  9909. @example
  9910. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  9911. @end example
  9912. @item
  9913. Show text fading in and out (appearing/disappearing):
  9914. @example
  9915. #!/bin/sh
  9916. DS=1.0 # display start
  9917. DE=10.0 # display end
  9918. FID=1.5 # fade in duration
  9919. FOD=5 # fade out duration
  9920. 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 @}"
  9921. @end example
  9922. @item
  9923. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9924. and the @option{fontsize} value are included in the @option{y} offset.
  9925. @example
  9926. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9927. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9928. @end example
  9929. @item
  9930. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9931. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9932. must have option @option{-export_path_metadata 1} for the special metadata fields
  9933. to be available for filters.
  9934. @example
  9935. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  9936. @end example
  9937. @end itemize
  9938. For more information about libfreetype, check:
  9939. @url{http://www.freetype.org/}.
  9940. For more information about fontconfig, check:
  9941. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  9942. For more information about libfribidi, check:
  9943. @url{http://fribidi.org/}.
  9944. For more information about libharfbuzz, check:
  9945. @url{https://github.com/harfbuzz/harfbuzz}.
  9946. @section edgedetect
  9947. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  9948. The filter accepts the following options:
  9949. @table @option
  9950. @item low
  9951. @item high
  9952. Set low and high threshold values used by the Canny thresholding
  9953. algorithm.
  9954. The high threshold selects the "strong" edge pixels, which are then
  9955. connected through 8-connectivity with the "weak" edge pixels selected
  9956. by the low threshold.
  9957. @var{low} and @var{high} threshold values must be chosen in the range
  9958. [0,1], and @var{low} should be lesser or equal to @var{high}.
  9959. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  9960. is @code{50/255}.
  9961. @item mode
  9962. Define the drawing mode.
  9963. @table @samp
  9964. @item wires
  9965. Draw white/gray wires on black background.
  9966. @item colormix
  9967. Mix the colors to create a paint/cartoon effect.
  9968. @item canny
  9969. Apply Canny edge detector on all selected planes.
  9970. @end table
  9971. Default value is @var{wires}.
  9972. @item planes
  9973. Select planes for filtering. By default all available planes are filtered.
  9974. @end table
  9975. @subsection Examples
  9976. @itemize
  9977. @item
  9978. Standard edge detection with custom values for the hysteresis thresholding:
  9979. @example
  9980. edgedetect=low=0.1:high=0.4
  9981. @end example
  9982. @item
  9983. Painting effect without thresholding:
  9984. @example
  9985. edgedetect=mode=colormix:high=0
  9986. @end example
  9987. @end itemize
  9988. @section elbg
  9989. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  9990. For each input image, the filter will compute the optimal mapping from
  9991. the input to the output given the codebook length, that is the number
  9992. of distinct output colors.
  9993. This filter accepts the following options.
  9994. @table @option
  9995. @item codebook_length, l
  9996. Set codebook length. The value must be a positive integer, and
  9997. represents the number of distinct output colors. Default value is 256.
  9998. @item nb_steps, n
  9999. Set the maximum number of iterations to apply for computing the optimal
  10000. mapping. The higher the value the better the result and the higher the
  10001. computation time. Default value is 1.
  10002. @item seed, s
  10003. Set a random seed, must be an integer included between 0 and
  10004. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  10005. will try to use a good random seed on a best effort basis.
  10006. @item pal8
  10007. Set pal8 output pixel format. This option does not work with codebook
  10008. length greater than 256. Default is disabled.
  10009. @item use_alpha
  10010. Include alpha values in the quantization calculation. Allows creating
  10011. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  10012. @end table
  10013. @section entropy
  10014. Measure graylevel entropy in histogram of color channels of video frames.
  10015. It accepts the following parameters:
  10016. @table @option
  10017. @item mode
  10018. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  10019. @var{diff} mode measures entropy of histogram delta values, absolute differences
  10020. between neighbour histogram values.
  10021. @end table
  10022. @section epx
  10023. Apply the EPX magnification filter which is designed for pixel art.
  10024. It accepts the following option:
  10025. @table @option
  10026. @item n
  10027. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  10028. @code{3xEPX}.
  10029. Default is @code{3}.
  10030. @end table
  10031. @section eq
  10032. Set brightness, contrast, saturation and approximate gamma adjustment.
  10033. The filter accepts the following options:
  10034. @table @option
  10035. @item contrast
  10036. Set the contrast expression. The value must be a float value in range
  10037. @code{-1000.0} to @code{1000.0}. The default value is "1".
  10038. @item brightness
  10039. Set the brightness expression. The value must be a float value in
  10040. range @code{-1.0} to @code{1.0}. The default value is "0".
  10041. @item saturation
  10042. Set the saturation expression. The value must be a float in
  10043. range @code{0.0} to @code{3.0}. The default value is "1".
  10044. @item gamma
  10045. Set the gamma expression. The value must be a float in range
  10046. @code{0.1} to @code{10.0}. The default value is "1".
  10047. @item gamma_r
  10048. Set the gamma expression for red. The value must be a float in
  10049. range @code{0.1} to @code{10.0}. The default value is "1".
  10050. @item gamma_g
  10051. Set the gamma expression for green. The value must be a float in range
  10052. @code{0.1} to @code{10.0}. The default value is "1".
  10053. @item gamma_b
  10054. Set the gamma expression for blue. The value must be a float in range
  10055. @code{0.1} to @code{10.0}. The default value is "1".
  10056. @item gamma_weight
  10057. Set the gamma weight expression. It can be used to reduce the effect
  10058. of a high gamma value on bright image areas, e.g. keep them from
  10059. getting overamplified and just plain white. The value must be a float
  10060. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  10061. gamma correction all the way down while @code{1.0} leaves it at its
  10062. full strength. Default is "1".
  10063. @item eval
  10064. Set when the expressions for brightness, contrast, saturation and
  10065. gamma expressions are evaluated.
  10066. It accepts the following values:
  10067. @table @samp
  10068. @item init
  10069. only evaluate expressions once during the filter initialization or
  10070. when a command is processed
  10071. @item frame
  10072. evaluate expressions for each incoming frame
  10073. @end table
  10074. Default value is @samp{init}.
  10075. @end table
  10076. The expressions accept the following parameters:
  10077. @table @option
  10078. @item n
  10079. frame count of the input frame starting from 0
  10080. @item pos
  10081. byte position of the corresponding packet in the input file, NAN if
  10082. unspecified; deprecated, do not use
  10083. @item r
  10084. frame rate of the input video, NAN if the input frame rate is unknown
  10085. @item t
  10086. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10087. @end table
  10088. @subsection Commands
  10089. The filter supports the following commands:
  10090. @table @option
  10091. @item contrast
  10092. Set the contrast expression.
  10093. @item brightness
  10094. Set the brightness expression.
  10095. @item saturation
  10096. Set the saturation expression.
  10097. @item gamma
  10098. Set the gamma expression.
  10099. @item gamma_r
  10100. Set the gamma_r expression.
  10101. @item gamma_g
  10102. Set gamma_g expression.
  10103. @item gamma_b
  10104. Set gamma_b expression.
  10105. @item gamma_weight
  10106. Set gamma_weight expression.
  10107. The command accepts the same syntax of the corresponding option.
  10108. If the specified expression is not valid, it is kept at its current
  10109. value.
  10110. @end table
  10111. @anchor{erosion}
  10112. @section erosion
  10113. Apply erosion effect to the video.
  10114. This filter replaces the pixel by the local(3x3) minimum.
  10115. It accepts the following options:
  10116. @table @option
  10117. @item threshold0
  10118. @item threshold1
  10119. @item threshold2
  10120. @item threshold3
  10121. Limit the maximum change for each plane, default is 65535.
  10122. If 0, plane will remain unchanged.
  10123. @item coordinates
  10124. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  10125. pixels are used.
  10126. Flags to local 3x3 coordinates maps like this:
  10127. 1 2 3
  10128. 4 5
  10129. 6 7 8
  10130. @end table
  10131. @subsection Commands
  10132. This filter supports the all above options as @ref{commands}.
  10133. @section estdif
  10134. Deinterlace the input video ("estdif" stands for "Edge Slope
  10135. Tracing Deinterlacing Filter").
  10136. Spatial only filter that uses edge slope tracing algorithm
  10137. to interpolate missing lines.
  10138. It accepts the following parameters:
  10139. @table @option
  10140. @item mode
  10141. The interlacing mode to adopt. It accepts one of the following values:
  10142. @table @option
  10143. @item frame
  10144. Output one frame for each frame.
  10145. @item field
  10146. Output one frame for each field.
  10147. @end table
  10148. The default value is @code{field}.
  10149. @item parity
  10150. The picture field parity assumed for the input interlaced video. It accepts one
  10151. of the following values:
  10152. @table @option
  10153. @item tff
  10154. Assume the top field is first.
  10155. @item bff
  10156. Assume the bottom field is first.
  10157. @item auto
  10158. Enable automatic detection of field parity.
  10159. @end table
  10160. The default value is @code{auto}.
  10161. If the interlacing is unknown or the decoder does not export this information,
  10162. top field first will be assumed.
  10163. @item deint
  10164. Specify which frames to deinterlace. Accepts one of the following
  10165. values:
  10166. @table @option
  10167. @item all
  10168. Deinterlace all frames.
  10169. @item interlaced
  10170. Only deinterlace frames marked as interlaced.
  10171. @end table
  10172. The default value is @code{all}.
  10173. @item rslope
  10174. Specify the search radius for edge slope tracing. Default value is 1.
  10175. Allowed range is from 1 to 15.
  10176. @item redge
  10177. Specify the search radius for best edge matching. Default value is 2.
  10178. Allowed range is from 0 to 15.
  10179. @item ecost
  10180. Specify the edge cost for edge matching. Default value is 2.
  10181. Allowed range is from 0 to 50.
  10182. @item mcost
  10183. Specify the middle cost for edge matching. Default value is 1.
  10184. Allowed range is from 0 to 50.
  10185. @item dcost
  10186. Specify the distance cost for edge matching. Default value is 1.
  10187. Allowed range is from 0 to 50.
  10188. @item interp
  10189. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  10190. of the following values:
  10191. @table @option
  10192. @item 2p
  10193. Two-point interpolation.
  10194. @item 4p
  10195. Four-point interpolation.
  10196. @item 6p
  10197. Six-point interpolation.
  10198. @end table
  10199. @end table
  10200. @subsection Commands
  10201. This filter supports same @ref{commands} as options.
  10202. @section exposure
  10203. Adjust exposure of the video stream.
  10204. The filter accepts the following options:
  10205. @table @option
  10206. @item exposure
  10207. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  10208. Default value is 0 EV.
  10209. @item black
  10210. Set the black level correction. Allowed range is from -1.0 to 1.0.
  10211. Default value is 0.
  10212. @end table
  10213. @subsection Commands
  10214. This filter supports same @ref{commands} as options.
  10215. @section extractplanes
  10216. Extract color channel components from input video stream into
  10217. separate grayscale video streams.
  10218. The filter accepts the following option:
  10219. @table @option
  10220. @item planes
  10221. Set plane(s) to extract.
  10222. Available values for planes are:
  10223. @table @samp
  10224. @item y
  10225. @item u
  10226. @item v
  10227. @item a
  10228. @item r
  10229. @item g
  10230. @item b
  10231. @end table
  10232. Choosing planes not available in the input will result in an error.
  10233. That means you cannot select @code{r}, @code{g}, @code{b} planes
  10234. with @code{y}, @code{u}, @code{v} planes at same time.
  10235. @end table
  10236. @subsection Examples
  10237. @itemize
  10238. @item
  10239. Extract luma, u and v color channel component from input video frame
  10240. into 3 grayscale outputs:
  10241. @example
  10242. 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
  10243. @end example
  10244. @end itemize
  10245. @section fade
  10246. Apply a fade-in/out effect to the input video.
  10247. It accepts the following parameters:
  10248. @table @option
  10249. @item type, t
  10250. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  10251. effect.
  10252. Default is @code{in}.
  10253. @item start_frame, s
  10254. Specify the number of the frame to start applying the fade
  10255. effect at. Default is 0.
  10256. @item nb_frames, n
  10257. The number of frames that the fade effect lasts. At the end of the
  10258. fade-in effect, the output video will have the same intensity as the input video.
  10259. At the end of the fade-out transition, the output video will be filled with the
  10260. selected @option{color}.
  10261. Default is 25.
  10262. @item alpha
  10263. If set to 1, fade only alpha channel, if one exists on the input.
  10264. Default value is 0.
  10265. @item start_time, st
  10266. Specify the timestamp (in seconds) of the frame to start to apply the fade
  10267. effect. If both start_frame and start_time are specified, the fade will start at
  10268. whichever comes last. Default is 0.
  10269. @item duration, d
  10270. The number of seconds for which the fade effect has to last. At the end of the
  10271. fade-in effect the output video will have the same intensity as the input video,
  10272. at the end of the fade-out transition the output video will be filled with the
  10273. selected @option{color}.
  10274. If both duration and nb_frames are specified, duration is used. Default is 0
  10275. (nb_frames is used by default).
  10276. @item color, c
  10277. Specify the color of the fade. Default is "black".
  10278. @end table
  10279. @subsection Examples
  10280. @itemize
  10281. @item
  10282. Fade in the first 30 frames of video:
  10283. @example
  10284. fade=in:0:30
  10285. @end example
  10286. The command above is equivalent to:
  10287. @example
  10288. fade=t=in:s=0:n=30
  10289. @end example
  10290. @item
  10291. Fade out the last 45 frames of a 200-frame video:
  10292. @example
  10293. fade=out:155:45
  10294. fade=type=out:start_frame=155:nb_frames=45
  10295. @end example
  10296. @item
  10297. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  10298. @example
  10299. fade=in:0:25, fade=out:975:25
  10300. @end example
  10301. @item
  10302. Make the first 5 frames yellow, then fade in from frame 5-24:
  10303. @example
  10304. fade=in:5:20:color=yellow
  10305. @end example
  10306. @item
  10307. Fade in alpha over first 25 frames of video:
  10308. @example
  10309. fade=in:0:25:alpha=1
  10310. @end example
  10311. @item
  10312. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  10313. @example
  10314. fade=t=in:st=5.5:d=0.5
  10315. @end example
  10316. @end itemize
  10317. @section feedback
  10318. Apply feedback video filter.
  10319. This filter pass cropped input frames to 2nd output.
  10320. From there it can be filtered with other video filters.
  10321. After filter receives frame from 2nd input, that frame
  10322. is combined on top of original frame from 1st input and passed
  10323. to 1st output.
  10324. The typical usage is filter only part of frame.
  10325. The filter accepts the following options:
  10326. @table @option
  10327. @item x
  10328. @item y
  10329. Set the top left crop position.
  10330. @item w
  10331. @item h
  10332. Set the crop size.
  10333. @end table
  10334. @subsection Examples
  10335. @itemize
  10336. @item
  10337. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  10338. @example
  10339. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  10340. @end example
  10341. @item
  10342. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  10343. @example
  10344. [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]
  10345. @end example
  10346. @end itemize
  10347. @section fftdnoiz
  10348. Denoise frames using 3D FFT (frequency domain filtering).
  10349. The filter accepts the following options:
  10350. @table @option
  10351. @item sigma
  10352. Set the noise sigma constant. This sets denoising strength.
  10353. Default value is 1. Allowed range is from 0 to 30.
  10354. Using very high sigma with low overlap may give blocking artifacts.
  10355. @item amount
  10356. Set amount of denoising. By default all detected noise is reduced.
  10357. Default value is 1. Allowed range is from 0 to 1.
  10358. @item block
  10359. Set size of block in pixels, Default is 32, can be 8 to 256.
  10360. @item overlap
  10361. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  10362. @item method
  10363. Set denoising method. Default is @code{wiener}, can also be @code{hard}.
  10364. @item prev
  10365. Set number of previous frames to use for denoising. By default is set to 0.
  10366. @item next
  10367. Set number of next frames to to use for denoising. By default is set to 0.
  10368. @item planes
  10369. Set planes which will be filtered, by default are all available filtered
  10370. except alpha.
  10371. @end table
  10372. @section fftfilt
  10373. Apply arbitrary expressions to samples in frequency domain
  10374. @table @option
  10375. @item dc_Y
  10376. Adjust the dc value (gain) of the luma plane of the image. The filter
  10377. accepts an integer value in range @code{0} to @code{1000}. The default
  10378. value is set to @code{0}.
  10379. @item dc_U
  10380. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  10381. filter accepts an integer value in range @code{0} to @code{1000}. The
  10382. default value is set to @code{0}.
  10383. @item dc_V
  10384. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  10385. filter accepts an integer value in range @code{0} to @code{1000}. The
  10386. default value is set to @code{0}.
  10387. @item weight_Y
  10388. Set the frequency domain weight expression for the luma plane.
  10389. @item weight_U
  10390. Set the frequency domain weight expression for the 1st chroma plane.
  10391. @item weight_V
  10392. Set the frequency domain weight expression for the 2nd chroma plane.
  10393. @item eval
  10394. Set when the expressions are evaluated.
  10395. It accepts the following values:
  10396. @table @samp
  10397. @item init
  10398. Only evaluate expressions once during the filter initialization.
  10399. @item frame
  10400. Evaluate expressions for each incoming frame.
  10401. @end table
  10402. Default value is @samp{init}.
  10403. The filter accepts the following variables:
  10404. @item X
  10405. @item Y
  10406. The coordinates of the current sample.
  10407. @item W
  10408. @item H
  10409. The width and height of the image.
  10410. @item N
  10411. The number of input frame, starting from 0.
  10412. @item WS
  10413. @item HS
  10414. The size of FFT array for horizontal and vertical processing.
  10415. @end table
  10416. @subsection Examples
  10417. @itemize
  10418. @item
  10419. High-pass:
  10420. @example
  10421. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  10422. @end example
  10423. @item
  10424. Low-pass:
  10425. @example
  10426. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  10427. @end example
  10428. @item
  10429. Sharpen:
  10430. @example
  10431. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  10432. @end example
  10433. @item
  10434. Blur:
  10435. @example
  10436. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  10437. @end example
  10438. @end itemize
  10439. @section field
  10440. Extract a single field from an interlaced image using stride
  10441. arithmetic to avoid wasting CPU time. The output frames are marked as
  10442. non-interlaced.
  10443. The filter accepts the following options:
  10444. @table @option
  10445. @item type
  10446. Specify whether to extract the top (if the value is @code{0} or
  10447. @code{top}) or the bottom field (if the value is @code{1} or
  10448. @code{bottom}).
  10449. @end table
  10450. @section fieldhint
  10451. Create new frames by copying the top and bottom fields from surrounding frames
  10452. supplied as numbers by the hint file.
  10453. @table @option
  10454. @item hint
  10455. Set file containing hints: absolute/relative frame numbers.
  10456. There must be one line for each frame in a clip. Each line must contain two
  10457. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  10458. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  10459. is current frame number for @code{absolute} mode or out of [-1, 1] range
  10460. for @code{relative} mode. First number tells from which frame to pick up top
  10461. field and second number tells from which frame to pick up bottom field.
  10462. If optionally followed by @code{+} output frame will be marked as interlaced,
  10463. else if followed by @code{-} output frame will be marked as progressive, else
  10464. it will be marked same as input frame.
  10465. If optionally followed by @code{t} output frame will use only top field, or in
  10466. case of @code{b} it will use only bottom field.
  10467. If line starts with @code{#} or @code{;} that line is skipped.
  10468. @item mode
  10469. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  10470. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  10471. are more frames to process than @code{hint} file is seek back to start.
  10472. @end table
  10473. Example of first several lines of @code{hint} file for @code{relative} mode:
  10474. @example
  10475. 0,0 - # first frame
  10476. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  10477. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  10478. 1,0 -
  10479. 0,0 -
  10480. 0,0 -
  10481. 1,0 -
  10482. 1,0 -
  10483. 1,0 -
  10484. 0,0 -
  10485. 0,0 -
  10486. 1,0 -
  10487. 1,0 -
  10488. 1,0 -
  10489. 0,0 -
  10490. @end example
  10491. @section fieldmatch
  10492. Field matching filter for inverse telecine. It is meant to reconstruct the
  10493. progressive frames from a telecined stream. The filter does not drop duplicated
  10494. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  10495. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  10496. The separation of the field matching and the decimation is notably motivated by
  10497. the possibility of inserting a de-interlacing filter fallback between the two.
  10498. If the source has mixed telecined and real interlaced content,
  10499. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  10500. But these remaining combed frames will be marked as interlaced, and thus can be
  10501. de-interlaced by a later filter such as @ref{yadif} before decimation.
  10502. In addition to the various configuration options, @code{fieldmatch} can take an
  10503. optional second stream, activated through the @option{ppsrc} option. If
  10504. enabled, the frames reconstruction will be based on the fields and frames from
  10505. this second stream. This allows the first input to be pre-processed in order to
  10506. help the various algorithms of the filter, while keeping the output lossless
  10507. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  10508. or brightness/contrast adjustments can help.
  10509. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  10510. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  10511. which @code{fieldmatch} is based on. While the semantic and usage are very
  10512. close, some behaviour and options names can differ.
  10513. The @ref{decimate} filter currently only works for constant frame rate input.
  10514. If your input has mixed telecined (30fps) and progressive content with a lower
  10515. framerate like 24fps use the following filterchain to produce the necessary cfr
  10516. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  10517. The filter accepts the following options:
  10518. @table @option
  10519. @item order
  10520. Specify the assumed field order of the input stream. Available values are:
  10521. @table @samp
  10522. @item auto
  10523. Auto detect parity (use FFmpeg's internal parity value).
  10524. @item bff
  10525. Assume bottom field first.
  10526. @item tff
  10527. Assume top field first.
  10528. @end table
  10529. Note that it is sometimes recommended not to trust the parity announced by the
  10530. stream.
  10531. Default value is @var{auto}.
  10532. @item mode
  10533. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  10534. sense that it won't risk creating jerkiness due to duplicate frames when
  10535. possible, but if there are bad edits or blended fields it will end up
  10536. outputting combed frames when a good match might actually exist. On the other
  10537. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  10538. but will almost always find a good frame if there is one. The other values are
  10539. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  10540. jerkiness and creating duplicate frames versus finding good matches in sections
  10541. with bad edits, orphaned fields, blended fields, etc.
  10542. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  10543. Available values are:
  10544. @table @samp
  10545. @item pc
  10546. 2-way matching (p/c)
  10547. @item pc_n
  10548. 2-way matching, and trying 3rd match if still combed (p/c + n)
  10549. @item pc_u
  10550. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  10551. @item pc_n_ub
  10552. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  10553. still combed (p/c + n + u/b)
  10554. @item pcn
  10555. 3-way matching (p/c/n)
  10556. @item pcn_ub
  10557. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  10558. detected as combed (p/c/n + u/b)
  10559. @end table
  10560. The parenthesis at the end indicate the matches that would be used for that
  10561. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  10562. @var{top}).
  10563. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  10564. the slowest.
  10565. Default value is @var{pc_n}.
  10566. @item ppsrc
  10567. Mark the main input stream as a pre-processed input, and enable the secondary
  10568. input stream as the clean source to pick the fields from. See the filter
  10569. introduction for more details. It is similar to the @option{clip2} feature from
  10570. VFM/TFM.
  10571. Default value is @code{0} (disabled).
  10572. @item field
  10573. Set the field to match from. It is recommended to set this to the same value as
  10574. @option{order} unless you experience matching failures with that setting. In
  10575. certain circumstances changing the field that is used to match from can have a
  10576. large impact on matching performance. Available values are:
  10577. @table @samp
  10578. @item auto
  10579. Automatic (same value as @option{order}).
  10580. @item bottom
  10581. Match from the bottom field.
  10582. @item top
  10583. Match from the top field.
  10584. @end table
  10585. Default value is @var{auto}.
  10586. @item mchroma
  10587. Set whether or not chroma is included during the match comparisons. In most
  10588. cases it is recommended to leave this enabled. You should set this to @code{0}
  10589. only if your clip has bad chroma problems such as heavy rainbowing or other
  10590. artifacts. Setting this to @code{0} could also be used to speed things up at
  10591. the cost of some accuracy.
  10592. Default value is @code{1}.
  10593. @item y0
  10594. @item y1
  10595. These define an exclusion band which excludes the lines between @option{y0} and
  10596. @option{y1} from being included in the field matching decision. An exclusion
  10597. band can be used to ignore subtitles, a logo, or other things that may
  10598. interfere with the matching. @option{y0} sets the starting scan line and
  10599. @option{y1} sets the ending line; all lines in between @option{y0} and
  10600. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  10601. @option{y0} and @option{y1} to the same value will disable the feature.
  10602. @option{y0} and @option{y1} defaults to @code{0}.
  10603. @item scthresh
  10604. Set the scene change detection threshold as a percentage of maximum change on
  10605. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  10606. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  10607. @option{scthresh} is @code{[0.0, 100.0]}.
  10608. Default value is @code{12.0}.
  10609. @item combmatch
  10610. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  10611. account the combed scores of matches when deciding what match to use as the
  10612. final match. Available values are:
  10613. @table @samp
  10614. @item none
  10615. No final matching based on combed scores.
  10616. @item sc
  10617. Combed scores are only used when a scene change is detected.
  10618. @item full
  10619. Use combed scores all the time.
  10620. @end table
  10621. Default is @var{sc}.
  10622. @item combdbg
  10623. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  10624. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  10625. Available values are:
  10626. @table @samp
  10627. @item none
  10628. No forced calculation.
  10629. @item pcn
  10630. Force p/c/n calculations.
  10631. @item pcnub
  10632. Force p/c/n/u/b calculations.
  10633. @end table
  10634. Default value is @var{none}.
  10635. @item cthresh
  10636. This is the area combing threshold used for combed frame detection. This
  10637. essentially controls how "strong" or "visible" combing must be to be detected.
  10638. Larger values mean combing must be more visible and smaller values mean combing
  10639. can be less visible or strong and still be detected. Valid settings are from
  10640. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  10641. be detected as combed). This is basically a pixel difference value. A good
  10642. range is @code{[8, 12]}.
  10643. Default value is @code{9}.
  10644. @item chroma
  10645. Sets whether or not chroma is considered in the combed frame decision. Only
  10646. disable this if your source has chroma problems (rainbowing, etc.) that are
  10647. causing problems for the combed frame detection with chroma enabled. Actually,
  10648. using @option{chroma}=@var{0} is usually more reliable, except for the case
  10649. where there is chroma only combing in the source.
  10650. Default value is @code{0}.
  10651. @item blockx
  10652. @item blocky
  10653. Respectively set the x-axis and y-axis size of the window used during combed
  10654. frame detection. This has to do with the size of the area in which
  10655. @option{combpel} pixels are required to be detected as combed for a frame to be
  10656. declared combed. See the @option{combpel} parameter description for more info.
  10657. Possible values are any number that is a power of 2 starting at 4 and going up
  10658. to 512.
  10659. Default value is @code{16}.
  10660. @item combpel
  10661. The number of combed pixels inside any of the @option{blocky} by
  10662. @option{blockx} size blocks on the frame for the frame to be detected as
  10663. combed. While @option{cthresh} controls how "visible" the combing must be, this
  10664. setting controls "how much" combing there must be in any localized area (a
  10665. window defined by the @option{blockx} and @option{blocky} settings) on the
  10666. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  10667. which point no frames will ever be detected as combed). This setting is known
  10668. as @option{MI} in TFM/VFM vocabulary.
  10669. Default value is @code{80}.
  10670. @end table
  10671. @anchor{p/c/n/u/b meaning}
  10672. @subsection p/c/n/u/b meaning
  10673. @subsubsection p/c/n
  10674. We assume the following telecined stream:
  10675. @example
  10676. Top fields: 1 2 2 3 4
  10677. Bottom fields: 1 2 3 4 4
  10678. @end example
  10679. The numbers correspond to the progressive frame the fields relate to. Here, the
  10680. first two frames are progressive, the 3rd and 4th are combed, and so on.
  10681. When @code{fieldmatch} is configured to run a matching from bottom
  10682. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  10683. @example
  10684. Input stream:
  10685. T 1 2 2 3 4
  10686. B 1 2 3 4 4 <-- matching reference
  10687. Matches: c c n n c
  10688. Output stream:
  10689. T 1 2 3 4 4
  10690. B 1 2 3 4 4
  10691. @end example
  10692. As a result of the field matching, we can see that some frames get duplicated.
  10693. To perform a complete inverse telecine, you need to rely on a decimation filter
  10694. after this operation. See for instance the @ref{decimate} filter.
  10695. The same operation now matching from top fields (@option{field}=@var{top})
  10696. looks like this:
  10697. @example
  10698. Input stream:
  10699. T 1 2 2 3 4 <-- matching reference
  10700. B 1 2 3 4 4
  10701. Matches: c c p p c
  10702. Output stream:
  10703. T 1 2 2 3 4
  10704. B 1 2 2 3 4
  10705. @end example
  10706. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  10707. basically, they refer to the frame and field of the opposite parity:
  10708. @itemize
  10709. @item @var{p} matches the field of the opposite parity in the previous frame
  10710. @item @var{c} matches the field of the opposite parity in the current frame
  10711. @item @var{n} matches the field of the opposite parity in the next frame
  10712. @end itemize
  10713. @subsubsection u/b
  10714. The @var{u} and @var{b} matching are a bit special in the sense that they match
  10715. from the opposite parity flag. In the following examples, we assume that we are
  10716. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  10717. 'x' is placed above and below each matched fields.
  10718. With bottom matching (@option{field}=@var{bottom}):
  10719. @example
  10720. Match: c p n b u
  10721. x x x x x
  10722. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10723. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10724. x x x x x
  10725. Output frames:
  10726. 2 1 2 2 2
  10727. 2 2 2 1 3
  10728. @end example
  10729. With top matching (@option{field}=@var{top}):
  10730. @example
  10731. Match: c p n b u
  10732. x x x x x
  10733. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10734. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10735. x x x x x
  10736. Output frames:
  10737. 2 2 2 1 2
  10738. 2 1 3 2 2
  10739. @end example
  10740. @subsection Examples
  10741. Simple IVTC of a top field first telecined stream:
  10742. @example
  10743. fieldmatch=order=tff:combmatch=none, decimate
  10744. @end example
  10745. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  10746. @example
  10747. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  10748. @end example
  10749. @section fieldorder
  10750. Transform the field order of the input video.
  10751. It accepts the following parameters:
  10752. @table @option
  10753. @item order
  10754. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  10755. for bottom field first.
  10756. @end table
  10757. The default value is @samp{tff}.
  10758. The transformation is done by shifting the picture content up or down
  10759. by one line, and filling the remaining line with appropriate picture content.
  10760. This method is consistent with most broadcast field order converters.
  10761. If the input video is not flagged as being interlaced, or it is already
  10762. flagged as being of the required output field order, then this filter does
  10763. not alter the incoming video.
  10764. It is very useful when converting to or from PAL DV material,
  10765. which is bottom field first.
  10766. For example:
  10767. @example
  10768. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  10769. @end example
  10770. @section fifo, afifo
  10771. Buffer input images and send them when they are requested.
  10772. It is mainly useful when auto-inserted by the libavfilter
  10773. framework.
  10774. It does not take parameters.
  10775. @section fillborders
  10776. Fill borders of the input video, without changing video stream dimensions.
  10777. Sometimes video can have garbage at the four edges and you may not want to
  10778. crop video input to keep size multiple of some number.
  10779. This filter accepts the following options:
  10780. @table @option
  10781. @item left
  10782. Number of pixels to fill from left border.
  10783. @item right
  10784. Number of pixels to fill from right border.
  10785. @item top
  10786. Number of pixels to fill from top border.
  10787. @item bottom
  10788. Number of pixels to fill from bottom border.
  10789. @item mode
  10790. Set fill mode.
  10791. It accepts the following values:
  10792. @table @samp
  10793. @item smear
  10794. fill pixels using outermost pixels
  10795. @item mirror
  10796. fill pixels using mirroring (half sample symmetric)
  10797. @item fixed
  10798. fill pixels with constant value
  10799. @item reflect
  10800. fill pixels using reflecting (whole sample symmetric)
  10801. @item wrap
  10802. fill pixels using wrapping
  10803. @item fade
  10804. fade pixels to constant value
  10805. @item margins
  10806. fill pixels at top and bottom with weighted averages pixels near borders
  10807. @end table
  10808. Default is @var{smear}.
  10809. @item color
  10810. Set color for pixels in fixed or fade mode. Default is @var{black}.
  10811. @end table
  10812. @subsection Commands
  10813. This filter supports same @ref{commands} as options.
  10814. The command accepts the same syntax of the corresponding option.
  10815. If the specified expression is not valid, it is kept at its current
  10816. value.
  10817. @section find_rect
  10818. Find a rectangular object in the input video.
  10819. The object to search for must be specified as a gray8 image specified with the
  10820. @option{object} option.
  10821. For each possible match, a score is computed. If the score reaches the specified
  10822. threshold, the object is considered found.
  10823. If the input video contains multiple instances of the object, the filter will
  10824. find only one of them.
  10825. When an object is found, the following metadata entries are set in the matching
  10826. frame:
  10827. @table @option
  10828. @item lavfi.rect.w
  10829. width of object
  10830. @item lavfi.rect.h
  10831. height of object
  10832. @item lavfi.rect.x
  10833. x position of object
  10834. @item lavfi.rect.y
  10835. y position of object
  10836. @item lavfi.rect.score
  10837. match score of the found object
  10838. @end table
  10839. It accepts the following options:
  10840. @table @option
  10841. @item object
  10842. Filepath of the object image, needs to be in gray8.
  10843. @item threshold
  10844. Detection threshold, expressed as a decimal number in the range 0-1.
  10845. A threshold value of 0.01 means only exact matches, a threshold of 0.99 means
  10846. almost everything matches.
  10847. Default value is 0.5.
  10848. @item mipmaps
  10849. Number of mipmaps, default is 3.
  10850. @item xmin, ymin, xmax, ymax
  10851. Specifies the rectangle in which to search.
  10852. @item discard
  10853. Discard frames where object is not detected. Default is disabled.
  10854. @end table
  10855. @subsection Examples
  10856. @itemize
  10857. @item
  10858. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  10859. @example
  10860. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  10861. @end example
  10862. @item
  10863. Find the position of an object in each frame using @command{ffprobe} and write
  10864. it to a log file:
  10865. @example
  10866. ffprobe -f lavfi movie=test.mp4,find_rect=object=object.pgm:threshold=0.3 \
  10867. -show_entries frame=pkt_pts_time:frame_tags=lavfi.rect.x,lavfi.rect.y \
  10868. -of csv -o find_rect.csv
  10869. @end example
  10870. @end itemize
  10871. @section floodfill
  10872. Flood area with values of same pixel components with another values.
  10873. It accepts the following options:
  10874. @table @option
  10875. @item x
  10876. Set pixel x coordinate.
  10877. @item y
  10878. Set pixel y coordinate.
  10879. @item s0
  10880. Set source #0 component value.
  10881. @item s1
  10882. Set source #1 component value.
  10883. @item s2
  10884. Set source #2 component value.
  10885. @item s3
  10886. Set source #3 component value.
  10887. @item d0
  10888. Set destination #0 component value.
  10889. @item d1
  10890. Set destination #1 component value.
  10891. @item d2
  10892. Set destination #2 component value.
  10893. @item d3
  10894. Set destination #3 component value.
  10895. @end table
  10896. @anchor{format}
  10897. @section format
  10898. Convert the input video to one of the specified pixel formats.
  10899. Libavfilter will try to pick one that is suitable as input to
  10900. the next filter.
  10901. It accepts the following parameters:
  10902. @table @option
  10903. @item pix_fmts
  10904. A '|'-separated list of pixel format names, such as
  10905. "pix_fmts=yuv420p|monow|rgb24".
  10906. @end table
  10907. @subsection Examples
  10908. @itemize
  10909. @item
  10910. Convert the input video to the @var{yuv420p} format
  10911. @example
  10912. format=pix_fmts=yuv420p
  10913. @end example
  10914. Convert the input video to any of the formats in the list
  10915. @example
  10916. format=pix_fmts=yuv420p|yuv444p|yuv410p
  10917. @end example
  10918. @end itemize
  10919. @anchor{fps}
  10920. @section fps
  10921. Convert the video to specified constant frame rate by duplicating or dropping
  10922. frames as necessary.
  10923. It accepts the following parameters:
  10924. @table @option
  10925. @item fps
  10926. The desired output frame rate. It accepts expressions containing the following
  10927. constants:
  10928. @table @samp
  10929. @item source_fps
  10930. The input's frame rate
  10931. @item ntsc
  10932. NTSC frame rate of @code{30000/1001}
  10933. @item pal
  10934. PAL frame rate of @code{25.0}
  10935. @item film
  10936. Film frame rate of @code{24.0}
  10937. @item ntsc_film
  10938. NTSC-film frame rate of @code{24000/1001}
  10939. @end table
  10940. The default is @code{25}.
  10941. @item start_time
  10942. Assume the first PTS should be the given value, in seconds. This allows for
  10943. padding/trimming at the start of stream. By default, no assumption is made
  10944. about the first frame's expected PTS, so no padding or trimming is done.
  10945. For example, this could be set to 0 to pad the beginning with duplicates of
  10946. the first frame if a video stream starts after the audio stream or to trim any
  10947. frames with a negative PTS.
  10948. @item round
  10949. Timestamp (PTS) rounding method.
  10950. Possible values are:
  10951. @table @option
  10952. @item zero
  10953. round towards 0
  10954. @item inf
  10955. round away from 0
  10956. @item down
  10957. round towards -infinity
  10958. @item up
  10959. round towards +infinity
  10960. @item near
  10961. round to nearest
  10962. @end table
  10963. The default is @code{near}.
  10964. @item eof_action
  10965. Action performed when reading the last frame.
  10966. Possible values are:
  10967. @table @option
  10968. @item round
  10969. Use same timestamp rounding method as used for other frames.
  10970. @item pass
  10971. Pass through last frame if input duration has not been reached yet.
  10972. @end table
  10973. The default is @code{round}.
  10974. @end table
  10975. Alternatively, the options can be specified as a flat string:
  10976. @var{fps}[:@var{start_time}[:@var{round}]].
  10977. See also the @ref{setpts} filter.
  10978. @subsection Examples
  10979. @itemize
  10980. @item
  10981. A typical usage in order to set the fps to 25:
  10982. @example
  10983. fps=fps=25
  10984. @end example
  10985. @item
  10986. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  10987. @example
  10988. fps=fps=film:round=near
  10989. @end example
  10990. @end itemize
  10991. @section framepack
  10992. Pack two different video streams into a stereoscopic video, setting proper
  10993. metadata on supported codecs. The two views should have the same size and
  10994. framerate and processing will stop when the shorter video ends. Please note
  10995. that you may conveniently adjust view properties with the @ref{scale} and
  10996. @ref{fps} filters.
  10997. It accepts the following parameters:
  10998. @table @option
  10999. @item format
  11000. The desired packing format. Supported values are:
  11001. @table @option
  11002. @item sbs
  11003. The views are next to each other (default).
  11004. @item tab
  11005. The views are on top of each other.
  11006. @item lines
  11007. The views are packed by line.
  11008. @item columns
  11009. The views are packed by column.
  11010. @item frameseq
  11011. The views are temporally interleaved.
  11012. @end table
  11013. @end table
  11014. Some examples:
  11015. @example
  11016. # Convert left and right views into a frame-sequential video
  11017. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  11018. # Convert views into a side-by-side video with the same output resolution as the input
  11019. 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
  11020. @end example
  11021. @section framerate
  11022. Change the frame rate by interpolating new video output frames from the source
  11023. frames.
  11024. This filter is not designed to function correctly with interlaced media. If
  11025. you wish to change the frame rate of interlaced media then you are required
  11026. to deinterlace before this filter and re-interlace after this filter.
  11027. A description of the accepted options follows.
  11028. @table @option
  11029. @item fps
  11030. Specify the output frames per second. This option can also be specified
  11031. as a value alone. The default is @code{50}.
  11032. @item interp_start
  11033. Specify the start of a range where the output frame will be created as a
  11034. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  11035. the default is @code{15}.
  11036. @item interp_end
  11037. Specify the end of a range where the output frame will be created as a
  11038. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  11039. the default is @code{240}.
  11040. @item scene
  11041. Specify the level at which a scene change is detected as a value between
  11042. 0 and 100 to indicate a new scene; a low value reflects a low
  11043. probability for the current frame to introduce a new scene, while a higher
  11044. value means the current frame is more likely to be one.
  11045. The default is @code{8.2}.
  11046. @item flags
  11047. Specify flags influencing the filter process.
  11048. Available value for @var{flags} is:
  11049. @table @option
  11050. @item scene_change_detect, scd
  11051. Enable scene change detection using the value of the option @var{scene}.
  11052. This flag is enabled by default.
  11053. @end table
  11054. @end table
  11055. @section framestep
  11056. Select one frame every N-th frame.
  11057. This filter accepts the following option:
  11058. @table @option
  11059. @item step
  11060. Select frame after every @code{step} frames.
  11061. Allowed values are positive integers higher than 0. Default value is @code{1}.
  11062. @end table
  11063. @section freezedetect
  11064. Detect frozen video.
  11065. This filter logs a message and sets frame metadata when it detects that the
  11066. input video has no significant change in content during a specified duration.
  11067. Video freeze detection calculates the mean average absolute difference of all
  11068. the components of video frames and compares it to a noise floor.
  11069. The printed times and duration are expressed in seconds. The
  11070. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  11071. whose timestamp equals or exceeds the detection duration and it contains the
  11072. timestamp of the first frame of the freeze. The
  11073. @code{lavfi.freezedetect.freeze_duration} and
  11074. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  11075. after the freeze.
  11076. The filter accepts the following options:
  11077. @table @option
  11078. @item noise, n
  11079. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  11080. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  11081. 0.001.
  11082. @item duration, d
  11083. Set freeze duration until notification (default is 2 seconds).
  11084. @end table
  11085. @section freezeframes
  11086. Freeze video frames.
  11087. This filter freezes video frames using frame from 2nd input.
  11088. The filter accepts the following options:
  11089. @table @option
  11090. @item first
  11091. Set number of first frame from which to start freeze.
  11092. @item last
  11093. Set number of last frame from which to end freeze.
  11094. @item replace
  11095. Set number of frame from 2nd input which will be used instead of replaced frames.
  11096. @end table
  11097. @anchor{frei0r}
  11098. @section frei0r
  11099. Apply a frei0r effect to the input video.
  11100. To enable the compilation of this filter, you need to install the frei0r
  11101. header and configure FFmpeg with @code{--enable-frei0r}.
  11102. It accepts the following parameters:
  11103. @table @option
  11104. @item filter_name
  11105. The name of the frei0r effect to load. If the environment variable
  11106. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  11107. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  11108. Otherwise, the standard frei0r paths are searched, in this order:
  11109. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  11110. @file{/usr/lib/frei0r-1/}.
  11111. @item filter_params
  11112. A '|'-separated list of parameters to pass to the frei0r effect.
  11113. @end table
  11114. A frei0r effect parameter can be a boolean (its value is either
  11115. "y" or "n"), a double, a color (specified as
  11116. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  11117. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  11118. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  11119. a position (specified as @var{X}/@var{Y}, where
  11120. @var{X} and @var{Y} are floating point numbers) and/or a string.
  11121. The number and types of parameters depend on the loaded effect. If an
  11122. effect parameter is not specified, the default value is set.
  11123. @subsection Examples
  11124. @itemize
  11125. @item
  11126. Apply the distort0r effect, setting the first two double parameters:
  11127. @example
  11128. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  11129. @end example
  11130. @item
  11131. Apply the colordistance effect, taking a color as the first parameter:
  11132. @example
  11133. frei0r=colordistance:0.2/0.3/0.4
  11134. frei0r=colordistance:violet
  11135. frei0r=colordistance:0x112233
  11136. @end example
  11137. @item
  11138. Apply the perspective effect, specifying the top left and top right image
  11139. positions:
  11140. @example
  11141. frei0r=perspective:0.2/0.2|0.8/0.2
  11142. @end example
  11143. @end itemize
  11144. For more information, see
  11145. @url{http://frei0r.dyne.org}
  11146. @subsection Commands
  11147. This filter supports the @option{filter_params} option as @ref{commands}.
  11148. @section fspp
  11149. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  11150. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  11151. processing filter, one of them is performed once per block, not per pixel.
  11152. This allows for much higher speed.
  11153. The filter accepts the following options:
  11154. @table @option
  11155. @item quality
  11156. Set quality. This option defines the number of levels for averaging. It accepts
  11157. an integer in the range 4-5. Default value is @code{4}.
  11158. @item qp
  11159. Force a constant quantization parameter. It accepts an integer in range 0-63.
  11160. If not set, the filter will use the QP from the video stream (if available).
  11161. @item strength
  11162. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  11163. more details but also more artifacts, while higher values make the image smoother
  11164. but also blurrier. Default value is @code{0} − PSNR optimal.
  11165. @item use_bframe_qp
  11166. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11167. option may cause flicker since the B-Frames have often larger QP. Default is
  11168. @code{0} (not enabled).
  11169. @end table
  11170. @section gblur
  11171. Apply Gaussian blur filter.
  11172. The filter accepts the following options:
  11173. @table @option
  11174. @item sigma
  11175. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  11176. @item steps
  11177. Set number of steps for Gaussian approximation. Default is @code{1}.
  11178. @item planes
  11179. Set which planes to filter. By default all planes are filtered.
  11180. @item sigmaV
  11181. Set vertical sigma, if negative it will be same as @code{sigma}.
  11182. Default is @code{-1}.
  11183. @end table
  11184. @subsection Commands
  11185. This filter supports same commands as options.
  11186. The command accepts the same syntax of the corresponding option.
  11187. If the specified expression is not valid, it is kept at its current
  11188. value.
  11189. @section geq
  11190. Apply generic equation to each pixel.
  11191. The filter accepts the following options:
  11192. @table @option
  11193. @item lum_expr, lum
  11194. Set the luma expression.
  11195. @item cb_expr, cb
  11196. Set the chrominance blue expression.
  11197. @item cr_expr, cr
  11198. Set the chrominance red expression.
  11199. @item alpha_expr, a
  11200. Set the alpha expression.
  11201. @item red_expr, r
  11202. Set the red expression.
  11203. @item green_expr, g
  11204. Set the green expression.
  11205. @item blue_expr, b
  11206. Set the blue expression.
  11207. @end table
  11208. The colorspace is selected according to the specified options. If one
  11209. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  11210. options is specified, the filter will automatically select a YCbCr
  11211. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  11212. @option{blue_expr} options is specified, it will select an RGB
  11213. colorspace.
  11214. If one of the chrominance expression is not defined, it falls back on the other
  11215. one. If no alpha expression is specified it will evaluate to opaque value.
  11216. If none of chrominance expressions are specified, they will evaluate
  11217. to the luma expression.
  11218. The expressions can use the following variables and functions:
  11219. @table @option
  11220. @item N
  11221. The sequential number of the filtered frame, starting from @code{0}.
  11222. @item X
  11223. @item Y
  11224. The coordinates of the current sample.
  11225. @item W
  11226. @item H
  11227. The width and height of the image.
  11228. @item SW
  11229. @item SH
  11230. Width and height scale depending on the currently filtered plane. It is the
  11231. ratio between the corresponding luma plane number of pixels and the current
  11232. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  11233. @code{0.5,0.5} for chroma planes.
  11234. @item T
  11235. Time of the current frame, expressed in seconds.
  11236. @item p(x, y)
  11237. Return the value of the pixel at location (@var{x},@var{y}) of the current
  11238. plane.
  11239. @item lum(x, y)
  11240. Return the value of the pixel at location (@var{x},@var{y}) of the luma
  11241. plane.
  11242. @item cb(x, y)
  11243. Return the value of the pixel at location (@var{x},@var{y}) of the
  11244. blue-difference chroma plane. Return 0 if there is no such plane.
  11245. @item cr(x, y)
  11246. Return the value of the pixel at location (@var{x},@var{y}) of the
  11247. red-difference chroma plane. Return 0 if there is no such plane.
  11248. @item r(x, y)
  11249. @item g(x, y)
  11250. @item b(x, y)
  11251. Return the value of the pixel at location (@var{x},@var{y}) of the
  11252. red/green/blue component. Return 0 if there is no such component.
  11253. @item alpha(x, y)
  11254. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  11255. plane. Return 0 if there is no such plane.
  11256. @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)
  11257. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  11258. sums of samples within a rectangle. See the functions without the sum postfix.
  11259. @item interpolation
  11260. Set one of interpolation methods:
  11261. @table @option
  11262. @item nearest, n
  11263. @item bilinear, b
  11264. @end table
  11265. Default is bilinear.
  11266. @end table
  11267. For functions, if @var{x} and @var{y} are outside the area, the value will be
  11268. automatically clipped to the closer edge.
  11269. Please note that this filter can use multiple threads in which case each slice
  11270. will have its own expression state. If you want to use only a single expression
  11271. state because your expressions depend on previous state then you should limit
  11272. the number of filter threads to 1.
  11273. @subsection Examples
  11274. @itemize
  11275. @item
  11276. Flip the image horizontally:
  11277. @example
  11278. geq=p(W-X\,Y)
  11279. @end example
  11280. @item
  11281. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  11282. wavelength of 100 pixels:
  11283. @example
  11284. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  11285. @end example
  11286. @item
  11287. Generate a fancy enigmatic moving light:
  11288. @example
  11289. 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
  11290. @end example
  11291. @item
  11292. Generate a quick emboss effect:
  11293. @example
  11294. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  11295. @end example
  11296. @item
  11297. Modify RGB components depending on pixel position:
  11298. @example
  11299. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  11300. @end example
  11301. @item
  11302. Create a radial gradient that is the same size as the input (also see
  11303. the @ref{vignette} filter):
  11304. @example
  11305. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  11306. @end example
  11307. @end itemize
  11308. @section gradfun
  11309. Fix the banding artifacts that are sometimes introduced into nearly flat
  11310. regions by truncation to 8-bit color depth.
  11311. Interpolate the gradients that should go where the bands are, and
  11312. dither them.
  11313. It is designed for playback only. Do not use it prior to
  11314. lossy compression, because compression tends to lose the dither and
  11315. bring back the bands.
  11316. It accepts the following parameters:
  11317. @table @option
  11318. @item strength
  11319. The maximum amount by which the filter will change any one pixel. This is also
  11320. the threshold for detecting nearly flat regions. Acceptable values range from
  11321. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  11322. valid range.
  11323. @item radius
  11324. The neighborhood to fit the gradient to. A larger radius makes for smoother
  11325. gradients, but also prevents the filter from modifying the pixels near detailed
  11326. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  11327. values will be clipped to the valid range.
  11328. @end table
  11329. Alternatively, the options can be specified as a flat string:
  11330. @var{strength}[:@var{radius}]
  11331. @subsection Examples
  11332. @itemize
  11333. @item
  11334. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  11335. @example
  11336. gradfun=3.5:8
  11337. @end example
  11338. @item
  11339. Specify radius, omitting the strength (which will fall-back to the default
  11340. value):
  11341. @example
  11342. gradfun=radius=8
  11343. @end example
  11344. @end itemize
  11345. @anchor{graphmonitor}
  11346. @section graphmonitor
  11347. Show various filtergraph stats.
  11348. With this filter one can debug complete filtergraph.
  11349. Especially issues with links filling with queued frames.
  11350. The filter accepts the following options:
  11351. @table @option
  11352. @item size, s
  11353. Set video output size. Default is @var{hd720}.
  11354. @item opacity, o
  11355. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  11356. @item mode, m
  11357. Set output mode flags.
  11358. Available values for flags are:
  11359. @table @samp
  11360. @item full
  11361. No any filtering. Default.
  11362. @item compact
  11363. Show only filters with queued frames.
  11364. @item nozero
  11365. Show only filters with non-zero stats.
  11366. @item noeof
  11367. Show only filters with non-eof stat.
  11368. @item nodisabled
  11369. Show only filters that are enabled in timeline.
  11370. @end table
  11371. @item flags, f
  11372. Set flags which enable which stats are shown in video.
  11373. Available values for flags are:
  11374. @table @samp
  11375. @item none
  11376. All flags turned off.
  11377. @item all
  11378. All flags turned on.
  11379. @item queue
  11380. Display number of queued frames in each link.
  11381. @item frame_count_in
  11382. Display number of frames taken from filter.
  11383. @item frame_count_out
  11384. Display number of frames given out from filter.
  11385. @item frame_count_delta
  11386. Display delta number of frames between above two values.
  11387. @item pts
  11388. Display current filtered frame pts.
  11389. @item pts_delta
  11390. Display pts delta between current and previous frame.
  11391. @item time
  11392. Display current filtered frame time.
  11393. @item time_delta
  11394. Display time delta between current and previous frame.
  11395. @item timebase
  11396. Display time base for filter link.
  11397. @item format
  11398. Display used format for filter link.
  11399. @item size
  11400. Display video size or number of audio channels in case of audio used by filter link.
  11401. @item rate
  11402. Display video frame rate or sample rate in case of audio used by filter link.
  11403. @item eof
  11404. Display link output status.
  11405. @item sample_count_in
  11406. Display number of samples taken from filter.
  11407. @item sample_count_out
  11408. Display number of samples given out from filter.
  11409. @item sample_count_delta
  11410. Display delta number of samples between above two values.
  11411. @item disabled
  11412. Show the timeline filter status.
  11413. @end table
  11414. @item rate, r
  11415. Set upper limit for video rate of output stream, Default value is @var{25}.
  11416. This guarantee that output video frame rate will not be higher than this value.
  11417. @end table
  11418. @section grayworld
  11419. A color constancy filter that applies color correction based on the grayworld assumption
  11420. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  11421. The algorithm uses linear light, so input
  11422. data should be linearized beforehand (and possibly correctly tagged).
  11423. @example
  11424. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  11425. @end example
  11426. @section greyedge
  11427. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  11428. and corrects the scene colors accordingly.
  11429. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  11430. The filter accepts the following options:
  11431. @table @option
  11432. @item difford
  11433. The order of differentiation to be applied on the scene. Must be chosen in the range
  11434. [0,2] and default value is 1.
  11435. @item minknorm
  11436. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  11437. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  11438. max value instead of calculating Minkowski distance.
  11439. @item sigma
  11440. The standard deviation of Gaussian blur to be applied on the scene. Must be
  11441. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  11442. can't be equal to 0 if @var{difford} is greater than 0.
  11443. @end table
  11444. @subsection Examples
  11445. @itemize
  11446. @item
  11447. Grey Edge:
  11448. @example
  11449. greyedge=difford=1:minknorm=5:sigma=2
  11450. @end example
  11451. @item
  11452. Max Edge:
  11453. @example
  11454. greyedge=difford=1:minknorm=0:sigma=2
  11455. @end example
  11456. @end itemize
  11457. @section guided
  11458. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  11459. The filter accepts the following options:
  11460. @table @option
  11461. @item radius
  11462. Set the box radius in pixels.
  11463. Allowed range is 1 to 20. Default is 3.
  11464. @item eps
  11465. Set regularization parameter (with square).
  11466. Allowed range is 0 to 1. Default is 0.01.
  11467. @item mode
  11468. Set filter mode. Can be @code{basic} or @code{fast}.
  11469. Default is @code{basic}.
  11470. @item sub
  11471. Set subsampling ratio for @code{fast} mode.
  11472. Range is 2 to 64. Default is 4.
  11473. No subsampling occurs in @code{basic} mode.
  11474. @item guidance
  11475. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  11476. If @code{off}, single input is required.
  11477. If @code{on}, two inputs of the same resolution and pixel format are required.
  11478. The second input serves as the guidance.
  11479. @item planes
  11480. Set planes to filter. Default is first only.
  11481. @end table
  11482. @subsection Commands
  11483. This filter supports the all above options as @ref{commands}.
  11484. @subsection Examples
  11485. @itemize
  11486. @item
  11487. Edge-preserving smoothing with guided filter:
  11488. @example
  11489. ffmpeg -i in.png -vf guided out.png
  11490. @end example
  11491. @item
  11492. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  11493. For the generation of guidance image, refer to paper "Guided Image Filtering".
  11494. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  11495. @example
  11496. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  11497. @end example
  11498. @end itemize
  11499. @anchor{haldclut}
  11500. @section haldclut
  11501. Apply a Hald CLUT to a video stream.
  11502. First input is the video stream to process, and second one is the Hald CLUT.
  11503. The Hald CLUT input can be a simple picture or a complete video stream.
  11504. The filter accepts the following options:
  11505. @table @option
  11506. @item clut
  11507. Set which CLUT video frames will be processed from second input stream,
  11508. can be @var{first} or @var{all}. Default is @var{all}.
  11509. @item shortest
  11510. Force termination when the shortest input terminates. Default is @code{0}.
  11511. @item repeatlast
  11512. Continue applying the last CLUT after the end of the stream. A value of
  11513. @code{0} disable the filter after the last frame of the CLUT is reached.
  11514. Default is @code{1}.
  11515. @end table
  11516. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  11517. filters share the same internals).
  11518. This filter also supports the @ref{framesync} options.
  11519. More information about the Hald CLUT can be found on Eskil Steenberg's website
  11520. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  11521. @subsection Commands
  11522. This filter supports the @code{interp} option as @ref{commands}.
  11523. @subsection Workflow examples
  11524. @subsubsection Hald CLUT video stream
  11525. Generate an identity Hald CLUT stream altered with various effects:
  11526. @example
  11527. 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
  11528. @end example
  11529. Note: make sure you use a lossless codec.
  11530. Then use it with @code{haldclut} to apply it on some random stream:
  11531. @example
  11532. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  11533. @end example
  11534. The Hald CLUT will be applied to the 10 first seconds (duration of
  11535. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  11536. to the remaining frames of the @code{mandelbrot} stream.
  11537. @subsubsection Hald CLUT with preview
  11538. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  11539. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  11540. biggest possible square starting at the top left of the picture. The remaining
  11541. padding pixels (bottom or right) will be ignored. This area can be used to add
  11542. a preview of the Hald CLUT.
  11543. Typically, the following generated Hald CLUT will be supported by the
  11544. @code{haldclut} filter:
  11545. @example
  11546. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  11547. pad=iw+320 [padded_clut];
  11548. smptebars=s=320x256, split [a][b];
  11549. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  11550. [main][b] overlay=W-320" -frames:v 1 clut.png
  11551. @end example
  11552. It contains the original and a preview of the effect of the CLUT: SMPTE color
  11553. bars are displayed on the right-top, and below the same color bars processed by
  11554. the color changes.
  11555. Then, the effect of this Hald CLUT can be visualized with:
  11556. @example
  11557. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  11558. @end example
  11559. @section hflip
  11560. Flip the input video horizontally.
  11561. For example, to horizontally flip the input video with @command{ffmpeg}:
  11562. @example
  11563. ffmpeg -i in.avi -vf "hflip" out.avi
  11564. @end example
  11565. @section histeq
  11566. This filter applies a global color histogram equalization on a
  11567. per-frame basis.
  11568. It can be used to correct video that has a compressed range of pixel
  11569. intensities. The filter redistributes the pixel intensities to
  11570. equalize their distribution across the intensity range. It may be
  11571. viewed as an "automatically adjusting contrast filter". This filter is
  11572. useful only for correcting degraded or poorly captured source
  11573. video.
  11574. The filter accepts the following options:
  11575. @table @option
  11576. @item strength
  11577. Determine the amount of equalization to be applied. As the strength
  11578. is reduced, the distribution of pixel intensities more-and-more
  11579. approaches that of the input frame. The value must be a float number
  11580. in the range [0,1] and defaults to 0.200.
  11581. @item intensity
  11582. Set the maximum intensity that can generated and scale the output
  11583. values appropriately. The strength should be set as desired and then
  11584. the intensity can be limited if needed to avoid washing-out. The value
  11585. must be a float number in the range [0,1] and defaults to 0.210.
  11586. @item antibanding
  11587. Set the antibanding level. If enabled the filter will randomly vary
  11588. the luminance of output pixels by a small amount to avoid banding of
  11589. the histogram. Possible values are @code{none}, @code{weak} or
  11590. @code{strong}. It defaults to @code{none}.
  11591. @end table
  11592. @anchor{histogram}
  11593. @section histogram
  11594. Compute and draw a color distribution histogram for the input video.
  11595. The computed histogram is a representation of the color component
  11596. distribution in an image.
  11597. Standard histogram displays the color components distribution in an image.
  11598. Displays color graph for each color component. Shows distribution of
  11599. the Y, U, V, A or R, G, B components, depending on input format, in the
  11600. current frame. Below each graph a color component scale meter is shown.
  11601. The filter accepts the following options:
  11602. @table @option
  11603. @item level_height
  11604. Set height of level. Default value is @code{200}.
  11605. Allowed range is [50, 2048].
  11606. @item scale_height
  11607. Set height of color scale. Default value is @code{12}.
  11608. Allowed range is [0, 40].
  11609. @item display_mode
  11610. Set display mode.
  11611. It accepts the following values:
  11612. @table @samp
  11613. @item stack
  11614. Per color component graphs are placed below each other.
  11615. @item parade
  11616. Per color component graphs are placed side by side.
  11617. @item overlay
  11618. Presents information identical to that in the @code{parade}, except
  11619. that the graphs representing color components are superimposed directly
  11620. over one another.
  11621. @end table
  11622. Default is @code{stack}.
  11623. @item levels_mode
  11624. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  11625. Default is @code{linear}.
  11626. @item components
  11627. Set what color components to display.
  11628. Default is @code{7}.
  11629. @item fgopacity
  11630. Set foreground opacity. Default is @code{0.7}.
  11631. @item bgopacity
  11632. Set background opacity. Default is @code{0.5}.
  11633. @item colors_mode
  11634. Set colors mode.
  11635. It accepts the following values:
  11636. @table @samp
  11637. @item whiteonblack
  11638. @item blackonwhite
  11639. @item whiteongray
  11640. @item blackongray
  11641. @item coloronblack
  11642. @item coloronwhite
  11643. @item colorongray
  11644. @item blackoncolor
  11645. @item whiteoncolor
  11646. @item grayoncolor
  11647. @end table
  11648. Default is @code{whiteonblack}.
  11649. @end table
  11650. @subsection Examples
  11651. @itemize
  11652. @item
  11653. Calculate and draw histogram:
  11654. @example
  11655. ffplay -i input -vf histogram
  11656. @end example
  11657. @end itemize
  11658. @anchor{hqdn3d}
  11659. @section hqdn3d
  11660. This is a high precision/quality 3d denoise filter. It aims to reduce
  11661. image noise, producing smooth images and making still images really
  11662. still. It should enhance compressibility.
  11663. It accepts the following optional parameters:
  11664. @table @option
  11665. @item luma_spatial
  11666. A non-negative floating point number which specifies spatial luma strength.
  11667. It defaults to 4.0.
  11668. @item chroma_spatial
  11669. A non-negative floating point number which specifies spatial chroma strength.
  11670. It defaults to 3.0*@var{luma_spatial}/4.0.
  11671. @item luma_tmp
  11672. A floating point number which specifies luma temporal strength. It defaults to
  11673. 6.0*@var{luma_spatial}/4.0.
  11674. @item chroma_tmp
  11675. A floating point number which specifies chroma temporal strength. It defaults to
  11676. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  11677. @end table
  11678. @subsection Commands
  11679. This filter supports same @ref{commands} as options.
  11680. The command accepts the same syntax of the corresponding option.
  11681. If the specified expression is not valid, it is kept at its current
  11682. value.
  11683. @anchor{hwdownload}
  11684. @section hwdownload
  11685. Download hardware frames to system memory.
  11686. The input must be in hardware frames, and the output a non-hardware format.
  11687. Not all formats will be supported on the output - it may be necessary to insert
  11688. an additional @option{format} filter immediately following in the graph to get
  11689. the output in a supported format.
  11690. @section hwmap
  11691. Map hardware frames to system memory or to another device.
  11692. This filter has several different modes of operation; which one is used depends
  11693. on the input and output formats:
  11694. @itemize
  11695. @item
  11696. Hardware frame input, normal frame output
  11697. Map the input frames to system memory and pass them to the output. If the
  11698. original hardware frame is later required (for example, after overlaying
  11699. something else on part of it), the @option{hwmap} filter can be used again
  11700. in the next mode to retrieve it.
  11701. @item
  11702. Normal frame input, hardware frame output
  11703. If the input is actually a software-mapped hardware frame, then unmap it -
  11704. that is, return the original hardware frame.
  11705. Otherwise, a device must be provided. Create new hardware surfaces on that
  11706. device for the output, then map them back to the software format at the input
  11707. and give those frames to the preceding filter. This will then act like the
  11708. @option{hwupload} filter, but may be able to avoid an additional copy when
  11709. the input is already in a compatible format.
  11710. @item
  11711. Hardware frame input and output
  11712. A device must be supplied for the output, either directly or with the
  11713. @option{derive_device} option. The input and output devices must be of
  11714. different types and compatible - the exact meaning of this is
  11715. system-dependent, but typically it means that they must refer to the same
  11716. underlying hardware context (for example, refer to the same graphics card).
  11717. If the input frames were originally created on the output device, then unmap
  11718. to retrieve the original frames.
  11719. Otherwise, map the frames to the output device - create new hardware frames
  11720. on the output corresponding to the frames on the input.
  11721. @end itemize
  11722. The following additional parameters are accepted:
  11723. @table @option
  11724. @item mode
  11725. Set the frame mapping mode. Some combination of:
  11726. @table @var
  11727. @item read
  11728. The mapped frame should be readable.
  11729. @item write
  11730. The mapped frame should be writeable.
  11731. @item overwrite
  11732. The mapping will always overwrite the entire frame.
  11733. This may improve performance in some cases, as the original contents of the
  11734. frame need not be loaded.
  11735. @item direct
  11736. The mapping must not involve any copying.
  11737. Indirect mappings to copies of frames are created in some cases where either
  11738. direct mapping is not possible or it would have unexpected properties.
  11739. Setting this flag ensures that the mapping is direct and will fail if that is
  11740. not possible.
  11741. @end table
  11742. Defaults to @var{read+write} if not specified.
  11743. @item derive_device @var{type}
  11744. Rather than using the device supplied at initialisation, instead derive a new
  11745. device of type @var{type} from the device the input frames exist on.
  11746. @item reverse
  11747. In a hardware to hardware mapping, map in reverse - create frames in the sink
  11748. and map them back to the source. This may be necessary in some cases where
  11749. a mapping in one direction is required but only the opposite direction is
  11750. supported by the devices being used.
  11751. This option is dangerous - it may break the preceding filter in undefined
  11752. ways if there are any additional constraints on that filter's output.
  11753. Do not use it without fully understanding the implications of its use.
  11754. @end table
  11755. @anchor{hwupload}
  11756. @section hwupload
  11757. Upload system memory frames to hardware surfaces.
  11758. The device to upload to must be supplied when the filter is initialised. If
  11759. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  11760. option or with the @option{derive_device} option. The input and output devices
  11761. must be of different types and compatible - the exact meaning of this is
  11762. system-dependent, but typically it means that they must refer to the same
  11763. underlying hardware context (for example, refer to the same graphics card).
  11764. The following additional parameters are accepted:
  11765. @table @option
  11766. @item derive_device @var{type}
  11767. Rather than using the device supplied at initialisation, instead derive a new
  11768. device of type @var{type} from the device the input frames exist on.
  11769. @end table
  11770. @anchor{hwupload_cuda}
  11771. @section hwupload_cuda
  11772. Upload system memory frames to a CUDA device.
  11773. It accepts the following optional parameters:
  11774. @table @option
  11775. @item device
  11776. The number of the CUDA device to use
  11777. @end table
  11778. @section hqx
  11779. Apply a high-quality magnification filter designed for pixel art. This filter
  11780. was originally created by Maxim Stepin.
  11781. It accepts the following option:
  11782. @table @option
  11783. @item n
  11784. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  11785. @code{hq3x} and @code{4} for @code{hq4x}.
  11786. Default is @code{3}.
  11787. @end table
  11788. @anchor{hstack}
  11789. @section hstack
  11790. Stack input videos horizontally.
  11791. All streams must be of same pixel format and of same height.
  11792. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11793. to create same output.
  11794. The filter accepts the following option:
  11795. @table @option
  11796. @item inputs
  11797. Set number of input streams. Default is 2.
  11798. @item shortest
  11799. If set to 1, force the output to terminate when the shortest input
  11800. terminates. Default value is 0.
  11801. @end table
  11802. @section hsvhold
  11803. Turns a certain HSV range into gray values.
  11804. This filter measures color difference between set HSV color in options
  11805. and ones measured in video stream. Depending on options, output
  11806. colors can be changed to be gray or not.
  11807. The filter accepts the following options:
  11808. @table @option
  11809. @item hue
  11810. Set the hue value which will be used in color difference calculation.
  11811. Allowed range is from -360 to 360. Default value is 0.
  11812. @item sat
  11813. Set the saturation value which will be used in color difference calculation.
  11814. Allowed range is from -1 to 1. Default value is 0.
  11815. @item val
  11816. Set the value which will be used in color difference calculation.
  11817. Allowed range is from -1 to 1. Default value is 0.
  11818. @item similarity
  11819. Set similarity percentage with the key color.
  11820. Allowed range is from 0 to 1. Default value is 0.01.
  11821. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11822. @item blend
  11823. Blend percentage.
  11824. Allowed range is from 0 to 1. Default value is 0.
  11825. 0.0 makes pixels either fully gray, or not gray at all.
  11826. Higher values result in more gray pixels, with a higher gray pixel
  11827. the more similar the pixels color is to the key color.
  11828. @end table
  11829. @section hsvkey
  11830. Turns a certain HSV range into transparency.
  11831. This filter measures color difference between set HSV color in options
  11832. and ones measured in video stream. Depending on options, output
  11833. colors can be changed to transparent by adding alpha channel.
  11834. The filter accepts the following options:
  11835. @table @option
  11836. @item hue
  11837. Set the hue value which will be used in color difference calculation.
  11838. Allowed range is from -360 to 360. Default value is 0.
  11839. @item sat
  11840. Set the saturation value which will be used in color difference calculation.
  11841. Allowed range is from -1 to 1. Default value is 0.
  11842. @item val
  11843. Set the value which will be used in color difference calculation.
  11844. Allowed range is from -1 to 1. Default value is 0.
  11845. @item similarity
  11846. Set similarity percentage with the key color.
  11847. Allowed range is from 0 to 1. Default value is 0.01.
  11848. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11849. @item blend
  11850. Blend percentage.
  11851. Allowed range is from 0 to 1. Default value is 0.
  11852. 0.0 makes pixels either fully transparent, or not transparent at all.
  11853. Higher values result in semi-transparent pixels, with a higher transparency
  11854. the more similar the pixels color is to the key color.
  11855. @end table
  11856. @section hue
  11857. Modify the hue and/or the saturation of the input.
  11858. It accepts the following parameters:
  11859. @table @option
  11860. @item h
  11861. Specify the hue angle as a number of degrees. It accepts an expression,
  11862. and defaults to "0".
  11863. @item s
  11864. Specify the saturation in the [-10,10] range. It accepts an expression and
  11865. defaults to "1".
  11866. @item H
  11867. Specify the hue angle as a number of radians. It accepts an
  11868. expression, and defaults to "0".
  11869. @item b
  11870. Specify the brightness in the [-10,10] range. It accepts an expression and
  11871. defaults to "0".
  11872. @end table
  11873. @option{h} and @option{H} are mutually exclusive, and can't be
  11874. specified at the same time.
  11875. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  11876. expressions containing the following constants:
  11877. @table @option
  11878. @item n
  11879. frame count of the input frame starting from 0
  11880. @item pts
  11881. presentation timestamp of the input frame expressed in time base units
  11882. @item r
  11883. frame rate of the input video, NAN if the input frame rate is unknown
  11884. @item t
  11885. timestamp expressed in seconds, NAN if the input timestamp is unknown
  11886. @item tb
  11887. time base of the input video
  11888. @end table
  11889. @subsection Examples
  11890. @itemize
  11891. @item
  11892. Set the hue to 90 degrees and the saturation to 1.0:
  11893. @example
  11894. hue=h=90:s=1
  11895. @end example
  11896. @item
  11897. Same command but expressing the hue in radians:
  11898. @example
  11899. hue=H=PI/2:s=1
  11900. @end example
  11901. @item
  11902. Rotate hue and make the saturation swing between 0
  11903. and 2 over a period of 1 second:
  11904. @example
  11905. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  11906. @end example
  11907. @item
  11908. Apply a 3 seconds saturation fade-in effect starting at 0:
  11909. @example
  11910. hue="s=min(t/3\,1)"
  11911. @end example
  11912. The general fade-in expression can be written as:
  11913. @example
  11914. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  11915. @end example
  11916. @item
  11917. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  11918. @example
  11919. hue="s=max(0\, min(1\, (8-t)/3))"
  11920. @end example
  11921. The general fade-out expression can be written as:
  11922. @example
  11923. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  11924. @end example
  11925. @end itemize
  11926. @subsection Commands
  11927. This filter supports the following commands:
  11928. @table @option
  11929. @item b
  11930. @item s
  11931. @item h
  11932. @item H
  11933. Modify the hue and/or the saturation and/or brightness of the input video.
  11934. The command accepts the same syntax of the corresponding option.
  11935. If the specified expression is not valid, it is kept at its current
  11936. value.
  11937. @end table
  11938. @section huesaturation
  11939. Apply hue-saturation-intensity adjustments to input video stream.
  11940. This filter operates in RGB colorspace.
  11941. This filter accepts the following options:
  11942. @table @option
  11943. @item hue
  11944. Set the hue shift in degrees to apply. Default is 0.
  11945. Allowed range is from -180 to 180.
  11946. @item saturation
  11947. Set the saturation shift. Default is 0.
  11948. Allowed range is from -1 to 1.
  11949. @item intensity
  11950. Set the intensity shift. Default is 0.
  11951. Allowed range is from -1 to 1.
  11952. @item colors
  11953. Set which primary and complementary colors are going to be adjusted.
  11954. This options is set by providing one or multiple values.
  11955. This can select multiple colors at once. By default all colors are selected.
  11956. @table @samp
  11957. @item r
  11958. Adjust reds.
  11959. @item y
  11960. Adjust yellows.
  11961. @item g
  11962. Adjust greens.
  11963. @item c
  11964. Adjust cyans.
  11965. @item b
  11966. Adjust blues.
  11967. @item m
  11968. Adjust magentas.
  11969. @item a
  11970. Adjust all colors.
  11971. @end table
  11972. @item strength
  11973. Set strength of filtering. Allowed range is from 0 to 100.
  11974. Default value is 1.
  11975. @item rw, gw, bw
  11976. Set weight for each RGB component. Allowed range is from 0 to 1.
  11977. By default is set to 0.333, 0.334, 0.333.
  11978. Those options are used in saturation and lightess processing.
  11979. @item lightness
  11980. Set preserving lightness, by default is disabled.
  11981. Adjusting hues can change lightness from original RGB triplet,
  11982. with this option enabled lightness is kept at same value.
  11983. @end table
  11984. @section hysteresis
  11985. Grow first stream into second stream by connecting components.
  11986. This makes it possible to build more robust edge masks.
  11987. This filter accepts the following options:
  11988. @table @option
  11989. @item planes
  11990. Set which planes will be processed as bitmap, unprocessed planes will be
  11991. copied from first stream.
  11992. By default value 0xf, all planes will be processed.
  11993. @item threshold
  11994. Set threshold which is used in filtering. If pixel component value is higher than
  11995. this value filter algorithm for connecting components is activated.
  11996. By default value is 0.
  11997. @end table
  11998. The @code{hysteresis} filter also supports the @ref{framesync} options.
  11999. @section iccdetect
  12000. Detect the colorspace from an embedded ICC profile (if present), and update
  12001. the frame's tags accordingly.
  12002. This filter accepts the following options:
  12003. @table @option
  12004. @item force
  12005. If true, the frame's existing colorspace tags will always be overridden by
  12006. values detected from an ICC profile. Otherwise, they will only be assigned if
  12007. they contain @code{unknown}. Enabled by default.
  12008. @end table
  12009. @section iccgen
  12010. Generate ICC profiles and attach them to frames.
  12011. This filter accepts the following options:
  12012. @table @option
  12013. @item color_primaries
  12014. @item color_trc
  12015. Configure the colorspace that the ICC profile will be generated for. The
  12016. default value of @code{auto} infers the value from the input frame's metadata,
  12017. defaulting to BT.709/sRGB as appropriate.
  12018. See the @ref{setparams} filter for a list of possible values, but note that
  12019. @code{unknown} are not valid values for this filter.
  12020. @item force
  12021. If true, an ICC profile will be generated even if it would overwrite an
  12022. already existing ICC profile. Disabled by default.
  12023. @end table
  12024. @section identity
  12025. Obtain the identity score between two input videos.
  12026. This filter takes two input videos.
  12027. Both input videos must have the same resolution and pixel format for
  12028. this filter to work correctly. Also it assumes that both inputs
  12029. have the same number of frames, which are compared one by one.
  12030. The obtained per component, average, min and max identity score is printed through
  12031. the logging system.
  12032. The filter stores the calculated identity scores of each frame in frame metadata.
  12033. This filter also supports the @ref{framesync} options.
  12034. In the below example the input file @file{main.mpg} being processed is compared
  12035. with the reference file @file{ref.mpg}.
  12036. @example
  12037. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  12038. @end example
  12039. @section idet
  12040. Detect video interlacing type.
  12041. This filter tries to detect if the input frames are interlaced, progressive,
  12042. top or bottom field first. It will also try to detect fields that are
  12043. repeated between adjacent frames (a sign of telecine).
  12044. Single frame detection considers only immediately adjacent frames when classifying each frame.
  12045. Multiple frame detection incorporates the classification history of previous frames.
  12046. The filter will log these metadata values:
  12047. @table @option
  12048. @item single.current_frame
  12049. Detected type of current frame using single-frame detection. One of:
  12050. ``tff'' (top field first), ``bff'' (bottom field first),
  12051. ``progressive'', or ``undetermined''
  12052. @item single.tff
  12053. Cumulative number of frames detected as top field first using single-frame detection.
  12054. @item multiple.tff
  12055. Cumulative number of frames detected as top field first using multiple-frame detection.
  12056. @item single.bff
  12057. Cumulative number of frames detected as bottom field first using single-frame detection.
  12058. @item multiple.current_frame
  12059. Detected type of current frame using multiple-frame detection. One of:
  12060. ``tff'' (top field first), ``bff'' (bottom field first),
  12061. ``progressive'', or ``undetermined''
  12062. @item multiple.bff
  12063. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  12064. @item single.progressive
  12065. Cumulative number of frames detected as progressive using single-frame detection.
  12066. @item multiple.progressive
  12067. Cumulative number of frames detected as progressive using multiple-frame detection.
  12068. @item single.undetermined
  12069. Cumulative number of frames that could not be classified using single-frame detection.
  12070. @item multiple.undetermined
  12071. Cumulative number of frames that could not be classified using multiple-frame detection.
  12072. @item repeated.current_frame
  12073. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  12074. @item repeated.neither
  12075. Cumulative number of frames with no repeated field.
  12076. @item repeated.top
  12077. Cumulative number of frames with the top field repeated from the previous frame's top field.
  12078. @item repeated.bottom
  12079. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  12080. @end table
  12081. The filter accepts the following options:
  12082. @table @option
  12083. @item intl_thres
  12084. Set interlacing threshold.
  12085. @item prog_thres
  12086. Set progressive threshold.
  12087. @item rep_thres
  12088. Threshold for repeated field detection.
  12089. @item half_life
  12090. Number of frames after which a given frame's contribution to the
  12091. statistics is halved (i.e., it contributes only 0.5 to its
  12092. classification). The default of 0 means that all frames seen are given
  12093. full weight of 1.0 forever.
  12094. @item analyze_interlaced_flag
  12095. When this is not 0 then idet will use the specified number of frames to determine
  12096. if the interlaced flag is accurate, it will not count undetermined frames.
  12097. If the flag is found to be accurate it will be used without any further
  12098. computations, if it is found to be inaccurate it will be cleared without any
  12099. further computations. This allows inserting the idet filter as a low computational
  12100. method to clean up the interlaced flag
  12101. @end table
  12102. @section il
  12103. Deinterleave or interleave fields.
  12104. This filter allows one to process interlaced images fields without
  12105. deinterlacing them. Deinterleaving splits the input frame into 2
  12106. fields (so called half pictures). Odd lines are moved to the top
  12107. half of the output image, even lines to the bottom half.
  12108. You can process (filter) them independently and then re-interleave them.
  12109. The filter accepts the following options:
  12110. @table @option
  12111. @item luma_mode, l
  12112. @item chroma_mode, c
  12113. @item alpha_mode, a
  12114. Available values for @var{luma_mode}, @var{chroma_mode} and
  12115. @var{alpha_mode} are:
  12116. @table @samp
  12117. @item none
  12118. Do nothing.
  12119. @item deinterleave, d
  12120. Deinterleave fields, placing one above the other.
  12121. @item interleave, i
  12122. Interleave fields. Reverse the effect of deinterleaving.
  12123. @end table
  12124. Default value is @code{none}.
  12125. @item luma_swap, ls
  12126. @item chroma_swap, cs
  12127. @item alpha_swap, as
  12128. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  12129. @end table
  12130. @subsection Commands
  12131. This filter supports the all above options as @ref{commands}.
  12132. @section inflate
  12133. Apply inflate effect to the video.
  12134. This filter replaces the pixel by the local(3x3) average by taking into account
  12135. only values higher than the pixel.
  12136. It accepts the following options:
  12137. @table @option
  12138. @item threshold0
  12139. @item threshold1
  12140. @item threshold2
  12141. @item threshold3
  12142. Limit the maximum change for each plane, default is 65535.
  12143. If 0, plane will remain unchanged.
  12144. @end table
  12145. @subsection Commands
  12146. This filter supports the all above options as @ref{commands}.
  12147. @section interlace
  12148. Simple interlacing filter from progressive contents. This interleaves upper (or
  12149. lower) lines from odd frames with lower (or upper) lines from even frames,
  12150. halving the frame rate and preserving image height.
  12151. @example
  12152. Original Original New Frame
  12153. Frame 'j' Frame 'j+1' (tff)
  12154. ========== =========== ==================
  12155. Line 0 --------------------> Frame 'j' Line 0
  12156. Line 1 Line 1 ----> Frame 'j+1' Line 1
  12157. Line 2 ---------------------> Frame 'j' Line 2
  12158. Line 3 Line 3 ----> Frame 'j+1' Line 3
  12159. ... ... ...
  12160. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  12161. @end example
  12162. It accepts the following optional parameters:
  12163. @table @option
  12164. @item scan
  12165. This determines whether the interlaced frame is taken from the even
  12166. (tff - default) or odd (bff) lines of the progressive frame.
  12167. @item lowpass
  12168. Vertical lowpass filter to avoid twitter interlacing and
  12169. reduce moire patterns.
  12170. @table @samp
  12171. @item 0, off
  12172. Disable vertical lowpass filter
  12173. @item 1, linear
  12174. Enable linear filter (default)
  12175. @item 2, complex
  12176. Enable complex filter. This will slightly less reduce twitter and moire
  12177. but better retain detail and subjective sharpness impression.
  12178. @end table
  12179. @end table
  12180. @section kerndeint
  12181. Deinterlace input video by applying Donald Graft's adaptive kernel
  12182. deinterling. Work on interlaced parts of a video to produce
  12183. progressive frames.
  12184. The description of the accepted parameters follows.
  12185. @table @option
  12186. @item thresh
  12187. Set the threshold which affects the filter's tolerance when
  12188. determining if a pixel line must be processed. It must be an integer
  12189. in the range [0,255] and defaults to 10. A value of 0 will result in
  12190. applying the process on every pixels.
  12191. @item map
  12192. Paint pixels exceeding the threshold value to white if set to 1.
  12193. Default is 0.
  12194. @item order
  12195. Set the fields order. Swap fields if set to 1, leave fields alone if
  12196. 0. Default is 0.
  12197. @item sharp
  12198. Enable additional sharpening if set to 1. Default is 0.
  12199. @item twoway
  12200. Enable twoway sharpening if set to 1. Default is 0.
  12201. @end table
  12202. @subsection Examples
  12203. @itemize
  12204. @item
  12205. Apply default values:
  12206. @example
  12207. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  12208. @end example
  12209. @item
  12210. Enable additional sharpening:
  12211. @example
  12212. kerndeint=sharp=1
  12213. @end example
  12214. @item
  12215. Paint processed pixels in white:
  12216. @example
  12217. kerndeint=map=1
  12218. @end example
  12219. @end itemize
  12220. @section kirsch
  12221. Apply kirsch operator to input video stream.
  12222. The filter accepts the following option:
  12223. @table @option
  12224. @item planes
  12225. Set which planes will be processed, unprocessed planes will be copied.
  12226. By default value 0xf, all planes will be processed.
  12227. @item scale
  12228. Set value which will be multiplied with filtered result.
  12229. @item delta
  12230. Set value which will be added to filtered result.
  12231. @end table
  12232. @subsection Commands
  12233. This filter supports the all above options as @ref{commands}.
  12234. @section lagfun
  12235. Slowly update darker pixels.
  12236. This filter makes short flashes of light appear longer.
  12237. This filter accepts the following options:
  12238. @table @option
  12239. @item decay
  12240. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  12241. @item planes
  12242. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  12243. @end table
  12244. @subsection Commands
  12245. This filter supports the all above options as @ref{commands}.
  12246. @section lenscorrection
  12247. Correct radial lens distortion
  12248. This filter can be used to correct for radial distortion as can result from the use
  12249. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  12250. one can use tools available for example as part of opencv or simply trial-and-error.
  12251. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  12252. and extract the k1 and k2 coefficients from the resulting matrix.
  12253. Note that effectively the same filter is available in the open-source tools Krita and
  12254. Digikam from the KDE project.
  12255. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  12256. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  12257. brightness distribution, so you may want to use both filters together in certain
  12258. cases, though you will have to take care of ordering, i.e. whether vignetting should
  12259. be applied before or after lens correction.
  12260. @subsection Options
  12261. The filter accepts the following options:
  12262. @table @option
  12263. @item cx
  12264. Relative x-coordinate of the focal point of the image, and thereby the center of the
  12265. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12266. width. Default is 0.5.
  12267. @item cy
  12268. Relative y-coordinate of the focal point of the image, and thereby the center of the
  12269. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12270. height. Default is 0.5.
  12271. @item k1
  12272. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  12273. no correction. Default is 0.
  12274. @item k2
  12275. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  12276. 0 means no correction. Default is 0.
  12277. @item i
  12278. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  12279. Default is @code{nearest}.
  12280. @item fc
  12281. Specify the color of the unmapped pixels. For the syntax of this option,
  12282. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12283. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  12284. @end table
  12285. The formula that generates the correction is:
  12286. @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)
  12287. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  12288. distances from the focal point in the source and target images, respectively.
  12289. @subsection Commands
  12290. This filter supports the all above options as @ref{commands}.
  12291. @section lensfun
  12292. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  12293. The @code{lensfun} filter requires the camera make, camera model, and lens model
  12294. to apply the lens correction. The filter will load the lensfun database and
  12295. query it to find the corresponding camera and lens entries in the database. As
  12296. long as these entries can be found with the given options, the filter can
  12297. perform corrections on frames. Note that incomplete strings will result in the
  12298. filter choosing the best match with the given options, and the filter will
  12299. output the chosen camera and lens models (logged with level "info"). You must
  12300. provide the make, camera model, and lens model as they are required.
  12301. To obtain a list of available makes and models, leave out one or both of @code{make} and
  12302. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  12303. The first column is the make and the second column is the model.
  12304. To obtain a list of available lenses, set any values for make and model and leave out the
  12305. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  12306. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  12307. The filter accepts the following options:
  12308. @table @option
  12309. @item make
  12310. The make of the camera (for example, "Canon"). This option is required.
  12311. @item model
  12312. The model of the camera (for example, "Canon EOS 100D"). This option is
  12313. required.
  12314. @item lens_model
  12315. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  12316. option is required.
  12317. @item db_path
  12318. The full path to the lens database folder. If not set, the filter will attempt to
  12319. load the database from the install path when the library was built. Default is unset.
  12320. @item mode
  12321. The type of correction to apply. The following values are valid options:
  12322. @table @samp
  12323. @item vignetting
  12324. Enables fixing lens vignetting.
  12325. @item geometry
  12326. Enables fixing lens geometry. This is the default.
  12327. @item subpixel
  12328. Enables fixing chromatic aberrations.
  12329. @item vig_geo
  12330. Enables fixing lens vignetting and lens geometry.
  12331. @item vig_subpixel
  12332. Enables fixing lens vignetting and chromatic aberrations.
  12333. @item distortion
  12334. Enables fixing both lens geometry and chromatic aberrations.
  12335. @item all
  12336. Enables all possible corrections.
  12337. @end table
  12338. @item focal_length
  12339. The focal length of the image/video (zoom; expected constant for video). For
  12340. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  12341. range should be chosen when using that lens. Default 18.
  12342. @item aperture
  12343. The aperture of the image/video (expected constant for video). Note that
  12344. aperture is only used for vignetting correction. Default 3.5.
  12345. @item focus_distance
  12346. The focus distance of the image/video (expected constant for video). Note that
  12347. focus distance is only used for vignetting and only slightly affects the
  12348. vignetting correction process. If unknown, leave it at the default value (which
  12349. is 1000).
  12350. @item scale
  12351. The scale factor which is applied after transformation. After correction the
  12352. video is no longer necessarily rectangular. This parameter controls how much of
  12353. the resulting image is visible. The value 0 means that a value will be chosen
  12354. automatically such that there is little or no unmapped area in the output
  12355. image. 1.0 means that no additional scaling is done. Lower values may result
  12356. in more of the corrected image being visible, while higher values may avoid
  12357. unmapped areas in the output.
  12358. @item target_geometry
  12359. The target geometry of the output image/video. The following values are valid
  12360. options:
  12361. @table @samp
  12362. @item rectilinear (default)
  12363. @item fisheye
  12364. @item panoramic
  12365. @item equirectangular
  12366. @item fisheye_orthographic
  12367. @item fisheye_stereographic
  12368. @item fisheye_equisolid
  12369. @item fisheye_thoby
  12370. @end table
  12371. @item reverse
  12372. Apply the reverse of image correction (instead of correcting distortion, apply
  12373. it).
  12374. @item interpolation
  12375. The type of interpolation used when correcting distortion. The following values
  12376. are valid options:
  12377. @table @samp
  12378. @item nearest
  12379. @item linear (default)
  12380. @item lanczos
  12381. @end table
  12382. @end table
  12383. @subsection Examples
  12384. @itemize
  12385. @item
  12386. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  12387. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  12388. aperture of "8.0".
  12389. @example
  12390. 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
  12391. @end example
  12392. @item
  12393. Apply the same as before, but only for the first 5 seconds of video.
  12394. @example
  12395. 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
  12396. @end example
  12397. @end itemize
  12398. @section libplacebo
  12399. Flexible GPU-accelerated processing filter based on libplacebo
  12400. (@url{https://code.videolan.org/videolan/libplacebo}).
  12401. @subsection Options
  12402. The options for this filter are divided into the following sections:
  12403. @subsubsection Output mode
  12404. These options control the overall output mode. By default, libplacebo will try
  12405. to preserve the source colorimetry and size as best as it can, but it will
  12406. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  12407. in source frames.
  12408. @table @option
  12409. @item inputs
  12410. Set the number of inputs. This can be used, alongside the @code{idx} variable,
  12411. to allow placing/blending multiple inputs inside the output frame. This
  12412. effectively enables functionality similar to @ref{hstack}, @ref{overlay}, etc.
  12413. @item w
  12414. @item h
  12415. Set the output video dimension expression. Default values are @code{iw} and
  12416. @code{ih}.
  12417. Allows for the same expressions as the @ref{scale} filter.
  12418. @item crop_x
  12419. @item crop_y
  12420. Set the input crop x/y expressions, default values are @code{(iw-cw)/2} and
  12421. @code{(ih-ch)/2}.
  12422. @item crop_w
  12423. @item crop_h
  12424. Set the input crop width/height expressions, default values are @code{iw} and
  12425. @code{ih}.
  12426. @item pos_x
  12427. @item pos_y
  12428. Set the output placement x/y expressions, default values are @code{(ow-pw)/2}
  12429. and @code{(oh-ph)/2}.
  12430. @item pos_w
  12431. @item pos_h
  12432. Set the output placement width/height expressions, default values are @code{ow}
  12433. and @code{oh}.
  12434. @item fps
  12435. Set the output frame rate. This can be rational, e.g. @code{60000/1001}. If
  12436. set to the special string @code{none} (the default), input timestamps will
  12437. instead be passed through to the output unmodified. Otherwise, the input video
  12438. frames will be interpolated as necessary to rescale the video to the specified
  12439. target framerate, in a manner as determined by the @option{frame_mixer} option.
  12440. @item format
  12441. Set the output format override. If unset (the default), frames will be output
  12442. in the same format as the respective input frames. Otherwise, format conversion
  12443. will be performed.
  12444. @item force_original_aspect_ratio
  12445. @item force_divisible_by
  12446. Work the same as the identical @ref{scale} filter options.
  12447. @item normalize_sar
  12448. If enabled, output frames will always have a pixel aspect ratio of 1:1. This
  12449. will introduce additional padding/cropping as necessary. If disabled (the
  12450. default), any aspect ratio mismatches, including those from e.g. anamorphic
  12451. video sources, are forwarded to the output pixel aspect ratio.
  12452. @item pad_crop_ratio
  12453. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  12454. cropping when the input aspect ratio does not match the output aspect ratio and
  12455. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  12456. content with black borders, while a value of @code{1.0} always crops off parts
  12457. of the content. Intermediate values are possible, leading to a mix of the two
  12458. approaches.
  12459. @item fillcolor
  12460. Set the color used to fill the output area not covered by the output image, for
  12461. example as a result of @option{normalize_sar}. For the general syntax of this
  12462. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12463. manual,ffmpeg-utils}. Defaults to @code{black}.
  12464. @item corner_rounding
  12465. Render frames with rounded corners. The value, given as a float ranging from
  12466. @code{0.0} to @code{1.0}, indicates the relative degree of rounding, from fully
  12467. square to fully circular. In other words, it gives the radius divided by half
  12468. the smaller side length. Defaults to @code{0.0}.
  12469. @item extra_opts
  12470. Pass extra libplacebo internal configuration options. These can be specified
  12471. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  12472. shows how to configure a custom filter kernel ("EWA LanczosSharp") and use it
  12473. to double the input image resolution:
  12474. @example
  12475. -vf "libplacebo=w=iw*2:h=ih*2:extra_opts='upscaler=custom\:upscaler_preset=ewa_lanczos\:upscaler_blur=0.9812505644269356'"
  12476. @end example
  12477. @item colorspace
  12478. @item color_primaries
  12479. @item color_trc
  12480. @item range
  12481. Configure the colorspace that output frames will be delivered in. The default
  12482. value of @code{auto} outputs frames in the same format as the input frames,
  12483. leading to no change. For any other value, conversion will be performed.
  12484. See the @ref{setparams} filter for a list of possible values.
  12485. @item apply_filmgrain
  12486. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  12487. it from the output. Enabled by default.
  12488. @item apply_dolbyvision
  12489. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  12490. the output. Enabled by default. Note that Dolby Vision will always output
  12491. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  12492. picked as the values of @code{auto} for the respective frame output options.
  12493. @end table
  12494. In addition to the expression constants documented for the @ref{scale} filter,
  12495. the @option{crop_w}, @option{crop_h}, @option{crop_x}, @option{crop_y},
  12496. @option{pos_w}, @option{pos_h}, @option{pos_x} and @option{pos_y} options can
  12497. also contain the following constants:
  12498. @table @option
  12499. @item in_idx, idx
  12500. The (0-based) numeric index of the currently active input stream.
  12501. @item crop_w, cw
  12502. @item crop_h, ch
  12503. The computed values of @option{crop_w} and @option{crop_h}.
  12504. @item pos_w, pw
  12505. @item pos_h, ph
  12506. The computed values of @option{pos_w} and @option{pos_h}.
  12507. @item in_t, t
  12508. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12509. @item out_t, ot
  12510. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12511. @item n
  12512. The input frame number, starting with 0.
  12513. @end table
  12514. @subsubsection Scaling
  12515. The options in this section control how libplacebo performs upscaling and (if
  12516. necessary) downscaling. Note that libplacebo will always internally operate on
  12517. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  12518. necessarily be upsampled and downsampled as part of the rendering process. That
  12519. means scaling might be in effect even if the source and destination resolution
  12520. are the same.
  12521. @table @option
  12522. @item upscaler
  12523. @item downscaler
  12524. Configure the filter kernel used for upscaling and downscaling. The respective
  12525. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  12526. values, pass @code{help} to these options. The most important values are:
  12527. @table @samp
  12528. @item none
  12529. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  12530. fast but poor quality, especially when downscaling.
  12531. @item bilinear
  12532. Bilinear interpolation. Can generally be done for free on GPUs, except when
  12533. doing so would lead to aliasing. Fast and low quality.
  12534. @item nearest
  12535. Nearest-neighbour interpolation. Sharp but highly aliasing.
  12536. @item oversample
  12537. Algorithm that looks visually similar to nearest-neighbour interpolation but
  12538. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  12539. minimal distortion of the artistic appearance.
  12540. @item lanczos
  12541. Standard sinc-sinc interpolation kernel.
  12542. @item spline36
  12543. Cubic spline approximation of lanczos. No difference in performance, but has
  12544. very slightly less ringing.
  12545. @item ewa_lanczos
  12546. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  12547. This is also popularly referred to as just "Jinc scaling". Slow but very high
  12548. quality.
  12549. @item gaussian
  12550. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  12551. very blurry.
  12552. @item mitchell
  12553. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  12554. little ringing.
  12555. @end table
  12556. @item frame_mixer
  12557. Controls the kernel used for mixing frames temporally. The default value is
  12558. @code{none}, which disables frame mixing. For a full list of possible values,
  12559. pass @code{help} to this option. The most important values are:
  12560. @table @samp
  12561. @item none
  12562. Disables frame mixing, giving a result equivalent to "nearest neighbour"
  12563. semantics.
  12564. @item oversample
  12565. Oversamples the input video to create a "Smooth Motion"-type effect: if an
  12566. output frame would exactly fall on the transition between two video frames, it
  12567. is blended according to the relative overlap. This is the recommended option
  12568. whenever preserving the original subjective appearance is desired.
  12569. @item mitchell_clamp
  12570. Larger filter kernel that smoothly interpolates multiple frames in a manner
  12571. designed to eliminate ringing and other artefacts as much as possible. This is
  12572. the recommended option wherever maximum visual smoothness is desired.
  12573. @item linear
  12574. Linear blend/fade between frames. Especially useful for constructing e.g.
  12575. slideshows.
  12576. @end table
  12577. @item lut_entries
  12578. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  12579. default of @code{0} will pick libplacebo's internal default, typically
  12580. @code{64}.
  12581. @item antiringing
  12582. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  12583. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  12584. aliasing if set too high. Disabled by default.
  12585. @item sigmoid
  12586. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  12587. Enabled by default.
  12588. @end table
  12589. @subsubsection Debanding
  12590. Libplacebo comes with a built-in debanding filter that is good at counteracting
  12591. many common sources of banding and blocking. Turning this on is highly
  12592. recommended whenever quality is desired.
  12593. @table @option
  12594. @item deband
  12595. Enable (fast) debanding algorithm. Disabled by default.
  12596. @item deband_iterations
  12597. Number of deband iterations of the debanding algorithm. Each iteration is
  12598. performed with progressively increased radius (and diminished threshold).
  12599. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  12600. @item deband_threshold
  12601. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  12602. Defaults to @code{4.0}.
  12603. @item deband_radius
  12604. Debanding filter radius. A higher radius is better for slow gradients, while
  12605. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  12606. @item deband_grain
  12607. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  12608. @code{6.0}.
  12609. @end table
  12610. @subsubsection Color adjustment
  12611. A collection of subjective color controls. Not very rigorous, so the exact
  12612. effect will vary somewhat depending on the input primaries and colorspace.
  12613. @table @option
  12614. @item brightness
  12615. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  12616. @item contrast
  12617. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12618. @item saturation
  12619. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12620. @item hue
  12621. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  12622. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  12623. coefficients for RGB inputs.
  12624. @item gamma
  12625. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12626. @item cones
  12627. Cone model to use for color blindness simulation. Accepts any combination of
  12628. @code{l}, @code{m} and @code{s}. Here are some examples:
  12629. @table @samp
  12630. @item m
  12631. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  12632. @item l
  12633. Protanomaly / protanopia (affecting 1%-2% of the population)
  12634. @item l+m
  12635. Monochromacy (very rare)
  12636. @item l+m+s
  12637. Achromatopsy (complete loss of daytime vision, extremely rare)
  12638. @end table
  12639. @item cone-strength
  12640. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  12641. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  12642. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  12643. above @code{1.0} result in exaggerating the differences between cones, which
  12644. may help compensate for reduced color vision.
  12645. @end table
  12646. @subsubsection Peak detection
  12647. To help deal with sources that only have static HDR10 metadata (or no tagging
  12648. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  12649. analyze source frames and adapt the tone mapping function in realtime. If this
  12650. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  12651. recommended to turn this feature off.
  12652. @table @option
  12653. @item peak_detect
  12654. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  12655. dynamic detection from the input. Note that the detected values do not get
  12656. written back to the output frames, they merely guide the internal tone mapping
  12657. process. Enabled by default.
  12658. @item smoothing_period
  12659. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  12660. values result in peak detection becoming less responsive to changes in the
  12661. input. Defaults to @code{100.0}.
  12662. @item minimum_peak
  12663. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  12664. and @code{100.0}. Defaults to @code{1.0}.
  12665. @item scene_threshold_low
  12666. @item scene_threshold_high
  12667. Lower and upper thresholds for scene change detection. Expressed in a
  12668. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  12669. and @code{10.0}, respectively. Setting either to a negative value disables
  12670. this functionality.
  12671. @item percentile
  12672. Which percentile of the frame brightness histogram to use as the source peak
  12673. for tone-mapping. Defaults to @code{99.995}, a fairly conservative value.
  12674. Setting this to @code{100.0} disables frame histogram measurement and instead
  12675. uses the true peak brightness for tone-mapping.
  12676. @end table
  12677. @subsubsection Tone mapping
  12678. The options in this section control how libplacebo performs tone-mapping and
  12679. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  12680. In general, libplacebo relies on accurate source tagging and mastering display
  12681. gamut information to produce the best results.
  12682. @table @option
  12683. @item gamut_mode
  12684. How to handle out-of-gamut colors that can occur as a result of colorimetric
  12685. gamut mapping.
  12686. @table @samp
  12687. @item clip
  12688. Do nothing, simply clip out-of-range colors to the RGB volume. Low quality but
  12689. extremely fast.
  12690. @item perceptual
  12691. Perceptually soft-clip colors to the gamut volume. This is the default.
  12692. @item relative
  12693. Relative colorimetric hard-clip. Similar to @code{perceptual} but without
  12694. the soft knee.
  12695. @item saturation
  12696. Saturation mapping, maps primaries directly to primaries in RGB space.
  12697. Not recommended except for artificial computer graphics for which a bright,
  12698. saturated display is desired.
  12699. @item absolute
  12700. Absolute colorimetric hard-clip. Performs no adjustment of the white point.
  12701. @item desaturate
  12702. Hard-desaturates out-of-gamut colors towards white, while preserving the
  12703. luminance. Has a tendency to distort the visual appearance of bright objects.
  12704. @item darken
  12705. Linearly reduces content brightness to preserves saturated details, followed by
  12706. clipping the remaining out-of-gamut colors.
  12707. @item warn
  12708. Highlight out-of-gamut pixels (by inverting/marking them).
  12709. @item linear
  12710. Linearly reduces chromaticity of the entire image to make it fit within the
  12711. target color volume. Be careful when using this on BT.2020 sources without
  12712. proper mastering metadata, as doing so will lead to excessive desaturation.
  12713. @end table
  12714. @item tonemapping
  12715. Tone-mapping algorithm to use. Available values are:
  12716. @table @samp
  12717. @item auto
  12718. Automatic selection based on internal heuristics. This is the default.
  12719. @item clip
  12720. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  12721. accuracy for in-range colors but completely destroys out-of-range information.
  12722. Does not perform any black point adaptation. Not configurable.
  12723. @item st2094-40
  12724. EETF from SMPTE ST 2094-40 Annex B, which applies the Bezier curves from HDR10+
  12725. dynamic metadata based on Bezier curves to perform tone-mapping. The OOTF used
  12726. is adjusted based on the ratio between the targeted and actual display peak
  12727. luminances.
  12728. @item st2094-10
  12729. EETF from SMPTE ST 2094-10 Annex B.2, which takes into account the input signal
  12730. average luminance in addition to the maximum/minimum. The configurable contrast
  12731. parameter influences the slope of the linear output segment, defaulting to
  12732. @code{1.0} for no increase/decrease in contrast. Note that this does not
  12733. currently include the subjective gain/offset/gamma controls defined in Annex
  12734. B.3.
  12735. @item bt.2390
  12736. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  12737. segment. The knee point offset is configurable. Note that this parameter
  12738. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  12739. spec.
  12740. @item bt.2446a
  12741. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  12742. sources. Can be used for both forward and inverse tone mapping. Not
  12743. configurable.
  12744. @item spline
  12745. Simple spline consisting of two polynomials, joined by a single pivot point.
  12746. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  12747. Can be used for both forward and inverse tone mapping.
  12748. @item reinhard
  12749. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  12750. local contrast coefficient at the display peak. Essentially, a parameter of
  12751. @code{0.5} implies that the reference white will be about half as bright as
  12752. when clipping. Defaults to @code{0.5}, which results in the simplest
  12753. formulation of this function.
  12754. @item mobius
  12755. Generalization of the reinhard tone mapping algorithm to support an additional
  12756. linear slope near black. The tone mapping parameter indicates the trade-off
  12757. between the linear section and the non-linear section. Essentially, for a given
  12758. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  12759. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  12760. this curve behave like @code{clip}, while values near @code{0.0} make this
  12761. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  12762. provides a good balance between colorimetric accuracy and preserving
  12763. out-of-gamut details.
  12764. @item hable
  12765. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  12766. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  12767. Popularized by its use in video games with HDR rendering. Preserves both dark
  12768. and bright details very well, but comes with the drawback of changing the
  12769. average brightness quite significantly. This is sort of similar to
  12770. @code{reinhard} with parameter @code{0.24}.
  12771. @item gamma
  12772. Fits a gamma (power) function to transfer between the source and target color
  12773. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  12774. linear sections. This preserves details at all scales fairly accurately, but
  12775. can result in an image with a muted or dull appearance. The parameter is used
  12776. as the cutoff point, defaulting to @code{0.5}.
  12777. @item linear
  12778. Linearly stretches the input range to the output range, in PQ space. This will
  12779. preserve all details accurately, but results in a significantly different
  12780. average brightness. Can be used for inverse tone-mapping in addition to regular
  12781. tone-mapping. The parameter can be used as an additional linear gain
  12782. coefficient (defaulting to @code{1.0}).
  12783. @end table
  12784. @item tonemapping_param
  12785. For tunable tone mapping functions, this parameter can be used to fine-tune the
  12786. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  12787. value of @code{0.0} is replaced by the curve's preferred default setting.
  12788. @item inverse_tonemapping
  12789. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  12790. output color volumes. Disabled by default.
  12791. @item tonemapping_lut_size
  12792. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  12793. @code{256}. Note that this figure is squared when combined with
  12794. @code{peak_detect}.
  12795. @item contrast_recovery
  12796. Contrast recovery strength. If set to a value above @code{0.0}, the source
  12797. image will be divided into high-frequency and low-frequency components, and a
  12798. portion of the high-frequency image is added back onto the tone-mapped output.
  12799. May cause excessive ringing artifacts for some HDR sources, but can improve the
  12800. subjective sharpness and detail left over in the image after tone-mapping.
  12801. Defaults to @code{0.30}.
  12802. @item contrast_smoothness
  12803. Contrast recovery lowpass kernel size. Defaults to @code{3.5}. Increasing or
  12804. decreasing this will affect the visual appearance substantially. Has no effect
  12805. when @code{contrast_recovery} is disabled.
  12806. @end table
  12807. @subsubsection Dithering
  12808. By default, libplacebo will dither whenever necessary, which includes rendering
  12809. to any integer format below 16-bit precision. It's recommended to always leave
  12810. this on, since not doing so may result in visible banding in the output, even
  12811. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12812. use @code{ordered_fixed} instead of disabling dithering.
  12813. @table @option
  12814. @item dithering
  12815. Dithering method to use. Accepts the following values:
  12816. @table @samp
  12817. @item none
  12818. Disables dithering completely. May result in visible banding.
  12819. @item blue
  12820. Dither with pseudo-blue noise. This is the default.
  12821. @item ordered
  12822. Tunable ordered dither pattern.
  12823. @item ordered_fixed
  12824. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12825. @item white
  12826. Dither with white noise. Texture-less.
  12827. @end table
  12828. @item dither_lut_size
  12829. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12830. @code{6}, corresponding to a LUT size of @code{64x64}.
  12831. @item dither_temporal
  12832. Enables temporal dithering. Disabled by default.
  12833. @end table
  12834. @subsubsection Custom shaders
  12835. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12836. syntax. A collection of such shaders can be found here:
  12837. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12838. A full description of the mpv shader format is beyond the scope of this
  12839. section, but a summary can be found here:
  12840. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12841. @table @option
  12842. @item custom_shader_path
  12843. Specifies a path to a custom shader file to load at runtime.
  12844. @item custom_shader_bin
  12845. Specifies a complete custom shader as a raw string.
  12846. @end table
  12847. @subsubsection Debugging / performance
  12848. All of the options in this section default off. They may be of assistance when
  12849. attempting to squeeze the maximum performance at the cost of quality.
  12850. @table @option
  12851. @item skip_aa
  12852. Disable anti-aliasing when downscaling.
  12853. @item polar_cutoff
  12854. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  12855. @code{0.0} and @code{1.0}.
  12856. @item disable_linear
  12857. Disable linear light scaling.
  12858. @item disable_builtin
  12859. Disable built-in GPU sampling (forces LUT).
  12860. @item disable_fbos
  12861. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12862. offering the maximum possible speed.
  12863. @end table
  12864. @subsection Commands
  12865. This filter supports almost all of the above options as @ref{commands}.
  12866. @subsection Examples
  12867. @itemize
  12868. @item
  12869. Tone-map input to standard gamut BT.709 output:
  12870. @example
  12871. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12872. @end example
  12873. @item
  12874. Rescale input to fit into standard 1080p, with high quality scaling:
  12875. @example
  12876. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12877. @end example
  12878. @item
  12879. Interpolate low FPS / VFR input to smoothed constant 60 fps output:
  12880. @example
  12881. libplacebo=fps=60:frame_mixer=mitchell_clamp
  12882. @end example
  12883. @item
  12884. Convert input to standard sRGB JPEG:
  12885. @example
  12886. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12887. @end example
  12888. @item
  12889. Use higher quality debanding settings:
  12890. @example
  12891. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  12892. @end example
  12893. @item
  12894. Run this filter on the CPU, on systems with Mesa installed (and with the most
  12895. expensive options disabled):
  12896. @example
  12897. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  12898. @end example
  12899. @item
  12900. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  12901. doing it with this filter. Note that this is only a gain if the frames are
  12902. either already on the GPU, or if you're using libplacebo for other purposes,
  12903. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  12904. @example
  12905. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  12906. @end example
  12907. @item
  12908. Interop with VAAPI hwdec to avoid round-tripping through RAM:
  12909. @example
  12910. ffmpeg -init_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi ... -vf libplacebo
  12911. @end example
  12912. @end itemize
  12913. @anchor{libvmaf}
  12914. @section libvmaf
  12915. Calulate the VMAF (Video Multi-Method Assessment Fusion) score for a
  12916. reference/distorted pair of input videos.
  12917. The first input is the distorted video, and the second input is the reference video.
  12918. The obtained VMAF score is printed through the logging system.
  12919. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12920. After installing the library it can be enabled using:
  12921. @code{./configure --enable-libvmaf}.
  12922. The filter has following options:
  12923. @table @option
  12924. @item model
  12925. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  12926. Default value: @code{"version=vmaf_v0.6.1"}
  12927. @item feature
  12928. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  12929. @item log_path
  12930. Set the file path to be used to store log files.
  12931. @item log_fmt
  12932. Set the format of the log file (xml, json, csv, or sub).
  12933. @item n_threads
  12934. Set number of threads to be used when initializing libvmaf.
  12935. Default value: @code{0}, no threads.
  12936. @item n_subsample
  12937. Set frame subsampling interval to be used.
  12938. @end table
  12939. This filter also supports the @ref{framesync} options.
  12940. @subsection Examples
  12941. @itemize
  12942. @item
  12943. In the examples below, a distorted video @file{distorted.mpg} is
  12944. compared with a reference file @file{reference.mpg}.
  12945. @item
  12946. Basic usage:
  12947. @example
  12948. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  12949. @end example
  12950. @item
  12951. Example with multiple models:
  12952. @example
  12953. 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 -
  12954. @end example
  12955. @item
  12956. Example with multiple addtional features:
  12957. @example
  12958. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  12959. @end example
  12960. @item
  12961. Example with options and different containers:
  12962. @example
  12963. 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 -
  12964. @end example
  12965. @end itemize
  12966. @section libvmaf_cuda
  12967. This is the CUDA variant of the @ref{libvmaf} filter. It only accepts CUDA frames.
  12968. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12969. After installing the library it can be enabled using:
  12970. @code{./configure --enable-nonfree --enable-ffnvcodec --enable-libvmaf}.
  12971. @subsection Examples
  12972. @itemize
  12973. @item
  12974. Basic usage showing CUVID hardware decoding and CUDA scaling with @ref{scale_cuda}:
  12975. @example
  12976. ffmpeg \
  12977. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i dis.obu \
  12978. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i ref.obu \
  12979. -filter_complex "
  12980. [0:v]scale_cuda=format=yuv420p[ref]; \
  12981. [1:v]scale_cuda=format=yuv420p[dis]; \
  12982. [dis][ref]libvmaf_cuda=log_fmt=json:log_path=output.json
  12983. " \
  12984. -f null -
  12985. @end example
  12986. @end itemize
  12987. @section limitdiff
  12988. Apply limited difference filter using second and optionally third video stream.
  12989. The filter accepts the following options:
  12990. @table @option
  12991. @item threshold
  12992. Set the threshold to use when allowing certain differences between video streams.
  12993. Any absolute difference value lower or exact than this threshold will pick pixel components from
  12994. first video stream.
  12995. @item elasticity
  12996. Set the elasticity of soft thresholding when processing video streams.
  12997. This value multiplied with first one sets second threshold.
  12998. Any absolute difference value greater or exact than second threshold will pick pixel components
  12999. from second video stream. For values between those two threshold
  13000. linear interpolation between first and second video stream will be used.
  13001. @item reference
  13002. Enable the reference (third) video stream processing. By default is disabled.
  13003. If set, this video stream will be used for calculating absolute difference with first video
  13004. stream.
  13005. @item planes
  13006. Specify which planes will be processed. Defaults to all available.
  13007. @end table
  13008. @subsection Commands
  13009. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  13010. @section limiter
  13011. Limits the pixel components values to the specified range [min, max].
  13012. The filter accepts the following options:
  13013. @table @option
  13014. @item min
  13015. Lower bound. Defaults to the lowest allowed value for the input.
  13016. @item max
  13017. Upper bound. Defaults to the highest allowed value for the input.
  13018. @item planes
  13019. Specify which planes will be processed. Defaults to all available.
  13020. @end table
  13021. @subsection Commands
  13022. This filter supports the all above options as @ref{commands}.
  13023. @section loop
  13024. Loop video frames.
  13025. The filter accepts the following options:
  13026. @table @option
  13027. @item loop
  13028. Set the number of loops. Setting this value to -1 will result in infinite loops.
  13029. Default is 0.
  13030. @item size
  13031. Set maximal size in number of frames. Default is 0.
  13032. @item start
  13033. Set first frame of loop. Default is 0.
  13034. @item time
  13035. Set the time of loop start in seconds.
  13036. Only used if option named @var{start} is set to @code{-1}.
  13037. @end table
  13038. @subsection Examples
  13039. @itemize
  13040. @item
  13041. Loop single first frame infinitely:
  13042. @example
  13043. loop=loop=-1:size=1:start=0
  13044. @end example
  13045. @item
  13046. Loop single first frame 10 times:
  13047. @example
  13048. loop=loop=10:size=1:start=0
  13049. @end example
  13050. @item
  13051. Loop 10 first frames 5 times:
  13052. @example
  13053. loop=loop=5:size=10:start=0
  13054. @end example
  13055. @end itemize
  13056. @section lut1d
  13057. Apply a 1D LUT to an input video.
  13058. The filter accepts the following options:
  13059. @table @option
  13060. @item file
  13061. Set the 1D LUT file name.
  13062. Currently supported formats:
  13063. @table @samp
  13064. @item cube
  13065. Iridas
  13066. @item csp
  13067. cineSpace
  13068. @end table
  13069. @item interp
  13070. Select interpolation mode.
  13071. Available values are:
  13072. @table @samp
  13073. @item nearest
  13074. Use values from the nearest defined point.
  13075. @item linear
  13076. Interpolate values using the linear interpolation.
  13077. @item cosine
  13078. Interpolate values using the cosine interpolation.
  13079. @item cubic
  13080. Interpolate values using the cubic interpolation.
  13081. @item spline
  13082. Interpolate values using the spline interpolation.
  13083. @end table
  13084. @end table
  13085. @subsection Commands
  13086. This filter supports the all above options as @ref{commands}.
  13087. @anchor{lut3d}
  13088. @section lut3d
  13089. Apply a 3D LUT to an input video.
  13090. The filter accepts the following options:
  13091. @table @option
  13092. @item file
  13093. Set the 3D LUT file name.
  13094. Currently supported formats:
  13095. @table @samp
  13096. @item 3dl
  13097. AfterEffects
  13098. @item cube
  13099. Iridas
  13100. @item dat
  13101. DaVinci
  13102. @item m3d
  13103. Pandora
  13104. @item csp
  13105. cineSpace
  13106. @end table
  13107. @item interp
  13108. Select interpolation mode.
  13109. Available values are:
  13110. @table @samp
  13111. @item nearest
  13112. Use values from the nearest defined point.
  13113. @item trilinear
  13114. Interpolate values using the 8 points defining a cube.
  13115. @item tetrahedral
  13116. Interpolate values using a tetrahedron.
  13117. @item pyramid
  13118. Interpolate values using a pyramid.
  13119. @item prism
  13120. Interpolate values using a prism.
  13121. @end table
  13122. @end table
  13123. @subsection Commands
  13124. This filter supports the @code{interp} option as @ref{commands}.
  13125. @section lumakey
  13126. Turn certain luma values into transparency.
  13127. The filter accepts the following options:
  13128. @table @option
  13129. @item threshold
  13130. Set the luma which will be used as base for transparency.
  13131. Default value is @code{0}.
  13132. @item tolerance
  13133. Set the range of luma values to be keyed out.
  13134. Default value is @code{0.01}.
  13135. @item softness
  13136. Set the range of softness. Default value is @code{0}.
  13137. Use this to control gradual transition from zero to full transparency.
  13138. @end table
  13139. @subsection Commands
  13140. This filter supports same @ref{commands} as options.
  13141. The command accepts the same syntax of the corresponding option.
  13142. If the specified expression is not valid, it is kept at its current
  13143. value.
  13144. @section lut, lutrgb, lutyuv
  13145. Compute a look-up table for binding each pixel component input value
  13146. to an output value, and apply it to the input video.
  13147. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  13148. to an RGB input video.
  13149. These filters accept the following parameters:
  13150. @table @option
  13151. @item c0
  13152. set first pixel component expression
  13153. @item c1
  13154. set second pixel component expression
  13155. @item c2
  13156. set third pixel component expression
  13157. @item c3
  13158. set fourth pixel component expression, corresponds to the alpha component
  13159. @item r
  13160. set red component expression
  13161. @item g
  13162. set green component expression
  13163. @item b
  13164. set blue component expression
  13165. @item a
  13166. alpha component expression
  13167. @item y
  13168. set Y/luma component expression
  13169. @item u
  13170. set U/Cb component expression
  13171. @item v
  13172. set V/Cr component expression
  13173. @end table
  13174. Each of them specifies the expression to use for computing the lookup table for
  13175. the corresponding pixel component values.
  13176. The exact component associated to each of the @var{c*} options depends on the
  13177. format in input.
  13178. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  13179. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  13180. The expressions can contain the following constants and functions:
  13181. @table @option
  13182. @item w
  13183. @item h
  13184. The input width and height.
  13185. @item val
  13186. The input value for the pixel component.
  13187. @item clipval
  13188. The input value, clipped to the @var{minval}-@var{maxval} range.
  13189. @item maxval
  13190. The maximum value for the pixel component.
  13191. @item minval
  13192. The minimum value for the pixel component.
  13193. @item negval
  13194. The negated value for the pixel component value, clipped to the
  13195. @var{minval}-@var{maxval} range; it corresponds to the expression
  13196. "maxval-clipval+minval".
  13197. @item clip(val)
  13198. The computed value in @var{val}, clipped to the
  13199. @var{minval}-@var{maxval} range.
  13200. @item gammaval(gamma)
  13201. The computed gamma correction value of the pixel component value,
  13202. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  13203. expression
  13204. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  13205. @end table
  13206. All expressions default to "clipval".
  13207. @subsection Commands
  13208. This filter supports same @ref{commands} as options.
  13209. @subsection Examples
  13210. @itemize
  13211. @item
  13212. Negate input video:
  13213. @example
  13214. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  13215. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  13216. @end example
  13217. The above is the same as:
  13218. @example
  13219. lutrgb="r=negval:g=negval:b=negval"
  13220. lutyuv="y=negval:u=negval:v=negval"
  13221. @end example
  13222. @item
  13223. Negate luma:
  13224. @example
  13225. lutyuv=y=negval
  13226. @end example
  13227. @item
  13228. Remove chroma components, turning the video into a graytone image:
  13229. @example
  13230. lutyuv="u=128:v=128"
  13231. @end example
  13232. @item
  13233. Apply a luma burning effect:
  13234. @example
  13235. lutyuv="y=2*val"
  13236. @end example
  13237. @item
  13238. Remove green and blue components:
  13239. @example
  13240. lutrgb="g=0:b=0"
  13241. @end example
  13242. @item
  13243. Set a constant alpha channel value on input:
  13244. @example
  13245. format=rgba,lutrgb=a="maxval-minval/2"
  13246. @end example
  13247. @item
  13248. Correct luma gamma by a factor of 0.5:
  13249. @example
  13250. lutyuv=y=gammaval(0.5)
  13251. @end example
  13252. @item
  13253. Discard least significant bits of luma:
  13254. @example
  13255. lutyuv=y='bitand(val, 128+64+32)'
  13256. @end example
  13257. @item
  13258. Technicolor like effect:
  13259. @example
  13260. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  13261. @end example
  13262. @end itemize
  13263. @section lut2, tlut2
  13264. The @code{lut2} filter takes two input streams and outputs one
  13265. stream.
  13266. The @code{tlut2} (time lut2) filter takes two consecutive frames
  13267. from one single stream.
  13268. This filter accepts the following parameters:
  13269. @table @option
  13270. @item c0
  13271. set first pixel component expression
  13272. @item c1
  13273. set second pixel component expression
  13274. @item c2
  13275. set third pixel component expression
  13276. @item c3
  13277. set fourth pixel component expression, corresponds to the alpha component
  13278. @item d
  13279. set output bit depth, only available for @code{lut2} filter. By default is 0,
  13280. which means bit depth is automatically picked from first input format.
  13281. @end table
  13282. The @code{lut2} filter also supports the @ref{framesync} options.
  13283. Each of them specifies the expression to use for computing the lookup table for
  13284. the corresponding pixel component values.
  13285. The exact component associated to each of the @var{c*} options depends on the
  13286. format in inputs.
  13287. The expressions can contain the following constants:
  13288. @table @option
  13289. @item w
  13290. @item h
  13291. The input width and height.
  13292. @item x
  13293. The first input value for the pixel component.
  13294. @item y
  13295. The second input value for the pixel component.
  13296. @item bdx
  13297. The first input video bit depth.
  13298. @item bdy
  13299. The second input video bit depth.
  13300. @end table
  13301. All expressions default to "x".
  13302. @subsection Commands
  13303. This filter supports the all above options as @ref{commands} except option @code{d}.
  13304. @subsection Examples
  13305. @itemize
  13306. @item
  13307. Highlight differences between two RGB video streams:
  13308. @example
  13309. 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)'
  13310. @end example
  13311. @item
  13312. Highlight differences between two YUV video streams:
  13313. @example
  13314. 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)'
  13315. @end example
  13316. @item
  13317. Show max difference between two video streams:
  13318. @example
  13319. 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)))'
  13320. @end example
  13321. @end itemize
  13322. @section maskedclamp
  13323. Clamp the first input stream with the second input and third input stream.
  13324. Returns the value of first stream to be between second input
  13325. stream - @code{undershoot} and third input stream + @code{overshoot}.
  13326. This filter accepts the following options:
  13327. @table @option
  13328. @item undershoot
  13329. Default value is @code{0}.
  13330. @item overshoot
  13331. Default value is @code{0}.
  13332. @item planes
  13333. Set which planes will be processed as bitmap, unprocessed planes will be
  13334. copied from first stream.
  13335. By default value 0xf, all planes will be processed.
  13336. @end table
  13337. @subsection Commands
  13338. This filter supports the all above options as @ref{commands}.
  13339. @section maskedmax
  13340. Merge the second and third input stream into output stream using absolute differences
  13341. between second input stream and first input stream and absolute difference between
  13342. third input stream and first input stream. The picked value will be from second input
  13343. stream if second absolute difference is greater than first one or from third input stream
  13344. otherwise.
  13345. This filter accepts the following options:
  13346. @table @option
  13347. @item planes
  13348. Set which planes will be processed as bitmap, unprocessed planes will be
  13349. copied from first stream.
  13350. By default value 0xf, all planes will be processed.
  13351. @end table
  13352. @subsection Commands
  13353. This filter supports the all above options as @ref{commands}.
  13354. @section maskedmerge
  13355. Merge the first input stream with the second input stream using per pixel
  13356. weights in the third input stream.
  13357. A value of 0 in the third stream pixel component means that pixel component
  13358. from first stream is returned unchanged, while maximum value (eg. 255 for
  13359. 8-bit videos) means that pixel component from second stream is returned
  13360. unchanged. Intermediate values define the amount of merging between both
  13361. input stream's pixel components.
  13362. This filter accepts the following options:
  13363. @table @option
  13364. @item planes
  13365. Set which planes will be processed as bitmap, unprocessed planes will be
  13366. copied from first stream.
  13367. By default value 0xf, all planes will be processed.
  13368. @end table
  13369. @subsection Commands
  13370. This filter supports the all above options as @ref{commands}.
  13371. @section maskedmin
  13372. Merge the second and third input stream into output stream using absolute differences
  13373. between second input stream and first input stream and absolute difference between
  13374. third input stream and first input stream. The picked value will be from second input
  13375. stream if second absolute difference is less than first one or from third input stream
  13376. otherwise.
  13377. This filter accepts the following options:
  13378. @table @option
  13379. @item planes
  13380. Set which planes will be processed as bitmap, unprocessed planes will be
  13381. copied from first stream.
  13382. By default value 0xf, all planes will be processed.
  13383. @end table
  13384. @subsection Commands
  13385. This filter supports the all above options as @ref{commands}.
  13386. @section maskedthreshold
  13387. Pick pixels comparing absolute difference of two video streams with fixed
  13388. threshold.
  13389. If absolute difference between pixel component of first and second video
  13390. stream is equal or lower than user supplied threshold than pixel component
  13391. from first video stream is picked, otherwise pixel component from second
  13392. video stream is picked.
  13393. This filter accepts the following options:
  13394. @table @option
  13395. @item threshold
  13396. Set threshold used when picking pixels from absolute difference from two input
  13397. video streams.
  13398. @item planes
  13399. Set which planes will be processed as bitmap, unprocessed planes will be
  13400. copied from second stream.
  13401. By default value 0xf, all planes will be processed.
  13402. @item mode
  13403. Set mode of filter operation. Can be @code{abs} or @code{diff}.
  13404. Default is @code{abs}.
  13405. @end table
  13406. @subsection Commands
  13407. This filter supports the all above options as @ref{commands}.
  13408. @section maskfun
  13409. Create mask from input video.
  13410. For example it is useful to create motion masks after @code{tblend} filter.
  13411. This filter accepts the following options:
  13412. @table @option
  13413. @item low
  13414. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  13415. @item high
  13416. Set high threshold. Any pixel component higher than this value will be set to max value
  13417. allowed for current pixel format.
  13418. @item planes
  13419. Set planes to filter, by default all available planes are filtered.
  13420. @item fill
  13421. Fill all frame pixels with this value.
  13422. @item sum
  13423. Set max average pixel value for frame. If sum of all pixel components is higher that this
  13424. average, output frame will be completely filled with value set by @var{fill} option.
  13425. Typically useful for scene changes when used in combination with @code{tblend} filter.
  13426. @end table
  13427. @subsection Commands
  13428. This filter supports the all above options as @ref{commands}.
  13429. @section mcdeint
  13430. Apply motion-compensation deinterlacing.
  13431. It needs one field per frame as input and must thus be used together
  13432. with yadif=1/3 or equivalent.
  13433. This filter accepts the following options:
  13434. @table @option
  13435. @item mode
  13436. Set the deinterlacing mode.
  13437. It accepts one of the following values:
  13438. @table @samp
  13439. @item fast
  13440. @item medium
  13441. @item slow
  13442. use iterative motion estimation
  13443. @item extra_slow
  13444. like @samp{slow}, but use multiple reference frames.
  13445. @end table
  13446. Default value is @samp{fast}.
  13447. @item parity
  13448. Set the picture field parity assumed for the input video. It must be
  13449. one of the following values:
  13450. @table @samp
  13451. @item 0, tff
  13452. assume top field first
  13453. @item 1, bff
  13454. assume bottom field first
  13455. @end table
  13456. Default value is @samp{bff}.
  13457. @item qp
  13458. Set per-block quantization parameter (QP) used by the internal
  13459. encoder.
  13460. Higher values should result in a smoother motion vector field but less
  13461. optimal individual vectors. Default value is 1.
  13462. @end table
  13463. @section median
  13464. Pick median pixel from certain rectangle defined by radius.
  13465. This filter accepts the following options:
  13466. @table @option
  13467. @item radius
  13468. Set horizontal radius size. Default value is @code{1}.
  13469. Allowed range is integer from 1 to 127.
  13470. @item planes
  13471. Set which planes to process. Default is @code{15}, which is all available planes.
  13472. @item radiusV
  13473. Set vertical radius size. Default value is @code{0}.
  13474. Allowed range is integer from 0 to 127.
  13475. If it is 0, value will be picked from horizontal @code{radius} option.
  13476. @item percentile
  13477. Set median percentile. Default value is @code{0.5}.
  13478. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  13479. minimum values, and @code{1} maximum values.
  13480. @end table
  13481. @subsection Commands
  13482. This filter supports same @ref{commands} as options.
  13483. The command accepts the same syntax of the corresponding option.
  13484. If the specified expression is not valid, it is kept at its current
  13485. value.
  13486. @section mergeplanes
  13487. Merge color channel components from several video streams.
  13488. The filter accepts up to 4 input streams, and merge selected input
  13489. planes to the output video.
  13490. This filter accepts the following options:
  13491. @table @option
  13492. @item mapping
  13493. Set input to output plane mapping. Default is @code{0}.
  13494. The mappings is specified as a bitmap. It should be specified as a
  13495. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  13496. mapping for the first plane of the output stream. 'A' sets the number of
  13497. the input stream to use (from 0 to 3), and 'a' the plane number of the
  13498. corresponding input to use (from 0 to 3). The rest of the mappings is
  13499. similar, 'Bb' describes the mapping for the output stream second
  13500. plane, 'Cc' describes the mapping for the output stream third plane and
  13501. 'Dd' describes the mapping for the output stream fourth plane.
  13502. @item format
  13503. Set output pixel format. Default is @code{yuva444p}.
  13504. @item map0s
  13505. @item map1s
  13506. @item map2s
  13507. @item map3s
  13508. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  13509. @item map0p
  13510. @item map1p
  13511. @item map2p
  13512. @item map3p
  13513. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  13514. @end table
  13515. @subsection Examples
  13516. @itemize
  13517. @item
  13518. Merge three gray video streams of same width and height into single video stream:
  13519. @example
  13520. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  13521. @end example
  13522. @item
  13523. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  13524. @example
  13525. [a0][a1]mergeplanes=0x00010210:yuva444p
  13526. @end example
  13527. @item
  13528. Swap Y and A plane in yuva444p stream:
  13529. @example
  13530. format=yuva444p,mergeplanes=0x03010200:yuva444p
  13531. @end example
  13532. @item
  13533. Swap U and V plane in yuv420p stream:
  13534. @example
  13535. format=yuv420p,mergeplanes=0x000201:yuv420p
  13536. @end example
  13537. @item
  13538. Cast a rgb24 clip to yuv444p:
  13539. @example
  13540. format=rgb24,mergeplanes=0x000102:yuv444p
  13541. @end example
  13542. @end itemize
  13543. @section mestimate
  13544. Estimate and export motion vectors using block matching algorithms.
  13545. Motion vectors are stored in frame side data to be used by other filters.
  13546. This filter accepts the following options:
  13547. @table @option
  13548. @item method
  13549. Specify the motion estimation method. Accepts one of the following values:
  13550. @table @samp
  13551. @item esa
  13552. Exhaustive search algorithm.
  13553. @item tss
  13554. Three step search algorithm.
  13555. @item tdls
  13556. Two dimensional logarithmic search algorithm.
  13557. @item ntss
  13558. New three step search algorithm.
  13559. @item fss
  13560. Four step search algorithm.
  13561. @item ds
  13562. Diamond search algorithm.
  13563. @item hexbs
  13564. Hexagon-based search algorithm.
  13565. @item epzs
  13566. Enhanced predictive zonal search algorithm.
  13567. @item umh
  13568. Uneven multi-hexagon search algorithm.
  13569. @end table
  13570. Default value is @samp{esa}.
  13571. @item mb_size
  13572. Macroblock size. Default @code{16}.
  13573. @item search_param
  13574. Search parameter. Default @code{7}.
  13575. @end table
  13576. @section midequalizer
  13577. Apply Midway Image Equalization effect using two video streams.
  13578. Midway Image Equalization adjusts a pair of images to have the same
  13579. histogram, while maintaining their dynamics as much as possible. It's
  13580. useful for e.g. matching exposures from a pair of stereo cameras.
  13581. This filter has two inputs and one output, which must be of same pixel format, but
  13582. may be of different sizes. The output of filter is first input adjusted with
  13583. midway histogram of both inputs.
  13584. This filter accepts the following option:
  13585. @table @option
  13586. @item planes
  13587. Set which planes to process. Default is @code{15}, which is all available planes.
  13588. @end table
  13589. @section minterpolate
  13590. Convert the video to specified frame rate using motion interpolation.
  13591. This filter accepts the following options:
  13592. @table @option
  13593. @item fps
  13594. 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}.
  13595. @item mi_mode
  13596. Motion interpolation mode. Following values are accepted:
  13597. @table @samp
  13598. @item dup
  13599. Duplicate previous or next frame for interpolating new ones.
  13600. @item blend
  13601. Blend source frames. Interpolated frame is mean of previous and next frames.
  13602. @item mci
  13603. Motion compensated interpolation. Following options are effective when this mode is selected:
  13604. @table @samp
  13605. @item mc_mode
  13606. Motion compensation mode. Following values are accepted:
  13607. @table @samp
  13608. @item obmc
  13609. Overlapped block motion compensation.
  13610. @item aobmc
  13611. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  13612. @end table
  13613. Default mode is @samp{obmc}.
  13614. @item me_mode
  13615. Motion estimation mode. Following values are accepted:
  13616. @table @samp
  13617. @item bidir
  13618. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  13619. @item bilat
  13620. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  13621. @end table
  13622. Default mode is @samp{bilat}.
  13623. @item me
  13624. The algorithm to be used for motion estimation. Following values are accepted:
  13625. @table @samp
  13626. @item esa
  13627. Exhaustive search algorithm.
  13628. @item tss
  13629. Three step search algorithm.
  13630. @item tdls
  13631. Two dimensional logarithmic search algorithm.
  13632. @item ntss
  13633. New three step search algorithm.
  13634. @item fss
  13635. Four step search algorithm.
  13636. @item ds
  13637. Diamond search algorithm.
  13638. @item hexbs
  13639. Hexagon-based search algorithm.
  13640. @item epzs
  13641. Enhanced predictive zonal search algorithm.
  13642. @item umh
  13643. Uneven multi-hexagon search algorithm.
  13644. @end table
  13645. Default algorithm is @samp{epzs}.
  13646. @item mb_size
  13647. Macroblock size. Default @code{16}.
  13648. @item search_param
  13649. Motion estimation search parameter. Default @code{32}.
  13650. @item vsbmc
  13651. 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).
  13652. @end table
  13653. @end table
  13654. @item scd
  13655. 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:
  13656. @table @samp
  13657. @item none
  13658. Disable scene change detection.
  13659. @item fdiff
  13660. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  13661. @end table
  13662. Default method is @samp{fdiff}.
  13663. @item scd_threshold
  13664. Scene change detection threshold. Default is @code{10.}.
  13665. @end table
  13666. @section mix
  13667. Mix several video input streams into one video stream.
  13668. A description of the accepted options follows.
  13669. @table @option
  13670. @item inputs
  13671. The number of inputs. If unspecified, it defaults to 2.
  13672. @item weights
  13673. Specify weight of each input video stream as sequence.
  13674. Each weight is separated by space. If number of weights
  13675. is smaller than number of @var{frames} last specified
  13676. weight will be used for all remaining unset weights.
  13677. @item scale
  13678. Specify scale, if it is set it will be multiplied with sum
  13679. of each weight multiplied with pixel values to give final destination
  13680. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13681. @item planes
  13682. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  13683. @item duration
  13684. Specify how end of stream is determined.
  13685. @table @samp
  13686. @item longest
  13687. The duration of the longest input. (default)
  13688. @item shortest
  13689. The duration of the shortest input.
  13690. @item first
  13691. The duration of the first input.
  13692. @end table
  13693. @end table
  13694. @subsection Commands
  13695. This filter supports the following commands:
  13696. @table @option
  13697. @item weights
  13698. @item scale
  13699. @item planes
  13700. Syntax is same as option with same name.
  13701. @end table
  13702. @section monochrome
  13703. Convert video to gray using custom color filter.
  13704. A description of the accepted options follows.
  13705. @table @option
  13706. @item cb
  13707. Set the chroma blue spot. Allowed range is from -1 to 1.
  13708. Default value is 0.
  13709. @item cr
  13710. Set the chroma red spot. Allowed range is from -1 to 1.
  13711. Default value is 0.
  13712. @item size
  13713. Set the color filter size. Allowed range is from .1 to 10.
  13714. Default value is 1.
  13715. @item high
  13716. Set the highlights strength. Allowed range is from 0 to 1.
  13717. Default value is 0.
  13718. @end table
  13719. @subsection Commands
  13720. This filter supports the all above options as @ref{commands}.
  13721. @section morpho
  13722. This filter allows to apply main morphological grayscale transforms,
  13723. erode and dilate with arbitrary structures set in second input stream.
  13724. Unlike naive implementation and much slower performance in @ref{erosion}
  13725. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  13726. should be used instead.
  13727. A description of accepted options follows,
  13728. @table @option
  13729. @item mode
  13730. Set morphological transform to apply, can be:
  13731. @table @samp
  13732. @item erode
  13733. @item dilate
  13734. @item open
  13735. @item close
  13736. @item gradient
  13737. @item tophat
  13738. @item blackhat
  13739. @end table
  13740. Default is @code{erode}.
  13741. @item planes
  13742. Set planes to filter, by default all planes except alpha are filtered.
  13743. @item structure
  13744. Set which structure video frames will be processed from second input stream,
  13745. can be @var{first} or @var{all}. Default is @var{all}.
  13746. @end table
  13747. The @code{morpho} filter also supports the @ref{framesync} options.
  13748. @subsection Commands
  13749. This filter supports same @ref{commands} as options.
  13750. @section mpdecimate
  13751. Drop frames that do not differ greatly from the previous frame in
  13752. order to reduce frame rate.
  13753. The main use of this filter is for very-low-bitrate encoding
  13754. (e.g. streaming over dialup modem), but it could in theory be used for
  13755. fixing movies that were inverse-telecined incorrectly.
  13756. A description of the accepted options follows.
  13757. @table @option
  13758. @item max
  13759. Set the maximum number of consecutive frames which can be dropped (if
  13760. positive), or the minimum interval between dropped frames (if
  13761. negative). If the value is 0, the frame is dropped disregarding the
  13762. number of previous sequentially dropped frames.
  13763. Default value is 0.
  13764. @item keep
  13765. Set the maximum number of consecutive similar frames to ignore before to start dropping them.
  13766. If the value is 0, the frame is dropped disregarding the
  13767. number of previous sequentially similar frames.
  13768. Default value is 0.
  13769. @item hi
  13770. @item lo
  13771. @item frac
  13772. Set the dropping threshold values.
  13773. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  13774. represent actual pixel value differences, so a threshold of 64
  13775. corresponds to 1 unit of difference for each pixel, or the same spread
  13776. out differently over the block.
  13777. A frame is a candidate for dropping if no 8x8 blocks differ by more
  13778. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  13779. meaning the whole image) differ by more than a threshold of @option{lo}.
  13780. Default value for @option{hi} is 64*12, default value for @option{lo} is
  13781. 64*5, and default value for @option{frac} is 0.33.
  13782. @end table
  13783. @section msad
  13784. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  13785. This filter takes two input videos.
  13786. Both input videos must have the same resolution and pixel format for
  13787. this filter to work correctly. Also it assumes that both inputs
  13788. have the same number of frames, which are compared one by one.
  13789. The obtained per component, average, min and max MSAD is printed through
  13790. the logging system.
  13791. The filter stores the calculated MSAD of each frame in frame metadata.
  13792. This filter also supports the @ref{framesync} options.
  13793. In the below example the input file @file{main.mpg} being processed is compared
  13794. with the reference file @file{ref.mpg}.
  13795. @example
  13796. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  13797. @end example
  13798. @section multiply
  13799. Multiply first video stream pixels values with second video stream pixels values.
  13800. The filter accepts the following options:
  13801. @table @option
  13802. @item scale
  13803. Set the scale applied to second video stream. By default is @code{1}.
  13804. Allowed range is from @code{0} to @code{9}.
  13805. @item offset
  13806. Set the offset applied to second video stream. By default is @code{0.5}.
  13807. Allowed range is from @code{-1} to @code{1}.
  13808. @item planes
  13809. Specify planes from input video stream that will be processed.
  13810. By default all planes are processed.
  13811. @end table
  13812. @subsection Commands
  13813. This filter supports same @ref{commands} as options.
  13814. @section negate
  13815. Negate (invert) the input video.
  13816. It accepts the following option:
  13817. @table @option
  13818. @item components
  13819. Set components to negate.
  13820. Available values for components are:
  13821. @table @samp
  13822. @item y
  13823. @item u
  13824. @item v
  13825. @item a
  13826. @item r
  13827. @item g
  13828. @item b
  13829. @end table
  13830. @item negate_alpha
  13831. With value 1, it negates the alpha component, if present. Default value is 0.
  13832. @end table
  13833. @subsection Commands
  13834. This filter supports same @ref{commands} as options.
  13835. @anchor{nlmeans}
  13836. @section nlmeans
  13837. Denoise frames using Non-Local Means algorithm.
  13838. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13839. context similarity is defined by comparing their surrounding patches of size
  13840. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13841. around the pixel.
  13842. Note that the research area defines centers for patches, which means some
  13843. patches will be made of pixels outside that research area.
  13844. The filter accepts the following options.
  13845. @table @option
  13846. @item s
  13847. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13848. @item p
  13849. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13850. @item pc
  13851. Same as @option{p} but for chroma planes.
  13852. The default value is @var{0} and means automatic.
  13853. @item r
  13854. Set research size. Default is 15. Must be odd number in range [0, 99].
  13855. @item rc
  13856. Same as @option{r} but for chroma planes.
  13857. The default value is @var{0} and means automatic.
  13858. @end table
  13859. @section nnedi
  13860. Deinterlace video using neural network edge directed interpolation.
  13861. This filter accepts the following options:
  13862. @table @option
  13863. @item weights
  13864. Mandatory option, without binary file filter can not work.
  13865. Currently file can be found here:
  13866. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13867. @item deint
  13868. Set which frames to deinterlace, by default it is @code{all}.
  13869. Can be @code{all} or @code{interlaced}.
  13870. @item field
  13871. Set mode of operation.
  13872. Can be one of the following:
  13873. @table @samp
  13874. @item af
  13875. Use frame flags, both fields.
  13876. @item a
  13877. Use frame flags, single field.
  13878. @item t
  13879. Use top field only.
  13880. @item b
  13881. Use bottom field only.
  13882. @item tf
  13883. Use both fields, top first.
  13884. @item bf
  13885. Use both fields, bottom first.
  13886. @end table
  13887. @item planes
  13888. Set which planes to process, by default filter process all frames.
  13889. @item nsize
  13890. Set size of local neighborhood around each pixel, used by the predictor neural
  13891. network.
  13892. Can be one of the following:
  13893. @table @samp
  13894. @item s8x6
  13895. @item s16x6
  13896. @item s32x6
  13897. @item s48x6
  13898. @item s8x4
  13899. @item s16x4
  13900. @item s32x4
  13901. @end table
  13902. @item nns
  13903. Set the number of neurons in predictor neural network.
  13904. Can be one of the following:
  13905. @table @samp
  13906. @item n16
  13907. @item n32
  13908. @item n64
  13909. @item n128
  13910. @item n256
  13911. @end table
  13912. @item qual
  13913. Controls the number of different neural network predictions that are blended
  13914. together to compute the final output value. Can be @code{fast}, default or
  13915. @code{slow}.
  13916. @item etype
  13917. Set which set of weights to use in the predictor.
  13918. Can be one of the following:
  13919. @table @samp
  13920. @item a, abs
  13921. weights trained to minimize absolute error
  13922. @item s, mse
  13923. weights trained to minimize squared error
  13924. @end table
  13925. @item pscrn
  13926. Controls whether or not the prescreener neural network is used to decide
  13927. which pixels should be processed by the predictor neural network and which
  13928. can be handled by simple cubic interpolation.
  13929. The prescreener is trained to know whether cubic interpolation will be
  13930. sufficient for a pixel or whether it should be predicted by the predictor nn.
  13931. The computational complexity of the prescreener nn is much less than that of
  13932. the predictor nn. Since most pixels can be handled by cubic interpolation,
  13933. using the prescreener generally results in much faster processing.
  13934. The prescreener is pretty accurate, so the difference between using it and not
  13935. using it is almost always unnoticeable.
  13936. Can be one of the following:
  13937. @table @samp
  13938. @item none
  13939. @item original
  13940. @item new
  13941. @item new2
  13942. @item new3
  13943. @end table
  13944. Default is @code{new}.
  13945. @end table
  13946. @subsection Commands
  13947. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  13948. @section noformat
  13949. Force libavfilter not to use any of the specified pixel formats for the
  13950. input to the next filter.
  13951. It accepts the following parameters:
  13952. @table @option
  13953. @item pix_fmts
  13954. A '|'-separated list of pixel format names, such as
  13955. pix_fmts=yuv420p|monow|rgb24".
  13956. @end table
  13957. @subsection Examples
  13958. @itemize
  13959. @item
  13960. Force libavfilter to use a format different from @var{yuv420p} for the
  13961. input to the vflip filter:
  13962. @example
  13963. noformat=pix_fmts=yuv420p,vflip
  13964. @end example
  13965. @item
  13966. Convert the input video to any of the formats not contained in the list:
  13967. @example
  13968. noformat=yuv420p|yuv444p|yuv410p
  13969. @end example
  13970. @end itemize
  13971. @section noise
  13972. Add noise on video input frame.
  13973. The filter accepts the following options:
  13974. @table @option
  13975. @item all_seed
  13976. @item c0_seed
  13977. @item c1_seed
  13978. @item c2_seed
  13979. @item c3_seed
  13980. Set noise seed for specific pixel component or all pixel components in case
  13981. of @var{all_seed}. Default value is @code{123457}.
  13982. @item all_strength, alls
  13983. @item c0_strength, c0s
  13984. @item c1_strength, c1s
  13985. @item c2_strength, c2s
  13986. @item c3_strength, c3s
  13987. Set noise strength for specific pixel component or all pixel components in case
  13988. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  13989. @item all_flags, allf
  13990. @item c0_flags, c0f
  13991. @item c1_flags, c1f
  13992. @item c2_flags, c2f
  13993. @item c3_flags, c3f
  13994. Set pixel component flags or set flags for all components if @var{all_flags}.
  13995. Available values for component flags are:
  13996. @table @samp
  13997. @item a
  13998. averaged temporal noise (smoother)
  13999. @item p
  14000. mix random noise with a (semi)regular pattern
  14001. @item t
  14002. temporal noise (noise pattern changes between frames)
  14003. @item u
  14004. uniform noise (gaussian otherwise)
  14005. @end table
  14006. @end table
  14007. @subsection Examples
  14008. Add temporal and uniform noise to input video:
  14009. @example
  14010. noise=alls=20:allf=t+u
  14011. @end example
  14012. @section normalize
  14013. Normalize RGB video (aka histogram stretching, contrast stretching).
  14014. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  14015. For each channel of each frame, the filter computes the input range and maps
  14016. it linearly to the user-specified output range. The output range defaults
  14017. to the full dynamic range from pure black to pure white.
  14018. Temporal smoothing can be used on the input range to reduce flickering (rapid
  14019. changes in brightness) caused when small dark or bright objects enter or leave
  14020. the scene. This is similar to the auto-exposure (automatic gain control) on a
  14021. video camera, and, like a video camera, it may cause a period of over- or
  14022. under-exposure of the video.
  14023. The R,G,B channels can be normalized independently, which may cause some
  14024. color shifting, or linked together as a single channel, which prevents
  14025. color shifting. Linked normalization preserves hue. Independent normalization
  14026. does not, so it can be used to remove some color casts. Independent and linked
  14027. normalization can be combined in any ratio.
  14028. The normalize filter accepts the following options:
  14029. @table @option
  14030. @item blackpt
  14031. @item whitept
  14032. Colors which define the output range. The minimum input value is mapped to
  14033. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  14034. The defaults are black and white respectively. Specifying white for
  14035. @var{blackpt} and black for @var{whitept} will give color-inverted,
  14036. normalized video. Shades of grey can be used to reduce the dynamic range
  14037. (contrast). Specifying saturated colors here can create some interesting
  14038. effects.
  14039. @item smoothing
  14040. The number of previous frames to use for temporal smoothing. The input range
  14041. of each channel is smoothed using a rolling average over the current frame
  14042. and the @var{smoothing} previous frames. The default is 0 (no temporal
  14043. smoothing).
  14044. @item independence
  14045. Controls the ratio of independent (color shifting) channel normalization to
  14046. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  14047. independent. Defaults to 1.0 (fully independent).
  14048. @item strength
  14049. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  14050. expensive no-op. Defaults to 1.0 (full strength).
  14051. @end table
  14052. @subsection Commands
  14053. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  14054. The command accepts the same syntax of the corresponding option.
  14055. If the specified expression is not valid, it is kept at its current
  14056. value.
  14057. @subsection Examples
  14058. Stretch video contrast to use the full dynamic range, with no temporal
  14059. smoothing; may flicker depending on the source content:
  14060. @example
  14061. normalize=blackpt=black:whitept=white:smoothing=0
  14062. @end example
  14063. As above, but with 50 frames of temporal smoothing; flicker should be
  14064. reduced, depending on the source content:
  14065. @example
  14066. normalize=blackpt=black:whitept=white:smoothing=50
  14067. @end example
  14068. As above, but with hue-preserving linked channel normalization:
  14069. @example
  14070. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  14071. @end example
  14072. As above, but with half strength:
  14073. @example
  14074. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  14075. @end example
  14076. Map the darkest input color to red, the brightest input color to cyan:
  14077. @example
  14078. normalize=blackpt=red:whitept=cyan
  14079. @end example
  14080. @section null
  14081. Pass the video source unchanged to the output.
  14082. @section ocr
  14083. Optical Character Recognition
  14084. This filter uses Tesseract for optical character recognition. To enable
  14085. compilation of this filter, you need to configure FFmpeg with
  14086. @code{--enable-libtesseract}.
  14087. It accepts the following options:
  14088. @table @option
  14089. @item datapath
  14090. Set datapath to tesseract data. Default is to use whatever was
  14091. set at installation.
  14092. @item language
  14093. Set language, default is "eng".
  14094. @item whitelist
  14095. Set character whitelist.
  14096. @item blacklist
  14097. Set character blacklist.
  14098. @end table
  14099. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  14100. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  14101. @section ocv
  14102. Apply a video transform using libopencv.
  14103. To enable this filter, install the libopencv library and headers and
  14104. configure FFmpeg with @code{--enable-libopencv}.
  14105. It accepts the following parameters:
  14106. @table @option
  14107. @item filter_name
  14108. The name of the libopencv filter to apply.
  14109. @item filter_params
  14110. The parameters to pass to the libopencv filter. If not specified, the default
  14111. values are assumed.
  14112. @end table
  14113. Refer to the official libopencv documentation for more precise
  14114. information:
  14115. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  14116. Several libopencv filters are supported; see the following subsections.
  14117. @anchor{dilate}
  14118. @subsection dilate
  14119. Dilate an image by using a specific structuring element.
  14120. It corresponds to the libopencv function @code{cvDilate}.
  14121. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  14122. @var{struct_el} represents a structuring element, and has the syntax:
  14123. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  14124. @var{cols} and @var{rows} represent the number of columns and rows of
  14125. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  14126. point, and @var{shape} the shape for the structuring element. @var{shape}
  14127. must be "rect", "cross", "ellipse", or "custom".
  14128. If the value for @var{shape} is "custom", it must be followed by a
  14129. string of the form "=@var{filename}". The file with name
  14130. @var{filename} is assumed to represent a binary image, with each
  14131. printable character corresponding to a bright pixel. When a custom
  14132. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  14133. or columns and rows of the read file are assumed instead.
  14134. The default value for @var{struct_el} is "3x3+0x0/rect".
  14135. @var{nb_iterations} specifies the number of times the transform is
  14136. applied to the image, and defaults to 1.
  14137. Some examples:
  14138. @example
  14139. # Use the default values
  14140. ocv=dilate
  14141. # Dilate using a structuring element with a 5x5 cross, iterating two times
  14142. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  14143. # Read the shape from the file diamond.shape, iterating two times.
  14144. # The file diamond.shape may contain a pattern of characters like this
  14145. # *
  14146. # ***
  14147. # *****
  14148. # ***
  14149. # *
  14150. # The specified columns and rows are ignored
  14151. # but the anchor point coordinates are not
  14152. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  14153. @end example
  14154. @subsection erode
  14155. Erode an image by using a specific structuring element.
  14156. It corresponds to the libopencv function @code{cvErode}.
  14157. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  14158. with the same syntax and semantics as the @ref{dilate} filter.
  14159. @subsection smooth
  14160. Smooth the input video.
  14161. The filter takes the following parameters:
  14162. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  14163. @var{type} is the type of smooth filter to apply, and must be one of
  14164. the following values: "blur", "blur_no_scale", "median", "gaussian",
  14165. or "bilateral". The default value is "gaussian".
  14166. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  14167. depends on the smooth type. @var{param1} and
  14168. @var{param2} accept integer positive values or 0. @var{param3} and
  14169. @var{param4} accept floating point values.
  14170. The default value for @var{param1} is 3. The default value for the
  14171. other parameters is 0.
  14172. These parameters correspond to the parameters assigned to the
  14173. libopencv function @code{cvSmooth}.
  14174. @section oscilloscope
  14175. 2D Video Oscilloscope.
  14176. Useful to measure spatial impulse, step responses, chroma delays, etc.
  14177. It accepts the following parameters:
  14178. @table @option
  14179. @item x
  14180. Set scope center x position.
  14181. @item y
  14182. Set scope center y position.
  14183. @item s
  14184. Set scope size, relative to frame diagonal.
  14185. @item t
  14186. Set scope tilt/rotation.
  14187. @item o
  14188. Set trace opacity.
  14189. @item tx
  14190. Set trace center x position.
  14191. @item ty
  14192. Set trace center y position.
  14193. @item tw
  14194. Set trace width, relative to width of frame.
  14195. @item th
  14196. Set trace height, relative to height of frame.
  14197. @item c
  14198. Set which components to trace. By default it traces first three components.
  14199. @item g
  14200. Draw trace grid. By default is enabled.
  14201. @item st
  14202. Draw some statistics. By default is enabled.
  14203. @item sc
  14204. Draw scope. By default is enabled.
  14205. @end table
  14206. @subsection Commands
  14207. This filter supports same @ref{commands} as options.
  14208. The command accepts the same syntax of the corresponding option.
  14209. If the specified expression is not valid, it is kept at its current
  14210. value.
  14211. @subsection Examples
  14212. @itemize
  14213. @item
  14214. Inspect full first row of video frame.
  14215. @example
  14216. oscilloscope=x=0.5:y=0:s=1
  14217. @end example
  14218. @item
  14219. Inspect full last row of video frame.
  14220. @example
  14221. oscilloscope=x=0.5:y=1:s=1
  14222. @end example
  14223. @item
  14224. Inspect full 5th line of video frame of height 1080.
  14225. @example
  14226. oscilloscope=x=0.5:y=5/1080:s=1
  14227. @end example
  14228. @item
  14229. Inspect full last column of video frame.
  14230. @example
  14231. oscilloscope=x=1:y=0.5:s=1:t=1
  14232. @end example
  14233. @end itemize
  14234. @anchor{overlay}
  14235. @section overlay
  14236. Overlay one video on top of another.
  14237. It takes two inputs and has one output. The first input is the "main"
  14238. video on which the second input is overlaid.
  14239. It accepts the following parameters:
  14240. A description of the accepted options follows.
  14241. @table @option
  14242. @item x
  14243. @item y
  14244. Set the expression for the x and y coordinates of the overlaid video
  14245. on the main video. Default value is "0" for both expressions. In case
  14246. the expression is invalid, it is set to a huge value (meaning that the
  14247. overlay will not be displayed within the output visible area).
  14248. @item eof_action
  14249. See @ref{framesync}.
  14250. @item eval
  14251. Set when the expressions for @option{x}, and @option{y} are evaluated.
  14252. It accepts the following values:
  14253. @table @samp
  14254. @item init
  14255. only evaluate expressions once during the filter initialization or
  14256. when a command is processed
  14257. @item frame
  14258. evaluate expressions for each incoming frame
  14259. @end table
  14260. Default value is @samp{frame}.
  14261. @item shortest
  14262. See @ref{framesync}.
  14263. @item format
  14264. Set the format for the output video.
  14265. It accepts the following values:
  14266. @table @samp
  14267. @item yuv420
  14268. force YUV 4:2:0 8-bit planar output
  14269. @item yuv420p10
  14270. force YUV 4:2:0 10-bit planar output
  14271. @item yuv422
  14272. force YUV 4:2:2 8-bit planar output
  14273. @item yuv422p10
  14274. force YUV 4:2:2 10-bit planar output
  14275. @item yuv444
  14276. force YUV 4:4:4 8-bit planar output
  14277. @item yuv444p10
  14278. force YUV 4:4:4 10-bit planar output
  14279. @item rgb
  14280. force RGB 8-bit packed output
  14281. @item gbrp
  14282. force RGB 8-bit planar output
  14283. @item auto
  14284. automatically pick format
  14285. @end table
  14286. Default value is @samp{yuv420}.
  14287. @item repeatlast
  14288. See @ref{framesync}.
  14289. @item alpha
  14290. Set format of alpha of the overlaid video, it can be @var{straight} or
  14291. @var{premultiplied}. Default is @var{straight}.
  14292. @end table
  14293. The @option{x}, and @option{y} expressions can contain the following
  14294. parameters.
  14295. @table @option
  14296. @item main_w, W
  14297. @item main_h, H
  14298. The main input width and height.
  14299. @item overlay_w, w
  14300. @item overlay_h, h
  14301. The overlay input width and height.
  14302. @item x
  14303. @item y
  14304. The computed values for @var{x} and @var{y}. They are evaluated for
  14305. each new frame.
  14306. @item hsub
  14307. @item vsub
  14308. horizontal and vertical chroma subsample values of the output
  14309. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  14310. @var{vsub} is 1.
  14311. @item n
  14312. the number of input frame, starting from 0
  14313. @item pos
  14314. the position in the file of the input frame, NAN if unknown; deprecated,
  14315. do not use
  14316. @item t
  14317. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  14318. @end table
  14319. This filter also supports the @ref{framesync} options.
  14320. Note that the @var{n}, @var{t} variables are available only
  14321. when evaluation is done @emph{per frame}, and will evaluate to NAN
  14322. when @option{eval} is set to @samp{init}.
  14323. Be aware that frames are taken from each input video in timestamp
  14324. order, hence, if their initial timestamps differ, it is a good idea
  14325. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  14326. have them begin in the same zero timestamp, as the example for
  14327. the @var{movie} filter does.
  14328. You can chain together more overlays but you should test the
  14329. efficiency of such approach.
  14330. @subsection Commands
  14331. This filter supports the following commands:
  14332. @table @option
  14333. @item x
  14334. @item y
  14335. Modify the x and y of the overlay input.
  14336. The command accepts the same syntax of the corresponding option.
  14337. If the specified expression is not valid, it is kept at its current
  14338. value.
  14339. @end table
  14340. @subsection Examples
  14341. @itemize
  14342. @item
  14343. Draw the overlay at 10 pixels from the bottom right corner of the main
  14344. video:
  14345. @example
  14346. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  14347. @end example
  14348. Using named options the example above becomes:
  14349. @example
  14350. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  14351. @end example
  14352. @item
  14353. Insert a transparent PNG logo in the bottom left corner of the input,
  14354. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  14355. @example
  14356. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  14357. @end example
  14358. @item
  14359. Insert 2 different transparent PNG logos (second logo on bottom
  14360. right corner) using the @command{ffmpeg} tool:
  14361. @example
  14362. 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
  14363. @end example
  14364. @item
  14365. Add a transparent color layer on top of the main video; @code{WxH}
  14366. must specify the size of the main input to the overlay filter:
  14367. @example
  14368. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  14369. @end example
  14370. @item
  14371. Play an original video and a filtered version (here with the deshake
  14372. filter) side by side using the @command{ffplay} tool:
  14373. @example
  14374. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  14375. @end example
  14376. The above command is the same as:
  14377. @example
  14378. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  14379. @end example
  14380. @item
  14381. Make a sliding overlay appearing from the left to the right top part of the
  14382. screen starting since time 2:
  14383. @example
  14384. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  14385. @end example
  14386. @item
  14387. Compose output by putting two input videos side to side:
  14388. @example
  14389. ffmpeg -i left.avi -i right.avi -filter_complex "
  14390. nullsrc=size=200x100 [background];
  14391. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  14392. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  14393. [background][left] overlay=shortest=1 [background+left];
  14394. [background+left][right] overlay=shortest=1:x=100 [left+right]
  14395. "
  14396. @end example
  14397. @item
  14398. Mask 10-20 seconds of a video by applying the delogo filter to a section
  14399. @example
  14400. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  14401. -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]'
  14402. masked.avi
  14403. @end example
  14404. @item
  14405. Chain several overlays in cascade:
  14406. @example
  14407. nullsrc=s=200x200 [bg];
  14408. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  14409. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  14410. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  14411. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  14412. [in3] null, [mid2] overlay=100:100 [out0]
  14413. @end example
  14414. @end itemize
  14415. @anchor{overlay_cuda}
  14416. @section overlay_cuda
  14417. Overlay one video on top of another.
  14418. This is the CUDA variant of the @ref{overlay} filter.
  14419. It only accepts CUDA frames. The underlying input pixel formats have to match.
  14420. It takes two inputs and has one output. The first input is the "main"
  14421. video on which the second input is overlaid.
  14422. It accepts the following parameters:
  14423. @table @option
  14424. @item x
  14425. @item y
  14426. Set expressions for the x and y coordinates of the overlaid video
  14427. on the main video.
  14428. They can contain the following parameters:
  14429. @table @option
  14430. @item main_w, W
  14431. @item main_h, H
  14432. The main input width and height.
  14433. @item overlay_w, w
  14434. @item overlay_h, h
  14435. The overlay input width and height.
  14436. @item x
  14437. @item y
  14438. The computed values for @var{x} and @var{y}. They are evaluated for
  14439. each new frame.
  14440. @item n
  14441. The ordinal index of the main input frame, starting from 0.
  14442. @item pos
  14443. The byte offset position in the file of the main input frame, NAN if unknown.
  14444. Deprecated, do not use.
  14445. @item t
  14446. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  14447. @end table
  14448. Default value is "0" for both expressions.
  14449. @item eval
  14450. Set when the expressions for @option{x} and @option{y} are evaluated.
  14451. It accepts the following values:
  14452. @table @option
  14453. @item init
  14454. Evaluate expressions once during filter initialization or
  14455. when a command is processed.
  14456. @item frame
  14457. Evaluate expressions for each incoming frame
  14458. @end table
  14459. Default value is @option{frame}.
  14460. @item eof_action
  14461. See @ref{framesync}.
  14462. @item shortest
  14463. See @ref{framesync}.
  14464. @item repeatlast
  14465. See @ref{framesync}.
  14466. @end table
  14467. This filter also supports the @ref{framesync} options.
  14468. @section owdenoise
  14469. Apply Overcomplete Wavelet denoiser.
  14470. The filter accepts the following options:
  14471. @table @option
  14472. @item depth
  14473. Set depth.
  14474. Larger depth values will denoise lower frequency components more, but
  14475. slow down filtering.
  14476. Must be an int in the range 8-16, default is @code{8}.
  14477. @item luma_strength, ls
  14478. Set luma strength.
  14479. Must be a double value in the range 0-1000, default is @code{1.0}.
  14480. @item chroma_strength, cs
  14481. Set chroma strength.
  14482. Must be a double value in the range 0-1000, default is @code{1.0}.
  14483. @end table
  14484. @anchor{pad}
  14485. @section pad
  14486. Add paddings to the input image, and place the original input at the
  14487. provided @var{x}, @var{y} coordinates.
  14488. It accepts the following parameters:
  14489. @table @option
  14490. @item width, w
  14491. @item height, h
  14492. Specify an expression for the size of the output image with the
  14493. paddings added. If the value for @var{width} or @var{height} is 0, the
  14494. corresponding input size is used for the output.
  14495. The @var{width} expression can reference the value set by the
  14496. @var{height} expression, and vice versa.
  14497. The default value of @var{width} and @var{height} is 0.
  14498. @item x
  14499. @item y
  14500. Specify the offsets to place the input image at within the padded area,
  14501. with respect to the top/left border of the output image.
  14502. The @var{x} expression can reference the value set by the @var{y}
  14503. expression, and vice versa.
  14504. The default value of @var{x} and @var{y} is 0.
  14505. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  14506. so the input image is centered on the padded area.
  14507. @item color
  14508. Specify the color of the padded area. For the syntax of this option,
  14509. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14510. manual,ffmpeg-utils}.
  14511. The default value of @var{color} is "black".
  14512. @item eval
  14513. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  14514. It accepts the following values:
  14515. @table @samp
  14516. @item init
  14517. Only evaluate expressions once during the filter initialization or when
  14518. a command is processed.
  14519. @item frame
  14520. Evaluate expressions for each incoming frame.
  14521. @end table
  14522. Default value is @samp{init}.
  14523. @item aspect
  14524. Pad to aspect instead to a resolution.
  14525. @end table
  14526. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  14527. options are expressions containing the following constants:
  14528. @table @option
  14529. @item in_w
  14530. @item in_h
  14531. The input video width and height.
  14532. @item iw
  14533. @item ih
  14534. These are the same as @var{in_w} and @var{in_h}.
  14535. @item out_w
  14536. @item out_h
  14537. The output width and height (the size of the padded area), as
  14538. specified by the @var{width} and @var{height} expressions.
  14539. @item ow
  14540. @item oh
  14541. These are the same as @var{out_w} and @var{out_h}.
  14542. @item x
  14543. @item y
  14544. The x and y offsets as specified by the @var{x} and @var{y}
  14545. expressions, or NAN if not yet specified.
  14546. @item a
  14547. same as @var{iw} / @var{ih}
  14548. @item sar
  14549. input sample aspect ratio
  14550. @item dar
  14551. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  14552. @item hsub
  14553. @item vsub
  14554. The horizontal and vertical chroma subsample values. For example for the
  14555. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14556. @end table
  14557. @subsection Examples
  14558. @itemize
  14559. @item
  14560. Add paddings with the color "violet" to the input video. The output video
  14561. size is 640x480, and the top-left corner of the input video is placed at
  14562. column 0, row 40
  14563. @example
  14564. pad=640:480:0:40:violet
  14565. @end example
  14566. The example above is equivalent to the following command:
  14567. @example
  14568. pad=width=640:height=480:x=0:y=40:color=violet
  14569. @end example
  14570. @item
  14571. Pad the input to get an output with dimensions increased by 3/2,
  14572. and put the input video at the center of the padded area:
  14573. @example
  14574. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  14575. @end example
  14576. @item
  14577. Pad the input to get a squared output with size equal to the maximum
  14578. value between the input width and height, and put the input video at
  14579. the center of the padded area:
  14580. @example
  14581. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  14582. @end example
  14583. @item
  14584. Pad the input to get a final w/h ratio of 16:9:
  14585. @example
  14586. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  14587. @end example
  14588. @item
  14589. In case of anamorphic video, in order to set the output display aspect
  14590. correctly, it is necessary to use @var{sar} in the expression,
  14591. according to the relation:
  14592. @example
  14593. (ih * X / ih) * sar = output_dar
  14594. X = output_dar / sar
  14595. @end example
  14596. Thus the previous example needs to be modified to:
  14597. @example
  14598. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  14599. @end example
  14600. @item
  14601. Double the output size and put the input video in the bottom-right
  14602. corner of the output padded area:
  14603. @example
  14604. pad="2*iw:2*ih:ow-iw:oh-ih"
  14605. @end example
  14606. @end itemize
  14607. @anchor{palettegen}
  14608. @section palettegen
  14609. Generate one palette for a whole video stream.
  14610. It accepts the following options:
  14611. @table @option
  14612. @item max_colors
  14613. Set the maximum number of colors to quantize in the palette.
  14614. Note: the palette will still contain 256 colors; the unused palette entries
  14615. will be black.
  14616. @item reserve_transparent
  14617. Create a palette of 255 colors maximum and reserve the last one for
  14618. transparency. Reserving the transparency color is useful for GIF optimization.
  14619. If not set, the maximum of colors in the palette will be 256. You probably want
  14620. to disable this option for a standalone image.
  14621. Set by default.
  14622. @item transparency_color
  14623. Set the color that will be used as background for transparency.
  14624. @item stats_mode
  14625. Set statistics mode.
  14626. It accepts the following values:
  14627. @table @samp
  14628. @item full
  14629. Compute full frame histograms.
  14630. @item diff
  14631. Compute histograms only for the part that differs from previous frame. This
  14632. might be relevant to give more importance to the moving part of your input if
  14633. the background is static.
  14634. @item single
  14635. Compute new histogram for each frame.
  14636. @end table
  14637. Default value is @var{full}.
  14638. @end table
  14639. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  14640. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  14641. color quantization of the palette. This information is also visible at
  14642. @var{info} logging level.
  14643. @subsection Examples
  14644. @itemize
  14645. @item
  14646. Generate a representative palette of a given video using @command{ffmpeg}:
  14647. @example
  14648. ffmpeg -i input.mkv -vf palettegen palette.png
  14649. @end example
  14650. @end itemize
  14651. @section paletteuse
  14652. Use a palette to downsample an input video stream.
  14653. The filter takes two inputs: one video stream and a palette. The palette must
  14654. be a 256 pixels image.
  14655. It accepts the following options:
  14656. @table @option
  14657. @item dither
  14658. Select dithering mode. Available algorithms are:
  14659. @table @samp
  14660. @item bayer
  14661. Ordered 8x8 bayer dithering (deterministic)
  14662. @item heckbert
  14663. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  14664. Note: this dithering is sometimes considered "wrong" and is included as a
  14665. reference.
  14666. @item floyd_steinberg
  14667. Floyd and Steingberg dithering (error diffusion)
  14668. @item sierra2
  14669. Frankie Sierra dithering v2 (error diffusion)
  14670. @item sierra2_4a
  14671. Frankie Sierra dithering v2 "Lite" (error diffusion)
  14672. @item sierra3
  14673. Frankie Sierra dithering v3 (error diffusion)
  14674. @item burkes
  14675. Burkes dithering (error diffusion)
  14676. @item atkinson
  14677. Atkinson dithering by Bill Atkinson at Apple Computer (error diffusion)
  14678. @item none
  14679. Disable dithering.
  14680. @end table
  14681. Default is @var{sierra2_4a}.
  14682. @item bayer_scale
  14683. When @var{bayer} dithering is selected, this option defines the scale of the
  14684. pattern (how much the crosshatch pattern is visible). A low value means more
  14685. visible pattern for less banding, and higher value means less visible pattern
  14686. at the cost of more banding.
  14687. The option must be an integer value in the range [0,5]. Default is @var{2}.
  14688. @item diff_mode
  14689. If set, define the zone to process
  14690. @table @samp
  14691. @item rectangle
  14692. Only the changing rectangle will be reprocessed. This is similar to GIF
  14693. cropping/offsetting compression mechanism. This option can be useful for speed
  14694. if only a part of the image is changing, and has use cases such as limiting the
  14695. scope of the error diffusal @option{dither} to the rectangle that bounds the
  14696. moving scene (it leads to more deterministic output if the scene doesn't change
  14697. much, and as a result less moving noise and better GIF compression).
  14698. @end table
  14699. Default is @var{none}.
  14700. @item new
  14701. Take new palette for each output frame.
  14702. @item alpha_threshold
  14703. Sets the alpha threshold for transparency. Alpha values above this threshold
  14704. will be treated as completely opaque, and values below this threshold will be
  14705. treated as completely transparent.
  14706. The option must be an integer value in the range [0,255]. Default is @var{128}.
  14707. @end table
  14708. @subsection Examples
  14709. @itemize
  14710. @item
  14711. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  14712. using @command{ffmpeg}:
  14713. @example
  14714. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  14715. @end example
  14716. @end itemize
  14717. @section perspective
  14718. Correct perspective of video not recorded perpendicular to the screen.
  14719. A description of the accepted parameters follows.
  14720. @table @option
  14721. @item x0
  14722. @item y0
  14723. @item x1
  14724. @item y1
  14725. @item x2
  14726. @item y2
  14727. @item x3
  14728. @item y3
  14729. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  14730. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  14731. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  14732. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  14733. then the corners of the source will be sent to the specified coordinates.
  14734. The expressions can use the following variables:
  14735. @table @option
  14736. @item W
  14737. @item H
  14738. the width and height of video frame.
  14739. @item in
  14740. Input frame count.
  14741. @item on
  14742. Output frame count.
  14743. @end table
  14744. @item interpolation
  14745. Set interpolation for perspective correction.
  14746. It accepts the following values:
  14747. @table @samp
  14748. @item linear
  14749. @item cubic
  14750. @end table
  14751. Default value is @samp{linear}.
  14752. @item sense
  14753. Set interpretation of coordinate options.
  14754. It accepts the following values:
  14755. @table @samp
  14756. @item 0, source
  14757. Send point in the source specified by the given coordinates to
  14758. the corners of the destination.
  14759. @item 1, destination
  14760. Send the corners of the source to the point in the destination specified
  14761. by the given coordinates.
  14762. Default value is @samp{source}.
  14763. @end table
  14764. @item eval
  14765. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  14766. It accepts the following values:
  14767. @table @samp
  14768. @item init
  14769. only evaluate expressions once during the filter initialization or
  14770. when a command is processed
  14771. @item frame
  14772. evaluate expressions for each incoming frame
  14773. @end table
  14774. Default value is @samp{init}.
  14775. @end table
  14776. @section phase
  14777. Delay interlaced video by one field time so that the field order changes.
  14778. The intended use is to fix PAL movies that have been captured with the
  14779. opposite field order to the film-to-video transfer.
  14780. A description of the accepted parameters follows.
  14781. @table @option
  14782. @item mode
  14783. Set phase mode.
  14784. It accepts the following values:
  14785. @table @samp
  14786. @item t
  14787. Capture field order top-first, transfer bottom-first.
  14788. Filter will delay the bottom field.
  14789. @item b
  14790. Capture field order bottom-first, transfer top-first.
  14791. Filter will delay the top field.
  14792. @item p
  14793. Capture and transfer with the same field order. This mode only exists
  14794. for the documentation of the other options to refer to, but if you
  14795. actually select it, the filter will faithfully do nothing.
  14796. @item a
  14797. Capture field order determined automatically by field flags, transfer
  14798. opposite.
  14799. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  14800. basis using field flags. If no field information is available,
  14801. then this works just like @samp{u}.
  14802. @item u
  14803. Capture unknown or varying, transfer opposite.
  14804. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  14805. analyzing the images and selecting the alternative that produces best
  14806. match between the fields.
  14807. @item T
  14808. Capture top-first, transfer unknown or varying.
  14809. Filter selects among @samp{t} and @samp{p} using image analysis.
  14810. @item B
  14811. Capture bottom-first, transfer unknown or varying.
  14812. Filter selects among @samp{b} and @samp{p} using image analysis.
  14813. @item A
  14814. Capture determined by field flags, transfer unknown or varying.
  14815. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  14816. image analysis. If no field information is available, then this works just
  14817. like @samp{U}. This is the default mode.
  14818. @item U
  14819. Both capture and transfer unknown or varying.
  14820. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  14821. @end table
  14822. @end table
  14823. @subsection Commands
  14824. This filter supports the all above options as @ref{commands}.
  14825. @section photosensitivity
  14826. Reduce various flashes in video, so to help users with epilepsy.
  14827. It accepts the following options:
  14828. @table @option
  14829. @item frames, f
  14830. Set how many frames to use when filtering. Default is 30.
  14831. @item threshold, t
  14832. Set detection threshold factor. Default is 1.
  14833. Lower is stricter.
  14834. @item skip
  14835. Set how many pixels to skip when sampling frames. Default is 1.
  14836. Allowed range is from 1 to 1024.
  14837. @item bypass
  14838. Leave frames unchanged. Default is disabled.
  14839. @end table
  14840. @section pixdesctest
  14841. Pixel format descriptor test filter, mainly useful for internal
  14842. testing. The output video should be equal to the input video.
  14843. For example:
  14844. @example
  14845. format=monow, pixdesctest
  14846. @end example
  14847. can be used to test the monowhite pixel format descriptor definition.
  14848. @section pixelize
  14849. Apply pixelization to video stream.
  14850. The filter accepts the following options:
  14851. @table @option
  14852. @item width, w
  14853. @item height, h
  14854. Set block dimensions that will be used for pixelization.
  14855. Default value is @code{16}.
  14856. @item mode, m
  14857. Set the mode of pixelization used.
  14858. Possible values are:
  14859. @table @samp
  14860. @item avg
  14861. @item min
  14862. @item max
  14863. @end table
  14864. Default value is @code{avg}.
  14865. @item planes, p
  14866. Set what planes to filter. Default is to filter all planes.
  14867. @end table
  14868. @subsection Commands
  14869. This filter supports all options as @ref{commands}.
  14870. @section pixscope
  14871. Display sample values of color channels. Mainly useful for checking color
  14872. and levels. Minimum supported resolution is 640x480.
  14873. The filters accept the following options:
  14874. @table @option
  14875. @item x
  14876. Set scope X position, relative offset on X axis.
  14877. @item y
  14878. Set scope Y position, relative offset on Y axis.
  14879. @item w
  14880. Set scope width.
  14881. @item h
  14882. Set scope height.
  14883. @item o
  14884. Set window opacity. This window also holds statistics about pixel area.
  14885. @item wx
  14886. Set window X position, relative offset on X axis.
  14887. @item wy
  14888. Set window Y position, relative offset on Y axis.
  14889. @end table
  14890. @subsection Commands
  14891. This filter supports same @ref{commands} as options.
  14892. @section pp
  14893. Enable the specified chain of postprocessing subfilters using libpostproc. This
  14894. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  14895. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  14896. Each subfilter and some options have a short and a long name that can be used
  14897. interchangeably, i.e. dr/dering are the same.
  14898. The filters accept the following options:
  14899. @table @option
  14900. @item subfilters
  14901. Set postprocessing subfilters string.
  14902. @end table
  14903. All subfilters share common options to determine their scope:
  14904. @table @option
  14905. @item a/autoq
  14906. Honor the quality commands for this subfilter.
  14907. @item c/chrom
  14908. Do chrominance filtering, too (default).
  14909. @item y/nochrom
  14910. Do luma filtering only (no chrominance).
  14911. @item n/noluma
  14912. Do chrominance filtering only (no luma).
  14913. @end table
  14914. These options can be appended after the subfilter name, separated by a '|'.
  14915. Available subfilters are:
  14916. @table @option
  14917. @item hb/hdeblock[|difference[|flatness]]
  14918. Horizontal deblocking filter
  14919. @table @option
  14920. @item difference
  14921. Difference factor where higher values mean more deblocking (default: @code{32}).
  14922. @item flatness
  14923. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14924. @end table
  14925. @item vb/vdeblock[|difference[|flatness]]
  14926. Vertical deblocking filter
  14927. @table @option
  14928. @item difference
  14929. Difference factor where higher values mean more deblocking (default: @code{32}).
  14930. @item flatness
  14931. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14932. @end table
  14933. @item ha/hadeblock[|difference[|flatness]]
  14934. Accurate horizontal deblocking filter
  14935. @table @option
  14936. @item difference
  14937. Difference factor where higher values mean more deblocking (default: @code{32}).
  14938. @item flatness
  14939. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14940. @end table
  14941. @item va/vadeblock[|difference[|flatness]]
  14942. Accurate vertical deblocking filter
  14943. @table @option
  14944. @item difference
  14945. Difference factor where higher values mean more deblocking (default: @code{32}).
  14946. @item flatness
  14947. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14948. @end table
  14949. @end table
  14950. The horizontal and vertical deblocking filters share the difference and
  14951. flatness values so you cannot set different horizontal and vertical
  14952. thresholds.
  14953. @table @option
  14954. @item h1/x1hdeblock
  14955. Experimental horizontal deblocking filter
  14956. @item v1/x1vdeblock
  14957. Experimental vertical deblocking filter
  14958. @item dr/dering
  14959. Deringing filter
  14960. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  14961. @table @option
  14962. @item threshold1
  14963. larger -> stronger filtering
  14964. @item threshold2
  14965. larger -> stronger filtering
  14966. @item threshold3
  14967. larger -> stronger filtering
  14968. @end table
  14969. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  14970. @table @option
  14971. @item f/fullyrange
  14972. Stretch luma to @code{0-255}.
  14973. @end table
  14974. @item lb/linblenddeint
  14975. Linear blend deinterlacing filter that deinterlaces the given block by
  14976. filtering all lines with a @code{(1 2 1)} filter.
  14977. @item li/linipoldeint
  14978. Linear interpolating deinterlacing filter that deinterlaces the given block by
  14979. linearly interpolating every second line.
  14980. @item ci/cubicipoldeint
  14981. Cubic interpolating deinterlacing filter deinterlaces the given block by
  14982. cubically interpolating every second line.
  14983. @item md/mediandeint
  14984. Median deinterlacing filter that deinterlaces the given block by applying a
  14985. median filter to every second line.
  14986. @item fd/ffmpegdeint
  14987. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  14988. second line with a @code{(-1 4 2 4 -1)} filter.
  14989. @item l5/lowpass5
  14990. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  14991. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  14992. @item fq/forceQuant[|quantizer]
  14993. Overrides the quantizer table from the input with the constant quantizer you
  14994. specify.
  14995. @table @option
  14996. @item quantizer
  14997. Quantizer to use
  14998. @end table
  14999. @item de/default
  15000. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  15001. @item fa/fast
  15002. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  15003. @item ac
  15004. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  15005. @end table
  15006. @subsection Examples
  15007. @itemize
  15008. @item
  15009. Apply horizontal and vertical deblocking, deringing and automatic
  15010. brightness/contrast:
  15011. @example
  15012. pp=hb/vb/dr/al
  15013. @end example
  15014. @item
  15015. Apply default filters without brightness/contrast correction:
  15016. @example
  15017. pp=de/-al
  15018. @end example
  15019. @item
  15020. Apply default filters and temporal denoiser:
  15021. @example
  15022. pp=default/tmpnoise|1|2|3
  15023. @end example
  15024. @item
  15025. Apply deblocking on luma only, and switch vertical deblocking on or off
  15026. automatically depending on available CPU time:
  15027. @example
  15028. pp=hb|y/vb|a
  15029. @end example
  15030. @end itemize
  15031. @section pp7
  15032. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  15033. similar to spp = 6 with 7 point DCT, where only the center sample is
  15034. used after IDCT.
  15035. The filter accepts the following options:
  15036. @table @option
  15037. @item qp
  15038. Force a constant quantization parameter. It accepts an integer in range
  15039. 0 to 63. If not set, the filter will use the QP from the video stream
  15040. (if available).
  15041. @item mode
  15042. Set thresholding mode. Available modes are:
  15043. @table @samp
  15044. @item hard
  15045. Set hard thresholding.
  15046. @item soft
  15047. Set soft thresholding (better de-ringing effect, but likely blurrier).
  15048. @item medium
  15049. Set medium thresholding (good results, default).
  15050. @end table
  15051. @end table
  15052. @section premultiply
  15053. Apply alpha premultiply effect to input video stream using first plane
  15054. of second stream as alpha.
  15055. Both streams must have same dimensions and same pixel format.
  15056. The filter accepts the following option:
  15057. @table @option
  15058. @item planes
  15059. Set which planes will be processed, unprocessed planes will be copied.
  15060. By default value 0xf, all planes will be processed.
  15061. @item inplace
  15062. Do not require 2nd input for processing, instead use alpha plane from input stream.
  15063. @end table
  15064. @section prewitt
  15065. Apply prewitt operator to input video stream.
  15066. The filter accepts the following option:
  15067. @table @option
  15068. @item planes
  15069. Set which planes will be processed, unprocessed planes will be copied.
  15070. By default value 0xf, all planes will be processed.
  15071. @item scale
  15072. Set value which will be multiplied with filtered result.
  15073. @item delta
  15074. Set value which will be added to filtered result.
  15075. @end table
  15076. @subsection Commands
  15077. This filter supports the all above options as @ref{commands}.
  15078. @section pseudocolor
  15079. Alter frame colors in video with pseudocolors.
  15080. This filter accepts the following options:
  15081. @table @option
  15082. @item c0
  15083. set pixel first component expression
  15084. @item c1
  15085. set pixel second component expression
  15086. @item c2
  15087. set pixel third component expression
  15088. @item c3
  15089. set pixel fourth component expression, corresponds to the alpha component
  15090. @item index, i
  15091. set component to use as base for altering colors
  15092. @item preset, p
  15093. Pick one of built-in LUTs. By default is set to none.
  15094. Available LUTs:
  15095. @table @samp
  15096. @item magma
  15097. @item inferno
  15098. @item plasma
  15099. @item viridis
  15100. @item turbo
  15101. @item cividis
  15102. @item range1
  15103. @item range2
  15104. @item shadows
  15105. @item highlights
  15106. @item solar
  15107. @item nominal
  15108. @item preferred
  15109. @item total
  15110. @item spectral
  15111. @item cool
  15112. @item heat
  15113. @item fiery
  15114. @item blues
  15115. @item green
  15116. @item helix
  15117. @end table
  15118. @item opacity
  15119. Set opacity of output colors. Allowed range is from 0 to 1.
  15120. Default value is set to 1.
  15121. @end table
  15122. Each of the expression options specifies the expression to use for computing
  15123. the lookup table for the corresponding pixel component values.
  15124. The expressions can contain the following constants and functions:
  15125. @table @option
  15126. @item w
  15127. @item h
  15128. The input width and height.
  15129. @item val
  15130. The input value for the pixel component.
  15131. @item ymin, umin, vmin, amin
  15132. The minimum allowed component value.
  15133. @item ymax, umax, vmax, amax
  15134. The maximum allowed component value.
  15135. @end table
  15136. All expressions default to "val".
  15137. @subsection Commands
  15138. This filter supports the all above options as @ref{commands}.
  15139. @subsection Examples
  15140. @itemize
  15141. @item
  15142. Change too high luma values to gradient:
  15143. @example
  15144. 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'"
  15145. @end example
  15146. @end itemize
  15147. @section psnr
  15148. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  15149. Ratio) between two input videos.
  15150. This filter takes in input two input videos, the first input is
  15151. considered the "main" source and is passed unchanged to the
  15152. output. The second input is used as a "reference" video for computing
  15153. the PSNR.
  15154. Both video inputs must have the same resolution and pixel format for
  15155. this filter to work correctly. Also it assumes that both inputs
  15156. have the same number of frames, which are compared one by one.
  15157. The obtained average PSNR is printed through the logging system.
  15158. The filter stores the accumulated MSE (mean squared error) of each
  15159. frame, and at the end of the processing it is averaged across all frames
  15160. equally, and the following formula is applied to obtain the PSNR:
  15161. @example
  15162. PSNR = 10*log10(MAX^2/MSE)
  15163. @end example
  15164. Where MAX is the average of the maximum values of each component of the
  15165. image.
  15166. The description of the accepted parameters follows.
  15167. @table @option
  15168. @item stats_file, f
  15169. If specified the filter will use the named file to save the PSNR of
  15170. each individual frame. When filename equals "-" the data is sent to
  15171. standard output.
  15172. @item stats_version
  15173. Specifies which version of the stats file format to use. Details of
  15174. each format are written below.
  15175. Default value is 1.
  15176. @item stats_add_max
  15177. Determines whether the max value is output to the stats log.
  15178. Default value is 0.
  15179. Requires stats_version >= 2. If this is set and stats_version < 2,
  15180. the filter will return an error.
  15181. @end table
  15182. This filter also supports the @ref{framesync} options.
  15183. The file printed if @var{stats_file} is selected, contains a sequence of
  15184. key/value pairs of the form @var{key}:@var{value} for each compared
  15185. couple of frames.
  15186. If a @var{stats_version} greater than 1 is specified, a header line precedes
  15187. the list of per-frame-pair stats, with key value pairs following the frame
  15188. format with the following parameters:
  15189. @table @option
  15190. @item psnr_log_version
  15191. The version of the log file format. Will match @var{stats_version}.
  15192. @item fields
  15193. A comma separated list of the per-frame-pair parameters included in
  15194. the log.
  15195. @end table
  15196. A description of each shown per-frame-pair parameter follows:
  15197. @table @option
  15198. @item n
  15199. sequential number of the input frame, starting from 1
  15200. @item mse_avg
  15201. Mean Square Error pixel-by-pixel average difference of the compared
  15202. frames, averaged over all the image components.
  15203. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  15204. Mean Square Error pixel-by-pixel average difference of the compared
  15205. frames for the component specified by the suffix.
  15206. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  15207. Peak Signal to Noise ratio of the compared frames for the component
  15208. specified by the suffix.
  15209. @item max_avg, max_y, max_u, max_v
  15210. Maximum allowed value for each channel, and average over all
  15211. channels.
  15212. @end table
  15213. @subsection Examples
  15214. @itemize
  15215. @item
  15216. For example:
  15217. @example
  15218. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  15219. [main][ref] psnr="stats_file=stats.log" [out]
  15220. @end example
  15221. On this example the input file being processed is compared with the
  15222. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  15223. is stored in @file{stats.log}.
  15224. @item
  15225. Another example with different containers:
  15226. @example
  15227. 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 -
  15228. @end example
  15229. @end itemize
  15230. @anchor{pullup}
  15231. @section pullup
  15232. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  15233. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  15234. content.
  15235. The pullup filter is designed to take advantage of future context in making
  15236. its decisions. This filter is stateless in the sense that it does not lock
  15237. onto a pattern to follow, but it instead looks forward to the following
  15238. fields in order to identify matches and rebuild progressive frames.
  15239. To produce content with an even framerate, insert the fps filter after
  15240. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  15241. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  15242. The filter accepts the following options:
  15243. @table @option
  15244. @item jl
  15245. @item jr
  15246. @item jt
  15247. @item jb
  15248. These options set the amount of "junk" to ignore at the left, right, top, and
  15249. bottom of the image, respectively. Left and right are in units of 8 pixels,
  15250. while top and bottom are in units of 2 lines.
  15251. The default is 8 pixels on each side.
  15252. @item sb
  15253. Set the strict breaks. Setting this option to 1 will reduce the chances of
  15254. filter generating an occasional mismatched frame, but it may also cause an
  15255. excessive number of frames to be dropped during high motion sequences.
  15256. Conversely, setting it to -1 will make filter match fields more easily.
  15257. This may help processing of video where there is slight blurring between
  15258. the fields, but may also cause there to be interlaced frames in the output.
  15259. Default value is @code{0}.
  15260. @item mp
  15261. Set the metric plane to use. It accepts the following values:
  15262. @table @samp
  15263. @item l
  15264. Use luma plane.
  15265. @item u
  15266. Use chroma blue plane.
  15267. @item v
  15268. Use chroma red plane.
  15269. @end table
  15270. This option may be set to use chroma plane instead of the default luma plane
  15271. for doing filter's computations. This may improve accuracy on very clean
  15272. source material, but more likely will decrease accuracy, especially if there
  15273. is chroma noise (rainbow effect) or any grayscale video.
  15274. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  15275. load and make pullup usable in realtime on slow machines.
  15276. @end table
  15277. For best results (without duplicated frames in the output file) it is
  15278. necessary to change the output frame rate. For example, to inverse
  15279. telecine NTSC input:
  15280. @example
  15281. ffmpeg -i input -vf pullup -r 24000/1001 ...
  15282. @end example
  15283. @section qp
  15284. Change video quantization parameters (QP).
  15285. The filter accepts the following option:
  15286. @table @option
  15287. @item qp
  15288. Set expression for quantization parameter.
  15289. @end table
  15290. The expression is evaluated through the eval API and can contain, among others,
  15291. the following constants:
  15292. @table @var
  15293. @item known
  15294. 1 if index is not 129, 0 otherwise.
  15295. @item qp
  15296. Sequential index starting from -129 to 128.
  15297. @end table
  15298. @subsection Examples
  15299. @itemize
  15300. @item
  15301. Some equation like:
  15302. @example
  15303. qp=2+2*sin(PI*qp)
  15304. @end example
  15305. @end itemize
  15306. @section random
  15307. Flush video frames from internal cache of frames into a random order.
  15308. No frame is discarded.
  15309. Inspired by @ref{frei0r} nervous filter.
  15310. @table @option
  15311. @item frames
  15312. Set size in number of frames of internal cache, in range from @code{2} to
  15313. @code{512}. Default is @code{30}.
  15314. @item seed
  15315. Set seed for random number generator, must be an integer included between
  15316. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15317. less than @code{0}, the filter will try to use a good random seed on a
  15318. best effort basis.
  15319. @end table
  15320. @section readeia608
  15321. Read closed captioning (EIA-608) information from the top lines of a video frame.
  15322. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  15323. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  15324. with EIA-608 data (starting from 0). A description of each metadata value follows:
  15325. @table @option
  15326. @item lavfi.readeia608.X.cc
  15327. The two bytes stored as EIA-608 data (printed in hexadecimal).
  15328. @item lavfi.readeia608.X.line
  15329. The number of the line on which the EIA-608 data was identified and read.
  15330. @end table
  15331. This filter accepts the following options:
  15332. @table @option
  15333. @item scan_min
  15334. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  15335. @item scan_max
  15336. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  15337. @item spw
  15338. Set the ratio of width reserved for sync code detection.
  15339. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  15340. @item chp
  15341. Enable checking the parity bit. In the event of a parity error, the filter will output
  15342. @code{0x00} for that character. Default is false.
  15343. @item lp
  15344. Lowpass lines prior to further processing. Default is enabled.
  15345. @end table
  15346. @subsection Commands
  15347. This filter supports the all above options as @ref{commands}.
  15348. @subsection Examples
  15349. @itemize
  15350. @item
  15351. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  15352. @example
  15353. 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
  15354. @end example
  15355. @end itemize
  15356. @section readvitc
  15357. Read vertical interval timecode (VITC) information from the top lines of a
  15358. video frame.
  15359. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  15360. timecode value, if a valid timecode has been detected. Further metadata key
  15361. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  15362. timecode data has been found or not.
  15363. This filter accepts the following options:
  15364. @table @option
  15365. @item scan_max
  15366. Set the maximum number of lines to scan for VITC data. If the value is set to
  15367. @code{-1} the full video frame is scanned. Default is @code{45}.
  15368. @item thr_b
  15369. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  15370. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  15371. @item thr_w
  15372. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  15373. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  15374. @end table
  15375. @subsection Examples
  15376. @itemize
  15377. @item
  15378. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  15379. draw @code{--:--:--:--} as a placeholder:
  15380. @example
  15381. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  15382. @end example
  15383. @end itemize
  15384. @section remap
  15385. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  15386. Destination pixel at position (X, Y) will be picked from source (x, y) position
  15387. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  15388. value for pixel will be used for destination pixel.
  15389. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  15390. will have Xmap/Ymap video stream dimensions.
  15391. Xmap and Ymap input video streams are 16bit depth, single channel.
  15392. @table @option
  15393. @item format
  15394. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  15395. Default is @code{color}.
  15396. @item fill
  15397. Specify the color of the unmapped pixels. For the syntax of this option,
  15398. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  15399. manual,ffmpeg-utils}. Default color is @code{black}.
  15400. @end table
  15401. @section removegrain
  15402. The removegrain filter is a spatial denoiser for progressive video.
  15403. @table @option
  15404. @item m0
  15405. Set mode for the first plane.
  15406. @item m1
  15407. Set mode for the second plane.
  15408. @item m2
  15409. Set mode for the third plane.
  15410. @item m3
  15411. Set mode for the fourth plane.
  15412. @end table
  15413. Range of mode is from 0 to 24. Description of each mode follows:
  15414. @table @var
  15415. @item 0
  15416. Leave input plane unchanged. Default.
  15417. @item 1
  15418. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  15419. @item 2
  15420. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  15421. @item 3
  15422. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  15423. @item 4
  15424. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  15425. This is equivalent to a median filter.
  15426. @item 5
  15427. Line-sensitive clipping giving the minimal change.
  15428. @item 6
  15429. Line-sensitive clipping, intermediate.
  15430. @item 7
  15431. Line-sensitive clipping, intermediate.
  15432. @item 8
  15433. Line-sensitive clipping, intermediate.
  15434. @item 9
  15435. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  15436. @item 10
  15437. Replaces the target pixel with the closest neighbour.
  15438. @item 11
  15439. [1 2 1] horizontal and vertical kernel blur.
  15440. @item 12
  15441. Same as mode 11.
  15442. @item 13
  15443. Bob mode, interpolates top field from the line where the neighbours
  15444. pixels are the closest.
  15445. @item 14
  15446. Bob mode, interpolates bottom field from the line where the neighbours
  15447. pixels are the closest.
  15448. @item 15
  15449. Bob mode, interpolates top field. Same as 13 but with a more complicated
  15450. interpolation formula.
  15451. @item 16
  15452. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  15453. interpolation formula.
  15454. @item 17
  15455. Clips the pixel with the minimum and maximum of respectively the maximum and
  15456. minimum of each pair of opposite neighbour pixels.
  15457. @item 18
  15458. Line-sensitive clipping using opposite neighbours whose greatest distance from
  15459. the current pixel is minimal.
  15460. @item 19
  15461. Replaces the pixel with the average of its 8 neighbours.
  15462. @item 20
  15463. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  15464. @item 21
  15465. Clips pixels using the averages of opposite neighbour.
  15466. @item 22
  15467. Same as mode 21 but simpler and faster.
  15468. @item 23
  15469. Small edge and halo removal, but reputed useless.
  15470. @item 24
  15471. Similar as 23.
  15472. @end table
  15473. @section removelogo
  15474. Suppress a TV station logo, using an image file to determine which
  15475. pixels comprise the logo. It works by filling in the pixels that
  15476. comprise the logo with neighboring pixels.
  15477. The filter accepts the following options:
  15478. @table @option
  15479. @item filename, f
  15480. Set the filter bitmap file, which can be any image format supported by
  15481. libavformat. The width and height of the image file must match those of the
  15482. video stream being processed.
  15483. @end table
  15484. Pixels in the provided bitmap image with a value of zero are not
  15485. considered part of the logo, non-zero pixels are considered part of
  15486. the logo. If you use white (255) for the logo and black (0) for the
  15487. rest, you will be safe. For making the filter bitmap, it is
  15488. recommended to take a screen capture of a black frame with the logo
  15489. visible, and then using a threshold filter followed by the erode
  15490. filter once or twice.
  15491. If needed, little splotches can be fixed manually. Remember that if
  15492. logo pixels are not covered, the filter quality will be much
  15493. reduced. Marking too many pixels as part of the logo does not hurt as
  15494. much, but it will increase the amount of blurring needed to cover over
  15495. the image and will destroy more information than necessary, and extra
  15496. pixels will slow things down on a large logo.
  15497. @section repeatfields
  15498. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  15499. fields based on its value.
  15500. @section reverse
  15501. Reverse a video clip.
  15502. Warning: This filter requires memory to buffer the entire clip, so trimming
  15503. is suggested.
  15504. @subsection Examples
  15505. @itemize
  15506. @item
  15507. Take the first 5 seconds of a clip, and reverse it.
  15508. @example
  15509. trim=end=5,reverse
  15510. @end example
  15511. @end itemize
  15512. @section rgbashift
  15513. Shift R/G/B/A pixels horizontally and/or vertically.
  15514. The filter accepts the following options:
  15515. @table @option
  15516. @item rh
  15517. Set amount to shift red horizontally.
  15518. @item rv
  15519. Set amount to shift red vertically.
  15520. @item gh
  15521. Set amount to shift green horizontally.
  15522. @item gv
  15523. Set amount to shift green vertically.
  15524. @item bh
  15525. Set amount to shift blue horizontally.
  15526. @item bv
  15527. Set amount to shift blue vertically.
  15528. @item ah
  15529. Set amount to shift alpha horizontally.
  15530. @item av
  15531. Set amount to shift alpha vertically.
  15532. @item edge
  15533. Set edge mode, can be @var{smear}, default, or @var{warp}.
  15534. @end table
  15535. @subsection Commands
  15536. This filter supports the all above options as @ref{commands}.
  15537. @section roberts
  15538. Apply roberts cross operator to input video stream.
  15539. The filter accepts the following option:
  15540. @table @option
  15541. @item planes
  15542. Set which planes will be processed, unprocessed planes will be copied.
  15543. By default value 0xf, all planes will be processed.
  15544. @item scale
  15545. Set value which will be multiplied with filtered result.
  15546. @item delta
  15547. Set value which will be added to filtered result.
  15548. @end table
  15549. @subsection Commands
  15550. This filter supports the all above options as @ref{commands}.
  15551. @section rotate
  15552. Rotate video by an arbitrary angle expressed in radians.
  15553. The filter accepts the following options:
  15554. A description of the optional parameters follows.
  15555. @table @option
  15556. @item angle, a
  15557. Set an expression for the angle by which to rotate the input video
  15558. clockwise, expressed as a number of radians. A negative value will
  15559. result in a counter-clockwise rotation. By default it is set to "0".
  15560. This expression is evaluated for each frame.
  15561. @item out_w, ow
  15562. Set the output width expression, default value is "iw".
  15563. This expression is evaluated just once during configuration.
  15564. @item out_h, oh
  15565. Set the output height expression, default value is "ih".
  15566. This expression is evaluated just once during configuration.
  15567. @item bilinear
  15568. Enable bilinear interpolation if set to 1, a value of 0 disables
  15569. it. Default value is 1.
  15570. @item fillcolor, c
  15571. Set the color used to fill the output area not covered by the rotated
  15572. image. For the general syntax of this option, check the
  15573. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15574. If the special value "none" is selected then no
  15575. background is printed (useful for example if the background is never shown).
  15576. Default value is "black".
  15577. @end table
  15578. The expressions for the angle and the output size can contain the
  15579. following constants and functions:
  15580. @table @option
  15581. @item n
  15582. sequential number of the input frame, starting from 0. It is always NAN
  15583. before the first frame is filtered.
  15584. @item t
  15585. time in seconds of the input frame, it is set to 0 when the filter is
  15586. configured. It is always NAN before the first frame is filtered.
  15587. @item hsub
  15588. @item vsub
  15589. horizontal and vertical chroma subsample values. For example for the
  15590. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15591. @item in_w, iw
  15592. @item in_h, ih
  15593. the input video width and height
  15594. @item out_w, ow
  15595. @item out_h, oh
  15596. the output width and height, that is the size of the padded area as
  15597. specified by the @var{width} and @var{height} expressions
  15598. @item rotw(a)
  15599. @item roth(a)
  15600. the minimal width/height required for completely containing the input
  15601. video rotated by @var{a} radians.
  15602. These are only available when computing the @option{out_w} and
  15603. @option{out_h} expressions.
  15604. @end table
  15605. @subsection Examples
  15606. @itemize
  15607. @item
  15608. Rotate the input by PI/6 radians clockwise:
  15609. @example
  15610. rotate=PI/6
  15611. @end example
  15612. @item
  15613. Rotate the input by PI/6 radians counter-clockwise:
  15614. @example
  15615. rotate=-PI/6
  15616. @end example
  15617. @item
  15618. Rotate the input by 45 degrees clockwise:
  15619. @example
  15620. rotate=45*PI/180
  15621. @end example
  15622. @item
  15623. Apply a constant rotation with period T, starting from an angle of PI/3:
  15624. @example
  15625. rotate=PI/3+2*PI*t/T
  15626. @end example
  15627. @item
  15628. Make the input video rotation oscillating with a period of T
  15629. seconds and an amplitude of A radians:
  15630. @example
  15631. rotate=A*sin(2*PI/T*t)
  15632. @end example
  15633. @item
  15634. Rotate the video, output size is chosen so that the whole rotating
  15635. input video is always completely contained in the output:
  15636. @example
  15637. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  15638. @end example
  15639. @item
  15640. Rotate the video, reduce the output size so that no background is ever
  15641. shown:
  15642. @example
  15643. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  15644. @end example
  15645. @end itemize
  15646. @subsection Commands
  15647. The filter supports the following commands:
  15648. @table @option
  15649. @item a, angle
  15650. Set the angle expression.
  15651. The command accepts the same syntax of the corresponding option.
  15652. If the specified expression is not valid, it is kept at its current
  15653. value.
  15654. @end table
  15655. @section sab
  15656. Apply Shape Adaptive Blur.
  15657. The filter accepts the following options:
  15658. @table @option
  15659. @item luma_radius, lr
  15660. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  15661. value is 1.0. A greater value will result in a more blurred image, and
  15662. in slower processing.
  15663. @item luma_pre_filter_radius, lpfr
  15664. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  15665. value is 1.0.
  15666. @item luma_strength, ls
  15667. Set luma maximum difference between pixels to still be considered, must
  15668. be a value in the 0.1-100.0 range, default value is 1.0.
  15669. @item chroma_radius, cr
  15670. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  15671. greater value will result in a more blurred image, and in slower
  15672. processing.
  15673. @item chroma_pre_filter_radius, cpfr
  15674. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  15675. @item chroma_strength, cs
  15676. Set chroma maximum difference between pixels to still be considered,
  15677. must be a value in the -0.9-100.0 range.
  15678. @end table
  15679. Each chroma option value, if not explicitly specified, is set to the
  15680. corresponding luma option value.
  15681. @anchor{scale}
  15682. @section scale
  15683. Scale (resize) the input video, using the libswscale library.
  15684. The scale filter forces the output display aspect ratio to be the same
  15685. of the input, by changing the output sample aspect ratio.
  15686. If the input image format is different from the format requested by
  15687. the next filter, the scale filter will convert the input to the
  15688. requested format.
  15689. @subsection Options
  15690. The filter accepts the following options, or any of the options
  15691. supported by the libswscale scaler.
  15692. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  15693. the complete list of scaler options.
  15694. @table @option
  15695. @item width, w
  15696. @item height, h
  15697. Set the output video dimension expression. Default value is the input
  15698. dimension.
  15699. If the @var{width} or @var{w} value is 0, the input width is used for
  15700. the output. If the @var{height} or @var{h} value is 0, the input height
  15701. is used for the output.
  15702. If one and only one of the values is -n with n >= 1, the scale filter
  15703. will use a value that maintains the aspect ratio of the input image,
  15704. calculated from the other specified dimension. After that it will,
  15705. however, make sure that the calculated dimension is divisible by n and
  15706. adjust the value if necessary.
  15707. If both values are -n with n >= 1, the behavior will be identical to
  15708. both values being set to 0 as previously detailed.
  15709. See below for the list of accepted constants for use in the dimension
  15710. expression.
  15711. @item eval
  15712. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15713. @table @samp
  15714. @item init
  15715. Only evaluate expressions once during the filter initialization or when a command is processed.
  15716. @item frame
  15717. Evaluate expressions for each incoming frame.
  15718. @end table
  15719. Default value is @samp{init}.
  15720. @item interl
  15721. Set the interlacing mode. It accepts the following values:
  15722. @table @samp
  15723. @item 1
  15724. Force interlaced aware scaling.
  15725. @item 0
  15726. Do not apply interlaced scaling.
  15727. @item -1
  15728. Select interlaced aware scaling depending on whether the source frames
  15729. are flagged as interlaced or not.
  15730. @end table
  15731. Default value is @samp{0}.
  15732. @item flags
  15733. Set libswscale scaling flags. See
  15734. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15735. complete list of values. If not explicitly specified the filter applies
  15736. the default flags.
  15737. @item param0, param1
  15738. Set libswscale input parameters for scaling algorithms that need them. See
  15739. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15740. complete documentation. If not explicitly specified the filter applies
  15741. empty parameters.
  15742. @item size, s
  15743. Set the video size. For the syntax of this option, check the
  15744. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15745. @item in_color_matrix
  15746. @item out_color_matrix
  15747. Set in/output YCbCr color space type.
  15748. This allows the autodetected value to be overridden as well as allows forcing
  15749. a specific value used for the output and encoder.
  15750. If not specified, the color space type depends on the pixel format.
  15751. Possible values:
  15752. @table @samp
  15753. @item auto
  15754. Choose automatically.
  15755. @item bt709
  15756. Format conforming to International Telecommunication Union (ITU)
  15757. Recommendation BT.709.
  15758. @item fcc
  15759. Set color space conforming to the United States Federal Communications
  15760. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  15761. @item bt601
  15762. @item bt470
  15763. @item smpte170m
  15764. Set color space conforming to:
  15765. @itemize
  15766. @item
  15767. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  15768. @item
  15769. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  15770. @item
  15771. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  15772. @end itemize
  15773. @item smpte240m
  15774. Set color space conforming to SMPTE ST 240:1999.
  15775. @item bt2020
  15776. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  15777. @end table
  15778. @item in_range
  15779. @item out_range
  15780. Set in/output YCbCr sample range.
  15781. This allows the autodetected value to be overridden as well as allows forcing
  15782. a specific value used for the output and encoder. If not specified, the
  15783. range depends on the pixel format. Possible values:
  15784. @table @samp
  15785. @item auto/unknown
  15786. Choose automatically.
  15787. @item jpeg/full/pc
  15788. Set full range (0-255 in case of 8-bit luma).
  15789. @item mpeg/limited/tv
  15790. Set "MPEG" range (16-235 in case of 8-bit luma).
  15791. @end table
  15792. @item force_original_aspect_ratio
  15793. Enable decreasing or increasing output video width or height if necessary to
  15794. keep the original aspect ratio. Possible values:
  15795. @table @samp
  15796. @item disable
  15797. Scale the video as specified and disable this feature.
  15798. @item decrease
  15799. The output video dimensions will automatically be decreased if needed.
  15800. @item increase
  15801. The output video dimensions will automatically be increased if needed.
  15802. @end table
  15803. One useful instance of this option is that when you know a specific device's
  15804. maximum allowed resolution, you can use this to limit the output video to
  15805. that, while retaining the aspect ratio. For example, device A allows
  15806. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15807. decrease) and specifying 1280x720 to the command line makes the output
  15808. 1280x533.
  15809. Please note that this is a different thing than specifying -1 for @option{w}
  15810. or @option{h}, you still need to specify the output resolution for this option
  15811. to work.
  15812. @item force_divisible_by
  15813. Ensures that both the output dimensions, width and height, are divisible by the
  15814. given integer when used together with @option{force_original_aspect_ratio}. This
  15815. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15816. This option respects the value set for @option{force_original_aspect_ratio},
  15817. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15818. may be slightly modified.
  15819. This option can be handy if you need to have a video fit within or exceed
  15820. a defined resolution using @option{force_original_aspect_ratio} but also have
  15821. encoder restrictions on width or height divisibility.
  15822. @end table
  15823. The values of the @option{w} and @option{h} options are expressions
  15824. containing the following constants:
  15825. @table @var
  15826. @item in_w
  15827. @item in_h
  15828. The input width and height
  15829. @item iw
  15830. @item ih
  15831. These are the same as @var{in_w} and @var{in_h}.
  15832. @item out_w
  15833. @item out_h
  15834. The output (scaled) width and height
  15835. @item ow
  15836. @item oh
  15837. These are the same as @var{out_w} and @var{out_h}
  15838. @item a
  15839. The same as @var{iw} / @var{ih}
  15840. @item sar
  15841. input sample aspect ratio
  15842. @item dar
  15843. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15844. @item hsub
  15845. @item vsub
  15846. horizontal and vertical input chroma subsample values. For example for the
  15847. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15848. @item ohsub
  15849. @item ovsub
  15850. horizontal and vertical output chroma subsample values. For example for the
  15851. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15852. @item n
  15853. The (sequential) number of the input frame, starting from 0.
  15854. Only available with @code{eval=frame}.
  15855. @item t
  15856. The presentation timestamp of the input frame, expressed as a number of
  15857. seconds. Only available with @code{eval=frame}.
  15858. @item pos
  15859. The position (byte offset) of the frame in the input stream, or NaN if
  15860. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15861. Only available with @code{eval=frame}.
  15862. Deprecated, do not use.
  15863. @end table
  15864. @subsection Examples
  15865. @itemize
  15866. @item
  15867. Scale the input video to a size of 200x100
  15868. @example
  15869. scale=w=200:h=100
  15870. @end example
  15871. This is equivalent to:
  15872. @example
  15873. scale=200:100
  15874. @end example
  15875. or:
  15876. @example
  15877. scale=200x100
  15878. @end example
  15879. @item
  15880. Specify a size abbreviation for the output size:
  15881. @example
  15882. scale=qcif
  15883. @end example
  15884. which can also be written as:
  15885. @example
  15886. scale=size=qcif
  15887. @end example
  15888. @item
  15889. Scale the input to 2x:
  15890. @example
  15891. scale=w=2*iw:h=2*ih
  15892. @end example
  15893. @item
  15894. The above is the same as:
  15895. @example
  15896. scale=2*in_w:2*in_h
  15897. @end example
  15898. @item
  15899. Scale the input to 2x with forced interlaced scaling:
  15900. @example
  15901. scale=2*iw:2*ih:interl=1
  15902. @end example
  15903. @item
  15904. Scale the input to half size:
  15905. @example
  15906. scale=w=iw/2:h=ih/2
  15907. @end example
  15908. @item
  15909. Increase the width, and set the height to the same size:
  15910. @example
  15911. scale=3/2*iw:ow
  15912. @end example
  15913. @item
  15914. Seek Greek harmony:
  15915. @example
  15916. scale=iw:1/PHI*iw
  15917. scale=ih*PHI:ih
  15918. @end example
  15919. @item
  15920. Increase the height, and set the width to 3/2 of the height:
  15921. @example
  15922. scale=w=3/2*oh:h=3/5*ih
  15923. @end example
  15924. @item
  15925. Increase the size, making the size a multiple of the chroma
  15926. subsample values:
  15927. @example
  15928. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  15929. @end example
  15930. @item
  15931. Increase the width to a maximum of 500 pixels,
  15932. keeping the same aspect ratio as the input:
  15933. @example
  15934. scale=w='min(500\, iw*3/2):h=-1'
  15935. @end example
  15936. @item
  15937. Make pixels square by combining scale and setsar:
  15938. @example
  15939. scale='trunc(ih*dar):ih',setsar=1/1
  15940. @end example
  15941. @item
  15942. Make pixels square by combining scale and setsar,
  15943. making sure the resulting resolution is even (required by some codecs):
  15944. @example
  15945. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  15946. @end example
  15947. @end itemize
  15948. @subsection Commands
  15949. This filter supports the following commands:
  15950. @table @option
  15951. @item width, w
  15952. @item height, h
  15953. Set the output video dimension expression.
  15954. The command accepts the same syntax of the corresponding option.
  15955. If the specified expression is not valid, it is kept at its current
  15956. value.
  15957. @end table
  15958. @anchor{scale_cuda}
  15959. @section scale_cuda
  15960. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  15961. Setting the output width and height works in the same way as for the @ref{scale} filter.
  15962. The filter accepts the following options:
  15963. @table @option
  15964. @item w
  15965. @item h
  15966. Set the output video dimension expression. Default value is the input dimension.
  15967. Allows for the same expressions as the @ref{scale} filter.
  15968. @item interp_algo
  15969. Sets the algorithm used for scaling:
  15970. @table @var
  15971. @item nearest
  15972. Nearest neighbour
  15973. Used by default if input parameters match the desired output.
  15974. @item bilinear
  15975. Bilinear
  15976. @item bicubic
  15977. Bicubic
  15978. This is the default.
  15979. @item lanczos
  15980. Lanczos
  15981. @end table
  15982. @item format
  15983. Controls the output pixel format. By default, or if none is specified, the input
  15984. pixel format is used.
  15985. The filter does not support converting between YUV and RGB pixel formats.
  15986. @item passthrough
  15987. If set to 0, every frame is processed, even if no conversion is neccesary.
  15988. This mode can be useful to use the filter as a buffer for a downstream
  15989. frame-consumer that exhausts the limited decoder frame pool.
  15990. If set to 1, frames are passed through as-is if they match the desired output
  15991. parameters. This is the default behaviour.
  15992. @item param
  15993. Algorithm-Specific parameter.
  15994. Affects the curves of the bicubic algorithm.
  15995. @item force_original_aspect_ratio
  15996. @item force_divisible_by
  15997. Work the same as the identical @ref{scale} filter options.
  15998. @end table
  15999. @subsection Examples
  16000. @itemize
  16001. @item
  16002. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  16003. @example
  16004. scale_cuda=-2:720:format=yuv420p
  16005. @end example
  16006. @item
  16007. Upscale to 4K using nearest neighbour algorithm.
  16008. @example
  16009. scale_cuda=4096:2160:interp_algo=nearest
  16010. @end example
  16011. @item
  16012. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  16013. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  16014. decoders frame pool.
  16015. @example
  16016. scale_cuda=passthrough=0
  16017. @end example
  16018. @end itemize
  16019. @anchor{scale_npp}
  16020. @section scale_npp
  16021. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  16022. format conversion on CUDA video frames. Setting the output width and height
  16023. works in the same way as for the @var{scale} filter.
  16024. The following additional options are accepted:
  16025. @table @option
  16026. @item format
  16027. The pixel format of the output CUDA frames. If set to the string "same" (the
  16028. default), the input format will be kept. Note that automatic format negotiation
  16029. and conversion is not yet supported for hardware frames
  16030. @item interp_algo
  16031. The interpolation algorithm used for resizing. One of the following:
  16032. @table @option
  16033. @item nn
  16034. Nearest neighbour.
  16035. @item linear
  16036. @item cubic
  16037. @item cubic2p_bspline
  16038. 2-parameter cubic (B=1, C=0)
  16039. @item cubic2p_catmullrom
  16040. 2-parameter cubic (B=0, C=1/2)
  16041. @item cubic2p_b05c03
  16042. 2-parameter cubic (B=1/2, C=3/10)
  16043. @item super
  16044. Supersampling
  16045. @item lanczos
  16046. @end table
  16047. @item force_original_aspect_ratio
  16048. Enable decreasing or increasing output video width or height if necessary to
  16049. keep the original aspect ratio. Possible values:
  16050. @table @samp
  16051. @item disable
  16052. Scale the video as specified and disable this feature.
  16053. @item decrease
  16054. The output video dimensions will automatically be decreased if needed.
  16055. @item increase
  16056. The output video dimensions will automatically be increased if needed.
  16057. @end table
  16058. One useful instance of this option is that when you know a specific device's
  16059. maximum allowed resolution, you can use this to limit the output video to
  16060. that, while retaining the aspect ratio. For example, device A allows
  16061. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  16062. decrease) and specifying 1280x720 to the command line makes the output
  16063. 1280x533.
  16064. Please note that this is a different thing than specifying -1 for @option{w}
  16065. or @option{h}, you still need to specify the output resolution for this option
  16066. to work.
  16067. @item force_divisible_by
  16068. Ensures that both the output dimensions, width and height, are divisible by the
  16069. given integer when used together with @option{force_original_aspect_ratio}. This
  16070. works similar to using @code{-n} in the @option{w} and @option{h} options.
  16071. This option respects the value set for @option{force_original_aspect_ratio},
  16072. increasing or decreasing the resolution accordingly. The video's aspect ratio
  16073. may be slightly modified.
  16074. This option can be handy if you need to have a video fit within or exceed
  16075. a defined resolution using @option{force_original_aspect_ratio} but also have
  16076. encoder restrictions on width or height divisibility.
  16077. @item eval
  16078. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  16079. @table @samp
  16080. @item init
  16081. Only evaluate expressions once during the filter initialization or when a command is processed.
  16082. @item frame
  16083. Evaluate expressions for each incoming frame.
  16084. @end table
  16085. @end table
  16086. The values of the @option{w} and @option{h} options are expressions
  16087. containing the following constants:
  16088. @table @var
  16089. @item in_w
  16090. @item in_h
  16091. The input width and height
  16092. @item iw
  16093. @item ih
  16094. These are the same as @var{in_w} and @var{in_h}.
  16095. @item out_w
  16096. @item out_h
  16097. The output (scaled) width and height
  16098. @item ow
  16099. @item oh
  16100. These are the same as @var{out_w} and @var{out_h}
  16101. @item a
  16102. The same as @var{iw} / @var{ih}
  16103. @item sar
  16104. input sample aspect ratio
  16105. @item dar
  16106. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16107. @item n
  16108. The (sequential) number of the input frame, starting from 0.
  16109. Only available with @code{eval=frame}.
  16110. @item t
  16111. The presentation timestamp of the input frame, expressed as a number of
  16112. seconds. Only available with @code{eval=frame}.
  16113. @item pos
  16114. The position (byte offset) of the frame in the input stream, or NaN if
  16115. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16116. Only available with @code{eval=frame}.
  16117. Deprecated, do not use.
  16118. @end table
  16119. @section scale2ref
  16120. Scale (resize) the input video, based on a reference video.
  16121. See the scale filter for available options, scale2ref supports the same but
  16122. uses the reference video instead of the main input as basis. scale2ref also
  16123. supports the following additional constants for the @option{w} and
  16124. @option{h} options:
  16125. @table @var
  16126. @item main_w
  16127. @item main_h
  16128. The main input video's width and height
  16129. @item main_a
  16130. The same as @var{main_w} / @var{main_h}
  16131. @item main_sar
  16132. The main input video's sample aspect ratio
  16133. @item main_dar, mdar
  16134. The main input video's display aspect ratio. Calculated from
  16135. @code{(main_w / main_h) * main_sar}.
  16136. @item main_hsub
  16137. @item main_vsub
  16138. The main input video's horizontal and vertical chroma subsample values.
  16139. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  16140. is 1.
  16141. @item main_n
  16142. The (sequential) number of the main input frame, starting from 0.
  16143. Only available with @code{eval=frame}.
  16144. @item main_t
  16145. The presentation timestamp of the main input frame, expressed as a number of
  16146. seconds. Only available with @code{eval=frame}.
  16147. @item main_pos
  16148. The position (byte offset) of the frame in the main input stream, or NaN if
  16149. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16150. Only available with @code{eval=frame}.
  16151. @end table
  16152. @subsection Examples
  16153. @itemize
  16154. @item
  16155. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  16156. @example
  16157. 'scale2ref[b][a];[a][b]overlay'
  16158. @end example
  16159. @item
  16160. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  16161. @example
  16162. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  16163. @end example
  16164. @end itemize
  16165. @subsection Commands
  16166. This filter supports the following commands:
  16167. @table @option
  16168. @item width, w
  16169. @item height, h
  16170. Set the output video dimension expression.
  16171. The command accepts the same syntax of the corresponding option.
  16172. If the specified expression is not valid, it is kept at its current
  16173. value.
  16174. @end table
  16175. @section scale2ref_npp
  16176. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  16177. video, based on a reference video.
  16178. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  16179. but uses the reference video instead of the main input as basis. scale2ref_npp
  16180. also supports the following additional constants for the @option{w} and
  16181. @option{h} options:
  16182. @table @var
  16183. @item main_w
  16184. @item main_h
  16185. The main input video's width and height
  16186. @item main_a
  16187. The same as @var{main_w} / @var{main_h}
  16188. @item main_sar
  16189. The main input video's sample aspect ratio
  16190. @item main_dar, mdar
  16191. The main input video's display aspect ratio. Calculated from
  16192. @code{(main_w / main_h) * main_sar}.
  16193. @item main_n
  16194. The (sequential) number of the main input frame, starting from 0.
  16195. Only available with @code{eval=frame}.
  16196. @item main_t
  16197. The presentation timestamp of the main input frame, expressed as a number of
  16198. seconds. Only available with @code{eval=frame}.
  16199. @item main_pos
  16200. The position (byte offset) of the frame in the main input stream, or NaN if
  16201. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16202. Only available with @code{eval=frame}.
  16203. @end table
  16204. @subsection Examples
  16205. @itemize
  16206. @item
  16207. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  16208. @example
  16209. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  16210. @end example
  16211. @item
  16212. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  16213. @example
  16214. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  16215. @end example
  16216. @end itemize
  16217. @section scale_vt
  16218. Scale and convert the color parameters using VTPixelTransferSession.
  16219. The filter accepts the following options:
  16220. @table @option
  16221. @item w
  16222. @item h
  16223. Set the output video dimension expression. Default value is the input dimension.
  16224. @item color_matrix
  16225. Set the output colorspace matrix.
  16226. @item color_primaries
  16227. Set the output color primaries.
  16228. @item color_transfer
  16229. Set the output transfer characteristics.
  16230. @end table
  16231. @section scharr
  16232. Apply scharr operator to input video stream.
  16233. The filter accepts the following option:
  16234. @table @option
  16235. @item planes
  16236. Set which planes will be processed, unprocessed planes will be copied.
  16237. By default value 0xf, all planes will be processed.
  16238. @item scale
  16239. Set value which will be multiplied with filtered result.
  16240. @item delta
  16241. Set value which will be added to filtered result.
  16242. @end table
  16243. @subsection Commands
  16244. This filter supports the all above options as @ref{commands}.
  16245. @section scroll
  16246. Scroll input video horizontally and/or vertically by constant speed.
  16247. The filter accepts the following options:
  16248. @table @option
  16249. @item horizontal, h
  16250. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16251. Negative values changes scrolling direction.
  16252. @item vertical, v
  16253. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16254. Negative values changes scrolling direction.
  16255. @item hpos
  16256. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  16257. @item vpos
  16258. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  16259. @end table
  16260. @subsection Commands
  16261. This filter supports the following @ref{commands}:
  16262. @table @option
  16263. @item horizontal, h
  16264. Set the horizontal scrolling speed.
  16265. @item vertical, v
  16266. Set the vertical scrolling speed.
  16267. @end table
  16268. @anchor{scdet}
  16269. @section scdet
  16270. Detect video scene change.
  16271. This filter sets frame metadata with mafd between frame, the scene score, and
  16272. forward the frame to the next filter, so they can use these metadata to detect
  16273. scene change or others.
  16274. In addition, this filter logs a message and sets frame metadata when it detects
  16275. a scene change by @option{threshold}.
  16276. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  16277. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  16278. to detect scene change.
  16279. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  16280. detect scene change with @option{threshold}.
  16281. The filter accepts the following options:
  16282. @table @option
  16283. @item threshold, t
  16284. Set the scene change detection threshold as a percentage of maximum change. Good
  16285. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  16286. @code{[0., 100.]}.
  16287. Default value is @code{10.}.
  16288. @item sc_pass, s
  16289. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  16290. You can enable it if you want to get snapshot of scene change frames only.
  16291. @end table
  16292. @anchor{selectivecolor}
  16293. @section selectivecolor
  16294. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  16295. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  16296. by the "purity" of the color (that is, how saturated it already is).
  16297. This filter is similar to the Adobe Photoshop Selective Color tool.
  16298. The filter accepts the following options:
  16299. @table @option
  16300. @item correction_method
  16301. Select color correction method.
  16302. Available values are:
  16303. @table @samp
  16304. @item absolute
  16305. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  16306. component value).
  16307. @item relative
  16308. Specified adjustments are relative to the original component value.
  16309. @end table
  16310. Default is @code{absolute}.
  16311. @item reds
  16312. Adjustments for red pixels (pixels where the red component is the maximum)
  16313. @item yellows
  16314. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  16315. @item greens
  16316. Adjustments for green pixels (pixels where the green component is the maximum)
  16317. @item cyans
  16318. Adjustments for cyan pixels (pixels where the red component is the minimum)
  16319. @item blues
  16320. Adjustments for blue pixels (pixels where the blue component is the maximum)
  16321. @item magentas
  16322. Adjustments for magenta pixels (pixels where the green component is the minimum)
  16323. @item whites
  16324. Adjustments for white pixels (pixels where all components are greater than 128)
  16325. @item neutrals
  16326. Adjustments for all pixels except pure black and pure white
  16327. @item blacks
  16328. Adjustments for black pixels (pixels where all components are lesser than 128)
  16329. @item psfile
  16330. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  16331. @end table
  16332. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  16333. 4 space separated floating point adjustment values in the [-1,1] range,
  16334. respectively to adjust the amount of cyan, magenta, yellow and black for the
  16335. pixels of its range.
  16336. @subsection Examples
  16337. @itemize
  16338. @item
  16339. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  16340. increase magenta by 27% in blue areas:
  16341. @example
  16342. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  16343. @end example
  16344. @item
  16345. Use a Photoshop selective color preset:
  16346. @example
  16347. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  16348. @end example
  16349. @end itemize
  16350. @anchor{separatefields}
  16351. @section separatefields
  16352. The @code{separatefields} takes a frame-based video input and splits
  16353. each frame into its components fields, producing a new half height clip
  16354. with twice the frame rate and twice the frame count.
  16355. This filter use field-dominance information in frame to decide which
  16356. of each pair of fields to place first in the output.
  16357. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  16358. @section setdar, setsar
  16359. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  16360. output video.
  16361. This is done by changing the specified Sample (aka Pixel) Aspect
  16362. Ratio, according to the following equation:
  16363. @example
  16364. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  16365. @end example
  16366. Keep in mind that the @code{setdar} filter does not modify the pixel
  16367. dimensions of the video frame. Also, the display aspect ratio set by
  16368. this filter may be changed by later filters in the filterchain,
  16369. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  16370. applied.
  16371. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  16372. the filter output video.
  16373. Note that as a consequence of the application of this filter, the
  16374. output display aspect ratio will change according to the equation
  16375. above.
  16376. Keep in mind that the sample aspect ratio set by the @code{setsar}
  16377. filter may be changed by later filters in the filterchain, e.g. if
  16378. another "setsar" or a "setdar" filter is applied.
  16379. It accepts the following parameters:
  16380. @table @option
  16381. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  16382. Set the aspect ratio used by the filter.
  16383. The parameter can be a floating point number string, or an expression. If the
  16384. parameter is not specified, the value "0" is assumed, meaning that the same
  16385. input value is used.
  16386. @item max
  16387. Set the maximum integer value to use for expressing numerator and
  16388. denominator when reducing the expressed aspect ratio to a rational.
  16389. Default value is @code{100}.
  16390. @end table
  16391. The parameter @var{sar} is an expression containing the following constants:
  16392. @table @option
  16393. @item w, h
  16394. The input width and height.
  16395. @item a
  16396. Same as @var{w} / @var{h}.
  16397. @item sar
  16398. The input sample aspect ratio.
  16399. @item dar
  16400. The input display aspect ratio. It is the same as
  16401. (@var{w} / @var{h}) * @var{sar}.
  16402. @item hsub, vsub
  16403. Horizontal and vertical chroma subsample values. For example, for the
  16404. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16405. @end table
  16406. @subsection Examples
  16407. @itemize
  16408. @item
  16409. To change the display aspect ratio to 16:9, specify one of the following:
  16410. @example
  16411. setdar=dar=1.77777
  16412. setdar=dar=16/9
  16413. @end example
  16414. @item
  16415. To change the sample aspect ratio to 10:11, specify:
  16416. @example
  16417. setsar=sar=10/11
  16418. @end example
  16419. @item
  16420. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  16421. 1000 in the aspect ratio reduction, use the command:
  16422. @example
  16423. setdar=ratio=16/9:max=1000
  16424. @end example
  16425. @end itemize
  16426. @anchor{setfield}
  16427. @section setfield
  16428. Force field for the output video frame.
  16429. The @code{setfield} filter marks the interlace type field for the
  16430. output frames. It does not change the input frame, but only sets the
  16431. corresponding property, which affects how the frame is treated by
  16432. following filters (e.g. @code{fieldorder} or @code{yadif}).
  16433. The filter accepts the following options:
  16434. @table @option
  16435. @item mode
  16436. Available values are:
  16437. @table @samp
  16438. @item auto
  16439. Keep the same field property.
  16440. @item bff
  16441. Mark the frame as bottom-field-first.
  16442. @item tff
  16443. Mark the frame as top-field-first.
  16444. @item prog
  16445. Mark the frame as progressive.
  16446. @end table
  16447. @end table
  16448. @anchor{setparams}
  16449. @section setparams
  16450. Force frame parameter for the output video frame.
  16451. The @code{setparams} filter marks interlace and color range for the
  16452. output frames. It does not change the input frame, but only sets the
  16453. corresponding property, which affects how the frame is treated by
  16454. filters/encoders.
  16455. @table @option
  16456. @item field_mode
  16457. Available values are:
  16458. @table @samp
  16459. @item auto
  16460. Keep the same field property (default).
  16461. @item bff
  16462. Mark the frame as bottom-field-first.
  16463. @item tff
  16464. Mark the frame as top-field-first.
  16465. @item prog
  16466. Mark the frame as progressive.
  16467. @end table
  16468. @item range
  16469. Available values are:
  16470. @table @samp
  16471. @item auto
  16472. Keep the same color range property (default).
  16473. @item unspecified, unknown
  16474. Mark the frame as unspecified color range.
  16475. @item limited, tv, mpeg
  16476. Mark the frame as limited range.
  16477. @item full, pc, jpeg
  16478. Mark the frame as full range.
  16479. @end table
  16480. @item color_primaries
  16481. Set the color primaries.
  16482. Available values are:
  16483. @table @samp
  16484. @item auto
  16485. Keep the same color primaries property (default).
  16486. @item bt709
  16487. @item unknown
  16488. @item bt470m
  16489. @item bt470bg
  16490. @item smpte170m
  16491. @item smpte240m
  16492. @item film
  16493. @item bt2020
  16494. @item smpte428
  16495. @item smpte431
  16496. @item smpte432
  16497. @item jedec-p22
  16498. @end table
  16499. @item color_trc
  16500. Set the color transfer.
  16501. Available values are:
  16502. @table @samp
  16503. @item auto
  16504. Keep the same color trc property (default).
  16505. @item bt709
  16506. @item unknown
  16507. @item bt470m
  16508. @item bt470bg
  16509. @item smpte170m
  16510. @item smpte240m
  16511. @item linear
  16512. @item log100
  16513. @item log316
  16514. @item iec61966-2-4
  16515. @item bt1361e
  16516. @item iec61966-2-1
  16517. @item bt2020-10
  16518. @item bt2020-12
  16519. @item smpte2084
  16520. @item smpte428
  16521. @item arib-std-b67
  16522. @end table
  16523. @item colorspace
  16524. Set the colorspace.
  16525. Available values are:
  16526. @table @samp
  16527. @item auto
  16528. Keep the same colorspace property (default).
  16529. @item gbr
  16530. @item bt709
  16531. @item unknown
  16532. @item fcc
  16533. @item bt470bg
  16534. @item smpte170m
  16535. @item smpte240m
  16536. @item ycgco
  16537. @item bt2020nc
  16538. @item bt2020c
  16539. @item smpte2085
  16540. @item chroma-derived-nc
  16541. @item chroma-derived-c
  16542. @item ictcp
  16543. @end table
  16544. @end table
  16545. @section sharpen_npp
  16546. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  16547. border control.
  16548. The following additional options are accepted:
  16549. @table @option
  16550. @item border_type
  16551. Type of sampling to be used ad frame borders. One of the following:
  16552. @table @option
  16553. @item replicate
  16554. Replicate pixel values.
  16555. @end table
  16556. @end table
  16557. @section shear
  16558. Apply shear transform to input video.
  16559. This filter supports the following options:
  16560. @table @option
  16561. @item shx
  16562. Shear factor in X-direction. Default value is 0.
  16563. Allowed range is from -2 to 2.
  16564. @item shy
  16565. Shear factor in Y-direction. Default value is 0.
  16566. Allowed range is from -2 to 2.
  16567. @item fillcolor, c
  16568. Set the color used to fill the output area not covered by the transformed
  16569. video. For the general syntax of this option, check the
  16570. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16571. If the special value "none" is selected then no
  16572. background is printed (useful for example if the background is never shown).
  16573. Default value is "black".
  16574. @item interp
  16575. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  16576. @end table
  16577. @subsection Commands
  16578. This filter supports the all above options as @ref{commands}.
  16579. @section showinfo
  16580. Show a line containing various information for each input video frame.
  16581. The input video is not modified.
  16582. This filter supports the following options:
  16583. @table @option
  16584. @item checksum
  16585. Calculate checksums of each plane. By default enabled.
  16586. @end table
  16587. The shown line contains a sequence of key/value pairs of the form
  16588. @var{key}:@var{value}.
  16589. The following values are shown in the output:
  16590. @table @option
  16591. @item n
  16592. The (sequential) number of the input frame, starting from 0.
  16593. @item pts
  16594. The Presentation TimeStamp of the input frame, expressed as a number of
  16595. time base units. The time base unit depends on the filter input pad.
  16596. @item pts_time
  16597. The Presentation TimeStamp of the input frame, expressed as a number of
  16598. seconds.
  16599. @item fmt
  16600. The pixel format name.
  16601. @item sar
  16602. The sample aspect ratio of the input frame, expressed in the form
  16603. @var{num}/@var{den}.
  16604. @item s
  16605. The size of the input frame. For the syntax of this option, check the
  16606. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16607. @item i
  16608. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  16609. for bottom field first).
  16610. @item iskey
  16611. This is 1 if the frame is a key frame, 0 otherwise.
  16612. @item type
  16613. The picture type of the input frame ("I" for an I-frame, "P" for a
  16614. P-frame, "B" for a B-frame, or "?" for an unknown type).
  16615. Also refer to the documentation of the @code{AVPictureType} enum and of
  16616. the @code{av_get_picture_type_char} function defined in
  16617. @file{libavutil/avutil.h}.
  16618. @item checksum
  16619. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  16620. @item plane_checksum
  16621. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  16622. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  16623. @item mean
  16624. The mean value of pixels in each plane of the input frame, expressed in the form
  16625. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  16626. @item stdev
  16627. The standard deviation of pixel values in each plane of the input frame, expressed
  16628. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  16629. @end table
  16630. @section showpalette
  16631. Displays the 256 colors palette of each frame. This filter is only relevant for
  16632. @var{pal8} pixel format frames.
  16633. It accepts the following option:
  16634. @table @option
  16635. @item s
  16636. Set the size of the box used to represent one palette color entry. Default is
  16637. @code{30} (for a @code{30x30} pixel box).
  16638. @end table
  16639. @section shuffleframes
  16640. Reorder and/or duplicate and/or drop video frames.
  16641. It accepts the following parameters:
  16642. @table @option
  16643. @item mapping
  16644. Set the destination indexes of input frames.
  16645. This is space or '|' separated list of indexes that maps input frames to output
  16646. frames. Number of indexes also sets maximal value that each index may have.
  16647. '-1' index have special meaning and that is to drop frame.
  16648. @end table
  16649. The first frame has the index 0. The default is to keep the input unchanged.
  16650. @subsection Examples
  16651. @itemize
  16652. @item
  16653. Swap second and third frame of every three frames of the input:
  16654. @example
  16655. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  16656. @end example
  16657. @item
  16658. Swap 10th and 1st frame of every ten frames of the input:
  16659. @example
  16660. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  16661. @end example
  16662. @end itemize
  16663. @section shufflepixels
  16664. Reorder pixels in video frames.
  16665. This filter accepts the following options:
  16666. @table @option
  16667. @item direction, d
  16668. Set shuffle direction. Can be forward or inverse direction.
  16669. Default direction is forward.
  16670. @item mode, m
  16671. Set shuffle mode. Can be horizontal, vertical or block mode.
  16672. @item width, w
  16673. @item height, h
  16674. Set shuffle block_size. In case of horizontal shuffle mode only width
  16675. part of size is used, and in case of vertical shuffle mode only height
  16676. part of size is used.
  16677. @item seed, s
  16678. Set random seed used with shuffling pixels. Mainly useful to set to be able
  16679. to reverse filtering process to get original input.
  16680. For example, to reverse forward shuffle you need to use same parameters
  16681. and exact same seed and to set direction to inverse.
  16682. @end table
  16683. @section shuffleplanes
  16684. Reorder and/or duplicate video planes.
  16685. It accepts the following parameters:
  16686. @table @option
  16687. @item map0
  16688. The index of the input plane to be used as the first output plane.
  16689. @item map1
  16690. The index of the input plane to be used as the second output plane.
  16691. @item map2
  16692. The index of the input plane to be used as the third output plane.
  16693. @item map3
  16694. The index of the input plane to be used as the fourth output plane.
  16695. @end table
  16696. The first plane has the index 0. The default is to keep the input unchanged.
  16697. @subsection Examples
  16698. @itemize
  16699. @item
  16700. Swap the second and third planes of the input:
  16701. @example
  16702. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  16703. @end example
  16704. @end itemize
  16705. @anchor{signalstats}
  16706. @section signalstats
  16707. Evaluate various visual metrics that assist in determining issues associated
  16708. with the digitization of analog video media.
  16709. By default the filter will log these metadata values:
  16710. @table @option
  16711. @item YMIN
  16712. Display the minimal Y value contained within the input frame. Expressed in
  16713. range of [0-255].
  16714. @item YLOW
  16715. Display the Y value at the 10% percentile within the input frame. Expressed in
  16716. range of [0-255].
  16717. @item YAVG
  16718. Display the average Y value within the input frame. Expressed in range of
  16719. [0-255].
  16720. @item YHIGH
  16721. Display the Y value at the 90% percentile within the input frame. Expressed in
  16722. range of [0-255].
  16723. @item YMAX
  16724. Display the maximum Y value contained within the input frame. Expressed in
  16725. range of [0-255].
  16726. @item UMIN
  16727. Display the minimal U value contained within the input frame. Expressed in
  16728. range of [0-255].
  16729. @item ULOW
  16730. Display the U value at the 10% percentile within the input frame. Expressed in
  16731. range of [0-255].
  16732. @item UAVG
  16733. Display the average U value within the input frame. Expressed in range of
  16734. [0-255].
  16735. @item UHIGH
  16736. Display the U value at the 90% percentile within the input frame. Expressed in
  16737. range of [0-255].
  16738. @item UMAX
  16739. Display the maximum U value contained within the input frame. Expressed in
  16740. range of [0-255].
  16741. @item VMIN
  16742. Display the minimal V value contained within the input frame. Expressed in
  16743. range of [0-255].
  16744. @item VLOW
  16745. Display the V value at the 10% percentile within the input frame. Expressed in
  16746. range of [0-255].
  16747. @item VAVG
  16748. Display the average V value within the input frame. Expressed in range of
  16749. [0-255].
  16750. @item VHIGH
  16751. Display the V value at the 90% percentile within the input frame. Expressed in
  16752. range of [0-255].
  16753. @item VMAX
  16754. Display the maximum V value contained within the input frame. Expressed in
  16755. range of [0-255].
  16756. @item SATMIN
  16757. Display the minimal saturation value contained within the input frame.
  16758. Expressed in range of [0-~181.02].
  16759. @item SATLOW
  16760. Display the saturation value at the 10% percentile within the input frame.
  16761. Expressed in range of [0-~181.02].
  16762. @item SATAVG
  16763. Display the average saturation value within the input frame. Expressed in range
  16764. of [0-~181.02].
  16765. @item SATHIGH
  16766. Display the saturation value at the 90% percentile within the input frame.
  16767. Expressed in range of [0-~181.02].
  16768. @item SATMAX
  16769. Display the maximum saturation value contained within the input frame.
  16770. Expressed in range of [0-~181.02].
  16771. @item HUEMED
  16772. Display the median value for hue within the input frame. Expressed in range of
  16773. [0-360].
  16774. @item HUEAVG
  16775. Display the average value for hue within the input frame. Expressed in range of
  16776. [0-360].
  16777. @item YDIF
  16778. Display the average of sample value difference between all values of the Y
  16779. plane in the current frame and corresponding values of the previous input frame.
  16780. Expressed in range of [0-255].
  16781. @item UDIF
  16782. Display the average of sample value difference between all values of the U
  16783. plane in the current frame and corresponding values of the previous input frame.
  16784. Expressed in range of [0-255].
  16785. @item VDIF
  16786. Display the average of sample value difference between all values of the V
  16787. plane in the current frame and corresponding values of the previous input frame.
  16788. Expressed in range of [0-255].
  16789. @item YBITDEPTH
  16790. Display bit depth of Y plane in current frame.
  16791. Expressed in range of [0-16].
  16792. @item UBITDEPTH
  16793. Display bit depth of U plane in current frame.
  16794. Expressed in range of [0-16].
  16795. @item VBITDEPTH
  16796. Display bit depth of V plane in current frame.
  16797. Expressed in range of [0-16].
  16798. @end table
  16799. The filter accepts the following options:
  16800. @table @option
  16801. @item stat
  16802. @item out
  16803. @option{stat} specify an additional form of image analysis.
  16804. @option{out} output video with the specified type of pixel highlighted.
  16805. Both options accept the following values:
  16806. @table @samp
  16807. @item tout
  16808. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  16809. unlike the neighboring pixels of the same field. Examples of temporal outliers
  16810. include the results of video dropouts, head clogs, or tape tracking issues.
  16811. @item vrep
  16812. Identify @var{vertical line repetition}. Vertical line repetition includes
  16813. similar rows of pixels within a frame. In born-digital video vertical line
  16814. repetition is common, but this pattern is uncommon in video digitized from an
  16815. analog source. When it occurs in video that results from the digitization of an
  16816. analog source it can indicate concealment from a dropout compensator.
  16817. @item brng
  16818. Identify pixels that fall outside of legal broadcast range.
  16819. @end table
  16820. @item color, c
  16821. Set the highlight color for the @option{out} option. The default color is
  16822. yellow.
  16823. @end table
  16824. @subsection Examples
  16825. @itemize
  16826. @item
  16827. Output data of various video metrics:
  16828. @example
  16829. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  16830. @end example
  16831. @item
  16832. Output specific data about the minimum and maximum values of the Y plane per frame:
  16833. @example
  16834. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  16835. @end example
  16836. @item
  16837. Playback video while highlighting pixels that are outside of broadcast range in red.
  16838. @example
  16839. ffplay example.mov -vf signalstats="out=brng:color=red"
  16840. @end example
  16841. @item
  16842. Playback video with signalstats metadata drawn over the frame.
  16843. @example
  16844. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  16845. @end example
  16846. The contents of signalstat_drawtext.txt used in the command are:
  16847. @example
  16848. time %@{pts:hms@}
  16849. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  16850. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  16851. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  16852. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  16853. @end example
  16854. @end itemize
  16855. @anchor{signature}
  16856. @section signature
  16857. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  16858. input. In this case the matching between the inputs can be calculated additionally.
  16859. The filter always passes through the first input. The signature of each stream can
  16860. be written into a file.
  16861. It accepts the following options:
  16862. @table @option
  16863. @item detectmode
  16864. Enable or disable the matching process.
  16865. Available values are:
  16866. @table @samp
  16867. @item off
  16868. Disable the calculation of a matching (default).
  16869. @item full
  16870. Calculate the matching for the whole video and output whether the whole video
  16871. matches or only parts.
  16872. @item fast
  16873. Calculate only until a matching is found or the video ends. Should be faster in
  16874. some cases.
  16875. @end table
  16876. @item nb_inputs
  16877. Set the number of inputs. The option value must be a non negative integer.
  16878. Default value is 1.
  16879. @item filename
  16880. Set the path to which the output is written. If there is more than one input,
  16881. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  16882. integer), that will be replaced with the input number. If no filename is
  16883. specified, no output will be written. This is the default.
  16884. @item format
  16885. Choose the output format.
  16886. Available values are:
  16887. @table @samp
  16888. @item binary
  16889. Use the specified binary representation (default).
  16890. @item xml
  16891. Use the specified xml representation.
  16892. @end table
  16893. @item th_d
  16894. Set threshold to detect one word as similar. The option value must be an integer
  16895. greater than zero. The default value is 9000.
  16896. @item th_dc
  16897. Set threshold to detect all words as similar. The option value must be an integer
  16898. greater than zero. The default value is 60000.
  16899. @item th_xh
  16900. Set threshold to detect frames as similar. The option value must be an integer
  16901. greater than zero. The default value is 116.
  16902. @item th_di
  16903. Set the minimum length of a sequence in frames to recognize it as matching
  16904. sequence. The option value must be a non negative integer value.
  16905. The default value is 0.
  16906. @item th_it
  16907. Set the minimum relation, that matching frames to all frames must have.
  16908. The option value must be a double value between 0 and 1. The default value is 0.5.
  16909. @end table
  16910. @subsection Examples
  16911. @itemize
  16912. @item
  16913. To calculate the signature of an input video and store it in signature.bin:
  16914. @example
  16915. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  16916. @end example
  16917. @item
  16918. To detect whether two videos match and store the signatures in XML format in
  16919. signature0.xml and signature1.xml:
  16920. @example
  16921. 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 -
  16922. @end example
  16923. @end itemize
  16924. @anchor{siti}
  16925. @section siti
  16926. Calculate Spatial Information (SI) and Temporal Information (TI) scores for a video,
  16927. as defined in ITU-T Rec. P.910 (11/21): Subjective video quality assessment methods
  16928. for multimedia applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
  16929. Note that this is a legacy implementation that corresponds to a superseded recommendation.
  16930. 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}
  16931. It accepts the following option:
  16932. @table @option
  16933. @item print_summary
  16934. If set to 1, Summary statistics will be printed to the console. Default 0.
  16935. @end table
  16936. @subsection Examples
  16937. @itemize
  16938. @item
  16939. To calculate SI/TI metrics and print summary:
  16940. @example
  16941. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  16942. @end example
  16943. @end itemize
  16944. @anchor{smartblur}
  16945. @section smartblur
  16946. Blur the input video without impacting the outlines.
  16947. It accepts the following options:
  16948. @table @option
  16949. @item luma_radius, lr
  16950. Set the luma radius. The option value must be a float number in
  16951. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16952. used to blur the image (slower if larger). Default value is 1.0.
  16953. @item luma_strength, ls
  16954. Set the luma strength. The option value must be a float number
  16955. in the range [-1.0,1.0] that configures the blurring. A value included
  16956. in [0.0,1.0] will blur the image whereas a value included in
  16957. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  16958. @item luma_threshold, lt
  16959. Set the luma threshold used as a coefficient to determine
  16960. whether a pixel should be blurred or not. The option value must be an
  16961. integer in the range [-30,30]. A value of 0 will filter all the image,
  16962. a value included in [0,30] will filter flat areas and a value included
  16963. in [-30,0] will filter edges. Default value is 0.
  16964. @item chroma_radius, cr
  16965. Set the chroma radius. The option value must be a float number in
  16966. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16967. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  16968. @item chroma_strength, cs
  16969. Set the chroma strength. The option value must be a float number
  16970. in the range [-1.0,1.0] that configures the blurring. A value included
  16971. in [0.0,1.0] will blur the image whereas a value included in
  16972. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  16973. @item chroma_threshold, ct
  16974. Set the chroma threshold used as a coefficient to determine
  16975. whether a pixel should be blurred or not. The option value must be an
  16976. integer in the range [-30,30]. A value of 0 will filter all the image,
  16977. a value included in [0,30] will filter flat areas and a value included
  16978. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  16979. @end table
  16980. If a chroma option is not explicitly set, the corresponding luma value
  16981. is set.
  16982. @section sobel
  16983. Apply sobel operator to input video stream.
  16984. The filter accepts the following option:
  16985. @table @option
  16986. @item planes
  16987. Set which planes will be processed, unprocessed planes will be copied.
  16988. By default value 0xf, all planes will be processed.
  16989. @item scale
  16990. Set value which will be multiplied with filtered result.
  16991. @item delta
  16992. Set value which will be added to filtered result.
  16993. @end table
  16994. @subsection Commands
  16995. This filter supports the all above options as @ref{commands}.
  16996. @anchor{spp}
  16997. @section spp
  16998. Apply a simple postprocessing filter that compresses and decompresses the image
  16999. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  17000. and average the results.
  17001. The filter accepts the following options:
  17002. @table @option
  17003. @item quality
  17004. Set quality. This option defines the number of levels for averaging. It accepts
  17005. an integer in the range 0-6. If set to @code{0}, the filter will have no
  17006. effect. A value of @code{6} means the higher quality. For each increment of
  17007. that value the speed drops by a factor of approximately 2. Default value is
  17008. @code{3}.
  17009. @item qp
  17010. Force a constant quantization parameter. If not set, the filter will use the QP
  17011. from the video stream (if available).
  17012. @item mode
  17013. Set thresholding mode. Available modes are:
  17014. @table @samp
  17015. @item hard
  17016. Set hard thresholding (default).
  17017. @item soft
  17018. Set soft thresholding (better de-ringing effect, but likely blurrier).
  17019. @end table
  17020. @item use_bframe_qp
  17021. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  17022. option may cause flicker since the B-Frames have often larger QP. Default is
  17023. @code{0} (not enabled).
  17024. @end table
  17025. @subsection Commands
  17026. This filter supports the following commands:
  17027. @table @option
  17028. @item quality, level
  17029. Set quality level. The value @code{max} can be used to set the maximum level,
  17030. currently @code{6}.
  17031. @end table
  17032. @anchor{sr}
  17033. @section sr
  17034. Scale the input by applying one of the super-resolution methods based on
  17035. convolutional neural networks. Supported models:
  17036. @itemize
  17037. @item
  17038. Super-Resolution Convolutional Neural Network model (SRCNN).
  17039. See @url{https://arxiv.org/abs/1501.00092}.
  17040. @item
  17041. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  17042. See @url{https://arxiv.org/abs/1609.05158}.
  17043. @end itemize
  17044. Training scripts as well as scripts for model file (.pb) saving can be found at
  17045. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  17046. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  17047. The filter accepts the following options:
  17048. @table @option
  17049. @item dnn_backend
  17050. Specify which DNN backend to use for model loading and execution. This option accepts
  17051. the following values:
  17052. @table @samp
  17053. @item tensorflow
  17054. TensorFlow backend. To enable this backend you
  17055. need to install the TensorFlow for C library (see
  17056. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  17057. @code{--enable-libtensorflow}
  17058. @end table
  17059. @item model
  17060. Set path to model file specifying network architecture and its parameters.
  17061. Note that different backends use different file formats. TensorFlow, OpenVINO backend
  17062. can load files for only its format.
  17063. @item scale_factor
  17064. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  17065. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  17066. input upscaled using bicubic upscaling with proper scale factor.
  17067. @end table
  17068. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  17069. @section ssim
  17070. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  17071. This filter takes in input two input videos, the first input is
  17072. considered the "main" source and is passed unchanged to the
  17073. output. The second input is used as a "reference" video for computing
  17074. the SSIM.
  17075. Both video inputs must have the same resolution and pixel format for
  17076. this filter to work correctly. Also it assumes that both inputs
  17077. have the same number of frames, which are compared one by one.
  17078. The filter stores the calculated SSIM of each frame.
  17079. The description of the accepted parameters follows.
  17080. @table @option
  17081. @item stats_file, f
  17082. If specified the filter will use the named file to save the SSIM of
  17083. each individual frame. When filename equals "-" the data is sent to
  17084. standard output.
  17085. @end table
  17086. The file printed if @var{stats_file} is selected, contains a sequence of
  17087. key/value pairs of the form @var{key}:@var{value} for each compared
  17088. couple of frames.
  17089. A description of each shown parameter follows:
  17090. @table @option
  17091. @item n
  17092. sequential number of the input frame, starting from 1
  17093. @item Y, U, V, R, G, B
  17094. SSIM of the compared frames for the component specified by the suffix.
  17095. @item All
  17096. SSIM of the compared frames for the whole frame.
  17097. @item dB
  17098. Same as above but in dB representation.
  17099. @end table
  17100. This filter also supports the @ref{framesync} options.
  17101. @subsection Examples
  17102. @itemize
  17103. @item
  17104. For example:
  17105. @example
  17106. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  17107. [main][ref] ssim="stats_file=stats.log" [out]
  17108. @end example
  17109. On this example the input file being processed is compared with the
  17110. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  17111. is stored in @file{stats.log}.
  17112. @item
  17113. Another example with both psnr and ssim at same time:
  17114. @example
  17115. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  17116. @end example
  17117. @item
  17118. Another example with different containers:
  17119. @example
  17120. 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 -
  17121. @end example
  17122. @end itemize
  17123. @section stereo3d
  17124. Convert between different stereoscopic image formats.
  17125. The filters accept the following options:
  17126. @table @option
  17127. @item in
  17128. Set stereoscopic image format of input.
  17129. Available values for input image formats are:
  17130. @table @samp
  17131. @item sbsl
  17132. side by side parallel (left eye left, right eye right)
  17133. @item sbsr
  17134. side by side crosseye (right eye left, left eye right)
  17135. @item sbs2l
  17136. side by side parallel with half width resolution
  17137. (left eye left, right eye right)
  17138. @item sbs2r
  17139. side by side crosseye with half width resolution
  17140. (right eye left, left eye right)
  17141. @item abl
  17142. @item tbl
  17143. above-below (left eye above, right eye below)
  17144. @item abr
  17145. @item tbr
  17146. above-below (right eye above, left eye below)
  17147. @item ab2l
  17148. @item tb2l
  17149. above-below with half height resolution
  17150. (left eye above, right eye below)
  17151. @item ab2r
  17152. @item tb2r
  17153. above-below with half height resolution
  17154. (right eye above, left eye below)
  17155. @item al
  17156. alternating frames (left eye first, right eye second)
  17157. @item ar
  17158. alternating frames (right eye first, left eye second)
  17159. @item irl
  17160. interleaved rows (left eye has top row, right eye starts on next row)
  17161. @item irr
  17162. interleaved rows (right eye has top row, left eye starts on next row)
  17163. @item icl
  17164. interleaved columns, left eye first
  17165. @item icr
  17166. interleaved columns, right eye first
  17167. Default value is @samp{sbsl}.
  17168. @end table
  17169. @item out
  17170. Set stereoscopic image format of output.
  17171. @table @samp
  17172. @item sbsl
  17173. side by side parallel (left eye left, right eye right)
  17174. @item sbsr
  17175. side by side crosseye (right eye left, left eye right)
  17176. @item sbs2l
  17177. side by side parallel with half width resolution
  17178. (left eye left, right eye right)
  17179. @item sbs2r
  17180. side by side crosseye with half width resolution
  17181. (right eye left, left eye right)
  17182. @item abl
  17183. @item tbl
  17184. above-below (left eye above, right eye below)
  17185. @item abr
  17186. @item tbr
  17187. above-below (right eye above, left eye below)
  17188. @item ab2l
  17189. @item tb2l
  17190. above-below with half height resolution
  17191. (left eye above, right eye below)
  17192. @item ab2r
  17193. @item tb2r
  17194. above-below with half height resolution
  17195. (right eye above, left eye below)
  17196. @item al
  17197. alternating frames (left eye first, right eye second)
  17198. @item ar
  17199. alternating frames (right eye first, left eye second)
  17200. @item irl
  17201. interleaved rows (left eye has top row, right eye starts on next row)
  17202. @item irr
  17203. interleaved rows (right eye has top row, left eye starts on next row)
  17204. @item arbg
  17205. anaglyph red/blue gray
  17206. (red filter on left eye, blue filter on right eye)
  17207. @item argg
  17208. anaglyph red/green gray
  17209. (red filter on left eye, green filter on right eye)
  17210. @item arcg
  17211. anaglyph red/cyan gray
  17212. (red filter on left eye, cyan filter on right eye)
  17213. @item arch
  17214. anaglyph red/cyan half colored
  17215. (red filter on left eye, cyan filter on right eye)
  17216. @item arcc
  17217. anaglyph red/cyan color
  17218. (red filter on left eye, cyan filter on right eye)
  17219. @item arcd
  17220. anaglyph red/cyan color optimized with the least squares projection of dubois
  17221. (red filter on left eye, cyan filter on right eye)
  17222. @item agmg
  17223. anaglyph green/magenta gray
  17224. (green filter on left eye, magenta filter on right eye)
  17225. @item agmh
  17226. anaglyph green/magenta half colored
  17227. (green filter on left eye, magenta filter on right eye)
  17228. @item agmc
  17229. anaglyph green/magenta colored
  17230. (green filter on left eye, magenta filter on right eye)
  17231. @item agmd
  17232. anaglyph green/magenta color optimized with the least squares projection of dubois
  17233. (green filter on left eye, magenta filter on right eye)
  17234. @item aybg
  17235. anaglyph yellow/blue gray
  17236. (yellow filter on left eye, blue filter on right eye)
  17237. @item aybh
  17238. anaglyph yellow/blue half colored
  17239. (yellow filter on left eye, blue filter on right eye)
  17240. @item aybc
  17241. anaglyph yellow/blue colored
  17242. (yellow filter on left eye, blue filter on right eye)
  17243. @item aybd
  17244. anaglyph yellow/blue color optimized with the least squares projection of dubois
  17245. (yellow filter on left eye, blue filter on right eye)
  17246. @item ml
  17247. mono output (left eye only)
  17248. @item mr
  17249. mono output (right eye only)
  17250. @item chl
  17251. checkerboard, left eye first
  17252. @item chr
  17253. checkerboard, right eye first
  17254. @item icl
  17255. interleaved columns, left eye first
  17256. @item icr
  17257. interleaved columns, right eye first
  17258. @item hdmi
  17259. HDMI frame pack
  17260. @end table
  17261. Default value is @samp{arcd}.
  17262. @end table
  17263. @subsection Examples
  17264. @itemize
  17265. @item
  17266. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  17267. @example
  17268. stereo3d=sbsl:aybd
  17269. @end example
  17270. @item
  17271. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  17272. @example
  17273. stereo3d=abl:sbsr
  17274. @end example
  17275. @end itemize
  17276. @section streamselect, astreamselect
  17277. Select video or audio streams.
  17278. The filter accepts the following options:
  17279. @table @option
  17280. @item inputs
  17281. Set number of inputs. Default is 2.
  17282. @item map
  17283. Set input indexes to remap to outputs.
  17284. @end table
  17285. @subsection Commands
  17286. The @code{streamselect} and @code{astreamselect} filter supports the following
  17287. commands:
  17288. @table @option
  17289. @item map
  17290. Set input indexes to remap to outputs.
  17291. @end table
  17292. @subsection Examples
  17293. @itemize
  17294. @item
  17295. Select first 5 seconds 1st stream and rest of time 2nd stream:
  17296. @example
  17297. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  17298. @end example
  17299. @item
  17300. Same as above, but for audio:
  17301. @example
  17302. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  17303. @end example
  17304. @end itemize
  17305. @anchor{subtitles}
  17306. @section subtitles
  17307. Draw subtitles on top of input video using the libass library.
  17308. To enable compilation of this filter you need to configure FFmpeg with
  17309. @code{--enable-libass}. This filter also requires a build with libavcodec and
  17310. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  17311. Alpha) subtitles format.
  17312. The filter accepts the following options:
  17313. @table @option
  17314. @item filename, f
  17315. Set the filename of the subtitle file to read. It must be specified.
  17316. @item original_size
  17317. Specify the size of the original video, the video for which the ASS file
  17318. was composed. For the syntax of this option, check the
  17319. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17320. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  17321. correctly scale the fonts if the aspect ratio has been changed.
  17322. @item fontsdir
  17323. Set a directory path containing fonts that can be used by the filter.
  17324. These fonts will be used in addition to whatever the font provider uses.
  17325. @item alpha
  17326. Process alpha channel, by default alpha channel is untouched.
  17327. @item charenc
  17328. Set subtitles input character encoding. @code{subtitles} filter only. Only
  17329. useful if not UTF-8.
  17330. @item stream_index, si
  17331. Set subtitles stream index. @code{subtitles} filter only.
  17332. @item force_style
  17333. Override default style or script info parameters of the subtitles. It accepts a
  17334. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  17335. @item wrap_unicode
  17336. Break lines according to the Unicode Line Breaking Algorithm. Availability requires
  17337. at least libass release 0.17.0 (or LIBASS_VERSION 0x01600010), @emph{and} libass must
  17338. have been built with libunibreak.
  17339. The option is enabled by default except for native ASS.
  17340. @end table
  17341. If the first key is not specified, it is assumed that the first value
  17342. specifies the @option{filename}.
  17343. For example, to render the file @file{sub.srt} on top of the input
  17344. video, use the command:
  17345. @example
  17346. subtitles=sub.srt
  17347. @end example
  17348. which is equivalent to:
  17349. @example
  17350. subtitles=filename=sub.srt
  17351. @end example
  17352. To render the default subtitles stream from file @file{video.mkv}, use:
  17353. @example
  17354. subtitles=video.mkv
  17355. @end example
  17356. To render the second subtitles stream from that file, use:
  17357. @example
  17358. subtitles=video.mkv:si=1
  17359. @end example
  17360. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  17361. @code{DejaVu Serif}, use:
  17362. @example
  17363. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  17364. @end example
  17365. @section super2xsai
  17366. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  17367. Interpolate) pixel art scaling algorithm.
  17368. Useful for enlarging pixel art images without reducing sharpness.
  17369. @section swaprect
  17370. Swap two rectangular objects in video.
  17371. This filter accepts the following options:
  17372. @table @option
  17373. @item w
  17374. Set object width.
  17375. @item h
  17376. Set object height.
  17377. @item x1
  17378. Set 1st rect x coordinate.
  17379. @item y1
  17380. Set 1st rect y coordinate.
  17381. @item x2
  17382. Set 2nd rect x coordinate.
  17383. @item y2
  17384. Set 2nd rect y coordinate.
  17385. All expressions are evaluated once for each frame.
  17386. @end table
  17387. The all options are expressions containing the following constants:
  17388. @table @option
  17389. @item w
  17390. @item h
  17391. The input width and height.
  17392. @item a
  17393. same as @var{w} / @var{h}
  17394. @item sar
  17395. input sample aspect ratio
  17396. @item dar
  17397. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  17398. @item n
  17399. The number of the input frame, starting from 0.
  17400. @item t
  17401. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  17402. @item pos
  17403. the position in the file of the input frame, NAN if unknown; deprecated,
  17404. do not use
  17405. @end table
  17406. @subsection Commands
  17407. This filter supports the all above options as @ref{commands}.
  17408. @section swapuv
  17409. Swap U & V plane.
  17410. @section tblend
  17411. Blend successive video frames.
  17412. See @ref{blend}
  17413. @section telecine
  17414. Apply telecine process to the video.
  17415. This filter accepts the following options:
  17416. @table @option
  17417. @item first_field
  17418. @table @samp
  17419. @item top, t
  17420. top field first
  17421. @item bottom, b
  17422. bottom field first
  17423. The default value is @code{top}.
  17424. @end table
  17425. @item pattern
  17426. A string of numbers representing the pulldown pattern you wish to apply.
  17427. The default value is @code{23}.
  17428. @end table
  17429. @example
  17430. Some typical patterns:
  17431. NTSC output (30i):
  17432. 27.5p: 32222
  17433. 24p: 23 (classic)
  17434. 24p: 2332 (preferred)
  17435. 20p: 33
  17436. 18p: 334
  17437. 16p: 3444
  17438. PAL output (25i):
  17439. 27.5p: 12222
  17440. 24p: 222222222223 ("Euro pulldown")
  17441. 16.67p: 33
  17442. 16p: 33333334
  17443. @end example
  17444. @section thistogram
  17445. Compute and draw a color distribution histogram for the input video across time.
  17446. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  17447. at certain time, this filter shows also past histograms of number of frames defined
  17448. by @code{width} option.
  17449. The computed histogram is a representation of the color component
  17450. distribution in an image.
  17451. The filter accepts the following options:
  17452. @table @option
  17453. @item width, w
  17454. Set width of single color component output. Default value is @code{0}.
  17455. Value of @code{0} means width will be picked from input video.
  17456. This also set number of passed histograms to keep.
  17457. Allowed range is [0, 8192].
  17458. @item display_mode, d
  17459. Set display mode.
  17460. It accepts the following values:
  17461. @table @samp
  17462. @item stack
  17463. Per color component graphs are placed below each other.
  17464. @item parade
  17465. Per color component graphs are placed side by side.
  17466. @item overlay
  17467. Presents information identical to that in the @code{parade}, except
  17468. that the graphs representing color components are superimposed directly
  17469. over one another.
  17470. @end table
  17471. Default is @code{stack}.
  17472. @item levels_mode, m
  17473. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  17474. Default is @code{linear}.
  17475. @item components, c
  17476. Set what color components to display.
  17477. Default is @code{7}.
  17478. @item bgopacity, b
  17479. Set background opacity. Default is @code{0.9}.
  17480. @item envelope, e
  17481. Show envelope. Default is disabled.
  17482. @item ecolor, ec
  17483. Set envelope color. Default is @code{gold}.
  17484. @item slide
  17485. Set slide mode.
  17486. Available values for slide is:
  17487. @table @samp
  17488. @item frame
  17489. Draw new frame when right border is reached.
  17490. @item replace
  17491. Replace old columns with new ones.
  17492. @item scroll
  17493. Scroll from right to left.
  17494. @item rscroll
  17495. Scroll from left to right.
  17496. @item picture
  17497. Draw single picture.
  17498. @end table
  17499. Default is @code{replace}.
  17500. @end table
  17501. @section threshold
  17502. Apply threshold effect to video stream.
  17503. This filter needs four video streams to perform thresholding.
  17504. First stream is stream we are filtering.
  17505. Second stream is holding threshold values, third stream is holding min values,
  17506. and last, fourth stream is holding max values.
  17507. The filter accepts the following option:
  17508. @table @option
  17509. @item planes
  17510. Set which planes will be processed, unprocessed planes will be copied.
  17511. By default value 0xf, all planes will be processed.
  17512. @end table
  17513. For example if first stream pixel's component value is less then threshold value
  17514. of pixel component from 2nd threshold stream, third stream value will picked,
  17515. otherwise fourth stream pixel component value will be picked.
  17516. Using color source filter one can perform various types of thresholding:
  17517. @subsection Commands
  17518. This filter supports the all options as @ref{commands}.
  17519. @subsection Examples
  17520. @itemize
  17521. @item
  17522. Binary threshold, using gray color as threshold:
  17523. @example
  17524. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  17525. @end example
  17526. @item
  17527. Inverted binary threshold, using gray color as threshold:
  17528. @example
  17529. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  17530. @end example
  17531. @item
  17532. Truncate binary threshold, using gray color as threshold:
  17533. @example
  17534. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  17535. @end example
  17536. @item
  17537. Threshold to zero, using gray color as threshold:
  17538. @example
  17539. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  17540. @end example
  17541. @item
  17542. Inverted threshold to zero, using gray color as threshold:
  17543. @example
  17544. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  17545. @end example
  17546. @end itemize
  17547. @section thumbnail
  17548. Select the most representative frame in a given sequence of consecutive frames.
  17549. The filter accepts the following options:
  17550. @table @option
  17551. @item n
  17552. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  17553. will pick one of them, and then handle the next batch of @var{n} frames until
  17554. the end. Default is @code{100}.
  17555. @item log
  17556. Set the log level to display picked frame stats.
  17557. Default is @code{info}.
  17558. @end table
  17559. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  17560. value will result in a higher memory usage, so a high value is not recommended.
  17561. @subsection Examples
  17562. @itemize
  17563. @item
  17564. Extract one picture each 50 frames:
  17565. @example
  17566. thumbnail=50
  17567. @end example
  17568. @item
  17569. Complete example of a thumbnail creation with @command{ffmpeg}:
  17570. @example
  17571. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  17572. @end example
  17573. @end itemize
  17574. @anchor{tile}
  17575. @section tile
  17576. Tile several successive frames together.
  17577. The @ref{untile} filter can do the reverse.
  17578. The filter accepts the following options:
  17579. @table @option
  17580. @item layout
  17581. Set the grid size in the form @code{COLUMNSxROWS}. Range is upto UINT_MAX cells.
  17582. Default is @code{6x5}.
  17583. @item nb_frames
  17584. Set the maximum number of frames to render in the given area. It must be less
  17585. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  17586. the area will be used.
  17587. @item margin
  17588. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  17589. @item padding
  17590. Set the inner border thickness (i.e. the number of pixels between frames). For
  17591. more advanced padding options (such as having different values for the edges),
  17592. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  17593. @item color
  17594. Specify the color of the unused area. For the syntax of this option, check the
  17595. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17596. The default value of @var{color} is "black".
  17597. @item overlap
  17598. Set the number of frames to overlap when tiling several successive frames together.
  17599. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17600. @item init_padding
  17601. Set the number of frames to initially be empty before displaying first output frame.
  17602. This controls how soon will one get first output frame.
  17603. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17604. @end table
  17605. @subsection Examples
  17606. @itemize
  17607. @item
  17608. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  17609. @example
  17610. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  17611. @end example
  17612. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  17613. duplicating each output frame to accommodate the originally detected frame
  17614. rate.
  17615. @item
  17616. Display @code{5} pictures in an area of @code{3x2} frames,
  17617. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  17618. mixed flat and named options:
  17619. @example
  17620. tile=3x2:nb_frames=5:padding=7:margin=2
  17621. @end example
  17622. @end itemize
  17623. @section tinterlace
  17624. Perform various types of temporal field interlacing.
  17625. Frames are counted starting from 1, so the first input frame is
  17626. considered odd.
  17627. The filter accepts the following options:
  17628. @table @option
  17629. @item mode
  17630. Specify the mode of the interlacing. This option can also be specified
  17631. as a value alone. See below for a list of values for this option.
  17632. Available values are:
  17633. @table @samp
  17634. @item merge, 0
  17635. Move odd frames into the upper field, even into the lower field,
  17636. generating a double height frame at half frame rate.
  17637. @example
  17638. ------> time
  17639. Input:
  17640. Frame 1 Frame 2 Frame 3 Frame 4
  17641. 11111 22222 33333 44444
  17642. 11111 22222 33333 44444
  17643. 11111 22222 33333 44444
  17644. 11111 22222 33333 44444
  17645. Output:
  17646. 11111 33333
  17647. 22222 44444
  17648. 11111 33333
  17649. 22222 44444
  17650. 11111 33333
  17651. 22222 44444
  17652. 11111 33333
  17653. 22222 44444
  17654. @end example
  17655. @item drop_even, 1
  17656. Only output odd frames, even frames are dropped, generating a frame with
  17657. unchanged height at half frame rate.
  17658. @example
  17659. ------> time
  17660. Input:
  17661. Frame 1 Frame 2 Frame 3 Frame 4
  17662. 11111 22222 33333 44444
  17663. 11111 22222 33333 44444
  17664. 11111 22222 33333 44444
  17665. 11111 22222 33333 44444
  17666. Output:
  17667. 11111 33333
  17668. 11111 33333
  17669. 11111 33333
  17670. 11111 33333
  17671. @end example
  17672. @item drop_odd, 2
  17673. Only output even frames, odd frames are dropped, generating a frame with
  17674. unchanged height at half frame rate.
  17675. @example
  17676. ------> time
  17677. Input:
  17678. Frame 1 Frame 2 Frame 3 Frame 4
  17679. 11111 22222 33333 44444
  17680. 11111 22222 33333 44444
  17681. 11111 22222 33333 44444
  17682. 11111 22222 33333 44444
  17683. Output:
  17684. 22222 44444
  17685. 22222 44444
  17686. 22222 44444
  17687. 22222 44444
  17688. @end example
  17689. @item pad, 3
  17690. Expand each frame to full height, but pad alternate lines with black,
  17691. generating a frame with double height at the same input frame rate.
  17692. @example
  17693. ------> time
  17694. Input:
  17695. Frame 1 Frame 2 Frame 3 Frame 4
  17696. 11111 22222 33333 44444
  17697. 11111 22222 33333 44444
  17698. 11111 22222 33333 44444
  17699. 11111 22222 33333 44444
  17700. Output:
  17701. 11111 ..... 33333 .....
  17702. ..... 22222 ..... 44444
  17703. 11111 ..... 33333 .....
  17704. ..... 22222 ..... 44444
  17705. 11111 ..... 33333 .....
  17706. ..... 22222 ..... 44444
  17707. 11111 ..... 33333 .....
  17708. ..... 22222 ..... 44444
  17709. @end example
  17710. @item interleave_top, 4
  17711. Interleave the upper field from odd frames with the lower field from
  17712. even frames, generating a frame with unchanged height at half frame rate.
  17713. @example
  17714. ------> time
  17715. Input:
  17716. Frame 1 Frame 2 Frame 3 Frame 4
  17717. 11111<- 22222 33333<- 44444
  17718. 11111 22222<- 33333 44444<-
  17719. 11111<- 22222 33333<- 44444
  17720. 11111 22222<- 33333 44444<-
  17721. Output:
  17722. 11111 33333
  17723. 22222 44444
  17724. 11111 33333
  17725. 22222 44444
  17726. @end example
  17727. @item interleave_bottom, 5
  17728. Interleave the lower field from odd frames with the upper field from
  17729. even frames, generating a frame with unchanged height at half frame rate.
  17730. @example
  17731. ------> time
  17732. Input:
  17733. Frame 1 Frame 2 Frame 3 Frame 4
  17734. 11111 22222<- 33333 44444<-
  17735. 11111<- 22222 33333<- 44444
  17736. 11111 22222<- 33333 44444<-
  17737. 11111<- 22222 33333<- 44444
  17738. Output:
  17739. 22222 44444
  17740. 11111 33333
  17741. 22222 44444
  17742. 11111 33333
  17743. @end example
  17744. @item interlacex2, 6
  17745. Double frame rate with unchanged height. Frames are inserted each
  17746. containing the second temporal field from the previous input frame and
  17747. the first temporal field from the next input frame. This mode relies on
  17748. the top_field_first flag. Useful for interlaced video displays with no
  17749. field synchronisation.
  17750. @example
  17751. ------> time
  17752. Input:
  17753. Frame 1 Frame 2 Frame 3 Frame 4
  17754. 11111 22222 33333 44444
  17755. 11111 22222 33333 44444
  17756. 11111 22222 33333 44444
  17757. 11111 22222 33333 44444
  17758. Output:
  17759. 11111 22222 22222 33333 33333 44444 44444
  17760. 11111 11111 22222 22222 33333 33333 44444
  17761. 11111 22222 22222 33333 33333 44444 44444
  17762. 11111 11111 22222 22222 33333 33333 44444
  17763. @end example
  17764. @item mergex2, 7
  17765. Move odd frames into the upper field, even into the lower field,
  17766. generating a double height frame at same frame rate.
  17767. @example
  17768. ------> time
  17769. Input:
  17770. Frame 1 Frame 2 Frame 3 Frame 4
  17771. 11111 22222 33333 44444
  17772. 11111 22222 33333 44444
  17773. 11111 22222 33333 44444
  17774. 11111 22222 33333 44444
  17775. Output:
  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. 11111 33333 33333 55555
  17783. 22222 22222 44444 44444
  17784. @end example
  17785. @end table
  17786. Numeric values are deprecated but are accepted for backward
  17787. compatibility reasons.
  17788. Default mode is @code{merge}.
  17789. @item flags
  17790. Specify flags influencing the filter process.
  17791. Available value for @var{flags} is:
  17792. @table @option
  17793. @item low_pass_filter, vlpf
  17794. Enable linear vertical low-pass filtering in the filter.
  17795. Vertical low-pass filtering is required when creating an interlaced
  17796. destination from a progressive source which contains high-frequency
  17797. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  17798. patterning.
  17799. @item complex_filter, cvlpf
  17800. Enable complex vertical low-pass filtering.
  17801. This will slightly less reduce interlace 'twitter' and Moire
  17802. patterning but better retain detail and subjective sharpness impression.
  17803. @item bypass_il
  17804. Bypass already interlaced frames, only adjust the frame rate.
  17805. @end table
  17806. Vertical low-pass filtering and bypassing already interlaced frames can only be
  17807. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  17808. @end table
  17809. @section tmedian
  17810. Pick median pixels from several successive input video frames.
  17811. The filter accepts the following options:
  17812. @table @option
  17813. @item radius
  17814. Set radius of median filter.
  17815. Default is 1. Allowed range is from 1 to 127.
  17816. @item planes
  17817. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  17818. @item percentile
  17819. Set median percentile. Default value is @code{0.5}.
  17820. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  17821. minimum values, and @code{1} maximum values.
  17822. @end table
  17823. @subsection Commands
  17824. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  17825. @section tmidequalizer
  17826. Apply Temporal Midway Video Equalization effect.
  17827. Midway Video Equalization adjusts a sequence of video frames to have the same
  17828. histograms, while maintaining their dynamics as much as possible. It's
  17829. useful for e.g. matching exposures from a video frames sequence.
  17830. This filter accepts the following option:
  17831. @table @option
  17832. @item radius
  17833. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  17834. @item sigma
  17835. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  17836. Setting this option to 0 effectively does nothing.
  17837. @item planes
  17838. Set which planes to process. Default is @code{15}, which is all available planes.
  17839. @end table
  17840. @section tmix
  17841. Mix successive video frames.
  17842. A description of the accepted options follows.
  17843. @table @option
  17844. @item frames
  17845. The number of successive frames to mix. If unspecified, it defaults to 3.
  17846. @item weights
  17847. Specify weight of each input video frame.
  17848. Each weight is separated by space. If number of weights is smaller than
  17849. number of @var{frames} last specified weight will be used for all remaining
  17850. unset weights.
  17851. @item scale
  17852. Specify scale, if it is set it will be multiplied with sum
  17853. of each weight multiplied with pixel values to give final destination
  17854. pixel value. By default @var{scale} is auto scaled to sum of weights.
  17855. @item planes
  17856. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  17857. @end table
  17858. @subsection Examples
  17859. @itemize
  17860. @item
  17861. Average 7 successive frames:
  17862. @example
  17863. tmix=frames=7:weights="1 1 1 1 1 1 1"
  17864. @end example
  17865. @item
  17866. Apply simple temporal convolution:
  17867. @example
  17868. tmix=frames=3:weights="-1 3 -1"
  17869. @end example
  17870. @item
  17871. Similar as above but only showing temporal differences:
  17872. @example
  17873. tmix=frames=3:weights="-1 2 -1":scale=1
  17874. @end example
  17875. @end itemize
  17876. @subsection Commands
  17877. This filter supports the following commands:
  17878. @table @option
  17879. @item weights
  17880. @item scale
  17881. @item planes
  17882. Syntax is same as option with same name.
  17883. @end table
  17884. @anchor{tonemap}
  17885. @section tonemap
  17886. Tone map colors from different dynamic ranges.
  17887. This filter expects data in single precision floating point, as it needs to
  17888. operate on (and can output) out-of-range values. Another filter, such as
  17889. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  17890. The tonemapping algorithms implemented only work on linear light, so input
  17891. data should be linearized beforehand (and possibly correctly tagged).
  17892. @example
  17893. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  17894. @end example
  17895. @subsection Options
  17896. The filter accepts the following options.
  17897. @table @option
  17898. @item tonemap
  17899. Set the tone map algorithm to use.
  17900. Possible values are:
  17901. @table @var
  17902. @item none
  17903. Do not apply any tone map, only desaturate overbright pixels.
  17904. @item clip
  17905. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  17906. in-range values, while distorting out-of-range values.
  17907. @item linear
  17908. Stretch the entire reference gamut to a linear multiple of the display.
  17909. @item gamma
  17910. Fit a logarithmic transfer between the tone curves.
  17911. @item reinhard
  17912. Preserve overall image brightness with a simple curve, using nonlinear
  17913. contrast, which results in flattening details and degrading color accuracy.
  17914. @item hable
  17915. Preserve both dark and bright details better than @var{reinhard}, at the cost
  17916. of slightly darkening everything. Use it when detail preservation is more
  17917. important than color and brightness accuracy.
  17918. @item mobius
  17919. Smoothly map out-of-range values, while retaining contrast and colors for
  17920. in-range material as much as possible. Use it when color accuracy is more
  17921. important than detail preservation.
  17922. @end table
  17923. Default is none.
  17924. @item param
  17925. Tune the tone mapping algorithm.
  17926. This affects the following algorithms:
  17927. @table @var
  17928. @item none
  17929. Ignored.
  17930. @item linear
  17931. Specifies the scale factor to use while stretching.
  17932. Default to 1.0.
  17933. @item gamma
  17934. Specifies the exponent of the function.
  17935. Default to 1.8.
  17936. @item clip
  17937. Specify an extra linear coefficient to multiply into the signal before clipping.
  17938. Default to 1.0.
  17939. @item reinhard
  17940. Specify the local contrast coefficient at the display peak.
  17941. Default to 0.5, which means that in-gamut values will be about half as bright
  17942. as when clipping.
  17943. @item hable
  17944. Ignored.
  17945. @item mobius
  17946. Specify the transition point from linear to mobius transform. Every value
  17947. below this point is guaranteed to be mapped 1:1. The higher the value, the
  17948. more accurate the result will be, at the cost of losing bright details.
  17949. Default to 0.3, which due to the steep initial slope still preserves in-range
  17950. colors fairly accurately.
  17951. @end table
  17952. @item desat
  17953. Apply desaturation for highlights that exceed this level of brightness. The
  17954. higher the parameter, the more color information will be preserved. This
  17955. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17956. (smoothly) turning into white instead. This makes images feel more natural,
  17957. at the cost of reducing information about out-of-range colors.
  17958. The default of 2.0 is somewhat conservative and will mostly just apply to
  17959. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  17960. This option works only if the input frame has a supported color tag.
  17961. @item peak
  17962. Override signal/nominal/reference peak with this value. Useful when the
  17963. embedded peak information in display metadata is not reliable or when tone
  17964. mapping from a lower range to a higher range.
  17965. @end table
  17966. @section tpad
  17967. Temporarily pad video frames.
  17968. The filter accepts the following options:
  17969. @table @option
  17970. @item start
  17971. Specify number of delay frames before input video stream. Default is 0.
  17972. @item stop
  17973. Specify number of padding frames after input video stream.
  17974. Set to -1 to pad indefinitely. Default is 0.
  17975. @item start_mode
  17976. Set kind of frames added to beginning of stream.
  17977. Can be either @var{add} or @var{clone}.
  17978. With @var{add} frames of solid-color are added.
  17979. With @var{clone} frames are clones of first frame.
  17980. Default is @var{add}.
  17981. @item stop_mode
  17982. Set kind of frames added to end of stream.
  17983. Can be either @var{add} or @var{clone}.
  17984. With @var{add} frames of solid-color are added.
  17985. With @var{clone} frames are clones of last frame.
  17986. Default is @var{add}.
  17987. @item start_duration, stop_duration
  17988. Specify the duration of the start/stop delay. See
  17989. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17990. for the accepted syntax.
  17991. These options override @var{start} and @var{stop}. Default is 0.
  17992. @item color
  17993. Specify the color of the padded area. For the syntax of this option,
  17994. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17995. manual,ffmpeg-utils}.
  17996. The default value of @var{color} is "black".
  17997. @end table
  17998. @anchor{transpose}
  17999. @section transpose
  18000. Transpose rows with columns in the input video and optionally flip it.
  18001. It accepts the following parameters:
  18002. @table @option
  18003. @item dir
  18004. Specify the transposition direction.
  18005. Can assume the following values:
  18006. @table @samp
  18007. @item 0, 4, cclock_flip
  18008. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  18009. @example
  18010. L.R L.l
  18011. . . -> . .
  18012. l.r R.r
  18013. @end example
  18014. @item 1, 5, clock
  18015. Rotate by 90 degrees clockwise, that is:
  18016. @example
  18017. L.R l.L
  18018. . . -> . .
  18019. l.r r.R
  18020. @end example
  18021. @item 2, 6, cclock
  18022. Rotate by 90 degrees counterclockwise, that is:
  18023. @example
  18024. L.R R.r
  18025. . . -> . .
  18026. l.r L.l
  18027. @end example
  18028. @item 3, 7, clock_flip
  18029. Rotate by 90 degrees clockwise and vertically flip, that is:
  18030. @example
  18031. L.R r.R
  18032. . . -> . .
  18033. l.r l.L
  18034. @end example
  18035. @end table
  18036. For values between 4-7, the transposition is only done if the input
  18037. video geometry is portrait and not landscape. These values are
  18038. deprecated, the @code{passthrough} option should be used instead.
  18039. Numerical values are deprecated, and should be dropped in favor of
  18040. symbolic constants.
  18041. @item passthrough
  18042. Do not apply the transposition if the input geometry matches the one
  18043. specified by the specified value. It accepts the following values:
  18044. @table @samp
  18045. @item none
  18046. Always apply transposition.
  18047. @item portrait
  18048. Preserve portrait geometry (when @var{height} >= @var{width}).
  18049. @item landscape
  18050. Preserve landscape geometry (when @var{width} >= @var{height}).
  18051. @end table
  18052. Default value is @code{none}.
  18053. @end table
  18054. For example to rotate by 90 degrees clockwise and preserve portrait
  18055. layout:
  18056. @example
  18057. transpose=dir=1:passthrough=portrait
  18058. @end example
  18059. The command above can also be specified as:
  18060. @example
  18061. transpose=1:portrait
  18062. @end example
  18063. @section transpose_npp
  18064. Transpose rows with columns in the input video and optionally flip it.
  18065. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  18066. It accepts the following parameters:
  18067. @table @option
  18068. @item dir
  18069. Specify the transposition direction.
  18070. Can assume the following values:
  18071. @table @samp
  18072. @item cclock_flip
  18073. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  18074. @item clock
  18075. Rotate by 90 degrees clockwise.
  18076. @item cclock
  18077. Rotate by 90 degrees counterclockwise.
  18078. @item clock_flip
  18079. Rotate by 90 degrees clockwise and vertically flip.
  18080. @end table
  18081. @item passthrough
  18082. Do not apply the transposition if the input geometry matches the one
  18083. specified by the specified value. It accepts the following values:
  18084. @table @samp
  18085. @item none
  18086. Always apply transposition. (default)
  18087. @item portrait
  18088. Preserve portrait geometry (when @var{height} >= @var{width}).
  18089. @item landscape
  18090. Preserve landscape geometry (when @var{width} >= @var{height}).
  18091. @end table
  18092. @end table
  18093. @section trim
  18094. Trim the input so that the output contains one continuous subpart of the input.
  18095. It accepts the following parameters:
  18096. @table @option
  18097. @item start
  18098. Specify the time of the start of the kept section, i.e. the frame with the
  18099. timestamp @var{start} will be the first frame in the output.
  18100. @item end
  18101. Specify the time of the first frame that will be dropped, i.e. the frame
  18102. immediately preceding the one with the timestamp @var{end} will be the last
  18103. frame in the output.
  18104. @item start_pts
  18105. This is the same as @var{start}, except this option sets the start timestamp
  18106. in timebase units instead of seconds.
  18107. @item end_pts
  18108. This is the same as @var{end}, except this option sets the end timestamp
  18109. in timebase units instead of seconds.
  18110. @item duration
  18111. The maximum duration of the output in seconds.
  18112. @item start_frame
  18113. The number of the first frame that should be passed to the output.
  18114. @item end_frame
  18115. The number of the first frame that should be dropped.
  18116. @end table
  18117. @option{start}, @option{end}, and @option{duration} are expressed as time
  18118. duration specifications; see
  18119. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18120. for the accepted syntax.
  18121. Note that the first two sets of the start/end options and the @option{duration}
  18122. option look at the frame timestamp, while the _frame variants simply count the
  18123. frames that pass through the filter. Also note that this filter does not modify
  18124. the timestamps. If you wish for the output timestamps to start at zero, insert a
  18125. setpts filter after the trim filter.
  18126. If multiple start or end options are set, this filter tries to be greedy and
  18127. keep all the frames that match at least one of the specified constraints. To keep
  18128. only the part that matches all the constraints at once, chain multiple trim
  18129. filters.
  18130. The defaults are such that all the input is kept. So it is possible to set e.g.
  18131. just the end values to keep everything before the specified time.
  18132. Examples:
  18133. @itemize
  18134. @item
  18135. Drop everything except the second minute of input:
  18136. @example
  18137. ffmpeg -i INPUT -vf trim=60:120
  18138. @end example
  18139. @item
  18140. Keep only the first second:
  18141. @example
  18142. ffmpeg -i INPUT -vf trim=duration=1
  18143. @end example
  18144. @end itemize
  18145. @section unpremultiply
  18146. Apply alpha unpremultiply effect to input video stream using first plane
  18147. of second stream as alpha.
  18148. Both streams must have same dimensions and same pixel format.
  18149. The filter accepts the following option:
  18150. @table @option
  18151. @item planes
  18152. Set which planes will be processed, unprocessed planes will be copied.
  18153. By default value 0xf, all planes will be processed.
  18154. If the format has 1 or 2 components, then luma is bit 0.
  18155. If the format has 3 or 4 components:
  18156. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  18157. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  18158. If present, the alpha channel is always the last bit.
  18159. @item inplace
  18160. Do not require 2nd input for processing, instead use alpha plane from input stream.
  18161. @end table
  18162. @anchor{unsharp}
  18163. @section unsharp
  18164. Sharpen or blur the input video.
  18165. It accepts the following parameters:
  18166. @table @option
  18167. @item luma_msize_x, lx
  18168. Set the luma matrix horizontal size. It must be an odd integer between
  18169. 3 and 23. The default value is 5.
  18170. @item luma_msize_y, ly
  18171. Set the luma matrix vertical size. It must be an odd integer between 3
  18172. and 23. The default value is 5.
  18173. @item luma_amount, la
  18174. Set the luma effect strength. It must be a floating point number, reasonable
  18175. values lay between -1.5 and 1.5.
  18176. Negative values will blur the input video, while positive values will
  18177. sharpen it, a value of zero will disable the effect.
  18178. Default value is 1.0.
  18179. @item chroma_msize_x, cx
  18180. Set the chroma matrix horizontal size. It must be an odd integer
  18181. between 3 and 23. The default value is 5.
  18182. @item chroma_msize_y, cy
  18183. Set the chroma matrix vertical size. It must be an odd integer
  18184. between 3 and 23. The default value is 5.
  18185. @item chroma_amount, ca
  18186. Set the chroma effect strength. It must be a floating point number, reasonable
  18187. values lay between -1.5 and 1.5.
  18188. Negative values will blur the input video, while positive values will
  18189. sharpen it, a value of zero will disable the effect.
  18190. Default value is 0.0.
  18191. @item alpha_msize_x, ax
  18192. Set the alpha matrix horizontal size. It must be an odd integer
  18193. between 3 and 23. The default value is 5.
  18194. @item alpha_msize_y, ay
  18195. Set the alpha matrix vertical size. It must be an odd integer
  18196. between 3 and 23. The default value is 5.
  18197. @item alpha_amount, aa
  18198. Set the alpha effect strength. It must be a floating point number, reasonable
  18199. values lay between -1.5 and 1.5.
  18200. Negative values will blur the input video, while positive values will
  18201. sharpen it, a value of zero will disable the effect.
  18202. Default value is 0.0.
  18203. @end table
  18204. All parameters are optional and default to the equivalent of the
  18205. string '5:5:1.0:5:5:0.0'.
  18206. @subsection Examples
  18207. @itemize
  18208. @item
  18209. Apply strong luma sharpen effect:
  18210. @example
  18211. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  18212. @end example
  18213. @item
  18214. Apply a strong blur of both luma and chroma parameters:
  18215. @example
  18216. unsharp=7:7:-2:7:7:-2
  18217. @end example
  18218. @end itemize
  18219. @anchor{untile}
  18220. @section untile
  18221. Decompose a video made of tiled images into the individual images.
  18222. The frame rate of the output video is the frame rate of the input video
  18223. multiplied by the number of tiles.
  18224. This filter does the reverse of @ref{tile}.
  18225. The filter accepts the following options:
  18226. @table @option
  18227. @item layout
  18228. Set the grid size (i.e. the number of lines and columns). For the syntax of
  18229. this option, check the
  18230. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18231. @end table
  18232. @subsection Examples
  18233. @itemize
  18234. @item
  18235. Produce a 1-second video from a still image file made of 25 frames stacked
  18236. vertically, like an analogic film reel:
  18237. @example
  18238. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  18239. @end example
  18240. @end itemize
  18241. @section uspp
  18242. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  18243. the image at several (or - in the case of @option{quality} level @code{8} - all)
  18244. shifts and average the results.
  18245. The way this differs from the behavior of spp is that uspp actually encodes &
  18246. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  18247. DCT similar to MJPEG.
  18248. This filter is only available in ffmpeg version 4.4 or earlier.
  18249. The filter accepts the following options:
  18250. @table @option
  18251. @item quality
  18252. Set quality. This option defines the number of levels for averaging. It accepts
  18253. an integer in the range 0-8. If set to @code{0}, the filter will have no
  18254. effect. A value of @code{8} means the higher quality. For each increment of
  18255. that value the speed drops by a factor of approximately 2. Default value is
  18256. @code{3}.
  18257. @item qp
  18258. Force a constant quantization parameter. If not set, the filter will use the QP
  18259. from the video stream (if available).
  18260. @item codec
  18261. Use specified codec instead of snow.
  18262. @end table
  18263. @section v360
  18264. Convert 360 videos between various formats.
  18265. The filter accepts the following options:
  18266. @table @option
  18267. @item input
  18268. @item output
  18269. Set format of the input/output video.
  18270. Available formats:
  18271. @table @samp
  18272. @item e
  18273. @item equirect
  18274. Equirectangular projection.
  18275. @item c3x2
  18276. @item c6x1
  18277. @item c1x6
  18278. Cubemap with 3x2/6x1/1x6 layout.
  18279. Format specific options:
  18280. @table @option
  18281. @item in_pad
  18282. @item out_pad
  18283. Set padding proportion for the input/output cubemap. Values in decimals.
  18284. Example values:
  18285. @table @samp
  18286. @item 0
  18287. No padding.
  18288. @item 0.01
  18289. 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)
  18290. @end table
  18291. Default value is @b{@samp{0}}.
  18292. Maximum value is @b{@samp{0.1}}.
  18293. @item fin_pad
  18294. @item fout_pad
  18295. Set fixed padding for the input/output cubemap. Values in pixels.
  18296. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  18297. @item in_forder
  18298. @item out_forder
  18299. Set order of faces for the input/output cubemap. Choose one direction for each position.
  18300. Designation of directions:
  18301. @table @samp
  18302. @item r
  18303. right
  18304. @item l
  18305. left
  18306. @item u
  18307. up
  18308. @item d
  18309. down
  18310. @item f
  18311. forward
  18312. @item b
  18313. back
  18314. @end table
  18315. Default value is @b{@samp{rludfb}}.
  18316. @item in_frot
  18317. @item out_frot
  18318. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  18319. Designation of angles:
  18320. @table @samp
  18321. @item 0
  18322. 0 degrees clockwise
  18323. @item 1
  18324. 90 degrees clockwise
  18325. @item 2
  18326. 180 degrees clockwise
  18327. @item 3
  18328. 270 degrees clockwise
  18329. @end table
  18330. Default value is @b{@samp{000000}}.
  18331. @end table
  18332. @item eac
  18333. Equi-Angular Cubemap.
  18334. @item flat
  18335. @item gnomonic
  18336. @item rectilinear
  18337. Regular video.
  18338. Format specific options:
  18339. @table @option
  18340. @item h_fov
  18341. @item v_fov
  18342. @item d_fov
  18343. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18344. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18345. @item ih_fov
  18346. @item iv_fov
  18347. @item id_fov
  18348. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18349. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18350. @end table
  18351. @item dfisheye
  18352. Dual fisheye.
  18353. Format specific options:
  18354. @table @option
  18355. @item h_fov
  18356. @item v_fov
  18357. @item d_fov
  18358. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18359. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18360. @item ih_fov
  18361. @item iv_fov
  18362. @item id_fov
  18363. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18364. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18365. @end table
  18366. @item barrel
  18367. @item fb
  18368. @item barrelsplit
  18369. Facebook's 360 formats.
  18370. @item sg
  18371. Stereographic format.
  18372. Format specific options:
  18373. @table @option
  18374. @item h_fov
  18375. @item v_fov
  18376. @item d_fov
  18377. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18378. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18379. @item ih_fov
  18380. @item iv_fov
  18381. @item id_fov
  18382. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18383. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18384. @end table
  18385. @item mercator
  18386. Mercator format.
  18387. @item ball
  18388. Ball format, gives significant distortion toward the back.
  18389. @item hammer
  18390. Hammer-Aitoff map projection format.
  18391. @item sinusoidal
  18392. Sinusoidal map projection format.
  18393. @item fisheye
  18394. Fisheye projection.
  18395. Format specific options:
  18396. @table @option
  18397. @item h_fov
  18398. @item v_fov
  18399. @item d_fov
  18400. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18401. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18402. @item ih_fov
  18403. @item iv_fov
  18404. @item id_fov
  18405. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18406. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18407. @end table
  18408. @item pannini
  18409. Pannini projection.
  18410. Format specific options:
  18411. @table @option
  18412. @item h_fov
  18413. Set output pannini parameter.
  18414. @item ih_fov
  18415. Set input pannini parameter.
  18416. @end table
  18417. @item cylindrical
  18418. Cylindrical projection.
  18419. Format specific options:
  18420. @table @option
  18421. @item h_fov
  18422. @item v_fov
  18423. @item d_fov
  18424. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18425. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18426. @item ih_fov
  18427. @item iv_fov
  18428. @item id_fov
  18429. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18430. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18431. @end table
  18432. @item perspective
  18433. Perspective projection. @i{(output only)}
  18434. Format specific options:
  18435. @table @option
  18436. @item v_fov
  18437. Set perspective parameter.
  18438. @end table
  18439. @item tetrahedron
  18440. Tetrahedron projection.
  18441. @item tsp
  18442. Truncated square pyramid projection.
  18443. @item he
  18444. @item hequirect
  18445. Half equirectangular projection.
  18446. @item equisolid
  18447. Equisolid format.
  18448. Format specific options:
  18449. @table @option
  18450. @item h_fov
  18451. @item v_fov
  18452. @item d_fov
  18453. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18454. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18455. @item ih_fov
  18456. @item iv_fov
  18457. @item id_fov
  18458. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18459. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18460. @end table
  18461. @item og
  18462. Orthographic format.
  18463. Format specific options:
  18464. @table @option
  18465. @item h_fov
  18466. @item v_fov
  18467. @item d_fov
  18468. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18469. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18470. @item ih_fov
  18471. @item iv_fov
  18472. @item id_fov
  18473. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18474. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18475. @end table
  18476. @item octahedron
  18477. Octahedron projection.
  18478. @item cylindricalea
  18479. Cylindrical Equal Area projection.
  18480. @end table
  18481. @item interp
  18482. Set interpolation method.@*
  18483. @i{Note: more complex interpolation methods require much more memory to run.}
  18484. Available methods:
  18485. @table @samp
  18486. @item near
  18487. @item nearest
  18488. Nearest neighbour.
  18489. @item line
  18490. @item linear
  18491. Bilinear interpolation.
  18492. @item lagrange9
  18493. Lagrange9 interpolation.
  18494. @item cube
  18495. @item cubic
  18496. Bicubic interpolation.
  18497. @item lanc
  18498. @item lanczos
  18499. Lanczos interpolation.
  18500. @item sp16
  18501. @item spline16
  18502. Spline16 interpolation.
  18503. @item gauss
  18504. @item gaussian
  18505. Gaussian interpolation.
  18506. @item mitchell
  18507. Mitchell interpolation.
  18508. @end table
  18509. Default value is @b{@samp{line}}.
  18510. @item w
  18511. @item h
  18512. Set the output video resolution.
  18513. Default resolution depends on formats.
  18514. @item in_stereo
  18515. @item out_stereo
  18516. Set the input/output stereo format.
  18517. @table @samp
  18518. @item 2d
  18519. 2D mono
  18520. @item sbs
  18521. Side by side
  18522. @item tb
  18523. Top bottom
  18524. @end table
  18525. Default value is @b{@samp{2d}} for input and output format.
  18526. @item yaw
  18527. @item pitch
  18528. @item roll
  18529. Set rotation for the output video. Values in degrees.
  18530. @item rorder
  18531. Set rotation order for the output video. Choose one item for each position.
  18532. @table @samp
  18533. @item y, Y
  18534. yaw
  18535. @item p, P
  18536. pitch
  18537. @item r, R
  18538. roll
  18539. @end table
  18540. Default value is @b{@samp{ypr}}.
  18541. @item h_flip
  18542. @item v_flip
  18543. @item d_flip
  18544. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  18545. @item ih_flip
  18546. @item iv_flip
  18547. Set if input video is flipped horizontally/vertically. Boolean values.
  18548. @item in_trans
  18549. Set if input video is transposed. Boolean value, by default disabled.
  18550. @item out_trans
  18551. Set if output video needs to be transposed. Boolean value, by default disabled.
  18552. @item h_offset
  18553. @item v_offset
  18554. Set output horizontal/vertical off-axis offset. Default is set to 0.
  18555. Allowed range is from -1 to 1.
  18556. @item alpha_mask
  18557. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  18558. @item reset_rot
  18559. Reset rotation of output video. Boolean value, by default disabled.
  18560. @end table
  18561. @subsection Examples
  18562. @itemize
  18563. @item
  18564. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  18565. @example
  18566. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  18567. @end example
  18568. @item
  18569. Extract back view of Equi-Angular Cubemap:
  18570. @example
  18571. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  18572. @end example
  18573. @item
  18574. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  18575. @example
  18576. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  18577. @end example
  18578. @end itemize
  18579. @subsection Commands
  18580. This filter supports subset of above options as @ref{commands}.
  18581. @section vaguedenoiser
  18582. Apply a wavelet based denoiser.
  18583. It transforms each frame from the video input into the wavelet domain,
  18584. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  18585. the obtained coefficients. It does an inverse wavelet transform after.
  18586. Due to wavelet properties, it should give a nice smoothed result, and
  18587. reduced noise, without blurring picture features.
  18588. This filter accepts the following options:
  18589. @table @option
  18590. @item threshold
  18591. The filtering strength. The higher, the more filtered the video will be.
  18592. Hard thresholding can use a higher threshold than soft thresholding
  18593. before the video looks overfiltered. Default value is 2.
  18594. @item method
  18595. The filtering method the filter will use.
  18596. It accepts the following values:
  18597. @table @samp
  18598. @item hard
  18599. All values under the threshold will be zeroed.
  18600. @item soft
  18601. All values under the threshold will be zeroed. All values above will be
  18602. reduced by the threshold.
  18603. @item garrote
  18604. Scales or nullifies coefficients - intermediary between (more) soft and
  18605. (less) hard thresholding.
  18606. @end table
  18607. Default is garrote.
  18608. @item nsteps
  18609. Number of times, the wavelet will decompose the picture. Picture can't
  18610. be decomposed beyond a particular point (typically, 8 for a 640x480
  18611. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  18612. @item percent
  18613. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  18614. @item planes
  18615. A list of the planes to process. By default all planes are processed.
  18616. @item type
  18617. The threshold type the filter will use.
  18618. It accepts the following values:
  18619. @table @samp
  18620. @item universal
  18621. Threshold used is same for all decompositions.
  18622. @item bayes
  18623. Threshold used depends also on each decomposition coefficients.
  18624. @end table
  18625. Default is universal.
  18626. @end table
  18627. @section varblur
  18628. Apply variable blur filter by using 2nd video stream to set blur radius.
  18629. The 2nd stream must have the same dimensions.
  18630. This filter accepts the following options:
  18631. @table @option
  18632. @item min_r
  18633. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  18634. @item max_r
  18635. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  18636. @item planes
  18637. Set which planes to process. By default, all are used.
  18638. @end table
  18639. The @code{varblur} filter also supports the @ref{framesync} options.
  18640. @subsection Commands
  18641. This filter supports all the above options as @ref{commands}.
  18642. @section vectorscope
  18643. Display 2 color component values in the two dimensional graph (which is called
  18644. a vectorscope).
  18645. This filter accepts the following options:
  18646. @table @option
  18647. @item mode, m
  18648. Set vectorscope mode.
  18649. It accepts the following values:
  18650. @table @samp
  18651. @item gray
  18652. @item tint
  18653. Gray values are displayed on graph, higher brightness means more pixels have
  18654. same component color value on location in graph. This is the default mode.
  18655. @item color
  18656. Gray values are displayed on graph. Surrounding pixels values which are not
  18657. present in video frame are drawn in gradient of 2 color components which are
  18658. set by option @code{x} and @code{y}. The 3rd color component is static.
  18659. @item color2
  18660. Actual color components values present in video frame are displayed on graph.
  18661. @item color3
  18662. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  18663. on graph increases value of another color component, which is luminance by
  18664. default values of @code{x} and @code{y}.
  18665. @item color4
  18666. Actual colors present in video frame are displayed on graph. If two different
  18667. colors map to same position on graph then color with higher value of component
  18668. not present in graph is picked.
  18669. @item color5
  18670. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  18671. component picked from radial gradient.
  18672. @end table
  18673. @item x
  18674. Set which color component will be represented on X-axis. Default is @code{1}.
  18675. @item y
  18676. Set which color component will be represented on Y-axis. Default is @code{2}.
  18677. @item intensity, i
  18678. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  18679. of color component which represents frequency of (X, Y) location in graph.
  18680. @item envelope, e
  18681. @table @samp
  18682. @item none
  18683. No envelope, this is default.
  18684. @item instant
  18685. Instant envelope, even darkest single pixel will be clearly highlighted.
  18686. @item peak
  18687. Hold maximum and minimum values presented in graph over time. This way you
  18688. can still spot out of range values without constantly looking at vectorscope.
  18689. @item peak+instant
  18690. Peak and instant envelope combined together.
  18691. @end table
  18692. @item graticule, g
  18693. Set what kind of graticule to draw.
  18694. @table @samp
  18695. @item none
  18696. @item green
  18697. @item color
  18698. @item invert
  18699. @end table
  18700. @item opacity, o
  18701. Set graticule opacity.
  18702. @item flags, f
  18703. Set graticule flags.
  18704. @table @samp
  18705. @item white
  18706. Draw graticule for white point.
  18707. @item black
  18708. Draw graticule for black point.
  18709. @item name
  18710. Draw color points short names.
  18711. @end table
  18712. @item bgopacity, b
  18713. Set background opacity.
  18714. @item lthreshold, l
  18715. Set low threshold for color component not represented on X or Y axis.
  18716. Values lower than this value will be ignored. Default is 0.
  18717. Note this value is multiplied with actual max possible value one pixel component
  18718. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  18719. is 0.1 * 255 = 25.
  18720. @item hthreshold, h
  18721. Set high threshold for color component not represented on X or Y axis.
  18722. Values higher than this value will be ignored. Default is 1.
  18723. Note this value is multiplied with actual max possible value one pixel component
  18724. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  18725. is 0.9 * 255 = 230.
  18726. @item colorspace, c
  18727. Set what kind of colorspace to use when drawing graticule.
  18728. @table @samp
  18729. @item auto
  18730. @item 601
  18731. @item 709
  18732. @end table
  18733. Default is auto.
  18734. @item tint0, t0
  18735. @item tint1, t1
  18736. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  18737. This means no tint, and output will remain gray.
  18738. @end table
  18739. @anchor{vidstabdetect}
  18740. @section vidstabdetect
  18741. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  18742. @ref{vidstabtransform} for pass 2.
  18743. This filter generates a file with relative translation and rotation
  18744. transform information about subsequent frames, which is then used by
  18745. the @ref{vidstabtransform} filter.
  18746. To enable compilation of this filter you need to configure FFmpeg with
  18747. @code{--enable-libvidstab}.
  18748. This filter accepts the following options:
  18749. @table @option
  18750. @item result
  18751. Set the path to the file used to write the transforms information.
  18752. Default value is @file{transforms.trf}.
  18753. @item shakiness
  18754. Set how shaky the video is and how quick the camera is. It accepts an
  18755. integer in the range 1-10, a value of 1 means little shakiness, a
  18756. value of 10 means strong shakiness. Default value is 5.
  18757. @item accuracy
  18758. Set the accuracy of the detection process. It must be a value in the
  18759. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  18760. accuracy. Default value is 15.
  18761. @item stepsize
  18762. Set stepsize of the search process. The region around minimum is
  18763. scanned with 1 pixel resolution. Default value is 6.
  18764. @item mincontrast
  18765. Set minimum contrast. Below this value a local measurement field is
  18766. discarded. Must be a floating point value in the range 0-1. Default
  18767. value is 0.3.
  18768. @item tripod
  18769. Set reference frame number for tripod mode.
  18770. If enabled, the motion of the frames is compared to a reference frame
  18771. in the filtered stream, identified by the specified number. The idea
  18772. is to compensate all movements in a more-or-less static scene and keep
  18773. the camera view absolutely still.
  18774. If set to 0, it is disabled. The frames are counted starting from 1.
  18775. @item show
  18776. Show fields and transforms in the resulting frames. It accepts an
  18777. integer in the range 0-2. Default value is 0, which disables any
  18778. visualization.
  18779. @item fileformat
  18780. Format for the transforms data file to be written.
  18781. Acceptable values are
  18782. @table @samp
  18783. @item ascii
  18784. Human-readable plain text
  18785. @item binary
  18786. Binary format, roughly 40% smaller than @code{ascii}. (@emph{default})
  18787. @end table
  18788. @end table
  18789. @subsection Examples
  18790. @itemize
  18791. @item
  18792. Use default values:
  18793. @example
  18794. vidstabdetect
  18795. @end example
  18796. @item
  18797. Analyze strongly shaky movie and put the results in file
  18798. @file{mytransforms.trf}:
  18799. @example
  18800. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  18801. @end example
  18802. @item
  18803. Visualize the result of internal transformations in the resulting
  18804. video:
  18805. @example
  18806. vidstabdetect=show=1
  18807. @end example
  18808. @item
  18809. Analyze a video with medium shakiness using @command{ffmpeg}:
  18810. @example
  18811. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  18812. @end example
  18813. @end itemize
  18814. @anchor{vidstabtransform}
  18815. @section vidstabtransform
  18816. Video stabilization/deshaking: pass 2 of 2,
  18817. see @ref{vidstabdetect} for pass 1.
  18818. Read a file with transform information for each frame and
  18819. apply/compensate them. Together with the @ref{vidstabdetect}
  18820. filter this can be used to deshake videos. See also
  18821. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  18822. the @ref{unsharp} filter, see below.
  18823. To enable compilation of this filter you need to configure FFmpeg with
  18824. @code{--enable-libvidstab}.
  18825. @subsection Options
  18826. @table @option
  18827. @item input
  18828. Set path to the file used to read the transforms. Default value is
  18829. @file{transforms.trf}.
  18830. @item smoothing
  18831. Set the number of frames (value*2 + 1) used for lowpass filtering the
  18832. camera movements. Default value is 10.
  18833. For example a number of 10 means that 21 frames are used (10 in the
  18834. past and 10 in the future) to smoothen the motion in the video. A
  18835. larger value leads to a smoother video, but limits the acceleration of
  18836. the camera (pan/tilt movements). 0 is a special case where a static
  18837. camera is simulated.
  18838. @item optalgo
  18839. Set the camera path optimization algorithm.
  18840. Accepted values are:
  18841. @table @samp
  18842. @item gauss
  18843. gaussian kernel low-pass filter on camera motion (default)
  18844. @item avg
  18845. averaging on transformations
  18846. @end table
  18847. @item maxshift
  18848. Set maximal number of pixels to translate frames. Default value is -1,
  18849. meaning no limit.
  18850. @item maxangle
  18851. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  18852. value is -1, meaning no limit.
  18853. @item crop
  18854. Specify how to deal with borders that may be visible due to movement
  18855. compensation.
  18856. Available values are:
  18857. @table @samp
  18858. @item keep
  18859. keep image information from previous frame (default)
  18860. @item black
  18861. fill the border black
  18862. @end table
  18863. @item invert
  18864. Invert transforms if set to 1. Default value is 0.
  18865. @item relative
  18866. Consider transforms as relative to previous frame if set to 1,
  18867. absolute if set to 0. Default value is 0.
  18868. @item zoom
  18869. Set percentage to zoom. A positive value will result in a zoom-in
  18870. effect, a negative value in a zoom-out effect. Default value is 0 (no
  18871. zoom).
  18872. @item optzoom
  18873. Set optimal zooming to avoid borders.
  18874. Accepted values are:
  18875. @table @samp
  18876. @item 0
  18877. disabled
  18878. @item 1
  18879. optimal static zoom value is determined (only very strong movements
  18880. will lead to visible borders) (default)
  18881. @item 2
  18882. optimal adaptive zoom value is determined (no borders will be
  18883. visible), see @option{zoomspeed}
  18884. @end table
  18885. Note that the value given at zoom is added to the one calculated here.
  18886. @item zoomspeed
  18887. Set percent to zoom maximally each frame (enabled when
  18888. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  18889. 0.25.
  18890. @item interpol
  18891. Specify type of interpolation.
  18892. Available values are:
  18893. @table @samp
  18894. @item no
  18895. no interpolation
  18896. @item linear
  18897. linear only horizontal
  18898. @item bilinear
  18899. linear in both directions (default)
  18900. @item bicubic
  18901. cubic in both directions (slow)
  18902. @end table
  18903. @item tripod
  18904. Enable virtual tripod mode if set to 1, which is equivalent to
  18905. @code{relative=0:smoothing=0}. Default value is 0.
  18906. Use also @code{tripod} option of @ref{vidstabdetect}.
  18907. @item debug
  18908. Increase log verbosity if set to 1. Also the detected global motions
  18909. are written to the temporary file @file{global_motions.trf}. Default
  18910. value is 0.
  18911. @end table
  18912. @subsection Examples
  18913. @itemize
  18914. @item
  18915. Use @command{ffmpeg} for a typical stabilization with default values:
  18916. @example
  18917. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  18918. @end example
  18919. Note the use of the @ref{unsharp} filter which is always recommended.
  18920. @item
  18921. Zoom in a bit more and load transform data from a given file:
  18922. @example
  18923. vidstabtransform=zoom=5:input="mytransforms.trf"
  18924. @end example
  18925. @item
  18926. Smoothen the video even more:
  18927. @example
  18928. vidstabtransform=smoothing=30
  18929. @end example
  18930. @end itemize
  18931. @section vflip
  18932. Flip the input video vertically.
  18933. For example, to vertically flip a video with @command{ffmpeg}:
  18934. @example
  18935. ffmpeg -i in.avi -vf "vflip" out.avi
  18936. @end example
  18937. @section vfrdet
  18938. Detect variable frame rate video.
  18939. This filter tries to detect if the input is variable or constant frame rate.
  18940. At end it will output number of frames detected as having variable delta pts,
  18941. and ones with constant delta pts.
  18942. If there was frames with variable delta, than it will also show min, max and
  18943. average delta encountered.
  18944. @section vibrance
  18945. Boost or alter saturation.
  18946. The filter accepts the following options:
  18947. @table @option
  18948. @item intensity
  18949. Set strength of boost if positive value or strength of alter if negative value.
  18950. Default is 0. Allowed range is from -2 to 2.
  18951. @item rbal
  18952. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  18953. @item gbal
  18954. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  18955. @item bbal
  18956. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  18957. @item rlum
  18958. Set the red luma coefficient.
  18959. @item glum
  18960. Set the green luma coefficient.
  18961. @item blum
  18962. Set the blue luma coefficient.
  18963. @item alternate
  18964. If @code{intensity} is negative and this is set to 1, colors will change,
  18965. otherwise colors will be less saturated, more towards gray.
  18966. @end table
  18967. @subsection Commands
  18968. This filter supports the all above options as @ref{commands}.
  18969. @section vif
  18970. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  18971. This filter takes two input videos.
  18972. Both input videos must have the same resolution and pixel format for
  18973. this filter to work correctly. Also it assumes that both inputs
  18974. have the same number of frames, which are compared one by one.
  18975. The obtained average VIF score is printed through the logging system.
  18976. The filter stores the calculated VIF score of each frame.
  18977. This filter also supports the @ref{framesync} options.
  18978. In the below example the input file @file{main.mpg} being processed is compared
  18979. with the reference file @file{ref.mpg}.
  18980. @example
  18981. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  18982. @end example
  18983. @anchor{vignette}
  18984. @section vignette
  18985. Make or reverse a natural vignetting effect.
  18986. The filter accepts the following options:
  18987. @table @option
  18988. @item angle, a
  18989. Set lens angle expression as a number of radians.
  18990. The value is clipped in the @code{[0,PI/2]} range.
  18991. Default value: @code{"PI/5"}
  18992. @item x0
  18993. @item y0
  18994. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  18995. by default.
  18996. @item mode
  18997. Set forward/backward mode.
  18998. Available modes are:
  18999. @table @samp
  19000. @item forward
  19001. The larger the distance from the central point, the darker the image becomes.
  19002. @item backward
  19003. The larger the distance from the central point, the brighter the image becomes.
  19004. This can be used to reverse a vignette effect, though there is no automatic
  19005. detection to extract the lens @option{angle} and other settings (yet). It can
  19006. also be used to create a burning effect.
  19007. @end table
  19008. Default value is @samp{forward}.
  19009. @item eval
  19010. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  19011. It accepts the following values:
  19012. @table @samp
  19013. @item init
  19014. Evaluate expressions only once during the filter initialization.
  19015. @item frame
  19016. Evaluate expressions for each incoming frame. This is way slower than the
  19017. @samp{init} mode since it requires all the scalers to be re-computed, but it
  19018. allows advanced dynamic expressions.
  19019. @end table
  19020. Default value is @samp{init}.
  19021. @item dither
  19022. Set dithering to reduce the circular banding effects. Default is @code{1}
  19023. (enabled).
  19024. @item aspect
  19025. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  19026. Setting this value to the SAR of the input will make a rectangular vignetting
  19027. following the dimensions of the video.
  19028. Default is @code{1/1}.
  19029. @end table
  19030. @subsection Expressions
  19031. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  19032. following parameters.
  19033. @table @option
  19034. @item w
  19035. @item h
  19036. input width and height
  19037. @item n
  19038. the number of input frame, starting from 0
  19039. @item pts
  19040. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  19041. @var{TB} units, NAN if undefined
  19042. @item r
  19043. frame rate of the input video, NAN if the input frame rate is unknown
  19044. @item t
  19045. the PTS (Presentation TimeStamp) of the filtered video frame,
  19046. expressed in seconds, NAN if undefined
  19047. @item tb
  19048. time base of the input video
  19049. @end table
  19050. @subsection Examples
  19051. @itemize
  19052. @item
  19053. Apply simple strong vignetting effect:
  19054. @example
  19055. vignette=PI/4
  19056. @end example
  19057. @item
  19058. Make a flickering vignetting:
  19059. @example
  19060. vignette='PI/4+random(1)*PI/50':eval=frame
  19061. @end example
  19062. @end itemize
  19063. @section vmafmotion
  19064. Obtain the average VMAF motion score of a video.
  19065. It is one of the component metrics of VMAF.
  19066. The obtained average motion score is printed through the logging system.
  19067. The filter accepts the following options:
  19068. @table @option
  19069. @item stats_file
  19070. If specified, the filter will use the named file to save the motion score of
  19071. each frame with respect to the previous frame.
  19072. When filename equals "-" the data is sent to standard output.
  19073. @end table
  19074. Example:
  19075. @example
  19076. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  19077. @end example
  19078. @anchor{vstack}
  19079. @section vstack
  19080. Stack input videos vertically.
  19081. All streams must be of same pixel format and of same width.
  19082. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  19083. to create same output.
  19084. The filter accepts the following options:
  19085. @table @option
  19086. @item inputs
  19087. Set number of input streams. Default is 2.
  19088. @item shortest
  19089. If set to 1, force the output to terminate when the shortest input
  19090. terminates. Default value is 0.
  19091. @end table
  19092. @section w3fdif
  19093. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  19094. Deinterlacing Filter").
  19095. Based on the process described by Martin Weston for BBC R&D, and
  19096. implemented based on the de-interlace algorithm written by Jim
  19097. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  19098. uses filter coefficients calculated by BBC R&D.
  19099. This filter uses field-dominance information in frame to decide which
  19100. of each pair of fields to place first in the output.
  19101. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  19102. There are two sets of filter coefficients, so called "simple"
  19103. and "complex". Which set of filter coefficients is used can
  19104. be set by passing an optional parameter:
  19105. @table @option
  19106. @item filter
  19107. Set the interlacing filter coefficients. Accepts one of the following values:
  19108. @table @samp
  19109. @item simple
  19110. Simple filter coefficient set.
  19111. @item complex
  19112. More-complex filter coefficient set.
  19113. @end table
  19114. Default value is @samp{complex}.
  19115. @item mode
  19116. The interlacing mode to adopt. It accepts one of the following values:
  19117. @table @option
  19118. @item frame
  19119. Output one frame for each frame.
  19120. @item field
  19121. Output one frame for each field.
  19122. @end table
  19123. The default value is @code{field}.
  19124. @item parity
  19125. The picture field parity assumed for the input interlaced video. It accepts one
  19126. of the following values:
  19127. @table @option
  19128. @item tff
  19129. Assume the top field is first.
  19130. @item bff
  19131. Assume the bottom field is first.
  19132. @item auto
  19133. Enable automatic detection of field parity.
  19134. @end table
  19135. The default value is @code{auto}.
  19136. If the interlacing is unknown or the decoder does not export this information,
  19137. top field first will be assumed.
  19138. @item deint
  19139. Specify which frames to deinterlace. Accepts one of the following values:
  19140. @table @samp
  19141. @item all
  19142. Deinterlace all frames,
  19143. @item interlaced
  19144. Only deinterlace frames marked as interlaced.
  19145. @end table
  19146. Default value is @samp{all}.
  19147. @end table
  19148. @subsection Commands
  19149. This filter supports same @ref{commands} as options.
  19150. @section waveform
  19151. Video waveform monitor.
  19152. The waveform monitor plots color component intensity. By default luma
  19153. only. Each column of the waveform corresponds to a column of pixels in the
  19154. source video.
  19155. It accepts the following options:
  19156. @table @option
  19157. @item mode, m
  19158. Can be either @code{row}, or @code{column}. Default is @code{column}.
  19159. In row mode, the graph on the left side represents color component value 0 and
  19160. the right side represents value = 255. In column mode, the top side represents
  19161. color component value = 0 and bottom side represents value = 255.
  19162. @item intensity, i
  19163. Set intensity. Smaller values are useful to find out how many values of the same
  19164. luminance are distributed across input rows/columns.
  19165. Default value is @code{0.04}. Allowed range is [0, 1].
  19166. @item mirror, r
  19167. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  19168. In mirrored mode, higher values will be represented on the left
  19169. side for @code{row} mode and at the top for @code{column} mode. Default is
  19170. @code{1} (mirrored).
  19171. @item display, d
  19172. Set display mode.
  19173. It accepts the following values:
  19174. @table @samp
  19175. @item overlay
  19176. Presents information identical to that in the @code{parade}, except
  19177. that the graphs representing color components are superimposed directly
  19178. over one another.
  19179. This display mode makes it easier to spot relative differences or similarities
  19180. in overlapping areas of the color components that are supposed to be identical,
  19181. such as neutral whites, grays, or blacks.
  19182. @item stack
  19183. Display separate graph for the color components side by side in
  19184. @code{row} mode or one below the other in @code{column} mode.
  19185. @item parade
  19186. Display separate graph for the color components side by side in
  19187. @code{column} mode or one below the other in @code{row} mode.
  19188. Using this display mode makes it easy to spot color casts in the highlights
  19189. and shadows of an image, by comparing the contours of the top and the bottom
  19190. graphs of each waveform. Since whites, grays, and blacks are characterized
  19191. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  19192. should display three waveforms of roughly equal width/height. If not, the
  19193. correction is easy to perform by making level adjustments the three waveforms.
  19194. @end table
  19195. Default is @code{stack}.
  19196. @item components, c
  19197. Set which color components to display. Default is 1, which means only luma
  19198. or red color component if input is in RGB colorspace. If is set for example to
  19199. 7 it will display all 3 (if) available color components.
  19200. @item envelope, e
  19201. @table @samp
  19202. @item none
  19203. No envelope, this is default.
  19204. @item instant
  19205. Instant envelope, minimum and maximum values presented in graph will be easily
  19206. visible even with small @code{step} value.
  19207. @item peak
  19208. Hold minimum and maximum values presented in graph across time. This way you
  19209. can still spot out of range values without constantly looking at waveforms.
  19210. @item peak+instant
  19211. Peak and instant envelope combined together.
  19212. @end table
  19213. @item filter, f
  19214. @table @samp
  19215. @item lowpass
  19216. No filtering, this is default.
  19217. @item flat
  19218. Luma and chroma combined together.
  19219. @item aflat
  19220. Similar as above, but shows difference between blue and red chroma.
  19221. @item xflat
  19222. Similar as above, but use different colors.
  19223. @item yflat
  19224. Similar as above, but again with different colors.
  19225. @item chroma
  19226. Displays only chroma.
  19227. @item color
  19228. Displays actual color value on waveform.
  19229. @item acolor
  19230. Similar as above, but with luma showing frequency of chroma values.
  19231. @end table
  19232. @item graticule, g
  19233. Set which graticule to display.
  19234. @table @samp
  19235. @item none
  19236. Do not display graticule.
  19237. @item green
  19238. Display green graticule showing legal broadcast ranges.
  19239. @item orange
  19240. Display orange graticule showing legal broadcast ranges.
  19241. @item invert
  19242. Display invert graticule showing legal broadcast ranges.
  19243. @end table
  19244. @item opacity, o
  19245. Set graticule opacity.
  19246. @item flags, fl
  19247. Set graticule flags.
  19248. @table @samp
  19249. @item numbers
  19250. Draw numbers above lines. By default enabled.
  19251. @item dots
  19252. Draw dots instead of lines.
  19253. @end table
  19254. @item scale, s
  19255. Set scale used for displaying graticule.
  19256. @table @samp
  19257. @item digital
  19258. @item millivolts
  19259. @item ire
  19260. @end table
  19261. Default is digital.
  19262. @item bgopacity, b
  19263. Set background opacity.
  19264. @item tint0, t0
  19265. @item tint1, t1
  19266. Set tint for output.
  19267. Only used with lowpass filter and when display is not overlay and input
  19268. pixel formats are not RGB.
  19269. @item fitmode, fm
  19270. Set sample aspect ratio of video output frames.
  19271. Can be used to configure waveform so it is not
  19272. streched too much in one of directions.
  19273. @table @samp
  19274. @item none
  19275. Set sample aspect ration to 1/1.
  19276. @item size
  19277. Set sample aspect ratio to match input size of video
  19278. @end table
  19279. Default is @samp{none}.
  19280. @item input
  19281. Set input formats for filter to pick from.
  19282. Can be @samp{all}, for selecting from all available formats,
  19283. or @samp{first}, for selecting first available format.
  19284. Default is @samp{first}.
  19285. @end table
  19286. @section weave, doubleweave
  19287. The @code{weave} takes a field-based video input and join
  19288. each two sequential fields into single frame, producing a new double
  19289. height clip with half the frame rate and half the frame count.
  19290. The @code{doubleweave} works same as @code{weave} but without
  19291. halving frame rate and frame count.
  19292. It accepts the following option:
  19293. @table @option
  19294. @item first_field
  19295. Set first field. Available values are:
  19296. @table @samp
  19297. @item top, t
  19298. Set the frame as top-field-first.
  19299. @item bottom, b
  19300. Set the frame as bottom-field-first.
  19301. @end table
  19302. @end table
  19303. @subsection Examples
  19304. @itemize
  19305. @item
  19306. Interlace video using @ref{select} and @ref{separatefields} filter:
  19307. @example
  19308. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  19309. @end example
  19310. @end itemize
  19311. @section xbr
  19312. Apply the xBR high-quality magnification filter which is designed for pixel
  19313. art. It follows a set of edge-detection rules, see
  19314. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  19315. It accepts the following option:
  19316. @table @option
  19317. @item n
  19318. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  19319. @code{3xBR} and @code{4} for @code{4xBR}.
  19320. Default is @code{3}.
  19321. @end table
  19322. @section xcorrelate
  19323. Apply normalized cross-correlation between first and second input video stream.
  19324. Second input video stream dimensions must be lower than first input video stream.
  19325. The filter accepts the following options:
  19326. @table @option
  19327. @item planes
  19328. Set which planes to process.
  19329. @item secondary
  19330. Set which secondary video frames will be processed from second input video stream,
  19331. can be @var{first} or @var{all}. Default is @var{all}.
  19332. @end table
  19333. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  19334. @section xfade
  19335. Apply cross fade from one input video stream to another input video stream.
  19336. The cross fade is applied for specified duration.
  19337. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  19338. frame rate and timebase.
  19339. The filter accepts the following options:
  19340. @table @option
  19341. @item transition
  19342. Set one of available transition effects:
  19343. @table @samp
  19344. @item custom
  19345. @item fade
  19346. @item wipeleft
  19347. @item wiperight
  19348. @item wipeup
  19349. @item wipedown
  19350. @item slideleft
  19351. @item slideright
  19352. @item slideup
  19353. @item slidedown
  19354. @item circlecrop
  19355. @item rectcrop
  19356. @item distance
  19357. @item fadeblack
  19358. @item fadewhite
  19359. @item radial
  19360. @item smoothleft
  19361. @item smoothright
  19362. @item smoothup
  19363. @item smoothdown
  19364. @item circleopen
  19365. @item circleclose
  19366. @item vertopen
  19367. @item vertclose
  19368. @item horzopen
  19369. @item horzclose
  19370. @item dissolve
  19371. @item pixelize
  19372. @item diagtl
  19373. @item diagtr
  19374. @item diagbl
  19375. @item diagbr
  19376. @item hlslice
  19377. @item hrslice
  19378. @item vuslice
  19379. @item vdslice
  19380. @item hblur
  19381. @item fadegrays
  19382. @item wipetl
  19383. @item wipetr
  19384. @item wipebl
  19385. @item wipebr
  19386. @item squeezeh
  19387. @item squeezev
  19388. @item zoomin
  19389. @item fadefast
  19390. @item fadeslow
  19391. @item hlwind
  19392. @item hrwind
  19393. @item vuwind
  19394. @item vdwind
  19395. @item coverleft
  19396. @item coverright
  19397. @item coverup
  19398. @item coverdown
  19399. @item revealleft
  19400. @item revealright
  19401. @item revealup
  19402. @item revealdown
  19403. @end table
  19404. Default transition effect is fade.
  19405. @item duration
  19406. Set cross fade duration in seconds.
  19407. Range is 0 to 60 seconds.
  19408. Default duration is 1 second.
  19409. @item offset
  19410. Set cross fade start relative to first input stream in seconds.
  19411. Default offset is 0.
  19412. @item expr
  19413. Set expression for custom transition effect.
  19414. The expressions can use the following variables and functions:
  19415. @table @option
  19416. @item X
  19417. @item Y
  19418. The coordinates of the current sample.
  19419. @item W
  19420. @item H
  19421. The width and height of the image.
  19422. @item P
  19423. Progress of transition effect.
  19424. @item PLANE
  19425. Currently processed plane.
  19426. @item A
  19427. Return value of first input at current location and plane.
  19428. @item B
  19429. Return value of second input at current location and plane.
  19430. @item a0(x, y)
  19431. @item a1(x, y)
  19432. @item a2(x, y)
  19433. @item a3(x, y)
  19434. Return the value of the pixel at location (@var{x},@var{y}) of the
  19435. first/second/third/fourth component of first input.
  19436. @item b0(x, y)
  19437. @item b1(x, y)
  19438. @item b2(x, y)
  19439. @item b3(x, y)
  19440. Return the value of the pixel at location (@var{x},@var{y}) of the
  19441. first/second/third/fourth component of second input.
  19442. @end table
  19443. @end table
  19444. @subsection Examples
  19445. @itemize
  19446. @item
  19447. Cross fade from one input video to another input video, with fade transition and duration of transition
  19448. of 2 seconds starting at offset of 5 seconds:
  19449. @example
  19450. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  19451. @end example
  19452. @end itemize
  19453. @section xmedian
  19454. Pick median pixels from several input videos.
  19455. The filter accepts the following options:
  19456. @table @option
  19457. @item inputs
  19458. Set number of inputs.
  19459. Default is 3. Allowed range is from 3 to 255.
  19460. If number of inputs is even number, than result will be mean value between two median values.
  19461. @item planes
  19462. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  19463. @item percentile
  19464. Set median percentile. Default value is @code{0.5}.
  19465. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  19466. minimum values, and @code{1} maximum values.
  19467. @end table
  19468. @subsection Commands
  19469. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  19470. @anchor{xstack}
  19471. @section xstack
  19472. Stack video inputs into custom layout.
  19473. All streams must be of same pixel format.
  19474. The filter accepts the following options:
  19475. @table @option
  19476. @item inputs
  19477. Set number of input streams. Default is 2.
  19478. @item layout
  19479. Specify layout of inputs.
  19480. This option requires the desired layout configuration to be explicitly set by the user.
  19481. This sets position of each video input in output. Each input
  19482. is separated by '|'.
  19483. The first number represents the column, and the second number represents the row.
  19484. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  19485. where X is video input from which to take width or height.
  19486. Multiple values can be used when separated by '+'. In such
  19487. case values are summed together.
  19488. Note that if inputs are of different sizes gaps may appear, as not all of
  19489. the output video frame will be filled. Similarly, videos can overlap each
  19490. other if their position doesn't leave enough space for the full frame of
  19491. adjoining videos.
  19492. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  19493. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  19494. the user. Either @code{grid} or @code{layout} can be specified at a time.
  19495. Specifying both will result in an error.
  19496. @item grid
  19497. Specify a fixed size grid of inputs.
  19498. This option is used to create a fixed size grid of the input streams. Set the
  19499. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  19500. input streams and they will be arranged as a grid with @code{ROWS} rows and
  19501. @code{COLUMNS} columns. When using this option, each input stream within a row
  19502. must have the same height and all the rows must have the same width.
  19503. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  19504. set to @code{ROWS * COLUMNS}.
  19505. For 2 inputs, a default grid of @code{2x1} (equivalent to
  19506. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  19507. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  19508. Specifying both will result in an error.
  19509. @item shortest
  19510. If set to 1, force the output to terminate when the shortest input
  19511. terminates. Default value is 0.
  19512. @item fill
  19513. If set to valid color, all unused pixels will be filled with that color.
  19514. By default fill is set to none, so it is disabled.
  19515. @end table
  19516. @subsection Examples
  19517. @itemize
  19518. @item
  19519. Display 4 inputs into 2x2 grid.
  19520. Layout:
  19521. @example
  19522. input1(0, 0) | input3(w0, 0)
  19523. input2(0, h0) | input4(w0, h0)
  19524. @end example
  19525. @example
  19526. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  19527. @end example
  19528. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19529. @item
  19530. Display 4 inputs into 1x4 grid.
  19531. Layout:
  19532. @example
  19533. input1(0, 0)
  19534. input2(0, h0)
  19535. input3(0, h0+h1)
  19536. input4(0, h0+h1+h2)
  19537. @end example
  19538. @example
  19539. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  19540. @end example
  19541. Note that if inputs are of different widths, unused space will appear.
  19542. @item
  19543. Display 9 inputs into 3x3 grid.
  19544. Layout:
  19545. @example
  19546. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  19547. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  19548. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  19549. @end example
  19550. @example
  19551. 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
  19552. @end example
  19553. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19554. @item
  19555. Display 16 inputs into 4x4 grid.
  19556. Layout:
  19557. @example
  19558. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  19559. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  19560. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  19561. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  19562. @end example
  19563. @example
  19564. 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|
  19565. 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
  19566. @end example
  19567. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19568. @end itemize
  19569. @anchor{yadif}
  19570. @section yadif
  19571. Deinterlace the input video ("yadif" means "yet another deinterlacing
  19572. filter").
  19573. It accepts the following parameters:
  19574. @table @option
  19575. @item mode
  19576. The interlacing mode to adopt. It accepts one of the following values:
  19577. @table @option
  19578. @item 0, send_frame
  19579. Output one frame for each frame.
  19580. @item 1, send_field
  19581. Output one frame for each field.
  19582. @item 2, send_frame_nospatial
  19583. Like @code{send_frame}, but it skips the spatial interlacing check.
  19584. @item 3, send_field_nospatial
  19585. Like @code{send_field}, but it skips the spatial interlacing check.
  19586. @end table
  19587. The default value is @code{send_frame}.
  19588. @item parity
  19589. The picture field parity assumed for the input interlaced video. It accepts one
  19590. of the following values:
  19591. @table @option
  19592. @item 0, tff
  19593. Assume the top field is first.
  19594. @item 1, bff
  19595. Assume the bottom field is first.
  19596. @item -1, auto
  19597. Enable automatic detection of field parity.
  19598. @end table
  19599. The default value is @code{auto}.
  19600. If the interlacing is unknown or the decoder does not export this information,
  19601. top field first will be assumed.
  19602. @item deint
  19603. Specify which frames to deinterlace. Accepts one of the following
  19604. values:
  19605. @table @option
  19606. @item 0, all
  19607. Deinterlace all frames.
  19608. @item 1, interlaced
  19609. Only deinterlace frames marked as interlaced.
  19610. @end table
  19611. The default value is @code{all}.
  19612. @end table
  19613. @section yadif_cuda
  19614. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  19615. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  19616. and/or nvenc.
  19617. It accepts the following parameters:
  19618. @table @option
  19619. @item mode
  19620. The interlacing mode to adopt. It accepts one of the following values:
  19621. @table @option
  19622. @item 0, send_frame
  19623. Output one frame for each frame.
  19624. @item 1, send_field
  19625. Output one frame for each field.
  19626. @item 2, send_frame_nospatial
  19627. Like @code{send_frame}, but it skips the spatial interlacing check.
  19628. @item 3, send_field_nospatial
  19629. Like @code{send_field}, but it skips the spatial interlacing check.
  19630. @end table
  19631. The default value is @code{send_frame}.
  19632. @item parity
  19633. The picture field parity assumed for the input interlaced video. It accepts one
  19634. of the following values:
  19635. @table @option
  19636. @item 0, tff
  19637. Assume the top field is first.
  19638. @item 1, bff
  19639. Assume the bottom field is first.
  19640. @item -1, auto
  19641. Enable automatic detection of field parity.
  19642. @end table
  19643. The default value is @code{auto}.
  19644. If the interlacing is unknown or the decoder does not export this information,
  19645. top field first will be assumed.
  19646. @item deint
  19647. Specify which frames to deinterlace. Accepts one of the following
  19648. values:
  19649. @table @option
  19650. @item 0, all
  19651. Deinterlace all frames.
  19652. @item 1, interlaced
  19653. Only deinterlace frames marked as interlaced.
  19654. @end table
  19655. The default value is @code{all}.
  19656. @end table
  19657. @section yaepblur
  19658. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  19659. The algorithm is described in
  19660. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  19661. It accepts the following parameters:
  19662. @table @option
  19663. @item radius, r
  19664. Set the window radius. Default value is 3.
  19665. @item planes, p
  19666. Set which planes to filter. Default is only the first plane.
  19667. @item sigma, s
  19668. Set blur strength. Default value is 128.
  19669. @end table
  19670. @subsection Commands
  19671. This filter supports same @ref{commands} as options.
  19672. @section zoompan
  19673. Apply Zoom & Pan effect.
  19674. This filter accepts the following options:
  19675. @table @option
  19676. @item zoom, z
  19677. Set the zoom expression. Range is 1-10. Default is 1.
  19678. @item x
  19679. @item y
  19680. Set the x and y expression. Default is 0.
  19681. @item d
  19682. Set the duration expression in number of frames.
  19683. This sets for how many number of frames effect will last for
  19684. single input image. Default is 90.
  19685. @item s
  19686. Set the output image size, default is 'hd720'.
  19687. @item fps
  19688. Set the output frame rate, default is '25'.
  19689. @end table
  19690. Each expression can contain the following constants:
  19691. @table @option
  19692. @item in_w, iw
  19693. Input width.
  19694. @item in_h, ih
  19695. Input height.
  19696. @item out_w, ow
  19697. Output width.
  19698. @item out_h, oh
  19699. Output height.
  19700. @item in
  19701. Input frame count.
  19702. @item on
  19703. Output frame count.
  19704. @item in_time, it
  19705. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  19706. @item out_time, time, ot
  19707. The output timestamp expressed in seconds.
  19708. @item x
  19709. @item y
  19710. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  19711. for current input frame.
  19712. @item px
  19713. @item py
  19714. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  19715. not yet such frame (first input frame).
  19716. @item zoom
  19717. Last calculated zoom from 'z' expression for current input frame.
  19718. @item pzoom
  19719. Last calculated zoom of last output frame of previous input frame.
  19720. @item duration
  19721. Number of output frames for current input frame. Calculated from 'd' expression
  19722. for each input frame.
  19723. @item pduration
  19724. number of output frames created for previous input frame
  19725. @item a
  19726. Rational number: input width / input height
  19727. @item sar
  19728. sample aspect ratio
  19729. @item dar
  19730. display aspect ratio
  19731. @end table
  19732. @subsection Examples
  19733. @itemize
  19734. @item
  19735. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  19736. @example
  19737. 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
  19738. @end example
  19739. @item
  19740. Zoom in up to 1.5x and pan always at center of picture:
  19741. @example
  19742. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19743. @end example
  19744. @item
  19745. Same as above but without pausing:
  19746. @example
  19747. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19748. @end example
  19749. @item
  19750. Zoom in 2x into center of picture only for the first second of the input video:
  19751. @example
  19752. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19753. @end example
  19754. @end itemize
  19755. @anchor{zscale}
  19756. @section zscale
  19757. Scale (resize) the input video, using the z.lib library:
  19758. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  19759. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  19760. The zscale filter forces the output display aspect ratio to be the same
  19761. as the input, by changing the output sample aspect ratio.
  19762. If the input image format is different from the format requested by
  19763. the next filter, the zscale filter will convert the input to the
  19764. requested format.
  19765. @subsection Options
  19766. The filter accepts the following options.
  19767. @table @option
  19768. @item width, w
  19769. @item height, h
  19770. Set the output video dimension expression. Default value is the input
  19771. dimension.
  19772. If the @var{width} or @var{w} value is 0, the input width is used for
  19773. the output. If the @var{height} or @var{h} value is 0, the input height
  19774. is used for the output.
  19775. If one and only one of the values is -n with n >= 1, the zscale filter
  19776. will use a value that maintains the aspect ratio of the input image,
  19777. calculated from the other specified dimension. After that it will,
  19778. however, make sure that the calculated dimension is divisible by n and
  19779. adjust the value if necessary.
  19780. If both values are -n with n >= 1, the behavior will be identical to
  19781. both values being set to 0 as previously detailed.
  19782. See below for the list of accepted constants for use in the dimension
  19783. expression.
  19784. @item size, s
  19785. Set the video size. For the syntax of this option, check the
  19786. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19787. @item dither, d
  19788. Set the dither type.
  19789. Possible values are:
  19790. @table @var
  19791. @item none
  19792. @item ordered
  19793. @item random
  19794. @item error_diffusion
  19795. @end table
  19796. Default is none.
  19797. @item filter, f
  19798. Set the resize filter type.
  19799. Possible values are:
  19800. @table @var
  19801. @item point
  19802. @item bilinear
  19803. @item bicubic
  19804. @item spline16
  19805. @item spline36
  19806. @item lanczos
  19807. @end table
  19808. Default is bilinear.
  19809. @item range, r
  19810. Set the color range.
  19811. Possible values are:
  19812. @table @var
  19813. @item input
  19814. @item limited
  19815. @item full
  19816. @end table
  19817. Default is same as input.
  19818. @item primaries, p
  19819. Set the color primaries.
  19820. Possible values are:
  19821. @table @var
  19822. @item input
  19823. @item 709
  19824. @item unspecified
  19825. @item 170m
  19826. @item 240m
  19827. @item 2020
  19828. @end table
  19829. Default is same as input.
  19830. @item transfer, t
  19831. Set the transfer characteristics.
  19832. Possible values are:
  19833. @table @var
  19834. @item input
  19835. @item 709
  19836. @item unspecified
  19837. @item 601
  19838. @item linear
  19839. @item 2020_10
  19840. @item 2020_12
  19841. @item smpte2084
  19842. @item iec61966-2-1
  19843. @item arib-std-b67
  19844. @end table
  19845. Default is same as input.
  19846. @item matrix, m
  19847. Set the colorspace matrix.
  19848. Possible value are:
  19849. @table @var
  19850. @item input
  19851. @item 709
  19852. @item unspecified
  19853. @item 470bg
  19854. @item 170m
  19855. @item 2020_ncl
  19856. @item 2020_cl
  19857. @end table
  19858. Default is same as input.
  19859. @item rangein, rin
  19860. Set the input color range.
  19861. Possible values are:
  19862. @table @var
  19863. @item input
  19864. @item limited
  19865. @item full
  19866. @end table
  19867. Default is same as input.
  19868. @item primariesin, pin
  19869. Set the input color primaries.
  19870. Possible values are:
  19871. @table @var
  19872. @item input
  19873. @item 709
  19874. @item unspecified
  19875. @item 170m
  19876. @item 240m
  19877. @item 2020
  19878. @end table
  19879. Default is same as input.
  19880. @item transferin, tin
  19881. Set the input transfer characteristics.
  19882. Possible values are:
  19883. @table @var
  19884. @item input
  19885. @item 709
  19886. @item unspecified
  19887. @item 601
  19888. @item linear
  19889. @item 2020_10
  19890. @item 2020_12
  19891. @end table
  19892. Default is same as input.
  19893. @item matrixin, min
  19894. Set the input colorspace matrix.
  19895. Possible value are:
  19896. @table @var
  19897. @item input
  19898. @item 709
  19899. @item unspecified
  19900. @item 470bg
  19901. @item 170m
  19902. @item 2020_ncl
  19903. @item 2020_cl
  19904. @end table
  19905. @item chromal, c
  19906. Set the output chroma location.
  19907. Possible values are:
  19908. @table @var
  19909. @item input
  19910. @item left
  19911. @item center
  19912. @item topleft
  19913. @item top
  19914. @item bottomleft
  19915. @item bottom
  19916. @end table
  19917. @item chromalin, cin
  19918. Set the input chroma location.
  19919. Possible values are:
  19920. @table @var
  19921. @item input
  19922. @item left
  19923. @item center
  19924. @item topleft
  19925. @item top
  19926. @item bottomleft
  19927. @item bottom
  19928. @end table
  19929. @item npl
  19930. Set the nominal peak luminance.
  19931. @item param_a
  19932. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  19933. filter taps for lanczos.
  19934. @item param_b
  19935. Parameter B for scaling filters. Parameter "c" for bicubic.
  19936. @end table
  19937. The values of the @option{w} and @option{h} options are expressions
  19938. containing the following constants:
  19939. @table @var
  19940. @item in_w
  19941. @item in_h
  19942. The input width and height
  19943. @item iw
  19944. @item ih
  19945. These are the same as @var{in_w} and @var{in_h}.
  19946. @item out_w
  19947. @item out_h
  19948. The output (scaled) width and height
  19949. @item ow
  19950. @item oh
  19951. These are the same as @var{out_w} and @var{out_h}
  19952. @item a
  19953. The same as @var{iw} / @var{ih}
  19954. @item sar
  19955. input sample aspect ratio
  19956. @item dar
  19957. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  19958. @item hsub
  19959. @item vsub
  19960. horizontal and vertical input chroma subsample values. For example for the
  19961. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19962. @item ohsub
  19963. @item ovsub
  19964. horizontal and vertical output chroma subsample values. For example for the
  19965. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19966. @end table
  19967. @subsection Commands
  19968. This filter supports the following commands:
  19969. @table @option
  19970. @item width, w
  19971. @item height, h
  19972. Set the output video dimension expression.
  19973. The command accepts the same syntax of the corresponding option.
  19974. If the specified expression is not valid, it is kept at its current
  19975. value.
  19976. @end table
  19977. @c man end VIDEO FILTERS
  19978. @chapter OpenCL Video Filters
  19979. @c man begin OPENCL VIDEO FILTERS
  19980. Below is a description of the currently available OpenCL video filters.
  19981. To enable compilation of these filters you need to configure FFmpeg with
  19982. @code{--enable-opencl}.
  19983. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  19984. @table @option
  19985. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  19986. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  19987. given device parameters.
  19988. @item -filter_hw_device @var{name}
  19989. Pass the hardware device called @var{name} to all filters in any filter graph.
  19990. @end table
  19991. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  19992. @itemize
  19993. @item
  19994. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  19995. @example
  19996. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  19997. @end example
  19998. @end itemize
  19999. 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.
  20000. @section avgblur_opencl
  20001. Apply average blur filter.
  20002. The filter accepts the following options:
  20003. @table @option
  20004. @item sizeX
  20005. Set horizontal radius size.
  20006. Range is @code{[1, 1024]} and default value is @code{1}.
  20007. @item planes
  20008. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20009. @item sizeY
  20010. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  20011. @end table
  20012. @subsection Example
  20013. @itemize
  20014. @item
  20015. 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.
  20016. @example
  20017. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  20018. @end example
  20019. @end itemize
  20020. @section boxblur_opencl
  20021. Apply a boxblur algorithm to the input video.
  20022. It accepts the following parameters:
  20023. @table @option
  20024. @item luma_radius, lr
  20025. @item luma_power, lp
  20026. @item chroma_radius, cr
  20027. @item chroma_power, cp
  20028. @item alpha_radius, ar
  20029. @item alpha_power, ap
  20030. @end table
  20031. A description of the accepted options follows.
  20032. @table @option
  20033. @item luma_radius, lr
  20034. @item chroma_radius, cr
  20035. @item alpha_radius, ar
  20036. Set an expression for the box radius in pixels used for blurring the
  20037. corresponding input plane.
  20038. The radius value must be a non-negative number, and must not be
  20039. greater than the value of the expression @code{min(w,h)/2} for the
  20040. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  20041. planes.
  20042. Default value for @option{luma_radius} is "2". If not specified,
  20043. @option{chroma_radius} and @option{alpha_radius} default to the
  20044. corresponding value set for @option{luma_radius}.
  20045. The expressions can contain the following constants:
  20046. @table @option
  20047. @item w
  20048. @item h
  20049. The input width and height in pixels.
  20050. @item cw
  20051. @item ch
  20052. The input chroma image width and height in pixels.
  20053. @item hsub
  20054. @item vsub
  20055. The horizontal and vertical chroma subsample values. For example, for the
  20056. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  20057. @end table
  20058. @item luma_power, lp
  20059. @item chroma_power, cp
  20060. @item alpha_power, ap
  20061. Specify how many times the boxblur filter is applied to the
  20062. corresponding plane.
  20063. Default value for @option{luma_power} is 2. If not specified,
  20064. @option{chroma_power} and @option{alpha_power} default to the
  20065. corresponding value set for @option{luma_power}.
  20066. A value of 0 will disable the effect.
  20067. @end table
  20068. @subsection Examples
  20069. 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.
  20070. @itemize
  20071. @item
  20072. Apply a boxblur filter with the luma, chroma, and alpha radius
  20073. 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.
  20074. @example
  20075. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  20076. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  20077. @end example
  20078. @item
  20079. 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.
  20080. For the luma plane, a 2x2 box radius will be run once.
  20081. For the chroma plane, a 4x4 box radius will be run 5 times.
  20082. For the alpha plane, a 3x3 box radius will be run 7 times.
  20083. @example
  20084. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  20085. @end example
  20086. @end itemize
  20087. @section colorkey_opencl
  20088. RGB colorspace color keying.
  20089. The filter accepts the following options:
  20090. @table @option
  20091. @item color
  20092. The color which will be replaced with transparency.
  20093. @item similarity
  20094. Similarity percentage with the key color.
  20095. 0.01 matches only the exact key color, while 1.0 matches everything.
  20096. @item blend
  20097. Blend percentage.
  20098. 0.0 makes pixels either fully transparent, or not transparent at all.
  20099. Higher values result in semi-transparent pixels, with a higher transparency
  20100. the more similar the pixels color is to the key color.
  20101. @end table
  20102. @subsection Examples
  20103. @itemize
  20104. @item
  20105. Make every semi-green pixel in the input transparent with some slight blending:
  20106. @example
  20107. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  20108. @end example
  20109. @end itemize
  20110. @section convolution_opencl
  20111. Apply convolution of 3x3, 5x5, 7x7 matrix.
  20112. The filter accepts the following options:
  20113. @table @option
  20114. @item 0m
  20115. @item 1m
  20116. @item 2m
  20117. @item 3m
  20118. Set matrix for each plane.
  20119. Matrix is sequence of 9, 25 or 49 signed numbers.
  20120. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  20121. @item 0rdiv
  20122. @item 1rdiv
  20123. @item 2rdiv
  20124. @item 3rdiv
  20125. Set multiplier for calculated value for each plane.
  20126. If unset or 0, it will be sum of all matrix elements.
  20127. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  20128. @item 0bias
  20129. @item 1bias
  20130. @item 2bias
  20131. @item 3bias
  20132. Set bias for each plane. This value is added to the result of the multiplication.
  20133. Useful for making the overall image brighter or darker.
  20134. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  20135. @end table
  20136. @subsection Examples
  20137. @itemize
  20138. @item
  20139. Apply sharpen:
  20140. @example
  20141. -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
  20142. @end example
  20143. @item
  20144. Apply blur:
  20145. @example
  20146. -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
  20147. @end example
  20148. @item
  20149. Apply edge enhance:
  20150. @example
  20151. -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
  20152. @end example
  20153. @item
  20154. Apply edge detect:
  20155. @example
  20156. -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
  20157. @end example
  20158. @item
  20159. Apply laplacian edge detector which includes diagonals:
  20160. @example
  20161. -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
  20162. @end example
  20163. @item
  20164. Apply emboss:
  20165. @example
  20166. -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
  20167. @end example
  20168. @end itemize
  20169. @section erosion_opencl
  20170. Apply erosion effect to the video.
  20171. This filter replaces the pixel by the local(3x3) minimum.
  20172. It accepts the following options:
  20173. @table @option
  20174. @item threshold0
  20175. @item threshold1
  20176. @item threshold2
  20177. @item threshold3
  20178. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20179. If @code{0}, plane will remain unchanged.
  20180. @item coordinates
  20181. Flag which specifies the pixel to refer to.
  20182. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20183. Flags to local 3x3 coordinates region centered on @code{x}:
  20184. 1 2 3
  20185. 4 x 5
  20186. 6 7 8
  20187. @end table
  20188. @subsection Example
  20189. @itemize
  20190. @item
  20191. 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.
  20192. @example
  20193. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20194. @end example
  20195. @end itemize
  20196. @section deshake_opencl
  20197. Feature-point based video stabilization filter.
  20198. The filter accepts the following options:
  20199. @table @option
  20200. @item tripod
  20201. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  20202. @item debug
  20203. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  20204. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  20205. Viewing point matches in the output video is only supported for RGB input.
  20206. Defaults to @code{0}.
  20207. @item adaptive_crop
  20208. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  20209. Defaults to @code{1}.
  20210. @item refine_features
  20211. Whether or not feature points should be refined at a sub-pixel level.
  20212. This can be turned off for a slight performance gain at the cost of precision.
  20213. Defaults to @code{1}.
  20214. @item smooth_strength
  20215. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  20216. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  20217. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  20218. Defaults to @code{0.0}.
  20219. @item smooth_window_multiplier
  20220. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  20221. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  20222. Acceptable values range from @code{0.1} to @code{10.0}.
  20223. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  20224. potentially improving smoothness, but also increase latency and memory usage.
  20225. Defaults to @code{2.0}.
  20226. @end table
  20227. @subsection Examples
  20228. @itemize
  20229. @item
  20230. Stabilize a video with a fixed, medium smoothing strength:
  20231. @example
  20232. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  20233. @end example
  20234. @item
  20235. Stabilize a video with debugging (both in console and in rendered video):
  20236. @example
  20237. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  20238. @end example
  20239. @end itemize
  20240. @section dilation_opencl
  20241. Apply dilation effect to the video.
  20242. This filter replaces the pixel by the local(3x3) maximum.
  20243. It accepts the following options:
  20244. @table @option
  20245. @item threshold0
  20246. @item threshold1
  20247. @item threshold2
  20248. @item threshold3
  20249. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20250. If @code{0}, plane will remain unchanged.
  20251. @item coordinates
  20252. Flag which specifies the pixel to refer to.
  20253. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20254. Flags to local 3x3 coordinates region centered on @code{x}:
  20255. 1 2 3
  20256. 4 x 5
  20257. 6 7 8
  20258. @end table
  20259. @subsection Example
  20260. @itemize
  20261. @item
  20262. 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.
  20263. @example
  20264. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20265. @end example
  20266. @end itemize
  20267. @anchor{nlmeans_opencl}
  20268. @section nlmeans_opencl
  20269. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  20270. @section overlay_opencl
  20271. Overlay one video on top of another.
  20272. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20273. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  20274. The filter accepts the following options:
  20275. @table @option
  20276. @item x
  20277. Set the x coordinate of the overlaid video on the main video.
  20278. Default value is @code{0}.
  20279. @item y
  20280. Set the y coordinate of the overlaid video on the main video.
  20281. Default value is @code{0}.
  20282. @end table
  20283. @subsection Examples
  20284. @itemize
  20285. @item
  20286. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  20287. @example
  20288. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20289. @end example
  20290. @item
  20291. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20292. @example
  20293. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20294. @end example
  20295. @end itemize
  20296. @section pad_opencl
  20297. Add paddings to the input image, and place the original input at the
  20298. provided @var{x}, @var{y} coordinates.
  20299. It accepts the following options:
  20300. @table @option
  20301. @item width, w
  20302. @item height, h
  20303. Specify an expression for the size of the output image with the
  20304. paddings added. If the value for @var{width} or @var{height} is 0, the
  20305. corresponding input size is used for the output.
  20306. The @var{width} expression can reference the value set by the
  20307. @var{height} expression, and vice versa.
  20308. The default value of @var{width} and @var{height} is 0.
  20309. @item x
  20310. @item y
  20311. Specify the offsets to place the input image at within the padded area,
  20312. with respect to the top/left border of the output image.
  20313. The @var{x} expression can reference the value set by the @var{y}
  20314. expression, and vice versa.
  20315. The default value of @var{x} and @var{y} is 0.
  20316. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  20317. so the input image is centered on the padded area.
  20318. @item color
  20319. Specify the color of the padded area. For the syntax of this option,
  20320. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  20321. manual,ffmpeg-utils}.
  20322. @item aspect
  20323. Pad to an aspect instead to a resolution.
  20324. @end table
  20325. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  20326. options are expressions containing the following constants:
  20327. @table @option
  20328. @item in_w
  20329. @item in_h
  20330. The input video width and height.
  20331. @item iw
  20332. @item ih
  20333. These are the same as @var{in_w} and @var{in_h}.
  20334. @item out_w
  20335. @item out_h
  20336. The output width and height (the size of the padded area), as
  20337. specified by the @var{width} and @var{height} expressions.
  20338. @item ow
  20339. @item oh
  20340. These are the same as @var{out_w} and @var{out_h}.
  20341. @item x
  20342. @item y
  20343. The x and y offsets as specified by the @var{x} and @var{y}
  20344. expressions, or NAN if not yet specified.
  20345. @item a
  20346. same as @var{iw} / @var{ih}
  20347. @item sar
  20348. input sample aspect ratio
  20349. @item dar
  20350. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  20351. @end table
  20352. @section prewitt_opencl
  20353. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  20354. The filter accepts the following option:
  20355. @table @option
  20356. @item planes
  20357. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20358. @item scale
  20359. Set value which will be multiplied with filtered result.
  20360. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20361. @item delta
  20362. Set value which will be added to filtered result.
  20363. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20364. @end table
  20365. @subsection Example
  20366. @itemize
  20367. @item
  20368. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  20369. @example
  20370. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20371. @end example
  20372. @end itemize
  20373. @anchor{program_opencl}
  20374. @section program_opencl
  20375. Filter video using an OpenCL program.
  20376. @table @option
  20377. @item source
  20378. OpenCL program source file.
  20379. @item kernel
  20380. Kernel name in program.
  20381. @item inputs
  20382. Number of inputs to the filter. Defaults to 1.
  20383. @item size, s
  20384. Size of output frames. Defaults to the same as the first input.
  20385. @end table
  20386. The @code{program_opencl} filter also supports the @ref{framesync} options.
  20387. The program source file must contain a kernel function with the given name,
  20388. which will be run once for each plane of the output. Each run on a plane
  20389. gets enqueued as a separate 2D global NDRange with one work-item for each
  20390. pixel to be generated. The global ID offset for each work-item is therefore
  20391. the coordinates of a pixel in the destination image.
  20392. The kernel function needs to take the following arguments:
  20393. @itemize
  20394. @item
  20395. Destination image, @var{__write_only image2d_t}.
  20396. This image will become the output; the kernel should write all of it.
  20397. @item
  20398. Frame index, @var{unsigned int}.
  20399. This is a counter starting from zero and increasing by one for each frame.
  20400. @item
  20401. Source images, @var{__read_only image2d_t}.
  20402. These are the most recent images on each input. The kernel may read from
  20403. them to generate the output, but they can't be written to.
  20404. @end itemize
  20405. Example programs:
  20406. @itemize
  20407. @item
  20408. Copy the input to the output (output must be the same size as the input).
  20409. @verbatim
  20410. __kernel void copy(__write_only image2d_t destination,
  20411. unsigned int index,
  20412. __read_only image2d_t source)
  20413. {
  20414. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  20415. int2 location = (int2)(get_global_id(0), get_global_id(1));
  20416. float4 value = read_imagef(source, sampler, location);
  20417. write_imagef(destination, location, value);
  20418. }
  20419. @end verbatim
  20420. @item
  20421. Apply a simple transformation, rotating the input by an amount increasing
  20422. with the index counter. Pixel values are linearly interpolated by the
  20423. sampler, and the output need not have the same dimensions as the input.
  20424. @verbatim
  20425. __kernel void rotate_image(__write_only image2d_t dst,
  20426. unsigned int index,
  20427. __read_only image2d_t src)
  20428. {
  20429. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20430. CLK_FILTER_LINEAR);
  20431. float angle = (float)index / 100.0f;
  20432. float2 dst_dim = convert_float2(get_image_dim(dst));
  20433. float2 src_dim = convert_float2(get_image_dim(src));
  20434. float2 dst_cen = dst_dim / 2.0f;
  20435. float2 src_cen = src_dim / 2.0f;
  20436. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  20437. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  20438. float2 src_pos = {
  20439. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  20440. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  20441. };
  20442. src_pos = src_pos * src_dim / dst_dim;
  20443. float2 src_loc = src_pos + src_cen;
  20444. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  20445. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  20446. write_imagef(dst, dst_loc, 0.5f);
  20447. else
  20448. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  20449. }
  20450. @end verbatim
  20451. @item
  20452. Blend two inputs together, with the amount of each input used varying
  20453. with the index counter.
  20454. @verbatim
  20455. __kernel void blend_images(__write_only image2d_t dst,
  20456. unsigned int index,
  20457. __read_only image2d_t src1,
  20458. __read_only image2d_t src2)
  20459. {
  20460. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20461. CLK_FILTER_LINEAR);
  20462. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  20463. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  20464. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  20465. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  20466. float4 val1 = read_imagef(src1, sampler, src1_loc);
  20467. float4 val2 = read_imagef(src2, sampler, src2_loc);
  20468. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  20469. }
  20470. @end verbatim
  20471. @end itemize
  20472. @section remap_opencl
  20473. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  20474. Destination pixel at position (X, Y) will be picked from source (x, y) position
  20475. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  20476. value for pixel will be used for destination pixel.
  20477. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  20478. will have Xmap/Ymap video stream dimensions.
  20479. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  20480. @table @option
  20481. @item interp
  20482. Specify interpolation used for remapping of pixels.
  20483. Allowed values are @code{near} and @code{linear}.
  20484. Default value is @code{linear}.
  20485. @item fill
  20486. Specify the color of the unmapped pixels. For the syntax of this option,
  20487. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  20488. manual,ffmpeg-utils}. Default color is @code{black}.
  20489. @end table
  20490. @section roberts_opencl
  20491. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  20492. The filter accepts the following option:
  20493. @table @option
  20494. @item planes
  20495. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20496. @item scale
  20497. Set value which will be multiplied with filtered result.
  20498. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20499. @item delta
  20500. Set value which will be added to filtered result.
  20501. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20502. @end table
  20503. @subsection Example
  20504. @itemize
  20505. @item
  20506. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  20507. @example
  20508. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20509. @end example
  20510. @end itemize
  20511. @section sobel_opencl
  20512. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  20513. The filter accepts the following option:
  20514. @table @option
  20515. @item planes
  20516. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20517. @item scale
  20518. Set value which will be multiplied with filtered result.
  20519. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20520. @item delta
  20521. Set value which will be added to filtered result.
  20522. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20523. @end table
  20524. @subsection Example
  20525. @itemize
  20526. @item
  20527. Apply sobel operator with scale set to 2 and delta set to 10
  20528. @example
  20529. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20530. @end example
  20531. @end itemize
  20532. @section tonemap_opencl
  20533. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  20534. It accepts the following parameters:
  20535. @table @option
  20536. @item tonemap
  20537. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  20538. @item param
  20539. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  20540. @item desat
  20541. Apply desaturation for highlights that exceed this level of brightness. The
  20542. higher the parameter, the more color information will be preserved. This
  20543. setting helps prevent unnaturally blown-out colors for super-highlights, by
  20544. (smoothly) turning into white instead. This makes images feel more natural,
  20545. at the cost of reducing information about out-of-range colors.
  20546. The default value is 0.5, and the algorithm here is a little different from
  20547. the cpu version tonemap currently. A setting of 0.0 disables this option.
  20548. @item threshold
  20549. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  20550. is used to detect whether the scene has changed or not. If the distance between
  20551. the current frame average brightness and the current running average exceeds
  20552. a threshold value, we would re-calculate scene average and peak brightness.
  20553. The default value is 0.2.
  20554. @item format
  20555. Specify the output pixel format.
  20556. Currently supported formats are:
  20557. @table @var
  20558. @item p010
  20559. @item nv12
  20560. @end table
  20561. @item range, r
  20562. Set the output color range.
  20563. Possible values are:
  20564. @table @var
  20565. @item tv/mpeg
  20566. @item pc/jpeg
  20567. @end table
  20568. Default is same as input.
  20569. @item primaries, p
  20570. Set the output color primaries.
  20571. Possible values are:
  20572. @table @var
  20573. @item bt709
  20574. @item bt2020
  20575. @end table
  20576. Default is same as input.
  20577. @item transfer, t
  20578. Set the output transfer characteristics.
  20579. Possible values are:
  20580. @table @var
  20581. @item bt709
  20582. @item bt2020
  20583. @end table
  20584. Default is bt709.
  20585. @item matrix, m
  20586. Set the output colorspace matrix.
  20587. Possible value are:
  20588. @table @var
  20589. @item bt709
  20590. @item bt2020
  20591. @end table
  20592. Default is same as input.
  20593. @end table
  20594. @subsection Example
  20595. @itemize
  20596. @item
  20597. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  20598. @example
  20599. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  20600. @end example
  20601. @end itemize
  20602. @section unsharp_opencl
  20603. Sharpen or blur the input video.
  20604. It accepts the following parameters:
  20605. @table @option
  20606. @item luma_msize_x, lx
  20607. Set the luma matrix horizontal size.
  20608. Range is @code{[1, 23]} and default value is @code{5}.
  20609. @item luma_msize_y, ly
  20610. Set the luma matrix vertical size.
  20611. Range is @code{[1, 23]} and default value is @code{5}.
  20612. @item luma_amount, la
  20613. Set the luma effect strength.
  20614. Range is @code{[-10, 10]} and default value is @code{1.0}.
  20615. Negative values will blur the input video, while positive values will
  20616. sharpen it, a value of zero will disable the effect.
  20617. @item chroma_msize_x, cx
  20618. Set the chroma matrix horizontal size.
  20619. Range is @code{[1, 23]} and default value is @code{5}.
  20620. @item chroma_msize_y, cy
  20621. Set the chroma matrix vertical size.
  20622. Range is @code{[1, 23]} and default value is @code{5}.
  20623. @item chroma_amount, ca
  20624. Set the chroma effect strength.
  20625. Range is @code{[-10, 10]} and default value is @code{0.0}.
  20626. Negative values will blur the input video, while positive values will
  20627. sharpen it, a value of zero will disable the effect.
  20628. @end table
  20629. All parameters are optional and default to the equivalent of the
  20630. string '5:5:1.0:5:5:0.0'.
  20631. @subsection Examples
  20632. @itemize
  20633. @item
  20634. Apply strong luma sharpen effect:
  20635. @example
  20636. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  20637. @end example
  20638. @item
  20639. Apply a strong blur of both luma and chroma parameters:
  20640. @example
  20641. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  20642. @end example
  20643. @end itemize
  20644. @section xfade_opencl
  20645. Cross fade two videos with custom transition effect by using OpenCL.
  20646. It accepts the following options:
  20647. @table @option
  20648. @item transition
  20649. Set one of possible transition effects.
  20650. @table @option
  20651. @item custom
  20652. Select custom transition effect, the actual transition description
  20653. will be picked from source and kernel options.
  20654. @item fade
  20655. @item wipeleft
  20656. @item wiperight
  20657. @item wipeup
  20658. @item wipedown
  20659. @item slideleft
  20660. @item slideright
  20661. @item slideup
  20662. @item slidedown
  20663. Default transition is fade.
  20664. @end table
  20665. @item source
  20666. OpenCL program source file for custom transition.
  20667. @item kernel
  20668. Set name of kernel to use for custom transition from program source file.
  20669. @item duration
  20670. Set duration of video transition.
  20671. @item offset
  20672. Set time of start of transition relative to first video.
  20673. @end table
  20674. The program source file must contain a kernel function with the given name,
  20675. which will be run once for each plane of the output. Each run on a plane
  20676. gets enqueued as a separate 2D global NDRange with one work-item for each
  20677. pixel to be generated. The global ID offset for each work-item is therefore
  20678. the coordinates of a pixel in the destination image.
  20679. The kernel function needs to take the following arguments:
  20680. @itemize
  20681. @item
  20682. Destination image, @var{__write_only image2d_t}.
  20683. This image will become the output; the kernel should write all of it.
  20684. @item
  20685. First Source image, @var{__read_only image2d_t}.
  20686. Second Source image, @var{__read_only image2d_t}.
  20687. These are the most recent images on each input. The kernel may read from
  20688. them to generate the output, but they can't be written to.
  20689. @item
  20690. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  20691. @end itemize
  20692. Example programs:
  20693. @itemize
  20694. @item
  20695. Apply dots curtain transition effect:
  20696. @verbatim
  20697. __kernel void blend_images(__write_only image2d_t dst,
  20698. __read_only image2d_t src1,
  20699. __read_only image2d_t src2,
  20700. float progress)
  20701. {
  20702. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20703. CLK_FILTER_LINEAR);
  20704. int2 p = (int2)(get_global_id(0), get_global_id(1));
  20705. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  20706. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  20707. rp = rp / dim;
  20708. float2 dots = (float2)(20.0, 20.0);
  20709. float2 center = (float2)(0,0);
  20710. float2 unused;
  20711. float4 val1 = read_imagef(src1, sampler, p);
  20712. float4 val2 = read_imagef(src2, sampler, p);
  20713. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  20714. write_imagef(dst, p, next ? val1 : val2);
  20715. }
  20716. @end verbatim
  20717. @end itemize
  20718. @c man end OPENCL VIDEO FILTERS
  20719. @chapter VAAPI Video Filters
  20720. @c man begin VAAPI VIDEO FILTERS
  20721. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  20722. To enable compilation of these filters you need to configure FFmpeg with
  20723. @code{--enable-vaapi}.
  20724. 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}
  20725. @section overlay_vaapi
  20726. Overlay one video on the top of another.
  20727. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20728. The filter accepts the following options:
  20729. @table @option
  20730. @item x
  20731. @item y
  20732. Set expressions for the x and y coordinates of the overlaid video
  20733. on the main video.
  20734. Default value is "0" for both expressions.
  20735. @item w
  20736. @item h
  20737. Set expressions for the width and height the overlaid video
  20738. on the main video.
  20739. Default values are 'overlay_iw' for 'w' and 'overlay_ih*w/overlay_iw' for 'h'.
  20740. The expressions can contain the following parameters:
  20741. @table @option
  20742. @item main_w, W
  20743. @item main_h, H
  20744. The main input width and height.
  20745. @item overlay_iw
  20746. @item overlay_ih
  20747. The overlay input width and height.
  20748. @item overlay_w, w
  20749. @item overlay_h, h
  20750. The overlay output width and height.
  20751. @item overlay_x, x
  20752. @item overlay_y, y
  20753. Position of the overlay layer inside of main
  20754. @end table
  20755. @item alpha
  20756. Set transparency of overlaid video. Allowed range is 0.0 to 1.0.
  20757. Higher value means lower transparency.
  20758. Default value is @code{1.0}.
  20759. @item eof_action
  20760. See @ref{framesync}.
  20761. @item shortest
  20762. See @ref{framesync}.
  20763. @item repeatlast
  20764. See @ref{framesync}.
  20765. @end table
  20766. This filter also supports the @ref{framesync} options.
  20767. @subsection Examples
  20768. @itemize
  20769. @item
  20770. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  20771. @example
  20772. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  20773. @end example
  20774. @item
  20775. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  20776. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20777. @example
  20778. -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
  20779. @end example
  20780. @end itemize
  20781. @section tonemap_vaapi
  20782. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  20783. It maps the dynamic range of HDR10 content to the SDR content.
  20784. It currently only accepts HDR10 as input.
  20785. It accepts the following parameters:
  20786. @table @option
  20787. @item format
  20788. Specify the output pixel format.
  20789. Currently supported formats are:
  20790. @table @var
  20791. @item p010
  20792. @item nv12
  20793. @end table
  20794. Default is nv12.
  20795. @item primaries, p
  20796. Set the output color primaries.
  20797. Default is same as input.
  20798. @item transfer, t
  20799. Set the output transfer characteristics.
  20800. Default is bt709.
  20801. @item matrix, m
  20802. Set the output colorspace matrix.
  20803. Default is same as input.
  20804. @end table
  20805. @subsection Example
  20806. @itemize
  20807. @item
  20808. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  20809. @example
  20810. tonemap_vaapi=format=p010:t=bt2020-10
  20811. @end example
  20812. @end itemize
  20813. @section hstack_vaapi
  20814. Stack input videos horizontally.
  20815. This is the VA-API variant of the @ref{hstack} filter, each input stream may
  20816. have different height, this filter will scale down/up each input stream while
  20817. keeping the orignal aspect.
  20818. It accepts the following options:
  20819. @table @option
  20820. @item inputs
  20821. See @ref{hstack}.
  20822. @item shortest
  20823. See @ref{hstack}.
  20824. @item height
  20825. Set height of output. If set to 0, this filter will set height of output to
  20826. height of the first input stream. Default value is 0.
  20827. @end table
  20828. @section vstack_vaapi
  20829. Stack input videos vertically.
  20830. This is the VA-API variant of the @ref{vstack} filter, each input stream may
  20831. have different width, this filter will scale down/up each input stream while
  20832. keeping the orignal aspect.
  20833. It accepts the following options:
  20834. @table @option
  20835. @item inputs
  20836. See @ref{vstack}.
  20837. @item shortest
  20838. See @ref{vstack}.
  20839. @item width
  20840. Set width of output. If set to 0, this filter will set width of output to
  20841. width of the first input stream. Default value is 0.
  20842. @end table
  20843. @section xstack_vaapi
  20844. Stack video inputs into custom layout.
  20845. This is the VA-API variant of the @ref{xstack} filter, each input stream may
  20846. have different size, this filter will scale down/up each input stream to the
  20847. given output size, or the size of the first input stream.
  20848. It accepts the following options:
  20849. @table @option
  20850. @item inputs
  20851. See @ref{xstack}.
  20852. @item shortest
  20853. See @ref{xstack}.
  20854. @item layout
  20855. See @ref{xstack}.
  20856. Moreover, this permits the user to supply output size for each input stream.
  20857. @example
  20858. xstack_vaapi=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  20859. @end example
  20860. @item grid
  20861. See @ref{xstack}.
  20862. @item grid_tile_size
  20863. Set output size for each input stream when @option{grid} is set. If this option
  20864. is not set, this filter will set output size by default to the size of the
  20865. first input stream. For the syntax of this option, check the
  20866. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20867. @item fill
  20868. See @ref{xstack}.
  20869. @end table
  20870. @c man end VAAPI VIDEO FILTERS
  20871. @chapter Vulkan Video Filters
  20872. @c man begin VULKAN VIDEO FILTERS
  20873. Below is a description of the currently available Vulkan video filters.
  20874. To enable compilation of these filters you need to configure FFmpeg with
  20875. @code{--enable-vulkan} and either @code{--enable-libglslang} or @code{--enable-libshaderc}.
  20876. Running Vulkan filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  20877. @table @option
  20878. @item -init_hw_device vulkan[=@var{name}][:@var{device}[,@var{key=value}...]]
  20879. Initialise a new hardware device of type @var{vulkan} called @var{name}, using the
  20880. given device parameters and options in @var{key=value}. The following options
  20881. are supported:
  20882. @table @option
  20883. @item debug
  20884. Switches validation layers on if set to 1.
  20885. @item linear_images
  20886. Allocates linear images. Does not apply to decoding.
  20887. @item disable_multiplane
  20888. Disables multiplane images. Does not apply to decoding.
  20889. @end table
  20890. @item -filter_hw_device @var{name}
  20891. Pass the hardware device called @var{name} to all filters in any filter graph.
  20892. @end table
  20893. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  20894. @itemize
  20895. @item
  20896. Example of choosing the first device and running nlmeans_vulkan filter with default parameters on it.
  20897. @example
  20898. -init_hw_device vulkan=vk:0 -filter_hw_device vk -i INPUT -vf "hwupload,nlmeans_vulkan,hwdownload" OUTPUT
  20899. @end example
  20900. @end itemize
  20901. 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.
  20902. @section avgblur_vulkan
  20903. Apply an average blur filter, implemented on the GPU using Vulkan.
  20904. The filter accepts the following options:
  20905. @table @option
  20906. @item sizeX
  20907. Set horizontal radius size.
  20908. Range is @code{[1, 32]} and default value is @code{3}.
  20909. @item sizeY
  20910. Set vertical radius size. Range is @code{[1, 32]} and default value is @code{3}.
  20911. @item planes
  20912. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20913. @end table
  20914. @section blend_vulkan
  20915. Blend two Vulkan frames into each other.
  20916. The @code{blend} filter takes two input streams and outputs one
  20917. stream, the first input is the "top" layer and second input is
  20918. "bottom" layer. By default, the output terminates when the longest input terminates.
  20919. A description of the accepted options follows.
  20920. @table @option
  20921. @item c0_mode
  20922. @item c1_mode
  20923. @item c2_mode
  20924. @item c3_mode
  20925. @item all_mode
  20926. Set blend mode for specific pixel component or all pixel components in case
  20927. of @var{all_mode}. Default value is @code{normal}.
  20928. Available values for component modes are:
  20929. @table @samp
  20930. @item normal
  20931. @item multiply
  20932. @end table
  20933. @end table
  20934. @section bwdif_vulkan
  20935. Deinterlacer using @ref{bwdif}, the "Bob Weaver Deinterlacing Filter" algorithm, implemented
  20936. on the GPU using Vulkan.
  20937. It accepts the following parameters:
  20938. @table @option
  20939. @item mode
  20940. The interlacing mode to adopt. It accepts one of the following values:
  20941. @table @option
  20942. @item 0, send_frame
  20943. Output one frame for each frame.
  20944. @item 1, send_field
  20945. Output one frame for each field.
  20946. @end table
  20947. The default value is @code{send_field}.
  20948. @item parity
  20949. The picture field parity assumed for the input interlaced video. It accepts one
  20950. of the following values:
  20951. @table @option
  20952. @item 0, tff
  20953. Assume the top field is first.
  20954. @item 1, bff
  20955. Assume the bottom field is first.
  20956. @item -1, auto
  20957. Enable automatic detection of field parity.
  20958. @end table
  20959. The default value is @code{auto}.
  20960. If the interlacing is unknown or the decoder does not export this information,
  20961. top field first will be assumed.
  20962. @item deint
  20963. Specify which frames to deinterlace. Accepts one of the following
  20964. values:
  20965. @table @option
  20966. @item 0, all
  20967. Deinterlace all frames.
  20968. @item 1, interlaced
  20969. Only deinterlace frames marked as interlaced.
  20970. @end table
  20971. The default value is @code{all}.
  20972. @end table
  20973. @section chromaber_vulkan
  20974. Apply an effect that emulates chromatic aberration. Works best with RGB inputs,
  20975. but provides a similar effect with YCbCr inputs too.
  20976. @table @option
  20977. @item dist_x
  20978. Horizontal displacement multiplier. Each chroma pixel's position will be multiplied
  20979. by this amount, starting from the center of the image. Default is @code{0}.
  20980. @item dist_y
  20981. Similarly, this sets the vertical displacement multiplier. Default is @code{0}.
  20982. @end table
  20983. @section color_vulkan
  20984. Video source that creates a Vulkan frame of a solid color.
  20985. Useful for benchmarking, or overlaying.
  20986. It accepts the following parameters:
  20987. @table @option
  20988. @item color
  20989. The color to use. Either a name, or a hexadecimal value.
  20990. The default value is @code{black}.
  20991. @item size
  20992. The size of the output frame. Default value is @code{1920x1080}.
  20993. @item rate
  20994. The framerate to output at. Default value is @code{60} frames per second.
  20995. @item duration
  20996. The video duration. Default value is @code{-0.000001}.
  20997. @item sar
  20998. The video signal aspect ratio. Default value is @code{1/1}.
  20999. @item format
  21000. The pixel format of the output Vulkan frames. Default value is @code{yuv444p}.
  21001. @item out_range
  21002. Set the output YCbCr sample range.
  21003. This allows the autodetected value to be overridden as well as allows forcing
  21004. a specific value used for the output and encoder. If not specified, the
  21005. range depends on the pixel format. Possible values:
  21006. @table @samp
  21007. @item auto/unknown
  21008. Choose automatically.
  21009. @item jpeg/full/pc
  21010. Set full range (0-255 in case of 8-bit luma).
  21011. @item mpeg/limited/tv
  21012. Set "MPEG" range (16-235 in case of 8-bit luma).
  21013. @end table
  21014. @end table
  21015. @section vflip_vulkan
  21016. Flips an image vertically.
  21017. @section hflip_vulkan
  21018. Flips an image horizontally.
  21019. @section flip_vulkan
  21020. Flips an image along both the vertical and horizontal axis.
  21021. @section gblur_vulkan
  21022. Apply Gaussian blur filter on Vulkan frames.
  21023. The filter accepts the following options:
  21024. @table @option
  21025. @item sigma
  21026. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  21027. @item sigmaV
  21028. Set vertical sigma, if negative it will be same as @code{sigma}.
  21029. Default is @code{-1}.
  21030. @item planes
  21031. Set which planes to filter. By default all planes are filtered.
  21032. @item size
  21033. Set the kernel size along the horizontal axis. Default is @code{19}.
  21034. @item sizeV
  21035. Set the kernel size along the vertical axis. Default is @code{0},
  21036. which sets to use the same value as @var{size}.
  21037. @end table
  21038. @section nlmeans_vulkan
  21039. Denoise frames using Non-Local Means algorithm, implemented on the GPU using
  21040. Vulkan.
  21041. Supports more pixel formats than @ref{nlmeans} or @ref{nlmeans_opencl}, including
  21042. alpha channel support.
  21043. The filter accepts the following options.
  21044. @table @option
  21045. @item s
  21046. Set denoising strength for all components. Default is 1.0. Must be in range [1.0, 100.0].
  21047. @item p
  21048. Set patch size for all planes. Default is 7. Must be odd number in range [0, 99].
  21049. @item r
  21050. Set research size. Default is 15. Must be odd number in range [0, 99].
  21051. @item t
  21052. Set parallelism. Default is 36. Must be a number in the range [1, 168].
  21053. Larger values may speed up processing, at the cost of more VRAM.
  21054. Lower values will slow it down, reducing VRAM usage.
  21055. Only supported on GPUs with atomic float operations (RDNA3+, Ampere+).
  21056. @item s0
  21057. @item s1
  21058. @item s2
  21059. @item s3
  21060. Set denoising strength for a specific component. Default is @var{1}, equal to @option{s}.
  21061. Must be odd number in range [1, 100].
  21062. @item p0
  21063. @item p1
  21064. @item p2
  21065. @item p3
  21066. Set patch size for a specific component. Default is @var{7}, equal to @option{p}.
  21067. Must be odd number in range [0, 99].
  21068. @end table
  21069. @section overlay_vulkan
  21070. Overlay one video on top of another.
  21071. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21072. This filter requires all inputs to use the same pixel format. So, format conversion may be needed.
  21073. The filter accepts the following options:
  21074. @table @option
  21075. @item x
  21076. Set the x coordinate of the overlaid video on the main video.
  21077. Default value is @code{0}.
  21078. @item y
  21079. Set the y coordinate of the overlaid video on the main video.
  21080. Default value is @code{0}.
  21081. @end table
  21082. @section transpose_vt
  21083. Transpose rows with columns in the input video and optionally flip it.
  21084. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21085. It accepts the following parameters:
  21086. @table @option
  21087. @item dir
  21088. Specify the transposition direction.
  21089. Can assume the following values:
  21090. @table @samp
  21091. @item cclock_flip
  21092. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21093. @item clock
  21094. Rotate by 90 degrees clockwise.
  21095. @item cclock
  21096. Rotate by 90 degrees counterclockwise.
  21097. @item clock_flip
  21098. Rotate by 90 degrees clockwise and vertically flip.
  21099. @item hflip
  21100. Flip the input video horizontally.
  21101. @item vflip
  21102. Flip the input video vertically.
  21103. @end table
  21104. @item passthrough
  21105. Do not apply the transposition if the input geometry matches the one
  21106. specified by the specified value. It accepts the following values:
  21107. @table @samp
  21108. @item none
  21109. Always apply transposition. (default)
  21110. @item portrait
  21111. Preserve portrait geometry (when @var{height} >= @var{width}).
  21112. @item landscape
  21113. Preserve landscape geometry (when @var{width} >= @var{height}).
  21114. @end table
  21115. @end table
  21116. @section transpose_vulkan
  21117. Transpose rows with columns in the input video and optionally flip it.
  21118. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21119. It accepts the following parameters:
  21120. @table @option
  21121. @item dir
  21122. Specify the transposition direction.
  21123. Can assume the following values:
  21124. @table @samp
  21125. @item cclock_flip
  21126. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21127. @item clock
  21128. Rotate by 90 degrees clockwise.
  21129. @item cclock
  21130. Rotate by 90 degrees counterclockwise.
  21131. @item clock_flip
  21132. Rotate by 90 degrees clockwise and vertically flip.
  21133. @end table
  21134. @item passthrough
  21135. Do not apply the transposition if the input geometry matches the one
  21136. specified by the specified value. It accepts the following values:
  21137. @table @samp
  21138. @item none
  21139. Always apply transposition. (default)
  21140. @item portrait
  21141. Preserve portrait geometry (when @var{height} >= @var{width}).
  21142. @item landscape
  21143. Preserve landscape geometry (when @var{width} >= @var{height}).
  21144. @end table
  21145. @end table
  21146. @c man end VULKAN VIDEO FILTERS
  21147. @chapter QSV Video Filters
  21148. @c man begin QSV VIDEO FILTERS
  21149. Below is a description of the currently available QSV video filters.
  21150. To enable compilation of these filters you need to configure FFmpeg with
  21151. @code{--enable-libmfx} or @code{--enable-libvpl}.
  21152. 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}
  21153. @section hstack_qsv
  21154. Stack input videos horizontally.
  21155. This is the QSV variant of the @ref{hstack} filter, each input stream may
  21156. have different height, this filter will scale down/up each input stream while
  21157. keeping the orignal aspect.
  21158. It accepts the following options:
  21159. @table @option
  21160. @item inputs
  21161. See @ref{hstack}.
  21162. @item shortest
  21163. See @ref{hstack}.
  21164. @item height
  21165. Set height of output. If set to 0, this filter will set height of output to
  21166. height of the first input stream. Default value is 0.
  21167. @end table
  21168. @section vstack_qsv
  21169. Stack input videos vertically.
  21170. This is the QSV variant of the @ref{vstack} filter, each input stream may
  21171. have different width, this filter will scale down/up each input stream while
  21172. keeping the orignal aspect.
  21173. It accepts the following options:
  21174. @table @option
  21175. @item inputs
  21176. See @ref{vstack}.
  21177. @item shortest
  21178. See @ref{vstack}.
  21179. @item width
  21180. Set width of output. If set to 0, this filter will set width of output to
  21181. width of the first input stream. Default value is 0.
  21182. @end table
  21183. @section xstack_qsv
  21184. Stack video inputs into custom layout.
  21185. This is the QSV variant of the @ref{xstack} filter.
  21186. It accepts the following options:
  21187. @table @option
  21188. @item inputs
  21189. See @ref{xstack}.
  21190. @item shortest
  21191. See @ref{xstack}.
  21192. @item layout
  21193. See @ref{xstack}.
  21194. Moreover, this permits the user to supply output size for each input stream.
  21195. @example
  21196. xstack_qsv=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  21197. @end example
  21198. @item grid
  21199. See @ref{xstack}.
  21200. @item grid_tile_size
  21201. Set output size for each input stream when @option{grid} is set. If this option
  21202. is not set, this filter will set output size by default to the size of the
  21203. first input stream. For the syntax of this option, check the
  21204. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21205. @item fill
  21206. See @ref{xstack}.
  21207. @end table
  21208. @c man end QSV VIDEO FILTERS
  21209. @chapter Video Sources
  21210. @c man begin VIDEO SOURCES
  21211. Below is a description of the currently available video sources.
  21212. @section buffer
  21213. Buffer video frames, and make them available to the filter chain.
  21214. This source is mainly intended for a programmatic use, in particular
  21215. through the interface defined in @file{libavfilter/buffersrc.h}.
  21216. It accepts the following parameters:
  21217. @table @option
  21218. @item video_size
  21219. Specify the size (width and height) of the buffered video frames. For the
  21220. syntax of this option, check the
  21221. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21222. @item width
  21223. The input video width.
  21224. @item height
  21225. The input video height.
  21226. @item pix_fmt
  21227. A string representing the pixel format of the buffered video frames.
  21228. It may be a number corresponding to a pixel format, or a pixel format
  21229. name.
  21230. @item time_base
  21231. Specify the timebase assumed by the timestamps of the buffered frames.
  21232. @item frame_rate
  21233. Specify the frame rate expected for the video stream.
  21234. @item pixel_aspect, sar
  21235. The sample (pixel) aspect ratio of the input video.
  21236. @item hw_frames_ctx
  21237. When using a hardware pixel format, this should be a reference to an
  21238. AVHWFramesContext describing input frames.
  21239. @end table
  21240. For example:
  21241. @example
  21242. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  21243. @end example
  21244. will instruct the source to accept video frames with size 320x240 and
  21245. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  21246. square pixels (1:1 sample aspect ratio).
  21247. Since the pixel format with name "yuv410p" corresponds to the number 6
  21248. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  21249. this example corresponds to:
  21250. @example
  21251. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  21252. @end example
  21253. Alternatively, the options can be specified as a flat string, but this
  21254. syntax is deprecated:
  21255. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  21256. @section cellauto
  21257. Create a pattern generated by an elementary cellular automaton.
  21258. The initial state of the cellular automaton can be defined through the
  21259. @option{filename} and @option{pattern} options. If such options are
  21260. not specified an initial state is created randomly.
  21261. At each new frame a new row in the video is filled with the result of
  21262. the cellular automaton next generation. The behavior when the whole
  21263. frame is filled is defined by the @option{scroll} option.
  21264. This source accepts the following options:
  21265. @table @option
  21266. @item filename, f
  21267. Read the initial cellular automaton state, i.e. the starting row, from
  21268. the specified file.
  21269. In the file, each non-whitespace character is considered an alive
  21270. cell, a newline will terminate the row, and further characters in the
  21271. file will be ignored.
  21272. @item pattern, p
  21273. Read the initial cellular automaton state, i.e. the starting row, from
  21274. the specified string.
  21275. Each non-whitespace character in the string is considered an alive
  21276. cell, a newline will terminate the row, and further characters in the
  21277. string will be ignored.
  21278. @item rate, r
  21279. Set the video rate, that is the number of frames generated per second.
  21280. Default is 25.
  21281. @item random_fill_ratio, ratio
  21282. Set the random fill ratio for the initial cellular automaton row. It
  21283. is a floating point number value ranging from 0 to 1, defaults to
  21284. 1/PHI.
  21285. This option is ignored when a file or a pattern is specified.
  21286. @item random_seed, seed
  21287. Set the seed for filling randomly the initial row, must be an integer
  21288. included between 0 and UINT32_MAX. If not specified, or if explicitly
  21289. set to -1, the filter will try to use a good random seed on a best
  21290. effort basis.
  21291. @item rule
  21292. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  21293. Default value is 110.
  21294. @item size, s
  21295. Set the size of the output video. For the syntax of this option, check the
  21296. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21297. If @option{filename} or @option{pattern} is specified, the size is set
  21298. by default to the width of the specified initial state row, and the
  21299. height is set to @var{width} * PHI.
  21300. If @option{size} is set, it must contain the width of the specified
  21301. pattern string, and the specified pattern will be centered in the
  21302. larger row.
  21303. If a filename or a pattern string is not specified, the size value
  21304. defaults to "320x518" (used for a randomly generated initial state).
  21305. @item scroll
  21306. If set to 1, scroll the output upward when all the rows in the output
  21307. have been already filled. If set to 0, the new generated row will be
  21308. written over the top row just after the bottom row is filled.
  21309. Defaults to 1.
  21310. @item start_full, full
  21311. If set to 1, completely fill the output with generated rows before
  21312. outputting the first frame.
  21313. This is the default behavior, for disabling set the value to 0.
  21314. @item stitch
  21315. If set to 1, stitch the left and right row edges together.
  21316. This is the default behavior, for disabling set the value to 0.
  21317. @end table
  21318. @subsection Examples
  21319. @itemize
  21320. @item
  21321. Read the initial state from @file{pattern}, and specify an output of
  21322. size 200x400.
  21323. @example
  21324. cellauto=f=pattern:s=200x400
  21325. @end example
  21326. @item
  21327. Generate a random initial row with a width of 200 cells, with a fill
  21328. ratio of 2/3:
  21329. @example
  21330. cellauto=ratio=2/3:s=200x200
  21331. @end example
  21332. @item
  21333. Create a pattern generated by rule 18 starting by a single alive cell
  21334. centered on an initial row with width 100:
  21335. @example
  21336. cellauto=p=@@:s=100x400:full=0:rule=18
  21337. @end example
  21338. @item
  21339. Specify a more elaborated initial pattern:
  21340. @example
  21341. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  21342. @end example
  21343. @end itemize
  21344. @anchor{coreimagesrc}
  21345. @section coreimagesrc
  21346. Video source generated on GPU using Apple's CoreImage API on OSX.
  21347. This video source is a specialized version of the @ref{coreimage} video filter.
  21348. Use a core image generator at the beginning of the applied filterchain to
  21349. generate the content.
  21350. The coreimagesrc video source accepts the following options:
  21351. @table @option
  21352. @item list_generators
  21353. List all available generators along with all their respective options as well as
  21354. possible minimum and maximum values along with the default values.
  21355. @example
  21356. list_generators=true
  21357. @end example
  21358. @item size, s
  21359. Specify the size of the sourced video. For the syntax of this option, check the
  21360. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21361. The default value is @code{320x240}.
  21362. @item rate, r
  21363. Specify the frame rate of the sourced video, as the number of frames
  21364. generated per second. It has to be a string in the format
  21365. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  21366. number or a valid video frame rate abbreviation. The default value is
  21367. "25".
  21368. @item sar
  21369. Set the sample aspect ratio of the sourced video.
  21370. @item duration, d
  21371. Set the duration of the sourced video. See
  21372. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21373. for the accepted syntax.
  21374. If not specified, or the expressed duration is negative, the video is
  21375. supposed to be generated forever.
  21376. @end table
  21377. Additionally, all options of the @ref{coreimage} video filter are accepted.
  21378. A complete filterchain can be used for further processing of the
  21379. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  21380. and examples for details.
  21381. @subsection Examples
  21382. @itemize
  21383. @item
  21384. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  21385. given as complete and escaped command-line for Apple's standard bash shell:
  21386. @example
  21387. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  21388. @end example
  21389. This example is equivalent to the QRCode example of @ref{coreimage} without the
  21390. need for a nullsrc video source.
  21391. @end itemize
  21392. @section ddagrab
  21393. Captures the Windows Desktop via Desktop Duplication API.
  21394. The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding
  21395. or processing. So an explicit @ref{hwdownload} is needed for any kind of
  21396. software processing.
  21397. It accepts the following options:
  21398. @table @option
  21399. @item output_idx
  21400. DXGI Output Index to capture.
  21401. Usually corresponds to the index Windows has given the screen minus one,
  21402. so it's starting at 0.
  21403. Defaults to output 0.
  21404. @item draw_mouse
  21405. Whether to draw the mouse cursor.
  21406. Defaults to true.
  21407. Only affects hardware cursors. If a game or application renders its own cursor,
  21408. it'll always be captured.
  21409. @item framerate
  21410. Framerate at which the desktop will be captured.
  21411. Defaults to 30 FPS.
  21412. @item video_size
  21413. Specify the size of the captured video.
  21414. Defaults to the full size of the screen.
  21415. Cropped from the bottom/right if smaller than screen size.
  21416. @item offset_x
  21417. Horizontal offset of the captured video.
  21418. @item offset_y
  21419. Vertical offset of the captured video.
  21420. @item output_fmt
  21421. Desired filter output format.
  21422. Defaults to 8 Bit BGRA.
  21423. It accepts the following values:
  21424. @table @samp
  21425. @item auto
  21426. Passes all supported output formats to DDA and returns what DDA decides to use.
  21427. @item 8bit
  21428. @item bgra
  21429. 8 Bit formats always work, and DDA will convert to them if neccesary.
  21430. @item 10bit
  21431. @item x2bgr10
  21432. Filter initialization will fail if 10 bit format is requested but unavailable.
  21433. @end table
  21434. @end table
  21435. @subsection Examples
  21436. Capture primary screen and encode using nvenc:
  21437. @example
  21438. ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4
  21439. @end example
  21440. You can also skip the lavfi device and directly use the filter.
  21441. Also demonstrates downloading the frame and encoding with libx264.
  21442. Explicit output format specification is required in this case:
  21443. @example
  21444. ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4
  21445. @end example
  21446. If you want to capture only a subsection of the desktop, this can be achieved
  21447. by specifying a smaller size and its offsets into the screen:
  21448. @example
  21449. ddagrab=video_size=800x600:offset_x=100:offset_y=100
  21450. @end example
  21451. @section gradients
  21452. Generate several gradients.
  21453. @table @option
  21454. @item size, s
  21455. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  21456. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  21457. @item rate, r
  21458. Set frame rate, expressed as number of frames per second. Default
  21459. value is "25".
  21460. @item c0, c1, c2, c3, c4, c5, c6, c7
  21461. Set 8 colors. Default values for colors is to pick random one.
  21462. @item x0, y0, y0, y1
  21463. Set gradient line source and destination points. If negative or out of range, random ones
  21464. are picked.
  21465. @item nb_colors, n
  21466. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  21467. @item seed
  21468. Set seed for picking gradient line points.
  21469. @item duration, d
  21470. Set the duration of the sourced video. See
  21471. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21472. for the accepted syntax.
  21473. If not specified, or the expressed duration is negative, the video is
  21474. supposed to be generated forever.
  21475. @item speed
  21476. Set speed of gradients rotation.
  21477. @item type, t
  21478. Set type of gradients, can be @code{linear} or @code{radial} or @code{circular} or @code{spiral}.
  21479. @end table
  21480. @section mandelbrot
  21481. Generate a Mandelbrot set fractal, and progressively zoom towards the
  21482. point specified with @var{start_x} and @var{start_y}.
  21483. This source accepts the following options:
  21484. @table @option
  21485. @item end_pts
  21486. Set the terminal pts value. Default value is 400.
  21487. @item end_scale
  21488. Set the terminal scale value.
  21489. Must be a floating point value. Default value is 0.3.
  21490. @item inner
  21491. Set the inner coloring mode, that is the algorithm used to draw the
  21492. Mandelbrot fractal internal region.
  21493. It shall assume one of the following values:
  21494. @table @option
  21495. @item black
  21496. Set black mode.
  21497. @item convergence
  21498. Show time until convergence.
  21499. @item mincol
  21500. Set color based on point closest to the origin of the iterations.
  21501. @item period
  21502. Set period mode.
  21503. @end table
  21504. Default value is @var{mincol}.
  21505. @item bailout
  21506. Set the bailout value. Default value is 10.0.
  21507. @item maxiter
  21508. Set the maximum of iterations performed by the rendering
  21509. algorithm. Default value is 7189.
  21510. @item outer
  21511. Set outer coloring mode.
  21512. It shall assume one of following values:
  21513. @table @option
  21514. @item iteration_count
  21515. Set iteration count mode.
  21516. @item normalized_iteration_count
  21517. set normalized iteration count mode.
  21518. @end table
  21519. Default value is @var{normalized_iteration_count}.
  21520. @item rate, r
  21521. Set frame rate, expressed as number of frames per second. Default
  21522. value is "25".
  21523. @item size, s
  21524. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  21525. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  21526. @item start_scale
  21527. Set the initial scale value. Default value is 3.0.
  21528. @item start_x
  21529. Set the initial x position. Must be a floating point value between
  21530. -100 and 100. Default value is -0.743643887037158704752191506114774.
  21531. @item start_y
  21532. Set the initial y position. Must be a floating point value between
  21533. -100 and 100. Default value is -0.131825904205311970493132056385139.
  21534. @end table
  21535. @section mptestsrc
  21536. Generate various test patterns, as generated by the MPlayer test filter.
  21537. The size of the generated video is fixed, and is 256x256.
  21538. This source is useful in particular for testing encoding features.
  21539. This source accepts the following options:
  21540. @table @option
  21541. @item rate, r
  21542. Specify the frame rate of the sourced video, as the number of frames
  21543. generated per second. It has to be a string in the format
  21544. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  21545. number or a valid video frame rate abbreviation. The default value is
  21546. "25".
  21547. @item duration, d
  21548. Set the duration of the sourced video. See
  21549. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21550. for the accepted syntax.
  21551. If not specified, or the expressed duration is negative, the video is
  21552. supposed to be generated forever.
  21553. @item test, t
  21554. Set the number or the name of the test to perform. Supported tests are:
  21555. @table @option
  21556. @item dc_luma
  21557. @item dc_chroma
  21558. @item freq_luma
  21559. @item freq_chroma
  21560. @item amp_luma
  21561. @item amp_chroma
  21562. @item cbp
  21563. @item mv
  21564. @item ring1
  21565. @item ring2
  21566. @item all
  21567. @item max_frames, m
  21568. Set the maximum number of frames generated for each test, default value is 30.
  21569. @end table
  21570. Default value is "all", which will cycle through the list of all tests.
  21571. @end table
  21572. Some examples:
  21573. @example
  21574. mptestsrc=t=dc_luma
  21575. @end example
  21576. will generate a "dc_luma" test pattern.
  21577. @section frei0r_src
  21578. Provide a frei0r source.
  21579. To enable compilation of this filter you need to install the frei0r
  21580. header and configure FFmpeg with @code{--enable-frei0r}.
  21581. This source accepts the following parameters:
  21582. @table @option
  21583. @item size
  21584. The size of the video to generate. For the syntax of this option, check the
  21585. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21586. @item framerate
  21587. The framerate of the generated video. It may be a string of the form
  21588. @var{num}/@var{den} or a frame rate abbreviation.
  21589. @item filter_name
  21590. The name to the frei0r source to load. For more information regarding frei0r and
  21591. how to set the parameters, read the @ref{frei0r} section in the video filters
  21592. documentation.
  21593. @item filter_params
  21594. A '|'-separated list of parameters to pass to the frei0r source.
  21595. @end table
  21596. For example, to generate a frei0r partik0l source with size 200x200
  21597. and frame rate 10 which is overlaid on the overlay filter main input:
  21598. @example
  21599. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  21600. @end example
  21601. @section life
  21602. Generate a life pattern.
  21603. This source is based on a generalization of John Conway's life game.
  21604. The sourced input represents a life grid, each pixel represents a cell
  21605. which can be in one of two possible states, alive or dead. Every cell
  21606. interacts with its eight neighbours, which are the cells that are
  21607. horizontally, vertically, or diagonally adjacent.
  21608. At each interaction the grid evolves according to the adopted rule,
  21609. which specifies the number of neighbor alive cells which will make a
  21610. cell stay alive or born. The @option{rule} option allows one to specify
  21611. the rule to adopt.
  21612. This source accepts the following options:
  21613. @table @option
  21614. @item filename, f
  21615. Set the file from which to read the initial grid state. In the file,
  21616. each non-whitespace character is considered an alive cell, and newline
  21617. is used to delimit the end of each row.
  21618. If this option is not specified, the initial grid is generated
  21619. randomly.
  21620. @item rate, r
  21621. Set the video rate, that is the number of frames generated per second.
  21622. Default is 25.
  21623. @item random_fill_ratio, ratio
  21624. Set the random fill ratio for the initial random grid. It is a
  21625. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  21626. It is ignored when a file is specified.
  21627. @item random_seed, seed
  21628. Set the seed for filling the initial random grid, must be an integer
  21629. included between 0 and UINT32_MAX. If not specified, or if explicitly
  21630. set to -1, the filter will try to use a good random seed on a best
  21631. effort basis.
  21632. @item rule
  21633. Set the life rule.
  21634. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  21635. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  21636. @var{NS} specifies the number of alive neighbor cells which make a
  21637. live cell stay alive, and @var{NB} the number of alive neighbor cells
  21638. which make a dead cell to become alive (i.e. to "born").
  21639. "s" and "b" can be used in place of "S" and "B", respectively.
  21640. Alternatively a rule can be specified by an 18-bits integer. The 9
  21641. high order bits are used to encode the next cell state if it is alive
  21642. for each number of neighbor alive cells, the low order bits specify
  21643. the rule for "borning" new cells. Higher order bits encode for an
  21644. higher number of neighbor cells.
  21645. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  21646. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  21647. Default value is "S23/B3", which is the original Conway's game of life
  21648. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  21649. cells, and will born a new cell if there are three alive cells around
  21650. a dead cell.
  21651. @item size, s
  21652. Set the size of the output video. For the syntax of this option, check the
  21653. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21654. If @option{filename} is specified, the size is set by default to the
  21655. same size of the input file. If @option{size} is set, it must contain
  21656. the size specified in the input file, and the initial grid defined in
  21657. that file is centered in the larger resulting area.
  21658. If a filename is not specified, the size value defaults to "320x240"
  21659. (used for a randomly generated initial grid).
  21660. @item stitch
  21661. If set to 1, stitch the left and right grid edges together, and the
  21662. top and bottom edges also. Defaults to 1.
  21663. @item mold
  21664. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  21665. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  21666. value from 0 to 255.
  21667. @item life_color
  21668. Set the color of living (or new born) cells.
  21669. @item death_color
  21670. Set the color of dead cells. If @option{mold} is set, this is the first color
  21671. used to represent a dead cell.
  21672. @item mold_color
  21673. Set mold color, for definitely dead and moldy cells.
  21674. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  21675. ffmpeg-utils manual,ffmpeg-utils}.
  21676. @end table
  21677. @subsection Examples
  21678. @itemize
  21679. @item
  21680. Read a grid from @file{pattern}, and center it on a grid of size
  21681. 300x300 pixels:
  21682. @example
  21683. life=f=pattern:s=300x300
  21684. @end example
  21685. @item
  21686. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  21687. @example
  21688. life=ratio=2/3:s=200x200
  21689. @end example
  21690. @item
  21691. Specify a custom rule for evolving a randomly generated grid:
  21692. @example
  21693. life=rule=S14/B34
  21694. @end example
  21695. @item
  21696. Full example with slow death effect (mold) using @command{ffplay}:
  21697. @example
  21698. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  21699. @end example
  21700. @end itemize
  21701. @anchor{allrgb}
  21702. @anchor{allyuv}
  21703. @anchor{color}
  21704. @anchor{colorchart}
  21705. @anchor{colorspectrum}
  21706. @anchor{haldclutsrc}
  21707. @anchor{nullsrc}
  21708. @anchor{pal75bars}
  21709. @anchor{pal100bars}
  21710. @anchor{rgbtestsrc}
  21711. @anchor{smptebars}
  21712. @anchor{smptehdbars}
  21713. @anchor{testsrc}
  21714. @anchor{testsrc2}
  21715. @anchor{yuvtestsrc}
  21716. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  21717. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  21718. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  21719. The @code{color} source provides an uniformly colored input.
  21720. The @code{colorchart} source provides a colors checker chart.
  21721. The @code{colorspectrum} source provides a color spectrum input.
  21722. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  21723. @ref{haldclut} filter.
  21724. The @code{nullsrc} source returns unprocessed video frames. It is
  21725. mainly useful to be employed in analysis / debugging tools, or as the
  21726. source for filters which ignore the input data.
  21727. The @code{pal75bars} source generates a color bars pattern, based on
  21728. EBU PAL recommendations with 75% color levels.
  21729. The @code{pal100bars} source generates a color bars pattern, based on
  21730. EBU PAL recommendations with 100% color levels.
  21731. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  21732. detecting RGB vs BGR issues. You should see a red, green and blue
  21733. stripe from top to bottom.
  21734. The @code{smptebars} source generates a color bars pattern, based on
  21735. the SMPTE Engineering Guideline EG 1-1990.
  21736. The @code{smptehdbars} source generates a color bars pattern, based on
  21737. the SMPTE RP 219-2002.
  21738. The @code{testsrc} source generates a test video pattern, showing a
  21739. color pattern, a scrolling gradient and a timestamp. This is mainly
  21740. intended for testing purposes.
  21741. The @code{testsrc2} source is similar to testsrc, but supports more
  21742. pixel formats instead of just @code{rgb24}. This allows using it as an
  21743. input for other tests without requiring a format conversion.
  21744. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  21745. see a y, cb and cr stripe from top to bottom.
  21746. The sources accept the following parameters:
  21747. @table @option
  21748. @item level
  21749. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  21750. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  21751. pixels to be used as identity matrix for 3D lookup tables. Each component is
  21752. coded on a @code{1/(N*N)} scale.
  21753. @item color, c
  21754. Specify the color of the source, only available in the @code{color}
  21755. source. For the syntax of this option, check the
  21756. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21757. @item size, s
  21758. Specify the size of the sourced video. For the syntax of this option, check the
  21759. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21760. The default value is @code{320x240}.
  21761. This option is not available with the @code{allrgb}, @code{allyuv}, and
  21762. @code{haldclutsrc} filters.
  21763. @item rate, r
  21764. Specify the frame rate of the sourced video, as the number of frames
  21765. generated per second. It has to be a string in the format
  21766. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  21767. number or a valid video frame rate abbreviation. The default value is
  21768. "25".
  21769. @item duration, d
  21770. Set the duration of the sourced video. See
  21771. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21772. for the accepted syntax.
  21773. If not specified, or the expressed duration is negative, the video is
  21774. supposed to be generated forever.
  21775. Since the frame rate is used as time base, all frames including the last one
  21776. will have their full duration. If the specified duration is not a multiple
  21777. of the frame duration, it will be rounded up.
  21778. @item sar
  21779. Set the sample aspect ratio of the sourced video.
  21780. @item alpha
  21781. Specify the alpha (opacity) of the background, only available in the
  21782. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  21783. 255 (fully opaque, the default).
  21784. @item decimals, n
  21785. Set the number of decimals to show in the timestamp, only available in the
  21786. @code{testsrc} source.
  21787. The displayed timestamp value will correspond to the original
  21788. timestamp value multiplied by the power of 10 of the specified
  21789. value. Default value is 0.
  21790. @item type
  21791. Set the type of the color spectrum, only available in the
  21792. @code{colorspectrum} source. Can be one of the following:
  21793. @table @samp
  21794. @item black
  21795. @item white
  21796. @item all
  21797. @end table
  21798. @item patch_size
  21799. Set patch size of single color patch, only available in the
  21800. @code{colorchart} source. Default is @code{64x64}.
  21801. @item preset
  21802. Set colorchecker colors preset, only available in the
  21803. @code{colorchart} source.
  21804. Available values are:
  21805. @table @samp
  21806. @item reference
  21807. @item skintones
  21808. @end table
  21809. Default value is @code{reference}.
  21810. @end table
  21811. @subsection Examples
  21812. @itemize
  21813. @item
  21814. Generate a video with a duration of 5.3 seconds, with size
  21815. 176x144 and a frame rate of 10 frames per second:
  21816. @example
  21817. testsrc=duration=5.3:size=qcif:rate=10
  21818. @end example
  21819. @item
  21820. The following graph description will generate a red source
  21821. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  21822. frames per second:
  21823. @example
  21824. color=c=red@@0.2:s=qcif:r=10
  21825. @end example
  21826. @item
  21827. If the input content is to be ignored, @code{nullsrc} can be used. The
  21828. following command generates noise in the luma plane by employing
  21829. the @code{geq} filter:
  21830. @example
  21831. nullsrc=s=256x256, geq=random(1)*255:128:128
  21832. @end example
  21833. @end itemize
  21834. @subsection Commands
  21835. The @code{color} source supports the following commands:
  21836. @table @option
  21837. @item c, color
  21838. Set the color of the created image. Accepts the same syntax of the
  21839. corresponding @option{color} option.
  21840. @end table
  21841. @section openclsrc
  21842. Generate video using an OpenCL program.
  21843. @table @option
  21844. @item source
  21845. OpenCL program source file.
  21846. @item kernel
  21847. Kernel name in program.
  21848. @item size, s
  21849. Size of frames to generate. This must be set.
  21850. @item format
  21851. Pixel format to use for the generated frames. This must be set.
  21852. @item rate, r
  21853. Number of frames generated every second. Default value is '25'.
  21854. @end table
  21855. For details of how the program loading works, see the @ref{program_opencl}
  21856. filter.
  21857. Example programs:
  21858. @itemize
  21859. @item
  21860. Generate a colour ramp by setting pixel values from the position of the pixel
  21861. in the output image. (Note that this will work with all pixel formats, but
  21862. the generated output will not be the same.)
  21863. @verbatim
  21864. __kernel void ramp(__write_only image2d_t dst,
  21865. unsigned int index)
  21866. {
  21867. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  21868. float4 val;
  21869. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  21870. write_imagef(dst, loc, val);
  21871. }
  21872. @end verbatim
  21873. @item
  21874. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  21875. @verbatim
  21876. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  21877. unsigned int index)
  21878. {
  21879. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  21880. float4 value = 0.0f;
  21881. int x = loc.x + index;
  21882. int y = loc.y + index;
  21883. while (x > 0 || y > 0) {
  21884. if (x % 3 == 1 && y % 3 == 1) {
  21885. value = 1.0f;
  21886. break;
  21887. }
  21888. x /= 3;
  21889. y /= 3;
  21890. }
  21891. write_imagef(dst, loc, value);
  21892. }
  21893. @end verbatim
  21894. @end itemize
  21895. @section sierpinski
  21896. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  21897. This source accepts the following options:
  21898. @table @option
  21899. @item size, s
  21900. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  21901. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  21902. @item rate, r
  21903. Set frame rate, expressed as number of frames per second. Default
  21904. value is "25".
  21905. @item seed
  21906. Set seed which is used for random panning.
  21907. @item jump
  21908. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  21909. @item type
  21910. Set fractal type, can be default @code{carpet} or @code{triangle}.
  21911. @end table
  21912. @section zoneplate
  21913. Generate a zoneplate test video pattern.
  21914. This source accepts the following options:
  21915. @table @option
  21916. @item size, s
  21917. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  21918. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "320x240".
  21919. @item rate, r
  21920. Set frame rate, expressed as number of frames per second. Default
  21921. value is "25".
  21922. @item duration, d
  21923. Set the duration of the sourced video. See
  21924. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21925. for the accepted syntax.
  21926. If not specified, or the expressed duration is negative, the video is
  21927. supposed to be generated forever.
  21928. @item sar
  21929. Set the sample aspect ratio of the sourced video.
  21930. @item precision
  21931. Set precision in bits for look-up table for sine calculations. Default value is 10.
  21932. Allowed range is from 4 to 16.
  21933. @item xo
  21934. Set horizontal axis offset for output signal. Default value is 0.
  21935. @item yo
  21936. Set vertical axis offset for output signal. Default value is 0.
  21937. @item to
  21938. Set time axis offset for output signal. Default value is 0.
  21939. @item k0
  21940. Set 0-order, constant added to signal phase. Default value is 0.
  21941. @item kx
  21942. Set 1-order, phase factor multiplier for horizontal axis. Default value is 0.
  21943. @item ky
  21944. Set 1-order, phase factor multiplier for vertical axis. Default value is 0.
  21945. @item kt
  21946. Set 1-order, phase factor multiplier for time axis. Default value is 0.
  21947. @item kxt, kyt, kxy
  21948. Set phase factor multipliers for combination of spatial and temporal axis.
  21949. Default value is 0.
  21950. @item kx2
  21951. Set 2-order, phase factor multiplier for horizontal axis. Default value is 0.
  21952. @item ky2
  21953. Set 2-order, phase factor multiplier for vertical axis. Default value is 0.
  21954. @item kt2
  21955. Set 2-order, phase factor multiplier for time axis. Default value is 0.
  21956. @item ku
  21957. Set the constant added to final phase to produce chroma-blue component of signal.
  21958. Default value is 0.
  21959. @item kv
  21960. Set the constant added to final phase to produce chroma-red component of signal.
  21961. Default value is 0.
  21962. @end table
  21963. @subsection Commands
  21964. This source supports the some above options as @ref{commands}.
  21965. @subsection Examples
  21966. @itemize
  21967. @item
  21968. Generate horizontal color sine sweep:
  21969. @example
  21970. zoneplate=ku=512:kv=0:kt2=0:kx2=256:s=wvga:xo=-426:kt=11
  21971. @end example
  21972. @item
  21973. Generate vertical color sine sweep:
  21974. @example
  21975. zoneplate=ku=512:kv=0:kt2=0:ky2=156:s=wvga:yo=-240:kt=11
  21976. @end example
  21977. @item
  21978. Generate circular zone-plate:
  21979. @example
  21980. zoneplate=ku=512:kv=100:kt2=0:ky2=256:kx2=556:s=wvga:yo=0:kt=11
  21981. @end example
  21982. @end itemize
  21983. @c man end VIDEO SOURCES
  21984. @chapter Video Sinks
  21985. @c man begin VIDEO SINKS
  21986. Below is a description of the currently available video sinks.
  21987. @section buffersink
  21988. Buffer video frames, and make them available to the end of the filter
  21989. graph.
  21990. This sink is mainly intended for programmatic use, in particular
  21991. through the interface defined in @file{libavfilter/buffersink.h}
  21992. or the options system.
  21993. It accepts a pointer to an AVBufferSinkContext structure, which
  21994. defines the incoming buffers' formats, to be passed as the opaque
  21995. parameter to @code{avfilter_init_filter} for initialization.
  21996. @section nullsink
  21997. Null video sink: do absolutely nothing with the input video. It is
  21998. mainly useful as a template and for use in analysis / debugging
  21999. tools.
  22000. @c man end VIDEO SINKS
  22001. @chapter Multimedia Filters
  22002. @c man begin MULTIMEDIA FILTERS
  22003. Below is a description of the currently available multimedia filters.
  22004. @section a3dscope
  22005. Convert input audio to 3d scope video output.
  22006. The filter accepts the following options:
  22007. @table @option
  22008. @item rate, r
  22009. Set frame rate, expressed as number of frames per second. Default
  22010. value is "25".
  22011. @item size, s
  22012. Specify the video size for the output. For the syntax of this option, check the
  22013. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22014. Default value is @code{hd720}.
  22015. @item fov
  22016. Set the camera field of view. Default is 90 degrees.
  22017. Allowed range is from 40 to 150.
  22018. @item roll
  22019. Set the camera roll.
  22020. @item pitch
  22021. Set the camera pitch.
  22022. @item yaw
  22023. Set the camera yaw.
  22024. @item xzoom
  22025. Set the camera zoom on X-axis.
  22026. @item yzoom
  22027. Set the camera zoom on Y-axis.
  22028. @item zzoom
  22029. Set the camera zoom on Z-axis.
  22030. @item xpos
  22031. Set the camera position on X-axis.
  22032. @item ypos
  22033. Set the camera position on Y-axis.
  22034. @item zpos
  22035. Set the camera position on Z-axis.
  22036. @item length
  22037. Set the length of displayed audio waves in number of frames.
  22038. @end table
  22039. @subsection Commands
  22040. Filter supports the some above options as @ref{commands}.
  22041. @section abitscope
  22042. Convert input audio to a video output, displaying the audio bit scope.
  22043. The filter accepts the following options:
  22044. @table @option
  22045. @item rate, r
  22046. Set frame rate, expressed as number of frames per second. Default
  22047. value is "25".
  22048. @item size, s
  22049. Specify the video size for the output. For the syntax of this option, check the
  22050. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22051. Default value is @code{1024x256}.
  22052. @item colors
  22053. Specify list of colors separated by space or by '|' which will be used to
  22054. draw channels. Unrecognized or missing colors will be replaced
  22055. by white color.
  22056. @item mode, m
  22057. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  22058. @end table
  22059. @section adrawgraph
  22060. Draw a graph using input audio metadata.
  22061. See @ref{drawgraph}
  22062. @section agraphmonitor
  22063. See @ref{graphmonitor}.
  22064. @section ahistogram
  22065. Convert input audio to a video output, displaying the volume histogram.
  22066. The filter accepts the following options:
  22067. @table @option
  22068. @item dmode
  22069. Specify how histogram is calculated.
  22070. It accepts the following values:
  22071. @table @samp
  22072. @item single
  22073. Use single histogram for all channels.
  22074. @item separate
  22075. Use separate histogram for each channel.
  22076. @end table
  22077. Default is @code{single}.
  22078. @item rate, r
  22079. Set frame rate, expressed as number of frames per second. Default
  22080. value is "25".
  22081. @item size, s
  22082. Specify the video size for the output. For the syntax of this option, check the
  22083. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22084. Default value is @code{hd720}.
  22085. @item scale
  22086. Set display scale.
  22087. It accepts the following values:
  22088. @table @samp
  22089. @item log
  22090. logarithmic
  22091. @item sqrt
  22092. square root
  22093. @item cbrt
  22094. cubic root
  22095. @item lin
  22096. linear
  22097. @item rlog
  22098. reverse logarithmic
  22099. @end table
  22100. Default is @code{log}.
  22101. @item ascale
  22102. Set amplitude scale.
  22103. It accepts the following values:
  22104. @table @samp
  22105. @item log
  22106. logarithmic
  22107. @item lin
  22108. linear
  22109. @end table
  22110. Default is @code{log}.
  22111. @item acount
  22112. Set how much frames to accumulate in histogram.
  22113. Default is 1. Setting this to -1 accumulates all frames.
  22114. @item rheight
  22115. Set histogram ratio of window height.
  22116. @item slide
  22117. Set sonogram sliding.
  22118. It accepts the following values:
  22119. @table @samp
  22120. @item replace
  22121. replace old rows with new ones.
  22122. @item scroll
  22123. scroll from top to bottom.
  22124. @end table
  22125. Default is @code{replace}.
  22126. @item hmode
  22127. Set histogram mode.
  22128. It accepts the following values:
  22129. @table @samp
  22130. @item abs
  22131. Use absolute values of samples.
  22132. @item sign
  22133. Use untouched values of samples.
  22134. @end table
  22135. Default is @code{abs}.
  22136. @end table
  22137. @section aphasemeter
  22138. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  22139. representing mean phase of current audio frame. A video output can also be produced and is
  22140. enabled by default. The audio is passed through as first output.
  22141. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  22142. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  22143. and @code{1} means channels are in phase.
  22144. The filter accepts the following options, all related to its video output:
  22145. @table @option
  22146. @item rate, r
  22147. Set the output frame rate. Default value is @code{25}.
  22148. @item size, s
  22149. Set the video size for the output. For the syntax of this option, check the
  22150. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22151. Default value is @code{800x400}.
  22152. @item rc
  22153. @item gc
  22154. @item bc
  22155. Specify the red, green, blue contrast. Default values are @code{2},
  22156. @code{7} and @code{1}.
  22157. Allowed range is @code{[0, 255]}.
  22158. @item mpc
  22159. Set color which will be used for drawing median phase. If color is
  22160. @code{none} which is default, no median phase value will be drawn.
  22161. @item video
  22162. Enable video output. Default is enabled.
  22163. @end table
  22164. @subsection phasing detection
  22165. The filter also detects out of phase and mono sequences in stereo streams.
  22166. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  22167. The filter accepts the following options for this detection:
  22168. @table @option
  22169. @item phasing
  22170. Enable mono and out of phase detection. Default is disabled.
  22171. @item tolerance, t
  22172. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  22173. Allowed range is @code{[0, 1]}.
  22174. @item angle, a
  22175. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  22176. Allowed range is @code{[90, 180]}.
  22177. @item duration, d
  22178. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  22179. @end table
  22180. @subsection Examples
  22181. @itemize
  22182. @item
  22183. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  22184. @example
  22185. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  22186. @end example
  22187. @end itemize
  22188. @section avectorscope
  22189. Convert input audio to a video output, representing the audio vector
  22190. scope.
  22191. The filter is used to measure the difference between channels of stereo
  22192. audio stream. A monaural signal, consisting of identical left and right
  22193. signal, results in straight vertical line. Any stereo separation is visible
  22194. as a deviation from this line, creating a Lissajous figure.
  22195. If the straight (or deviation from it) but horizontal line appears this
  22196. indicates that the left and right channels are out of phase.
  22197. The filter accepts the following options:
  22198. @table @option
  22199. @item mode, m
  22200. Set the vectorscope mode.
  22201. Available values are:
  22202. @table @samp
  22203. @item lissajous
  22204. Lissajous rotated by 45 degrees.
  22205. @item lissajous_xy
  22206. Same as above but not rotated.
  22207. @item polar
  22208. Shape resembling half of circle.
  22209. @end table
  22210. Default value is @samp{lissajous}.
  22211. @item size, s
  22212. Set the video size for the output. For the syntax of this option, check the
  22213. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22214. Default value is @code{400x400}.
  22215. @item rate, r
  22216. Set the output frame rate. Default value is @code{25}.
  22217. @item rc
  22218. @item gc
  22219. @item bc
  22220. @item ac
  22221. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  22222. @code{160}, @code{80} and @code{255}.
  22223. Allowed range is @code{[0, 255]}.
  22224. @item rf
  22225. @item gf
  22226. @item bf
  22227. @item af
  22228. Specify the red, green, blue and alpha fade. Default values are @code{15},
  22229. @code{10}, @code{5} and @code{5}.
  22230. Allowed range is @code{[0, 255]}.
  22231. @item zoom
  22232. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  22233. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  22234. @item draw
  22235. Set the vectorscope drawing mode.
  22236. Available values are:
  22237. @table @samp
  22238. @item dot
  22239. Draw dot for each sample.
  22240. @item line
  22241. Draw line between previous and current sample.
  22242. @item aaline
  22243. Draw anti-aliased line between previous and current sample.
  22244. @end table
  22245. Default value is @samp{dot}.
  22246. @item scale
  22247. Specify amplitude scale of audio samples.
  22248. Available values are:
  22249. @table @samp
  22250. @item lin
  22251. Linear.
  22252. @item sqrt
  22253. Square root.
  22254. @item cbrt
  22255. Cubic root.
  22256. @item log
  22257. Logarithmic.
  22258. @end table
  22259. @item swap
  22260. Swap left channel axis with right channel axis.
  22261. @item mirror
  22262. Mirror axis.
  22263. @table @samp
  22264. @item none
  22265. No mirror.
  22266. @item x
  22267. Mirror only x axis.
  22268. @item y
  22269. Mirror only y axis.
  22270. @item xy
  22271. Mirror both axis.
  22272. @end table
  22273. @end table
  22274. @subsection Examples
  22275. @itemize
  22276. @item
  22277. Complete example using @command{ffplay}:
  22278. @example
  22279. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  22280. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  22281. @end example
  22282. @end itemize
  22283. @subsection Commands
  22284. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  22285. @section bench, abench
  22286. Benchmark part of a filtergraph.
  22287. The filter accepts the following options:
  22288. @table @option
  22289. @item action
  22290. Start or stop a timer.
  22291. Available values are:
  22292. @table @samp
  22293. @item start
  22294. Get the current time, set it as frame metadata (using the key
  22295. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  22296. @item stop
  22297. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  22298. the input frame metadata to get the time difference. Time difference, average,
  22299. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  22300. @code{min}) are then printed. The timestamps are expressed in seconds.
  22301. @end table
  22302. @end table
  22303. @subsection Examples
  22304. @itemize
  22305. @item
  22306. Benchmark @ref{selectivecolor} filter:
  22307. @example
  22308. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  22309. @end example
  22310. @end itemize
  22311. @section concat
  22312. Concatenate audio and video streams, joining them together one after the
  22313. other.
  22314. The filter works on segments of synchronized video and audio streams. All
  22315. segments must have the same number of streams of each type, and that will
  22316. also be the number of streams at output.
  22317. The filter accepts the following options:
  22318. @table @option
  22319. @item n
  22320. Set the number of segments. Default is 2.
  22321. @item v
  22322. Set the number of output video streams, that is also the number of video
  22323. streams in each segment. Default is 1.
  22324. @item a
  22325. Set the number of output audio streams, that is also the number of audio
  22326. streams in each segment. Default is 0.
  22327. @item unsafe
  22328. Activate unsafe mode: do not fail if segments have a different format.
  22329. @end table
  22330. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  22331. @var{a} audio outputs.
  22332. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  22333. segment, in the same order as the outputs, then the inputs for the second
  22334. segment, etc.
  22335. Related streams do not always have exactly the same duration, for various
  22336. reasons including codec frame size or sloppy authoring. For that reason,
  22337. related synchronized streams (e.g. a video and its audio track) should be
  22338. concatenated at once. The concat filter will use the duration of the longest
  22339. stream in each segment (except the last one), and if necessary pad shorter
  22340. audio streams with silence.
  22341. For this filter to work correctly, all segments must start at timestamp 0.
  22342. All corresponding streams must have the same parameters in all segments; the
  22343. filtering system will automatically select a common pixel format for video
  22344. streams, and a common sample format, sample rate and channel layout for
  22345. audio streams, but other settings, such as resolution, must be converted
  22346. explicitly by the user.
  22347. Different frame rates are acceptable but will result in variable frame rate
  22348. at output; be sure to configure the output file to handle it.
  22349. @subsection Examples
  22350. @itemize
  22351. @item
  22352. Concatenate an opening, an episode and an ending, all in bilingual version
  22353. (video in stream 0, audio in streams 1 and 2):
  22354. @example
  22355. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  22356. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  22357. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  22358. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  22359. @end example
  22360. @item
  22361. Concatenate two parts, handling audio and video separately, using the
  22362. (a)movie sources, and adjusting the resolution:
  22363. @example
  22364. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  22365. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  22366. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  22367. @end example
  22368. Note that a desync will happen at the stitch if the audio and video streams
  22369. do not have exactly the same duration in the first file.
  22370. @end itemize
  22371. @subsection Commands
  22372. This filter supports the following commands:
  22373. @table @option
  22374. @item next
  22375. Close the current segment and step to the next one
  22376. @end table
  22377. @anchor{ebur128}
  22378. @section ebur128
  22379. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  22380. level. By default, it logs a message at a frequency of 10Hz with the
  22381. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  22382. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  22383. The filter can only analyze streams which have
  22384. sample format is double-precision floating point. The input stream will be converted to
  22385. this specification, if needed. Users may need to insert aformat and/or aresample filters
  22386. after this filter to obtain the original parameters.
  22387. The filter also has a video output (see the @var{video} option) with a real
  22388. time graph to observe the loudness evolution. The graphic contains the logged
  22389. message mentioned above, so it is not printed anymore when this option is set,
  22390. unless the verbose logging is set. The main graphing area contains the
  22391. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  22392. the momentary loudness (400 milliseconds), but can optionally be configured
  22393. to instead display short-term loudness (see @var{gauge}).
  22394. The green area marks a +/- 1LU target range around the target loudness
  22395. (-23LUFS by default, unless modified through @var{target}).
  22396. More information about the Loudness Recommendation EBU R128 on
  22397. @url{http://tech.ebu.ch/loudness}.
  22398. The filter accepts the following options:
  22399. @table @option
  22400. @item video
  22401. Activate the video output. The audio stream is passed unchanged whether this
  22402. option is set or no. The video stream will be the first output stream if
  22403. activated. Default is @code{0}.
  22404. @item size
  22405. Set the video size. This option is for video only. For the syntax of this
  22406. option, check the
  22407. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22408. Default and minimum resolution is @code{640x480}.
  22409. @item meter
  22410. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  22411. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  22412. other integer value between this range is allowed.
  22413. @item metadata
  22414. Set metadata injection. If set to @code{1}, the audio input will be segmented
  22415. into 100ms output frames, each of them containing various loudness information
  22416. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  22417. Default is @code{0}.
  22418. @item framelog
  22419. Force the frame logging level.
  22420. Available values are:
  22421. @table @samp
  22422. @item quiet
  22423. logging disabled
  22424. @item info
  22425. information logging level
  22426. @item verbose
  22427. verbose logging level
  22428. @end table
  22429. By default, the logging level is set to @var{info}. If the @option{video} or
  22430. the @option{metadata} options are set, it switches to @var{verbose}.
  22431. @item peak
  22432. Set peak mode(s).
  22433. Available modes can be cumulated (the option is a @code{flag} type). Possible
  22434. values are:
  22435. @table @samp
  22436. @item none
  22437. Disable any peak mode (default).
  22438. @item sample
  22439. Enable sample-peak mode.
  22440. Simple peak mode looking for the higher sample value. It logs a message
  22441. for sample-peak (identified by @code{SPK}).
  22442. @item true
  22443. Enable true-peak mode.
  22444. If enabled, the peak lookup is done on an over-sampled version of the input
  22445. stream for better peak accuracy. It logs a message for true-peak.
  22446. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  22447. This mode requires a build with @code{libswresample}.
  22448. @end table
  22449. @item dualmono
  22450. Treat mono input files as "dual mono". If a mono file is intended for playback
  22451. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  22452. If set to @code{true}, this option will compensate for this effect.
  22453. Multi-channel input files are not affected by this option.
  22454. @item panlaw
  22455. Set a specific pan law to be used for the measurement of dual mono files.
  22456. This parameter is optional, and has a default value of -3.01dB.
  22457. @item target
  22458. Set a specific target level (in LUFS) used as relative zero in the visualization.
  22459. This parameter is optional and has a default value of -23LUFS as specified
  22460. by EBU R128. However, material published online may prefer a level of -16LUFS
  22461. (e.g. for use with podcasts or video platforms).
  22462. @item gauge
  22463. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  22464. @code{shortterm}. By default the momentary value will be used, but in certain
  22465. scenarios it may be more useful to observe the short term value instead (e.g.
  22466. live mixing).
  22467. @item scale
  22468. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  22469. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  22470. video output, not the summary or continuous log output.
  22471. @item integrated
  22472. Read-only exported value for measured integrated loudness, in LUFS.
  22473. @item range
  22474. Read-only exported value for measured loudness range, in LU.
  22475. @item lra_low
  22476. Read-only exported value for measured LRA low, in LUFS.
  22477. @item lra_high
  22478. Read-only exported value for measured LRA high, in LUFS.
  22479. @item sample_peak
  22480. Read-only exported value for measured sample peak, in dBFS.
  22481. @item true_peak
  22482. Read-only exported value for measured true peak, in dBFS.
  22483. @end table
  22484. @subsection Examples
  22485. @itemize
  22486. @item
  22487. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  22488. @example
  22489. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  22490. @end example
  22491. @item
  22492. Run an analysis with @command{ffmpeg}:
  22493. @example
  22494. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  22495. @end example
  22496. @end itemize
  22497. @section interleave, ainterleave
  22498. Temporally interleave frames from several inputs.
  22499. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  22500. These filters read frames from several inputs and send the oldest
  22501. queued frame to the output.
  22502. Input streams must have well defined, monotonically increasing frame
  22503. timestamp values.
  22504. In order to submit one frame to output, these filters need to enqueue
  22505. at least one frame for each input, so they cannot work in case one
  22506. input is not yet terminated and will not receive incoming frames.
  22507. For example consider the case when one input is a @code{select} filter
  22508. which always drops input frames. The @code{interleave} filter will keep
  22509. reading from that input, but it will never be able to send new frames
  22510. to output until the input sends an end-of-stream signal.
  22511. Also, depending on inputs synchronization, the filters will drop
  22512. frames in case one input receives more frames than the other ones, and
  22513. the queue is already filled.
  22514. These filters accept the following options:
  22515. @table @option
  22516. @item nb_inputs, n
  22517. Set the number of different inputs, it is 2 by default.
  22518. @item duration
  22519. How to determine the end-of-stream.
  22520. @table @option
  22521. @item longest
  22522. The duration of the longest input. (default)
  22523. @item shortest
  22524. The duration of the shortest input.
  22525. @item first
  22526. The duration of the first input.
  22527. @end table
  22528. @end table
  22529. @subsection Examples
  22530. @itemize
  22531. @item
  22532. Interleave frames belonging to different streams using @command{ffmpeg}:
  22533. @example
  22534. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  22535. @end example
  22536. @item
  22537. Add flickering blur effect:
  22538. @example
  22539. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  22540. @end example
  22541. @end itemize
  22542. @section latency, alatency
  22543. Measure filtering latency.
  22544. Report previous filter filtering latency, delay in number of audio samples for audio filters
  22545. or number of video frames for video filters.
  22546. On end of input stream, filter will report min and max measured latency for previous running filter
  22547. in filtergraph.
  22548. @section metadata, ametadata
  22549. Manipulate frame metadata.
  22550. This filter accepts the following options:
  22551. @table @option
  22552. @item mode
  22553. Set mode of operation of the filter.
  22554. Can be one of the following:
  22555. @table @samp
  22556. @item select
  22557. If both @code{value} and @code{key} is set, select frames
  22558. which have such metadata. If only @code{key} is set, select
  22559. every frame that has such key in metadata.
  22560. @item add
  22561. Add new metadata @code{key} and @code{value}. If key is already available
  22562. do nothing.
  22563. @item modify
  22564. Modify value of already present key.
  22565. @item delete
  22566. If @code{value} is set, delete only keys that have such value.
  22567. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  22568. the frame.
  22569. @item print
  22570. Print key and its value if metadata was found. If @code{key} is not set print all
  22571. metadata values available in frame.
  22572. @end table
  22573. @item key
  22574. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  22575. @item value
  22576. Set metadata value which will be used. This option is mandatory for
  22577. @code{modify} and @code{add} mode.
  22578. @item function
  22579. Which function to use when comparing metadata value and @code{value}.
  22580. Can be one of following:
  22581. @table @samp
  22582. @item same_str
  22583. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  22584. @item starts_with
  22585. Values are interpreted as strings, returns true if metadata value starts with
  22586. the @code{value} option string.
  22587. @item less
  22588. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  22589. @item equal
  22590. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  22591. @item greater
  22592. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  22593. @item expr
  22594. Values are interpreted as floats, returns true if expression from option @code{expr}
  22595. evaluates to true.
  22596. @item ends_with
  22597. Values are interpreted as strings, returns true if metadata value ends with
  22598. the @code{value} option string.
  22599. @end table
  22600. @item expr
  22601. Set expression which is used when @code{function} is set to @code{expr}.
  22602. The expression is evaluated through the eval API and can contain the following
  22603. constants:
  22604. @table @option
  22605. @item VALUE1, FRAMEVAL
  22606. Float representation of @code{value} from metadata key.
  22607. @item VALUE2, USERVAL
  22608. Float representation of @code{value} as supplied by user in @code{value} option.
  22609. @end table
  22610. @item file
  22611. If specified in @code{print} mode, output is written to the named file. Instead of
  22612. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  22613. for standard output. If @code{file} option is not set, output is written to the log
  22614. with AV_LOG_INFO loglevel.
  22615. @item direct
  22616. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  22617. @end table
  22618. @subsection Examples
  22619. @itemize
  22620. @item
  22621. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  22622. between 0 and 1.
  22623. @example
  22624. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  22625. @end example
  22626. @item
  22627. Print silencedetect output to file @file{metadata.txt}.
  22628. @example
  22629. silencedetect,ametadata=mode=print:file=metadata.txt
  22630. @end example
  22631. @item
  22632. Direct all metadata to a pipe with file descriptor 4.
  22633. @example
  22634. metadata=mode=print:file='pipe\:4'
  22635. @end example
  22636. @end itemize
  22637. @section perms, aperms
  22638. Set read/write permissions for the output frames.
  22639. These filters are mainly aimed at developers to test direct path in the
  22640. following filter in the filtergraph.
  22641. The filters accept the following options:
  22642. @table @option
  22643. @item mode
  22644. Select the permissions mode.
  22645. It accepts the following values:
  22646. @table @samp
  22647. @item none
  22648. Do nothing. This is the default.
  22649. @item ro
  22650. Set all the output frames read-only.
  22651. @item rw
  22652. Set all the output frames directly writable.
  22653. @item toggle
  22654. Make the frame read-only if writable, and writable if read-only.
  22655. @item random
  22656. Set each output frame read-only or writable randomly.
  22657. @end table
  22658. @item seed
  22659. Set the seed for the @var{random} mode, must be an integer included between
  22660. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  22661. @code{-1}, the filter will try to use a good random seed on a best effort
  22662. basis.
  22663. @end table
  22664. Note: in case of auto-inserted filter between the permission filter and the
  22665. following one, the permission might not be received as expected in that
  22666. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  22667. perms/aperms filter can avoid this problem.
  22668. @section realtime, arealtime
  22669. Slow down filtering to match real time approximately.
  22670. These filters will pause the filtering for a variable amount of time to
  22671. match the output rate with the input timestamps.
  22672. They are similar to the @option{re} option to @code{ffmpeg}.
  22673. They accept the following options:
  22674. @table @option
  22675. @item limit
  22676. Time limit for the pauses. Any pause longer than that will be considered
  22677. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  22678. @item speed
  22679. Speed factor for processing. The value must be a float larger than zero.
  22680. Values larger than 1.0 will result in faster than realtime processing,
  22681. smaller will slow processing down. The @var{limit} is automatically adapted
  22682. accordingly. Default is 1.0.
  22683. A processing speed faster than what is possible without these filters cannot
  22684. be achieved.
  22685. @end table
  22686. @subsection Commands
  22687. Both filters supports the all above options as @ref{commands}.
  22688. @section segment, asegment
  22689. Split single input stream into multiple streams.
  22690. This filter does opposite of concat filters.
  22691. @code{segment} works on video frames, @code{asegment} on audio samples.
  22692. This filter accepts the following options:
  22693. @table @option
  22694. @item timestamps
  22695. Timestamps of output segments separated by '|'. The first segment will run
  22696. from the beginning of the input stream. The last segment will run until
  22697. the end of the input stream
  22698. @item frames, samples
  22699. Exact frame/sample count to split the segments.
  22700. @end table
  22701. In all cases, prefixing an each segment with '+' will make it relative to the
  22702. previous segment.
  22703. @subsection Examples
  22704. @itemize
  22705. @item
  22706. Split input audio stream into three output audio streams, starting at start of input audio stream
  22707. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  22708. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  22709. @example
  22710. asegment=timestamps="60|150"
  22711. @end example
  22712. @end itemize
  22713. @anchor{select}
  22714. @section select, aselect
  22715. Select frames to pass in output.
  22716. This filter accepts the following options:
  22717. @table @option
  22718. @item expr, e
  22719. Set expression, which is evaluated for each input frame.
  22720. If the expression is evaluated to zero, the frame is discarded.
  22721. If the evaluation result is negative or NaN, the frame is sent to the
  22722. first output; otherwise it is sent to the output with index
  22723. @code{ceil(val)-1}, assuming that the input index starts from 0.
  22724. For example a value of @code{1.2} corresponds to the output with index
  22725. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  22726. @item outputs, n
  22727. Set the number of outputs. The output to which to send the selected
  22728. frame is based on the result of the evaluation. Default value is 1.
  22729. @end table
  22730. The expression can contain the following constants:
  22731. @table @option
  22732. @item n
  22733. The (sequential) number of the filtered frame, starting from 0.
  22734. @item selected_n
  22735. The (sequential) number of the selected frame, starting from 0.
  22736. @item prev_selected_n
  22737. The sequential number of the last selected frame. It's NAN if undefined.
  22738. @item TB
  22739. The timebase of the input timestamps.
  22740. @item pts
  22741. The PTS (Presentation TimeStamp) of the filtered frame,
  22742. expressed in @var{TB} units. It's NAN if undefined.
  22743. @item t
  22744. The PTS of the filtered frame,
  22745. expressed in seconds. It's NAN if undefined.
  22746. @item prev_pts
  22747. The PTS of the previously filtered frame. It's NAN if undefined.
  22748. @item prev_selected_pts
  22749. The PTS of the last previously filtered frame. It's NAN if undefined.
  22750. @item prev_selected_t
  22751. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  22752. @item start_pts
  22753. The first PTS in the stream which is not NAN. It remains NAN if not found.
  22754. @item start_t
  22755. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  22756. @item pict_type @emph{(video only)}
  22757. The type of the filtered frame. It can assume one of the following
  22758. values:
  22759. @table @option
  22760. @item I
  22761. @item P
  22762. @item B
  22763. @item S
  22764. @item SI
  22765. @item SP
  22766. @item BI
  22767. @end table
  22768. @item interlace_type @emph{(video only)}
  22769. The frame interlace type. It can assume one of the following values:
  22770. @table @option
  22771. @item PROGRESSIVE
  22772. The frame is progressive (not interlaced).
  22773. @item TOPFIRST
  22774. The frame is top-field-first.
  22775. @item BOTTOMFIRST
  22776. The frame is bottom-field-first.
  22777. @end table
  22778. @item consumed_sample_n @emph{(audio only)}
  22779. the number of selected samples before the current frame
  22780. @item samples_n @emph{(audio only)}
  22781. the number of samples in the current frame
  22782. @item sample_rate @emph{(audio only)}
  22783. the input sample rate
  22784. @item key
  22785. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  22786. @item pos
  22787. the position in the file of the filtered frame, -1 if the information
  22788. is not available (e.g. for synthetic video); deprecated, do not use
  22789. @item scene @emph{(video only)}
  22790. value between 0 and 1 to indicate a new scene; a low value reflects a low
  22791. probability for the current frame to introduce a new scene, while a higher
  22792. value means the current frame is more likely to be one (see the example below)
  22793. @item concatdec_select
  22794. The concat demuxer can select only part of a concat input file by setting an
  22795. inpoint and an outpoint, but the output packets may not be entirely contained
  22796. in the selected interval. By using this variable, it is possible to skip frames
  22797. generated by the concat demuxer which are not exactly contained in the selected
  22798. interval.
  22799. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  22800. and the @var{lavf.concat.duration} packet metadata values which are also
  22801. present in the decoded frames.
  22802. The @var{concatdec_select} variable is -1 if the frame pts is at least
  22803. start_time and either the duration metadata is missing or the frame pts is less
  22804. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  22805. missing.
  22806. That basically means that an input frame is selected if its pts is within the
  22807. interval set by the concat demuxer.
  22808. @end table
  22809. The default value of the select expression is "1".
  22810. @subsection Examples
  22811. @itemize
  22812. @item
  22813. Select all frames in input:
  22814. @example
  22815. select
  22816. @end example
  22817. The example above is the same as:
  22818. @example
  22819. select=1
  22820. @end example
  22821. @item
  22822. Skip all frames:
  22823. @example
  22824. select=0
  22825. @end example
  22826. @item
  22827. Select only I-frames:
  22828. @example
  22829. select='eq(pict_type\,I)'
  22830. @end example
  22831. @item
  22832. Select one frame every 100:
  22833. @example
  22834. select='not(mod(n\,100))'
  22835. @end example
  22836. @item
  22837. Select only frames contained in the 10-20 time interval:
  22838. @example
  22839. select=between(t\,10\,20)
  22840. @end example
  22841. @item
  22842. Select only I-frames contained in the 10-20 time interval:
  22843. @example
  22844. select=between(t\,10\,20)*eq(pict_type\,I)
  22845. @end example
  22846. @item
  22847. Select frames with a minimum distance of 10 seconds:
  22848. @example
  22849. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  22850. @end example
  22851. @item
  22852. Use aselect to select only audio frames with samples number > 100:
  22853. @example
  22854. aselect='gt(samples_n\,100)'
  22855. @end example
  22856. @item
  22857. Create a mosaic of the first scenes:
  22858. @example
  22859. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  22860. @end example
  22861. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  22862. choice.
  22863. @item
  22864. Send even and odd frames to separate outputs, and compose them:
  22865. @example
  22866. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  22867. @end example
  22868. @item
  22869. Select useful frames from an ffconcat file which is using inpoints and
  22870. outpoints but where the source files are not intra frame only.
  22871. @example
  22872. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  22873. @end example
  22874. @end itemize
  22875. @section sendcmd, asendcmd
  22876. Send commands to filters in the filtergraph.
  22877. These filters read commands to be sent to other filters in the
  22878. filtergraph.
  22879. @code{sendcmd} must be inserted between two video filters,
  22880. @code{asendcmd} must be inserted between two audio filters, but apart
  22881. from that they act the same way.
  22882. The specification of commands can be provided in the filter arguments
  22883. with the @var{commands} option, or in a file specified by the
  22884. @var{filename} option.
  22885. These filters accept the following options:
  22886. @table @option
  22887. @item commands, c
  22888. Set the commands to be read and sent to the other filters.
  22889. @item filename, f
  22890. Set the filename of the commands to be read and sent to the other
  22891. filters.
  22892. @end table
  22893. @subsection Commands syntax
  22894. A commands description consists of a sequence of interval
  22895. specifications, comprising a list of commands to be executed when a
  22896. particular event related to that interval occurs. The occurring event
  22897. is typically the current frame time entering or leaving a given time
  22898. interval.
  22899. An interval is specified by the following syntax:
  22900. @example
  22901. @var{START}[-@var{END}] @var{COMMANDS};
  22902. @end example
  22903. The time interval is specified by the @var{START} and @var{END} times.
  22904. @var{END} is optional and defaults to the maximum time.
  22905. The current frame time is considered within the specified interval if
  22906. it is included in the interval [@var{START}, @var{END}), that is when
  22907. the time is greater or equal to @var{START} and is lesser than
  22908. @var{END}.
  22909. @var{COMMANDS} consists of a sequence of one or more command
  22910. specifications, separated by ",", relating to that interval. The
  22911. syntax of a command specification is given by:
  22912. @example
  22913. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  22914. @end example
  22915. @var{FLAGS} is optional and specifies the type of events relating to
  22916. the time interval which enable sending the specified command, and must
  22917. be a non-null sequence of identifier flags separated by "+" or "|" and
  22918. enclosed between "[" and "]".
  22919. The following flags are recognized:
  22920. @table @option
  22921. @item enter
  22922. The command is sent when the current frame timestamp enters the
  22923. specified interval. In other words, the command is sent when the
  22924. previous frame timestamp was not in the given interval, and the
  22925. current is.
  22926. @item leave
  22927. The command is sent when the current frame timestamp leaves the
  22928. specified interval. In other words, the command is sent when the
  22929. previous frame timestamp was in the given interval, and the
  22930. current is not.
  22931. @item expr
  22932. The command @var{ARG} is interpreted as expression and result of
  22933. expression is passed as @var{ARG}.
  22934. The expression is evaluated through the eval API and can contain the following
  22935. constants:
  22936. @table @option
  22937. @item POS
  22938. Original position in the file of the frame, or undefined if undefined
  22939. for the current frame. Deprecated, do not use.
  22940. @item PTS
  22941. The presentation timestamp in input.
  22942. @item N
  22943. The count of the input frame for video or audio, starting from 0.
  22944. @item T
  22945. The time in seconds of the current frame.
  22946. @item TS
  22947. The start time in seconds of the current command interval.
  22948. @item TE
  22949. The end time in seconds of the current command interval.
  22950. @item TI
  22951. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  22952. @item W
  22953. The video frame width.
  22954. @item H
  22955. The video frame height.
  22956. @end table
  22957. @end table
  22958. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  22959. assumed.
  22960. @var{TARGET} specifies the target of the command, usually the name of
  22961. the filter class or a specific filter instance name.
  22962. @var{COMMAND} specifies the name of the command for the target filter.
  22963. @var{ARG} is optional and specifies the optional list of argument for
  22964. the given @var{COMMAND}.
  22965. Between one interval specification and another, whitespaces, or
  22966. sequences of characters starting with @code{#} until the end of line,
  22967. are ignored and can be used to annotate comments.
  22968. A simplified BNF description of the commands specification syntax
  22969. follows:
  22970. @example
  22971. @var{COMMAND_FLAG} ::= "enter" | "leave"
  22972. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  22973. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  22974. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  22975. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  22976. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  22977. @end example
  22978. @subsection Examples
  22979. @itemize
  22980. @item
  22981. Specify audio tempo change at second 4:
  22982. @example
  22983. asendcmd=c='4.0 atempo tempo 1.5',atempo
  22984. @end example
  22985. @item
  22986. Target a specific filter instance:
  22987. @example
  22988. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  22989. @end example
  22990. @item
  22991. Specify a list of drawtext and hue commands in a file.
  22992. @example
  22993. # show text in the interval 5-10
  22994. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  22995. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  22996. # desaturate the image in the interval 15-20
  22997. 15.0-20.0 [enter] hue s 0,
  22998. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  22999. [leave] hue s 1,
  23000. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  23001. # apply an exponential saturation fade-out effect, starting from time 25
  23002. 25 [enter] hue s exp(25-t)
  23003. @end example
  23004. A filtergraph allowing to read and process the above command list
  23005. stored in a file @file{test.cmd}, can be specified with:
  23006. @example
  23007. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  23008. @end example
  23009. @end itemize
  23010. @anchor{setpts}
  23011. @section setpts, asetpts
  23012. Change the PTS (presentation timestamp) of the input frames.
  23013. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  23014. This filter accepts the following options:
  23015. @table @option
  23016. @item expr
  23017. The expression which is evaluated for each frame to construct its timestamp.
  23018. @end table
  23019. The expression is evaluated through the eval API and can contain the following
  23020. constants:
  23021. @table @option
  23022. @item FRAME_RATE, FR
  23023. frame rate, only defined for constant frame-rate video
  23024. @item PTS
  23025. The presentation timestamp in input
  23026. @item N
  23027. The count of the input frame for video or the number of consumed samples,
  23028. not including the current frame for audio, starting from 0.
  23029. @item NB_CONSUMED_SAMPLES
  23030. The number of consumed samples, not including the current frame (only
  23031. audio)
  23032. @item NB_SAMPLES, S
  23033. The number of samples in the current frame (only audio)
  23034. @item SAMPLE_RATE, SR
  23035. The audio sample rate.
  23036. @item STARTPTS
  23037. The PTS of the first frame.
  23038. @item STARTT
  23039. the time in seconds of the first frame
  23040. @item INTERLACED
  23041. State whether the current frame is interlaced.
  23042. @item T
  23043. the time in seconds of the current frame
  23044. @item POS
  23045. original position in the file of the frame, or undefined if undefined
  23046. for the current frame; deprecated, do not use
  23047. @item PREV_INPTS
  23048. The previous input PTS.
  23049. @item PREV_INT
  23050. previous input time in seconds
  23051. @item PREV_OUTPTS
  23052. The previous output PTS.
  23053. @item PREV_OUTT
  23054. previous output time in seconds
  23055. @item RTCTIME
  23056. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  23057. instead.
  23058. @item RTCSTART
  23059. The wallclock (RTC) time at the start of the movie in microseconds.
  23060. @item TB
  23061. The timebase of the input timestamps.
  23062. @item T_CHANGE
  23063. Time of the first frame after command was applied or time of the first frame if no commands.
  23064. @end table
  23065. @subsection Examples
  23066. @itemize
  23067. @item
  23068. Start counting PTS from zero
  23069. @example
  23070. setpts=PTS-STARTPTS
  23071. @end example
  23072. @item
  23073. Apply fast motion effect:
  23074. @example
  23075. setpts=0.5*PTS
  23076. @end example
  23077. @item
  23078. Apply slow motion effect:
  23079. @example
  23080. setpts=2.0*PTS
  23081. @end example
  23082. @item
  23083. Set fixed rate of 25 frames per second:
  23084. @example
  23085. setpts=N/(25*TB)
  23086. @end example
  23087. @item
  23088. Set fixed rate 25 fps with some jitter:
  23089. @example
  23090. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  23091. @end example
  23092. @item
  23093. Apply an offset of 10 seconds to the input PTS:
  23094. @example
  23095. setpts=PTS+10/TB
  23096. @end example
  23097. @item
  23098. Generate timestamps from a "live source" and rebase onto the current timebase:
  23099. @example
  23100. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  23101. @end example
  23102. @item
  23103. Generate timestamps by counting samples:
  23104. @example
  23105. asetpts=N/SR/TB
  23106. @end example
  23107. @end itemize
  23108. @subsection Commands
  23109. Both filters support all above options as @ref{commands}.
  23110. @section setrange
  23111. Force color range for the output video frame.
  23112. The @code{setrange} filter marks the color range property for the
  23113. output frames. It does not change the input frame, but only sets the
  23114. corresponding property, which affects how the frame is treated by
  23115. following filters.
  23116. The filter accepts the following options:
  23117. @table @option
  23118. @item range
  23119. Available values are:
  23120. @table @samp
  23121. @item auto
  23122. Keep the same color range property.
  23123. @item unspecified, unknown
  23124. Set the color range as unspecified.
  23125. @item limited, tv, mpeg
  23126. Set the color range as limited.
  23127. @item full, pc, jpeg
  23128. Set the color range as full.
  23129. @end table
  23130. @end table
  23131. @section settb, asettb
  23132. Set the timebase to use for the output frames timestamps.
  23133. It is mainly useful for testing timebase configuration.
  23134. It accepts the following parameters:
  23135. @table @option
  23136. @item expr, tb
  23137. The expression which is evaluated into the output timebase.
  23138. @end table
  23139. The value for @option{tb} is an arithmetic expression representing a
  23140. rational. The expression can contain the constants "AVTB" (the default
  23141. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  23142. audio only). Default value is "intb".
  23143. @subsection Examples
  23144. @itemize
  23145. @item
  23146. Set the timebase to 1/25:
  23147. @example
  23148. settb=expr=1/25
  23149. @end example
  23150. @item
  23151. Set the timebase to 1/10:
  23152. @example
  23153. settb=expr=0.1
  23154. @end example
  23155. @item
  23156. Set the timebase to 1001/1000:
  23157. @example
  23158. settb=1+0.001
  23159. @end example
  23160. @item
  23161. Set the timebase to 2*intb:
  23162. @example
  23163. settb=2*intb
  23164. @end example
  23165. @item
  23166. Set the default timebase value:
  23167. @example
  23168. settb=AVTB
  23169. @end example
  23170. @end itemize
  23171. @section showcqt
  23172. Convert input audio to a video output representing frequency spectrum
  23173. logarithmically using Brown-Puckette constant Q transform algorithm with
  23174. direct frequency domain coefficient calculation (but the transform itself
  23175. is not really constant Q, instead the Q factor is actually variable/clamped),
  23176. with musical tone scale, from E0 to D#10.
  23177. The filter accepts the following options:
  23178. @table @option
  23179. @item size, s
  23180. Specify the video size for the output. It must be even. For the syntax of this option,
  23181. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23182. Default value is @code{1920x1080}.
  23183. @item fps, rate, r
  23184. Set the output frame rate. Default value is @code{25}.
  23185. @item bar_h
  23186. Set the bargraph height. It must be even. Default value is @code{-1} which
  23187. computes the bargraph height automatically.
  23188. @item axis_h
  23189. Set the axis height. It must be even. Default value is @code{-1} which computes
  23190. the axis height automatically.
  23191. @item sono_h
  23192. Set the sonogram height. It must be even. Default value is @code{-1} which
  23193. computes the sonogram height automatically.
  23194. @item fullhd
  23195. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  23196. instead. Default value is @code{1}.
  23197. @item sono_v, volume
  23198. Specify the sonogram volume expression. It can contain variables:
  23199. @table @option
  23200. @item bar_v
  23201. the @var{bar_v} evaluated expression
  23202. @item frequency, freq, f
  23203. the frequency where it is evaluated
  23204. @item timeclamp, tc
  23205. the value of @var{timeclamp} option
  23206. @end table
  23207. and functions:
  23208. @table @option
  23209. @item a_weighting(f)
  23210. A-weighting of equal loudness
  23211. @item b_weighting(f)
  23212. B-weighting of equal loudness
  23213. @item c_weighting(f)
  23214. C-weighting of equal loudness.
  23215. @end table
  23216. Default value is @code{16}.
  23217. @item bar_v, volume2
  23218. Specify the bargraph volume expression. It can contain variables:
  23219. @table @option
  23220. @item sono_v
  23221. the @var{sono_v} evaluated expression
  23222. @item frequency, freq, f
  23223. the frequency where it is evaluated
  23224. @item timeclamp, tc
  23225. the value of @var{timeclamp} option
  23226. @end table
  23227. and functions:
  23228. @table @option
  23229. @item a_weighting(f)
  23230. A-weighting of equal loudness
  23231. @item b_weighting(f)
  23232. B-weighting of equal loudness
  23233. @item c_weighting(f)
  23234. C-weighting of equal loudness.
  23235. @end table
  23236. Default value is @code{sono_v}.
  23237. @item sono_g, gamma
  23238. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  23239. higher gamma makes the spectrum having more range. Default value is @code{3}.
  23240. Acceptable range is @code{[1, 7]}.
  23241. @item bar_g, gamma2
  23242. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  23243. @code{[1, 7]}.
  23244. @item bar_t
  23245. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  23246. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  23247. @item timeclamp, tc
  23248. Specify the transform timeclamp. At low frequency, there is trade-off between
  23249. accuracy in time domain and frequency domain. If timeclamp is lower,
  23250. event in time domain is represented more accurately (such as fast bass drum),
  23251. otherwise event in frequency domain is represented more accurately
  23252. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  23253. @item attack
  23254. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  23255. limits future samples by applying asymmetric windowing in time domain, useful
  23256. when low latency is required. Accepted range is @code{[0, 1]}.
  23257. @item basefreq
  23258. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  23259. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  23260. @item endfreq
  23261. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  23262. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  23263. @item coeffclamp
  23264. This option is deprecated and ignored.
  23265. @item tlength
  23266. Specify the transform length in time domain. Use this option to control accuracy
  23267. trade-off between time domain and frequency domain at every frequency sample.
  23268. It can contain variables:
  23269. @table @option
  23270. @item frequency, freq, f
  23271. the frequency where it is evaluated
  23272. @item timeclamp, tc
  23273. the value of @var{timeclamp} option.
  23274. @end table
  23275. Default value is @code{384*tc/(384+tc*f)}.
  23276. @item count
  23277. Specify the transform count for every video frame. Default value is @code{6}.
  23278. Acceptable range is @code{[1, 30]}.
  23279. @item fcount
  23280. Specify the transform count for every single pixel. Default value is @code{0},
  23281. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  23282. @item fontfile
  23283. Specify font file for use with freetype to draw the axis. If not specified,
  23284. use embedded font. Note that drawing with font file or embedded font is not
  23285. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  23286. option instead.
  23287. @item font
  23288. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  23289. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  23290. escaping.
  23291. @item fontcolor
  23292. Specify font color expression. This is arithmetic expression that should return
  23293. integer value 0xRRGGBB. It can contain variables:
  23294. @table @option
  23295. @item frequency, freq, f
  23296. the frequency where it is evaluated
  23297. @item timeclamp, tc
  23298. the value of @var{timeclamp} option
  23299. @end table
  23300. and functions:
  23301. @table @option
  23302. @item midi(f)
  23303. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  23304. @item r(x), g(x), b(x)
  23305. red, green, and blue value of intensity x.
  23306. @end table
  23307. Default value is @code{st(0, (midi(f)-59.5)/12);
  23308. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  23309. r(1-ld(1)) + b(ld(1))}.
  23310. @item axisfile
  23311. Specify image file to draw the axis. This option override @var{fontfile} and
  23312. @var{fontcolor} option.
  23313. @item axis, text
  23314. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  23315. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  23316. Default value is @code{1}.
  23317. @item csp
  23318. Set colorspace. The accepted values are:
  23319. @table @samp
  23320. @item unspecified
  23321. Unspecified (default)
  23322. @item bt709
  23323. BT.709
  23324. @item fcc
  23325. FCC
  23326. @item bt470bg
  23327. BT.470BG or BT.601-6 625
  23328. @item smpte170m
  23329. SMPTE-170M or BT.601-6 525
  23330. @item smpte240m
  23331. SMPTE-240M
  23332. @item bt2020ncl
  23333. BT.2020 with non-constant luminance
  23334. @end table
  23335. @item cscheme
  23336. Set spectrogram color scheme. This is list of floating point values with format
  23337. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  23338. The default is @code{1|0.5|0|0|0.5|1}.
  23339. @end table
  23340. @subsection Examples
  23341. @itemize
  23342. @item
  23343. Playing audio while showing the spectrum:
  23344. @example
  23345. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  23346. @end example
  23347. @item
  23348. Same as above, but with frame rate 30 fps:
  23349. @example
  23350. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  23351. @end example
  23352. @item
  23353. Playing at 1280x720:
  23354. @example
  23355. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  23356. @end example
  23357. @item
  23358. Disable sonogram display:
  23359. @example
  23360. sono_h=0
  23361. @end example
  23362. @item
  23363. A1 and its harmonics: A1, A2, (near)E3, A3:
  23364. @example
  23365. 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),
  23366. asplit[a][out1]; [a] showcqt [out0]'
  23367. @end example
  23368. @item
  23369. Same as above, but with more accuracy in frequency domain:
  23370. @example
  23371. 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),
  23372. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  23373. @end example
  23374. @item
  23375. Custom volume:
  23376. @example
  23377. bar_v=10:sono_v=bar_v*a_weighting(f)
  23378. @end example
  23379. @item
  23380. Custom gamma, now spectrum is linear to the amplitude.
  23381. @example
  23382. bar_g=2:sono_g=2
  23383. @end example
  23384. @item
  23385. Custom tlength equation:
  23386. @example
  23387. 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)))'
  23388. @end example
  23389. @item
  23390. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  23391. @example
  23392. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  23393. @end example
  23394. @item
  23395. Custom font using fontconfig:
  23396. @example
  23397. font='Courier New,Monospace,mono|bold'
  23398. @end example
  23399. @item
  23400. Custom frequency range with custom axis using image file:
  23401. @example
  23402. axisfile=myaxis.png:basefreq=40:endfreq=10000
  23403. @end example
  23404. @end itemize
  23405. @section showcwt
  23406. Convert input audio to video output representing frequency spectrum
  23407. using Continuous Wavelet Transform and Morlet wavelet.
  23408. The filter accepts the following options:
  23409. @table @option
  23410. @item size, s
  23411. Specify the video size for the output. For the syntax of this option,
  23412. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23413. Default value is @code{640x512}.
  23414. @item rate, r
  23415. Set the output frame rate. Default value is @code{25}.
  23416. @item scale
  23417. Set the frequency scale used. Allowed values are:
  23418. @table @option
  23419. @item linear
  23420. @item log
  23421. @item bark
  23422. @item mel
  23423. @item erbs
  23424. @item sqrt
  23425. @item cbrt
  23426. @item qdrt
  23427. @end table
  23428. Default value is @code{linear}.
  23429. @item iscale
  23430. Set the intensity scale used. Allowed values are:
  23431. @table @option
  23432. @item linear
  23433. @item log
  23434. @item sqrt
  23435. @item cbrt
  23436. @item qdrt
  23437. @end table
  23438. Default value is @code{log}.
  23439. @item min
  23440. Set the minimum frequency that will be used in output.
  23441. Default is @code{20} Hz.
  23442. @item max
  23443. Set the maximum frequency that will be used in output.
  23444. Default is @code{20000} Hz. The real frequency upper limit
  23445. depends on input audio's sample rate and such will be enforced
  23446. on this value when it is set to value greater than Nyquist frequency.
  23447. @item imin
  23448. Set the minimum intensity that will be used in output.
  23449. @item imax
  23450. Set the maximum intensity that will be used in output.
  23451. @item logb
  23452. Set the logarithmic basis for brightness strength when
  23453. mapping calculated magnitude values to pixel values.
  23454. Allowed range is from @code{0} to @code{1}.
  23455. Default value is @code{0.0001}.
  23456. @item deviation
  23457. Set the frequency deviation.
  23458. Lower values than @code{1} are more frequency oriented,
  23459. while higher values than @code{1} are more time oriented.
  23460. Allowed range is from @code{0} to @code{10}.
  23461. Default value is @code{1}.
  23462. @item pps
  23463. Set the number of pixel output per each second in one row.
  23464. Allowed range is from @code{1} to @code{1024}.
  23465. Default value is @code{64}.
  23466. @item mode
  23467. Set the output visual mode. Allowed values are:
  23468. @table @option
  23469. @item magnitude
  23470. Show magnitude.
  23471. @item phase
  23472. Show only phase.
  23473. @item magphase
  23474. Show combination of magnitude and phase.
  23475. Magnitude is mapped to brightness and phase to color.
  23476. @item channel
  23477. Show unique color per channel magnitude.
  23478. @item stereo
  23479. Show unique color per stereo difference.
  23480. @end table
  23481. Default value is @code{magnitude}.
  23482. @item slide
  23483. Set the output slide method. Allowed values are:
  23484. @table @option
  23485. @item replace
  23486. @item scroll
  23487. @item frame
  23488. @end table
  23489. @item direction
  23490. Set the direction method for output slide method. Allowed values are:
  23491. @table @option
  23492. @item lr
  23493. Direction from left to right.
  23494. @item rl
  23495. Direction from right to left.
  23496. @item ud
  23497. Direction from up to down.
  23498. @item du
  23499. Direction from down to up.
  23500. @end table
  23501. @item bar
  23502. Set the ratio of bargraph display to display size. Default is 0.
  23503. @item rotation
  23504. Set color rotation, must be in [-1.0, 1.0] range.
  23505. Default value is @code{0}.
  23506. @end table
  23507. @section showfreqs
  23508. Convert input audio to video output representing the audio power spectrum.
  23509. Audio amplitude is on Y-axis while frequency is on X-axis.
  23510. The filter accepts the following options:
  23511. @table @option
  23512. @item size, s
  23513. Specify size of video. For the syntax of this option, check the
  23514. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23515. Default is @code{1024x512}.
  23516. @item rate, r
  23517. Set video rate. Default is @code{25}.
  23518. @item mode
  23519. Set display mode.
  23520. This set how each frequency bin will be represented.
  23521. It accepts the following values:
  23522. @table @samp
  23523. @item line
  23524. @item bar
  23525. @item dot
  23526. @end table
  23527. Default is @code{bar}.
  23528. @item ascale
  23529. Set amplitude scale.
  23530. It accepts the following values:
  23531. @table @samp
  23532. @item lin
  23533. Linear scale.
  23534. @item sqrt
  23535. Square root scale.
  23536. @item cbrt
  23537. Cubic root scale.
  23538. @item log
  23539. Logarithmic scale.
  23540. @end table
  23541. Default is @code{log}.
  23542. @item fscale
  23543. Set frequency scale.
  23544. It accepts the following values:
  23545. @table @samp
  23546. @item lin
  23547. Linear scale.
  23548. @item log
  23549. Logarithmic scale.
  23550. @item rlog
  23551. Reverse logarithmic scale.
  23552. @end table
  23553. Default is @code{lin}.
  23554. @item win_size
  23555. Set window size. Allowed range is from 16 to 65536.
  23556. Default is @code{2048}
  23557. @item win_func
  23558. Set windowing function.
  23559. It accepts the following values:
  23560. @table @samp
  23561. @item rect
  23562. @item bartlett
  23563. @item hanning
  23564. @item hamming
  23565. @item blackman
  23566. @item welch
  23567. @item flattop
  23568. @item bharris
  23569. @item bnuttall
  23570. @item bhann
  23571. @item sine
  23572. @item nuttall
  23573. @item lanczos
  23574. @item gauss
  23575. @item tukey
  23576. @item dolph
  23577. @item cauchy
  23578. @item parzen
  23579. @item poisson
  23580. @item bohman
  23581. @item kaiser
  23582. @end table
  23583. Default is @code{hanning}.
  23584. @item overlap
  23585. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  23586. which means optimal overlap for selected window function will be picked.
  23587. @item averaging
  23588. Set time averaging. Setting this to 0 will display current maximal peaks.
  23589. Default is @code{1}, which means time averaging is disabled.
  23590. @item colors
  23591. Specify list of colors separated by space or by '|' which will be used to
  23592. draw channel frequencies. Unrecognized or missing colors will be replaced
  23593. by white color.
  23594. @item cmode
  23595. Set channel display mode.
  23596. It accepts the following values:
  23597. @table @samp
  23598. @item combined
  23599. @item separate
  23600. @end table
  23601. Default is @code{combined}.
  23602. @item minamp
  23603. Set minimum amplitude used in @code{log} amplitude scaler.
  23604. @item data
  23605. Set data display mode.
  23606. It accepts the following values:
  23607. @table @samp
  23608. @item magnitude
  23609. @item phase
  23610. @item delay
  23611. @end table
  23612. Default is @code{magnitude}.
  23613. @item channels
  23614. Set channels to use when processing audio. By default all are processed.
  23615. @end table
  23616. @section showspatial
  23617. Convert stereo input audio to a video output, representing the spatial relationship
  23618. between two channels.
  23619. The filter accepts the following options:
  23620. @table @option
  23621. @item size, s
  23622. Specify the video size for the output. For the syntax of this option, check the
  23623. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23624. Default value is @code{512x512}.
  23625. @item win_size
  23626. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  23627. @item win_func
  23628. Set window function.
  23629. It accepts the following values:
  23630. @table @samp
  23631. @item rect
  23632. @item bartlett
  23633. @item hann
  23634. @item hanning
  23635. @item hamming
  23636. @item blackman
  23637. @item welch
  23638. @item flattop
  23639. @item bharris
  23640. @item bnuttall
  23641. @item bhann
  23642. @item sine
  23643. @item nuttall
  23644. @item lanczos
  23645. @item gauss
  23646. @item tukey
  23647. @item dolph
  23648. @item cauchy
  23649. @item parzen
  23650. @item poisson
  23651. @item bohman
  23652. @item kaiser
  23653. @end table
  23654. Default value is @code{hann}.
  23655. @item rate, r
  23656. Set output framerate.
  23657. @end table
  23658. @anchor{showspectrum}
  23659. @section showspectrum
  23660. Convert input audio to a video output, representing the audio frequency
  23661. spectrum.
  23662. The filter accepts the following options:
  23663. @table @option
  23664. @item size, s
  23665. Specify the video size for the output. For the syntax of this option, check the
  23666. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23667. Default value is @code{640x512}.
  23668. @item slide
  23669. Specify how the spectrum should slide along the window.
  23670. It accepts the following values:
  23671. @table @samp
  23672. @item replace
  23673. the samples start again on the left when they reach the right
  23674. @item scroll
  23675. the samples scroll from right to left
  23676. @item fullframe
  23677. frames are only produced when the samples reach the right
  23678. @item rscroll
  23679. the samples scroll from left to right
  23680. @item lreplace
  23681. the samples start again on the right when they reach the left
  23682. @end table
  23683. Default value is @code{replace}.
  23684. @item mode
  23685. Specify display mode.
  23686. It accepts the following values:
  23687. @table @samp
  23688. @item combined
  23689. all channels are displayed in the same row
  23690. @item separate
  23691. all channels are displayed in separate rows
  23692. @end table
  23693. Default value is @samp{combined}.
  23694. @item color
  23695. Specify display color mode.
  23696. It accepts the following values:
  23697. @table @samp
  23698. @item channel
  23699. each channel is displayed in a separate color
  23700. @item intensity
  23701. each channel is displayed using the same color scheme
  23702. @item rainbow
  23703. each channel is displayed using the rainbow color scheme
  23704. @item moreland
  23705. each channel is displayed using the moreland color scheme
  23706. @item nebulae
  23707. each channel is displayed using the nebulae color scheme
  23708. @item fire
  23709. each channel is displayed using the fire color scheme
  23710. @item fiery
  23711. each channel is displayed using the fiery color scheme
  23712. @item fruit
  23713. each channel is displayed using the fruit color scheme
  23714. @item cool
  23715. each channel is displayed using the cool color scheme
  23716. @item magma
  23717. each channel is displayed using the magma color scheme
  23718. @item green
  23719. each channel is displayed using the green color scheme
  23720. @item viridis
  23721. each channel is displayed using the viridis color scheme
  23722. @item plasma
  23723. each channel is displayed using the plasma color scheme
  23724. @item cividis
  23725. each channel is displayed using the cividis color scheme
  23726. @item terrain
  23727. each channel is displayed using the terrain color scheme
  23728. @end table
  23729. Default value is @samp{channel}.
  23730. @item scale
  23731. Specify scale used for calculating intensity color values.
  23732. It accepts the following values:
  23733. @table @samp
  23734. @item lin
  23735. linear
  23736. @item sqrt
  23737. square root, default
  23738. @item cbrt
  23739. cubic root
  23740. @item log
  23741. logarithmic
  23742. @item 4thrt
  23743. 4th root
  23744. @item 5thrt
  23745. 5th root
  23746. @end table
  23747. Default value is @samp{sqrt}.
  23748. @item fscale
  23749. Specify frequency scale.
  23750. It accepts the following values:
  23751. @table @samp
  23752. @item lin
  23753. linear
  23754. @item log
  23755. logarithmic
  23756. @end table
  23757. Default value is @samp{lin}.
  23758. @item saturation
  23759. Set saturation modifier for displayed colors. Negative values provide
  23760. alternative color scheme. @code{0} is no saturation at all.
  23761. Saturation must be in [-10.0, 10.0] range.
  23762. Default value is @code{1}.
  23763. @item win_func
  23764. Set window function.
  23765. It accepts the following values:
  23766. @table @samp
  23767. @item rect
  23768. @item bartlett
  23769. @item hann
  23770. @item hanning
  23771. @item hamming
  23772. @item blackman
  23773. @item welch
  23774. @item flattop
  23775. @item bharris
  23776. @item bnuttall
  23777. @item bhann
  23778. @item sine
  23779. @item nuttall
  23780. @item lanczos
  23781. @item gauss
  23782. @item tukey
  23783. @item dolph
  23784. @item cauchy
  23785. @item parzen
  23786. @item poisson
  23787. @item bohman
  23788. @item kaiser
  23789. @end table
  23790. Default value is @code{hann}.
  23791. @item orientation
  23792. Set orientation of time vs frequency axis. Can be @code{vertical} or
  23793. @code{horizontal}. Default is @code{vertical}.
  23794. @item overlap
  23795. Set ratio of overlap window. Default value is @code{0}.
  23796. When value is @code{1} overlap is set to recommended size for specific
  23797. window function currently used.
  23798. @item gain
  23799. Set scale gain for calculating intensity color values.
  23800. Default value is @code{1}.
  23801. @item data
  23802. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  23803. or unwrapped phase: @code{uphase}.
  23804. @item rotation
  23805. Set color rotation, must be in [-1.0, 1.0] range.
  23806. Default value is @code{0}.
  23807. @item start
  23808. Set start frequency from which to display spectrogram. Default is @code{0}.
  23809. @item stop
  23810. Set stop frequency to which to display spectrogram. Default is @code{0}.
  23811. @item fps
  23812. Set upper frame rate limit. Default is @code{auto}, unlimited.
  23813. @item legend
  23814. Draw time and frequency axes and legends. Default is disabled.
  23815. @item drange
  23816. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  23817. Allowed range is from 10 to 200.
  23818. @item limit
  23819. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  23820. Allowed range is from -100 to 100.
  23821. @item opacity
  23822. Set opacity strength when using pixel format output with alpha component.
  23823. @end table
  23824. The usage is very similar to the showwaves filter; see the examples in that
  23825. section.
  23826. @subsection Examples
  23827. @itemize
  23828. @item
  23829. Large window with logarithmic color scaling:
  23830. @example
  23831. showspectrum=s=1280x480:scale=log
  23832. @end example
  23833. @item
  23834. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  23835. @example
  23836. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  23837. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  23838. @end example
  23839. @end itemize
  23840. @section showspectrumpic
  23841. Convert input audio to a single video frame, representing the audio frequency
  23842. spectrum.
  23843. The filter accepts the following options:
  23844. @table @option
  23845. @item size, s
  23846. Specify the video size for the output. For the syntax of this option, check the
  23847. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23848. Default value is @code{4096x2048}.
  23849. @item mode
  23850. Specify display mode.
  23851. It accepts the following values:
  23852. @table @samp
  23853. @item combined
  23854. all channels are displayed in the same row
  23855. @item separate
  23856. all channels are displayed in separate rows
  23857. @end table
  23858. Default value is @samp{combined}.
  23859. @item color
  23860. Specify display color mode.
  23861. It accepts the following values:
  23862. @table @samp
  23863. @item channel
  23864. each channel is displayed in a separate color
  23865. @item intensity
  23866. each channel is displayed using the same color scheme
  23867. @item rainbow
  23868. each channel is displayed using the rainbow color scheme
  23869. @item moreland
  23870. each channel is displayed using the moreland color scheme
  23871. @item nebulae
  23872. each channel is displayed using the nebulae color scheme
  23873. @item fire
  23874. each channel is displayed using the fire color scheme
  23875. @item fiery
  23876. each channel is displayed using the fiery color scheme
  23877. @item fruit
  23878. each channel is displayed using the fruit color scheme
  23879. @item cool
  23880. each channel is displayed using the cool color scheme
  23881. @item magma
  23882. each channel is displayed using the magma color scheme
  23883. @item green
  23884. each channel is displayed using the green color scheme
  23885. @item viridis
  23886. each channel is displayed using the viridis color scheme
  23887. @item plasma
  23888. each channel is displayed using the plasma color scheme
  23889. @item cividis
  23890. each channel is displayed using the cividis color scheme
  23891. @item terrain
  23892. each channel is displayed using the terrain color scheme
  23893. @end table
  23894. Default value is @samp{intensity}.
  23895. @item scale
  23896. Specify scale used for calculating intensity color values.
  23897. It accepts the following values:
  23898. @table @samp
  23899. @item lin
  23900. linear
  23901. @item sqrt
  23902. square root, default
  23903. @item cbrt
  23904. cubic root
  23905. @item log
  23906. logarithmic
  23907. @item 4thrt
  23908. 4th root
  23909. @item 5thrt
  23910. 5th root
  23911. @end table
  23912. Default value is @samp{log}.
  23913. @item fscale
  23914. Specify frequency scale.
  23915. It accepts the following values:
  23916. @table @samp
  23917. @item lin
  23918. linear
  23919. @item log
  23920. logarithmic
  23921. @end table
  23922. Default value is @samp{lin}.
  23923. @item saturation
  23924. Set saturation modifier for displayed colors. Negative values provide
  23925. alternative color scheme. @code{0} is no saturation at all.
  23926. Saturation must be in [-10.0, 10.0] range.
  23927. Default value is @code{1}.
  23928. @item win_func
  23929. Set window function.
  23930. It accepts the following values:
  23931. @table @samp
  23932. @item rect
  23933. @item bartlett
  23934. @item hann
  23935. @item hanning
  23936. @item hamming
  23937. @item blackman
  23938. @item welch
  23939. @item flattop
  23940. @item bharris
  23941. @item bnuttall
  23942. @item bhann
  23943. @item sine
  23944. @item nuttall
  23945. @item lanczos
  23946. @item gauss
  23947. @item tukey
  23948. @item dolph
  23949. @item cauchy
  23950. @item parzen
  23951. @item poisson
  23952. @item bohman
  23953. @item kaiser
  23954. @end table
  23955. Default value is @code{hann}.
  23956. @item orientation
  23957. Set orientation of time vs frequency axis. Can be @code{vertical} or
  23958. @code{horizontal}. Default is @code{vertical}.
  23959. @item gain
  23960. Set scale gain for calculating intensity color values.
  23961. Default value is @code{1}.
  23962. @item legend
  23963. Draw time and frequency axes and legends. Default is enabled.
  23964. @item rotation
  23965. Set color rotation, must be in [-1.0, 1.0] range.
  23966. Default value is @code{0}.
  23967. @item start
  23968. Set start frequency from which to display spectrogram. Default is @code{0}.
  23969. @item stop
  23970. Set stop frequency to which to display spectrogram. Default is @code{0}.
  23971. @item drange
  23972. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  23973. Allowed range is from 10 to 200.
  23974. @item limit
  23975. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  23976. Allowed range is from -100 to 100.
  23977. @item opacity
  23978. Set opacity strength when using pixel format output with alpha component.
  23979. @end table
  23980. @subsection Examples
  23981. @itemize
  23982. @item
  23983. Extract an audio spectrogram of a whole audio track
  23984. in a 1024x1024 picture using @command{ffmpeg}:
  23985. @example
  23986. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  23987. @end example
  23988. @end itemize
  23989. @section showvolume
  23990. Convert input audio volume to a video output.
  23991. The filter accepts the following options:
  23992. @table @option
  23993. @item rate, r
  23994. Set video rate.
  23995. @item b
  23996. Set border width, allowed range is [0, 5]. Default is 1.
  23997. @item w
  23998. Set channel width, allowed range is [80, 8192]. Default is 400.
  23999. @item h
  24000. Set channel height, allowed range is [1, 900]. Default is 20.
  24001. @item f
  24002. Set fade, allowed range is [0, 1]. Default is 0.95.
  24003. @item c
  24004. Set volume color expression.
  24005. The expression can use the following variables:
  24006. @table @option
  24007. @item VOLUME
  24008. Current max volume of channel in dB.
  24009. @item PEAK
  24010. Current peak.
  24011. @item CHANNEL
  24012. Current channel number, starting from 0.
  24013. @end table
  24014. @item t
  24015. If set, displays channel names. Default is enabled.
  24016. @item v
  24017. If set, displays volume values. Default is enabled.
  24018. @item o
  24019. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  24020. default is @code{h}.
  24021. @item s
  24022. Set step size, allowed range is [0, 5]. Default is 0, which means
  24023. step is disabled.
  24024. @item p
  24025. Set background opacity, allowed range is [0, 1]. Default is 0.
  24026. @item m
  24027. Set metering mode, can be peak: @code{p} or rms: @code{r},
  24028. default is @code{p}.
  24029. @item ds
  24030. Set display scale, can be linear: @code{lin} or log: @code{log},
  24031. default is @code{lin}.
  24032. @item dm
  24033. In second.
  24034. If set to > 0., display a line for the max level
  24035. in the previous seconds.
  24036. default is disabled: @code{0.}
  24037. @item dmc
  24038. The color of the max line. Use when @code{dm} option is set to > 0.
  24039. default is: @code{orange}
  24040. @end table
  24041. @section showwaves
  24042. Convert input audio to a video output, representing the samples waves.
  24043. The filter accepts the following options:
  24044. @table @option
  24045. @item size, s
  24046. Specify the video size for the output. For the syntax of this option, check the
  24047. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24048. Default value is @code{600x240}.
  24049. @item mode
  24050. Set display mode.
  24051. Available values are:
  24052. @table @samp
  24053. @item point
  24054. Draw a point for each sample.
  24055. @item line
  24056. Draw a vertical line for each sample.
  24057. @item p2p
  24058. Draw a point for each sample and a line between them.
  24059. @item cline
  24060. Draw a centered vertical line for each sample.
  24061. @end table
  24062. Default value is @code{point}.
  24063. @item n
  24064. Set the number of samples which are printed on the same column. A
  24065. larger value will decrease the frame rate. Must be a positive
  24066. integer. This option can be set only if the value for @var{rate}
  24067. is not explicitly specified.
  24068. @item rate, r
  24069. Set the (approximate) output frame rate. This is done by setting the
  24070. option @var{n}. Default value is "25".
  24071. @item split_channels
  24072. Set if channels should be drawn separately or overlap. Default value is 0.
  24073. @item colors
  24074. Set colors separated by '|' which are going to be used for drawing of each channel.
  24075. @item scale
  24076. Set amplitude scale.
  24077. Available values are:
  24078. @table @samp
  24079. @item lin
  24080. Linear.
  24081. @item log
  24082. Logarithmic.
  24083. @item sqrt
  24084. Square root.
  24085. @item cbrt
  24086. Cubic root.
  24087. @end table
  24088. Default is linear.
  24089. @item draw
  24090. Set the draw mode. This is mostly useful to set for high @var{n}.
  24091. Available values are:
  24092. @table @samp
  24093. @item scale
  24094. Scale pixel values for each drawn sample.
  24095. @item full
  24096. Draw every sample directly.
  24097. @end table
  24098. Default value is @code{scale}.
  24099. @end table
  24100. @subsection Examples
  24101. @itemize
  24102. @item
  24103. Output the input file audio and the corresponding video representation
  24104. at the same time:
  24105. @example
  24106. amovie=a.mp3,asplit[out0],showwaves[out1]
  24107. @end example
  24108. @item
  24109. Create a synthetic signal and show it with showwaves, forcing a
  24110. frame rate of 30 frames per second:
  24111. @example
  24112. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  24113. @end example
  24114. @end itemize
  24115. @section showwavespic
  24116. Convert input audio to a single video frame, representing the samples waves.
  24117. The filter accepts the following options:
  24118. @table @option
  24119. @item size, s
  24120. Specify the video size for the output. For the syntax of this option, check the
  24121. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24122. Default value is @code{600x240}.
  24123. @item split_channels
  24124. Set if channels should be drawn separately or overlap. Default value is 0.
  24125. @item colors
  24126. Set colors separated by '|' which are going to be used for drawing of each channel.
  24127. @item scale
  24128. Set amplitude scale.
  24129. Available values are:
  24130. @table @samp
  24131. @item lin
  24132. Linear.
  24133. @item log
  24134. Logarithmic.
  24135. @item sqrt
  24136. Square root.
  24137. @item cbrt
  24138. Cubic root.
  24139. @end table
  24140. Default is linear.
  24141. @item draw
  24142. Set the draw mode.
  24143. Available values are:
  24144. @table @samp
  24145. @item scale
  24146. Scale pixel values for each drawn sample.
  24147. @item full
  24148. Draw every sample directly.
  24149. @end table
  24150. Default value is @code{scale}.
  24151. @item filter
  24152. Set the filter mode.
  24153. Available values are:
  24154. @table @samp
  24155. @item average
  24156. Use average samples values for each drawn sample.
  24157. @item peak
  24158. Use peak samples values for each drawn sample.
  24159. @end table
  24160. Default value is @code{average}.
  24161. @end table
  24162. @subsection Examples
  24163. @itemize
  24164. @item
  24165. Extract a channel split representation of the wave form of a whole audio track
  24166. in a 1024x800 picture using @command{ffmpeg}:
  24167. @example
  24168. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  24169. @end example
  24170. @end itemize
  24171. @section sidedata, asidedata
  24172. Delete frame side data, or select frames based on it.
  24173. This filter accepts the following options:
  24174. @table @option
  24175. @item mode
  24176. Set mode of operation of the filter.
  24177. Can be one of the following:
  24178. @table @samp
  24179. @item select
  24180. Select every frame with side data of @code{type}.
  24181. @item delete
  24182. Delete side data of @code{type}. If @code{type} is not set, delete all side
  24183. data in the frame.
  24184. @end table
  24185. @item type
  24186. Set side data type used with all modes. Must be set for @code{select} mode. For
  24187. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  24188. in @file{libavutil/frame.h}. For example, to choose
  24189. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  24190. @end table
  24191. @section spectrumsynth
  24192. Synthesize audio from 2 input video spectrums, first input stream represents
  24193. magnitude across time and second represents phase across time.
  24194. The filter will transform from frequency domain as displayed in videos back
  24195. to time domain as presented in audio output.
  24196. This filter is primarily created for reversing processed @ref{showspectrum}
  24197. filter outputs, but can synthesize sound from other spectrograms too.
  24198. But in such case results are going to be poor if the phase data is not
  24199. available, because in such cases phase data need to be recreated, usually
  24200. it's just recreated from random noise.
  24201. For best results use gray only output (@code{channel} color mode in
  24202. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  24203. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  24204. @code{data} option. Inputs videos should generally use @code{fullframe}
  24205. slide mode as that saves resources needed for decoding video.
  24206. The filter accepts the following options:
  24207. @table @option
  24208. @item sample_rate
  24209. Specify sample rate of output audio, the sample rate of audio from which
  24210. spectrum was generated may differ.
  24211. @item channels
  24212. Set number of channels represented in input video spectrums.
  24213. @item scale
  24214. Set scale which was used when generating magnitude input spectrum.
  24215. Can be @code{lin} or @code{log}. Default is @code{log}.
  24216. @item slide
  24217. Set slide which was used when generating inputs spectrums.
  24218. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  24219. Default is @code{fullframe}.
  24220. @item win_func
  24221. Set window function used for resynthesis.
  24222. @item overlap
  24223. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  24224. which means optimal overlap for selected window function will be picked.
  24225. @item orientation
  24226. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  24227. Default is @code{vertical}.
  24228. @end table
  24229. @subsection Examples
  24230. @itemize
  24231. @item
  24232. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  24233. then resynthesize videos back to audio with spectrumsynth:
  24234. @example
  24235. 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
  24236. 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
  24237. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  24238. @end example
  24239. @end itemize
  24240. @section split, asplit
  24241. Split input into several identical outputs.
  24242. @code{asplit} works with audio input, @code{split} with video.
  24243. The filter accepts a single parameter which specifies the number of outputs. If
  24244. unspecified, it defaults to 2.
  24245. @subsection Examples
  24246. @itemize
  24247. @item
  24248. Create two separate outputs from the same input:
  24249. @example
  24250. [in] split [out0][out1]
  24251. @end example
  24252. @item
  24253. To create 3 or more outputs, you need to specify the number of
  24254. outputs, like in:
  24255. @example
  24256. [in] asplit=3 [out0][out1][out2]
  24257. @end example
  24258. @item
  24259. Create two separate outputs from the same input, one cropped and
  24260. one padded:
  24261. @example
  24262. [in] split [splitout1][splitout2];
  24263. [splitout1] crop=100:100:0:0 [cropout];
  24264. [splitout2] pad=200:200:100:100 [padout];
  24265. @end example
  24266. @item
  24267. Create 5 copies of the input audio with @command{ffmpeg}:
  24268. @example
  24269. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  24270. @end example
  24271. @end itemize
  24272. @section zmq, azmq
  24273. Receive commands sent through a libzmq client, and forward them to
  24274. filters in the filtergraph.
  24275. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  24276. must be inserted between two video filters, @code{azmq} between two
  24277. audio filters. Both are capable to send messages to any filter type.
  24278. To enable these filters you need to install the libzmq library and
  24279. headers and configure FFmpeg with @code{--enable-libzmq}.
  24280. For more information about libzmq see:
  24281. @url{http://www.zeromq.org/}
  24282. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  24283. receives messages sent through a network interface defined by the
  24284. @option{bind_address} (or the abbreviation "@option{b}") option.
  24285. Default value of this option is @file{tcp://localhost:5555}. You may
  24286. want to alter this value to your needs, but do not forget to escape any
  24287. ':' signs (see @ref{filtergraph escaping}).
  24288. The received message must be in the form:
  24289. @example
  24290. @var{TARGET} @var{COMMAND} [@var{ARG}]
  24291. @end example
  24292. @var{TARGET} specifies the target of the command, usually the name of
  24293. the filter class or a specific filter instance name. The default
  24294. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  24295. but you can override this by using the @samp{filter_name@@id} syntax
  24296. (see @ref{Filtergraph syntax}).
  24297. @var{COMMAND} specifies the name of the command for the target filter.
  24298. @var{ARG} is optional and specifies the optional argument list for the
  24299. given @var{COMMAND}.
  24300. Upon reception, the message is processed and the corresponding command
  24301. is injected into the filtergraph. Depending on the result, the filter
  24302. will send a reply to the client, adopting the format:
  24303. @example
  24304. @var{ERROR_CODE} @var{ERROR_REASON}
  24305. @var{MESSAGE}
  24306. @end example
  24307. @var{MESSAGE} is optional.
  24308. @subsection Examples
  24309. Look at @file{tools/zmqsend} for an example of a zmq client which can
  24310. be used to send commands processed by these filters.
  24311. Consider the following filtergraph generated by @command{ffplay}.
  24312. In this example the last overlay filter has an instance name. All other
  24313. filters will have default instance names.
  24314. @example
  24315. ffplay -dumpgraph 1 -f lavfi "
  24316. color=s=100x100:c=red [l];
  24317. color=s=100x100:c=blue [r];
  24318. nullsrc=s=200x100, zmq [bg];
  24319. [bg][l] overlay [bg+l];
  24320. [bg+l][r] overlay@@my=x=100 "
  24321. @end example
  24322. To change the color of the left side of the video, the following
  24323. command can be used:
  24324. @example
  24325. echo Parsed_color_0 c yellow | tools/zmqsend
  24326. @end example
  24327. To change the right side:
  24328. @example
  24329. echo Parsed_color_1 c pink | tools/zmqsend
  24330. @end example
  24331. To change the position of the right side:
  24332. @example
  24333. echo overlay@@my x 150 | tools/zmqsend
  24334. @end example
  24335. @c man end MULTIMEDIA FILTERS
  24336. @chapter Multimedia Sources
  24337. @c man begin MULTIMEDIA SOURCES
  24338. Below is a description of the currently available multimedia sources.
  24339. @section amovie
  24340. This is the same as @ref{movie} source, except it selects an audio
  24341. stream by default.
  24342. @section avsynctest
  24343. Generate an Audio/Video Sync Test.
  24344. Generated stream periodically shows flash video frame and emits beep in audio.
  24345. Useful to inspect A/V sync issues.
  24346. It accepts the following options:
  24347. @table @option
  24348. @item size, s
  24349. Set output video size. Default value is @code{hd720}.
  24350. @item framerate, fr
  24351. Set output video frame rate. Default value is @code{30}.
  24352. @item samplerate, sr
  24353. Set output audio sample rate. Default value is @code{44100}.
  24354. @item amplitude, a
  24355. Set output audio beep amplitude. Default value is @code{0.7}.
  24356. @item period, p
  24357. Set output audio beep period in seconds. Default value is @code{3}.
  24358. @item delay, dl
  24359. Set output video flash delay in number of frames. Default value is @code{0}.
  24360. @item cycle, c
  24361. Enable cycling of video delays, by default is disabled.
  24362. @item duration, d
  24363. Set stream output duration. By default duration is unlimited.
  24364. @item fg, bg, ag
  24365. Set foreground/background/additional color.
  24366. @end table
  24367. @subsection Commands
  24368. This source supports the some above options as @ref{commands}.
  24369. @anchor{movie}
  24370. @section movie
  24371. Read audio and/or video stream(s) from a movie container.
  24372. It accepts the following parameters:
  24373. @table @option
  24374. @item filename
  24375. The name of the resource to read (not necessarily a file; it can also be a
  24376. device or a stream accessed through some protocol).
  24377. @item format_name, f
  24378. Specifies the format assumed for the movie to read, and can be either
  24379. the name of a container or an input device. If not specified, the
  24380. format is guessed from @var{movie_name} or by probing.
  24381. @item seek_point, sp
  24382. Specifies the seek point in seconds. The frames will be output
  24383. starting from this seek point. The parameter is evaluated with
  24384. @code{av_strtod}, so the numerical value may be suffixed by an IS
  24385. postfix. The default value is "0".
  24386. @item streams, s
  24387. Specifies the streams to read. Several streams can be specified,
  24388. separated by "+". The source will then have as many outputs, in the
  24389. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  24390. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  24391. respectively the default (best suited) video and audio stream. Default
  24392. is "dv", or "da" if the filter is called as "amovie".
  24393. @item stream_index, si
  24394. Specifies the index of the video stream to read. If the value is -1,
  24395. the most suitable video stream will be automatically selected. The default
  24396. value is "-1". Deprecated. If the filter is called "amovie", it will select
  24397. audio instead of video.
  24398. @item loop
  24399. Specifies how many times to read the stream in sequence.
  24400. If the value is 0, the stream will be looped infinitely.
  24401. Default value is "1".
  24402. Note that when the movie is looped the source timestamps are not
  24403. changed, so it will generate non monotonically increasing timestamps.
  24404. @item discontinuity
  24405. Specifies the time difference between frames above which the point is
  24406. considered a timestamp discontinuity which is removed by adjusting the later
  24407. timestamps.
  24408. @item dec_threads
  24409. Specifies the number of threads for decoding
  24410. @item format_opts
  24411. Specify format options for the opened file. Format options can be specified
  24412. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  24413. shows how to add protocol_whitelist and protocol_blacklist options:
  24414. @example
  24415. ffplay -f lavfi
  24416. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  24417. @end example
  24418. @end table
  24419. It allows overlaying a second video on top of the main input of
  24420. a filtergraph, as shown in this graph:
  24421. @example
  24422. input -----------> deltapts0 --> overlay --> output
  24423. ^
  24424. |
  24425. movie --> scale--> deltapts1 -------+
  24426. @end example
  24427. @subsection Examples
  24428. @itemize
  24429. @item
  24430. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  24431. on top of the input labelled "in":
  24432. @example
  24433. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  24434. [in] setpts=PTS-STARTPTS [main];
  24435. [main][over] overlay=16:16 [out]
  24436. @end example
  24437. @item
  24438. Read from a video4linux2 device, and overlay it on top of the input
  24439. labelled "in":
  24440. @example
  24441. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  24442. [in] setpts=PTS-STARTPTS [main];
  24443. [main][over] overlay=16:16 [out]
  24444. @end example
  24445. @item
  24446. Read the first video stream and the audio stream with id 0x81 from
  24447. dvd.vob; the video is connected to the pad named "video" and the audio is
  24448. connected to the pad named "audio":
  24449. @example
  24450. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  24451. @end example
  24452. @end itemize
  24453. @subsection Commands
  24454. Both movie and amovie support the following commands:
  24455. @table @option
  24456. @item seek
  24457. Perform seek using "av_seek_frame".
  24458. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  24459. @itemize
  24460. @item
  24461. @var{stream_index}: If stream_index is -1, a default
  24462. stream is selected, and @var{timestamp} is automatically converted
  24463. from AV_TIME_BASE units to the stream specific time_base.
  24464. @item
  24465. @var{timestamp}: Timestamp in AVStream.time_base units
  24466. or, if no stream is specified, in AV_TIME_BASE units.
  24467. @item
  24468. @var{flags}: Flags which select direction and seeking mode.
  24469. @end itemize
  24470. @item get_duration
  24471. Get movie duration in AV_TIME_BASE units.
  24472. @end table
  24473. @c man end MULTIMEDIA SOURCES