filters.texi 812 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order for each band split. This controls filter roll-off or steepness
  413. of filter transfer function.
  414. Available values are:
  415. @table @samp
  416. @item 2nd
  417. 12 dB per octave.
  418. @item 4th
  419. 24 dB per octave.
  420. @item 6th
  421. 36 dB per octave.
  422. @item 8th
  423. 48 dB per octave.
  424. @item 10th
  425. 60 dB per octave.
  426. @item 12th
  427. 72 dB per octave.
  428. @item 14th
  429. 84 dB per octave.
  430. @item 16th
  431. 96 dB per octave.
  432. @item 18th
  433. 108 dB per octave.
  434. @item 20th
  435. 120 dB per octave.
  436. @end table
  437. Default is @var{4th}.
  438. @item level
  439. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  440. @item gains
  441. Set output gain for each band. Default value is 1 for all bands.
  442. @item precision
  443. Set which precision to use when processing samples.
  444. @table @option
  445. @item auto
  446. Auto pick internal sample format depending on other filters.
  447. @item float
  448. Always use single-floating point precision sample format.
  449. @item double
  450. Always use double-floating point precision sample format.
  451. @end table
  452. Default value is @code{auto}.
  453. @end table
  454. @subsection Examples
  455. @itemize
  456. @item
  457. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  458. each band will be in separate stream:
  459. @example
  460. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  461. @end example
  462. @item
  463. Same as above, but with higher filter order:
  464. @example
  465. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  466. @end example
  467. @item
  468. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  469. @example
  470. 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
  471. @end example
  472. @end itemize
  473. @section acrusher
  474. Reduce audio bit resolution.
  475. This filter is bit crusher with enhanced functionality. A bit crusher
  476. is used to audibly reduce number of bits an audio signal is sampled
  477. with. This doesn't change the bit depth at all, it just produces the
  478. effect. Material reduced in bit depth sounds more harsh and "digital".
  479. This filter is able to even round to continuous values instead of discrete
  480. bit depths.
  481. Additionally it has a D/C offset which results in different crushing of
  482. the lower and the upper half of the signal.
  483. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  484. Another feature of this filter is the logarithmic mode.
  485. This setting switches from linear distances between bits to logarithmic ones.
  486. The result is a much more "natural" sounding crusher which doesn't gate low
  487. signals for example. The human ear has a logarithmic perception,
  488. so this kind of crushing is much more pleasant.
  489. Logarithmic crushing is also able to get anti-aliased.
  490. The filter accepts the following options:
  491. @table @option
  492. @item level_in
  493. Set level in.
  494. @item level_out
  495. Set level out.
  496. @item bits
  497. Set bit reduction.
  498. @item mix
  499. Set mixing amount.
  500. @item mode
  501. Can be linear: @code{lin} or logarithmic: @code{log}.
  502. @item dc
  503. Set DC.
  504. @item aa
  505. Set anti-aliasing.
  506. @item samples
  507. Set sample reduction.
  508. @item lfo
  509. Enable LFO. By default disabled.
  510. @item lforange
  511. Set LFO range.
  512. @item lforate
  513. Set LFO rate.
  514. @end table
  515. @subsection Commands
  516. This filter supports the all above options as @ref{commands}.
  517. @section acue
  518. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  519. filter.
  520. @section adeclick
  521. Remove impulsive noise from input audio.
  522. Samples detected as impulsive noise are replaced by interpolated samples using
  523. autoregressive modelling.
  524. @table @option
  525. @item window, w
  526. Set window size, in milliseconds. Allowed range is from @code{10} to
  527. @code{100}. Default value is @code{55} milliseconds.
  528. This sets size of window which will be processed at once.
  529. @item overlap, o
  530. Set window overlap, in percentage of window size. Allowed range is from
  531. @code{50} to @code{95}. Default value is @code{75} percent.
  532. Setting this to a very high value increases impulsive noise removal but makes
  533. whole process much slower.
  534. @item arorder, a
  535. Set autoregression order, in percentage of window size. Allowed range is from
  536. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  537. controls quality of interpolated samples using neighbour good samples.
  538. @item threshold, t
  539. Set threshold value. Allowed range is from @code{1} to @code{100}.
  540. Default value is @code{2}.
  541. This controls the strength of impulsive noise which is going to be removed.
  542. The lower value, the more samples will be detected as impulsive noise.
  543. @item burst, b
  544. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  545. @code{10}. Default value is @code{2}.
  546. If any two samples detected as noise are spaced less than this value then any
  547. sample between those two samples will be also detected as noise.
  548. @item method, m
  549. Set overlap method.
  550. It accepts the following values:
  551. @table @option
  552. @item add, a
  553. Select overlap-add method. Even not interpolated samples are slightly
  554. changed with this method.
  555. @item save, s
  556. Select overlap-save method. Not interpolated samples remain unchanged.
  557. @end table
  558. Default value is @code{a}.
  559. @end table
  560. @section adeclip
  561. Remove clipped samples from input audio.
  562. Samples detected as clipped are replaced by interpolated samples using
  563. autoregressive modelling.
  564. @table @option
  565. @item window, w
  566. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  567. Default value is @code{55} milliseconds.
  568. This sets size of window which will be processed at once.
  569. @item overlap, o
  570. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  571. to @code{95}. Default value is @code{75} percent.
  572. @item arorder, a
  573. Set autoregression order, in percentage of window size. Allowed range is from
  574. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  575. quality of interpolated samples using neighbour good samples.
  576. @item threshold, t
  577. Set threshold value. Allowed range is from @code{1} to @code{100}.
  578. Default value is @code{10}. Higher values make clip detection less aggressive.
  579. @item hsize, n
  580. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  581. Default value is @code{1000}. Higher values make clip detection less aggressive.
  582. @item method, m
  583. Set overlap method.
  584. It accepts the following values:
  585. @table @option
  586. @item add, a
  587. Select overlap-add method. Even not interpolated samples are slightly changed
  588. with this method.
  589. @item save, s
  590. Select overlap-save method. Not interpolated samples remain unchanged.
  591. @end table
  592. Default value is @code{a}.
  593. @end table
  594. @section adecorrelate
  595. Apply decorrelation to input audio stream.
  596. The filter accepts the following options:
  597. @table @option
  598. @item stages
  599. Set decorrelation stages of filtering. Allowed
  600. range is from 1 to 16. Default value is 6.
  601. @item seed
  602. Set random seed used for setting delay in samples across channels.
  603. @end table
  604. @section adelay
  605. Delay one or more audio channels.
  606. Samples in delayed channel are filled with silence.
  607. The filter accepts the following option:
  608. @table @option
  609. @item delays
  610. Set list of delays in milliseconds for each channel separated by '|'.
  611. Unused delays will be silently ignored. If number of given delays is
  612. smaller than number of channels all remaining channels will not be delayed.
  613. If you want to delay exact number of samples, append 'S' to number.
  614. If you want instead to delay in seconds, append 's' to number.
  615. @item all
  616. Use last set delay for all remaining channels. By default is disabled.
  617. This option if enabled changes how option @code{delays} is interpreted.
  618. @end table
  619. @subsection Examples
  620. @itemize
  621. @item
  622. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  623. the second channel (and any other channels that may be present) unchanged.
  624. @example
  625. adelay=1500|0|500
  626. @end example
  627. @item
  628. Delay second channel by 500 samples, the third channel by 700 samples and leave
  629. the first channel (and any other channels that may be present) unchanged.
  630. @example
  631. adelay=0|500S|700S
  632. @end example
  633. @item
  634. Delay all channels by same number of samples:
  635. @example
  636. adelay=delays=64S:all=1
  637. @end example
  638. @end itemize
  639. @section adenorm
  640. Remedy denormals in audio by adding extremely low-level noise.
  641. This filter shall be placed before any filter that can produce denormals.
  642. A description of the accepted parameters follows.
  643. @table @option
  644. @item level
  645. Set level of added noise in dB. Default is @code{-351}.
  646. Allowed range is from -451 to -90.
  647. @item type
  648. Set type of added noise.
  649. @table @option
  650. @item dc
  651. Add DC signal.
  652. @item ac
  653. Add AC signal.
  654. @item square
  655. Add square signal.
  656. @item pulse
  657. Add pulse signal.
  658. @end table
  659. Default is @code{dc}.
  660. @end table
  661. @subsection Commands
  662. This filter supports the all above options as @ref{commands}.
  663. @section aderivative, aintegral
  664. Compute derivative/integral of audio stream.
  665. Applying both filters one after another produces original audio.
  666. @section adynamicequalizer
  667. Apply dynamic equalization to input audio stream.
  668. A description of the accepted options follows.
  669. @table @option
  670. @item threshold
  671. Set the detection threshold used to trigger equalization.
  672. Threshold detection is using bandpass filter.
  673. Default value is 0. Allowed range is from 0 to 100.
  674. @item dfrequency
  675. Set the detection frequency in Hz used for bandpass filter used to trigger equalization.
  676. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  677. @item dqfactor
  678. Set the detection resonance factor for bandpass filter used to trigger equalization.
  679. Default value is 1. Allowed range is from 0.001 to 1000.
  680. @item tfrequency
  681. Set the target frequency of equalization filter.
  682. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  683. @item tqfactor
  684. Set the target resonance factor for target equalization filter.
  685. Default value is 1. Allowed range is from 0.001 to 1000.
  686. @item attack
  687. Set the amount of milliseconds the signal from detection has to rise above
  688. the detection threshold before equalization starts.
  689. Default is 20. Allowed range is between 1 and 2000.
  690. @item release
  691. Set the amount of milliseconds the signal from detection has to fall below the
  692. detection threshold before equalization ends.
  693. Default is 200. Allowed range is between 1 and 2000.
  694. @item ratio
  695. Set the ratio by which the equalization gain is raised.
  696. Default is 1. Allowed range is between 0 and 30.
  697. @item makeup
  698. Set the makeup offset by which the equalization gain is raised.
  699. Default is 0. Allowed range is between 0 and 100.
  700. @item range
  701. Set the max allowed cut/boost amount. Default is 50.
  702. Allowed range is from 1 to 200.
  703. @item mode
  704. Set the mode of filter operation, can be one of the following:
  705. @table @samp
  706. @item listen
  707. Output only isolated bandpass signal.
  708. @item cut
  709. Cut frequencies above detection threshold.
  710. @item boost
  711. Boost frequencies bellow detection threshold.
  712. @end table
  713. Default mode is @samp{cut}.
  714. @item tftype
  715. Set the type of target filter, can be one of the following:
  716. @table @samp
  717. @item bell
  718. @item lowshelf
  719. @item highshelf
  720. @end table
  721. Default type is @samp{bell}.
  722. @item direction
  723. Set processing direction relative to threshold.
  724. @table @samp
  725. @item downward
  726. Boost or cut if threshhold is higher than detected volume.
  727. @item upward
  728. Boost or cut if threshhold is lower than detected volume.
  729. @end table
  730. Default direction is @samp{downward}.
  731. @end table
  732. @subsection Commands
  733. This filter supports the all above options as @ref{commands}.
  734. @section adynamicsmooth
  735. Apply dynamic smoothing to input audio stream.
  736. A description of the accepted options follows.
  737. @table @option
  738. @item sensitivity
  739. Set an amount of sensitivity to frequency fluctations. Default is 2.
  740. Allowed range is from 0 to 1e+06.
  741. @item basefreq
  742. Set a base frequency for smoothing. Default value is 22050.
  743. Allowed range is from 2 to 1e+06.
  744. @end table
  745. @subsection Commands
  746. This filter supports the all above options as @ref{commands}.
  747. @section aecho
  748. Apply echoing to the input audio.
  749. Echoes are reflected sound and can occur naturally amongst mountains
  750. (and sometimes large buildings) when talking or shouting; digital echo
  751. effects emulate this behaviour and are often used to help fill out the
  752. sound of a single instrument or vocal. The time difference between the
  753. original signal and the reflection is the @code{delay}, and the
  754. loudness of the reflected signal is the @code{decay}.
  755. Multiple echoes can have different delays and decays.
  756. A description of the accepted parameters follows.
  757. @table @option
  758. @item in_gain
  759. Set input gain of reflected signal. Default is @code{0.6}.
  760. @item out_gain
  761. Set output gain of reflected signal. Default is @code{0.3}.
  762. @item delays
  763. Set list of time intervals in milliseconds between original signal and reflections
  764. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  765. Default is @code{1000}.
  766. @item decays
  767. Set list of loudness of reflected signals separated by '|'.
  768. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  769. Default is @code{0.5}.
  770. @end table
  771. @subsection Examples
  772. @itemize
  773. @item
  774. Make it sound as if there are twice as many instruments as are actually playing:
  775. @example
  776. aecho=0.8:0.88:60:0.4
  777. @end example
  778. @item
  779. If delay is very short, then it sounds like a (metallic) robot playing music:
  780. @example
  781. aecho=0.8:0.88:6:0.4
  782. @end example
  783. @item
  784. A longer delay will sound like an open air concert in the mountains:
  785. @example
  786. aecho=0.8:0.9:1000:0.3
  787. @end example
  788. @item
  789. Same as above but with one more mountain:
  790. @example
  791. aecho=0.8:0.9:1000|1800:0.3|0.25
  792. @end example
  793. @end itemize
  794. @section aemphasis
  795. Audio emphasis filter creates or restores material directly taken from LPs or
  796. emphased CDs with different filter curves. E.g. to store music on vinyl the
  797. signal has to be altered by a filter first to even out the disadvantages of
  798. this recording medium.
  799. Once the material is played back the inverse filter has to be applied to
  800. restore the distortion of the frequency response.
  801. The filter accepts the following options:
  802. @table @option
  803. @item level_in
  804. Set input gain.
  805. @item level_out
  806. Set output gain.
  807. @item mode
  808. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  809. use @code{production} mode. Default is @code{reproduction} mode.
  810. @item type
  811. Set filter type. Selects medium. Can be one of the following:
  812. @table @option
  813. @item col
  814. select Columbia.
  815. @item emi
  816. select EMI.
  817. @item bsi
  818. select BSI (78RPM).
  819. @item riaa
  820. select RIAA.
  821. @item cd
  822. select Compact Disc (CD).
  823. @item 50fm
  824. select 50µs (FM).
  825. @item 75fm
  826. select 75µs (FM).
  827. @item 50kf
  828. select 50µs (FM-KF).
  829. @item 75kf
  830. select 75µs (FM-KF).
  831. @end table
  832. @end table
  833. @subsection Commands
  834. This filter supports the all above options as @ref{commands}.
  835. @section aeval
  836. Modify an audio signal according to the specified expressions.
  837. This filter accepts one or more expressions (one for each channel),
  838. which are evaluated and used to modify a corresponding audio signal.
  839. It accepts the following parameters:
  840. @table @option
  841. @item exprs
  842. Set the '|'-separated expressions list for each separate channel. If
  843. the number of input channels is greater than the number of
  844. expressions, the last specified expression is used for the remaining
  845. output channels.
  846. @item channel_layout, c
  847. Set output channel layout. If not specified, the channel layout is
  848. specified by the number of expressions. If set to @samp{same}, it will
  849. use by default the same input channel layout.
  850. @end table
  851. Each expression in @var{exprs} can contain the following constants and functions:
  852. @table @option
  853. @item ch
  854. channel number of the current expression
  855. @item n
  856. number of the evaluated sample, starting from 0
  857. @item s
  858. sample rate
  859. @item t
  860. time of the evaluated sample expressed in seconds
  861. @item nb_in_channels
  862. @item nb_out_channels
  863. input and output number of channels
  864. @item val(CH)
  865. the value of input channel with number @var{CH}
  866. @end table
  867. Note: this filter is slow. For faster processing you should use a
  868. dedicated filter.
  869. @subsection Examples
  870. @itemize
  871. @item
  872. Half volume:
  873. @example
  874. aeval=val(ch)/2:c=same
  875. @end example
  876. @item
  877. Invert phase of the second channel:
  878. @example
  879. aeval=val(0)|-val(1)
  880. @end example
  881. @end itemize
  882. @section aexciter
  883. An exciter is used to produce high sound that is not present in the
  884. original signal. This is done by creating harmonic distortions of the
  885. signal which are restricted in range and added to the original signal.
  886. An Exciter raises the upper end of an audio signal without simply raising
  887. the higher frequencies like an equalizer would do to create a more
  888. "crisp" or "brilliant" sound.
  889. The filter accepts the following options:
  890. @table @option
  891. @item level_in
  892. Set input level prior processing of signal.
  893. Allowed range is from 0 to 64.
  894. Default value is 1.
  895. @item level_out
  896. Set output level after processing of signal.
  897. Allowed range is from 0 to 64.
  898. Default value is 1.
  899. @item amount
  900. Set the amount of harmonics added to original signal.
  901. Allowed range is from 0 to 64.
  902. Default value is 1.
  903. @item drive
  904. Set the amount of newly created harmonics.
  905. Allowed range is from 0.1 to 10.
  906. Default value is 8.5.
  907. @item blend
  908. Set the octave of newly created harmonics.
  909. Allowed range is from -10 to 10.
  910. Default value is 0.
  911. @item freq
  912. Set the lower frequency limit of producing harmonics in Hz.
  913. Allowed range is from 2000 to 12000 Hz.
  914. Default is 7500 Hz.
  915. @item ceil
  916. Set the upper frequency limit of producing harmonics.
  917. Allowed range is from 9999 to 20000 Hz.
  918. If value is lower than 10000 Hz no limit is applied.
  919. @item listen
  920. Mute the original signal and output only added harmonics.
  921. By default is disabled.
  922. @end table
  923. @subsection Commands
  924. This filter supports the all above options as @ref{commands}.
  925. @anchor{afade}
  926. @section afade
  927. Apply fade-in/out effect to input audio.
  928. A description of the accepted parameters follows.
  929. @table @option
  930. @item type, t
  931. Specify the effect type, can be either @code{in} for fade-in, or
  932. @code{out} for a fade-out effect. Default is @code{in}.
  933. @item start_sample, ss
  934. Specify the number of the start sample for starting to apply the fade
  935. effect. Default is 0.
  936. @item nb_samples, ns
  937. Specify the number of samples for which the fade effect has to last. At
  938. the end of the fade-in effect the output audio will have the same
  939. volume as the input audio, at the end of the fade-out transition
  940. the output audio will be silence. Default is 44100.
  941. @item start_time, st
  942. Specify the start time of the fade effect. Default is 0.
  943. The value must be specified as a time duration; see
  944. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  945. for the accepted syntax.
  946. If set this option is used instead of @var{start_sample}.
  947. @item duration, d
  948. Specify the duration of the fade effect. See
  949. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  950. for the accepted syntax.
  951. At the end of the fade-in effect the output audio will have the same
  952. volume as the input audio, at the end of the fade-out transition
  953. the output audio will be silence.
  954. By default the duration is determined by @var{nb_samples}.
  955. If set this option is used instead of @var{nb_samples}.
  956. @item curve
  957. Set curve for fade transition.
  958. It accepts the following values:
  959. @table @option
  960. @item tri
  961. select triangular, linear slope (default)
  962. @item qsin
  963. select quarter of sine wave
  964. @item hsin
  965. select half of sine wave
  966. @item esin
  967. select exponential sine wave
  968. @item log
  969. select logarithmic
  970. @item ipar
  971. select inverted parabola
  972. @item qua
  973. select quadratic
  974. @item cub
  975. select cubic
  976. @item squ
  977. select square root
  978. @item cbr
  979. select cubic root
  980. @item par
  981. select parabola
  982. @item exp
  983. select exponential
  984. @item iqsin
  985. select inverted quarter of sine wave
  986. @item ihsin
  987. select inverted half of sine wave
  988. @item dese
  989. select double-exponential seat
  990. @item desi
  991. select double-exponential sigmoid
  992. @item losi
  993. select logistic sigmoid
  994. @item sinc
  995. select sine cardinal function
  996. @item isinc
  997. select inverted sine cardinal function
  998. @item nofade
  999. no fade applied
  1000. @end table
  1001. @end table
  1002. @subsection Commands
  1003. This filter supports the all above options as @ref{commands}.
  1004. @subsection Examples
  1005. @itemize
  1006. @item
  1007. Fade in first 15 seconds of audio:
  1008. @example
  1009. afade=t=in:ss=0:d=15
  1010. @end example
  1011. @item
  1012. Fade out last 25 seconds of a 900 seconds audio:
  1013. @example
  1014. afade=t=out:st=875:d=25
  1015. @end example
  1016. @end itemize
  1017. @section afftdn
  1018. Denoise audio samples with FFT.
  1019. A description of the accepted parameters follows.
  1020. @table @option
  1021. @item noise_reduction, nr
  1022. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1023. Default value is 12 dB.
  1024. @item noise_floor, nf
  1025. Set the noise floor in dB, allowed range is -80 to -20.
  1026. Default value is -50 dB.
  1027. @item noise_type, nt
  1028. Set the noise type.
  1029. It accepts the following values:
  1030. @table @option
  1031. @item white, w
  1032. Select white noise.
  1033. @item vinyl, v
  1034. Select vinyl noise.
  1035. @item shellac, s
  1036. Select shellac noise.
  1037. @item custom, c
  1038. Select custom noise, defined in @code{bn} option.
  1039. Default value is white noise.
  1040. @end table
  1041. @item band_noise, bn
  1042. Set custom band noise profile for every one of 15 bands.
  1043. Bands are separated by ' ' or '|'.
  1044. @item residual_floor, rf
  1045. Set the residual floor in dB, allowed range is -80 to -20.
  1046. Default value is -38 dB.
  1047. @item track_noise, tn
  1048. Enable noise floor tracking. By default is disabled.
  1049. With this enabled, noise floor is automatically adjusted.
  1050. @item track_residual, tr
  1051. Enable residual tracking. By default is disabled.
  1052. @item output_mode, om
  1053. Set the output mode.
  1054. It accepts the following values:
  1055. @table @option
  1056. @item input, i
  1057. Pass input unchanged.
  1058. @item output, o
  1059. Pass noise filtered out.
  1060. @item noise, n
  1061. Pass only noise.
  1062. Default value is @var{output}.
  1063. @end table
  1064. @item adaptivity, ad
  1065. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1066. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1067. react much slower.
  1068. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1069. @item floor_offset, fo
  1070. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1071. noise floor. It is only effective when noise floor tracking is enabled.
  1072. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1073. @item noise_link, nl
  1074. Set the noise link used for multichannel audio.
  1075. It accepts the following values:
  1076. @table @option
  1077. @item none
  1078. Use unchanged channel's noise floor.
  1079. @item min
  1080. Use measured min noise floor of all channels.
  1081. @item max
  1082. Use measured max noise floor of all channels.
  1083. @item average
  1084. Use measured average noise floor of all channels.
  1085. Default value is @var{min}.
  1086. @end table
  1087. @item band_multiplier, bm
  1088. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1089. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1090. @item sample_noise, sn
  1091. Toggle capturing and measurement of noise profile from input audio.
  1092. It accepts the following values:
  1093. @table @option
  1094. @item start, begin
  1095. Start sample noise capture.
  1096. @item stop, end
  1097. Stop sample noise capture and measure new noise band profile.
  1098. Default value is @code{none}.
  1099. @end table
  1100. @item gain_smooth, gs
  1101. Set gain smooth spatial radius, used to smooth gains applied to each frequency bin.
  1102. Useful to reduce random music noise artefacts.
  1103. Higher values increases smoothing of gains.
  1104. Allowed range is from @code{0} to @code{50}.
  1105. Default value is @code{0}.
  1106. @end table
  1107. @subsection Commands
  1108. This filter supports the some above mentioned options as @ref{commands}.
  1109. @subsection Examples
  1110. @itemize
  1111. @item
  1112. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1113. @example
  1114. afftdn=nr=10:nf=-40
  1115. @end example
  1116. @item
  1117. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1118. tracking of noise floor so noise floor will gradually change during processing:
  1119. @example
  1120. afftdn=nr=10:nf=-80:tn=1
  1121. @end example
  1122. @item
  1123. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1124. of first 0.4 seconds of input audio:
  1125. @example
  1126. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1127. @end example
  1128. @end itemize
  1129. @section afftfilt
  1130. Apply arbitrary expressions to samples in frequency domain.
  1131. @table @option
  1132. @item real
  1133. Set frequency domain real expression for each separate channel separated
  1134. by '|'. Default is "re".
  1135. If the number of input channels is greater than the number of
  1136. expressions, the last specified expression is used for the remaining
  1137. output channels.
  1138. @item imag
  1139. Set frequency domain imaginary expression for each separate channel
  1140. separated by '|'. Default is "im".
  1141. Each expression in @var{real} and @var{imag} can contain the following
  1142. constants and functions:
  1143. @table @option
  1144. @item sr
  1145. sample rate
  1146. @item b
  1147. current frequency bin number
  1148. @item nb
  1149. number of available bins
  1150. @item ch
  1151. channel number of the current expression
  1152. @item chs
  1153. number of channels
  1154. @item pts
  1155. current frame pts
  1156. @item re
  1157. current real part of frequency bin of current channel
  1158. @item im
  1159. current imaginary part of frequency bin of current channel
  1160. @item real(b, ch)
  1161. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1162. @item imag(b, ch)
  1163. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1164. @end table
  1165. @item win_size
  1166. Set window size. Allowed range is from 16 to 131072.
  1167. Default is @code{4096}
  1168. @item win_func
  1169. Set window function.
  1170. It accepts the following values:
  1171. @table @samp
  1172. @item rect
  1173. @item bartlett
  1174. @item hann, hanning
  1175. @item hamming
  1176. @item blackman
  1177. @item welch
  1178. @item flattop
  1179. @item bharris
  1180. @item bnuttall
  1181. @item bhann
  1182. @item sine
  1183. @item nuttall
  1184. @item lanczos
  1185. @item gauss
  1186. @item tukey
  1187. @item dolph
  1188. @item cauchy
  1189. @item parzen
  1190. @item poisson
  1191. @item bohman
  1192. @item kaiser
  1193. @end table
  1194. Default is @code{hann}.
  1195. @item overlap
  1196. Set window overlap. If set to 1, the recommended overlap for selected
  1197. window function will be picked. Default is @code{0.75}.
  1198. @end table
  1199. @subsection Examples
  1200. @itemize
  1201. @item
  1202. Leave almost only low frequencies in audio:
  1203. @example
  1204. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1205. @end example
  1206. @item
  1207. Apply robotize effect:
  1208. @example
  1209. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1210. @end example
  1211. @item
  1212. Apply whisper effect:
  1213. @example
  1214. 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"
  1215. @end example
  1216. @item
  1217. Apply phase shift:
  1218. @example
  1219. afftfilt="real=re*cos(1)-im*sin(1):imag=re*sin(1)+im*cos(1)"
  1220. @end example
  1221. @end itemize
  1222. @anchor{afir}
  1223. @section afir
  1224. Apply an arbitrary Finite Impulse Response filter.
  1225. This filter is designed for applying long FIR filters,
  1226. up to 60 seconds long.
  1227. It can be used as component for digital crossover filters,
  1228. room equalization, cross talk cancellation, wavefield synthesis,
  1229. auralization, ambiophonics, ambisonics and spatialization.
  1230. This filter uses the streams higher than first one as FIR coefficients.
  1231. If the non-first stream holds a single channel, it will be used
  1232. for all input channels in the first stream, otherwise
  1233. the number of channels in the non-first stream must be same as
  1234. the number of channels in the first stream.
  1235. It accepts the following parameters:
  1236. @table @option
  1237. @item dry
  1238. Set dry gain. This sets input gain.
  1239. @item wet
  1240. Set wet gain. This sets final output gain.
  1241. @item length
  1242. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1243. @item gtype
  1244. Enable applying gain measured from power of IR.
  1245. Set which approach to use for auto gain measurement.
  1246. @table @option
  1247. @item none
  1248. Do not apply any gain.
  1249. @item peak
  1250. select peak gain, very conservative approach. This is default value.
  1251. @item dc
  1252. select DC gain, limited application.
  1253. @item gn
  1254. select gain to noise approach, this is most popular one.
  1255. @end table
  1256. @item irgain
  1257. Set gain to be applied to IR coefficients before filtering.
  1258. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1259. @item irfmt
  1260. Set format of IR stream. Can be @code{mono} or @code{input}.
  1261. Default is @code{input}.
  1262. @item maxir
  1263. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1264. Allowed range is 0.1 to 60 seconds.
  1265. @item response
  1266. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1267. By default it is disabled.
  1268. @item channel
  1269. Set for which IR channel to display frequency response. By default is first channel
  1270. displayed. This option is used only when @var{response} is enabled.
  1271. @item size
  1272. Set video stream size. This option is used only when @var{response} is enabled.
  1273. @item rate
  1274. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1275. @item minp
  1276. Set minimal partition size used for convolution. Default is @var{8192}.
  1277. Allowed range is from @var{1} to @var{32768}.
  1278. Lower values decreases latency at cost of higher CPU usage.
  1279. @item maxp
  1280. Set maximal partition size used for convolution. Default is @var{8192}.
  1281. Allowed range is from @var{8} to @var{32768}.
  1282. Lower values may increase CPU usage.
  1283. @item nbirs
  1284. Set number of input impulse responses streams which will be switchable at runtime.
  1285. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1286. @item ir
  1287. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1288. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1289. This option can be changed at runtime via @ref{commands}.
  1290. @item precision
  1291. Set which precision to use when processing samples.
  1292. @table @option
  1293. @item auto
  1294. Auto pick internal sample format depending on other filters.
  1295. @item float
  1296. Always use single-floating point precision sample format.
  1297. @item double
  1298. Always use double-floating point precision sample format.
  1299. @end table
  1300. Default value is auto.
  1301. @end table
  1302. @subsection Examples
  1303. @itemize
  1304. @item
  1305. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1306. @example
  1307. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1308. @end example
  1309. @end itemize
  1310. @anchor{aformat}
  1311. @section aformat
  1312. Set output format constraints for the input audio. The framework will
  1313. negotiate the most appropriate format to minimize conversions.
  1314. It accepts the following parameters:
  1315. @table @option
  1316. @item sample_fmts, f
  1317. A '|'-separated list of requested sample formats.
  1318. @item sample_rates, r
  1319. A '|'-separated list of requested sample rates.
  1320. @item channel_layouts, cl
  1321. A '|'-separated list of requested channel layouts.
  1322. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1323. for the required syntax.
  1324. @end table
  1325. If a parameter is omitted, all values are allowed.
  1326. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1327. @example
  1328. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1329. @end example
  1330. @section afreqshift
  1331. Apply frequency shift to input audio samples.
  1332. The filter accepts the following options:
  1333. @table @option
  1334. @item shift
  1335. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1336. Default value is 0.0.
  1337. @item level
  1338. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1339. Default value is 1.0.
  1340. @item order
  1341. Set filter order used for filtering. Allowed range is from 1 to 16.
  1342. Default value is 8.
  1343. @end table
  1344. @subsection Commands
  1345. This filter supports the all above options as @ref{commands}.
  1346. @section afwtdn
  1347. Reduce broadband noise from input samples using Wavelets.
  1348. A description of the accepted options follows.
  1349. @table @option
  1350. @item sigma
  1351. Set the noise sigma, allowed range is from 0 to 1.
  1352. Default value is 0.
  1353. This option controls strength of denoising applied to input samples.
  1354. Most useful way to set this option is via decibels, eg. -45dB.
  1355. @item levels
  1356. Set the number of wavelet levels of decomposition.
  1357. Allowed range is from 1 to 12.
  1358. Default value is 10.
  1359. Setting this too low make denoising performance very poor.
  1360. @item wavet
  1361. Set wavelet type for decomposition of input frame.
  1362. They are sorted by number of coefficients, from lowest to highest.
  1363. More coefficients means worse filtering speed, but overall better quality.
  1364. Available wavelets are:
  1365. @table @samp
  1366. @item sym2
  1367. @item sym4
  1368. @item rbior68
  1369. @item deb10
  1370. @item sym10
  1371. @item coif5
  1372. @item bl3
  1373. @end table
  1374. @item percent
  1375. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1376. Default value is 85 percent or partial denoising.
  1377. @item profile
  1378. If enabled, first input frame will be used as noise profile.
  1379. If first frame samples contain non-noise performance will be very poor.
  1380. @item adaptive
  1381. If enabled, input frames are analyzed for presence of noise.
  1382. If noise is detected with high possibility then input frame profile will be
  1383. used for processing following frames, until new noise frame is detected.
  1384. @item samples
  1385. Set size of single frame in number of samples. Allowed range is from 512 to
  1386. 65536. Default frame size is 8192 samples.
  1387. @item softness
  1388. Set softness applied inside thresholding function. Allowed range is from 0 to
  1389. 10. Default softness is 1.
  1390. @end table
  1391. @subsection Commands
  1392. This filter supports the all above options as @ref{commands}.
  1393. @section agate
  1394. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1395. processing reduces disturbing noise between useful signals.
  1396. Gating is done by detecting the volume below a chosen level @var{threshold}
  1397. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1398. floor is set via @var{range}. Because an exact manipulation of the signal
  1399. would cause distortion of the waveform the reduction can be levelled over
  1400. time. This is done by setting @var{attack} and @var{release}.
  1401. @var{attack} determines how long the signal has to fall below the threshold
  1402. before any reduction will occur and @var{release} sets the time the signal
  1403. has to rise above the threshold to reduce the reduction again.
  1404. Shorter signals than the chosen attack time will be left untouched.
  1405. @table @option
  1406. @item level_in
  1407. Set input level before filtering.
  1408. Default is 1. Allowed range is from 0.015625 to 64.
  1409. @item mode
  1410. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1411. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1412. will be amplified, expanding dynamic range in upward direction.
  1413. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1414. @item range
  1415. Set the level of gain reduction when the signal is below the threshold.
  1416. Default is 0.06125. Allowed range is from 0 to 1.
  1417. Setting this to 0 disables reduction and then filter behaves like expander.
  1418. @item threshold
  1419. If a signal rises above this level the gain reduction is released.
  1420. Default is 0.125. Allowed range is from 0 to 1.
  1421. @item ratio
  1422. Set a ratio by which the signal is reduced.
  1423. Default is 2. Allowed range is from 1 to 9000.
  1424. @item attack
  1425. Amount of milliseconds the signal has to rise above the threshold before gain
  1426. reduction stops.
  1427. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1428. @item release
  1429. Amount of milliseconds the signal has to fall below the threshold before the
  1430. reduction is increased again. Default is 250 milliseconds.
  1431. Allowed range is from 0.01 to 9000.
  1432. @item makeup
  1433. Set amount of amplification of signal after processing.
  1434. Default is 1. Allowed range is from 1 to 64.
  1435. @item knee
  1436. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1437. Default is 2.828427125. Allowed range is from 1 to 8.
  1438. @item detection
  1439. Choose if exact signal should be taken for detection or an RMS like one.
  1440. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1441. @item link
  1442. Choose if the average level between all channels or the louder channel affects
  1443. the reduction.
  1444. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1445. @end table
  1446. @subsection Commands
  1447. This filter supports the all above options as @ref{commands}.
  1448. @section aiir
  1449. Apply an arbitrary Infinite Impulse Response filter.
  1450. It accepts the following parameters:
  1451. @table @option
  1452. @item zeros, z
  1453. Set B/numerator/zeros/reflection coefficients.
  1454. @item poles, p
  1455. Set A/denominator/poles/ladder coefficients.
  1456. @item gains, k
  1457. Set channels gains.
  1458. @item dry_gain
  1459. Set input gain.
  1460. @item wet_gain
  1461. Set output gain.
  1462. @item format, f
  1463. Set coefficients format.
  1464. @table @samp
  1465. @item ll
  1466. lattice-ladder function
  1467. @item sf
  1468. analog transfer function
  1469. @item tf
  1470. digital transfer function
  1471. @item zp
  1472. Z-plane zeros/poles, cartesian (default)
  1473. @item pr
  1474. Z-plane zeros/poles, polar radians
  1475. @item pd
  1476. Z-plane zeros/poles, polar degrees
  1477. @item sp
  1478. S-plane zeros/poles
  1479. @end table
  1480. @item process, r
  1481. Set type of processing.
  1482. @table @samp
  1483. @item d
  1484. direct processing
  1485. @item s
  1486. serial processing
  1487. @item p
  1488. parallel processing
  1489. @end table
  1490. @item precision, e
  1491. Set filtering precision.
  1492. @table @samp
  1493. @item dbl
  1494. double-precision floating-point (default)
  1495. @item flt
  1496. single-precision floating-point
  1497. @item i32
  1498. 32-bit integers
  1499. @item i16
  1500. 16-bit integers
  1501. @end table
  1502. @item normalize, n
  1503. Normalize filter coefficients, by default is enabled.
  1504. Enabling it will normalize magnitude response at DC to 0dB.
  1505. @item mix
  1506. How much to use filtered signal in output. Default is 1.
  1507. Range is between 0 and 1.
  1508. @item response
  1509. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1510. By default it is disabled.
  1511. @item channel
  1512. Set for which IR channel to display frequency response. By default is first channel
  1513. displayed. This option is used only when @var{response} is enabled.
  1514. @item size
  1515. Set video stream size. This option is used only when @var{response} is enabled.
  1516. @end table
  1517. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1518. order.
  1519. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1520. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1521. imaginary unit.
  1522. Different coefficients and gains can be provided for every channel, in such case
  1523. use '|' to separate coefficients or gains. Last provided coefficients will be
  1524. used for all remaining channels.
  1525. @subsection Examples
  1526. @itemize
  1527. @item
  1528. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1529. @example
  1530. 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
  1531. @end example
  1532. @item
  1533. Same as above but in @code{zp} format:
  1534. @example
  1535. 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
  1536. @end example
  1537. @item
  1538. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1539. @example
  1540. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1541. @end example
  1542. @end itemize
  1543. @section alimiter
  1544. The limiter prevents an input signal from rising over a desired threshold.
  1545. This limiter uses lookahead technology to prevent your signal from distorting.
  1546. It means that there is a small delay after the signal is processed. Keep in mind
  1547. that the delay it produces is the attack time you set.
  1548. The filter accepts the following options:
  1549. @table @option
  1550. @item level_in
  1551. Set input gain. Default is 1.
  1552. @item level_out
  1553. Set output gain. Default is 1.
  1554. @item limit
  1555. Don't let signals above this level pass the limiter. Default is 1.
  1556. @item attack
  1557. The limiter will reach its attenuation level in this amount of time in
  1558. milliseconds. Default is 5 milliseconds.
  1559. @item release
  1560. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1561. Default is 50 milliseconds.
  1562. @item asc
  1563. When gain reduction is always needed ASC takes care of releasing to an
  1564. average reduction level rather than reaching a reduction of 0 in the release
  1565. time.
  1566. @item asc_level
  1567. Select how much the release time is affected by ASC, 0 means nearly no changes
  1568. in release time while 1 produces higher release times.
  1569. @item level
  1570. Auto level output signal. Default is enabled.
  1571. This normalizes audio back to 0dB if enabled.
  1572. @item latency
  1573. Compensate the delay introduced by using the lookahead buffer set with attack
  1574. parameter. Also flush the valid audio data in the lookahead buffer when the
  1575. stream hits EOF.
  1576. @end table
  1577. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1578. with @ref{aresample} before applying this filter.
  1579. @section allpass
  1580. Apply a two-pole all-pass filter with central frequency (in Hz)
  1581. @var{frequency}, and filter-width @var{width}.
  1582. An all-pass filter changes the audio's frequency to phase relationship
  1583. without changing its frequency to amplitude relationship.
  1584. The filter accepts the following options:
  1585. @table @option
  1586. @item frequency, f
  1587. Set frequency in Hz.
  1588. @item width_type, t
  1589. Set method to specify band-width of filter.
  1590. @table @option
  1591. @item h
  1592. Hz
  1593. @item q
  1594. Q-Factor
  1595. @item o
  1596. octave
  1597. @item s
  1598. slope
  1599. @item k
  1600. kHz
  1601. @end table
  1602. @item width, w
  1603. Specify the band-width of a filter in width_type units.
  1604. @item mix, m
  1605. How much to use filtered signal in output. Default is 1.
  1606. Range is between 0 and 1.
  1607. @item channels, c
  1608. Specify which channels to filter, by default all available are filtered.
  1609. @item normalize, n
  1610. Normalize biquad coefficients, by default is disabled.
  1611. Enabling it will normalize magnitude response at DC to 0dB.
  1612. @item order, o
  1613. Set the filter order, can be 1 or 2. Default is 2.
  1614. @item transform, a
  1615. Set transform type of IIR filter.
  1616. @table @option
  1617. @item di
  1618. @item dii
  1619. @item tdi
  1620. @item tdii
  1621. @item latt
  1622. @item svf
  1623. @item zdf
  1624. @end table
  1625. @item precision, r
  1626. Set precison of filtering.
  1627. @table @option
  1628. @item auto
  1629. Pick automatic sample format depending on surround filters.
  1630. @item s16
  1631. Always use signed 16-bit.
  1632. @item s32
  1633. Always use signed 32-bit.
  1634. @item f32
  1635. Always use float 32-bit.
  1636. @item f64
  1637. Always use float 64-bit.
  1638. @end table
  1639. @end table
  1640. @subsection Commands
  1641. This filter supports the following commands:
  1642. @table @option
  1643. @item frequency, f
  1644. Change allpass frequency.
  1645. Syntax for the command is : "@var{frequency}"
  1646. @item width_type, t
  1647. Change allpass width_type.
  1648. Syntax for the command is : "@var{width_type}"
  1649. @item width, w
  1650. Change allpass width.
  1651. Syntax for the command is : "@var{width}"
  1652. @item mix, m
  1653. Change allpass mix.
  1654. Syntax for the command is : "@var{mix}"
  1655. @end table
  1656. @section aloop
  1657. Loop audio samples.
  1658. The filter accepts the following options:
  1659. @table @option
  1660. @item loop
  1661. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1662. Default is 0.
  1663. @item size
  1664. Set maximal number of samples. Default is 0.
  1665. @item start
  1666. Set first sample of loop. Default is 0.
  1667. @end table
  1668. @anchor{amerge}
  1669. @section amerge
  1670. Merge two or more audio streams into a single multi-channel stream.
  1671. The filter accepts the following options:
  1672. @table @option
  1673. @item inputs
  1674. Set the number of inputs. Default is 2.
  1675. @end table
  1676. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1677. the channel layout of the output will be set accordingly and the channels
  1678. will be reordered as necessary. If the channel layouts of the inputs are not
  1679. disjoint, the output will have all the channels of the first input then all
  1680. the channels of the second input, in that order, and the channel layout of
  1681. the output will be the default value corresponding to the total number of
  1682. channels.
  1683. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1684. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1685. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1686. first input, b1 is the first channel of the second input).
  1687. On the other hand, if both input are in stereo, the output channels will be
  1688. in the default order: a1, a2, b1, b2, and the channel layout will be
  1689. arbitrarily set to 4.0, which may or may not be the expected value.
  1690. All inputs must have the same sample rate, and format.
  1691. If inputs do not have the same duration, the output will stop with the
  1692. shortest.
  1693. @subsection Examples
  1694. @itemize
  1695. @item
  1696. Merge two mono files into a stereo stream:
  1697. @example
  1698. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1699. @end example
  1700. @item
  1701. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1702. @example
  1703. 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
  1704. @end example
  1705. @end itemize
  1706. @section amix
  1707. Mixes multiple audio inputs into a single output.
  1708. Note that this filter only supports float samples (the @var{amerge}
  1709. and @var{pan} audio filters support many formats). If the @var{amix}
  1710. input has integer samples then @ref{aresample} will be automatically
  1711. inserted to perform the conversion to float samples.
  1712. It accepts the following parameters:
  1713. @table @option
  1714. @item inputs
  1715. The number of inputs. If unspecified, it defaults to 2.
  1716. @item duration
  1717. How to determine the end-of-stream.
  1718. @table @option
  1719. @item longest
  1720. The duration of the longest input. (default)
  1721. @item shortest
  1722. The duration of the shortest input.
  1723. @item first
  1724. The duration of the first input.
  1725. @end table
  1726. @item dropout_transition
  1727. The transition time, in seconds, for volume renormalization when an input
  1728. stream ends. The default value is 2 seconds.
  1729. @item weights
  1730. Specify weight of each input audio stream as a sequence of numbers separated
  1731. by a space. If fewer weights are specified compared to number of inputs, the
  1732. last weight is assigned to the remaining inputs.
  1733. Default weight for each input is 1.
  1734. @item normalize
  1735. Always scale inputs instead of only doing summation of samples.
  1736. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1737. by this filter if this option is disabled. By default is enabled.
  1738. @end table
  1739. @subsection Examples
  1740. @itemize
  1741. @item
  1742. This will mix 3 input audio streams to a single output with the same duration as the
  1743. first input and a dropout transition time of 3 seconds:
  1744. @example
  1745. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1746. @end example
  1747. @item
  1748. This will mix one vocal and one music input audio stream to a single output with the same duration as the
  1749. longest input. The music will have quarter the weight as the vocals, and the inputs are not normalized:
  1750. @example
  1751. ffmpeg -i VOCALS -i MUSIC -filter_complex amix=inputs=2:duration=longest:dropout_transition=0:weights="1 0.25":normalize=0 OUTPUT
  1752. @end example
  1753. @end itemize
  1754. @subsection Commands
  1755. This filter supports the following commands:
  1756. @table @option
  1757. @item weights
  1758. @item normalize
  1759. Syntax is same as option with same name.
  1760. @end table
  1761. @section amultiply
  1762. Multiply first audio stream with second audio stream and store result
  1763. in output audio stream. Multiplication is done by multiplying each
  1764. sample from first stream with sample at same position from second stream.
  1765. With this element-wise multiplication one can create amplitude fades and
  1766. amplitude modulations.
  1767. @section anequalizer
  1768. High-order parametric multiband equalizer for each channel.
  1769. It accepts the following parameters:
  1770. @table @option
  1771. @item params
  1772. This option string is in format:
  1773. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1774. Each equalizer band is separated by '|'.
  1775. @table @option
  1776. @item chn
  1777. Set channel number to which equalization will be applied.
  1778. If input doesn't have that channel the entry is ignored.
  1779. @item f
  1780. Set central frequency for band.
  1781. If input doesn't have that frequency the entry is ignored.
  1782. @item w
  1783. Set band width in Hertz.
  1784. @item g
  1785. Set band gain in dB.
  1786. @item t
  1787. Set filter type for band, optional, can be:
  1788. @table @samp
  1789. @item 0
  1790. Butterworth, this is default.
  1791. @item 1
  1792. Chebyshev type 1.
  1793. @item 2
  1794. Chebyshev type 2.
  1795. @end table
  1796. @end table
  1797. @item curves
  1798. With this option activated frequency response of anequalizer is displayed
  1799. in video stream.
  1800. @item size
  1801. Set video stream size. Only useful if curves option is activated.
  1802. @item mgain
  1803. Set max gain that will be displayed. Only useful if curves option is activated.
  1804. Setting this to a reasonable value makes it possible to display gain which is derived from
  1805. neighbour bands which are too close to each other and thus produce higher gain
  1806. when both are activated.
  1807. @item fscale
  1808. Set frequency scale used to draw frequency response in video output.
  1809. Can be linear or logarithmic. Default is logarithmic.
  1810. @item colors
  1811. Set color for each channel curve which is going to be displayed in video stream.
  1812. This is list of color names separated by space or by '|'.
  1813. Unrecognised or missing colors will be replaced by white color.
  1814. @end table
  1815. @subsection Examples
  1816. @itemize
  1817. @item
  1818. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1819. for first 2 channels using Chebyshev type 1 filter:
  1820. @example
  1821. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1822. @end example
  1823. @end itemize
  1824. @subsection Commands
  1825. This filter supports the following commands:
  1826. @table @option
  1827. @item change
  1828. Alter existing filter parameters.
  1829. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1830. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1831. error is returned.
  1832. @var{freq} set new frequency parameter.
  1833. @var{width} set new width parameter in Hertz.
  1834. @var{gain} set new gain parameter in dB.
  1835. Full filter invocation with asendcmd may look like this:
  1836. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1837. @end table
  1838. @section anlmdn
  1839. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1840. Each sample is adjusted by looking for other samples with similar contexts. This
  1841. context similarity is defined by comparing their surrounding patches of size
  1842. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1843. The filter accepts the following options:
  1844. @table @option
  1845. @item strength, s
  1846. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  1847. @item patch, p
  1848. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1849. Default value is 2 milliseconds.
  1850. @item research, r
  1851. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1852. Default value is 6 milliseconds.
  1853. @item output, o
  1854. Set the output mode.
  1855. It accepts the following values:
  1856. @table @option
  1857. @item i
  1858. Pass input unchanged.
  1859. @item o
  1860. Pass noise filtered out.
  1861. @item n
  1862. Pass only noise.
  1863. Default value is @var{o}.
  1864. @end table
  1865. @item smooth, m
  1866. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  1867. @end table
  1868. @subsection Commands
  1869. This filter supports the all above options as @ref{commands}.
  1870. @section anlmf, anlms
  1871. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  1872. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1873. relate to producing the least mean square of the error signal (difference between the desired,
  1874. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1875. A description of the accepted options follows.
  1876. @table @option
  1877. @item order
  1878. Set filter order.
  1879. @item mu
  1880. Set filter mu.
  1881. @item eps
  1882. Set the filter eps.
  1883. @item leakage
  1884. Set the filter leakage.
  1885. @item out_mode
  1886. It accepts the following values:
  1887. @table @option
  1888. @item i
  1889. Pass the 1st input.
  1890. @item d
  1891. Pass the 2nd input.
  1892. @item o
  1893. Pass filtered samples.
  1894. @item n
  1895. Pass difference between desired and filtered samples.
  1896. Default value is @var{o}.
  1897. @end table
  1898. @end table
  1899. @subsection Examples
  1900. @itemize
  1901. @item
  1902. One of many usages of this filter is noise reduction, input audio is filtered
  1903. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1904. @example
  1905. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1906. @end example
  1907. @end itemize
  1908. @subsection Commands
  1909. This filter supports the same commands as options, excluding option @code{order}.
  1910. @section anull
  1911. Pass the audio source unchanged to the output.
  1912. @section apad
  1913. Pad the end of an audio stream with silence.
  1914. This can be used together with @command{ffmpeg} @option{-shortest} to
  1915. extend audio streams to the same length as the video stream.
  1916. A description of the accepted options follows.
  1917. @table @option
  1918. @item packet_size
  1919. Set silence packet size. Default value is 4096.
  1920. @item pad_len
  1921. Set the number of samples of silence to add to the end. After the
  1922. value is reached, the stream is terminated. This option is mutually
  1923. exclusive with @option{whole_len}.
  1924. @item whole_len
  1925. Set the minimum total number of samples in the output audio stream. If
  1926. the value is longer than the input audio length, silence is added to
  1927. the end, until the value is reached. This option is mutually exclusive
  1928. with @option{pad_len}.
  1929. @item pad_dur
  1930. Specify the duration of samples of silence to add. See
  1931. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1932. for the accepted syntax. Used only if set to non-negative value.
  1933. @item whole_dur
  1934. Specify the minimum total duration in the output audio stream. See
  1935. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1936. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  1937. the input audio length, silence is added to the end, until the value is reached.
  1938. This option is mutually exclusive with @option{pad_dur}
  1939. @end table
  1940. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1941. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1942. the input stream indefinitely.
  1943. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  1944. @option{whole_dur} also caused the filter to add silence indefinitely.
  1945. @subsection Examples
  1946. @itemize
  1947. @item
  1948. Add 1024 samples of silence to the end of the input:
  1949. @example
  1950. apad=pad_len=1024
  1951. @end example
  1952. @item
  1953. Make sure the audio output will contain at least 10000 samples, pad
  1954. the input with silence if required:
  1955. @example
  1956. apad=whole_len=10000
  1957. @end example
  1958. @item
  1959. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1960. video stream will always result the shortest and will be converted
  1961. until the end in the output file when using the @option{shortest}
  1962. option:
  1963. @example
  1964. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1965. @end example
  1966. @end itemize
  1967. @section aphaser
  1968. Add a phasing effect to the input audio.
  1969. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1970. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1971. A description of the accepted parameters follows.
  1972. @table @option
  1973. @item in_gain
  1974. Set input gain. Default is 0.4.
  1975. @item out_gain
  1976. Set output gain. Default is 0.74
  1977. @item delay
  1978. Set delay in milliseconds. Default is 3.0.
  1979. @item decay
  1980. Set decay. Default is 0.4.
  1981. @item speed
  1982. Set modulation speed in Hz. Default is 0.5.
  1983. @item type
  1984. Set modulation type. Default is triangular.
  1985. It accepts the following values:
  1986. @table @samp
  1987. @item triangular, t
  1988. @item sinusoidal, s
  1989. @end table
  1990. @end table
  1991. @section aphaseshift
  1992. Apply phase shift to input audio samples.
  1993. The filter accepts the following options:
  1994. @table @option
  1995. @item shift
  1996. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1997. Default value is 0.0.
  1998. @item level
  1999. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  2000. Default value is 1.0.
  2001. @item order
  2002. Set filter order used for filtering. Allowed range is from 1 to 16.
  2003. Default value is 8.
  2004. @end table
  2005. @subsection Commands
  2006. This filter supports the all above options as @ref{commands}.
  2007. @section apsyclip
  2008. Apply Psychoacoustic clipper to input audio stream.
  2009. The filter accepts the following options:
  2010. @table @option
  2011. @item level_in
  2012. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2013. @item level_out
  2014. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2015. @item clip
  2016. Set the clipping start value. Default value is 0dBFS or 1.
  2017. @item diff
  2018. Output only difference samples, useful to hear introduced distortions.
  2019. By default is disabled.
  2020. @item adaptive
  2021. Set strength of adaptive distortion applied. Default value is 0.5.
  2022. Allowed range is from 0 to 1.
  2023. @item iterations
  2024. Set number of iterations of psychoacoustic clipper.
  2025. Allowed range is from 1 to 20. Default value is 10.
  2026. @item level
  2027. Auto level output signal. Default is disabled.
  2028. This normalizes audio back to 0dBFS if enabled.
  2029. @end table
  2030. @subsection Commands
  2031. This filter supports the all above options as @ref{commands}.
  2032. @section apulsator
  2033. Audio pulsator is something between an autopanner and a tremolo.
  2034. But it can produce funny stereo effects as well. Pulsator changes the volume
  2035. of the left and right channel based on a LFO (low frequency oscillator) with
  2036. different waveforms and shifted phases.
  2037. This filter have the ability to define an offset between left and right
  2038. channel. An offset of 0 means that both LFO shapes match each other.
  2039. The left and right channel are altered equally - a conventional tremolo.
  2040. An offset of 50% means that the shape of the right channel is exactly shifted
  2041. in phase (or moved backwards about half of the frequency) - pulsator acts as
  2042. an autopanner. At 1 both curves match again. Every setting in between moves the
  2043. phase shift gapless between all stages and produces some "bypassing" sounds with
  2044. sine and triangle waveforms. The more you set the offset near 1 (starting from
  2045. the 0.5) the faster the signal passes from the left to the right speaker.
  2046. The filter accepts the following options:
  2047. @table @option
  2048. @item level_in
  2049. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2050. @item level_out
  2051. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2052. @item mode
  2053. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  2054. sawup or sawdown. Default is sine.
  2055. @item amount
  2056. Set modulation. Define how much of original signal is affected by the LFO.
  2057. @item offset_l
  2058. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2059. @item offset_r
  2060. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2061. @item width
  2062. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2063. @item timing
  2064. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2065. @item bpm
  2066. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2067. is set to bpm.
  2068. @item ms
  2069. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2070. is set to ms.
  2071. @item hz
  2072. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2073. if timing is set to hz.
  2074. @end table
  2075. @anchor{aresample}
  2076. @section aresample
  2077. Resample the input audio to the specified parameters, using the
  2078. libswresample library. If none are specified then the filter will
  2079. automatically convert between its input and output.
  2080. This filter is also able to stretch/squeeze the audio data to make it match
  2081. the timestamps or to inject silence / cut out audio to make it match the
  2082. timestamps, do a combination of both or do neither.
  2083. The filter accepts the syntax
  2084. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2085. expresses a sample rate and @var{resampler_options} is a list of
  2086. @var{key}=@var{value} pairs, separated by ":". See the
  2087. @ref{Resampler Options,,"Resampler Options" section in the
  2088. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2089. for the complete list of supported options.
  2090. @subsection Examples
  2091. @itemize
  2092. @item
  2093. Resample the input audio to 44100Hz:
  2094. @example
  2095. aresample=44100
  2096. @end example
  2097. @item
  2098. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2099. samples per second compensation:
  2100. @example
  2101. aresample=async=1000
  2102. @end example
  2103. @end itemize
  2104. @section areverse
  2105. Reverse an audio clip.
  2106. Warning: This filter requires memory to buffer the entire clip, so trimming
  2107. is suggested.
  2108. @subsection Examples
  2109. @itemize
  2110. @item
  2111. Take the first 5 seconds of a clip, and reverse it.
  2112. @example
  2113. atrim=end=5,areverse
  2114. @end example
  2115. @end itemize
  2116. @section arnndn
  2117. Reduce noise from speech using Recurrent Neural Networks.
  2118. This filter accepts the following options:
  2119. @table @option
  2120. @item model, m
  2121. Set train model file to load. This option is always required.
  2122. @item mix
  2123. Set how much to mix filtered samples into final output.
  2124. Allowed range is from -1 to 1. Default value is 1.
  2125. Negative values are special, they set how much to keep filtered noise
  2126. in the final filter output. Set this option to -1 to hear actual
  2127. noise removed from input signal.
  2128. @end table
  2129. @subsection Commands
  2130. This filter supports the all above options as @ref{commands}.
  2131. @section asdr
  2132. Measure Audio Signal-to-Distortion Ratio.
  2133. This filter takes two audio streams for input, and outputs first
  2134. audio stream.
  2135. Results are in dB per channel at end of either input.
  2136. @section asetnsamples
  2137. Set the number of samples per each output audio frame.
  2138. The last output packet may contain a different number of samples, as
  2139. the filter will flush all the remaining samples when the input audio
  2140. signals its end.
  2141. The filter accepts the following options:
  2142. @table @option
  2143. @item nb_out_samples, n
  2144. Set the number of frames per each output audio frame. The number is
  2145. intended as the number of samples @emph{per each channel}.
  2146. Default value is 1024.
  2147. @item pad, p
  2148. If set to 1, the filter will pad the last audio frame with zeroes, so
  2149. that the last frame will contain the same number of samples as the
  2150. previous ones. Default value is 1.
  2151. @end table
  2152. For example, to set the number of per-frame samples to 1234 and
  2153. disable padding for the last frame, use:
  2154. @example
  2155. asetnsamples=n=1234:p=0
  2156. @end example
  2157. @section asetrate
  2158. Set the sample rate without altering the PCM data.
  2159. This will result in a change of speed and pitch.
  2160. The filter accepts the following options:
  2161. @table @option
  2162. @item sample_rate, r
  2163. Set the output sample rate. Default is 44100 Hz.
  2164. @end table
  2165. @section ashowinfo
  2166. Show a line containing various information for each input audio frame.
  2167. The input audio is not modified.
  2168. The shown line contains a sequence of key/value pairs of the form
  2169. @var{key}:@var{value}.
  2170. The following values are shown in the output:
  2171. @table @option
  2172. @item n
  2173. The (sequential) number of the input frame, starting from 0.
  2174. @item pts
  2175. The presentation timestamp of the input frame, in time base units; the time base
  2176. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2177. @item pts_time
  2178. The presentation timestamp of the input frame in seconds.
  2179. @item pos
  2180. position of the frame in the input stream, -1 if this information in
  2181. unavailable and/or meaningless (for example in case of synthetic audio)
  2182. @item fmt
  2183. The sample format.
  2184. @item chlayout
  2185. The channel layout.
  2186. @item rate
  2187. The sample rate for the audio frame.
  2188. @item nb_samples
  2189. The number of samples (per channel) in the frame.
  2190. @item checksum
  2191. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2192. audio, the data is treated as if all the planes were concatenated.
  2193. @item plane_checksums
  2194. A list of Adler-32 checksums for each data plane.
  2195. @end table
  2196. @section asoftclip
  2197. Apply audio soft clipping.
  2198. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2199. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2200. This filter accepts the following options:
  2201. @table @option
  2202. @item type
  2203. Set type of soft-clipping.
  2204. It accepts the following values:
  2205. @table @option
  2206. @item hard
  2207. @item tanh
  2208. @item atan
  2209. @item cubic
  2210. @item exp
  2211. @item alg
  2212. @item quintic
  2213. @item sin
  2214. @item erf
  2215. @end table
  2216. @item threshold
  2217. Set threshold from where to start clipping. Default value is 0dB or 1.
  2218. @item output
  2219. Set gain applied to output. Default value is 0dB or 1.
  2220. @item param
  2221. Set additional parameter which controls sigmoid function.
  2222. @item oversample
  2223. Set oversampling factor.
  2224. @end table
  2225. @subsection Commands
  2226. This filter supports the all above options as @ref{commands}.
  2227. @section aspectralstats
  2228. Display frequency domain statistical information about the audio channels.
  2229. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2230. It accepts the following option:
  2231. @table @option
  2232. @item win_size
  2233. Set the window length in samples. Default value is 2048.
  2234. Allowed range is from 32 to 65536.
  2235. @item win_func
  2236. Set window function.
  2237. It accepts the following values:
  2238. @table @samp
  2239. @item rect
  2240. @item bartlett
  2241. @item hann, hanning
  2242. @item hamming
  2243. @item blackman
  2244. @item welch
  2245. @item flattop
  2246. @item bharris
  2247. @item bnuttall
  2248. @item bhann
  2249. @item sine
  2250. @item nuttall
  2251. @item lanczos
  2252. @item gauss
  2253. @item tukey
  2254. @item dolph
  2255. @item cauchy
  2256. @item parzen
  2257. @item poisson
  2258. @item bohman
  2259. @item kaiser
  2260. @end table
  2261. Default is @code{hann}.
  2262. @item overlap
  2263. Set window overlap. Allowed range is from @code{0}
  2264. to @code{1}. Default value is @code{0.5}.
  2265. @item measure
  2266. Select the parameters which are measured. The metadata keys can
  2267. be used as flags, default is @option{all} which measures everything.
  2268. @option{none} disables all measurement.
  2269. @end table
  2270. A list of each metadata key follows:
  2271. @table @option
  2272. @item mean
  2273. @item variance
  2274. @item centroid
  2275. @item spread
  2276. @item skewness
  2277. @item kurtosis
  2278. @item entropy
  2279. @item flatness
  2280. @item crest
  2281. @item flux
  2282. @item slope
  2283. @item decrease
  2284. @item rolloff
  2285. @end table
  2286. @section asr
  2287. Automatic Speech Recognition
  2288. This filter uses PocketSphinx for speech recognition. To enable
  2289. compilation of this filter, you need to configure FFmpeg with
  2290. @code{--enable-pocketsphinx}.
  2291. It accepts the following options:
  2292. @table @option
  2293. @item rate
  2294. Set sampling rate of input audio. Defaults is @code{16000}.
  2295. This need to match speech models, otherwise one will get poor results.
  2296. @item hmm
  2297. Set dictionary containing acoustic model files.
  2298. @item dict
  2299. Set pronunciation dictionary.
  2300. @item lm
  2301. Set language model file.
  2302. @item lmctl
  2303. Set language model set.
  2304. @item lmname
  2305. Set which language model to use.
  2306. @item logfn
  2307. Set output for log messages.
  2308. @end table
  2309. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2310. @anchor{astats}
  2311. @section astats
  2312. Display time domain statistical information about the audio channels.
  2313. Statistics are calculated and displayed for each audio channel and,
  2314. where applicable, an overall figure is also given.
  2315. It accepts the following option:
  2316. @table @option
  2317. @item length
  2318. Short window length in seconds, used for peak and trough RMS measurement.
  2319. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2320. @item metadata
  2321. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2322. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2323. disabled.
  2324. Available keys for each channel are:
  2325. DC_offset
  2326. Min_level
  2327. Max_level
  2328. Min_difference
  2329. Max_difference
  2330. Mean_difference
  2331. RMS_difference
  2332. Peak_level
  2333. RMS_peak
  2334. RMS_trough
  2335. Crest_factor
  2336. Flat_factor
  2337. Peak_count
  2338. Noise_floor
  2339. Noise_floor_count
  2340. Entropy
  2341. Bit_depth
  2342. Dynamic_range
  2343. Zero_crossings
  2344. Zero_crossings_rate
  2345. Number_of_NaNs
  2346. Number_of_Infs
  2347. Number_of_denormals
  2348. and for Overall:
  2349. DC_offset
  2350. Min_level
  2351. Max_level
  2352. Min_difference
  2353. Max_difference
  2354. Mean_difference
  2355. RMS_difference
  2356. Peak_level
  2357. RMS_level
  2358. RMS_peak
  2359. RMS_trough
  2360. Flat_factor
  2361. Peak_count
  2362. Noise_floor
  2363. Noise_floor_count
  2364. Entropy
  2365. Bit_depth
  2366. Number_of_samples
  2367. Number_of_NaNs
  2368. Number_of_Infs
  2369. Number_of_denormals
  2370. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  2371. this @code{lavfi.astats.Overall.Peak_count}.
  2372. For description what each key means read below.
  2373. @item reset
  2374. Set the number of frames over which cumulative stats are calculated before
  2375. being reset
  2376. Default is disabled.
  2377. @item measure_perchannel
  2378. Select the parameters which are measured per channel. The metadata keys can
  2379. be used as flags, default is @option{all} which measures everything.
  2380. @option{none} disables all per channel measurement.
  2381. @item measure_overall
  2382. Select the parameters which are measured overall. The metadata keys can
  2383. be used as flags, default is @option{all} which measures everything.
  2384. @option{none} disables all overall measurement.
  2385. @end table
  2386. A description of each shown parameter follows:
  2387. @table @option
  2388. @item DC offset
  2389. Mean amplitude displacement from zero.
  2390. @item Min level
  2391. Minimal sample level.
  2392. @item Max level
  2393. Maximal sample level.
  2394. @item Min difference
  2395. Minimal difference between two consecutive samples.
  2396. @item Max difference
  2397. Maximal difference between two consecutive samples.
  2398. @item Mean difference
  2399. Mean difference between two consecutive samples.
  2400. The average of each difference between two consecutive samples.
  2401. @item RMS difference
  2402. Root Mean Square difference between two consecutive samples.
  2403. @item Peak level dB
  2404. @item RMS level dB
  2405. Standard peak and RMS level measured in dBFS.
  2406. @item RMS peak dB
  2407. @item RMS trough dB
  2408. Peak and trough values for RMS level measured over a short window.
  2409. @item Crest factor
  2410. Standard ratio of peak to RMS level (note: not in dB).
  2411. @item Flat factor
  2412. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2413. (i.e. either @var{Min level} or @var{Max level}).
  2414. @item Peak count
  2415. Number of occasions (not the number of samples) that the signal attained either
  2416. @var{Min level} or @var{Max level}.
  2417. @item Noise floor dB
  2418. Minimum local peak measured in dBFS over a short window.
  2419. @item Noise floor count
  2420. Number of occasions (not the number of samples) that the signal attained
  2421. @var{Noise floor}.
  2422. @item Entropy
  2423. Entropy measured across whole audio. Entropy of value near 1.0 is typically measured for white noise.
  2424. @item Bit depth
  2425. Overall bit depth of audio. Number of bits used for each sample.
  2426. @item Dynamic range
  2427. Measured dynamic range of audio in dB.
  2428. @item Zero crossings
  2429. Number of points where the waveform crosses the zero level axis.
  2430. @item Zero crossings rate
  2431. Rate of Zero crossings and number of audio samples.
  2432. @end table
  2433. @section asubboost
  2434. Boost subwoofer frequencies.
  2435. The filter accepts the following options:
  2436. @table @option
  2437. @item dry
  2438. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2439. Default value is 1.0.
  2440. @item wet
  2441. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2442. Default value is 1.0.
  2443. @item boost
  2444. Set max boost factor. Allowed range is from 1 to 12. Default value is 2.
  2445. @item decay
  2446. Set delay line decay gain value. Allowed range is from 0 to 1.
  2447. Default value is 0.0.
  2448. @item feedback
  2449. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2450. Default value is 0.9.
  2451. @item cutoff
  2452. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2453. Default value is 100.
  2454. @item slope
  2455. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2456. Default value is 0.5.
  2457. @item delay
  2458. Set delay. Allowed range is from 1 to 100.
  2459. Default value is 20.
  2460. @item channels
  2461. Set the channels to process. Default value is all available.
  2462. @end table
  2463. @subsection Commands
  2464. This filter supports the all above options as @ref{commands}.
  2465. @section asubcut
  2466. Cut subwoofer frequencies.
  2467. This filter allows to set custom, steeper
  2468. roll off than highpass filter, and thus is able to more attenuate
  2469. frequency content in stop-band.
  2470. The filter accepts the following options:
  2471. @table @option
  2472. @item cutoff
  2473. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2474. Default value is 20.
  2475. @item order
  2476. Set filter order. Available values are from 3 to 20.
  2477. Default value is 10.
  2478. @item level
  2479. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2480. @end table
  2481. @subsection Commands
  2482. This filter supports the all above options as @ref{commands}.
  2483. @section asupercut
  2484. Cut super frequencies.
  2485. The filter accepts the following options:
  2486. @table @option
  2487. @item cutoff
  2488. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2489. Default value is 20000.
  2490. @item order
  2491. Set filter order. Available values are from 3 to 20.
  2492. Default value is 10.
  2493. @item level
  2494. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2495. @end table
  2496. @subsection Commands
  2497. This filter supports the all above options as @ref{commands}.
  2498. @section asuperpass
  2499. Apply high order Butterworth band-pass filter.
  2500. The filter accepts the following options:
  2501. @table @option
  2502. @item centerf
  2503. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2504. Default value is 1000.
  2505. @item order
  2506. Set filter order. Available values are from 4 to 20.
  2507. Default value is 4.
  2508. @item qfactor
  2509. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2510. @item level
  2511. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2512. @end table
  2513. @subsection Commands
  2514. This filter supports the all above options as @ref{commands}.
  2515. @section asuperstop
  2516. Apply high order Butterworth band-stop filter.
  2517. The filter accepts the following options:
  2518. @table @option
  2519. @item centerf
  2520. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2521. Default value is 1000.
  2522. @item order
  2523. Set filter order. Available values are from 4 to 20.
  2524. Default value is 4.
  2525. @item qfactor
  2526. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2527. @item level
  2528. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2529. @end table
  2530. @subsection Commands
  2531. This filter supports the all above options as @ref{commands}.
  2532. @section atempo
  2533. Adjust audio tempo.
  2534. The filter accepts exactly one parameter, the audio tempo. If not
  2535. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2536. be in the [0.5, 100.0] range.
  2537. Note that tempo greater than 2 will skip some samples rather than
  2538. blend them in. If for any reason this is a concern it is always
  2539. possible to daisy-chain several instances of atempo to achieve the
  2540. desired product tempo.
  2541. @subsection Examples
  2542. @itemize
  2543. @item
  2544. Slow down audio to 80% tempo:
  2545. @example
  2546. atempo=0.8
  2547. @end example
  2548. @item
  2549. To speed up audio to 300% tempo:
  2550. @example
  2551. atempo=3
  2552. @end example
  2553. @item
  2554. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2555. @example
  2556. atempo=sqrt(3),atempo=sqrt(3)
  2557. @end example
  2558. @end itemize
  2559. @subsection Commands
  2560. This filter supports the following commands:
  2561. @table @option
  2562. @item tempo
  2563. Change filter tempo scale factor.
  2564. Syntax for the command is : "@var{tempo}"
  2565. @end table
  2566. @section atilt
  2567. Apply spectral tilt filter to audio stream.
  2568. This filter apply any spectral roll-off slope over any specified frequency band.
  2569. The filter accepts the following options:
  2570. @table @option
  2571. @item freq
  2572. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2573. @item slope
  2574. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2575. @item width
  2576. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2577. @item order
  2578. Set order of tilt filter.
  2579. @item level
  2580. Set input volume level. Allowed range is from 0 to 4.
  2581. Defalt is 1.
  2582. @end table
  2583. @subsection Commands
  2584. This filter supports the all above options as @ref{commands}.
  2585. @section atrim
  2586. Trim the input so that the output contains one continuous subpart of the input.
  2587. It accepts the following parameters:
  2588. @table @option
  2589. @item start
  2590. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2591. sample with the timestamp @var{start} will be the first sample in the output.
  2592. @item end
  2593. Specify time of the first audio sample that will be dropped, i.e. the
  2594. audio sample immediately preceding the one with the timestamp @var{end} will be
  2595. the last sample in the output.
  2596. @item start_pts
  2597. Same as @var{start}, except this option sets the start timestamp in samples
  2598. instead of seconds.
  2599. @item end_pts
  2600. Same as @var{end}, except this option sets the end timestamp in samples instead
  2601. of seconds.
  2602. @item duration
  2603. The maximum duration of the output in seconds.
  2604. @item start_sample
  2605. The number of the first sample that should be output.
  2606. @item end_sample
  2607. The number of the first sample that should be dropped.
  2608. @end table
  2609. @option{start}, @option{end}, and @option{duration} are expressed as time
  2610. duration specifications; see
  2611. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2612. Note that the first two sets of the start/end options and the @option{duration}
  2613. option look at the frame timestamp, while the _sample options simply count the
  2614. samples that pass through the filter. So start/end_pts and start/end_sample will
  2615. give different results when the timestamps are wrong, inexact or do not start at
  2616. zero. Also note that this filter does not modify the timestamps. If you wish
  2617. to have the output timestamps start at zero, insert the asetpts filter after the
  2618. atrim filter.
  2619. If multiple start or end options are set, this filter tries to be greedy and
  2620. keep all samples that match at least one of the specified constraints. To keep
  2621. only the part that matches all the constraints at once, chain multiple atrim
  2622. filters.
  2623. The defaults are such that all the input is kept. So it is possible to set e.g.
  2624. just the end values to keep everything before the specified time.
  2625. Examples:
  2626. @itemize
  2627. @item
  2628. Drop everything except the second minute of input:
  2629. @example
  2630. ffmpeg -i INPUT -af atrim=60:120
  2631. @end example
  2632. @item
  2633. Keep only the first 1000 samples:
  2634. @example
  2635. ffmpeg -i INPUT -af atrim=end_sample=1000
  2636. @end example
  2637. @end itemize
  2638. @section axcorrelate
  2639. Calculate normalized windowed cross-correlation between two input audio streams.
  2640. Resulted samples are always between -1 and 1 inclusive.
  2641. If result is 1 it means two input samples are highly correlated in that selected segment.
  2642. Result 0 means they are not correlated at all.
  2643. If result is -1 it means two input samples are out of phase, which means they cancel each
  2644. other.
  2645. The filter accepts the following options:
  2646. @table @option
  2647. @item size
  2648. Set size of segment over which cross-correlation is calculated.
  2649. Default is 256. Allowed range is from 2 to 131072.
  2650. @item algo
  2651. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2652. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2653. are always zero and thus need much less calculations to make.
  2654. This is generally not true, but is valid for typical audio streams.
  2655. @end table
  2656. @subsection Examples
  2657. @itemize
  2658. @item
  2659. Calculate correlation between channels in stereo audio stream:
  2660. @example
  2661. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2662. @end example
  2663. @end itemize
  2664. @section bandpass
  2665. Apply a two-pole Butterworth band-pass filter with central
  2666. frequency @var{frequency}, and (3dB-point) band-width width.
  2667. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2668. instead of the default: constant 0dB peak gain.
  2669. The filter roll off at 6dB per octave (20dB per decade).
  2670. The filter accepts the following options:
  2671. @table @option
  2672. @item frequency, f
  2673. Set the filter's central frequency. Default is @code{3000}.
  2674. @item csg
  2675. Constant skirt gain if set to 1. Defaults to 0.
  2676. @item width_type, t
  2677. Set method to specify band-width of filter.
  2678. @table @option
  2679. @item h
  2680. Hz
  2681. @item q
  2682. Q-Factor
  2683. @item o
  2684. octave
  2685. @item s
  2686. slope
  2687. @item k
  2688. kHz
  2689. @end table
  2690. @item width, w
  2691. Specify the band-width of a filter in width_type units.
  2692. @item mix, m
  2693. How much to use filtered signal in output. Default is 1.
  2694. Range is between 0 and 1.
  2695. @item channels, c
  2696. Specify which channels to filter, by default all available are filtered.
  2697. @item normalize, n
  2698. Normalize biquad coefficients, by default is disabled.
  2699. Enabling it will normalize magnitude response at DC to 0dB.
  2700. @item transform, a
  2701. Set transform type of IIR filter.
  2702. @table @option
  2703. @item di
  2704. @item dii
  2705. @item tdi
  2706. @item tdii
  2707. @item latt
  2708. @item svf
  2709. @item zdf
  2710. @end table
  2711. @item precision, r
  2712. Set precison of filtering.
  2713. @table @option
  2714. @item auto
  2715. Pick automatic sample format depending on surround filters.
  2716. @item s16
  2717. Always use signed 16-bit.
  2718. @item s32
  2719. Always use signed 32-bit.
  2720. @item f32
  2721. Always use float 32-bit.
  2722. @item f64
  2723. Always use float 64-bit.
  2724. @end table
  2725. @item block_size, b
  2726. Set block size used for reverse IIR processing. If this value is set to high enough
  2727. value (higher than impulse response length truncated when reaches near zero values) filtering
  2728. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2729. Note that filter delay will be exactly this many samples when set to non-zero value.
  2730. @end table
  2731. @subsection Commands
  2732. This filter supports the following commands:
  2733. @table @option
  2734. @item frequency, f
  2735. Change bandpass frequency.
  2736. Syntax for the command is : "@var{frequency}"
  2737. @item width_type, t
  2738. Change bandpass width_type.
  2739. Syntax for the command is : "@var{width_type}"
  2740. @item width, w
  2741. Change bandpass width.
  2742. Syntax for the command is : "@var{width}"
  2743. @item mix, m
  2744. Change bandpass mix.
  2745. Syntax for the command is : "@var{mix}"
  2746. @end table
  2747. @section bandreject
  2748. Apply a two-pole Butterworth band-reject filter with central
  2749. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2750. The filter roll off at 6dB per octave (20dB per decade).
  2751. The filter accepts the following options:
  2752. @table @option
  2753. @item frequency, f
  2754. Set the filter's central frequency. Default is @code{3000}.
  2755. @item width_type, t
  2756. Set method to specify band-width of filter.
  2757. @table @option
  2758. @item h
  2759. Hz
  2760. @item q
  2761. Q-Factor
  2762. @item o
  2763. octave
  2764. @item s
  2765. slope
  2766. @item k
  2767. kHz
  2768. @end table
  2769. @item width, w
  2770. Specify the band-width of a filter in width_type units.
  2771. @item mix, m
  2772. How much to use filtered signal in output. Default is 1.
  2773. Range is between 0 and 1.
  2774. @item channels, c
  2775. Specify which channels to filter, by default all available are filtered.
  2776. @item normalize, n
  2777. Normalize biquad coefficients, by default is disabled.
  2778. Enabling it will normalize magnitude response at DC to 0dB.
  2779. @item transform, a
  2780. Set transform type of IIR filter.
  2781. @table @option
  2782. @item di
  2783. @item dii
  2784. @item tdi
  2785. @item tdii
  2786. @item latt
  2787. @item svf
  2788. @item zdf
  2789. @end table
  2790. @item precision, r
  2791. Set precison of filtering.
  2792. @table @option
  2793. @item auto
  2794. Pick automatic sample format depending on surround filters.
  2795. @item s16
  2796. Always use signed 16-bit.
  2797. @item s32
  2798. Always use signed 32-bit.
  2799. @item f32
  2800. Always use float 32-bit.
  2801. @item f64
  2802. Always use float 64-bit.
  2803. @end table
  2804. @item block_size, b
  2805. Set block size used for reverse IIR processing. If this value is set to high enough
  2806. value (higher than impulse response length truncated when reaches near zero values) filtering
  2807. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2808. Note that filter delay will be exactly this many samples when set to non-zero value.
  2809. @end table
  2810. @subsection Commands
  2811. This filter supports the following commands:
  2812. @table @option
  2813. @item frequency, f
  2814. Change bandreject frequency.
  2815. Syntax for the command is : "@var{frequency}"
  2816. @item width_type, t
  2817. Change bandreject width_type.
  2818. Syntax for the command is : "@var{width_type}"
  2819. @item width, w
  2820. Change bandreject width.
  2821. Syntax for the command is : "@var{width}"
  2822. @item mix, m
  2823. Change bandreject mix.
  2824. Syntax for the command is : "@var{mix}"
  2825. @end table
  2826. @section bass, lowshelf
  2827. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2828. shelving filter with a response similar to that of a standard
  2829. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2830. The filter accepts the following options:
  2831. @table @option
  2832. @item gain, g
  2833. Give the gain at 0 Hz. Its useful range is about -20
  2834. (for a large cut) to +20 (for a large boost).
  2835. Beware of clipping when using a positive gain.
  2836. @item frequency, f
  2837. Set the filter's central frequency and so can be used
  2838. to extend or reduce the frequency range to be boosted or cut.
  2839. The default value is @code{100} Hz.
  2840. @item width_type, t
  2841. Set method to specify band-width of filter.
  2842. @table @option
  2843. @item h
  2844. Hz
  2845. @item q
  2846. Q-Factor
  2847. @item o
  2848. octave
  2849. @item s
  2850. slope
  2851. @item k
  2852. kHz
  2853. @end table
  2854. @item width, w
  2855. Determine how steep is the filter's shelf transition.
  2856. @item poles, p
  2857. Set number of poles. Default is 2.
  2858. @item mix, m
  2859. How much to use filtered signal in output. Default is 1.
  2860. Range is between 0 and 1.
  2861. @item channels, c
  2862. Specify which channels to filter, by default all available are filtered.
  2863. @item normalize, n
  2864. Normalize biquad coefficients, by default is disabled.
  2865. Enabling it will normalize magnitude response at DC to 0dB.
  2866. @item transform, a
  2867. Set transform type of IIR filter.
  2868. @table @option
  2869. @item di
  2870. @item dii
  2871. @item tdi
  2872. @item tdii
  2873. @item latt
  2874. @item svf
  2875. @item zdf
  2876. @end table
  2877. @item precision, r
  2878. Set precison of filtering.
  2879. @table @option
  2880. @item auto
  2881. Pick automatic sample format depending on surround filters.
  2882. @item s16
  2883. Always use signed 16-bit.
  2884. @item s32
  2885. Always use signed 32-bit.
  2886. @item f32
  2887. Always use float 32-bit.
  2888. @item f64
  2889. Always use float 64-bit.
  2890. @end table
  2891. @item block_size, b
  2892. Set block size used for reverse IIR processing. If this value is set to high enough
  2893. value (higher than impulse response length truncated when reaches near zero values) filtering
  2894. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2895. Note that filter delay will be exactly this many samples when set to non-zero value.
  2896. @end table
  2897. @subsection Commands
  2898. This filter supports the following commands:
  2899. @table @option
  2900. @item frequency, f
  2901. Change bass frequency.
  2902. Syntax for the command is : "@var{frequency}"
  2903. @item width_type, t
  2904. Change bass width_type.
  2905. Syntax for the command is : "@var{width_type}"
  2906. @item width, w
  2907. Change bass width.
  2908. Syntax for the command is : "@var{width}"
  2909. @item gain, g
  2910. Change bass gain.
  2911. Syntax for the command is : "@var{gain}"
  2912. @item mix, m
  2913. Change bass mix.
  2914. Syntax for the command is : "@var{mix}"
  2915. @end table
  2916. @section biquad
  2917. Apply a biquad IIR filter with the given coefficients.
  2918. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2919. are the numerator and denominator coefficients respectively.
  2920. and @var{channels}, @var{c} specify which channels to filter, by default all
  2921. available are filtered.
  2922. @subsection Commands
  2923. This filter supports the following commands:
  2924. @table @option
  2925. @item a0
  2926. @item a1
  2927. @item a2
  2928. @item b0
  2929. @item b1
  2930. @item b2
  2931. Change biquad parameter.
  2932. Syntax for the command is : "@var{value}"
  2933. @item mix, m
  2934. How much to use filtered signal in output. Default is 1.
  2935. Range is between 0 and 1.
  2936. @item channels, c
  2937. Specify which channels to filter, by default all available are filtered.
  2938. @item normalize, n
  2939. Normalize biquad coefficients, by default is disabled.
  2940. Enabling it will normalize magnitude response at DC to 0dB.
  2941. @item transform, a
  2942. Set transform type of IIR filter.
  2943. @table @option
  2944. @item di
  2945. @item dii
  2946. @item tdi
  2947. @item tdii
  2948. @item latt
  2949. @item svf
  2950. @item zdf
  2951. @end table
  2952. @item precision, r
  2953. Set precison of filtering.
  2954. @table @option
  2955. @item auto
  2956. Pick automatic sample format depending on surround filters.
  2957. @item s16
  2958. Always use signed 16-bit.
  2959. @item s32
  2960. Always use signed 32-bit.
  2961. @item f32
  2962. Always use float 32-bit.
  2963. @item f64
  2964. Always use float 64-bit.
  2965. @end table
  2966. @item block_size, b
  2967. Set block size used for reverse IIR processing. If this value is set to high enough
  2968. value (higher than impulse response length truncated when reaches near zero values) filtering
  2969. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2970. Note that filter delay will be exactly this many samples when set to non-zero value.
  2971. @end table
  2972. @section bs2b
  2973. Bauer stereo to binaural transformation, which improves headphone listening of
  2974. stereo audio records.
  2975. To enable compilation of this filter you need to configure FFmpeg with
  2976. @code{--enable-libbs2b}.
  2977. It accepts the following parameters:
  2978. @table @option
  2979. @item profile
  2980. Pre-defined crossfeed level.
  2981. @table @option
  2982. @item default
  2983. Default level (fcut=700, feed=50).
  2984. @item cmoy
  2985. Chu Moy circuit (fcut=700, feed=60).
  2986. @item jmeier
  2987. Jan Meier circuit (fcut=650, feed=95).
  2988. @end table
  2989. @item fcut
  2990. Cut frequency (in Hz).
  2991. @item feed
  2992. Feed level (in Hz).
  2993. @end table
  2994. @section channelmap
  2995. Remap input channels to new locations.
  2996. It accepts the following parameters:
  2997. @table @option
  2998. @item map
  2999. Map channels from input to output. The argument is a '|'-separated list of
  3000. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  3001. @var{in_channel} form. @var{in_channel} can be either the name of the input
  3002. channel (e.g. FL for front left) or its index in the input channel layout.
  3003. @var{out_channel} is the name of the output channel or its index in the output
  3004. channel layout. If @var{out_channel} is not given then it is implicitly an
  3005. index, starting with zero and increasing by one for each mapping.
  3006. @item channel_layout
  3007. The channel layout of the output stream.
  3008. @end table
  3009. If no mapping is present, the filter will implicitly map input channels to
  3010. output channels, preserving indices.
  3011. @subsection Examples
  3012. @itemize
  3013. @item
  3014. For example, assuming a 5.1+downmix input MOV file,
  3015. @example
  3016. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  3017. @end example
  3018. will create an output WAV file tagged as stereo from the downmix channels of
  3019. the input.
  3020. @item
  3021. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  3022. @example
  3023. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  3024. @end example
  3025. @end itemize
  3026. @section channelsplit
  3027. Split each channel from an input audio stream into a separate output stream.
  3028. It accepts the following parameters:
  3029. @table @option
  3030. @item channel_layout
  3031. The channel layout of the input stream. The default is "stereo".
  3032. @item channels
  3033. A channel layout describing the channels to be extracted as separate output streams
  3034. or "all" to extract each input channel as a separate stream. The default is "all".
  3035. Choosing channels not present in channel layout in the input will result in an error.
  3036. @end table
  3037. @subsection Examples
  3038. @itemize
  3039. @item
  3040. For example, assuming a stereo input MP3 file,
  3041. @example
  3042. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  3043. @end example
  3044. will create an output Matroska file with two audio streams, one containing only
  3045. the left channel and the other the right channel.
  3046. @item
  3047. Split a 5.1 WAV file into per-channel files:
  3048. @example
  3049. ffmpeg -i in.wav -filter_complex
  3050. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  3051. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  3052. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  3053. side_right.wav
  3054. @end example
  3055. @item
  3056. Extract only LFE from a 5.1 WAV file:
  3057. @example
  3058. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  3059. -map '[LFE]' lfe.wav
  3060. @end example
  3061. @end itemize
  3062. @section chorus
  3063. Add a chorus effect to the audio.
  3064. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  3065. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  3066. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  3067. The modulation depth defines the range the modulated delay is played before or after
  3068. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  3069. sound tuned around the original one, like in a chorus where some vocals are slightly
  3070. off key.
  3071. It accepts the following parameters:
  3072. @table @option
  3073. @item in_gain
  3074. Set input gain. Default is 0.4.
  3075. @item out_gain
  3076. Set output gain. Default is 0.4.
  3077. @item delays
  3078. Set delays. A typical delay is around 40ms to 60ms.
  3079. @item decays
  3080. Set decays.
  3081. @item speeds
  3082. Set speeds.
  3083. @item depths
  3084. Set depths.
  3085. @end table
  3086. @subsection Examples
  3087. @itemize
  3088. @item
  3089. A single delay:
  3090. @example
  3091. chorus=0.7:0.9:55:0.4:0.25:2
  3092. @end example
  3093. @item
  3094. Two delays:
  3095. @example
  3096. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3097. @end example
  3098. @item
  3099. Fuller sounding chorus with three delays:
  3100. @example
  3101. 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
  3102. @end example
  3103. @end itemize
  3104. @section compand
  3105. Compress or expand the audio's dynamic range.
  3106. It accepts the following parameters:
  3107. @table @option
  3108. @item attacks
  3109. @item decays
  3110. A list of times in seconds for each channel over which the instantaneous level
  3111. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3112. increase of volume and @var{decays} refers to decrease of volume. For most
  3113. situations, the attack time (response to the audio getting louder) should be
  3114. shorter than the decay time, because the human ear is more sensitive to sudden
  3115. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3116. a typical value for decay is 0.8 seconds.
  3117. If specified number of attacks & decays is lower than number of channels, the last
  3118. set attack/decay will be used for all remaining channels.
  3119. @item points
  3120. A list of points for the transfer function, specified in dB relative to the
  3121. maximum possible signal amplitude. Each key points list must be defined using
  3122. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3123. @code{x0/y0 x1/y1 x2/y2 ....}
  3124. The input values must be in strictly increasing order but the transfer function
  3125. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3126. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3127. function are @code{-70/-70|-60/-20|1/0}.
  3128. @item soft-knee
  3129. Set the curve radius in dB for all joints. It defaults to 0.01.
  3130. @item gain
  3131. Set the additional gain in dB to be applied at all points on the transfer
  3132. function. This allows for easy adjustment of the overall gain.
  3133. It defaults to 0.
  3134. @item volume
  3135. Set an initial volume, in dB, to be assumed for each channel when filtering
  3136. starts. This permits the user to supply a nominal level initially, so that, for
  3137. example, a very large gain is not applied to initial signal levels before the
  3138. companding has begun to operate. A typical value for audio which is initially
  3139. quiet is -90 dB. It defaults to 0.
  3140. @item delay
  3141. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3142. delayed before being fed to the volume adjuster. Specifying a delay
  3143. approximately equal to the attack/decay times allows the filter to effectively
  3144. operate in predictive rather than reactive mode. It defaults to 0.
  3145. @end table
  3146. @subsection Examples
  3147. @itemize
  3148. @item
  3149. Make music with both quiet and loud passages suitable for listening to in a
  3150. noisy environment:
  3151. @example
  3152. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3153. @end example
  3154. Another example for audio with whisper and explosion parts:
  3155. @example
  3156. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3157. @end example
  3158. @item
  3159. A noise gate for when the noise is at a lower level than the signal:
  3160. @example
  3161. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3162. @end example
  3163. @item
  3164. Here is another noise gate, this time for when the noise is at a higher level
  3165. than the signal (making it, in some ways, similar to squelch):
  3166. @example
  3167. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3168. @end example
  3169. @item
  3170. 2:1 compression starting at -6dB:
  3171. @example
  3172. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3173. @end example
  3174. @item
  3175. 2:1 compression starting at -9dB:
  3176. @example
  3177. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3178. @end example
  3179. @item
  3180. 2:1 compression starting at -12dB:
  3181. @example
  3182. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3183. @end example
  3184. @item
  3185. 2:1 compression starting at -18dB:
  3186. @example
  3187. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3188. @end example
  3189. @item
  3190. 3:1 compression starting at -15dB:
  3191. @example
  3192. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3193. @end example
  3194. @item
  3195. Compressor/Gate:
  3196. @example
  3197. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3198. @end example
  3199. @item
  3200. Expander:
  3201. @example
  3202. 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
  3203. @end example
  3204. @item
  3205. Hard limiter at -6dB:
  3206. @example
  3207. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3208. @end example
  3209. @item
  3210. Hard limiter at -12dB:
  3211. @example
  3212. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3213. @end example
  3214. @item
  3215. Hard noise gate at -35 dB:
  3216. @example
  3217. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3218. @end example
  3219. @item
  3220. Soft limiter:
  3221. @example
  3222. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3223. @end example
  3224. @end itemize
  3225. @section compensationdelay
  3226. Compensation Delay Line is a metric based delay to compensate differing
  3227. positions of microphones or speakers.
  3228. For example, you have recorded guitar with two microphones placed in
  3229. different locations. Because the front of sound wave has fixed speed in
  3230. normal conditions, the phasing of microphones can vary and depends on
  3231. their location and interposition. The best sound mix can be achieved when
  3232. these microphones are in phase (synchronized). Note that a distance of
  3233. ~30 cm between microphones makes one microphone capture the signal in
  3234. antiphase to the other microphone. That makes the final mix sound moody.
  3235. This filter helps to solve phasing problems by adding different delays
  3236. to each microphone track and make them synchronized.
  3237. The best result can be reached when you take one track as base and
  3238. synchronize other tracks one by one with it.
  3239. Remember that synchronization/delay tolerance depends on sample rate, too.
  3240. Higher sample rates will give more tolerance.
  3241. The filter accepts the following parameters:
  3242. @table @option
  3243. @item mm
  3244. Set millimeters distance. This is compensation distance for fine tuning.
  3245. Default is 0.
  3246. @item cm
  3247. Set cm distance. This is compensation distance for tightening distance setup.
  3248. Default is 0.
  3249. @item m
  3250. Set meters distance. This is compensation distance for hard distance setup.
  3251. Default is 0.
  3252. @item dry
  3253. Set dry amount. Amount of unprocessed (dry) signal.
  3254. Default is 0.
  3255. @item wet
  3256. Set wet amount. Amount of processed (wet) signal.
  3257. Default is 1.
  3258. @item temp
  3259. Set temperature in degrees Celsius. This is the temperature of the environment.
  3260. Default is 20.
  3261. @end table
  3262. @subsection Commands
  3263. This filter supports the all above options as @ref{commands}.
  3264. @section crossfeed
  3265. Apply headphone crossfeed filter.
  3266. Crossfeed is the process of blending the left and right channels of stereo
  3267. audio recording.
  3268. It is mainly used to reduce extreme stereo separation of low frequencies.
  3269. The intent is to produce more speaker like sound to the listener.
  3270. The filter accepts the following options:
  3271. @table @option
  3272. @item strength
  3273. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3274. This sets gain of low shelf filter for side part of stereo image.
  3275. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3276. @item range
  3277. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3278. This sets cut off frequency of low shelf filter. Default is cut off near
  3279. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3280. @item slope
  3281. Set curve slope of low shelf filter. Default is 0.5.
  3282. Allowed range is from 0.01 to 1.
  3283. @item level_in
  3284. Set input gain. Default is 0.9.
  3285. @item level_out
  3286. Set output gain. Default is 1.
  3287. @item block_size
  3288. Set block size used for reverse IIR processing. If this value is set to high enough
  3289. value (higher than impulse response length truncated when reaches near zero values) filtering
  3290. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3291. Note that filter delay will be exactly this many samples when set to non-zero value.
  3292. @end table
  3293. @subsection Commands
  3294. This filter supports the all above options as @ref{commands}.
  3295. @section crystalizer
  3296. Simple algorithm for audio noise sharpening.
  3297. This filter linearly increases differences betweeen each audio sample.
  3298. The filter accepts the following options:
  3299. @table @option
  3300. @item i
  3301. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3302. (unchanged sound) to 10.0 (maximum effect).
  3303. To inverse filtering use negative value.
  3304. @item c
  3305. Enable clipping. By default is enabled.
  3306. @end table
  3307. @subsection Commands
  3308. This filter supports the all above options as @ref{commands}.
  3309. @section dcshift
  3310. Apply a DC shift to the audio.
  3311. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3312. in the recording chain) from the audio. The effect of a DC offset is reduced
  3313. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3314. a signal has a DC offset.
  3315. @table @option
  3316. @item shift
  3317. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3318. the audio.
  3319. @item limitergain
  3320. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3321. used to prevent clipping.
  3322. @end table
  3323. @section deesser
  3324. Apply de-essing to the audio samples.
  3325. @table @option
  3326. @item i
  3327. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3328. Default is 0.
  3329. @item m
  3330. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3331. Default is 0.5.
  3332. @item f
  3333. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3334. Default is 0.5.
  3335. @item s
  3336. Set the output mode.
  3337. It accepts the following values:
  3338. @table @option
  3339. @item i
  3340. Pass input unchanged.
  3341. @item o
  3342. Pass ess filtered out.
  3343. @item e
  3344. Pass only ess.
  3345. Default value is @var{o}.
  3346. @end table
  3347. @end table
  3348. @section dialoguenhance
  3349. Enhance dialogue in stereo audio.
  3350. This filter accepts stereo input and produce surround (3.0) channels output.
  3351. The newly produced front center channel have enhanced speech dialogue originally
  3352. available in both stereo channels.
  3353. This filter outputs front left and front right channels same as available in stereo input.
  3354. The filter accepts the following options:
  3355. @table @option
  3356. @item original
  3357. Set the original center factor to keep in front center channel output.
  3358. Allowed range is from 0 to 1. Default value is 1.
  3359. @item enhance
  3360. Set the dialogue enhance factor to put in front center channel output.
  3361. Allowed range is from 0 to 3. Default value is 1.
  3362. @item voice
  3363. Set the voice detection factor.
  3364. Allowed range is from 2 to 32. Default value is 2.
  3365. @end table
  3366. @subsection Commands
  3367. This filter supports the all above options as @ref{commands}.
  3368. @section drmeter
  3369. Measure audio dynamic range.
  3370. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3371. is found in transition material. And anything less that 8 have very poor dynamics
  3372. and is very compressed.
  3373. The filter accepts the following options:
  3374. @table @option
  3375. @item length
  3376. Set window length in seconds used to split audio into segments of equal length.
  3377. Default is 3 seconds.
  3378. @end table
  3379. @section dynaudnorm
  3380. Dynamic Audio Normalizer.
  3381. This filter applies a certain amount of gain to the input audio in order
  3382. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3383. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3384. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3385. This allows for applying extra gain to the "quiet" sections of the audio
  3386. while avoiding distortions or clipping the "loud" sections. In other words:
  3387. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3388. sections, in the sense that the volume of each section is brought to the
  3389. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3390. this goal *without* applying "dynamic range compressing". It will retain 100%
  3391. of the dynamic range *within* each section of the audio file.
  3392. @table @option
  3393. @item framelen, f
  3394. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3395. Default is 500 milliseconds.
  3396. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3397. referred to as frames. This is required, because a peak magnitude has no
  3398. meaning for just a single sample value. Instead, we need to determine the
  3399. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3400. normalizer would simply use the peak magnitude of the complete file, the
  3401. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3402. frame. The length of a frame is specified in milliseconds. By default, the
  3403. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3404. been found to give good results with most files.
  3405. Note that the exact frame length, in number of samples, will be determined
  3406. automatically, based on the sampling rate of the individual input audio file.
  3407. @item gausssize, g
  3408. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3409. number. Default is 31.
  3410. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3411. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3412. is specified in frames, centered around the current frame. For the sake of
  3413. simplicity, this must be an odd number. Consequently, the default value of 31
  3414. takes into account the current frame, as well as the 15 preceding frames and
  3415. the 15 subsequent frames. Using a larger window results in a stronger
  3416. smoothing effect and thus in less gain variation, i.e. slower gain
  3417. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3418. effect and thus in more gain variation, i.e. faster gain adaptation.
  3419. In other words, the more you increase this value, the more the Dynamic Audio
  3420. Normalizer will behave like a "traditional" normalization filter. On the
  3421. contrary, the more you decrease this value, the more the Dynamic Audio
  3422. Normalizer will behave like a dynamic range compressor.
  3423. @item peak, p
  3424. Set the target peak value. This specifies the highest permissible magnitude
  3425. level for the normalized audio input. This filter will try to approach the
  3426. target peak magnitude as closely as possible, but at the same time it also
  3427. makes sure that the normalized signal will never exceed the peak magnitude.
  3428. A frame's maximum local gain factor is imposed directly by the target peak
  3429. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3430. It is not recommended to go above this value.
  3431. @item maxgain, m
  3432. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3433. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3434. factor for each input frame, i.e. the maximum gain factor that does not
  3435. result in clipping or distortion. The maximum gain factor is determined by
  3436. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3437. additionally bounds the frame's maximum gain factor by a predetermined
  3438. (global) maximum gain factor. This is done in order to avoid excessive gain
  3439. factors in "silent" or almost silent frames. By default, the maximum gain
  3440. factor is 10.0, For most inputs the default value should be sufficient and
  3441. it usually is not recommended to increase this value. Though, for input
  3442. with an extremely low overall volume level, it may be necessary to allow even
  3443. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3444. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3445. Instead, a "sigmoid" threshold function will be applied. This way, the
  3446. gain factors will smoothly approach the threshold value, but never exceed that
  3447. value.
  3448. @item targetrms, r
  3449. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3450. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3451. This means that the maximum local gain factor for each frame is defined
  3452. (only) by the frame's highest magnitude sample. This way, the samples can
  3453. be amplified as much as possible without exceeding the maximum signal
  3454. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3455. Normalizer can also take into account the frame's root mean square,
  3456. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3457. determine the power of a time-varying signal. It is therefore considered
  3458. that the RMS is a better approximation of the "perceived loudness" than
  3459. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3460. frames to a constant RMS value, a uniform "perceived loudness" can be
  3461. established. If a target RMS value has been specified, a frame's local gain
  3462. factor is defined as the factor that would result in exactly that RMS value.
  3463. Note, however, that the maximum local gain factor is still restricted by the
  3464. frame's highest magnitude sample, in order to prevent clipping.
  3465. @item coupling, n
  3466. Enable channels coupling. By default is enabled.
  3467. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3468. amount. This means the same gain factor will be applied to all channels, i.e.
  3469. the maximum possible gain factor is determined by the "loudest" channel.
  3470. However, in some recordings, it may happen that the volume of the different
  3471. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3472. In this case, this option can be used to disable the channel coupling. This way,
  3473. the gain factor will be determined independently for each channel, depending
  3474. only on the individual channel's highest magnitude sample. This allows for
  3475. harmonizing the volume of the different channels.
  3476. @item correctdc, c
  3477. Enable DC bias correction. By default is disabled.
  3478. An audio signal (in the time domain) is a sequence of sample values.
  3479. In the Dynamic Audio Normalizer these sample values are represented in the
  3480. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3481. audio signal, or "waveform", should be centered around the zero point.
  3482. That means if we calculate the mean value of all samples in a file, or in a
  3483. single frame, then the result should be 0.0 or at least very close to that
  3484. value. If, however, there is a significant deviation of the mean value from
  3485. 0.0, in either positive or negative direction, this is referred to as a
  3486. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3487. Audio Normalizer provides optional DC bias correction.
  3488. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3489. the mean value, or "DC correction" offset, of each input frame and subtract
  3490. that value from all of the frame's sample values which ensures those samples
  3491. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3492. boundaries, the DC correction offset values will be interpolated smoothly
  3493. between neighbouring frames.
  3494. @item altboundary, b
  3495. Enable alternative boundary mode. By default is disabled.
  3496. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3497. around each frame. This includes the preceding frames as well as the
  3498. subsequent frames. However, for the "boundary" frames, located at the very
  3499. beginning and at the very end of the audio file, not all neighbouring
  3500. frames are available. In particular, for the first few frames in the audio
  3501. file, the preceding frames are not known. And, similarly, for the last few
  3502. frames in the audio file, the subsequent frames are not known. Thus, the
  3503. question arises which gain factors should be assumed for the missing frames
  3504. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3505. to deal with this situation. The default boundary mode assumes a gain factor
  3506. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3507. "fade out" at the beginning and at the end of the input, respectively.
  3508. @item compress, s
  3509. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3510. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3511. compression. This means that signal peaks will not be pruned and thus the
  3512. full dynamic range will be retained within each local neighbourhood. However,
  3513. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3514. normalization algorithm with a more "traditional" compression.
  3515. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3516. (thresholding) function. If (and only if) the compression feature is enabled,
  3517. all input frames will be processed by a soft knee thresholding function prior
  3518. to the actual normalization process. Put simply, the thresholding function is
  3519. going to prune all samples whose magnitude exceeds a certain threshold value.
  3520. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3521. value. Instead, the threshold value will be adjusted for each individual
  3522. frame.
  3523. In general, smaller parameters result in stronger compression, and vice versa.
  3524. Values below 3.0 are not recommended, because audible distortion may appear.
  3525. @item threshold, t
  3526. Set the target threshold value. This specifies the lowest permissible
  3527. magnitude level for the audio input which will be normalized.
  3528. If input frame volume is above this value frame will be normalized.
  3529. Otherwise frame may not be normalized at all. The default value is set
  3530. to 0, which means all input frames will be normalized.
  3531. This option is mostly useful if digital noise is not wanted to be amplified.
  3532. @item channels, h
  3533. Specify which channels to filter, by default all available channels are filtered.
  3534. @item overlap, o
  3535. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3536. Using >0 and <1 values will make less conservative gain adjustments, like
  3537. when framelen option is set to smaller value, if framelen option value is
  3538. compensated for non-zero overlap then gain adjustments will be smoother across time
  3539. compared to zero overlap case.
  3540. @end table
  3541. @subsection Commands
  3542. This filter supports the all above options as @ref{commands}.
  3543. @section earwax
  3544. Make audio easier to listen to on headphones.
  3545. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3546. so that when listened to on headphones the stereo image is moved from
  3547. inside your head (standard for headphones) to outside and in front of
  3548. the listener (standard for speakers).
  3549. Ported from SoX.
  3550. @section equalizer
  3551. Apply a two-pole peaking equalisation (EQ) filter. With this
  3552. filter, the signal-level at and around a selected frequency can
  3553. be increased or decreased, whilst (unlike bandpass and bandreject
  3554. filters) that at all other frequencies is unchanged.
  3555. In order to produce complex equalisation curves, this filter can
  3556. be given several times, each with a different central frequency.
  3557. The filter accepts the following options:
  3558. @table @option
  3559. @item frequency, f
  3560. Set the filter's central frequency in Hz.
  3561. @item width_type, t
  3562. Set method to specify band-width of filter.
  3563. @table @option
  3564. @item h
  3565. Hz
  3566. @item q
  3567. Q-Factor
  3568. @item o
  3569. octave
  3570. @item s
  3571. slope
  3572. @item k
  3573. kHz
  3574. @end table
  3575. @item width, w
  3576. Specify the band-width of a filter in width_type units.
  3577. @item gain, g
  3578. Set the required gain or attenuation in dB.
  3579. Beware of clipping when using a positive gain.
  3580. @item mix, m
  3581. How much to use filtered signal in output. Default is 1.
  3582. Range is between 0 and 1.
  3583. @item channels, c
  3584. Specify which channels to filter, by default all available are filtered.
  3585. @item normalize, n
  3586. Normalize biquad coefficients, by default is disabled.
  3587. Enabling it will normalize magnitude response at DC to 0dB.
  3588. @item transform, a
  3589. Set transform type of IIR filter.
  3590. @table @option
  3591. @item di
  3592. @item dii
  3593. @item tdi
  3594. @item tdii
  3595. @item latt
  3596. @item svf
  3597. @item zdf
  3598. @end table
  3599. @item precision, r
  3600. Set precison of filtering.
  3601. @table @option
  3602. @item auto
  3603. Pick automatic sample format depending on surround filters.
  3604. @item s16
  3605. Always use signed 16-bit.
  3606. @item s32
  3607. Always use signed 32-bit.
  3608. @item f32
  3609. Always use float 32-bit.
  3610. @item f64
  3611. Always use float 64-bit.
  3612. @end table
  3613. @item block_size, b
  3614. Set block size used for reverse IIR processing. If this value is set to high enough
  3615. value (higher than impulse response length truncated when reaches near zero values) filtering
  3616. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3617. Note that filter delay will be exactly this many samples when set to non-zero value.
  3618. @end table
  3619. @subsection Examples
  3620. @itemize
  3621. @item
  3622. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3623. @example
  3624. equalizer=f=1000:t=h:width=200:g=-10
  3625. @end example
  3626. @item
  3627. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3628. @example
  3629. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3630. @end example
  3631. @end itemize
  3632. @subsection Commands
  3633. This filter supports the following commands:
  3634. @table @option
  3635. @item frequency, f
  3636. Change equalizer frequency.
  3637. Syntax for the command is : "@var{frequency}"
  3638. @item width_type, t
  3639. Change equalizer width_type.
  3640. Syntax for the command is : "@var{width_type}"
  3641. @item width, w
  3642. Change equalizer width.
  3643. Syntax for the command is : "@var{width}"
  3644. @item gain, g
  3645. Change equalizer gain.
  3646. Syntax for the command is : "@var{gain}"
  3647. @item mix, m
  3648. Change equalizer mix.
  3649. Syntax for the command is : "@var{mix}"
  3650. @end table
  3651. @section extrastereo
  3652. Linearly increases the difference between left and right channels which
  3653. adds some sort of "live" effect to playback.
  3654. The filter accepts the following options:
  3655. @table @option
  3656. @item m
  3657. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3658. (average of both channels), with 1.0 sound will be unchanged, with
  3659. -1.0 left and right channels will be swapped.
  3660. @item c
  3661. Enable clipping. By default is enabled.
  3662. @end table
  3663. @subsection Commands
  3664. This filter supports the all above options as @ref{commands}.
  3665. @section firequalizer
  3666. Apply FIR Equalization using arbitrary frequency response.
  3667. The filter accepts the following option:
  3668. @table @option
  3669. @item gain
  3670. Set gain curve equation (in dB). The expression can contain variables:
  3671. @table @option
  3672. @item f
  3673. the evaluated frequency
  3674. @item sr
  3675. sample rate
  3676. @item ch
  3677. channel number, set to 0 when multichannels evaluation is disabled
  3678. @item chid
  3679. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3680. multichannels evaluation is disabled
  3681. @item chs
  3682. number of channels
  3683. @item chlayout
  3684. channel_layout, see libavutil/channel_layout.h
  3685. @end table
  3686. and functions:
  3687. @table @option
  3688. @item gain_interpolate(f)
  3689. interpolate gain on frequency f based on gain_entry
  3690. @item cubic_interpolate(f)
  3691. same as gain_interpolate, but smoother
  3692. @end table
  3693. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3694. @item gain_entry
  3695. Set gain entry for gain_interpolate function. The expression can
  3696. contain functions:
  3697. @table @option
  3698. @item entry(f, g)
  3699. store gain entry at frequency f with value g
  3700. @end table
  3701. This option is also available as command.
  3702. @item delay
  3703. Set filter delay in seconds. Higher value means more accurate.
  3704. Default is @code{0.01}.
  3705. @item accuracy
  3706. Set filter accuracy in Hz. Lower value means more accurate.
  3707. Default is @code{5}.
  3708. @item wfunc
  3709. Set window function. Acceptable values are:
  3710. @table @option
  3711. @item rectangular
  3712. rectangular window, useful when gain curve is already smooth
  3713. @item hann
  3714. hann window (default)
  3715. @item hamming
  3716. hamming window
  3717. @item blackman
  3718. blackman window
  3719. @item nuttall3
  3720. 3-terms continuous 1st derivative nuttall window
  3721. @item mnuttall3
  3722. minimum 3-terms discontinuous nuttall window
  3723. @item nuttall
  3724. 4-terms continuous 1st derivative nuttall window
  3725. @item bnuttall
  3726. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3727. @item bharris
  3728. blackman-harris window
  3729. @item tukey
  3730. tukey window
  3731. @end table
  3732. @item fixed
  3733. If enabled, use fixed number of audio samples. This improves speed when
  3734. filtering with large delay. Default is disabled.
  3735. @item multi
  3736. Enable multichannels evaluation on gain. Default is disabled.
  3737. @item zero_phase
  3738. Enable zero phase mode by subtracting timestamp to compensate delay.
  3739. Default is disabled.
  3740. @item scale
  3741. Set scale used by gain. Acceptable values are:
  3742. @table @option
  3743. @item linlin
  3744. linear frequency, linear gain
  3745. @item linlog
  3746. linear frequency, logarithmic (in dB) gain (default)
  3747. @item loglin
  3748. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3749. @item loglog
  3750. logarithmic frequency, logarithmic gain
  3751. @end table
  3752. @item dumpfile
  3753. Set file for dumping, suitable for gnuplot.
  3754. @item dumpscale
  3755. Set scale for dumpfile. Acceptable values are same with scale option.
  3756. Default is linlog.
  3757. @item fft2
  3758. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3759. Default is disabled.
  3760. @item min_phase
  3761. Enable minimum phase impulse response. Default is disabled.
  3762. @end table
  3763. @subsection Examples
  3764. @itemize
  3765. @item
  3766. lowpass at 1000 Hz:
  3767. @example
  3768. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3769. @end example
  3770. @item
  3771. lowpass at 1000 Hz with gain_entry:
  3772. @example
  3773. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3774. @end example
  3775. @item
  3776. custom equalization:
  3777. @example
  3778. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3779. @end example
  3780. @item
  3781. higher delay with zero phase to compensate delay:
  3782. @example
  3783. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3784. @end example
  3785. @item
  3786. lowpass on left channel, highpass on right channel:
  3787. @example
  3788. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3789. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3790. @end example
  3791. @end itemize
  3792. @section flanger
  3793. Apply a flanging effect to the audio.
  3794. The filter accepts the following options:
  3795. @table @option
  3796. @item delay
  3797. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3798. @item depth
  3799. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3800. @item regen
  3801. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3802. Default value is 0.
  3803. @item width
  3804. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3805. Default value is 71.
  3806. @item speed
  3807. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3808. @item shape
  3809. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3810. Default value is @var{sinusoidal}.
  3811. @item phase
  3812. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3813. Default value is 25.
  3814. @item interp
  3815. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3816. Default is @var{linear}.
  3817. @end table
  3818. @section haas
  3819. Apply Haas effect to audio.
  3820. Note that this makes most sense to apply on mono signals.
  3821. With this filter applied to mono signals it give some directionality and
  3822. stretches its stereo image.
  3823. The filter accepts the following options:
  3824. @table @option
  3825. @item level_in
  3826. Set input level. By default is @var{1}, or 0dB
  3827. @item level_out
  3828. Set output level. By default is @var{1}, or 0dB.
  3829. @item side_gain
  3830. Set gain applied to side part of signal. By default is @var{1}.
  3831. @item middle_source
  3832. Set kind of middle source. Can be one of the following:
  3833. @table @samp
  3834. @item left
  3835. Pick left channel.
  3836. @item right
  3837. Pick right channel.
  3838. @item mid
  3839. Pick middle part signal of stereo image.
  3840. @item side
  3841. Pick side part signal of stereo image.
  3842. @end table
  3843. @item middle_phase
  3844. Change middle phase. By default is disabled.
  3845. @item left_delay
  3846. Set left channel delay. By default is @var{2.05} milliseconds.
  3847. @item left_balance
  3848. Set left channel balance. By default is @var{-1}.
  3849. @item left_gain
  3850. Set left channel gain. By default is @var{1}.
  3851. @item left_phase
  3852. Change left phase. By default is disabled.
  3853. @item right_delay
  3854. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3855. @item right_balance
  3856. Set right channel balance. By default is @var{1}.
  3857. @item right_gain
  3858. Set right channel gain. By default is @var{1}.
  3859. @item right_phase
  3860. Change right phase. By default is enabled.
  3861. @end table
  3862. @section hdcd
  3863. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3864. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3865. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3866. of HDCD, and detects the Transient Filter flag.
  3867. @example
  3868. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3869. @end example
  3870. When using the filter with wav, note the default encoding for wav is 16-bit,
  3871. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3872. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3873. @example
  3874. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3875. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3876. @end example
  3877. The filter accepts the following options:
  3878. @table @option
  3879. @item disable_autoconvert
  3880. Disable any automatic format conversion or resampling in the filter graph.
  3881. @item process_stereo
  3882. Process the stereo channels together. If target_gain does not match between
  3883. channels, consider it invalid and use the last valid target_gain.
  3884. @item cdt_ms
  3885. Set the code detect timer period in ms.
  3886. @item force_pe
  3887. Always extend peaks above -3dBFS even if PE isn't signaled.
  3888. @item analyze_mode
  3889. Replace audio with a solid tone and adjust the amplitude to signal some
  3890. specific aspect of the decoding process. The output file can be loaded in
  3891. an audio editor alongside the original to aid analysis.
  3892. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3893. Modes are:
  3894. @table @samp
  3895. @item 0, off
  3896. Disabled
  3897. @item 1, lle
  3898. Gain adjustment level at each sample
  3899. @item 2, pe
  3900. Samples where peak extend occurs
  3901. @item 3, cdt
  3902. Samples where the code detect timer is active
  3903. @item 4, tgm
  3904. Samples where the target gain does not match between channels
  3905. @end table
  3906. @end table
  3907. @section headphone
  3908. Apply head-related transfer functions (HRTFs) to create virtual
  3909. loudspeakers around the user for binaural listening via headphones.
  3910. The HRIRs are provided via additional streams, for each channel
  3911. one stereo input stream is needed.
  3912. The filter accepts the following options:
  3913. @table @option
  3914. @item map
  3915. Set mapping of input streams for convolution.
  3916. The argument is a '|'-separated list of channel names in order as they
  3917. are given as additional stream inputs for filter.
  3918. This also specify number of input streams. Number of input streams
  3919. must be not less than number of channels in first stream plus one.
  3920. @item gain
  3921. Set gain applied to audio. Value is in dB. Default is 0.
  3922. @item type
  3923. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3924. processing audio in time domain which is slow.
  3925. @var{freq} is processing audio in frequency domain which is fast.
  3926. Default is @var{freq}.
  3927. @item lfe
  3928. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3929. @item size
  3930. Set size of frame in number of samples which will be processed at once.
  3931. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3932. @item hrir
  3933. Set format of hrir stream.
  3934. Default value is @var{stereo}. Alternative value is @var{multich}.
  3935. If value is set to @var{stereo}, number of additional streams should
  3936. be greater or equal to number of input channels in first input stream.
  3937. Also each additional stream should have stereo number of channels.
  3938. If value is set to @var{multich}, number of additional streams should
  3939. be exactly one. Also number of input channels of additional stream
  3940. should be equal or greater than twice number of channels of first input
  3941. stream.
  3942. @end table
  3943. @subsection Examples
  3944. @itemize
  3945. @item
  3946. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3947. each amovie filter use stereo file with IR coefficients as input.
  3948. The files give coefficients for each position of virtual loudspeaker:
  3949. @example
  3950. ffmpeg -i input.wav
  3951. -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"
  3952. output.wav
  3953. @end example
  3954. @item
  3955. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3956. but now in @var{multich} @var{hrir} format.
  3957. @example
  3958. 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"
  3959. output.wav
  3960. @end example
  3961. @end itemize
  3962. @section highpass
  3963. Apply a high-pass filter with 3dB point frequency.
  3964. The filter can be either single-pole, or double-pole (the default).
  3965. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3966. The filter accepts the following options:
  3967. @table @option
  3968. @item frequency, f
  3969. Set frequency in Hz. Default is 3000.
  3970. @item poles, p
  3971. Set number of poles. Default is 2.
  3972. @item width_type, t
  3973. Set method to specify band-width of filter.
  3974. @table @option
  3975. @item h
  3976. Hz
  3977. @item q
  3978. Q-Factor
  3979. @item o
  3980. octave
  3981. @item s
  3982. slope
  3983. @item k
  3984. kHz
  3985. @end table
  3986. @item width, w
  3987. Specify the band-width of a filter in width_type units.
  3988. Applies only to double-pole filter.
  3989. The default is 0.707q and gives a Butterworth response.
  3990. @item mix, m
  3991. How much to use filtered signal in output. Default is 1.
  3992. Range is between 0 and 1.
  3993. @item channels, c
  3994. Specify which channels to filter, by default all available are filtered.
  3995. @item normalize, n
  3996. Normalize biquad coefficients, by default is disabled.
  3997. Enabling it will normalize magnitude response at DC to 0dB.
  3998. @item transform, a
  3999. Set transform type of IIR filter.
  4000. @table @option
  4001. @item di
  4002. @item dii
  4003. @item tdi
  4004. @item tdii
  4005. @item latt
  4006. @item svf
  4007. @item zdf
  4008. @end table
  4009. @item precision, r
  4010. Set precison of filtering.
  4011. @table @option
  4012. @item auto
  4013. Pick automatic sample format depending on surround filters.
  4014. @item s16
  4015. Always use signed 16-bit.
  4016. @item s32
  4017. Always use signed 32-bit.
  4018. @item f32
  4019. Always use float 32-bit.
  4020. @item f64
  4021. Always use float 64-bit.
  4022. @end table
  4023. @item block_size, b
  4024. Set block size used for reverse IIR processing. If this value is set to high enough
  4025. value (higher than impulse response length truncated when reaches near zero values) filtering
  4026. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4027. Note that filter delay will be exactly this many samples when set to non-zero value.
  4028. @end table
  4029. @subsection Commands
  4030. This filter supports the following commands:
  4031. @table @option
  4032. @item frequency, f
  4033. Change highpass frequency.
  4034. Syntax for the command is : "@var{frequency}"
  4035. @item width_type, t
  4036. Change highpass width_type.
  4037. Syntax for the command is : "@var{width_type}"
  4038. @item width, w
  4039. Change highpass width.
  4040. Syntax for the command is : "@var{width}"
  4041. @item mix, m
  4042. Change highpass mix.
  4043. Syntax for the command is : "@var{mix}"
  4044. @end table
  4045. @section join
  4046. Join multiple input streams into one multi-channel stream.
  4047. It accepts the following parameters:
  4048. @table @option
  4049. @item inputs
  4050. The number of input streams. It defaults to 2.
  4051. @item channel_layout
  4052. The desired output channel layout. It defaults to stereo.
  4053. @item map
  4054. Map channels from inputs to output. The argument is a '|'-separated list of
  4055. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  4056. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  4057. can be either the name of the input channel (e.g. FL for front left) or its
  4058. index in the specified input stream. @var{out_channel} is the name of the output
  4059. channel.
  4060. @end table
  4061. The filter will attempt to guess the mappings when they are not specified
  4062. explicitly. It does so by first trying to find an unused matching input channel
  4063. and if that fails it picks the first unused input channel.
  4064. Join 3 inputs (with properly set channel layouts):
  4065. @example
  4066. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  4067. @end example
  4068. Build a 5.1 output from 6 single-channel streams:
  4069. @example
  4070. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  4071. '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'
  4072. out
  4073. @end example
  4074. @section ladspa
  4075. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  4076. To enable compilation of this filter you need to configure FFmpeg with
  4077. @code{--enable-ladspa}.
  4078. @table @option
  4079. @item file, f
  4080. Specifies the name of LADSPA plugin library to load. If the environment
  4081. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  4082. each one of the directories specified by the colon separated list in
  4083. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  4084. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  4085. @file{/usr/lib/ladspa/}.
  4086. @item plugin, p
  4087. Specifies the plugin within the library. Some libraries contain only
  4088. one plugin, but others contain many of them. If this is not set filter
  4089. will list all available plugins within the specified library.
  4090. @item controls, c
  4091. Set the '|' separated list of controls which are zero or more floating point
  4092. values that determine the behavior of the loaded plugin (for example delay,
  4093. threshold or gain).
  4094. Controls need to be defined using the following syntax:
  4095. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  4096. @var{valuei} is the value set on the @var{i}-th control.
  4097. Alternatively they can be also defined using the following syntax:
  4098. @var{value0}|@var{value1}|@var{value2}|..., where
  4099. @var{valuei} is the value set on the @var{i}-th control.
  4100. If @option{controls} is set to @code{help}, all available controls and
  4101. their valid ranges are printed.
  4102. @item sample_rate, s
  4103. Specify the sample rate, default to 44100. Only used if plugin have
  4104. zero inputs.
  4105. @item nb_samples, n
  4106. Set the number of samples per channel per each output frame, default
  4107. is 1024. Only used if plugin have zero inputs.
  4108. @item duration, d
  4109. Set the minimum duration of the sourced audio. See
  4110. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4111. for the accepted syntax.
  4112. Note that the resulting duration may be greater than the specified duration,
  4113. as the generated audio is always cut at the end of a complete frame.
  4114. If not specified, or the expressed duration is negative, the audio is
  4115. supposed to be generated forever.
  4116. Only used if plugin have zero inputs.
  4117. @item latency, l
  4118. Enable latency compensation, by default is disabled.
  4119. Only used if plugin have inputs.
  4120. @end table
  4121. @subsection Examples
  4122. @itemize
  4123. @item
  4124. List all available plugins within amp (LADSPA example plugin) library:
  4125. @example
  4126. ladspa=file=amp
  4127. @end example
  4128. @item
  4129. List all available controls and their valid ranges for @code{vcf_notch}
  4130. plugin from @code{VCF} library:
  4131. @example
  4132. ladspa=f=vcf:p=vcf_notch:c=help
  4133. @end example
  4134. @item
  4135. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4136. plugin library:
  4137. @example
  4138. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4139. @end example
  4140. @item
  4141. Add reverberation to the audio using TAP-plugins
  4142. (Tom's Audio Processing plugins):
  4143. @example
  4144. ladspa=file=tap_reverb:tap_reverb
  4145. @end example
  4146. @item
  4147. Generate white noise, with 0.2 amplitude:
  4148. @example
  4149. ladspa=file=cmt:noise_source_white:c=c0=.2
  4150. @end example
  4151. @item
  4152. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4153. @code{C* Audio Plugin Suite} (CAPS) library:
  4154. @example
  4155. ladspa=file=caps:Click:c=c1=20'
  4156. @end example
  4157. @item
  4158. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4159. @example
  4160. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4161. @end example
  4162. @item
  4163. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4164. @code{SWH Plugins} collection:
  4165. @example
  4166. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4167. @end example
  4168. @item
  4169. Attenuate low frequencies using Multiband EQ from Steve Harris
  4170. @code{SWH Plugins} collection:
  4171. @example
  4172. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4173. @end example
  4174. @item
  4175. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4176. (CAPS) library:
  4177. @example
  4178. ladspa=caps:Narrower
  4179. @end example
  4180. @item
  4181. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4182. @example
  4183. ladspa=caps:White:.2
  4184. @end example
  4185. @item
  4186. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4187. @example
  4188. ladspa=caps:Fractal:c=c1=1
  4189. @end example
  4190. @item
  4191. Dynamic volume normalization using @code{VLevel} plugin:
  4192. @example
  4193. ladspa=vlevel-ladspa:vlevel_mono
  4194. @end example
  4195. @end itemize
  4196. @subsection Commands
  4197. This filter supports the following commands:
  4198. @table @option
  4199. @item cN
  4200. Modify the @var{N}-th control value.
  4201. If the specified value is not valid, it is ignored and prior one is kept.
  4202. @end table
  4203. @section loudnorm
  4204. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4205. Support for both single pass (livestreams, files) and double pass (files) modes.
  4206. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4207. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4208. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4209. The filter accepts the following options:
  4210. @table @option
  4211. @item I, i
  4212. Set integrated loudness target.
  4213. Range is -70.0 - -5.0. Default value is -24.0.
  4214. @item LRA, lra
  4215. Set loudness range target.
  4216. Range is 1.0 - 50.0. Default value is 7.0.
  4217. @item TP, tp
  4218. Set maximum true peak.
  4219. Range is -9.0 - +0.0. Default value is -2.0.
  4220. @item measured_I, measured_i
  4221. Measured IL of input file.
  4222. Range is -99.0 - +0.0.
  4223. @item measured_LRA, measured_lra
  4224. Measured LRA of input file.
  4225. Range is 0.0 - 99.0.
  4226. @item measured_TP, measured_tp
  4227. Measured true peak of input file.
  4228. Range is -99.0 - +99.0.
  4229. @item measured_thresh
  4230. Measured threshold of input file.
  4231. Range is -99.0 - +0.0.
  4232. @item offset
  4233. Set offset gain. Gain is applied before the true-peak limiter.
  4234. Range is -99.0 - +99.0. Default is +0.0.
  4235. @item linear
  4236. Normalize by linearly scaling the source audio.
  4237. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4238. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4239. be lower than source LRA and the change in integrated loudness shouldn't
  4240. result in a true peak which exceeds the target TP. If any of these
  4241. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4242. Options are @code{true} or @code{false}. Default is @code{true}.
  4243. @item dual_mono
  4244. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4245. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4246. If set to @code{true}, this option will compensate for this effect.
  4247. Multi-channel input files are not affected by this option.
  4248. Options are true or false. Default is false.
  4249. @item print_format
  4250. Set print format for stats. Options are summary, json, or none.
  4251. Default value is none.
  4252. @end table
  4253. @section lowpass
  4254. Apply a low-pass filter with 3dB point frequency.
  4255. The filter can be either single-pole or double-pole (the default).
  4256. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4257. The filter accepts the following options:
  4258. @table @option
  4259. @item frequency, f
  4260. Set frequency in Hz. Default is 500.
  4261. @item poles, p
  4262. Set number of poles. Default is 2.
  4263. @item width_type, t
  4264. Set method to specify band-width of filter.
  4265. @table @option
  4266. @item h
  4267. Hz
  4268. @item q
  4269. Q-Factor
  4270. @item o
  4271. octave
  4272. @item s
  4273. slope
  4274. @item k
  4275. kHz
  4276. @end table
  4277. @item width, w
  4278. Specify the band-width of a filter in width_type units.
  4279. Applies only to double-pole filter.
  4280. The default is 0.707q and gives a Butterworth response.
  4281. @item mix, m
  4282. How much to use filtered signal in output. Default is 1.
  4283. Range is between 0 and 1.
  4284. @item channels, c
  4285. Specify which channels to filter, by default all available are filtered.
  4286. @item normalize, n
  4287. Normalize biquad coefficients, by default is disabled.
  4288. Enabling it will normalize magnitude response at DC to 0dB.
  4289. @item transform, a
  4290. Set transform type of IIR filter.
  4291. @table @option
  4292. @item di
  4293. @item dii
  4294. @item tdi
  4295. @item tdii
  4296. @item latt
  4297. @item svf
  4298. @item zdf
  4299. @end table
  4300. @item precision, r
  4301. Set precison of filtering.
  4302. @table @option
  4303. @item auto
  4304. Pick automatic sample format depending on surround filters.
  4305. @item s16
  4306. Always use signed 16-bit.
  4307. @item s32
  4308. Always use signed 32-bit.
  4309. @item f32
  4310. Always use float 32-bit.
  4311. @item f64
  4312. Always use float 64-bit.
  4313. @end table
  4314. @item block_size, b
  4315. Set block size used for reverse IIR processing. If this value is set to high enough
  4316. value (higher than impulse response length truncated when reaches near zero values) filtering
  4317. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4318. Note that filter delay will be exactly this many samples when set to non-zero value.
  4319. @end table
  4320. @subsection Examples
  4321. @itemize
  4322. @item
  4323. Lowpass only LFE channel, it LFE is not present it does nothing:
  4324. @example
  4325. lowpass=c=LFE
  4326. @end example
  4327. @end itemize
  4328. @subsection Commands
  4329. This filter supports the following commands:
  4330. @table @option
  4331. @item frequency, f
  4332. Change lowpass frequency.
  4333. Syntax for the command is : "@var{frequency}"
  4334. @item width_type, t
  4335. Change lowpass width_type.
  4336. Syntax for the command is : "@var{width_type}"
  4337. @item width, w
  4338. Change lowpass width.
  4339. Syntax for the command is : "@var{width}"
  4340. @item mix, m
  4341. Change lowpass mix.
  4342. Syntax for the command is : "@var{mix}"
  4343. @end table
  4344. @section lv2
  4345. Load a LV2 (LADSPA Version 2) plugin.
  4346. To enable compilation of this filter you need to configure FFmpeg with
  4347. @code{--enable-lv2}.
  4348. @table @option
  4349. @item plugin, p
  4350. Specifies the plugin URI. You may need to escape ':'.
  4351. @item controls, c
  4352. Set the '|' separated list of controls which are zero or more floating point
  4353. values that determine the behavior of the loaded plugin (for example delay,
  4354. threshold or gain).
  4355. If @option{controls} is set to @code{help}, all available controls and
  4356. their valid ranges are printed.
  4357. @item sample_rate, s
  4358. Specify the sample rate, default to 44100. Only used if plugin have
  4359. zero inputs.
  4360. @item nb_samples, n
  4361. Set the number of samples per channel per each output frame, default
  4362. is 1024. Only used if plugin have zero inputs.
  4363. @item duration, d
  4364. Set the minimum duration of the sourced audio. See
  4365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4366. for the accepted syntax.
  4367. Note that the resulting duration may be greater than the specified duration,
  4368. as the generated audio is always cut at the end of a complete frame.
  4369. If not specified, or the expressed duration is negative, the audio is
  4370. supposed to be generated forever.
  4371. Only used if plugin have zero inputs.
  4372. @end table
  4373. @subsection Examples
  4374. @itemize
  4375. @item
  4376. Apply bass enhancer plugin from Calf:
  4377. @example
  4378. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4379. @end example
  4380. @item
  4381. Apply vinyl plugin from Calf:
  4382. @example
  4383. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4384. @end example
  4385. @item
  4386. Apply bit crusher plugin from ArtyFX:
  4387. @example
  4388. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4389. @end example
  4390. @end itemize
  4391. @subsection Commands
  4392. This filter supports all options that are exported by plugin as commands.
  4393. @section mcompand
  4394. Multiband Compress or expand the audio's dynamic range.
  4395. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4396. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4397. response when absent compander action.
  4398. It accepts the following parameters:
  4399. @table @option
  4400. @item args
  4401. This option syntax is:
  4402. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4403. For explanation of each item refer to compand filter documentation.
  4404. @end table
  4405. @anchor{pan}
  4406. @section pan
  4407. Mix channels with specific gain levels. The filter accepts the output
  4408. channel layout followed by a set of channels definitions.
  4409. This filter is also designed to efficiently remap the channels of an audio
  4410. stream.
  4411. The filter accepts parameters of the form:
  4412. "@var{l}|@var{outdef}|@var{outdef}|..."
  4413. @table @option
  4414. @item l
  4415. output channel layout or number of channels
  4416. @item outdef
  4417. output channel specification, of the form:
  4418. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4419. @item out_name
  4420. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4421. number (c0, c1, etc.)
  4422. @item gain
  4423. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4424. @item in_name
  4425. input channel to use, see out_name for details; it is not possible to mix
  4426. named and numbered input channels
  4427. @end table
  4428. If the `=' in a channel specification is replaced by `<', then the gains for
  4429. that specification will be renormalized so that the total is 1, thus
  4430. avoiding clipping noise.
  4431. @subsection Mixing examples
  4432. For example, if you want to down-mix from stereo to mono, but with a bigger
  4433. factor for the left channel:
  4434. @example
  4435. pan=1c|c0=0.9*c0+0.1*c1
  4436. @end example
  4437. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4438. 7-channels surround:
  4439. @example
  4440. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4441. @end example
  4442. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4443. that should be preferred (see "-ac" option) unless you have very specific
  4444. needs.
  4445. @subsection Remapping examples
  4446. The channel remapping will be effective if, and only if:
  4447. @itemize
  4448. @item gain coefficients are zeroes or ones,
  4449. @item only one input per channel output,
  4450. @end itemize
  4451. If all these conditions are satisfied, the filter will notify the user ("Pure
  4452. channel mapping detected"), and use an optimized and lossless method to do the
  4453. remapping.
  4454. For example, if you have a 5.1 source and want a stereo audio stream by
  4455. dropping the extra channels:
  4456. @example
  4457. pan="stereo| c0=FL | c1=FR"
  4458. @end example
  4459. Given the same source, you can also switch front left and front right channels
  4460. and keep the input channel layout:
  4461. @example
  4462. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4463. @end example
  4464. If the input is a stereo audio stream, you can mute the front left channel (and
  4465. still keep the stereo channel layout) with:
  4466. @example
  4467. pan="stereo|c1=c1"
  4468. @end example
  4469. Still with a stereo audio stream input, you can copy the right channel in both
  4470. front left and right:
  4471. @example
  4472. pan="stereo| c0=FR | c1=FR"
  4473. @end example
  4474. @section replaygain
  4475. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4476. outputs it unchanged.
  4477. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4478. @section resample
  4479. Convert the audio sample format, sample rate and channel layout. It is
  4480. not meant to be used directly.
  4481. @section rubberband
  4482. Apply time-stretching and pitch-shifting with librubberband.
  4483. To enable compilation of this filter, you need to configure FFmpeg with
  4484. @code{--enable-librubberband}.
  4485. The filter accepts the following options:
  4486. @table @option
  4487. @item tempo
  4488. Set tempo scale factor.
  4489. @item pitch
  4490. Set pitch scale factor.
  4491. @item transients
  4492. Set transients detector.
  4493. Possible values are:
  4494. @table @var
  4495. @item crisp
  4496. @item mixed
  4497. @item smooth
  4498. @end table
  4499. @item detector
  4500. Set detector.
  4501. Possible values are:
  4502. @table @var
  4503. @item compound
  4504. @item percussive
  4505. @item soft
  4506. @end table
  4507. @item phase
  4508. Set phase.
  4509. Possible values are:
  4510. @table @var
  4511. @item laminar
  4512. @item independent
  4513. @end table
  4514. @item window
  4515. Set processing window size.
  4516. Possible values are:
  4517. @table @var
  4518. @item standard
  4519. @item short
  4520. @item long
  4521. @end table
  4522. @item smoothing
  4523. Set smoothing.
  4524. Possible values are:
  4525. @table @var
  4526. @item off
  4527. @item on
  4528. @end table
  4529. @item formant
  4530. Enable formant preservation when shift pitching.
  4531. Possible values are:
  4532. @table @var
  4533. @item shifted
  4534. @item preserved
  4535. @end table
  4536. @item pitchq
  4537. Set pitch quality.
  4538. Possible values are:
  4539. @table @var
  4540. @item quality
  4541. @item speed
  4542. @item consistency
  4543. @end table
  4544. @item channels
  4545. Set channels.
  4546. Possible values are:
  4547. @table @var
  4548. @item apart
  4549. @item together
  4550. @end table
  4551. @end table
  4552. @subsection Commands
  4553. This filter supports the following commands:
  4554. @table @option
  4555. @item tempo
  4556. Change filter tempo scale factor.
  4557. Syntax for the command is : "@var{tempo}"
  4558. @item pitch
  4559. Change filter pitch scale factor.
  4560. Syntax for the command is : "@var{pitch}"
  4561. @end table
  4562. @section sidechaincompress
  4563. This filter acts like normal compressor but has the ability to compress
  4564. detected signal using second input signal.
  4565. It needs two input streams and returns one output stream.
  4566. First input stream will be processed depending on second stream signal.
  4567. The filtered signal then can be filtered with other filters in later stages of
  4568. processing. See @ref{pan} and @ref{amerge} filter.
  4569. The filter accepts the following options:
  4570. @table @option
  4571. @item level_in
  4572. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4573. @item mode
  4574. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4575. Default is @code{downward}.
  4576. @item threshold
  4577. If a signal of second stream raises above this level it will affect the gain
  4578. reduction of first stream.
  4579. By default is 0.125. Range is between 0.00097563 and 1.
  4580. @item ratio
  4581. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4582. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4583. Default is 2. Range is between 1 and 20.
  4584. @item attack
  4585. Amount of milliseconds the signal has to rise above the threshold before gain
  4586. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4587. @item release
  4588. Amount of milliseconds the signal has to fall below the threshold before
  4589. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4590. @item makeup
  4591. Set the amount by how much signal will be amplified after processing.
  4592. Default is 1. Range is from 1 to 64.
  4593. @item knee
  4594. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4595. Default is 2.82843. Range is between 1 and 8.
  4596. @item link
  4597. Choose if the @code{average} level between all channels of side-chain stream
  4598. or the louder(@code{maximum}) channel of side-chain stream affects the
  4599. reduction. Default is @code{average}.
  4600. @item detection
  4601. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4602. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4603. @item level_sc
  4604. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4605. @item mix
  4606. How much to use compressed signal in output. Default is 1.
  4607. Range is between 0 and 1.
  4608. @end table
  4609. @subsection Commands
  4610. This filter supports the all above options as @ref{commands}.
  4611. @subsection Examples
  4612. @itemize
  4613. @item
  4614. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4615. depending on the signal of 2nd input and later compressed signal to be
  4616. merged with 2nd input:
  4617. @example
  4618. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4619. @end example
  4620. @end itemize
  4621. @section sidechaingate
  4622. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4623. filter the detected signal before sending it to the gain reduction stage.
  4624. Normally a gate uses the full range signal to detect a level above the
  4625. threshold.
  4626. For example: If you cut all lower frequencies from your sidechain signal
  4627. the gate will decrease the volume of your track only if not enough highs
  4628. appear. With this technique you are able to reduce the resonation of a
  4629. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4630. guitar.
  4631. It needs two input streams and returns one output stream.
  4632. First input stream will be processed depending on second stream signal.
  4633. The filter accepts the following options:
  4634. @table @option
  4635. @item level_in
  4636. Set input level before filtering.
  4637. Default is 1. Allowed range is from 0.015625 to 64.
  4638. @item mode
  4639. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4640. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4641. will be amplified, expanding dynamic range in upward direction.
  4642. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4643. @item range
  4644. Set the level of gain reduction when the signal is below the threshold.
  4645. Default is 0.06125. Allowed range is from 0 to 1.
  4646. Setting this to 0 disables reduction and then filter behaves like expander.
  4647. @item threshold
  4648. If a signal rises above this level the gain reduction is released.
  4649. Default is 0.125. Allowed range is from 0 to 1.
  4650. @item ratio
  4651. Set a ratio about which the signal is reduced.
  4652. Default is 2. Allowed range is from 1 to 9000.
  4653. @item attack
  4654. Amount of milliseconds the signal has to rise above the threshold before gain
  4655. reduction stops.
  4656. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4657. @item release
  4658. Amount of milliseconds the signal has to fall below the threshold before the
  4659. reduction is increased again. Default is 250 milliseconds.
  4660. Allowed range is from 0.01 to 9000.
  4661. @item makeup
  4662. Set amount of amplification of signal after processing.
  4663. Default is 1. Allowed range is from 1 to 64.
  4664. @item knee
  4665. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4666. Default is 2.828427125. Allowed range is from 1 to 8.
  4667. @item detection
  4668. Choose if exact signal should be taken for detection or an RMS like one.
  4669. Default is rms. Can be peak or rms.
  4670. @item link
  4671. Choose if the average level between all channels or the louder channel affects
  4672. the reduction.
  4673. Default is average. Can be average or maximum.
  4674. @item level_sc
  4675. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4676. @end table
  4677. @subsection Commands
  4678. This filter supports the all above options as @ref{commands}.
  4679. @section silencedetect
  4680. Detect silence in an audio stream.
  4681. This filter logs a message when it detects that the input audio volume is less
  4682. or equal to a noise tolerance value for a duration greater or equal to the
  4683. minimum detected noise duration.
  4684. The printed times and duration are expressed in seconds. The
  4685. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4686. is set on the first frame whose timestamp equals or exceeds the detection
  4687. duration and it contains the timestamp of the first frame of the silence.
  4688. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4689. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4690. keys are set on the first frame after the silence. If @option{mono} is
  4691. enabled, and each channel is evaluated separately, the @code{.X}
  4692. suffixed keys are used, and @code{X} corresponds to the channel number.
  4693. The filter accepts the following options:
  4694. @table @option
  4695. @item noise, n
  4696. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4697. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4698. @item duration, d
  4699. Set silence duration until notification (default is 2 seconds). See
  4700. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4701. for the accepted syntax.
  4702. @item mono, m
  4703. Process each channel separately, instead of combined. By default is disabled.
  4704. @end table
  4705. @subsection Examples
  4706. @itemize
  4707. @item
  4708. Detect 5 seconds of silence with -50dB noise tolerance:
  4709. @example
  4710. silencedetect=n=-50dB:d=5
  4711. @end example
  4712. @item
  4713. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4714. tolerance in @file{silence.mp3}:
  4715. @example
  4716. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4717. @end example
  4718. @end itemize
  4719. @section silenceremove
  4720. Remove silence from the beginning, middle or end of the audio.
  4721. The filter accepts the following options:
  4722. @table @option
  4723. @item start_periods
  4724. This value is used to indicate if audio should be trimmed at beginning of
  4725. the audio. A value of zero indicates no silence should be trimmed from the
  4726. beginning. When specifying a non-zero value, it trims audio up until it
  4727. finds non-silence. Normally, when trimming silence from beginning of audio
  4728. the @var{start_periods} will be @code{1} but it can be increased to higher
  4729. values to trim all audio up to specific count of non-silence periods.
  4730. Default value is @code{0}.
  4731. @item start_duration
  4732. Specify the amount of time that non-silence must be detected before it stops
  4733. trimming audio. By increasing the duration, bursts of noises can be treated
  4734. as silence and trimmed off. Default value is @code{0}.
  4735. @item start_threshold
  4736. This indicates what sample value should be treated as silence. For digital
  4737. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4738. you may wish to increase the value to account for background noise.
  4739. Can be specified in dB (in case "dB" is appended to the specified value)
  4740. or amplitude ratio. Default value is @code{0}.
  4741. @item start_silence
  4742. Specify max duration of silence at beginning that will be kept after
  4743. trimming. Default is 0, which is equal to trimming all samples detected
  4744. as silence.
  4745. @item start_mode
  4746. Specify mode of detection of silence end in start of multi-channel audio.
  4747. Can be @var{any} or @var{all}. Default is @var{any}.
  4748. With @var{any}, any sample that is detected as non-silence will cause
  4749. stopped trimming of silence.
  4750. With @var{all}, only if all channels are detected as non-silence will cause
  4751. stopped trimming of silence.
  4752. @item stop_periods
  4753. Set the count for trimming silence from the end of audio.
  4754. To remove silence from the middle of a file, specify a @var{stop_periods}
  4755. that is negative. This value is then treated as a positive value and is
  4756. used to indicate the effect should restart processing as specified by
  4757. @var{start_periods}, making it suitable for removing periods of silence
  4758. in the middle of the audio.
  4759. Default value is @code{0}.
  4760. @item stop_duration
  4761. Specify a duration of silence that must exist before audio is not copied any
  4762. more. By specifying a higher duration, silence that is wanted can be left in
  4763. the audio.
  4764. Default value is @code{0}.
  4765. @item stop_threshold
  4766. This is the same as @option{start_threshold} but for trimming silence from
  4767. the end of audio.
  4768. Can be specified in dB (in case "dB" is appended to the specified value)
  4769. or amplitude ratio. Default value is @code{0}.
  4770. @item stop_silence
  4771. Specify max duration of silence at end that will be kept after
  4772. trimming. Default is 0, which is equal to trimming all samples detected
  4773. as silence.
  4774. @item stop_mode
  4775. Specify mode of detection of silence start in end of multi-channel audio.
  4776. Can be @var{any} or @var{all}. Default is @var{any}.
  4777. With @var{any}, any sample that is detected as non-silence will cause
  4778. stopped trimming of silence.
  4779. With @var{all}, only if all channels are detected as non-silence will cause
  4780. stopped trimming of silence.
  4781. @item detection
  4782. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4783. and works better with digital silence which is exactly 0.
  4784. Default value is @code{rms}.
  4785. @item window
  4786. Set duration in number of seconds used to calculate size of window in number
  4787. of samples for detecting silence.
  4788. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4789. @end table
  4790. @subsection Examples
  4791. @itemize
  4792. @item
  4793. The following example shows how this filter can be used to start a recording
  4794. that does not contain the delay at the start which usually occurs between
  4795. pressing the record button and the start of the performance:
  4796. @example
  4797. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4798. @end example
  4799. @item
  4800. Trim all silence encountered from beginning to end where there is more than 1
  4801. second of silence in audio:
  4802. @example
  4803. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4804. @end example
  4805. @item
  4806. Trim all digital silence samples, using peak detection, from beginning to end
  4807. where there is more than 0 samples of digital silence in audio and digital
  4808. silence is detected in all channels at same positions in stream:
  4809. @example
  4810. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4811. @end example
  4812. @end itemize
  4813. @section sofalizer
  4814. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4815. loudspeakers around the user for binaural listening via headphones (audio
  4816. formats up to 9 channels supported).
  4817. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4818. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4819. Austrian Academy of Sciences.
  4820. To enable compilation of this filter you need to configure FFmpeg with
  4821. @code{--enable-libmysofa}.
  4822. The filter accepts the following options:
  4823. @table @option
  4824. @item sofa
  4825. Set the SOFA file used for rendering.
  4826. @item gain
  4827. Set gain applied to audio. Value is in dB. Default is 0.
  4828. @item rotation
  4829. Set rotation of virtual loudspeakers in deg. Default is 0.
  4830. @item elevation
  4831. Set elevation of virtual speakers in deg. Default is 0.
  4832. @item radius
  4833. Set distance in meters between loudspeakers and the listener with near-field
  4834. HRTFs. Default is 1.
  4835. @item type
  4836. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4837. processing audio in time domain which is slow.
  4838. @var{freq} is processing audio in frequency domain which is fast.
  4839. Default is @var{freq}.
  4840. @item speakers
  4841. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4842. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4843. Each virtual loudspeaker is described with short channel name following with
  4844. azimuth and elevation in degrees.
  4845. Each virtual loudspeaker description is separated by '|'.
  4846. For example to override front left and front right channel positions use:
  4847. 'speakers=FL 45 15|FR 345 15'.
  4848. Descriptions with unrecognised channel names are ignored.
  4849. @item lfegain
  4850. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4851. @item framesize
  4852. Set custom frame size in number of samples. Default is 1024.
  4853. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4854. is set to @var{freq}.
  4855. @item normalize
  4856. Should all IRs be normalized upon importing SOFA file.
  4857. By default is enabled.
  4858. @item interpolate
  4859. Should nearest IRs be interpolated with neighbor IRs if exact position
  4860. does not match. By default is disabled.
  4861. @item minphase
  4862. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4863. @item anglestep
  4864. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4865. @item radstep
  4866. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4867. @end table
  4868. @subsection Examples
  4869. @itemize
  4870. @item
  4871. Using ClubFritz6 sofa file:
  4872. @example
  4873. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4874. @end example
  4875. @item
  4876. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4877. @example
  4878. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4879. @end example
  4880. @item
  4881. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4882. and also with custom gain:
  4883. @example
  4884. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4885. @end example
  4886. @end itemize
  4887. @section speechnorm
  4888. Speech Normalizer.
  4889. This filter expands or compresses each half-cycle of audio samples
  4890. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4891. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4892. The filter accepts the following options:
  4893. @table @option
  4894. @item peak, p
  4895. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4896. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4897. @item expansion, e
  4898. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4899. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4900. would be such that local peak value reaches target peak value but never to surpass it and that
  4901. ratio between new and previous peak value does not surpass this option value.
  4902. @item compression, c
  4903. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4904. This option controls maximum local half-cycle of samples compression. This option is used
  4905. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4906. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4907. that peak's half-cycle will be compressed by current compression factor.
  4908. @item threshold, t
  4909. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4910. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4911. Any half-cycle samples with their local peak value below or same as this option value will be
  4912. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4913. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4914. @item raise, r
  4915. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4916. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4917. each new half-cycle until it reaches @option{expansion} value.
  4918. Setting this options too high may lead to distortions.
  4919. @item fall, f
  4920. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4921. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4922. each new half-cycle until it reaches @option{compression} value.
  4923. @item channels, h
  4924. Specify which channels to filter, by default all available channels are filtered.
  4925. @item invert, i
  4926. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4927. option. When enabled any half-cycle of samples with their local peak value below or same as
  4928. @option{threshold} option will be expanded otherwise it will be compressed.
  4929. @item link, l
  4930. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4931. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4932. is enabled the minimum of all possible gains for each filtered channel is used.
  4933. @end table
  4934. @subsection Commands
  4935. This filter supports the all above options as @ref{commands}.
  4936. @subsection Examples
  4937. @itemize
  4938. @item
  4939. Weak and slow amplification:
  4940. @example
  4941. speechnorm=e=3:r=0.00001:l=1
  4942. @end example
  4943. @item
  4944. Moderate and slow amplification:
  4945. @example
  4946. speechnorm=e=6.25:r=0.00001:l=1
  4947. @end example
  4948. @item
  4949. Strong and fast amplification:
  4950. @example
  4951. speechnorm=e=12.5:r=0.0001:l=1
  4952. @end example
  4953. @item
  4954. Very strong and fast amplification:
  4955. @example
  4956. speechnorm=e=25:r=0.0001:l=1
  4957. @end example
  4958. @item
  4959. Extreme and fast amplification:
  4960. @example
  4961. speechnorm=e=50:r=0.0001:l=1
  4962. @end example
  4963. @end itemize
  4964. @section stereotools
  4965. This filter has some handy utilities to manage stereo signals, for converting
  4966. M/S stereo recordings to L/R signal while having control over the parameters
  4967. or spreading the stereo image of master track.
  4968. The filter accepts the following options:
  4969. @table @option
  4970. @item level_in
  4971. Set input level before filtering for both channels. Defaults is 1.
  4972. Allowed range is from 0.015625 to 64.
  4973. @item level_out
  4974. Set output level after filtering for both channels. Defaults is 1.
  4975. Allowed range is from 0.015625 to 64.
  4976. @item balance_in
  4977. Set input balance between both channels. Default is 0.
  4978. Allowed range is from -1 to 1.
  4979. @item balance_out
  4980. Set output balance between both channels. Default is 0.
  4981. Allowed range is from -1 to 1.
  4982. @item softclip
  4983. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4984. clipping. Disabled by default.
  4985. @item mutel
  4986. Mute the left channel. Disabled by default.
  4987. @item muter
  4988. Mute the right channel. Disabled by default.
  4989. @item phasel
  4990. Change the phase of the left channel. Disabled by default.
  4991. @item phaser
  4992. Change the phase of the right channel. Disabled by default.
  4993. @item mode
  4994. Set stereo mode. Available values are:
  4995. @table @samp
  4996. @item lr>lr
  4997. Left/Right to Left/Right, this is default.
  4998. @item lr>ms
  4999. Left/Right to Mid/Side.
  5000. @item ms>lr
  5001. Mid/Side to Left/Right.
  5002. @item lr>ll
  5003. Left/Right to Left/Left.
  5004. @item lr>rr
  5005. Left/Right to Right/Right.
  5006. @item lr>l+r
  5007. Left/Right to Left + Right.
  5008. @item lr>rl
  5009. Left/Right to Right/Left.
  5010. @item ms>ll
  5011. Mid/Side to Left/Left.
  5012. @item ms>rr
  5013. Mid/Side to Right/Right.
  5014. @item ms>rl
  5015. Mid/Side to Right/Left.
  5016. @item lr>l-r
  5017. Left/Right to Left - Right.
  5018. @end table
  5019. @item slev
  5020. Set level of side signal. Default is 1.
  5021. Allowed range is from 0.015625 to 64.
  5022. @item sbal
  5023. Set balance of side signal. Default is 0.
  5024. Allowed range is from -1 to 1.
  5025. @item mlev
  5026. Set level of the middle signal. Default is 1.
  5027. Allowed range is from 0.015625 to 64.
  5028. @item mpan
  5029. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  5030. @item base
  5031. Set stereo base between mono and inversed channels. Default is 0.
  5032. Allowed range is from -1 to 1.
  5033. @item delay
  5034. Set delay in milliseconds how much to delay left from right channel and
  5035. vice versa. Default is 0. Allowed range is from -20 to 20.
  5036. @item sclevel
  5037. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  5038. @item phase
  5039. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  5040. @item bmode_in, bmode_out
  5041. Set balance mode for balance_in/balance_out option.
  5042. Can be one of the following:
  5043. @table @samp
  5044. @item balance
  5045. Classic balance mode. Attenuate one channel at time.
  5046. Gain is raised up to 1.
  5047. @item amplitude
  5048. Similar as classic mode above but gain is raised up to 2.
  5049. @item power
  5050. Equal power distribution, from -6dB to +6dB range.
  5051. @end table
  5052. @end table
  5053. @subsection Commands
  5054. This filter supports the all above options as @ref{commands}.
  5055. @subsection Examples
  5056. @itemize
  5057. @item
  5058. Apply karaoke like effect:
  5059. @example
  5060. stereotools=mlev=0.015625
  5061. @end example
  5062. @item
  5063. Convert M/S signal to L/R:
  5064. @example
  5065. "stereotools=mode=ms>lr"
  5066. @end example
  5067. @end itemize
  5068. @section stereowiden
  5069. This filter enhance the stereo effect by suppressing signal common to both
  5070. channels and by delaying the signal of left into right and vice versa,
  5071. thereby widening the stereo effect.
  5072. The filter accepts the following options:
  5073. @table @option
  5074. @item delay
  5075. Time in milliseconds of the delay of left signal into right and vice versa.
  5076. Default is 20 milliseconds.
  5077. @item feedback
  5078. Amount of gain in delayed signal into right and vice versa. Gives a delay
  5079. effect of left signal in right output and vice versa which gives widening
  5080. effect. Default is 0.3.
  5081. @item crossfeed
  5082. Cross feed of left into right with inverted phase. This helps in suppressing
  5083. the mono. If the value is 1 it will cancel all the signal common to both
  5084. channels. Default is 0.3.
  5085. @item drymix
  5086. Set level of input signal of original channel. Default is 0.8.
  5087. @end table
  5088. @subsection Commands
  5089. This filter supports the all above options except @code{delay} as @ref{commands}.
  5090. @section superequalizer
  5091. Apply 18 band equalizer.
  5092. The filter accepts the following options:
  5093. @table @option
  5094. @item 1b
  5095. Set 65Hz band gain.
  5096. @item 2b
  5097. Set 92Hz band gain.
  5098. @item 3b
  5099. Set 131Hz band gain.
  5100. @item 4b
  5101. Set 185Hz band gain.
  5102. @item 5b
  5103. Set 262Hz band gain.
  5104. @item 6b
  5105. Set 370Hz band gain.
  5106. @item 7b
  5107. Set 523Hz band gain.
  5108. @item 8b
  5109. Set 740Hz band gain.
  5110. @item 9b
  5111. Set 1047Hz band gain.
  5112. @item 10b
  5113. Set 1480Hz band gain.
  5114. @item 11b
  5115. Set 2093Hz band gain.
  5116. @item 12b
  5117. Set 2960Hz band gain.
  5118. @item 13b
  5119. Set 4186Hz band gain.
  5120. @item 14b
  5121. Set 5920Hz band gain.
  5122. @item 15b
  5123. Set 8372Hz band gain.
  5124. @item 16b
  5125. Set 11840Hz band gain.
  5126. @item 17b
  5127. Set 16744Hz band gain.
  5128. @item 18b
  5129. Set 20000Hz band gain.
  5130. @end table
  5131. @section surround
  5132. Apply audio surround upmix filter.
  5133. This filter allows to produce multichannel output from audio stream.
  5134. The filter accepts the following options:
  5135. @table @option
  5136. @item chl_out
  5137. Set output channel layout. By default, this is @var{5.1}.
  5138. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5139. for the required syntax.
  5140. @item chl_in
  5141. Set input channel layout. By default, this is @var{stereo}.
  5142. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5143. for the required syntax.
  5144. @item level_in
  5145. Set input volume level. By default, this is @var{1}.
  5146. @item level_out
  5147. Set output volume level. By default, this is @var{1}.
  5148. @item lfe
  5149. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5150. @item lfe_low
  5151. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5152. @item lfe_high
  5153. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5154. @item lfe_mode
  5155. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5156. In @var{add} mode, LFE channel is created from input audio and added to output.
  5157. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5158. also all non-LFE output channels are subtracted with output LFE channel.
  5159. @item angle
  5160. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5161. Default is @var{90}.
  5162. @item fc_in
  5163. Set front center input volume. By default, this is @var{1}.
  5164. @item fc_out
  5165. Set front center output volume. By default, this is @var{1}.
  5166. @item fl_in
  5167. Set front left input volume. By default, this is @var{1}.
  5168. @item fl_out
  5169. Set front left output volume. By default, this is @var{1}.
  5170. @item fr_in
  5171. Set front right input volume. By default, this is @var{1}.
  5172. @item fr_out
  5173. Set front right output volume. By default, this is @var{1}.
  5174. @item sl_in
  5175. Set side left input volume. By default, this is @var{1}.
  5176. @item sl_out
  5177. Set side left output volume. By default, this is @var{1}.
  5178. @item sr_in
  5179. Set side right input volume. By default, this is @var{1}.
  5180. @item sr_out
  5181. Set side right output volume. By default, this is @var{1}.
  5182. @item bl_in
  5183. Set back left input volume. By default, this is @var{1}.
  5184. @item bl_out
  5185. Set back left output volume. By default, this is @var{1}.
  5186. @item br_in
  5187. Set back right input volume. By default, this is @var{1}.
  5188. @item br_out
  5189. Set back right output volume. By default, this is @var{1}.
  5190. @item bc_in
  5191. Set back center input volume. By default, this is @var{1}.
  5192. @item bc_out
  5193. Set back center output volume. By default, this is @var{1}.
  5194. @item lfe_in
  5195. Set LFE input volume. By default, this is @var{1}.
  5196. @item lfe_out
  5197. Set LFE output volume. By default, this is @var{1}.
  5198. @item allx
  5199. Set spread usage of stereo image across X axis for all channels.
  5200. Allowed range is from @var{-1} to @var{15}.
  5201. By default this value is negative @var{-1}, and thus unused.
  5202. @item ally
  5203. Set spread usage of stereo image across Y axis for all channels.
  5204. Allowed range is from @var{-1} to @var{15}.
  5205. By default this value is negative @var{-1}, and thus unused.
  5206. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5207. Set spread usage of stereo image across X axis for each channel.
  5208. Allowed range is from @var{0.06} to @var{15}.
  5209. By default this value is @var{0.5}.
  5210. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5211. Set spread usage of stereo image across Y axis for each channel.
  5212. Allowed range is from @var{0.06} to @var{15}.
  5213. By default this value is @var{0.5}.
  5214. @item win_size
  5215. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5216. @item win_func
  5217. Set window function.
  5218. It accepts the following values:
  5219. @table @samp
  5220. @item rect
  5221. @item bartlett
  5222. @item hann, hanning
  5223. @item hamming
  5224. @item blackman
  5225. @item welch
  5226. @item flattop
  5227. @item bharris
  5228. @item bnuttall
  5229. @item bhann
  5230. @item sine
  5231. @item nuttall
  5232. @item lanczos
  5233. @item gauss
  5234. @item tukey
  5235. @item dolph
  5236. @item cauchy
  5237. @item parzen
  5238. @item poisson
  5239. @item bohman
  5240. @item kaiser
  5241. @end table
  5242. Default is @code{hann}.
  5243. @item overlap
  5244. Set window overlap. If set to 1, the recommended overlap for selected
  5245. window function will be picked. Default is @code{0.5}.
  5246. @end table
  5247. @section tiltshelf
  5248. Boost or cut the lower frequencies and cut or boost higher frequencies
  5249. of the audio using a two-pole shelving filter with a response similar to
  5250. that of a standard hi-fi's tone-controls.
  5251. This is also known as shelving equalisation (EQ).
  5252. The filter accepts the following options:
  5253. @table @option
  5254. @item gain, g
  5255. Give the gain at 0 Hz. Its useful range is about -20
  5256. (for a large cut) to +20 (for a large boost).
  5257. Beware of clipping when using a positive gain.
  5258. @item frequency, f
  5259. Set the filter's central frequency and so can be used
  5260. to extend or reduce the frequency range to be boosted or cut.
  5261. The default value is @code{3000} Hz.
  5262. @item width_type, t
  5263. Set method to specify band-width of filter.
  5264. @table @option
  5265. @item h
  5266. Hz
  5267. @item q
  5268. Q-Factor
  5269. @item o
  5270. octave
  5271. @item s
  5272. slope
  5273. @item k
  5274. kHz
  5275. @end table
  5276. @item width, w
  5277. Determine how steep is the filter's shelf transition.
  5278. @item poles, p
  5279. Set number of poles. Default is 2.
  5280. @item mix, m
  5281. How much to use filtered signal in output. Default is 1.
  5282. Range is between 0 and 1.
  5283. @item channels, c
  5284. Specify which channels to filter, by default all available are filtered.
  5285. @item normalize, n
  5286. Normalize biquad coefficients, by default is disabled.
  5287. Enabling it will normalize magnitude response at DC to 0dB.
  5288. @item transform, a
  5289. Set transform type of IIR filter.
  5290. @table @option
  5291. @item di
  5292. @item dii
  5293. @item tdi
  5294. @item tdii
  5295. @item latt
  5296. @item svf
  5297. @item zdf
  5298. @end table
  5299. @item precision, r
  5300. Set precison of filtering.
  5301. @table @option
  5302. @item auto
  5303. Pick automatic sample format depending on surround filters.
  5304. @item s16
  5305. Always use signed 16-bit.
  5306. @item s32
  5307. Always use signed 32-bit.
  5308. @item f32
  5309. Always use float 32-bit.
  5310. @item f64
  5311. Always use float 64-bit.
  5312. @end table
  5313. @item block_size, b
  5314. Set block size used for reverse IIR processing. If this value is set to high enough
  5315. value (higher than impulse response length truncated when reaches near zero values) filtering
  5316. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5317. Note that filter delay will be exactly this many samples when set to non-zero value.
  5318. @end table
  5319. @subsection Commands
  5320. This filter supports some options as @ref{commands}.
  5321. @section treble, highshelf
  5322. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5323. shelving filter with a response similar to that of a standard
  5324. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5325. The filter accepts the following options:
  5326. @table @option
  5327. @item gain, g
  5328. Give the gain at whichever is the lower of ~22 kHz and the
  5329. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5330. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5331. @item frequency, f
  5332. Set the filter's central frequency and so can be used
  5333. to extend or reduce the frequency range to be boosted or cut.
  5334. The default value is @code{3000} Hz.
  5335. @item width_type, t
  5336. Set method to specify band-width of filter.
  5337. @table @option
  5338. @item h
  5339. Hz
  5340. @item q
  5341. Q-Factor
  5342. @item o
  5343. octave
  5344. @item s
  5345. slope
  5346. @item k
  5347. kHz
  5348. @end table
  5349. @item width, w
  5350. Determine how steep is the filter's shelf transition.
  5351. @item poles, p
  5352. Set number of poles. Default is 2.
  5353. @item mix, m
  5354. How much to use filtered signal in output. Default is 1.
  5355. Range is between 0 and 1.
  5356. @item channels, c
  5357. Specify which channels to filter, by default all available are filtered.
  5358. @item normalize, n
  5359. Normalize biquad coefficients, by default is disabled.
  5360. Enabling it will normalize magnitude response at DC to 0dB.
  5361. @item transform, a
  5362. Set transform type of IIR filter.
  5363. @table @option
  5364. @item di
  5365. @item dii
  5366. @item tdi
  5367. @item tdii
  5368. @item latt
  5369. @item svf
  5370. @item zdf
  5371. @end table
  5372. @item precision, r
  5373. Set precison of filtering.
  5374. @table @option
  5375. @item auto
  5376. Pick automatic sample format depending on surround filters.
  5377. @item s16
  5378. Always use signed 16-bit.
  5379. @item s32
  5380. Always use signed 32-bit.
  5381. @item f32
  5382. Always use float 32-bit.
  5383. @item f64
  5384. Always use float 64-bit.
  5385. @end table
  5386. @item block_size, b
  5387. Set block size used for reverse IIR processing. If this value is set to high enough
  5388. value (higher than impulse response length truncated when reaches near zero values) filtering
  5389. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5390. Note that filter delay will be exactly this many samples when set to non-zero value.
  5391. @end table
  5392. @subsection Commands
  5393. This filter supports the following commands:
  5394. @table @option
  5395. @item frequency, f
  5396. Change treble frequency.
  5397. Syntax for the command is : "@var{frequency}"
  5398. @item width_type, t
  5399. Change treble width_type.
  5400. Syntax for the command is : "@var{width_type}"
  5401. @item width, w
  5402. Change treble width.
  5403. Syntax for the command is : "@var{width}"
  5404. @item gain, g
  5405. Change treble gain.
  5406. Syntax for the command is : "@var{gain}"
  5407. @item mix, m
  5408. Change treble mix.
  5409. Syntax for the command is : "@var{mix}"
  5410. @end table
  5411. @section tremolo
  5412. Sinusoidal amplitude modulation.
  5413. The filter accepts the following options:
  5414. @table @option
  5415. @item f
  5416. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5417. (20 Hz or lower) will result in a tremolo effect.
  5418. This filter may also be used as a ring modulator by specifying
  5419. a modulation frequency higher than 20 Hz.
  5420. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5421. @item d
  5422. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5423. Default value is 0.5.
  5424. @end table
  5425. @section vibrato
  5426. Sinusoidal phase modulation.
  5427. The filter accepts the following options:
  5428. @table @option
  5429. @item f
  5430. Modulation frequency in Hertz.
  5431. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5432. @item d
  5433. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5434. Default value is 0.5.
  5435. @end table
  5436. @section virtualbass
  5437. Apply audio Virtual Bass filter.
  5438. This filter accepts stereo input and produce stereo with LFE (2.1) channels output.
  5439. The newly produced LFE channel have enhanced virtual bass originally obtained from both stereo channels.
  5440. This filter outputs front left and front right channels unchanged as available in stereo input.
  5441. The filter accepts the following options:
  5442. @table @option
  5443. @item cutoff
  5444. Set the virtual bass cutoff frequency. Default value is 250 Hz.
  5445. Allowed range is from 100 to 500 Hz.
  5446. @item strength
  5447. Set the virtual bass strength. Allowed range is from 0.5 to 3.
  5448. Default value is 3.
  5449. @end table
  5450. @section volume
  5451. Adjust the input audio volume.
  5452. It accepts the following parameters:
  5453. @table @option
  5454. @item volume
  5455. Set audio volume expression.
  5456. Output values are clipped to the maximum value.
  5457. The output audio volume is given by the relation:
  5458. @example
  5459. @var{output_volume} = @var{volume} * @var{input_volume}
  5460. @end example
  5461. The default value for @var{volume} is "1.0".
  5462. @item precision
  5463. This parameter represents the mathematical precision.
  5464. It determines which input sample formats will be allowed, which affects the
  5465. precision of the volume scaling.
  5466. @table @option
  5467. @item fixed
  5468. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5469. @item float
  5470. 32-bit floating-point; this limits input sample format to FLT. (default)
  5471. @item double
  5472. 64-bit floating-point; this limits input sample format to DBL.
  5473. @end table
  5474. @item replaygain
  5475. Choose the behaviour on encountering ReplayGain side data in input frames.
  5476. @table @option
  5477. @item drop
  5478. Remove ReplayGain side data, ignoring its contents (the default).
  5479. @item ignore
  5480. Ignore ReplayGain side data, but leave it in the frame.
  5481. @item track
  5482. Prefer the track gain, if present.
  5483. @item album
  5484. Prefer the album gain, if present.
  5485. @end table
  5486. @item replaygain_preamp
  5487. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5488. Default value for @var{replaygain_preamp} is 0.0.
  5489. @item replaygain_noclip
  5490. Prevent clipping by limiting the gain applied.
  5491. Default value for @var{replaygain_noclip} is 1.
  5492. @item eval
  5493. Set when the volume expression is evaluated.
  5494. It accepts the following values:
  5495. @table @samp
  5496. @item once
  5497. only evaluate expression once during the filter initialization, or
  5498. when the @samp{volume} command is sent
  5499. @item frame
  5500. evaluate expression for each incoming frame
  5501. @end table
  5502. Default value is @samp{once}.
  5503. @end table
  5504. The volume expression can contain the following parameters.
  5505. @table @option
  5506. @item n
  5507. frame number (starting at zero)
  5508. @item nb_channels
  5509. number of channels
  5510. @item nb_consumed_samples
  5511. number of samples consumed by the filter
  5512. @item nb_samples
  5513. number of samples in the current frame
  5514. @item pos
  5515. original frame position in the file
  5516. @item pts
  5517. frame PTS
  5518. @item sample_rate
  5519. sample rate
  5520. @item startpts
  5521. PTS at start of stream
  5522. @item startt
  5523. time at start of stream
  5524. @item t
  5525. frame time
  5526. @item tb
  5527. timestamp timebase
  5528. @item volume
  5529. last set volume value
  5530. @end table
  5531. Note that when @option{eval} is set to @samp{once} only the
  5532. @var{sample_rate} and @var{tb} variables are available, all other
  5533. variables will evaluate to NAN.
  5534. @subsection Commands
  5535. This filter supports the following commands:
  5536. @table @option
  5537. @item volume
  5538. Modify the volume expression.
  5539. The command accepts the same syntax of the corresponding option.
  5540. If the specified expression is not valid, it is kept at its current
  5541. value.
  5542. @end table
  5543. @subsection Examples
  5544. @itemize
  5545. @item
  5546. Halve the input audio volume:
  5547. @example
  5548. volume=volume=0.5
  5549. volume=volume=1/2
  5550. volume=volume=-6.0206dB
  5551. @end example
  5552. In all the above example the named key for @option{volume} can be
  5553. omitted, for example like in:
  5554. @example
  5555. volume=0.5
  5556. @end example
  5557. @item
  5558. Increase input audio power by 6 decibels using fixed-point precision:
  5559. @example
  5560. volume=volume=6dB:precision=fixed
  5561. @end example
  5562. @item
  5563. Fade volume after time 10 with an annihilation period of 5 seconds:
  5564. @example
  5565. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5566. @end example
  5567. @end itemize
  5568. @section volumedetect
  5569. Detect the volume of the input video.
  5570. The filter has no parameters. It supports only 16-bit signed integer samples,
  5571. so the input will be converted when needed. Statistics about the volume will
  5572. be printed in the log when the input stream end is reached.
  5573. In particular it will show the mean volume (root mean square), maximum
  5574. volume (on a per-sample basis), and the beginning of a histogram of the
  5575. registered volume values (from the maximum value to a cumulated 1/1000 of
  5576. the samples).
  5577. All volumes are in decibels relative to the maximum PCM value.
  5578. @subsection Examples
  5579. Here is an excerpt of the output:
  5580. @example
  5581. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5582. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5583. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5584. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5585. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5586. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5587. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5588. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5589. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5590. @end example
  5591. It means that:
  5592. @itemize
  5593. @item
  5594. The mean square energy is approximately -27 dB, or 10^-2.7.
  5595. @item
  5596. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5597. @item
  5598. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5599. @end itemize
  5600. In other words, raising the volume by +4 dB does not cause any clipping,
  5601. raising it by +5 dB causes clipping for 6 samples, etc.
  5602. @c man end AUDIO FILTERS
  5603. @chapter Audio Sources
  5604. @c man begin AUDIO SOURCES
  5605. Below is a description of the currently available audio sources.
  5606. @section abuffer
  5607. Buffer audio frames, and make them available to the filter chain.
  5608. This source is mainly intended for a programmatic use, in particular
  5609. through the interface defined in @file{libavfilter/buffersrc.h}.
  5610. It accepts the following parameters:
  5611. @table @option
  5612. @item time_base
  5613. The timebase which will be used for timestamps of submitted frames. It must be
  5614. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5615. @item sample_rate
  5616. The sample rate of the incoming audio buffers.
  5617. @item sample_fmt
  5618. The sample format of the incoming audio buffers.
  5619. Either a sample format name or its corresponding integer representation from
  5620. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5621. @item channel_layout
  5622. The channel layout of the incoming audio buffers.
  5623. Either a channel layout name from channel_layout_map in
  5624. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5625. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5626. @item channels
  5627. The number of channels of the incoming audio buffers.
  5628. If both @var{channels} and @var{channel_layout} are specified, then they
  5629. must be consistent.
  5630. @end table
  5631. @subsection Examples
  5632. @example
  5633. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  5634. @end example
  5635. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  5636. Since the sample format with name "s16p" corresponds to the number
  5637. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  5638. equivalent to:
  5639. @example
  5640. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  5641. @end example
  5642. @section aevalsrc
  5643. Generate an audio signal specified by an expression.
  5644. This source accepts in input one or more expressions (one for each
  5645. channel), which are evaluated and used to generate a corresponding
  5646. audio signal.
  5647. This source accepts the following options:
  5648. @table @option
  5649. @item exprs
  5650. Set the '|'-separated expressions list for each separate channel. In case the
  5651. @option{channel_layout} option is not specified, the selected channel layout
  5652. depends on the number of provided expressions. Otherwise the last
  5653. specified expression is applied to the remaining output channels.
  5654. @item channel_layout, c
  5655. Set the channel layout. The number of channels in the specified layout
  5656. must be equal to the number of specified expressions.
  5657. @item duration, d
  5658. Set the minimum duration of the sourced audio. See
  5659. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5660. for the accepted syntax.
  5661. Note that the resulting duration may be greater than the specified
  5662. duration, as the generated audio is always cut at the end of a
  5663. complete frame.
  5664. If not specified, or the expressed duration is negative, the audio is
  5665. supposed to be generated forever.
  5666. @item nb_samples, n
  5667. Set the number of samples per channel per each output frame,
  5668. default to 1024.
  5669. @item sample_rate, s
  5670. Specify the sample rate, default to 44100.
  5671. @end table
  5672. Each expression in @var{exprs} can contain the following constants:
  5673. @table @option
  5674. @item n
  5675. number of the evaluated sample, starting from 0
  5676. @item t
  5677. time of the evaluated sample expressed in seconds, starting from 0
  5678. @item s
  5679. sample rate
  5680. @end table
  5681. @subsection Examples
  5682. @itemize
  5683. @item
  5684. Generate silence:
  5685. @example
  5686. aevalsrc=0
  5687. @end example
  5688. @item
  5689. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5690. 8000 Hz:
  5691. @example
  5692. aevalsrc="sin(440*2*PI*t):s=8000"
  5693. @end example
  5694. @item
  5695. Generate a two channels signal, specify the channel layout (Front
  5696. Center + Back Center) explicitly:
  5697. @example
  5698. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5699. @end example
  5700. @item
  5701. Generate white noise:
  5702. @example
  5703. aevalsrc="-2+random(0)"
  5704. @end example
  5705. @item
  5706. Generate an amplitude modulated signal:
  5707. @example
  5708. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5709. @end example
  5710. @item
  5711. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5712. @example
  5713. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5714. @end example
  5715. @end itemize
  5716. @section afirsrc
  5717. Generate a FIR coefficients using frequency sampling method.
  5718. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5719. The filter accepts the following options:
  5720. @table @option
  5721. @item taps, t
  5722. Set number of filter coefficents in output audio stream.
  5723. Default value is 1025.
  5724. @item frequency, f
  5725. Set frequency points from where magnitude and phase are set.
  5726. This must be in non decreasing order, and first element must be 0, while last element
  5727. must be 1. Elements are separated by white spaces.
  5728. @item magnitude, m
  5729. Set magnitude value for every frequency point set by @option{frequency}.
  5730. Number of values must be same as number of frequency points.
  5731. Values are separated by white spaces.
  5732. @item phase, p
  5733. Set phase value for every frequency point set by @option{frequency}.
  5734. Number of values must be same as number of frequency points.
  5735. Values are separated by white spaces.
  5736. @item sample_rate, r
  5737. Set sample rate, default is 44100.
  5738. @item nb_samples, n
  5739. Set number of samples per each frame. Default is 1024.
  5740. @item win_func, w
  5741. Set window function. Default is blackman.
  5742. @end table
  5743. @section anullsrc
  5744. The null audio source, return unprocessed audio frames. It is mainly useful
  5745. as a template and to be employed in analysis / debugging tools, or as
  5746. the source for filters which ignore the input data (for example the sox
  5747. synth filter).
  5748. This source accepts the following options:
  5749. @table @option
  5750. @item channel_layout, cl
  5751. Specifies the channel layout, and can be either an integer or a string
  5752. representing a channel layout. The default value of @var{channel_layout}
  5753. is "stereo".
  5754. Check the channel_layout_map definition in
  5755. @file{libavutil/channel_layout.c} for the mapping between strings and
  5756. channel layout values.
  5757. @item sample_rate, r
  5758. Specifies the sample rate, and defaults to 44100.
  5759. @item nb_samples, n
  5760. Set the number of samples per requested frames.
  5761. @item duration, d
  5762. Set the duration of the sourced audio. See
  5763. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5764. for the accepted syntax.
  5765. If not specified, or the expressed duration is negative, the audio is
  5766. supposed to be generated forever.
  5767. @end table
  5768. @subsection Examples
  5769. @itemize
  5770. @item
  5771. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5772. @example
  5773. anullsrc=r=48000:cl=4
  5774. @end example
  5775. @item
  5776. Do the same operation with a more obvious syntax:
  5777. @example
  5778. anullsrc=r=48000:cl=mono
  5779. @end example
  5780. @end itemize
  5781. All the parameters need to be explicitly defined.
  5782. @section flite
  5783. Synthesize a voice utterance using the libflite library.
  5784. To enable compilation of this filter you need to configure FFmpeg with
  5785. @code{--enable-libflite}.
  5786. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5787. The filter accepts the following options:
  5788. @table @option
  5789. @item list_voices
  5790. If set to 1, list the names of the available voices and exit
  5791. immediately. Default value is 0.
  5792. @item nb_samples, n
  5793. Set the maximum number of samples per frame. Default value is 512.
  5794. @item textfile
  5795. Set the filename containing the text to speak.
  5796. @item text
  5797. Set the text to speak.
  5798. @item voice, v
  5799. Set the voice to use for the speech synthesis. Default value is
  5800. @code{kal}. See also the @var{list_voices} option.
  5801. @end table
  5802. @subsection Examples
  5803. @itemize
  5804. @item
  5805. Read from file @file{speech.txt}, and synthesize the text using the
  5806. standard flite voice:
  5807. @example
  5808. flite=textfile=speech.txt
  5809. @end example
  5810. @item
  5811. Read the specified text selecting the @code{slt} voice:
  5812. @example
  5813. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5814. @end example
  5815. @item
  5816. Input text to ffmpeg:
  5817. @example
  5818. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5819. @end example
  5820. @item
  5821. Make @file{ffplay} speak the specified text, using @code{flite} and
  5822. the @code{lavfi} device:
  5823. @example
  5824. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5825. @end example
  5826. @end itemize
  5827. For more information about libflite, check:
  5828. @url{http://www.festvox.org/flite/}
  5829. @section anoisesrc
  5830. Generate a noise audio signal.
  5831. The filter accepts the following options:
  5832. @table @option
  5833. @item sample_rate, r
  5834. Specify the sample rate. Default value is 48000 Hz.
  5835. @item amplitude, a
  5836. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5837. is 1.0.
  5838. @item duration, d
  5839. Specify the duration of the generated audio stream. Not specifying this option
  5840. results in noise with an infinite length.
  5841. @item color, colour, c
  5842. Specify the color of noise. Available noise colors are white, pink, brown,
  5843. blue, violet and velvet. Default color is white.
  5844. @item seed, s
  5845. Specify a value used to seed the PRNG.
  5846. @item nb_samples, n
  5847. Set the number of samples per each output frame, default is 1024.
  5848. @end table
  5849. @subsection Examples
  5850. @itemize
  5851. @item
  5852. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5853. @example
  5854. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5855. @end example
  5856. @end itemize
  5857. @section hilbert
  5858. Generate odd-tap Hilbert transform FIR coefficients.
  5859. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5860. the signal by 90 degrees.
  5861. This is used in many matrix coding schemes and for analytic signal generation.
  5862. The process is often written as a multiplication by i (or j), the imaginary unit.
  5863. The filter accepts the following options:
  5864. @table @option
  5865. @item sample_rate, s
  5866. Set sample rate, default is 44100.
  5867. @item taps, t
  5868. Set length of FIR filter, default is 22051.
  5869. @item nb_samples, n
  5870. Set number of samples per each frame.
  5871. @item win_func, w
  5872. Set window function to be used when generating FIR coefficients.
  5873. @end table
  5874. @section sinc
  5875. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5876. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5877. The filter accepts the following options:
  5878. @table @option
  5879. @item sample_rate, r
  5880. Set sample rate, default is 44100.
  5881. @item nb_samples, n
  5882. Set number of samples per each frame. Default is 1024.
  5883. @item hp
  5884. Set high-pass frequency. Default is 0.
  5885. @item lp
  5886. Set low-pass frequency. Default is 0.
  5887. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5888. is higher than 0 then filter will create band-pass filter coefficients,
  5889. otherwise band-reject filter coefficients.
  5890. @item phase
  5891. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5892. @item beta
  5893. Set Kaiser window beta.
  5894. @item att
  5895. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5896. @item round
  5897. Enable rounding, by default is disabled.
  5898. @item hptaps
  5899. Set number of taps for high-pass filter.
  5900. @item lptaps
  5901. Set number of taps for low-pass filter.
  5902. @end table
  5903. @section sine
  5904. Generate an audio signal made of a sine wave with amplitude 1/8.
  5905. The audio signal is bit-exact.
  5906. The filter accepts the following options:
  5907. @table @option
  5908. @item frequency, f
  5909. Set the carrier frequency. Default is 440 Hz.
  5910. @item beep_factor, b
  5911. Enable a periodic beep every second with frequency @var{beep_factor} times
  5912. the carrier frequency. Default is 0, meaning the beep is disabled.
  5913. @item sample_rate, r
  5914. Specify the sample rate, default is 44100.
  5915. @item duration, d
  5916. Specify the duration of the generated audio stream.
  5917. @item samples_per_frame
  5918. Set the number of samples per output frame.
  5919. The expression can contain the following constants:
  5920. @table @option
  5921. @item n
  5922. The (sequential) number of the output audio frame, starting from 0.
  5923. @item pts
  5924. The PTS (Presentation TimeStamp) of the output audio frame,
  5925. expressed in @var{TB} units.
  5926. @item t
  5927. The PTS of the output audio frame, expressed in seconds.
  5928. @item TB
  5929. The timebase of the output audio frames.
  5930. @end table
  5931. Default is @code{1024}.
  5932. @end table
  5933. @subsection Examples
  5934. @itemize
  5935. @item
  5936. Generate a simple 440 Hz sine wave:
  5937. @example
  5938. sine
  5939. @end example
  5940. @item
  5941. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5942. @example
  5943. sine=220:4:d=5
  5944. sine=f=220:b=4:d=5
  5945. sine=frequency=220:beep_factor=4:duration=5
  5946. @end example
  5947. @item
  5948. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5949. pattern:
  5950. @example
  5951. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5952. @end example
  5953. @end itemize
  5954. @c man end AUDIO SOURCES
  5955. @chapter Audio Sinks
  5956. @c man begin AUDIO SINKS
  5957. Below is a description of the currently available audio sinks.
  5958. @section abuffersink
  5959. Buffer audio frames, and make them available to the end of filter chain.
  5960. This sink is mainly intended for programmatic use, in particular
  5961. through the interface defined in @file{libavfilter/buffersink.h}
  5962. or the options system.
  5963. It accepts a pointer to an AVABufferSinkContext structure, which
  5964. defines the incoming buffers' formats, to be passed as the opaque
  5965. parameter to @code{avfilter_init_filter} for initialization.
  5966. @section anullsink
  5967. Null audio sink; do absolutely nothing with the input audio. It is
  5968. mainly useful as a template and for use in analysis / debugging
  5969. tools.
  5970. @c man end AUDIO SINKS
  5971. @chapter Video Filters
  5972. @c man begin VIDEO FILTERS
  5973. When you configure your FFmpeg build, you can disable any of the
  5974. existing filters using @code{--disable-filters}.
  5975. The configure output will show the video filters included in your
  5976. build.
  5977. Below is a description of the currently available video filters.
  5978. @section addroi
  5979. Mark a region of interest in a video frame.
  5980. The frame data is passed through unchanged, but metadata is attached
  5981. to the frame indicating regions of interest which can affect the
  5982. behaviour of later encoding. Multiple regions can be marked by
  5983. applying the filter multiple times.
  5984. @table @option
  5985. @item x
  5986. Region distance in pixels from the left edge of the frame.
  5987. @item y
  5988. Region distance in pixels from the top edge of the frame.
  5989. @item w
  5990. Region width in pixels.
  5991. @item h
  5992. Region height in pixels.
  5993. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5994. and may contain the following variables:
  5995. @table @option
  5996. @item iw
  5997. Width of the input frame.
  5998. @item ih
  5999. Height of the input frame.
  6000. @end table
  6001. @item qoffset
  6002. Quantisation offset to apply within the region.
  6003. This must be a real value in the range -1 to +1. A value of zero
  6004. indicates no quality change. A negative value asks for better quality
  6005. (less quantisation), while a positive value asks for worse quality
  6006. (greater quantisation).
  6007. The range is calibrated so that the extreme values indicate the
  6008. largest possible offset - if the rest of the frame is encoded with the
  6009. worst possible quality, an offset of -1 indicates that this region
  6010. should be encoded with the best possible quality anyway. Intermediate
  6011. values are then interpolated in some codec-dependent way.
  6012. For example, in 10-bit H.264 the quantisation parameter varies between
  6013. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  6014. this region should be encoded with a QP around one-tenth of the full
  6015. range better than the rest of the frame. So, if most of the frame
  6016. were to be encoded with a QP of around 30, this region would get a QP
  6017. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  6018. An extreme value of -1 would indicate that this region should be
  6019. encoded with the best possible quality regardless of the treatment of
  6020. the rest of the frame - that is, should be encoded at a QP of -12.
  6021. @item clear
  6022. If set to true, remove any existing regions of interest marked on the
  6023. frame before adding the new one.
  6024. @end table
  6025. @subsection Examples
  6026. @itemize
  6027. @item
  6028. Mark the centre quarter of the frame as interesting.
  6029. @example
  6030. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  6031. @end example
  6032. @item
  6033. Mark the 100-pixel-wide region on the left edge of the frame as very
  6034. uninteresting (to be encoded at much lower quality than the rest of
  6035. the frame).
  6036. @example
  6037. addroi=0:0:100:ih:+1/5
  6038. @end example
  6039. @end itemize
  6040. @section alphaextract
  6041. Extract the alpha component from the input as a grayscale video. This
  6042. is especially useful with the @var{alphamerge} filter.
  6043. @section alphamerge
  6044. Add or replace the alpha component of the primary input with the
  6045. grayscale value of a second input. This is intended for use with
  6046. @var{alphaextract} to allow the transmission or storage of frame
  6047. sequences that have alpha in a format that doesn't support an alpha
  6048. channel.
  6049. For example, to reconstruct full frames from a normal YUV-encoded video
  6050. and a separate video created with @var{alphaextract}, you might use:
  6051. @example
  6052. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  6053. @end example
  6054. @section amplify
  6055. Amplify differences between current pixel and pixels of adjacent frames in
  6056. same pixel location.
  6057. This filter accepts the following options:
  6058. @table @option
  6059. @item radius
  6060. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  6061. For example radius of 3 will instruct filter to calculate average of 7 frames.
  6062. @item factor
  6063. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  6064. @item threshold
  6065. Set threshold for difference amplification. Any difference greater or equal to
  6066. this value will not alter source pixel. Default is 10.
  6067. Allowed range is from 0 to 65535.
  6068. @item tolerance
  6069. Set tolerance for difference amplification. Any difference lower to
  6070. this value will not alter source pixel. Default is 0.
  6071. Allowed range is from 0 to 65535.
  6072. @item low
  6073. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6074. This option controls maximum possible value that will decrease source pixel value.
  6075. @item high
  6076. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6077. This option controls maximum possible value that will increase source pixel value.
  6078. @item planes
  6079. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  6080. @end table
  6081. @subsection Commands
  6082. This filter supports the following @ref{commands} that corresponds to option of same name:
  6083. @table @option
  6084. @item factor
  6085. @item threshold
  6086. @item tolerance
  6087. @item low
  6088. @item high
  6089. @item planes
  6090. @end table
  6091. @section ass
  6092. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  6093. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  6094. Substation Alpha) subtitles files.
  6095. This filter accepts the following option in addition to the common options from
  6096. the @ref{subtitles} filter:
  6097. @table @option
  6098. @item shaping
  6099. Set the shaping engine
  6100. Available values are:
  6101. @table @samp
  6102. @item auto
  6103. The default libass shaping engine, which is the best available.
  6104. @item simple
  6105. Fast, font-agnostic shaper that can do only substitutions
  6106. @item complex
  6107. Slower shaper using OpenType for substitutions and positioning
  6108. @end table
  6109. The default is @code{auto}.
  6110. @end table
  6111. @section atadenoise
  6112. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  6113. The filter accepts the following options:
  6114. @table @option
  6115. @item 0a
  6116. Set threshold A for 1st plane. Default is 0.02.
  6117. Valid range is 0 to 0.3.
  6118. @item 0b
  6119. Set threshold B for 1st plane. Default is 0.04.
  6120. Valid range is 0 to 5.
  6121. @item 1a
  6122. Set threshold A for 2nd plane. Default is 0.02.
  6123. Valid range is 0 to 0.3.
  6124. @item 1b
  6125. Set threshold B for 2nd plane. Default is 0.04.
  6126. Valid range is 0 to 5.
  6127. @item 2a
  6128. Set threshold A for 3rd plane. Default is 0.02.
  6129. Valid range is 0 to 0.3.
  6130. @item 2b
  6131. Set threshold B for 3rd plane. Default is 0.04.
  6132. Valid range is 0 to 5.
  6133. Threshold A is designed to react on abrupt changes in the input signal and
  6134. threshold B is designed to react on continuous changes in the input signal.
  6135. @item s
  6136. Set number of frames filter will use for averaging. Default is 9. Must be odd
  6137. number in range [5, 129].
  6138. @item p
  6139. Set what planes of frame filter will use for averaging. Default is all.
  6140. @item a
  6141. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  6142. Alternatively can be set to @code{s} serial.
  6143. Parallel can be faster then serial, while other way around is never true.
  6144. Parallel will abort early on first change being greater then thresholds, while serial
  6145. will continue processing other side of frames if they are equal or below thresholds.
  6146. @item 0s
  6147. @item 1s
  6148. @item 2s
  6149. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  6150. Valid range is from 0 to 32767.
  6151. This options controls weight for each pixel in radius defined by size.
  6152. Default value means every pixel have same weight.
  6153. Setting this option to 0 effectively disables filtering.
  6154. @end table
  6155. @subsection Commands
  6156. This filter supports same @ref{commands} as options except option @code{s}.
  6157. The command accepts the same syntax of the corresponding option.
  6158. @section avgblur
  6159. Apply average blur filter.
  6160. The filter accepts the following options:
  6161. @table @option
  6162. @item sizeX
  6163. Set horizontal radius size.
  6164. @item planes
  6165. Set which planes to filter. By default all planes are filtered.
  6166. @item sizeY
  6167. Set vertical radius size, if zero it will be same as @code{sizeX}.
  6168. Default is @code{0}.
  6169. @end table
  6170. @subsection Commands
  6171. This filter supports same commands as options.
  6172. The command accepts the same syntax of the corresponding option.
  6173. If the specified expression is not valid, it is kept at its current
  6174. value.
  6175. @section bbox
  6176. Compute the bounding box for the non-black pixels in the input frame
  6177. luminance plane.
  6178. This filter computes the bounding box containing all the pixels with a
  6179. luminance value greater than the minimum allowed value.
  6180. The parameters describing the bounding box are printed on the filter
  6181. log.
  6182. The filter accepts the following option:
  6183. @table @option
  6184. @item min_val
  6185. Set the minimal luminance value. Default is @code{16}.
  6186. @end table
  6187. @subsection Commands
  6188. This filter supports the all above options as @ref{commands}.
  6189. @section bilateral
  6190. Apply bilateral filter, spatial smoothing while preserving edges.
  6191. The filter accepts the following options:
  6192. @table @option
  6193. @item sigmaS
  6194. Set sigma of gaussian function to calculate spatial weight.
  6195. Allowed range is 0 to 512. Default is 0.1.
  6196. @item sigmaR
  6197. Set sigma of gaussian function to calculate range weight.
  6198. Allowed range is 0 to 1. Default is 0.1.
  6199. @item planes
  6200. Set planes to filter. Default is first only.
  6201. @end table
  6202. @subsection Commands
  6203. This filter supports the all above options as @ref{commands}.
  6204. @section bilateral_cuda
  6205. CUDA accelerated bilateral filter, an edge preserving filter.
  6206. This filter is mathematically accurate thanks to the use of GPU acceleration.
  6207. For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
  6208. The filter accepts the following options:
  6209. @table @option
  6210. @item sigmaS
  6211. Set sigma of gaussian function to calculate spatial weight, also called sigma space.
  6212. Allowed range is 0.1 to 512. Default is 0.1.
  6213. @item sigmaR
  6214. Set sigma of gaussian function to calculate color range weight, also called sigma color.
  6215. Allowed range is 0.1 to 512. Default is 0.1.
  6216. @item window_size
  6217. Set window size of the bilateral function to determine the number of neighbours to loop on.
  6218. If the number entered is even, one will be added automatically.
  6219. Allowed range is 1 to 255. Default is 1.
  6220. @end table
  6221. @subsection Examples
  6222. @itemize
  6223. @item
  6224. Apply the bilateral filter on a video.
  6225. @example
  6226. ./ffmpeg -v verbose \
  6227. -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \
  6228. -init_hw_device cuda \
  6229. -filter_complex \
  6230. " \
  6231. [0:v]scale_cuda=format=yuv444p[scaled_video];
  6232. [scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  6233. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  6234. @end example
  6235. @end itemize
  6236. @section bitplanenoise
  6237. Show and measure bit plane noise.
  6238. The filter accepts the following options:
  6239. @table @option
  6240. @item bitplane
  6241. Set which plane to analyze. Default is @code{1}.
  6242. @item filter
  6243. Filter out noisy pixels from @code{bitplane} set above.
  6244. Default is disabled.
  6245. @end table
  6246. @section blackdetect
  6247. Detect video intervals that are (almost) completely black. Can be
  6248. useful to detect chapter transitions, commercials, or invalid
  6249. recordings.
  6250. The filter outputs its detection analysis to both the log as well as
  6251. frame metadata. If a black segment of at least the specified minimum
  6252. duration is found, a line with the start and end timestamps as well
  6253. as duration is printed to the log with level @code{info}. In addition,
  6254. a log line with level @code{debug} is printed per frame showing the
  6255. black amount detected for that frame.
  6256. The filter also attaches metadata to the first frame of a black
  6257. segment with key @code{lavfi.black_start} and to the first frame
  6258. after the black segment ends with key @code{lavfi.black_end}. The
  6259. value is the frame's timestamp. This metadata is added regardless
  6260. of the minimum duration specified.
  6261. The filter accepts the following options:
  6262. @table @option
  6263. @item black_min_duration, d
  6264. Set the minimum detected black duration expressed in seconds. It must
  6265. be a non-negative floating point number.
  6266. Default value is 2.0.
  6267. @item picture_black_ratio_th, pic_th
  6268. Set the threshold for considering a picture "black".
  6269. Express the minimum value for the ratio:
  6270. @example
  6271. @var{nb_black_pixels} / @var{nb_pixels}
  6272. @end example
  6273. for which a picture is considered black.
  6274. Default value is 0.98.
  6275. @item pixel_black_th, pix_th
  6276. Set the threshold for considering a pixel "black".
  6277. The threshold expresses the maximum pixel luminance value for which a
  6278. pixel is considered "black". The provided value is scaled according to
  6279. the following equation:
  6280. @example
  6281. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  6282. @end example
  6283. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  6284. the input video format, the range is [0-255] for YUV full-range
  6285. formats and [16-235] for YUV non full-range formats.
  6286. Default value is 0.10.
  6287. @end table
  6288. The following example sets the maximum pixel threshold to the minimum
  6289. value, and detects only black intervals of 2 or more seconds:
  6290. @example
  6291. blackdetect=d=2:pix_th=0.00
  6292. @end example
  6293. @section blackframe
  6294. Detect frames that are (almost) completely black. Can be useful to
  6295. detect chapter transitions or commercials. Output lines consist of
  6296. the frame number of the detected frame, the percentage of blackness,
  6297. the position in the file if known or -1 and the timestamp in seconds.
  6298. In order to display the output lines, you need to set the loglevel at
  6299. least to the AV_LOG_INFO value.
  6300. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6301. The value represents the percentage of pixels in the picture that
  6302. are below the threshold value.
  6303. It accepts the following parameters:
  6304. @table @option
  6305. @item amount
  6306. The percentage of the pixels that have to be below the threshold; it defaults to
  6307. @code{98}.
  6308. @item threshold, thresh
  6309. The threshold below which a pixel value is considered black; it defaults to
  6310. @code{32}.
  6311. @end table
  6312. @anchor{blend}
  6313. @section blend
  6314. Blend two video frames into each other.
  6315. The @code{blend} filter takes two input streams and outputs one
  6316. stream, the first input is the "top" layer and second input is
  6317. "bottom" layer. By default, the output terminates when the longest input terminates.
  6318. The @code{tblend} (time blend) filter takes two consecutive frames
  6319. from one single stream, and outputs the result obtained by blending
  6320. the new frame on top of the old frame.
  6321. A description of the accepted options follows.
  6322. @table @option
  6323. @item c0_mode
  6324. @item c1_mode
  6325. @item c2_mode
  6326. @item c3_mode
  6327. @item all_mode
  6328. Set blend mode for specific pixel component or all pixel components in case
  6329. of @var{all_mode}. Default value is @code{normal}.
  6330. Available values for component modes are:
  6331. @table @samp
  6332. @item addition
  6333. @item and
  6334. @item average
  6335. @item bleach
  6336. @item burn
  6337. @item darken
  6338. @item difference
  6339. @item divide
  6340. @item dodge
  6341. @item exclusion
  6342. @item extremity
  6343. @item freeze
  6344. @item geometric
  6345. @item glow
  6346. @item grainextract
  6347. @item grainmerge
  6348. @item hardlight
  6349. @item hardmix
  6350. @item hardoverlay
  6351. @item harmonic
  6352. @item heat
  6353. @item interpolate
  6354. @item lighten
  6355. @item linearlight
  6356. @item multiply
  6357. @item multiply128
  6358. @item negation
  6359. @item normal
  6360. @item or
  6361. @item overlay
  6362. @item phoenix
  6363. @item pinlight
  6364. @item reflect
  6365. @item screen
  6366. @item softdifference
  6367. @item softlight
  6368. @item stain
  6369. @item subtract
  6370. @item vividlight
  6371. @item xor
  6372. @end table
  6373. @item c0_opacity
  6374. @item c1_opacity
  6375. @item c2_opacity
  6376. @item c3_opacity
  6377. @item all_opacity
  6378. Set blend opacity for specific pixel component or all pixel components in case
  6379. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6380. @item c0_expr
  6381. @item c1_expr
  6382. @item c2_expr
  6383. @item c3_expr
  6384. @item all_expr
  6385. Set blend expression for specific pixel component or all pixel components in case
  6386. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6387. The expressions can use the following variables:
  6388. @table @option
  6389. @item N
  6390. The sequential number of the filtered frame, starting from @code{0}.
  6391. @item X
  6392. @item Y
  6393. the coordinates of the current sample
  6394. @item W
  6395. @item H
  6396. the width and height of currently filtered plane
  6397. @item SW
  6398. @item SH
  6399. Width and height scale for the plane being filtered. It is the
  6400. ratio between the dimensions of the current plane to the luma plane,
  6401. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6402. the luma plane and @code{0.5,0.5} for the chroma planes.
  6403. @item T
  6404. Time of the current frame, expressed in seconds.
  6405. @item TOP, A
  6406. Value of pixel component at current location for first video frame (top layer).
  6407. @item BOTTOM, B
  6408. Value of pixel component at current location for second video frame (bottom layer).
  6409. @end table
  6410. @end table
  6411. The @code{blend} filter also supports the @ref{framesync} options.
  6412. @subsection Examples
  6413. @itemize
  6414. @item
  6415. Apply transition from bottom layer to top layer in first 10 seconds:
  6416. @example
  6417. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6418. @end example
  6419. @item
  6420. Apply linear horizontal transition from top layer to bottom layer:
  6421. @example
  6422. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6423. @end example
  6424. @item
  6425. Apply 1x1 checkerboard effect:
  6426. @example
  6427. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6428. @end example
  6429. @item
  6430. Apply uncover left effect:
  6431. @example
  6432. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6433. @end example
  6434. @item
  6435. Apply uncover down effect:
  6436. @example
  6437. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6438. @end example
  6439. @item
  6440. Apply uncover up-left effect:
  6441. @example
  6442. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6443. @end example
  6444. @item
  6445. Split diagonally video and shows top and bottom layer on each side:
  6446. @example
  6447. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6448. @end example
  6449. @item
  6450. Display differences between the current and the previous frame:
  6451. @example
  6452. tblend=all_mode=grainextract
  6453. @end example
  6454. @end itemize
  6455. @subsection Commands
  6456. This filter supports same @ref{commands} as options.
  6457. @anchor{blockdetect}
  6458. @section blockdetect
  6459. Determines blockiness of frames without altering the input frames.
  6460. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference.
  6461. The filter accepts the following options:
  6462. @table @option
  6463. @item period_min
  6464. @item period_max
  6465. Set minimum and maximum values for determining pixel grids (periods).
  6466. Default values are [3,24].
  6467. @item planes
  6468. Set planes to filter. Default is first only.
  6469. @end table
  6470. @subsection Examples
  6471. @itemize
  6472. @item
  6473. Determine blockiness for the first plane and search for periods within [8,32]:
  6474. @example
  6475. blockdetect=period_min=8:period_max=32:planes=1
  6476. @end example
  6477. @end itemize
  6478. @anchor{blurdetect}
  6479. @section blurdetect
  6480. Determines blurriness of frames without altering the input frames.
  6481. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6482. Allows for a block-based abbreviation.
  6483. The filter accepts the following options:
  6484. @table @option
  6485. @item low
  6486. @item high
  6487. Set low and high threshold values used by the Canny thresholding
  6488. algorithm.
  6489. The high threshold selects the "strong" edge pixels, which are then
  6490. connected through 8-connectivity with the "weak" edge pixels selected
  6491. by the low threshold.
  6492. @var{low} and @var{high} threshold values must be chosen in the range
  6493. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6494. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6495. is @code{50/255}.
  6496. @item radius
  6497. Define the radius to search around an edge pixel for local maxima.
  6498. @item block_pct
  6499. Determine blurriness only for the most significant blocks, given in percentage.
  6500. @item block_width
  6501. 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}.
  6502. @item block_height
  6503. 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}.
  6504. @item planes
  6505. Set planes to filter. Default is first only.
  6506. @end table
  6507. @subsection Examples
  6508. @itemize
  6509. @item
  6510. Determine blur for 80% of most significant 32x32 blocks:
  6511. @example
  6512. blurdetect=block_width=32:block_height=32:block_pct=80
  6513. @end example
  6514. @end itemize
  6515. @section bm3d
  6516. Denoise frames using Block-Matching 3D algorithm.
  6517. The filter accepts the following options.
  6518. @table @option
  6519. @item sigma
  6520. Set denoising strength. Default value is 1.
  6521. Allowed range is from 0 to 999.9.
  6522. The denoising algorithm is very sensitive to sigma, so adjust it
  6523. according to the source.
  6524. @item block
  6525. Set local patch size. This sets dimensions in 2D.
  6526. @item bstep
  6527. Set sliding step for processing blocks. Default value is 4.
  6528. Allowed range is from 1 to 64.
  6529. Smaller values allows processing more reference blocks and is slower.
  6530. @item group
  6531. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6532. When set to 1, no block matching is done. Larger values allows more blocks
  6533. in single group.
  6534. Allowed range is from 1 to 256.
  6535. @item range
  6536. Set radius for search block matching. Default is 9.
  6537. Allowed range is from 1 to INT32_MAX.
  6538. @item mstep
  6539. Set step between two search locations for block matching. Default is 1.
  6540. Allowed range is from 1 to 64. Smaller is slower.
  6541. @item thmse
  6542. Set threshold of mean square error for block matching. Valid range is 0 to
  6543. INT32_MAX.
  6544. @item hdthr
  6545. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6546. Larger values results in stronger hard-thresholding filtering in frequency
  6547. domain.
  6548. @item estim
  6549. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6550. Default is @code{basic}.
  6551. @item ref
  6552. If enabled, filter will use 2nd stream for block matching.
  6553. Default is disabled for @code{basic} value of @var{estim} option,
  6554. and always enabled if value of @var{estim} is @code{final}.
  6555. @item planes
  6556. Set planes to filter. Default is all available except alpha.
  6557. @end table
  6558. @subsection Examples
  6559. @itemize
  6560. @item
  6561. Basic filtering with bm3d:
  6562. @example
  6563. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6564. @end example
  6565. @item
  6566. Same as above, but filtering only luma:
  6567. @example
  6568. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6569. @end example
  6570. @item
  6571. Same as above, but with both estimation modes:
  6572. @example
  6573. 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
  6574. @end example
  6575. @item
  6576. Same as above, but prefilter with @ref{nlmeans} filter instead:
  6577. @example
  6578. 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
  6579. @end example
  6580. @end itemize
  6581. @section boxblur
  6582. Apply a boxblur algorithm to the input video.
  6583. It accepts the following parameters:
  6584. @table @option
  6585. @item luma_radius, lr
  6586. @item luma_power, lp
  6587. @item chroma_radius, cr
  6588. @item chroma_power, cp
  6589. @item alpha_radius, ar
  6590. @item alpha_power, ap
  6591. @end table
  6592. A description of the accepted options follows.
  6593. @table @option
  6594. @item luma_radius, lr
  6595. @item chroma_radius, cr
  6596. @item alpha_radius, ar
  6597. Set an expression for the box radius in pixels used for blurring the
  6598. corresponding input plane.
  6599. The radius value must be a non-negative number, and must not be
  6600. greater than the value of the expression @code{min(w,h)/2} for the
  6601. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  6602. planes.
  6603. Default value for @option{luma_radius} is "2". If not specified,
  6604. @option{chroma_radius} and @option{alpha_radius} default to the
  6605. corresponding value set for @option{luma_radius}.
  6606. The expressions can contain the following constants:
  6607. @table @option
  6608. @item w
  6609. @item h
  6610. The input width and height in pixels.
  6611. @item cw
  6612. @item ch
  6613. The input chroma image width and height in pixels.
  6614. @item hsub
  6615. @item vsub
  6616. The horizontal and vertical chroma subsample values. For example, for the
  6617. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  6618. @end table
  6619. @item luma_power, lp
  6620. @item chroma_power, cp
  6621. @item alpha_power, ap
  6622. Specify how many times the boxblur filter is applied to the
  6623. corresponding plane.
  6624. Default value for @option{luma_power} is 2. If not specified,
  6625. @option{chroma_power} and @option{alpha_power} default to the
  6626. corresponding value set for @option{luma_power}.
  6627. A value of 0 will disable the effect.
  6628. @end table
  6629. @subsection Examples
  6630. @itemize
  6631. @item
  6632. Apply a boxblur filter with the luma, chroma, and alpha radii
  6633. set to 2:
  6634. @example
  6635. boxblur=luma_radius=2:luma_power=1
  6636. boxblur=2:1
  6637. @end example
  6638. @item
  6639. Set the luma radius to 2, and alpha and chroma radius to 0:
  6640. @example
  6641. boxblur=2:1:cr=0:ar=0
  6642. @end example
  6643. @item
  6644. Set the luma and chroma radii to a fraction of the video dimension:
  6645. @example
  6646. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  6647. @end example
  6648. @end itemize
  6649. @section bwdif
  6650. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  6651. Deinterlacing Filter").
  6652. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  6653. interpolation algorithms.
  6654. It accepts the following parameters:
  6655. @table @option
  6656. @item mode
  6657. The interlacing mode to adopt. It accepts one of the following values:
  6658. @table @option
  6659. @item 0, send_frame
  6660. Output one frame for each frame.
  6661. @item 1, send_field
  6662. Output one frame for each field.
  6663. @end table
  6664. The default value is @code{send_field}.
  6665. @item parity
  6666. The picture field parity assumed for the input interlaced video. It accepts one
  6667. of the following values:
  6668. @table @option
  6669. @item 0, tff
  6670. Assume the top field is first.
  6671. @item 1, bff
  6672. Assume the bottom field is first.
  6673. @item -1, auto
  6674. Enable automatic detection of field parity.
  6675. @end table
  6676. The default value is @code{auto}.
  6677. If the interlacing is unknown or the decoder does not export this information,
  6678. top field first will be assumed.
  6679. @item deint
  6680. Specify which frames to deinterlace. Accepts one of the following
  6681. values:
  6682. @table @option
  6683. @item 0, all
  6684. Deinterlace all frames.
  6685. @item 1, interlaced
  6686. Only deinterlace frames marked as interlaced.
  6687. @end table
  6688. The default value is @code{all}.
  6689. @end table
  6690. @section cas
  6691. Apply Contrast Adaptive Sharpen filter to video stream.
  6692. The filter accepts the following options:
  6693. @table @option
  6694. @item strength
  6695. Set the sharpening strength. Default value is 0.
  6696. @item planes
  6697. Set planes to filter. Default value is to filter all
  6698. planes except alpha plane.
  6699. @end table
  6700. @subsection Commands
  6701. This filter supports same @ref{commands} as options.
  6702. @section chromahold
  6703. Remove all color information for all colors except for certain one.
  6704. The filter accepts the following options:
  6705. @table @option
  6706. @item color
  6707. The color which will not be replaced with neutral chroma.
  6708. @item similarity
  6709. Similarity percentage with the above color.
  6710. 0.01 matches only the exact key color, while 1.0 matches everything.
  6711. @item blend
  6712. Blend percentage.
  6713. 0.0 makes pixels either fully gray, or not gray at all.
  6714. Higher values result in more preserved color.
  6715. @item yuv
  6716. Signals that the color passed is already in YUV instead of RGB.
  6717. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6718. This can be used to pass exact YUV values as hexadecimal numbers.
  6719. @end table
  6720. @subsection Commands
  6721. This filter supports same @ref{commands} as options.
  6722. The command accepts the same syntax of the corresponding option.
  6723. If the specified expression is not valid, it is kept at its current
  6724. value.
  6725. @anchor{chromakey}
  6726. @section chromakey
  6727. YUV colorspace color/chroma keying.
  6728. The filter accepts the following options:
  6729. @table @option
  6730. @item color
  6731. The color which will be replaced with transparency.
  6732. @item similarity
  6733. Similarity percentage with the key color.
  6734. 0.01 matches only the exact key color, while 1.0 matches everything.
  6735. @item blend
  6736. Blend percentage.
  6737. 0.0 makes pixels either fully transparent, or not transparent at all.
  6738. Higher values result in semi-transparent pixels, with a higher transparency
  6739. the more similar the pixels color is to the key color.
  6740. @item yuv
  6741. Signals that the color passed is already in YUV instead of RGB.
  6742. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6743. This can be used to pass exact YUV values as hexadecimal numbers.
  6744. @end table
  6745. @subsection Commands
  6746. This filter supports same @ref{commands} as options.
  6747. The command accepts the same syntax of the corresponding option.
  6748. If the specified expression is not valid, it is kept at its current
  6749. value.
  6750. @subsection Examples
  6751. @itemize
  6752. @item
  6753. Make every green pixel in the input image transparent:
  6754. @example
  6755. ffmpeg -i input.png -vf chromakey=green out.png
  6756. @end example
  6757. @item
  6758. Overlay a greenscreen-video on top of a static black background.
  6759. @example
  6760. 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
  6761. @end example
  6762. @end itemize
  6763. @section chromakey_cuda
  6764. CUDA accelerated YUV colorspace color/chroma keying.
  6765. This filter works like normal chromakey filter but operates on CUDA frames.
  6766. for more details and parameters see @ref{chromakey}.
  6767. @subsection Examples
  6768. @itemize
  6769. @item
  6770. Make all the green pixels in the input video transparent and use it as an overlay for another video:
  6771. @example
  6772. ./ffmpeg \
  6773. -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
  6774. -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
  6775. -init_hw_device cuda \
  6776. -filter_complex \
  6777. " \
  6778. [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
  6779. [1:v]scale_cuda=format=yuv420p[base]; \
  6780. [base][overlay_video]overlay_cuda" \
  6781. -an -sn -c:v h264_nvenc -cq 20 output.mp4
  6782. @end example
  6783. @item
  6784. Process two software sources, explicitly uploading the frames:
  6785. @example
  6786. ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
  6787. -f lavfi -i color=size=800x600:color=white,format=yuv420p \
  6788. -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
  6789. -filter_complex \
  6790. " \
  6791. [0]hwupload[under]; \
  6792. [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
  6793. [under][over]overlay_cuda" \
  6794. -c:v hevc_nvenc -cq 18 -preset slow output.mp4
  6795. @end example
  6796. @end itemize
  6797. @section chromanr
  6798. Reduce chrominance noise.
  6799. The filter accepts the following options:
  6800. @table @option
  6801. @item thres
  6802. Set threshold for averaging chrominance values.
  6803. Sum of absolute difference of Y, U and V pixel components of current
  6804. pixel and neighbour pixels lower than this threshold will be used in
  6805. averaging. Luma component is left unchanged and is copied to output.
  6806. Default value is 30. Allowed range is from 1 to 200.
  6807. @item sizew
  6808. Set horizontal radius of rectangle used for averaging.
  6809. Allowed range is from 1 to 100. Default value is 5.
  6810. @item sizeh
  6811. Set vertical radius of rectangle used for averaging.
  6812. Allowed range is from 1 to 100. Default value is 5.
  6813. @item stepw
  6814. Set horizontal step when averaging. Default value is 1.
  6815. Allowed range is from 1 to 50.
  6816. Mostly useful to speed-up filtering.
  6817. @item steph
  6818. Set vertical step when averaging. Default value is 1.
  6819. Allowed range is from 1 to 50.
  6820. Mostly useful to speed-up filtering.
  6821. @item threy
  6822. Set Y threshold for averaging chrominance values.
  6823. Set finer control for max allowed difference between Y components
  6824. of current pixel and neigbour pixels.
  6825. Default value is 200. Allowed range is from 1 to 200.
  6826. @item threu
  6827. Set U threshold for averaging chrominance values.
  6828. Set finer control for max allowed difference between U components
  6829. of current pixel and neigbour pixels.
  6830. Default value is 200. Allowed range is from 1 to 200.
  6831. @item threv
  6832. Set V threshold for averaging chrominance values.
  6833. Set finer control for max allowed difference between V components
  6834. of current pixel and neigbour pixels.
  6835. Default value is 200. Allowed range is from 1 to 200.
  6836. @item distance
  6837. Set distance type used in calculations.
  6838. @table @samp
  6839. @item manhattan
  6840. Absolute difference.
  6841. @item euclidean
  6842. Difference squared.
  6843. @end table
  6844. Default distance type is manhattan.
  6845. @end table
  6846. @subsection Commands
  6847. This filter supports same @ref{commands} as options.
  6848. The command accepts the same syntax of the corresponding option.
  6849. @section chromashift
  6850. Shift chroma pixels horizontally and/or vertically.
  6851. The filter accepts the following options:
  6852. @table @option
  6853. @item cbh
  6854. Set amount to shift chroma-blue horizontally.
  6855. @item cbv
  6856. Set amount to shift chroma-blue vertically.
  6857. @item crh
  6858. Set amount to shift chroma-red horizontally.
  6859. @item crv
  6860. Set amount to shift chroma-red vertically.
  6861. @item edge
  6862. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6863. @end table
  6864. @subsection Commands
  6865. This filter supports the all above options as @ref{commands}.
  6866. @section ciescope
  6867. Display CIE color diagram with pixels overlaid onto it.
  6868. The filter accepts the following options:
  6869. @table @option
  6870. @item system
  6871. Set color system.
  6872. @table @samp
  6873. @item ntsc, 470m
  6874. @item ebu, 470bg
  6875. @item smpte
  6876. @item 240m
  6877. @item apple
  6878. @item widergb
  6879. @item cie1931
  6880. @item rec709, hdtv
  6881. @item uhdtv, rec2020
  6882. @item dcip3
  6883. @end table
  6884. @item cie
  6885. Set CIE system.
  6886. @table @samp
  6887. @item xyy
  6888. @item ucs
  6889. @item luv
  6890. @end table
  6891. @item gamuts
  6892. Set what gamuts to draw.
  6893. See @code{system} option for available values.
  6894. @item size, s
  6895. Set ciescope size, by default set to 512.
  6896. @item intensity, i
  6897. Set intensity used to map input pixel values to CIE diagram.
  6898. @item contrast
  6899. Set contrast used to draw tongue colors that are out of active color system gamut.
  6900. @item corrgamma
  6901. Correct gamma displayed on scope, by default enabled.
  6902. @item showwhite
  6903. Show white point on CIE diagram, by default disabled.
  6904. @item gamma
  6905. Set input gamma. Used only with XYZ input color space.
  6906. @item fill
  6907. Fill with CIE colors. By default is enabled.
  6908. @end table
  6909. @section codecview
  6910. Visualize information exported by some codecs.
  6911. Some codecs can export information through frames using side-data or other
  6912. means. For example, some MPEG based codecs export motion vectors through the
  6913. @var{export_mvs} flag in the codec @option{flags2} option.
  6914. The filter accepts the following option:
  6915. @table @option
  6916. @item block
  6917. Display block partition structure using the luma plane.
  6918. @item mv
  6919. Set motion vectors to visualize.
  6920. Available flags for @var{mv} are:
  6921. @table @samp
  6922. @item pf
  6923. forward predicted MVs of P-frames
  6924. @item bf
  6925. forward predicted MVs of B-frames
  6926. @item bb
  6927. backward predicted MVs of B-frames
  6928. @end table
  6929. @item qp
  6930. Display quantization parameters using the chroma planes.
  6931. @item mv_type, mvt
  6932. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6933. Available flags for @var{mv_type} are:
  6934. @table @samp
  6935. @item fp
  6936. forward predicted MVs
  6937. @item bp
  6938. backward predicted MVs
  6939. @end table
  6940. @item frame_type, ft
  6941. Set frame type to visualize motion vectors of.
  6942. Available flags for @var{frame_type} are:
  6943. @table @samp
  6944. @item if
  6945. intra-coded frames (I-frames)
  6946. @item pf
  6947. predicted frames (P-frames)
  6948. @item bf
  6949. bi-directionally predicted frames (B-frames)
  6950. @end table
  6951. @end table
  6952. @subsection Examples
  6953. @itemize
  6954. @item
  6955. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6956. @example
  6957. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6958. @end example
  6959. @item
  6960. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6961. @example
  6962. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6963. @end example
  6964. @end itemize
  6965. @section colorbalance
  6966. Modify intensity of primary colors (red, green and blue) of input frames.
  6967. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6968. regions for the red-cyan, green-magenta or blue-yellow balance.
  6969. A positive adjustment value shifts the balance towards the primary color, a negative
  6970. value towards the complementary color.
  6971. The filter accepts the following options:
  6972. @table @option
  6973. @item rs
  6974. @item gs
  6975. @item bs
  6976. Adjust red, green and blue shadows (darkest pixels).
  6977. @item rm
  6978. @item gm
  6979. @item bm
  6980. Adjust red, green and blue midtones (medium pixels).
  6981. @item rh
  6982. @item gh
  6983. @item bh
  6984. Adjust red, green and blue highlights (brightest pixels).
  6985. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6986. @item pl
  6987. Preserve lightness when changing color balance. Default is disabled.
  6988. @end table
  6989. @subsection Examples
  6990. @itemize
  6991. @item
  6992. Add red color cast to shadows:
  6993. @example
  6994. colorbalance=rs=.3
  6995. @end example
  6996. @end itemize
  6997. @subsection Commands
  6998. This filter supports the all above options as @ref{commands}.
  6999. @section colorcontrast
  7000. Adjust color contrast between RGB components.
  7001. The filter accepts the following options:
  7002. @table @option
  7003. @item rc
  7004. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7005. @item gm
  7006. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7007. @item by
  7008. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7009. @item rcw
  7010. @item gmw
  7011. @item byw
  7012. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  7013. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  7014. @item pl
  7015. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  7016. @end table
  7017. @subsection Commands
  7018. This filter supports the all above options as @ref{commands}.
  7019. @section colorcorrect
  7020. Adjust color white balance selectively for blacks and whites.
  7021. This filter operates in YUV colorspace.
  7022. The filter accepts the following options:
  7023. @table @option
  7024. @item rl
  7025. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  7026. Default value is 0.
  7027. @item bl
  7028. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  7029. Default value is 0.
  7030. @item rh
  7031. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7032. Default value is 0.
  7033. @item bh
  7034. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7035. Default value is 0.
  7036. @item saturation
  7037. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  7038. Default value is 1.
  7039. @item analyze
  7040. If set to anything other than @code{manual} it will analyze every frame and use derived
  7041. parameters for filtering output frame.
  7042. Possible values are:
  7043. @table @samp
  7044. @item manual
  7045. @item average
  7046. @item minmax
  7047. @item median
  7048. @end table
  7049. Default value is @code{manual}.
  7050. @end table
  7051. @subsection Commands
  7052. This filter supports the all above options as @ref{commands}.
  7053. @section colorchannelmixer
  7054. Adjust video input frames by re-mixing color channels.
  7055. This filter modifies a color channel by adding the values associated to
  7056. the other channels of the same pixels. For example if the value to
  7057. modify is red, the output value will be:
  7058. @example
  7059. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  7060. @end example
  7061. The filter accepts the following options:
  7062. @table @option
  7063. @item rr
  7064. @item rg
  7065. @item rb
  7066. @item ra
  7067. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  7068. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  7069. @item gr
  7070. @item gg
  7071. @item gb
  7072. @item ga
  7073. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  7074. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  7075. @item br
  7076. @item bg
  7077. @item bb
  7078. @item ba
  7079. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  7080. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  7081. @item ar
  7082. @item ag
  7083. @item ab
  7084. @item aa
  7085. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  7086. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  7087. Allowed ranges for options are @code{[-2.0, 2.0]}.
  7088. @item pc
  7089. Set preserve color mode. The accepted values are:
  7090. @table @samp
  7091. @item none
  7092. Disable color preserving, this is default.
  7093. @item lum
  7094. Preserve luminance.
  7095. @item max
  7096. Preserve max value of RGB triplet.
  7097. @item avg
  7098. Preserve average value of RGB triplet.
  7099. @item sum
  7100. Preserve sum value of RGB triplet.
  7101. @item nrm
  7102. Preserve normalized value of RGB triplet.
  7103. @item pwr
  7104. Preserve power value of RGB triplet.
  7105. @end table
  7106. @item pa
  7107. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  7108. Default is @code{0.0}, thus disabled.
  7109. @end table
  7110. @subsection Examples
  7111. @itemize
  7112. @item
  7113. Convert source to grayscale:
  7114. @example
  7115. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  7116. @end example
  7117. @item
  7118. Simulate sepia tones:
  7119. @example
  7120. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  7121. @end example
  7122. @end itemize
  7123. @subsection Commands
  7124. This filter supports the all above options as @ref{commands}.
  7125. @section colorize
  7126. Overlay a solid color on the video stream.
  7127. The filter accepts the following options:
  7128. @table @option
  7129. @item hue
  7130. Set the color hue. Allowed range is from 0 to 360.
  7131. Default value is 0.
  7132. @item saturation
  7133. Set the color saturation. Allowed range is from 0 to 1.
  7134. Default value is 0.5.
  7135. @item lightness
  7136. Set the color lightness. Allowed range is from 0 to 1.
  7137. Default value is 0.5.
  7138. @item mix
  7139. Set the mix of source lightness. By default is set to 1.0.
  7140. Allowed range is from 0.0 to 1.0.
  7141. @end table
  7142. @subsection Commands
  7143. This filter supports the all above options as @ref{commands}.
  7144. @section colorkey
  7145. RGB colorspace color keying.
  7146. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  7147. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  7148. the similarity radius depends on the value of the blend option.
  7149. The filter accepts the following options:
  7150. @table @option
  7151. @item color
  7152. Set the color for which alpha will be set to 0 (full transparency).
  7153. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7154. Default is @code{black}.
  7155. @item similarity
  7156. Set the radius from the key color within which other colors also have full transparency.
  7157. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  7158. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  7159. around the exact key color, while 1.0 matches everything.
  7160. Default is @code{0.01}.
  7161. @item blend
  7162. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  7163. 0.0 makes pixels either fully transparent or fully opaque.
  7164. Higher values result in semi-transparent pixels, with greater transparency
  7165. the more similar the pixel color is to the key color.
  7166. Range is 0.0 to 1.0. Default is @code{0.0}.
  7167. @end table
  7168. @subsection Examples
  7169. @itemize
  7170. @item
  7171. Make every green pixel in the input image transparent:
  7172. @example
  7173. ffmpeg -i input.png -vf colorkey=green out.png
  7174. @end example
  7175. @item
  7176. Overlay a greenscreen-video on top of a static background image.
  7177. @example
  7178. 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
  7179. @end example
  7180. @end itemize
  7181. @subsection Commands
  7182. This filter supports same @ref{commands} as options.
  7183. The command accepts the same syntax of the corresponding option.
  7184. If the specified expression is not valid, it is kept at its current
  7185. value.
  7186. @section colorhold
  7187. Remove all color information for all RGB colors except for certain one.
  7188. The filter accepts the following options:
  7189. @table @option
  7190. @item color
  7191. The color which will not be replaced with neutral gray.
  7192. @item similarity
  7193. Similarity percentage with the above color.
  7194. 0.01 matches only the exact key color, while 1.0 matches everything.
  7195. @item blend
  7196. Blend percentage. 0.0 makes pixels fully gray.
  7197. Higher values result in more preserved color.
  7198. @end table
  7199. @subsection Commands
  7200. This filter supports same @ref{commands} as options.
  7201. The command accepts the same syntax of the corresponding option.
  7202. If the specified expression is not valid, it is kept at its current
  7203. value.
  7204. @section colorlevels
  7205. Adjust video input frames using levels.
  7206. The filter accepts the following options:
  7207. @table @option
  7208. @item rimin
  7209. @item gimin
  7210. @item bimin
  7211. @item aimin
  7212. Adjust red, green, blue and alpha input black point.
  7213. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7214. @item rimax
  7215. @item gimax
  7216. @item bimax
  7217. @item aimax
  7218. Adjust red, green, blue and alpha input white point.
  7219. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  7220. Input levels are used to lighten highlights (bright tones), darken shadows
  7221. (dark tones), change the balance of bright and dark tones.
  7222. @item romin
  7223. @item gomin
  7224. @item bomin
  7225. @item aomin
  7226. Adjust red, green, blue and alpha output black point.
  7227. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  7228. @item romax
  7229. @item gomax
  7230. @item bomax
  7231. @item aomax
  7232. Adjust red, green, blue and alpha output white point.
  7233. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  7234. Output levels allows manual selection of a constrained output level range.
  7235. @item preserve
  7236. Set preserve color mode. The accepted values are:
  7237. @table @samp
  7238. @item none
  7239. Disable color preserving, this is default.
  7240. @item lum
  7241. Preserve luminance.
  7242. @item max
  7243. Preserve max value of RGB triplet.
  7244. @item avg
  7245. Preserve average value of RGB triplet.
  7246. @item sum
  7247. Preserve sum value of RGB triplet.
  7248. @item nrm
  7249. Preserve normalized value of RGB triplet.
  7250. @item pwr
  7251. Preserve power value of RGB triplet.
  7252. @end table
  7253. @end table
  7254. @subsection Examples
  7255. @itemize
  7256. @item
  7257. Make video output darker:
  7258. @example
  7259. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  7260. @end example
  7261. @item
  7262. Increase contrast:
  7263. @example
  7264. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  7265. @end example
  7266. @item
  7267. Make video output lighter:
  7268. @example
  7269. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  7270. @end example
  7271. @item
  7272. Increase brightness:
  7273. @example
  7274. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  7275. @end example
  7276. @end itemize
  7277. @subsection Commands
  7278. This filter supports the all above options as @ref{commands}.
  7279. @section colormap
  7280. Apply custom color maps to video stream.
  7281. This filter needs three input video streams.
  7282. First stream is video stream that is going to be filtered out.
  7283. Second and third video stream specify color patches for source
  7284. color to target color mapping.
  7285. The filter accepts the following options:
  7286. @table @option
  7287. @item patch_size
  7288. Set the source and target video stream patch size in pixels.
  7289. @item nb_patches
  7290. Set the max number of used patches from source and target video stream.
  7291. Default value is number of patches available in additional video streams.
  7292. Max allowed number of patches is @code{64}.
  7293. @item type
  7294. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  7295. Defaults is @code{absolute}.
  7296. @item kernel
  7297. Set the kernel used to measure color differences between mapped colors.
  7298. The accepted values are:
  7299. @table @samp
  7300. @item euclidean
  7301. @item weuclidean
  7302. @end table
  7303. Default is @code{euclidean}.
  7304. @end table
  7305. @section colormatrix
  7306. Convert color matrix.
  7307. The filter accepts the following options:
  7308. @table @option
  7309. @item src
  7310. @item dst
  7311. Specify the source and destination color matrix. Both values must be
  7312. specified.
  7313. The accepted values are:
  7314. @table @samp
  7315. @item bt709
  7316. BT.709
  7317. @item fcc
  7318. FCC
  7319. @item bt601
  7320. BT.601
  7321. @item bt470
  7322. BT.470
  7323. @item bt470bg
  7324. BT.470BG
  7325. @item smpte170m
  7326. SMPTE-170M
  7327. @item smpte240m
  7328. SMPTE-240M
  7329. @item bt2020
  7330. BT.2020
  7331. @end table
  7332. @end table
  7333. For example to convert from BT.601 to SMPTE-240M, use the command:
  7334. @example
  7335. colormatrix=bt601:smpte240m
  7336. @end example
  7337. @section colorspace
  7338. Convert colorspace, transfer characteristics or color primaries.
  7339. Input video needs to have an even size.
  7340. The filter accepts the following options:
  7341. @table @option
  7342. @anchor{all}
  7343. @item all
  7344. Specify all color properties at once.
  7345. The accepted values are:
  7346. @table @samp
  7347. @item bt470m
  7348. BT.470M
  7349. @item bt470bg
  7350. BT.470BG
  7351. @item bt601-6-525
  7352. BT.601-6 525
  7353. @item bt601-6-625
  7354. BT.601-6 625
  7355. @item bt709
  7356. BT.709
  7357. @item smpte170m
  7358. SMPTE-170M
  7359. @item smpte240m
  7360. SMPTE-240M
  7361. @item bt2020
  7362. BT.2020
  7363. @end table
  7364. @anchor{space}
  7365. @item space
  7366. Specify output colorspace.
  7367. The accepted values are:
  7368. @table @samp
  7369. @item bt709
  7370. BT.709
  7371. @item fcc
  7372. FCC
  7373. @item bt470bg
  7374. BT.470BG or BT.601-6 625
  7375. @item smpte170m
  7376. SMPTE-170M or BT.601-6 525
  7377. @item smpte240m
  7378. SMPTE-240M
  7379. @item ycgco
  7380. YCgCo
  7381. @item bt2020ncl
  7382. BT.2020 with non-constant luminance
  7383. @end table
  7384. @anchor{trc}
  7385. @item trc
  7386. Specify output transfer characteristics.
  7387. The accepted values are:
  7388. @table @samp
  7389. @item bt709
  7390. BT.709
  7391. @item bt470m
  7392. BT.470M
  7393. @item bt470bg
  7394. BT.470BG
  7395. @item gamma22
  7396. Constant gamma of 2.2
  7397. @item gamma28
  7398. Constant gamma of 2.8
  7399. @item smpte170m
  7400. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7401. @item smpte240m
  7402. SMPTE-240M
  7403. @item srgb
  7404. SRGB
  7405. @item iec61966-2-1
  7406. iec61966-2-1
  7407. @item iec61966-2-4
  7408. iec61966-2-4
  7409. @item xvycc
  7410. xvycc
  7411. @item bt2020-10
  7412. BT.2020 for 10-bits content
  7413. @item bt2020-12
  7414. BT.2020 for 12-bits content
  7415. @end table
  7416. @anchor{primaries}
  7417. @item primaries
  7418. Specify output color primaries.
  7419. The accepted values are:
  7420. @table @samp
  7421. @item bt709
  7422. BT.709
  7423. @item bt470m
  7424. BT.470M
  7425. @item bt470bg
  7426. BT.470BG or BT.601-6 625
  7427. @item smpte170m
  7428. SMPTE-170M or BT.601-6 525
  7429. @item smpte240m
  7430. SMPTE-240M
  7431. @item film
  7432. film
  7433. @item smpte431
  7434. SMPTE-431
  7435. @item smpte432
  7436. SMPTE-432
  7437. @item bt2020
  7438. BT.2020
  7439. @item jedec-p22
  7440. JEDEC P22 phosphors
  7441. @end table
  7442. @anchor{range}
  7443. @item range
  7444. Specify output color range.
  7445. The accepted values are:
  7446. @table @samp
  7447. @item tv
  7448. TV (restricted) range
  7449. @item mpeg
  7450. MPEG (restricted) range
  7451. @item pc
  7452. PC (full) range
  7453. @item jpeg
  7454. JPEG (full) range
  7455. @end table
  7456. @item format
  7457. Specify output color format.
  7458. The accepted values are:
  7459. @table @samp
  7460. @item yuv420p
  7461. YUV 4:2:0 planar 8-bits
  7462. @item yuv420p10
  7463. YUV 4:2:0 planar 10-bits
  7464. @item yuv420p12
  7465. YUV 4:2:0 planar 12-bits
  7466. @item yuv422p
  7467. YUV 4:2:2 planar 8-bits
  7468. @item yuv422p10
  7469. YUV 4:2:2 planar 10-bits
  7470. @item yuv422p12
  7471. YUV 4:2:2 planar 12-bits
  7472. @item yuv444p
  7473. YUV 4:4:4 planar 8-bits
  7474. @item yuv444p10
  7475. YUV 4:4:4 planar 10-bits
  7476. @item yuv444p12
  7477. YUV 4:4:4 planar 12-bits
  7478. @end table
  7479. @item fast
  7480. Do a fast conversion, which skips gamma/primary correction. This will take
  7481. significantly less CPU, but will be mathematically incorrect. To get output
  7482. compatible with that produced by the colormatrix filter, use fast=1.
  7483. @item dither
  7484. Specify dithering mode.
  7485. The accepted values are:
  7486. @table @samp
  7487. @item none
  7488. No dithering
  7489. @item fsb
  7490. Floyd-Steinberg dithering
  7491. @end table
  7492. @item wpadapt
  7493. Whitepoint adaptation mode.
  7494. The accepted values are:
  7495. @table @samp
  7496. @item bradford
  7497. Bradford whitepoint adaptation
  7498. @item vonkries
  7499. von Kries whitepoint adaptation
  7500. @item identity
  7501. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7502. @end table
  7503. @item iall
  7504. Override all input properties at once. Same accepted values as @ref{all}.
  7505. @item ispace
  7506. Override input colorspace. Same accepted values as @ref{space}.
  7507. @item iprimaries
  7508. Override input color primaries. Same accepted values as @ref{primaries}.
  7509. @item itrc
  7510. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7511. @item irange
  7512. Override input color range. Same accepted values as @ref{range}.
  7513. @end table
  7514. The filter converts the transfer characteristics, color space and color
  7515. primaries to the specified user values. The output value, if not specified,
  7516. is set to a default value based on the "all" property. If that property is
  7517. also not specified, the filter will log an error. The output color range and
  7518. format default to the same value as the input color range and format. The
  7519. input transfer characteristics, color space, color primaries and color range
  7520. should be set on the input data. If any of these are missing, the filter will
  7521. log an error and no conversion will take place.
  7522. For example to convert the input to SMPTE-240M, use the command:
  7523. @example
  7524. colorspace=smpte240m
  7525. @end example
  7526. @section colorspace_cuda
  7527. CUDA accelerated implementation of the colorspace filter.
  7528. It is by no means feature complete compared to the software colorspace filter,
  7529. and at the current time only supports color range conversion between jpeg/full
  7530. and mpeg/limited range.
  7531. The filter accepts the following options:
  7532. @table @option
  7533. @item range
  7534. Specify output color range.
  7535. The accepted values are:
  7536. @table @samp
  7537. @item tv
  7538. TV (restricted) range
  7539. @item mpeg
  7540. MPEG (restricted) range
  7541. @item pc
  7542. PC (full) range
  7543. @item jpeg
  7544. JPEG (full) range
  7545. @end table
  7546. @end table
  7547. @section colortemperature
  7548. Adjust color temperature in video to simulate variations in ambient color temperature.
  7549. The filter accepts the following options:
  7550. @table @option
  7551. @item temperature
  7552. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7553. Default value is 6500 K.
  7554. @item mix
  7555. Set mixing with filtered output. Allowed range is from 0 to 1.
  7556. Default value is 1.
  7557. @item pl
  7558. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  7559. Default value is 0.
  7560. @end table
  7561. @subsection Commands
  7562. This filter supports same @ref{commands} as options.
  7563. @section convolution
  7564. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  7565. The filter accepts the following options:
  7566. @table @option
  7567. @item 0m
  7568. @item 1m
  7569. @item 2m
  7570. @item 3m
  7571. Set matrix for each plane.
  7572. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  7573. and from 1 to 49 odd number of signed integers in @var{row} mode.
  7574. @item 0rdiv
  7575. @item 1rdiv
  7576. @item 2rdiv
  7577. @item 3rdiv
  7578. Set multiplier for calculated value for each plane.
  7579. If unset or 0, it will be sum of all matrix elements.
  7580. @item 0bias
  7581. @item 1bias
  7582. @item 2bias
  7583. @item 3bias
  7584. Set bias for each plane. This value is added to the result of the multiplication.
  7585. Useful for making the overall image brighter or darker. Default is 0.0.
  7586. @item 0mode
  7587. @item 1mode
  7588. @item 2mode
  7589. @item 3mode
  7590. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  7591. Default is @var{square}.
  7592. @end table
  7593. @subsection Commands
  7594. This filter supports the all above options as @ref{commands}.
  7595. @subsection Examples
  7596. @itemize
  7597. @item
  7598. Apply sharpen:
  7599. @example
  7600. 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"
  7601. @end example
  7602. @item
  7603. Apply blur:
  7604. @example
  7605. 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"
  7606. @end example
  7607. @item
  7608. Apply edge enhance:
  7609. @example
  7610. 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"
  7611. @end example
  7612. @item
  7613. Apply edge detect:
  7614. @example
  7615. 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"
  7616. @end example
  7617. @item
  7618. Apply laplacian edge detector which includes diagonals:
  7619. @example
  7620. 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"
  7621. @end example
  7622. @item
  7623. Apply emboss:
  7624. @example
  7625. 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"
  7626. @end example
  7627. @end itemize
  7628. @section convolve
  7629. Apply 2D convolution of video stream in frequency domain using second stream
  7630. as impulse.
  7631. The filter accepts the following options:
  7632. @table @option
  7633. @item planes
  7634. Set which planes to process.
  7635. @item impulse
  7636. Set which impulse video frames will be processed, can be @var{first}
  7637. or @var{all}. Default is @var{all}.
  7638. @end table
  7639. The @code{convolve} filter also supports the @ref{framesync} options.
  7640. @section copy
  7641. Copy the input video source unchanged to the output. This is mainly useful for
  7642. testing purposes.
  7643. @anchor{coreimage}
  7644. @section coreimage
  7645. Video filtering on GPU using Apple's CoreImage API on OSX.
  7646. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  7647. processed by video hardware. However, software-based OpenGL implementations
  7648. exist which means there is no guarantee for hardware processing. It depends on
  7649. the respective OSX.
  7650. There are many filters and image generators provided by Apple that come with a
  7651. large variety of options. The filter has to be referenced by its name along
  7652. with its options.
  7653. The coreimage filter accepts the following options:
  7654. @table @option
  7655. @item list_filters
  7656. List all available filters and generators along with all their respective
  7657. options as well as possible minimum and maximum values along with the default
  7658. values.
  7659. @example
  7660. list_filters=true
  7661. @end example
  7662. @item filter
  7663. Specify all filters by their respective name and options.
  7664. Use @var{list_filters} to determine all valid filter names and options.
  7665. Numerical options are specified by a float value and are automatically clamped
  7666. to their respective value range. Vector and color options have to be specified
  7667. by a list of space separated float values. Character escaping has to be done.
  7668. A special option name @code{default} is available to use default options for a
  7669. filter.
  7670. It is required to specify either @code{default} or at least one of the filter options.
  7671. All omitted options are used with their default values.
  7672. The syntax of the filter string is as follows:
  7673. @example
  7674. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  7675. @end example
  7676. @item output_rect
  7677. Specify a rectangle where the output of the filter chain is copied into the
  7678. input image. It is given by a list of space separated float values:
  7679. @example
  7680. output_rect=x\ y\ width\ height
  7681. @end example
  7682. If not given, the output rectangle equals the dimensions of the input image.
  7683. The output rectangle is automatically cropped at the borders of the input
  7684. image. Negative values are valid for each component.
  7685. @example
  7686. output_rect=25\ 25\ 100\ 100
  7687. @end example
  7688. @end table
  7689. Several filters can be chained for successive processing without GPU-HOST
  7690. transfers allowing for fast processing of complex filter chains.
  7691. Currently, only filters with zero (generators) or exactly one (filters) input
  7692. image and one output image are supported. Also, transition filters are not yet
  7693. usable as intended.
  7694. Some filters generate output images with additional padding depending on the
  7695. respective filter kernel. The padding is automatically removed to ensure the
  7696. filter output has the same size as the input image.
  7697. For image generators, the size of the output image is determined by the
  7698. previous output image of the filter chain or the input image of the whole
  7699. filterchain, respectively. The generators do not use the pixel information of
  7700. this image to generate their output. However, the generated output is
  7701. blended onto this image, resulting in partial or complete coverage of the
  7702. output image.
  7703. The @ref{coreimagesrc} video source can be used for generating input images
  7704. which are directly fed into the filter chain. By using it, providing input
  7705. images by another video source or an input video is not required.
  7706. @subsection Examples
  7707. @itemize
  7708. @item
  7709. List all filters available:
  7710. @example
  7711. coreimage=list_filters=true
  7712. @end example
  7713. @item
  7714. Use the CIBoxBlur filter with default options to blur an image:
  7715. @example
  7716. coreimage=filter=CIBoxBlur@@default
  7717. @end example
  7718. @item
  7719. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  7720. its center at 100x100 and a radius of 50 pixels:
  7721. @example
  7722. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  7723. @end example
  7724. @item
  7725. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  7726. given as complete and escaped command-line for Apple's standard bash shell:
  7727. @example
  7728. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  7729. @end example
  7730. @end itemize
  7731. @section cover_rect
  7732. Cover a rectangular object
  7733. It accepts the following options:
  7734. @table @option
  7735. @item cover
  7736. Filepath of the optional cover image, needs to be in yuv420.
  7737. @item mode
  7738. Set covering mode.
  7739. It accepts the following values:
  7740. @table @samp
  7741. @item cover
  7742. cover it by the supplied image
  7743. @item blur
  7744. cover it by interpolating the surrounding pixels
  7745. @end table
  7746. Default value is @var{blur}.
  7747. @end table
  7748. @subsection Examples
  7749. @itemize
  7750. @item
  7751. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7752. @example
  7753. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7754. @end example
  7755. @end itemize
  7756. @section crop
  7757. Crop the input video to given dimensions.
  7758. It accepts the following parameters:
  7759. @table @option
  7760. @item w, out_w
  7761. The width of the output video. It defaults to @code{iw}.
  7762. This expression is evaluated only once during the filter
  7763. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  7764. @item h, out_h
  7765. The height of the output video. It defaults to @code{ih}.
  7766. This expression is evaluated only once during the filter
  7767. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  7768. @item x
  7769. The horizontal position, in the input video, of the left edge of the output
  7770. video. It defaults to @code{(in_w-out_w)/2}.
  7771. This expression is evaluated per-frame.
  7772. @item y
  7773. The vertical position, in the input video, of the top edge of the output video.
  7774. It defaults to @code{(in_h-out_h)/2}.
  7775. This expression is evaluated per-frame.
  7776. @item keep_aspect
  7777. If set to 1 will force the output display aspect ratio
  7778. to be the same of the input, by changing the output sample aspect
  7779. ratio. It defaults to 0.
  7780. @item exact
  7781. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  7782. width/height/x/y as specified and will not be rounded to nearest smaller value.
  7783. It defaults to 0.
  7784. @end table
  7785. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  7786. expressions containing the following constants:
  7787. @table @option
  7788. @item x
  7789. @item y
  7790. The computed values for @var{x} and @var{y}. They are evaluated for
  7791. each new frame.
  7792. @item in_w
  7793. @item in_h
  7794. The input width and height.
  7795. @item iw
  7796. @item ih
  7797. These are the same as @var{in_w} and @var{in_h}.
  7798. @item out_w
  7799. @item out_h
  7800. The output (cropped) width and height.
  7801. @item ow
  7802. @item oh
  7803. These are the same as @var{out_w} and @var{out_h}.
  7804. @item a
  7805. same as @var{iw} / @var{ih}
  7806. @item sar
  7807. input sample aspect ratio
  7808. @item dar
  7809. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7810. @item hsub
  7811. @item vsub
  7812. horizontal and vertical chroma subsample values. For example for the
  7813. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7814. @item n
  7815. The number of the input frame, starting from 0.
  7816. @item pos
  7817. the position in the file of the input frame, NAN if unknown
  7818. @item t
  7819. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  7820. @end table
  7821. The expression for @var{out_w} may depend on the value of @var{out_h},
  7822. and the expression for @var{out_h} may depend on @var{out_w}, but they
  7823. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  7824. evaluated after @var{out_w} and @var{out_h}.
  7825. The @var{x} and @var{y} parameters specify the expressions for the
  7826. position of the top-left corner of the output (non-cropped) area. They
  7827. are evaluated for each frame. If the evaluated value is not valid, it
  7828. is approximated to the nearest valid value.
  7829. The expression for @var{x} may depend on @var{y}, and the expression
  7830. for @var{y} may depend on @var{x}.
  7831. @subsection Examples
  7832. @itemize
  7833. @item
  7834. Crop area with size 100x100 at position (12,34).
  7835. @example
  7836. crop=100:100:12:34
  7837. @end example
  7838. Using named options, the example above becomes:
  7839. @example
  7840. crop=w=100:h=100:x=12:y=34
  7841. @end example
  7842. @item
  7843. Crop the central input area with size 100x100:
  7844. @example
  7845. crop=100:100
  7846. @end example
  7847. @item
  7848. Crop the central input area with size 2/3 of the input video:
  7849. @example
  7850. crop=2/3*in_w:2/3*in_h
  7851. @end example
  7852. @item
  7853. Crop the input video central square:
  7854. @example
  7855. crop=out_w=in_h
  7856. crop=in_h
  7857. @end example
  7858. @item
  7859. Delimit the rectangle with the top-left corner placed at position
  7860. 100:100 and the right-bottom corner corresponding to the right-bottom
  7861. corner of the input image.
  7862. @example
  7863. crop=in_w-100:in_h-100:100:100
  7864. @end example
  7865. @item
  7866. Crop 10 pixels from the left and right borders, and 20 pixels from
  7867. the top and bottom borders
  7868. @example
  7869. crop=in_w-2*10:in_h-2*20
  7870. @end example
  7871. @item
  7872. Keep only the bottom right quarter of the input image:
  7873. @example
  7874. crop=in_w/2:in_h/2:in_w/2:in_h/2
  7875. @end example
  7876. @item
  7877. Crop height for getting Greek harmony:
  7878. @example
  7879. crop=in_w:1/PHI*in_w
  7880. @end example
  7881. @item
  7882. Apply trembling effect:
  7883. @example
  7884. 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)
  7885. @end example
  7886. @item
  7887. Apply erratic camera effect depending on timestamp:
  7888. @example
  7889. 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)"
  7890. @end example
  7891. @item
  7892. Set x depending on the value of y:
  7893. @example
  7894. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  7895. @end example
  7896. @end itemize
  7897. @subsection Commands
  7898. This filter supports the following commands:
  7899. @table @option
  7900. @item w, out_w
  7901. @item h, out_h
  7902. @item x
  7903. @item y
  7904. Set width/height of the output video and the horizontal/vertical position
  7905. in the input video.
  7906. The command accepts the same syntax of the corresponding option.
  7907. If the specified expression is not valid, it is kept at its current
  7908. value.
  7909. @end table
  7910. @section cropdetect
  7911. Auto-detect the crop size.
  7912. It calculates the necessary cropping parameters and prints the
  7913. recommended parameters via the logging system. The detected dimensions
  7914. correspond to the non-black or video area of the input video according to @var{mode}.
  7915. It accepts the following parameters:
  7916. @table @option
  7917. @item mode
  7918. 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.
  7919. @table @samp
  7920. @item black
  7921. Detect black pixels surrounding the playing video. For fine control use option @var{limit}.
  7922. @item mvedges
  7923. Detect the playing video by the motion vectors inside the video and scanning for edge pixels typically forming the border of a playing video.
  7924. @end table
  7925. @item limit
  7926. Set higher black value threshold, which can be optionally specified
  7927. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  7928. value greater to the set value is considered non-black. It defaults to 24.
  7929. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  7930. on the bitdepth of the pixel format.
  7931. @item round
  7932. The value which the width/height should be divisible by. It defaults to
  7933. 16. The offset is automatically adjusted to center the video. Use 2 to
  7934. get only even dimensions (needed for 4:2:2 video). 16 is best when
  7935. encoding to most video codecs.
  7936. @item skip
  7937. Set the number of initial frames for which evaluation is skipped.
  7938. Default is 2. Range is 0 to INT_MAX.
  7939. @item reset_count, reset
  7940. Set the counter that determines after how many frames cropdetect will
  7941. reset the previously detected largest video area and start over to
  7942. detect the current optimal crop area. Default value is 0.
  7943. This can be useful when channel logos distort the video area. 0
  7944. indicates 'never reset', and returns the largest area encountered during
  7945. playback.
  7946. @item mv_threshold
  7947. Set motion in pixel units as threshold for motion detection. It defaults to 8.
  7948. @item low
  7949. @item high
  7950. Set low and high threshold values used by the Canny thresholding
  7951. algorithm.
  7952. The high threshold selects the "strong" edge pixels, which are then
  7953. connected through 8-connectivity with the "weak" edge pixels selected
  7954. by the low threshold.
  7955. @var{low} and @var{high} threshold values must be chosen in the range
  7956. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7957. Default value for @var{low} is @code{5/255}, and default value for @var{high}
  7958. is @code{15/255}.
  7959. @end table
  7960. @subsection Examples
  7961. @itemize
  7962. @item
  7963. Find video area surrounded by black borders:
  7964. @example
  7965. ffmpeg -i file.mp4 -vf cropdetect,metadata=mode=print -f null -
  7966. @end example
  7967. @item
  7968. Find an embedded video area, generate motion vectors beforehand:
  7969. @example
  7970. ffmpeg -i file.mp4 -vf mestimate,cropdetect=mode=mvedges,metadata=mode=print -f null -
  7971. @end example
  7972. @item
  7973. Find an embedded video area, use motion vectors from decoder:
  7974. @example
  7975. ffmpeg -flags2 +export_mvs -i file.mp4 -vf cropdetect=mode=mvedges,metadata=mode=print -f null -
  7976. @end example
  7977. @end itemize
  7978. @anchor{cue}
  7979. @section cue
  7980. Delay video filtering until a given wallclock timestamp. The filter first
  7981. passes on @option{preroll} amount of frames, then it buffers at most
  7982. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  7983. it forwards the buffered frames and also any subsequent frames coming in its
  7984. input.
  7985. The filter can be used synchronize the output of multiple ffmpeg processes for
  7986. realtime output devices like decklink. By putting the delay in the filtering
  7987. chain and pre-buffering frames the process can pass on data to output almost
  7988. immediately after the target wallclock timestamp is reached.
  7989. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  7990. some use cases.
  7991. @table @option
  7992. @item cue
  7993. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  7994. @item preroll
  7995. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  7996. @item buffer
  7997. The maximum duration of content to buffer before waiting for the cue expressed
  7998. in seconds. Default is 0.
  7999. @end table
  8000. @anchor{curves}
  8001. @section curves
  8002. Apply color adjustments using curves.
  8003. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  8004. component (red, green and blue) has its values defined by @var{N} key points
  8005. tied from each other using a smooth curve. The x-axis represents the pixel
  8006. values from the input frame, and the y-axis the new pixel values to be set for
  8007. the output frame.
  8008. By default, a component curve is defined by the two points @var{(0;0)} and
  8009. @var{(1;1)}. This creates a straight line where each original pixel value is
  8010. "adjusted" to its own value, which means no change to the image.
  8011. The filter allows you to redefine these two points and add some more. A new
  8012. curve will be define to pass smoothly through all these new coordinates. The
  8013. new defined points needs to be strictly increasing over the x-axis, and their
  8014. @var{x} and @var{y} values must be in the @var{[0;1]} interval. The curve is
  8015. formed by using a natural or monotonic cubic spline interpolation, depending
  8016. on the @var{interp} option (default: @code{natural}). The @code{natural}
  8017. spline produces a smoother curve in general while the monotonic (@code{pchip})
  8018. spline guarantees the transitions between the specified points to be
  8019. monotonic. If the computed curves happened to go outside the vector spaces,
  8020. the values will be clipped accordingly.
  8021. The filter accepts the following options:
  8022. @table @option
  8023. @item preset
  8024. Select one of the available color presets. This option can be used in addition
  8025. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  8026. options takes priority on the preset values.
  8027. Available presets are:
  8028. @table @samp
  8029. @item none
  8030. @item color_negative
  8031. @item cross_process
  8032. @item darker
  8033. @item increase_contrast
  8034. @item lighter
  8035. @item linear_contrast
  8036. @item medium_contrast
  8037. @item negative
  8038. @item strong_contrast
  8039. @item vintage
  8040. @end table
  8041. Default is @code{none}.
  8042. @item master, m
  8043. Set the master key points. These points will define a second pass mapping. It
  8044. is sometimes called a "luminance" or "value" mapping. It can be used with
  8045. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  8046. post-processing LUT.
  8047. @item red, r
  8048. Set the key points for the red component.
  8049. @item green, g
  8050. Set the key points for the green component.
  8051. @item blue, b
  8052. Set the key points for the blue component.
  8053. @item all
  8054. Set the key points for all components (not including master).
  8055. Can be used in addition to the other key points component
  8056. options. In this case, the unset component(s) will fallback on this
  8057. @option{all} setting.
  8058. @item psfile
  8059. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  8060. @item plot
  8061. Save Gnuplot script of the curves in specified file.
  8062. @item interp
  8063. Specify the kind of interpolation. Available algorithms are:
  8064. @table @samp
  8065. @item natural
  8066. Natural cubic spline using a piece-wise cubic polynomial that is twice continuously differentiable.
  8067. @item pchip
  8068. Monotonic cubic spline using a piecewise cubic Hermite interpolating polynomial (PCHIP).
  8069. @end table
  8070. @end table
  8071. To avoid some filtergraph syntax conflicts, each key points list need to be
  8072. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  8073. @subsection Commands
  8074. This filter supports same @ref{commands} as options.
  8075. @subsection Examples
  8076. @itemize
  8077. @item
  8078. Increase slightly the middle level of blue:
  8079. @example
  8080. curves=blue='0/0 0.5/0.58 1/1'
  8081. @end example
  8082. @item
  8083. Vintage effect:
  8084. @example
  8085. 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'
  8086. @end example
  8087. Here we obtain the following coordinates for each components:
  8088. @table @var
  8089. @item red
  8090. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  8091. @item green
  8092. @code{(0;0) (0.50;0.48) (1;1)}
  8093. @item blue
  8094. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  8095. @end table
  8096. @item
  8097. The previous example can also be achieved with the associated built-in preset:
  8098. @example
  8099. curves=preset=vintage
  8100. @end example
  8101. @item
  8102. Or simply:
  8103. @example
  8104. curves=vintage
  8105. @end example
  8106. @item
  8107. Use a Photoshop preset and redefine the points of the green component:
  8108. @example
  8109. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  8110. @end example
  8111. @item
  8112. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  8113. and @command{gnuplot}:
  8114. @example
  8115. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  8116. gnuplot -p /tmp/curves.plt
  8117. @end example
  8118. @end itemize
  8119. @section datascope
  8120. Video data analysis filter.
  8121. This filter shows hexadecimal pixel values of part of video.
  8122. The filter accepts the following options:
  8123. @table @option
  8124. @item size, s
  8125. Set output video size.
  8126. @item x
  8127. Set x offset from where to pick pixels.
  8128. @item y
  8129. Set y offset from where to pick pixels.
  8130. @item mode
  8131. Set scope mode, can be one of the following:
  8132. @table @samp
  8133. @item mono
  8134. Draw hexadecimal pixel values with white color on black background.
  8135. @item color
  8136. Draw hexadecimal pixel values with input video pixel color on black
  8137. background.
  8138. @item color2
  8139. Draw hexadecimal pixel values on color background picked from input video,
  8140. the text color is picked in such way so its always visible.
  8141. @end table
  8142. @item axis
  8143. Draw rows and columns numbers on left and top of video.
  8144. @item opacity
  8145. Set background opacity.
  8146. @item format
  8147. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  8148. @item components
  8149. Set pixel components to display. By default all pixel components are displayed.
  8150. @end table
  8151. @subsection Commands
  8152. This filter supports same @ref{commands} as options excluding @code{size} option.
  8153. @section dblur
  8154. Apply Directional blur filter.
  8155. The filter accepts the following options:
  8156. @table @option
  8157. @item angle
  8158. Set angle of directional blur. Default is @code{45}.
  8159. @item radius
  8160. Set radius of directional blur. Default is @code{5}.
  8161. @item planes
  8162. Set which planes to filter. By default all planes are filtered.
  8163. @end table
  8164. @subsection Commands
  8165. This filter supports same @ref{commands} as options.
  8166. The command accepts the same syntax of the corresponding option.
  8167. If the specified expression is not valid, it is kept at its current
  8168. value.
  8169. @section dctdnoiz
  8170. Denoise frames using 2D DCT (frequency domain filtering).
  8171. This filter is not designed for real time.
  8172. The filter accepts the following options:
  8173. @table @option
  8174. @item sigma, s
  8175. Set the noise sigma constant.
  8176. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  8177. coefficient (absolute value) below this threshold with be dropped.
  8178. If you need a more advanced filtering, see @option{expr}.
  8179. Default is @code{0}.
  8180. @item overlap
  8181. Set number overlapping pixels for each block. Since the filter can be slow, you
  8182. may want to reduce this value, at the cost of a less effective filter and the
  8183. risk of various artefacts.
  8184. If the overlapping value doesn't permit processing the whole input width or
  8185. height, a warning will be displayed and according borders won't be denoised.
  8186. Default value is @var{blocksize}-1, which is the best possible setting.
  8187. @item expr, e
  8188. Set the coefficient factor expression.
  8189. For each coefficient of a DCT block, this expression will be evaluated as a
  8190. multiplier value for the coefficient.
  8191. If this is option is set, the @option{sigma} option will be ignored.
  8192. The absolute value of the coefficient can be accessed through the @var{c}
  8193. variable.
  8194. @item n
  8195. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  8196. @var{blocksize}, which is the width and height of the processed blocks.
  8197. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  8198. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  8199. on the speed processing. Also, a larger block size does not necessarily means a
  8200. better de-noising.
  8201. @end table
  8202. @subsection Examples
  8203. Apply a denoise with a @option{sigma} of @code{4.5}:
  8204. @example
  8205. dctdnoiz=4.5
  8206. @end example
  8207. The same operation can be achieved using the expression system:
  8208. @example
  8209. dctdnoiz=e='gte(c, 4.5*3)'
  8210. @end example
  8211. Violent denoise using a block size of @code{16x16}:
  8212. @example
  8213. dctdnoiz=15:n=4
  8214. @end example
  8215. @section deband
  8216. Remove banding artifacts from input video.
  8217. It works by replacing banded pixels with average value of referenced pixels.
  8218. The filter accepts the following options:
  8219. @table @option
  8220. @item 1thr
  8221. @item 2thr
  8222. @item 3thr
  8223. @item 4thr
  8224. Set banding detection threshold for each plane. Default is 0.02.
  8225. Valid range is 0.00003 to 0.5.
  8226. If difference between current pixel and reference pixel is less than threshold,
  8227. it will be considered as banded.
  8228. @item range, r
  8229. Banding detection range in pixels. Default is 16. If positive, random number
  8230. in range 0 to set value will be used. If negative, exact absolute value
  8231. will be used.
  8232. The range defines square of four pixels around current pixel.
  8233. @item direction, d
  8234. Set direction in radians from which four pixel will be compared. If positive,
  8235. random direction from 0 to set direction will be picked. If negative, exact of
  8236. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  8237. will pick only pixels on same row and -PI/2 will pick only pixels on same
  8238. column.
  8239. @item blur, b
  8240. If enabled, current pixel is compared with average value of all four
  8241. surrounding pixels. The default is enabled. If disabled current pixel is
  8242. compared with all four surrounding pixels. The pixel is considered banded
  8243. if only all four differences with surrounding pixels are less than threshold.
  8244. @item coupling, c
  8245. If enabled, current pixel is changed if and only if all pixel components are banded,
  8246. e.g. banding detection threshold is triggered for all color components.
  8247. The default is disabled.
  8248. @end table
  8249. @subsection Commands
  8250. This filter supports the all above options as @ref{commands}.
  8251. @section deblock
  8252. Remove blocking artifacts from input video.
  8253. The filter accepts the following options:
  8254. @table @option
  8255. @item filter
  8256. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  8257. This controls what kind of deblocking is applied.
  8258. @item block
  8259. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  8260. @item alpha
  8261. @item beta
  8262. @item gamma
  8263. @item delta
  8264. Set blocking detection thresholds. Allowed range is 0 to 1.
  8265. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  8266. Using higher threshold gives more deblocking strength.
  8267. Setting @var{alpha} controls threshold detection at exact edge of block.
  8268. Remaining options controls threshold detection near the edge. Each one for
  8269. below/above or left/right. Setting any of those to @var{0} disables
  8270. deblocking.
  8271. @item planes
  8272. Set planes to filter. Default is to filter all available planes.
  8273. @end table
  8274. @subsection Examples
  8275. @itemize
  8276. @item
  8277. Deblock using weak filter and block size of 4 pixels.
  8278. @example
  8279. deblock=filter=weak:block=4
  8280. @end example
  8281. @item
  8282. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  8283. deblocking more edges.
  8284. @example
  8285. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  8286. @end example
  8287. @item
  8288. Similar as above, but filter only first plane.
  8289. @example
  8290. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  8291. @end example
  8292. @item
  8293. Similar as above, but filter only second and third plane.
  8294. @example
  8295. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  8296. @end example
  8297. @end itemize
  8298. @subsection Commands
  8299. This filter supports the all above options as @ref{commands}.
  8300. @anchor{decimate}
  8301. @section decimate
  8302. Drop duplicated frames at regular intervals.
  8303. The filter accepts the following options:
  8304. @table @option
  8305. @item cycle
  8306. Set the number of frames from which one will be dropped. Setting this to
  8307. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  8308. Default is @code{5}.
  8309. @item dupthresh
  8310. Set the threshold for duplicate detection. If the difference metric for a frame
  8311. is less than or equal to this value, then it is declared as duplicate. Default
  8312. is @code{1.1}
  8313. @item scthresh
  8314. Set scene change threshold. Default is @code{15}.
  8315. @item blockx
  8316. @item blocky
  8317. Set the size of the x and y-axis blocks used during metric calculations.
  8318. Larger blocks give better noise suppression, but also give worse detection of
  8319. small movements. Must be a power of two. Default is @code{32}.
  8320. @item ppsrc
  8321. Mark main input as a pre-processed input and activate clean source input
  8322. stream. This allows the input to be pre-processed with various filters to help
  8323. the metrics calculation while keeping the frame selection lossless. When set to
  8324. @code{1}, the first stream is for the pre-processed input, and the second
  8325. stream is the clean source from where the kept frames are chosen. Default is
  8326. @code{0}.
  8327. @item chroma
  8328. Set whether or not chroma is considered in the metric calculations. Default is
  8329. @code{1}.
  8330. @end table
  8331. @section deconvolve
  8332. Apply 2D deconvolution of video stream in frequency domain using second stream
  8333. as impulse.
  8334. The filter accepts the following options:
  8335. @table @option
  8336. @item planes
  8337. Set which planes to process.
  8338. @item impulse
  8339. Set which impulse video frames will be processed, can be @var{first}
  8340. or @var{all}. Default is @var{all}.
  8341. @item noise
  8342. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  8343. and height are not same and not power of 2 or if stream prior to convolving
  8344. had noise.
  8345. @end table
  8346. The @code{deconvolve} filter also supports the @ref{framesync} options.
  8347. @section dedot
  8348. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  8349. It accepts the following options:
  8350. @table @option
  8351. @item m
  8352. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  8353. @var{rainbows} for cross-color reduction.
  8354. @item lt
  8355. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  8356. @item tl
  8357. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  8358. @item tc
  8359. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  8360. @item ct
  8361. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  8362. @end table
  8363. @section deflate
  8364. Apply deflate effect to the video.
  8365. This filter replaces the pixel by the local(3x3) average by taking into account
  8366. only values lower than the pixel.
  8367. It accepts the following options:
  8368. @table @option
  8369. @item threshold0
  8370. @item threshold1
  8371. @item threshold2
  8372. @item threshold3
  8373. Limit the maximum change for each plane, default is 65535.
  8374. If 0, plane will remain unchanged.
  8375. @end table
  8376. @subsection Commands
  8377. This filter supports the all above options as @ref{commands}.
  8378. @section deflicker
  8379. Remove temporal frame luminance variations.
  8380. It accepts the following options:
  8381. @table @option
  8382. @item size, s
  8383. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  8384. @item mode, m
  8385. Set averaging mode to smooth temporal luminance variations.
  8386. Available values are:
  8387. @table @samp
  8388. @item am
  8389. Arithmetic mean
  8390. @item gm
  8391. Geometric mean
  8392. @item hm
  8393. Harmonic mean
  8394. @item qm
  8395. Quadratic mean
  8396. @item cm
  8397. Cubic mean
  8398. @item pm
  8399. Power mean
  8400. @item median
  8401. Median
  8402. @end table
  8403. @item bypass
  8404. Do not actually modify frame. Useful when one only wants metadata.
  8405. @end table
  8406. @section dejudder
  8407. Remove judder produced by partially interlaced telecined content.
  8408. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8409. source was partially telecined content then the output of @code{pullup,dejudder}
  8410. will have a variable frame rate. May change the recorded frame rate of the
  8411. container. Aside from that change, this filter will not affect constant frame
  8412. rate video.
  8413. The option available in this filter is:
  8414. @table @option
  8415. @item cycle
  8416. Specify the length of the window over which the judder repeats.
  8417. Accepts any integer greater than 1. Useful values are:
  8418. @table @samp
  8419. @item 4
  8420. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8421. @item 5
  8422. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8423. @item 20
  8424. If a mixture of the two.
  8425. @end table
  8426. The default is @samp{4}.
  8427. @end table
  8428. @section delogo
  8429. Suppress a TV station logo by a simple interpolation of the surrounding
  8430. pixels. Just set a rectangle covering the logo and watch it disappear
  8431. (and sometimes something even uglier appear - your mileage may vary).
  8432. It accepts the following parameters:
  8433. @table @option
  8434. @item x
  8435. @item y
  8436. Specify the top left corner coordinates of the logo. They must be
  8437. specified.
  8438. @item w
  8439. @item h
  8440. Specify the width and height of the logo to clear. They must be
  8441. specified.
  8442. @item show
  8443. When set to 1, a green rectangle is drawn on the screen to simplify
  8444. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8445. The default value is 0.
  8446. The rectangle is drawn on the outermost pixels which will be (partly)
  8447. replaced with interpolated values. The values of the next pixels
  8448. immediately outside this rectangle in each direction will be used to
  8449. compute the interpolated pixel values inside the rectangle.
  8450. @end table
  8451. @subsection Examples
  8452. @itemize
  8453. @item
  8454. Set a rectangle covering the area with top left corner coordinates 0,0
  8455. and size 100x77:
  8456. @example
  8457. delogo=x=0:y=0:w=100:h=77
  8458. @end example
  8459. @end itemize
  8460. @anchor{derain}
  8461. @section derain
  8462. Remove the rain in the input image/video by applying the derain methods based on
  8463. convolutional neural networks. Supported models:
  8464. @itemize
  8465. @item
  8466. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8467. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8468. @end itemize
  8469. Training as well as model generation scripts are provided in
  8470. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8471. Native model files (.model) can be generated from TensorFlow model
  8472. files (.pb) by using tools/python/convert.py
  8473. The filter accepts the following options:
  8474. @table @option
  8475. @item filter_type
  8476. Specify which filter to use. This option accepts the following values:
  8477. @table @samp
  8478. @item derain
  8479. Derain filter. To conduct derain filter, you need to use a derain model.
  8480. @item dehaze
  8481. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  8482. @end table
  8483. Default value is @samp{derain}.
  8484. @item dnn_backend
  8485. Specify which DNN backend to use for model loading and execution. This option accepts
  8486. the following values:
  8487. @table @samp
  8488. @item native
  8489. Native implementation of DNN loading and execution.
  8490. @item tensorflow
  8491. TensorFlow backend. To enable this backend you
  8492. need to install the TensorFlow for C library (see
  8493. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8494. @code{--enable-libtensorflow}
  8495. @end table
  8496. Default value is @samp{native}.
  8497. @item model
  8498. Set path to model file specifying network architecture and its parameters.
  8499. Note that different backends use different file formats. TensorFlow and native
  8500. backend can load files for only its format.
  8501. @end table
  8502. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  8503. @section deshake
  8504. Attempt to fix small changes in horizontal and/or vertical shift. This
  8505. filter helps remove camera shake from hand-holding a camera, bumping a
  8506. tripod, moving on a vehicle, etc.
  8507. The filter accepts the following options:
  8508. @table @option
  8509. @item x
  8510. @item y
  8511. @item w
  8512. @item h
  8513. Specify a rectangular area where to limit the search for motion
  8514. vectors.
  8515. If desired the search for motion vectors can be limited to a
  8516. rectangular area of the frame defined by its top left corner, width
  8517. and height. These parameters have the same meaning as the drawbox
  8518. filter which can be used to visualise the position of the bounding
  8519. box.
  8520. This is useful when simultaneous movement of subjects within the frame
  8521. might be confused for camera motion by the motion vector search.
  8522. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  8523. then the full frame is used. This allows later options to be set
  8524. without specifying the bounding box for the motion vector search.
  8525. Default - search the whole frame.
  8526. @item rx
  8527. @item ry
  8528. Specify the maximum extent of movement in x and y directions in the
  8529. range 0-64 pixels. Default 16.
  8530. @item edge
  8531. Specify how to generate pixels to fill blanks at the edge of the
  8532. frame. Available values are:
  8533. @table @samp
  8534. @item blank, 0
  8535. Fill zeroes at blank locations
  8536. @item original, 1
  8537. Original image at blank locations
  8538. @item clamp, 2
  8539. Extruded edge value at blank locations
  8540. @item mirror, 3
  8541. Mirrored edge at blank locations
  8542. @end table
  8543. Default value is @samp{mirror}.
  8544. @item blocksize
  8545. Specify the blocksize to use for motion search. Range 4-128 pixels,
  8546. default 8.
  8547. @item contrast
  8548. Specify the contrast threshold for blocks. Only blocks with more than
  8549. the specified contrast (difference between darkest and lightest
  8550. pixels) will be considered. Range 1-255, default 125.
  8551. @item search
  8552. Specify the search strategy. Available values are:
  8553. @table @samp
  8554. @item exhaustive, 0
  8555. Set exhaustive search
  8556. @item less, 1
  8557. Set less exhaustive search.
  8558. @end table
  8559. Default value is @samp{exhaustive}.
  8560. @item filename
  8561. If set then a detailed log of the motion search is written to the
  8562. specified file.
  8563. @end table
  8564. @section despill
  8565. Remove unwanted contamination of foreground colors, caused by reflected color of
  8566. greenscreen or bluescreen.
  8567. This filter accepts the following options:
  8568. @table @option
  8569. @item type
  8570. Set what type of despill to use.
  8571. @item mix
  8572. Set how spillmap will be generated.
  8573. @item expand
  8574. Set how much to get rid of still remaining spill.
  8575. @item red
  8576. Controls amount of red in spill area.
  8577. @item green
  8578. Controls amount of green in spill area.
  8579. Should be -1 for greenscreen.
  8580. @item blue
  8581. Controls amount of blue in spill area.
  8582. Should be -1 for bluescreen.
  8583. @item brightness
  8584. Controls brightness of spill area, preserving colors.
  8585. @item alpha
  8586. Modify alpha from generated spillmap.
  8587. @end table
  8588. @subsection Commands
  8589. This filter supports the all above options as @ref{commands}.
  8590. @section detelecine
  8591. Apply an exact inverse of the telecine operation. It requires a predefined
  8592. pattern specified using the pattern option which must be the same as that passed
  8593. to the telecine filter.
  8594. This filter accepts the following options:
  8595. @table @option
  8596. @item first_field
  8597. @table @samp
  8598. @item top, t
  8599. top field first
  8600. @item bottom, b
  8601. bottom field first
  8602. The default value is @code{top}.
  8603. @end table
  8604. @item pattern
  8605. A string of numbers representing the pulldown pattern you wish to apply.
  8606. The default value is @code{23}.
  8607. @item start_frame
  8608. A number representing position of the first frame with respect to the telecine
  8609. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  8610. @end table
  8611. @anchor{dilation}
  8612. @section dilation
  8613. Apply dilation effect to the video.
  8614. This filter replaces the pixel by the local(3x3) maximum.
  8615. It accepts the following options:
  8616. @table @option
  8617. @item threshold0
  8618. @item threshold1
  8619. @item threshold2
  8620. @item threshold3
  8621. Limit the maximum change for each plane, default is 65535.
  8622. If 0, plane will remain unchanged.
  8623. @item coordinates
  8624. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8625. pixels are used.
  8626. Flags to local 3x3 coordinates maps like this:
  8627. 1 2 3
  8628. 4 5
  8629. 6 7 8
  8630. @end table
  8631. @subsection Commands
  8632. This filter supports the all above options as @ref{commands}.
  8633. @section displace
  8634. Displace pixels as indicated by second and third input stream.
  8635. It takes three input streams and outputs one stream, the first input is the
  8636. source, and second and third input are displacement maps.
  8637. The second input specifies how much to displace pixels along the
  8638. x-axis, while the third input specifies how much to displace pixels
  8639. along the y-axis.
  8640. If one of displacement map streams terminates, last frame from that
  8641. displacement map will be used.
  8642. Note that once generated, displacements maps can be reused over and over again.
  8643. A description of the accepted options follows.
  8644. @table @option
  8645. @item edge
  8646. Set displace behavior for pixels that are out of range.
  8647. Available values are:
  8648. @table @samp
  8649. @item blank
  8650. Missing pixels are replaced by black pixels.
  8651. @item smear
  8652. Adjacent pixels will spread out to replace missing pixels.
  8653. @item wrap
  8654. Out of range pixels are wrapped so they point to pixels of other side.
  8655. @item mirror
  8656. Out of range pixels will be replaced with mirrored pixels.
  8657. @end table
  8658. Default is @samp{smear}.
  8659. @end table
  8660. @subsection Examples
  8661. @itemize
  8662. @item
  8663. Add ripple effect to rgb input of video size hd720:
  8664. @example
  8665. 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
  8666. @end example
  8667. @item
  8668. Add wave effect to rgb input of video size hd720:
  8669. @example
  8670. 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
  8671. @end example
  8672. @end itemize
  8673. @section dnn_classify
  8674. Do classification with deep neural networks based on bounding boxes.
  8675. The filter accepts the following options:
  8676. @table @option
  8677. @item dnn_backend
  8678. Specify which DNN backend to use for model loading and execution. This option accepts
  8679. only openvino now, tensorflow backends will be added.
  8680. @item model
  8681. Set path to model file specifying network architecture and its parameters.
  8682. Note that different backends use different file formats.
  8683. @item input
  8684. Set the input name of the dnn network.
  8685. @item output
  8686. Set the output name of the dnn network.
  8687. @item confidence
  8688. Set the confidence threshold (default: 0.5).
  8689. @item labels
  8690. Set path to label file specifying the mapping between label id and name.
  8691. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8692. The first line is the name of label id 0,
  8693. and the second line is the name of label id 1, etc.
  8694. The label id is considered as name if the label file is not provided.
  8695. @item backend_configs
  8696. Set the configs to be passed into backend
  8697. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8698. please use tools/python/tf_sess_config.py to get the configs for your system.
  8699. @end table
  8700. @section dnn_detect
  8701. Do object detection with deep neural networks.
  8702. The filter accepts the following options:
  8703. @table @option
  8704. @item dnn_backend
  8705. Specify which DNN backend to use for model loading and execution. This option accepts
  8706. only openvino now, tensorflow backends will be added.
  8707. @item model
  8708. Set path to model file specifying network architecture and its parameters.
  8709. Note that different backends use different file formats.
  8710. @item input
  8711. Set the input name of the dnn network.
  8712. @item output
  8713. Set the output name of the dnn network.
  8714. @item confidence
  8715. Set the confidence threshold (default: 0.5).
  8716. @item labels
  8717. Set path to label file specifying the mapping between label id and name.
  8718. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8719. The first line is the name of label id 0 (usually it is 'background'),
  8720. and the second line is the name of label id 1, etc.
  8721. The label id is considered as name if the label file is not provided.
  8722. @item backend_configs
  8723. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8724. Roll back to sync execution if the backend does not support async.
  8725. @end table
  8726. @anchor{dnn_processing}
  8727. @section dnn_processing
  8728. Do image processing with deep neural networks. It works together with another filter
  8729. which converts the pixel format of the Frame to what the dnn network requires.
  8730. The filter accepts the following options:
  8731. @table @option
  8732. @item dnn_backend
  8733. Specify which DNN backend to use for model loading and execution. This option accepts
  8734. the following values:
  8735. @table @samp
  8736. @item native
  8737. Native implementation of DNN loading and execution.
  8738. @item tensorflow
  8739. TensorFlow backend. To enable this backend you
  8740. need to install the TensorFlow for C library (see
  8741. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8742. @code{--enable-libtensorflow}
  8743. @item openvino
  8744. OpenVINO backend. To enable this backend you
  8745. need to build and install the OpenVINO for C library (see
  8746. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  8747. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  8748. be needed if the header files and libraries are not installed into system path)
  8749. @end table
  8750. Default value is @samp{native}.
  8751. @item model
  8752. Set path to model file specifying network architecture and its parameters.
  8753. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  8754. backend can load files for only its format.
  8755. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  8756. @item input
  8757. Set the input name of the dnn network.
  8758. @item output
  8759. Set the output name of the dnn network.
  8760. @item backend_configs
  8761. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8762. Roll back to sync execution if the backend does not support async.
  8763. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8764. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8765. @end table
  8766. @subsection Examples
  8767. @itemize
  8768. @item
  8769. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  8770. @example
  8771. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  8772. @end example
  8773. @item
  8774. Halve the pixel value of the frame with format gray32f:
  8775. @example
  8776. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  8777. @end example
  8778. @item
  8779. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  8780. @example
  8781. ./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
  8782. @end example
  8783. @item
  8784. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  8785. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8786. @example
  8787. ./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
  8788. @end example
  8789. @end itemize
  8790. @section drawbox
  8791. Draw a colored box on the input image.
  8792. It accepts the following parameters:
  8793. @table @option
  8794. @item x
  8795. @item y
  8796. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  8797. @item width, w
  8798. @item height, h
  8799. The expressions which specify the width and height of the box; if 0 they are interpreted as
  8800. the input width and height. It defaults to 0.
  8801. @item color, c
  8802. Specify the color of the box to write. For the general syntax of this option,
  8803. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8804. value @code{invert} is used, the box edge color is the same as the
  8805. video with inverted luma.
  8806. @item thickness, t
  8807. The expression which sets the thickness of the box edge.
  8808. A value of @code{fill} will create a filled box. Default value is @code{3}.
  8809. See below for the list of accepted constants.
  8810. @item replace
  8811. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  8812. will overwrite the video's color and alpha pixels.
  8813. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  8814. @end table
  8815. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8816. following constants:
  8817. @table @option
  8818. @item dar
  8819. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8820. @item hsub
  8821. @item vsub
  8822. horizontal and vertical chroma subsample values. For example for the
  8823. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8824. @item in_h, ih
  8825. @item in_w, iw
  8826. The input width and height.
  8827. @item sar
  8828. The input sample aspect ratio.
  8829. @item x
  8830. @item y
  8831. The x and y offset coordinates where the box is drawn.
  8832. @item w
  8833. @item h
  8834. The width and height of the drawn box.
  8835. @item box_source
  8836. Box source can be set as side_data_detection_bboxes if you want to use box data in
  8837. detection bboxes of side data.
  8838. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  8839. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  8840. not sure about the box source.
  8841. @item t
  8842. The thickness of the drawn box.
  8843. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  8844. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  8845. @end table
  8846. @subsection Examples
  8847. @itemize
  8848. @item
  8849. Draw a black box around the edge of the input image:
  8850. @example
  8851. drawbox
  8852. @end example
  8853. @item
  8854. Draw a box with color red and an opacity of 50%:
  8855. @example
  8856. drawbox=10:20:200:60:red@@0.5
  8857. @end example
  8858. The previous example can be specified as:
  8859. @example
  8860. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  8861. @end example
  8862. @item
  8863. Fill the box with pink color:
  8864. @example
  8865. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  8866. @end example
  8867. @item
  8868. Draw a 2-pixel red 2.40:1 mask:
  8869. @example
  8870. 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
  8871. @end example
  8872. @end itemize
  8873. @subsection Commands
  8874. This filter supports same commands as options.
  8875. The command accepts the same syntax of the corresponding option.
  8876. If the specified expression is not valid, it is kept at its current
  8877. value.
  8878. @anchor{drawgraph}
  8879. @section drawgraph
  8880. Draw a graph using input video metadata.
  8881. It accepts the following parameters:
  8882. @table @option
  8883. @item m1
  8884. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  8885. @item fg1
  8886. Set 1st foreground color expression.
  8887. @item m2
  8888. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  8889. @item fg2
  8890. Set 2nd foreground color expression.
  8891. @item m3
  8892. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  8893. @item fg3
  8894. Set 3rd foreground color expression.
  8895. @item m4
  8896. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  8897. @item fg4
  8898. Set 4th foreground color expression.
  8899. @item min
  8900. Set minimal value of metadata value.
  8901. @item max
  8902. Set maximal value of metadata value.
  8903. @item bg
  8904. Set graph background color. Default is white.
  8905. @item mode
  8906. Set graph mode.
  8907. Available values for mode is:
  8908. @table @samp
  8909. @item bar
  8910. @item dot
  8911. @item line
  8912. @end table
  8913. Default is @code{line}.
  8914. @item slide
  8915. Set slide mode.
  8916. Available values for slide is:
  8917. @table @samp
  8918. @item frame
  8919. Draw new frame when right border is reached.
  8920. @item replace
  8921. Replace old columns with new ones.
  8922. @item scroll
  8923. Scroll from right to left.
  8924. @item rscroll
  8925. Scroll from left to right.
  8926. @item picture
  8927. Draw single picture.
  8928. @end table
  8929. Default is @code{frame}.
  8930. @item size
  8931. Set size of graph video. For the syntax of this option, check the
  8932. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8933. The default value is @code{900x256}.
  8934. @item rate, r
  8935. Set the output frame rate. Default value is @code{25}.
  8936. The foreground color expressions can use the following variables:
  8937. @table @option
  8938. @item MIN
  8939. Minimal value of metadata value.
  8940. @item MAX
  8941. Maximal value of metadata value.
  8942. @item VAL
  8943. Current metadata key value.
  8944. @end table
  8945. The color is defined as 0xAABBGGRR.
  8946. @end table
  8947. Example using metadata from @ref{signalstats} filter:
  8948. @example
  8949. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  8950. @end example
  8951. Example using metadata from @ref{ebur128} filter:
  8952. @example
  8953. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  8954. @end example
  8955. @section drawgrid
  8956. Draw a grid on the input image.
  8957. It accepts the following parameters:
  8958. @table @option
  8959. @item x
  8960. @item y
  8961. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  8962. @item width, w
  8963. @item height, h
  8964. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  8965. input width and height, respectively, minus @code{thickness}, so image gets
  8966. framed. Default to 0.
  8967. @item color, c
  8968. Specify the color of the grid. For the general syntax of this option,
  8969. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8970. value @code{invert} is used, the grid color is the same as the
  8971. video with inverted luma.
  8972. @item thickness, t
  8973. The expression which sets the thickness of the grid line. Default value is @code{1}.
  8974. See below for the list of accepted constants.
  8975. @item replace
  8976. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  8977. will overwrite the video's color and alpha pixels.
  8978. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  8979. @end table
  8980. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8981. following constants:
  8982. @table @option
  8983. @item dar
  8984. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8985. @item hsub
  8986. @item vsub
  8987. horizontal and vertical chroma subsample values. For example for the
  8988. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8989. @item in_h, ih
  8990. @item in_w, iw
  8991. The input grid cell width and height.
  8992. @item sar
  8993. The input sample aspect ratio.
  8994. @item x
  8995. @item y
  8996. The x and y coordinates of some point of grid intersection (meant to configure offset).
  8997. @item w
  8998. @item h
  8999. The width and height of the drawn cell.
  9000. @item t
  9001. The thickness of the drawn cell.
  9002. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9003. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9004. @end table
  9005. @subsection Examples
  9006. @itemize
  9007. @item
  9008. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  9009. @example
  9010. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  9011. @end example
  9012. @item
  9013. Draw a white 3x3 grid with an opacity of 50%:
  9014. @example
  9015. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  9016. @end example
  9017. @end itemize
  9018. @subsection Commands
  9019. This filter supports same commands as options.
  9020. The command accepts the same syntax of the corresponding option.
  9021. If the specified expression is not valid, it is kept at its current
  9022. value.
  9023. @anchor{drawtext}
  9024. @section drawtext
  9025. Draw a text string or text from a specified file on top of a video, using the
  9026. libfreetype library.
  9027. To enable compilation of this filter, you need to configure FFmpeg with
  9028. @code{--enable-libfreetype}.
  9029. To enable default font fallback and the @var{font} option you need to
  9030. configure FFmpeg with @code{--enable-libfontconfig}.
  9031. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  9032. @code{--enable-libfribidi}.
  9033. @subsection Syntax
  9034. It accepts the following parameters:
  9035. @table @option
  9036. @item box
  9037. Used to draw a box around text using the background color.
  9038. The value must be either 1 (enable) or 0 (disable).
  9039. The default value of @var{box} is 0.
  9040. @item boxborderw
  9041. Set the width of the border to be drawn around the box using @var{boxcolor}.
  9042. The default value of @var{boxborderw} is 0.
  9043. @item boxcolor
  9044. The color to be used for drawing box around text. For the syntax of this
  9045. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9046. The default value of @var{boxcolor} is "white".
  9047. @item line_spacing
  9048. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  9049. The default value of @var{line_spacing} is 0.
  9050. @item borderw
  9051. Set the width of the border to be drawn around the text using @var{bordercolor}.
  9052. The default value of @var{borderw} is 0.
  9053. @item bordercolor
  9054. Set the color to be used for drawing border around text. For the syntax of this
  9055. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9056. The default value of @var{bordercolor} is "black".
  9057. @item expansion
  9058. Select how the @var{text} is expanded. Can be either @code{none},
  9059. @code{strftime} (deprecated) or
  9060. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  9061. below for details.
  9062. @item basetime
  9063. Set a start time for the count. Value is in microseconds. Only applied
  9064. in the deprecated strftime expansion mode. To emulate in normal expansion
  9065. mode use the @code{pts} function, supplying the start time (in seconds)
  9066. as the second argument.
  9067. @item fix_bounds
  9068. If true, check and fix text coords to avoid clipping.
  9069. @item fontcolor
  9070. The color to be used for drawing fonts. For the syntax of this option, check
  9071. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9072. The default value of @var{fontcolor} is "black".
  9073. @item fontcolor_expr
  9074. String which is expanded the same way as @var{text} to obtain dynamic
  9075. @var{fontcolor} value. By default this option has empty value and is not
  9076. processed. When this option is set, it overrides @var{fontcolor} option.
  9077. @item font
  9078. The font family to be used for drawing text. By default Sans.
  9079. @item fontfile
  9080. The font file to be used for drawing text. The path must be included.
  9081. This parameter is mandatory if the fontconfig support is disabled.
  9082. @item alpha
  9083. Draw the text applying alpha blending. The value can
  9084. be a number between 0.0 and 1.0.
  9085. The expression accepts the same variables @var{x, y} as well.
  9086. The default value is 1.
  9087. Please see @var{fontcolor_expr}.
  9088. @item fontsize
  9089. The font size to be used for drawing text.
  9090. The default value of @var{fontsize} is 16.
  9091. @item text_shaping
  9092. If set to 1, attempt to shape the text (for example, reverse the order of
  9093. right-to-left text and join Arabic characters) before drawing it.
  9094. Otherwise, just draw the text exactly as given.
  9095. By default 1 (if supported).
  9096. @item ft_load_flags
  9097. The flags to be used for loading the fonts.
  9098. The flags map the corresponding flags supported by libfreetype, and are
  9099. a combination of the following values:
  9100. @table @var
  9101. @item default
  9102. @item no_scale
  9103. @item no_hinting
  9104. @item render
  9105. @item no_bitmap
  9106. @item vertical_layout
  9107. @item force_autohint
  9108. @item crop_bitmap
  9109. @item pedantic
  9110. @item ignore_global_advance_width
  9111. @item no_recurse
  9112. @item ignore_transform
  9113. @item monochrome
  9114. @item linear_design
  9115. @item no_autohint
  9116. @end table
  9117. Default value is "default".
  9118. For more information consult the documentation for the FT_LOAD_*
  9119. libfreetype flags.
  9120. @item shadowcolor
  9121. The color to be used for drawing a shadow behind the drawn text. For the
  9122. syntax of this option, check the @ref{color syntax,,"Color" section in the
  9123. ffmpeg-utils manual,ffmpeg-utils}.
  9124. The default value of @var{shadowcolor} is "black".
  9125. @item shadowx
  9126. @item shadowy
  9127. The x and y offsets for the text shadow position with respect to the
  9128. position of the text. They can be either positive or negative
  9129. values. The default value for both is "0".
  9130. @item start_number
  9131. The starting frame number for the n/frame_num variable. The default value
  9132. is "0".
  9133. @item tabsize
  9134. The size in number of spaces to use for rendering the tab.
  9135. Default value is 4.
  9136. @item timecode
  9137. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  9138. format. It can be used with or without text parameter. @var{timecode_rate}
  9139. option must be specified.
  9140. @item timecode_rate, rate, r
  9141. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  9142. integer. Minimum value is "1".
  9143. Drop-frame timecode is supported for frame rates 30 & 60.
  9144. @item tc24hmax
  9145. If set to 1, the output of the timecode option will wrap around at 24 hours.
  9146. Default is 0 (disabled).
  9147. @item text
  9148. The text string to be drawn. The text must be a sequence of UTF-8
  9149. encoded characters.
  9150. This parameter is mandatory if no file is specified with the parameter
  9151. @var{textfile}.
  9152. @item textfile
  9153. A text file containing text to be drawn. The text must be a sequence
  9154. of UTF-8 encoded characters.
  9155. This parameter is mandatory if no text string is specified with the
  9156. parameter @var{text}.
  9157. If both @var{text} and @var{textfile} are specified, an error is thrown.
  9158. @item text_source
  9159. Text source should be set as side_data_detection_bboxes if you want to use text data in
  9160. detection bboxes of side data.
  9161. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  9162. text data in detection bboxes of side data. So please do not use this parameter
  9163. if you are not sure about the text source.
  9164. @item reload
  9165. The @var{textfile} will be reloaded at specified frame interval.
  9166. Be sure to update @var{textfile} atomically, or it may be read partially,
  9167. or even fail.
  9168. Range is 0 to INT_MAX. Default is 0.
  9169. @item x
  9170. @item y
  9171. The expressions which specify the offsets where text will be drawn
  9172. within the video frame. They are relative to the top/left border of the
  9173. output image.
  9174. The default value of @var{x} and @var{y} is "0".
  9175. See below for the list of accepted constants and functions.
  9176. @end table
  9177. The parameters for @var{x} and @var{y} are expressions containing the
  9178. following constants and functions:
  9179. @table @option
  9180. @item dar
  9181. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9182. @item hsub
  9183. @item vsub
  9184. horizontal and vertical chroma subsample values. For example for the
  9185. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9186. @item line_h, lh
  9187. the height of each text line
  9188. @item main_h, h, H
  9189. the input height
  9190. @item main_w, w, W
  9191. the input width
  9192. @item max_glyph_a, ascent
  9193. the maximum distance from the baseline to the highest/upper grid
  9194. coordinate used to place a glyph outline point, for all the rendered
  9195. glyphs.
  9196. It is a positive value, due to the grid's orientation with the Y axis
  9197. upwards.
  9198. @item max_glyph_d, descent
  9199. the maximum distance from the baseline to the lowest grid coordinate
  9200. used to place a glyph outline point, for all the rendered glyphs.
  9201. This is a negative value, due to the grid's orientation, with the Y axis
  9202. upwards.
  9203. @item max_glyph_h
  9204. maximum glyph height, that is the maximum height for all the glyphs
  9205. contained in the rendered text, it is equivalent to @var{ascent} -
  9206. @var{descent}.
  9207. @item max_glyph_w
  9208. maximum glyph width, that is the maximum width for all the glyphs
  9209. contained in the rendered text
  9210. @item n
  9211. the number of input frame, starting from 0
  9212. @item rand(min, max)
  9213. return a random number included between @var{min} and @var{max}
  9214. @item sar
  9215. The input sample aspect ratio.
  9216. @item t
  9217. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9218. @item text_h, th
  9219. the height of the rendered text
  9220. @item text_w, tw
  9221. the width of the rendered text
  9222. @item x
  9223. @item y
  9224. the x and y offset coordinates where the text is drawn.
  9225. These parameters allow the @var{x} and @var{y} expressions to refer
  9226. to each other, so you can for example specify @code{y=x/dar}.
  9227. @item pict_type
  9228. A one character description of the current frame's picture type.
  9229. @item pkt_pos
  9230. The current packet's position in the input file or stream
  9231. (in bytes, from the start of the input). A value of -1 indicates
  9232. this info is not available.
  9233. @item duration
  9234. The current packet's duration, in seconds.
  9235. @item pkt_size
  9236. The current packet's size (in bytes).
  9237. @end table
  9238. @anchor{drawtext_expansion}
  9239. @subsection Text expansion
  9240. If @option{expansion} is set to @code{strftime},
  9241. the filter recognizes strftime() sequences in the provided text and
  9242. expands them accordingly. Check the documentation of strftime(). This
  9243. feature is deprecated.
  9244. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  9245. If @option{expansion} is set to @code{normal} (which is the default),
  9246. the following expansion mechanism is used.
  9247. The backslash character @samp{\}, followed by any character, always expands to
  9248. the second character.
  9249. Sequences of the form @code{%@{...@}} are expanded. The text between the
  9250. braces is a function name, possibly followed by arguments separated by ':'.
  9251. If the arguments contain special characters or delimiters (':' or '@}'),
  9252. they should be escaped.
  9253. Note that they probably must also be escaped as the value for the
  9254. @option{text} option in the filter argument string and as the filter
  9255. argument in the filtergraph description, and possibly also for the shell,
  9256. that makes up to four levels of escaping; using a text file avoids these
  9257. problems.
  9258. The following functions are available:
  9259. @table @command
  9260. @item expr, e
  9261. The expression evaluation result.
  9262. It must take one argument specifying the expression to be evaluated,
  9263. which accepts the same constants and functions as the @var{x} and
  9264. @var{y} values. Note that not all constants should be used, for
  9265. example the text size is not known when evaluating the expression, so
  9266. the constants @var{text_w} and @var{text_h} will have an undefined
  9267. value.
  9268. @item expr_int_format, eif
  9269. Evaluate the expression's value and output as formatted integer.
  9270. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  9271. The second argument specifies the output format. Allowed values are @samp{x},
  9272. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  9273. @code{printf} function.
  9274. The third parameter is optional and sets the number of positions taken by the output.
  9275. It can be used to add padding with zeros from the left.
  9276. @item gmtime
  9277. The time at which the filter is running, expressed in UTC.
  9278. It can accept an argument: a strftime() format string.
  9279. The format string is extended to support the variable @var{%[1-6]N}
  9280. which prints fractions of the second with optionally specified number of digits.
  9281. @item localtime
  9282. The time at which the filter is running, expressed in the local time zone.
  9283. It can accept an argument: a strftime() format string.
  9284. The format string is extended to support the variable @var{%[1-6]N}
  9285. which prints fractions of the second with optionally specified number of digits.
  9286. @item metadata
  9287. Frame metadata. Takes one or two arguments.
  9288. The first argument is mandatory and specifies the metadata key.
  9289. The second argument is optional and specifies a default value, used when the
  9290. metadata key is not found or empty.
  9291. Available metadata can be identified by inspecting entries
  9292. starting with TAG included within each frame section
  9293. printed by running @code{ffprobe -show_frames}.
  9294. String metadata generated in filters leading to
  9295. the drawtext filter are also available.
  9296. @item n, frame_num
  9297. The frame number, starting from 0.
  9298. @item pict_type
  9299. A one character description of the current picture type.
  9300. @item pts
  9301. The timestamp of the current frame.
  9302. It can take up to three arguments.
  9303. The first argument is the format of the timestamp; it defaults to @code{flt}
  9304. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  9305. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  9306. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  9307. @code{localtime} stands for the timestamp of the frame formatted as
  9308. local time zone time.
  9309. The second argument is an offset added to the timestamp.
  9310. If the format is set to @code{hms}, a third argument @code{24HH} may be
  9311. supplied to present the hour part of the formatted timestamp in 24h format
  9312. (00-23).
  9313. If the format is set to @code{localtime} or @code{gmtime},
  9314. a third argument may be supplied: a strftime() format string.
  9315. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  9316. @end table
  9317. @subsection Commands
  9318. This filter supports altering parameters via commands:
  9319. @table @option
  9320. @item reinit
  9321. Alter existing filter parameters.
  9322. Syntax for the argument is the same as for filter invocation, e.g.
  9323. @example
  9324. fontsize=56:fontcolor=green:text='Hello World'
  9325. @end example
  9326. Full filter invocation with sendcmd would look like this:
  9327. @example
  9328. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  9329. @end example
  9330. @end table
  9331. If the entire argument can't be parsed or applied as valid values then the filter will
  9332. continue with its existing parameters.
  9333. @subsection Examples
  9334. @itemize
  9335. @item
  9336. Draw "Test Text" with font FreeSerif, using the default values for the
  9337. optional parameters.
  9338. @example
  9339. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  9340. @end example
  9341. @item
  9342. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  9343. and y=50 (counting from the top-left corner of the screen), text is
  9344. yellow with a red box around it. Both the text and the box have an
  9345. opacity of 20%.
  9346. @example
  9347. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  9348. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  9349. @end example
  9350. Note that the double quotes are not necessary if spaces are not used
  9351. within the parameter list.
  9352. @item
  9353. Show the text at the center of the video frame:
  9354. @example
  9355. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  9356. @end example
  9357. @item
  9358. Show the text at a random position, switching to a new position every 30 seconds:
  9359. @example
  9360. 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)"
  9361. @end example
  9362. @item
  9363. Show a text line sliding from right to left in the last row of the video
  9364. frame. The file @file{LONG_LINE} is assumed to contain a single line
  9365. with no newlines.
  9366. @example
  9367. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  9368. @end example
  9369. @item
  9370. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  9371. @example
  9372. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  9373. @end example
  9374. @item
  9375. Draw a single green letter "g", at the center of the input video.
  9376. The glyph baseline is placed at half screen height.
  9377. @example
  9378. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  9379. @end example
  9380. @item
  9381. Show text for 1 second every 3 seconds:
  9382. @example
  9383. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  9384. @end example
  9385. @item
  9386. Use fontconfig to set the font. Note that the colons need to be escaped.
  9387. @example
  9388. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  9389. @end example
  9390. @item
  9391. Draw "Test Text" with font size dependent on height of the video.
  9392. @example
  9393. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  9394. @end example
  9395. @item
  9396. Print the date of a real-time encoding (see strftime(3)):
  9397. @example
  9398. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  9399. @end example
  9400. @item
  9401. Show text fading in and out (appearing/disappearing):
  9402. @example
  9403. #!/bin/sh
  9404. DS=1.0 # display start
  9405. DE=10.0 # display end
  9406. FID=1.5 # fade in duration
  9407. FOD=5 # fade out duration
  9408. 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 @}"
  9409. @end example
  9410. @item
  9411. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9412. and the @option{fontsize} value are included in the @option{y} offset.
  9413. @example
  9414. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9415. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9416. @end example
  9417. @item
  9418. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9419. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9420. must have option @option{-export_path_metadata 1} for the special metadata fields
  9421. to be available for filters.
  9422. @example
  9423. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  9424. @end example
  9425. @end itemize
  9426. For more information about libfreetype, check:
  9427. @url{http://www.freetype.org/}.
  9428. For more information about fontconfig, check:
  9429. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  9430. For more information about libfribidi, check:
  9431. @url{http://fribidi.org/}.
  9432. @section edgedetect
  9433. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  9434. The filter accepts the following options:
  9435. @table @option
  9436. @item low
  9437. @item high
  9438. Set low and high threshold values used by the Canny thresholding
  9439. algorithm.
  9440. The high threshold selects the "strong" edge pixels, which are then
  9441. connected through 8-connectivity with the "weak" edge pixels selected
  9442. by the low threshold.
  9443. @var{low} and @var{high} threshold values must be chosen in the range
  9444. [0,1], and @var{low} should be lesser or equal to @var{high}.
  9445. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  9446. is @code{50/255}.
  9447. @item mode
  9448. Define the drawing mode.
  9449. @table @samp
  9450. @item wires
  9451. Draw white/gray wires on black background.
  9452. @item colormix
  9453. Mix the colors to create a paint/cartoon effect.
  9454. @item canny
  9455. Apply Canny edge detector on all selected planes.
  9456. @end table
  9457. Default value is @var{wires}.
  9458. @item planes
  9459. Select planes for filtering. By default all available planes are filtered.
  9460. @end table
  9461. @subsection Examples
  9462. @itemize
  9463. @item
  9464. Standard edge detection with custom values for the hysteresis thresholding:
  9465. @example
  9466. edgedetect=low=0.1:high=0.4
  9467. @end example
  9468. @item
  9469. Painting effect without thresholding:
  9470. @example
  9471. edgedetect=mode=colormix:high=0
  9472. @end example
  9473. @end itemize
  9474. @section elbg
  9475. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  9476. For each input image, the filter will compute the optimal mapping from
  9477. the input to the output given the codebook length, that is the number
  9478. of distinct output colors.
  9479. This filter accepts the following options.
  9480. @table @option
  9481. @item codebook_length, l
  9482. Set codebook length. The value must be a positive integer, and
  9483. represents the number of distinct output colors. Default value is 256.
  9484. @item nb_steps, n
  9485. Set the maximum number of iterations to apply for computing the optimal
  9486. mapping. The higher the value the better the result and the higher the
  9487. computation time. Default value is 1.
  9488. @item seed, s
  9489. Set a random seed, must be an integer included between 0 and
  9490. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  9491. will try to use a good random seed on a best effort basis.
  9492. @item pal8
  9493. Set pal8 output pixel format. This option does not work with codebook
  9494. length greater than 256. Default is disabled.
  9495. @item use_alpha
  9496. Include alpha values in the quantization calculation. Allows creating
  9497. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  9498. @end table
  9499. @section entropy
  9500. Measure graylevel entropy in histogram of color channels of video frames.
  9501. It accepts the following parameters:
  9502. @table @option
  9503. @item mode
  9504. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  9505. @var{diff} mode measures entropy of histogram delta values, absolute differences
  9506. between neighbour histogram values.
  9507. @end table
  9508. @section epx
  9509. Apply the EPX magnification filter which is designed for pixel art.
  9510. It accepts the following option:
  9511. @table @option
  9512. @item n
  9513. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  9514. @code{3xEPX}.
  9515. Default is @code{3}.
  9516. @end table
  9517. @section eq
  9518. Set brightness, contrast, saturation and approximate gamma adjustment.
  9519. The filter accepts the following options:
  9520. @table @option
  9521. @item contrast
  9522. Set the contrast expression. The value must be a float value in range
  9523. @code{-1000.0} to @code{1000.0}. The default value is "1".
  9524. @item brightness
  9525. Set the brightness expression. The value must be a float value in
  9526. range @code{-1.0} to @code{1.0}. The default value is "0".
  9527. @item saturation
  9528. Set the saturation expression. The value must be a float in
  9529. range @code{0.0} to @code{3.0}. The default value is "1".
  9530. @item gamma
  9531. Set the gamma expression. The value must be a float in range
  9532. @code{0.1} to @code{10.0}. The default value is "1".
  9533. @item gamma_r
  9534. Set the gamma expression for red. The value must be a float in
  9535. range @code{0.1} to @code{10.0}. The default value is "1".
  9536. @item gamma_g
  9537. Set the gamma expression for green. The value must be a float in range
  9538. @code{0.1} to @code{10.0}. The default value is "1".
  9539. @item gamma_b
  9540. Set the gamma expression for blue. The value must be a float in range
  9541. @code{0.1} to @code{10.0}. The default value is "1".
  9542. @item gamma_weight
  9543. Set the gamma weight expression. It can be used to reduce the effect
  9544. of a high gamma value on bright image areas, e.g. keep them from
  9545. getting overamplified and just plain white. The value must be a float
  9546. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  9547. gamma correction all the way down while @code{1.0} leaves it at its
  9548. full strength. Default is "1".
  9549. @item eval
  9550. Set when the expressions for brightness, contrast, saturation and
  9551. gamma expressions are evaluated.
  9552. It accepts the following values:
  9553. @table @samp
  9554. @item init
  9555. only evaluate expressions once during the filter initialization or
  9556. when a command is processed
  9557. @item frame
  9558. evaluate expressions for each incoming frame
  9559. @end table
  9560. Default value is @samp{init}.
  9561. @end table
  9562. The expressions accept the following parameters:
  9563. @table @option
  9564. @item n
  9565. frame count of the input frame starting from 0
  9566. @item pos
  9567. byte position of the corresponding packet in the input file, NAN if
  9568. unspecified
  9569. @item r
  9570. frame rate of the input video, NAN if the input frame rate is unknown
  9571. @item t
  9572. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9573. @end table
  9574. @subsection Commands
  9575. The filter supports the following commands:
  9576. @table @option
  9577. @item contrast
  9578. Set the contrast expression.
  9579. @item brightness
  9580. Set the brightness expression.
  9581. @item saturation
  9582. Set the saturation expression.
  9583. @item gamma
  9584. Set the gamma expression.
  9585. @item gamma_r
  9586. Set the gamma_r expression.
  9587. @item gamma_g
  9588. Set gamma_g expression.
  9589. @item gamma_b
  9590. Set gamma_b expression.
  9591. @item gamma_weight
  9592. Set gamma_weight expression.
  9593. The command accepts the same syntax of the corresponding option.
  9594. If the specified expression is not valid, it is kept at its current
  9595. value.
  9596. @end table
  9597. @anchor{erosion}
  9598. @section erosion
  9599. Apply erosion effect to the video.
  9600. This filter replaces the pixel by the local(3x3) minimum.
  9601. It accepts the following options:
  9602. @table @option
  9603. @item threshold0
  9604. @item threshold1
  9605. @item threshold2
  9606. @item threshold3
  9607. Limit the maximum change for each plane, default is 65535.
  9608. If 0, plane will remain unchanged.
  9609. @item coordinates
  9610. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9611. pixels are used.
  9612. Flags to local 3x3 coordinates maps like this:
  9613. 1 2 3
  9614. 4 5
  9615. 6 7 8
  9616. @end table
  9617. @subsection Commands
  9618. This filter supports the all above options as @ref{commands}.
  9619. @section estdif
  9620. Deinterlace the input video ("estdif" stands for "Edge Slope
  9621. Tracing Deinterlacing Filter").
  9622. Spatial only filter that uses edge slope tracing algorithm
  9623. to interpolate missing lines.
  9624. It accepts the following parameters:
  9625. @table @option
  9626. @item mode
  9627. The interlacing mode to adopt. It accepts one of the following values:
  9628. @table @option
  9629. @item frame
  9630. Output one frame for each frame.
  9631. @item field
  9632. Output one frame for each field.
  9633. @end table
  9634. The default value is @code{field}.
  9635. @item parity
  9636. The picture field parity assumed for the input interlaced video. It accepts one
  9637. of the following values:
  9638. @table @option
  9639. @item tff
  9640. Assume the top field is first.
  9641. @item bff
  9642. Assume the bottom field is first.
  9643. @item auto
  9644. Enable automatic detection of field parity.
  9645. @end table
  9646. The default value is @code{auto}.
  9647. If the interlacing is unknown or the decoder does not export this information,
  9648. top field first will be assumed.
  9649. @item deint
  9650. Specify which frames to deinterlace. Accepts one of the following
  9651. values:
  9652. @table @option
  9653. @item all
  9654. Deinterlace all frames.
  9655. @item interlaced
  9656. Only deinterlace frames marked as interlaced.
  9657. @end table
  9658. The default value is @code{all}.
  9659. @item rslope
  9660. Specify the search radius for edge slope tracing. Default value is 1.
  9661. Allowed range is from 1 to 15.
  9662. @item redge
  9663. Specify the search radius for best edge matching. Default value is 2.
  9664. Allowed range is from 0 to 15.
  9665. @item ecost
  9666. Specify the edge cost for edge matching. Default value is 1.0.
  9667. Allowed range is from 0 to 9.
  9668. @item mcost
  9669. Specify the middle cost for edge matching. Default value is 0.5.
  9670. Allowed range is from 0 to 1.
  9671. @item dcost
  9672. Specify the distance cost for edge matching. Default value is 0.5.
  9673. Allowed range is from 0 to 1.
  9674. @item interp
  9675. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  9676. of the following values:
  9677. @table @option
  9678. @item 2p
  9679. Two-point interpolation.
  9680. @item 4p
  9681. Four-point interpolation.
  9682. @item 6p
  9683. Six-point interpolation.
  9684. @end table
  9685. @end table
  9686. @subsection Commands
  9687. This filter supports same @ref{commands} as options.
  9688. @section exposure
  9689. Adjust exposure of the video stream.
  9690. The filter accepts the following options:
  9691. @table @option
  9692. @item exposure
  9693. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  9694. Default value is 0 EV.
  9695. @item black
  9696. Set the black level correction. Allowed range is from -1.0 to 1.0.
  9697. Default value is 0.
  9698. @end table
  9699. @subsection Commands
  9700. This filter supports same @ref{commands} as options.
  9701. @section extractplanes
  9702. Extract color channel components from input video stream into
  9703. separate grayscale video streams.
  9704. The filter accepts the following option:
  9705. @table @option
  9706. @item planes
  9707. Set plane(s) to extract.
  9708. Available values for planes are:
  9709. @table @samp
  9710. @item y
  9711. @item u
  9712. @item v
  9713. @item a
  9714. @item r
  9715. @item g
  9716. @item b
  9717. @end table
  9718. Choosing planes not available in the input will result in an error.
  9719. That means you cannot select @code{r}, @code{g}, @code{b} planes
  9720. with @code{y}, @code{u}, @code{v} planes at same time.
  9721. @end table
  9722. @subsection Examples
  9723. @itemize
  9724. @item
  9725. Extract luma, u and v color channel component from input video frame
  9726. into 3 grayscale outputs:
  9727. @example
  9728. 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
  9729. @end example
  9730. @end itemize
  9731. @section fade
  9732. Apply a fade-in/out effect to the input video.
  9733. It accepts the following parameters:
  9734. @table @option
  9735. @item type, t
  9736. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  9737. effect.
  9738. Default is @code{in}.
  9739. @item start_frame, s
  9740. Specify the number of the frame to start applying the fade
  9741. effect at. Default is 0.
  9742. @item nb_frames, n
  9743. The number of frames that the fade effect lasts. At the end of the
  9744. fade-in effect, the output video will have the same intensity as the input video.
  9745. At the end of the fade-out transition, the output video will be filled with the
  9746. selected @option{color}.
  9747. Default is 25.
  9748. @item alpha
  9749. If set to 1, fade only alpha channel, if one exists on the input.
  9750. Default value is 0.
  9751. @item start_time, st
  9752. Specify the timestamp (in seconds) of the frame to start to apply the fade
  9753. effect. If both start_frame and start_time are specified, the fade will start at
  9754. whichever comes last. Default is 0.
  9755. @item duration, d
  9756. The number of seconds for which the fade effect has to last. At the end of the
  9757. fade-in effect the output video will have the same intensity as the input video,
  9758. at the end of the fade-out transition the output video will be filled with the
  9759. selected @option{color}.
  9760. If both duration and nb_frames are specified, duration is used. Default is 0
  9761. (nb_frames is used by default).
  9762. @item color, c
  9763. Specify the color of the fade. Default is "black".
  9764. @end table
  9765. @subsection Examples
  9766. @itemize
  9767. @item
  9768. Fade in the first 30 frames of video:
  9769. @example
  9770. fade=in:0:30
  9771. @end example
  9772. The command above is equivalent to:
  9773. @example
  9774. fade=t=in:s=0:n=30
  9775. @end example
  9776. @item
  9777. Fade out the last 45 frames of a 200-frame video:
  9778. @example
  9779. fade=out:155:45
  9780. fade=type=out:start_frame=155:nb_frames=45
  9781. @end example
  9782. @item
  9783. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  9784. @example
  9785. fade=in:0:25, fade=out:975:25
  9786. @end example
  9787. @item
  9788. Make the first 5 frames yellow, then fade in from frame 5-24:
  9789. @example
  9790. fade=in:5:20:color=yellow
  9791. @end example
  9792. @item
  9793. Fade in alpha over first 25 frames of video:
  9794. @example
  9795. fade=in:0:25:alpha=1
  9796. @end example
  9797. @item
  9798. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  9799. @example
  9800. fade=t=in:st=5.5:d=0.5
  9801. @end example
  9802. @end itemize
  9803. @section feedback
  9804. Apply feedback video filter.
  9805. This filter pass cropped input frames to 2nd output.
  9806. From there it can be filtered with other video filters.
  9807. After filter receives frame from 2nd input, that frame
  9808. is combined on top of original frame from 1st input and passed
  9809. to 1st output.
  9810. The typical usage is filter only part of frame.
  9811. The filter accepts the following options:
  9812. @table @option
  9813. @item x
  9814. @item y
  9815. Set the top left crop position.
  9816. @item w
  9817. @item h
  9818. Set the crop size.
  9819. @end table
  9820. @subsection Examples
  9821. @itemize
  9822. @item
  9823. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  9824. @example
  9825. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  9826. @end example
  9827. @item
  9828. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  9829. @example
  9830. [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]
  9831. @end example
  9832. @end itemize
  9833. @section fftdnoiz
  9834. Denoise frames using 3D FFT (frequency domain filtering).
  9835. The filter accepts the following options:
  9836. @table @option
  9837. @item sigma
  9838. Set the noise sigma constant. This sets denoising strength.
  9839. Default value is 1. Allowed range is from 0 to 30.
  9840. Using very high sigma with low overlap may give blocking artifacts.
  9841. @item amount
  9842. Set amount of denoising. By default all detected noise is reduced.
  9843. Default value is 1. Allowed range is from 0 to 1.
  9844. @item block
  9845. Set size of block in pixels, Default is 32, can be 8 to 256.
  9846. @item overlap
  9847. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  9848. @item method
  9849. Set denoising method. Default is @code{wiener}, can also be @code{hard}.
  9850. @item prev
  9851. Set number of previous frames to use for denoising. By default is set to 0.
  9852. @item next
  9853. Set number of next frames to to use for denoising. By default is set to 0.
  9854. @item planes
  9855. Set planes which will be filtered, by default are all available filtered
  9856. except alpha.
  9857. @end table
  9858. @section fftfilt
  9859. Apply arbitrary expressions to samples in frequency domain
  9860. @table @option
  9861. @item dc_Y
  9862. Adjust the dc value (gain) of the luma plane of the image. The filter
  9863. accepts an integer value in range @code{0} to @code{1000}. The default
  9864. value is set to @code{0}.
  9865. @item dc_U
  9866. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  9867. filter accepts an integer value in range @code{0} to @code{1000}. The
  9868. default value is set to @code{0}.
  9869. @item dc_V
  9870. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  9871. filter accepts an integer value in range @code{0} to @code{1000}. The
  9872. default value is set to @code{0}.
  9873. @item weight_Y
  9874. Set the frequency domain weight expression for the luma plane.
  9875. @item weight_U
  9876. Set the frequency domain weight expression for the 1st chroma plane.
  9877. @item weight_V
  9878. Set the frequency domain weight expression for the 2nd chroma plane.
  9879. @item eval
  9880. Set when the expressions are evaluated.
  9881. It accepts the following values:
  9882. @table @samp
  9883. @item init
  9884. Only evaluate expressions once during the filter initialization.
  9885. @item frame
  9886. Evaluate expressions for each incoming frame.
  9887. @end table
  9888. Default value is @samp{init}.
  9889. The filter accepts the following variables:
  9890. @item X
  9891. @item Y
  9892. The coordinates of the current sample.
  9893. @item W
  9894. @item H
  9895. The width and height of the image.
  9896. @item N
  9897. The number of input frame, starting from 0.
  9898. @item WS
  9899. @item HS
  9900. The size of FFT array for horizontal and vertical processing.
  9901. @end table
  9902. @subsection Examples
  9903. @itemize
  9904. @item
  9905. High-pass:
  9906. @example
  9907. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  9908. @end example
  9909. @item
  9910. Low-pass:
  9911. @example
  9912. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  9913. @end example
  9914. @item
  9915. Sharpen:
  9916. @example
  9917. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  9918. @end example
  9919. @item
  9920. Blur:
  9921. @example
  9922. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  9923. @end example
  9924. @end itemize
  9925. @section field
  9926. Extract a single field from an interlaced image using stride
  9927. arithmetic to avoid wasting CPU time. The output frames are marked as
  9928. non-interlaced.
  9929. The filter accepts the following options:
  9930. @table @option
  9931. @item type
  9932. Specify whether to extract the top (if the value is @code{0} or
  9933. @code{top}) or the bottom field (if the value is @code{1} or
  9934. @code{bottom}).
  9935. @end table
  9936. @section fieldhint
  9937. Create new frames by copying the top and bottom fields from surrounding frames
  9938. supplied as numbers by the hint file.
  9939. @table @option
  9940. @item hint
  9941. Set file containing hints: absolute/relative frame numbers.
  9942. There must be one line for each frame in a clip. Each line must contain two
  9943. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  9944. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  9945. is current frame number for @code{absolute} mode or out of [-1, 1] range
  9946. for @code{relative} mode. First number tells from which frame to pick up top
  9947. field and second number tells from which frame to pick up bottom field.
  9948. If optionally followed by @code{+} output frame will be marked as interlaced,
  9949. else if followed by @code{-} output frame will be marked as progressive, else
  9950. it will be marked same as input frame.
  9951. If optionally followed by @code{t} output frame will use only top field, or in
  9952. case of @code{b} it will use only bottom field.
  9953. If line starts with @code{#} or @code{;} that line is skipped.
  9954. @item mode
  9955. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  9956. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  9957. are more frames to process than @code{hint} file is seek back to start.
  9958. @end table
  9959. Example of first several lines of @code{hint} file for @code{relative} mode:
  9960. @example
  9961. 0,0 - # first frame
  9962. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  9963. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  9964. 1,0 -
  9965. 0,0 -
  9966. 0,0 -
  9967. 1,0 -
  9968. 1,0 -
  9969. 1,0 -
  9970. 0,0 -
  9971. 0,0 -
  9972. 1,0 -
  9973. 1,0 -
  9974. 1,0 -
  9975. 0,0 -
  9976. @end example
  9977. @section fieldmatch
  9978. Field matching filter for inverse telecine. It is meant to reconstruct the
  9979. progressive frames from a telecined stream. The filter does not drop duplicated
  9980. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  9981. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  9982. The separation of the field matching and the decimation is notably motivated by
  9983. the possibility of inserting a de-interlacing filter fallback between the two.
  9984. If the source has mixed telecined and real interlaced content,
  9985. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  9986. But these remaining combed frames will be marked as interlaced, and thus can be
  9987. de-interlaced by a later filter such as @ref{yadif} before decimation.
  9988. In addition to the various configuration options, @code{fieldmatch} can take an
  9989. optional second stream, activated through the @option{ppsrc} option. If
  9990. enabled, the frames reconstruction will be based on the fields and frames from
  9991. this second stream. This allows the first input to be pre-processed in order to
  9992. help the various algorithms of the filter, while keeping the output lossless
  9993. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  9994. or brightness/contrast adjustments can help.
  9995. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  9996. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  9997. which @code{fieldmatch} is based on. While the semantic and usage are very
  9998. close, some behaviour and options names can differ.
  9999. The @ref{decimate} filter currently only works for constant frame rate input.
  10000. If your input has mixed telecined (30fps) and progressive content with a lower
  10001. framerate like 24fps use the following filterchain to produce the necessary cfr
  10002. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  10003. The filter accepts the following options:
  10004. @table @option
  10005. @item order
  10006. Specify the assumed field order of the input stream. Available values are:
  10007. @table @samp
  10008. @item auto
  10009. Auto detect parity (use FFmpeg's internal parity value).
  10010. @item bff
  10011. Assume bottom field first.
  10012. @item tff
  10013. Assume top field first.
  10014. @end table
  10015. Note that it is sometimes recommended not to trust the parity announced by the
  10016. stream.
  10017. Default value is @var{auto}.
  10018. @item mode
  10019. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  10020. sense that it won't risk creating jerkiness due to duplicate frames when
  10021. possible, but if there are bad edits or blended fields it will end up
  10022. outputting combed frames when a good match might actually exist. On the other
  10023. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  10024. but will almost always find a good frame if there is one. The other values are
  10025. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  10026. jerkiness and creating duplicate frames versus finding good matches in sections
  10027. with bad edits, orphaned fields, blended fields, etc.
  10028. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  10029. Available values are:
  10030. @table @samp
  10031. @item pc
  10032. 2-way matching (p/c)
  10033. @item pc_n
  10034. 2-way matching, and trying 3rd match if still combed (p/c + n)
  10035. @item pc_u
  10036. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  10037. @item pc_n_ub
  10038. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  10039. still combed (p/c + n + u/b)
  10040. @item pcn
  10041. 3-way matching (p/c/n)
  10042. @item pcn_ub
  10043. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  10044. detected as combed (p/c/n + u/b)
  10045. @end table
  10046. The parenthesis at the end indicate the matches that would be used for that
  10047. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  10048. @var{top}).
  10049. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  10050. the slowest.
  10051. Default value is @var{pc_n}.
  10052. @item ppsrc
  10053. Mark the main input stream as a pre-processed input, and enable the secondary
  10054. input stream as the clean source to pick the fields from. See the filter
  10055. introduction for more details. It is similar to the @option{clip2} feature from
  10056. VFM/TFM.
  10057. Default value is @code{0} (disabled).
  10058. @item field
  10059. Set the field to match from. It is recommended to set this to the same value as
  10060. @option{order} unless you experience matching failures with that setting. In
  10061. certain circumstances changing the field that is used to match from can have a
  10062. large impact on matching performance. Available values are:
  10063. @table @samp
  10064. @item auto
  10065. Automatic (same value as @option{order}).
  10066. @item bottom
  10067. Match from the bottom field.
  10068. @item top
  10069. Match from the top field.
  10070. @end table
  10071. Default value is @var{auto}.
  10072. @item mchroma
  10073. Set whether or not chroma is included during the match comparisons. In most
  10074. cases it is recommended to leave this enabled. You should set this to @code{0}
  10075. only if your clip has bad chroma problems such as heavy rainbowing or other
  10076. artifacts. Setting this to @code{0} could also be used to speed things up at
  10077. the cost of some accuracy.
  10078. Default value is @code{1}.
  10079. @item y0
  10080. @item y1
  10081. These define an exclusion band which excludes the lines between @option{y0} and
  10082. @option{y1} from being included in the field matching decision. An exclusion
  10083. band can be used to ignore subtitles, a logo, or other things that may
  10084. interfere with the matching. @option{y0} sets the starting scan line and
  10085. @option{y1} sets the ending line; all lines in between @option{y0} and
  10086. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  10087. @option{y0} and @option{y1} to the same value will disable the feature.
  10088. @option{y0} and @option{y1} defaults to @code{0}.
  10089. @item scthresh
  10090. Set the scene change detection threshold as a percentage of maximum change on
  10091. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  10092. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  10093. @option{scthresh} is @code{[0.0, 100.0]}.
  10094. Default value is @code{12.0}.
  10095. @item combmatch
  10096. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  10097. account the combed scores of matches when deciding what match to use as the
  10098. final match. Available values are:
  10099. @table @samp
  10100. @item none
  10101. No final matching based on combed scores.
  10102. @item sc
  10103. Combed scores are only used when a scene change is detected.
  10104. @item full
  10105. Use combed scores all the time.
  10106. @end table
  10107. Default is @var{sc}.
  10108. @item combdbg
  10109. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  10110. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  10111. Available values are:
  10112. @table @samp
  10113. @item none
  10114. No forced calculation.
  10115. @item pcn
  10116. Force p/c/n calculations.
  10117. @item pcnub
  10118. Force p/c/n/u/b calculations.
  10119. @end table
  10120. Default value is @var{none}.
  10121. @item cthresh
  10122. This is the area combing threshold used for combed frame detection. This
  10123. essentially controls how "strong" or "visible" combing must be to be detected.
  10124. Larger values mean combing must be more visible and smaller values mean combing
  10125. can be less visible or strong and still be detected. Valid settings are from
  10126. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  10127. be detected as combed). This is basically a pixel difference value. A good
  10128. range is @code{[8, 12]}.
  10129. Default value is @code{9}.
  10130. @item chroma
  10131. Sets whether or not chroma is considered in the combed frame decision. Only
  10132. disable this if your source has chroma problems (rainbowing, etc.) that are
  10133. causing problems for the combed frame detection with chroma enabled. Actually,
  10134. using @option{chroma}=@var{0} is usually more reliable, except for the case
  10135. where there is chroma only combing in the source.
  10136. Default value is @code{0}.
  10137. @item blockx
  10138. @item blocky
  10139. Respectively set the x-axis and y-axis size of the window used during combed
  10140. frame detection. This has to do with the size of the area in which
  10141. @option{combpel} pixels are required to be detected as combed for a frame to be
  10142. declared combed. See the @option{combpel} parameter description for more info.
  10143. Possible values are any number that is a power of 2 starting at 4 and going up
  10144. to 512.
  10145. Default value is @code{16}.
  10146. @item combpel
  10147. The number of combed pixels inside any of the @option{blocky} by
  10148. @option{blockx} size blocks on the frame for the frame to be detected as
  10149. combed. While @option{cthresh} controls how "visible" the combing must be, this
  10150. setting controls "how much" combing there must be in any localized area (a
  10151. window defined by the @option{blockx} and @option{blocky} settings) on the
  10152. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  10153. which point no frames will ever be detected as combed). This setting is known
  10154. as @option{MI} in TFM/VFM vocabulary.
  10155. Default value is @code{80}.
  10156. @end table
  10157. @anchor{p/c/n/u/b meaning}
  10158. @subsection p/c/n/u/b meaning
  10159. @subsubsection p/c/n
  10160. We assume the following telecined stream:
  10161. @example
  10162. Top fields: 1 2 2 3 4
  10163. Bottom fields: 1 2 3 4 4
  10164. @end example
  10165. The numbers correspond to the progressive frame the fields relate to. Here, the
  10166. first two frames are progressive, the 3rd and 4th are combed, and so on.
  10167. When @code{fieldmatch} is configured to run a matching from bottom
  10168. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  10169. @example
  10170. Input stream:
  10171. T 1 2 2 3 4
  10172. B 1 2 3 4 4 <-- matching reference
  10173. Matches: c c n n c
  10174. Output stream:
  10175. T 1 2 3 4 4
  10176. B 1 2 3 4 4
  10177. @end example
  10178. As a result of the field matching, we can see that some frames get duplicated.
  10179. To perform a complete inverse telecine, you need to rely on a decimation filter
  10180. after this operation. See for instance the @ref{decimate} filter.
  10181. The same operation now matching from top fields (@option{field}=@var{top})
  10182. looks like this:
  10183. @example
  10184. Input stream:
  10185. T 1 2 2 3 4 <-- matching reference
  10186. B 1 2 3 4 4
  10187. Matches: c c p p c
  10188. Output stream:
  10189. T 1 2 2 3 4
  10190. B 1 2 2 3 4
  10191. @end example
  10192. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  10193. basically, they refer to the frame and field of the opposite parity:
  10194. @itemize
  10195. @item @var{p} matches the field of the opposite parity in the previous frame
  10196. @item @var{c} matches the field of the opposite parity in the current frame
  10197. @item @var{n} matches the field of the opposite parity in the next frame
  10198. @end itemize
  10199. @subsubsection u/b
  10200. The @var{u} and @var{b} matching are a bit special in the sense that they match
  10201. from the opposite parity flag. In the following examples, we assume that we are
  10202. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  10203. 'x' is placed above and below each matched fields.
  10204. With bottom matching (@option{field}=@var{bottom}):
  10205. @example
  10206. Match: c p n b u
  10207. x x x x x
  10208. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10209. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10210. x x x x x
  10211. Output frames:
  10212. 2 1 2 2 2
  10213. 2 2 2 1 3
  10214. @end example
  10215. With top matching (@option{field}=@var{top}):
  10216. @example
  10217. Match: c p n b u
  10218. x x x x x
  10219. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10220. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10221. x x x x x
  10222. Output frames:
  10223. 2 2 2 1 2
  10224. 2 1 3 2 2
  10225. @end example
  10226. @subsection Examples
  10227. Simple IVTC of a top field first telecined stream:
  10228. @example
  10229. fieldmatch=order=tff:combmatch=none, decimate
  10230. @end example
  10231. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  10232. @example
  10233. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  10234. @end example
  10235. @section fieldorder
  10236. Transform the field order of the input video.
  10237. It accepts the following parameters:
  10238. @table @option
  10239. @item order
  10240. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  10241. for bottom field first.
  10242. @end table
  10243. The default value is @samp{tff}.
  10244. The transformation is done by shifting the picture content up or down
  10245. by one line, and filling the remaining line with appropriate picture content.
  10246. This method is consistent with most broadcast field order converters.
  10247. If the input video is not flagged as being interlaced, or it is already
  10248. flagged as being of the required output field order, then this filter does
  10249. not alter the incoming video.
  10250. It is very useful when converting to or from PAL DV material,
  10251. which is bottom field first.
  10252. For example:
  10253. @example
  10254. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  10255. @end example
  10256. @section fifo, afifo
  10257. Buffer input images and send them when they are requested.
  10258. It is mainly useful when auto-inserted by the libavfilter
  10259. framework.
  10260. It does not take parameters.
  10261. @section fillborders
  10262. Fill borders of the input video, without changing video stream dimensions.
  10263. Sometimes video can have garbage at the four edges and you may not want to
  10264. crop video input to keep size multiple of some number.
  10265. This filter accepts the following options:
  10266. @table @option
  10267. @item left
  10268. Number of pixels to fill from left border.
  10269. @item right
  10270. Number of pixels to fill from right border.
  10271. @item top
  10272. Number of pixels to fill from top border.
  10273. @item bottom
  10274. Number of pixels to fill from bottom border.
  10275. @item mode
  10276. Set fill mode.
  10277. It accepts the following values:
  10278. @table @samp
  10279. @item smear
  10280. fill pixels using outermost pixels
  10281. @item mirror
  10282. fill pixels using mirroring (half sample symmetric)
  10283. @item fixed
  10284. fill pixels with constant value
  10285. @item reflect
  10286. fill pixels using reflecting (whole sample symmetric)
  10287. @item wrap
  10288. fill pixels using wrapping
  10289. @item fade
  10290. fade pixels to constant value
  10291. @item margins
  10292. fill pixels at top and bottom with weighted averages pixels near borders
  10293. @end table
  10294. Default is @var{smear}.
  10295. @item color
  10296. Set color for pixels in fixed or fade mode. Default is @var{black}.
  10297. @end table
  10298. @subsection Commands
  10299. This filter supports same @ref{commands} as options.
  10300. The command accepts the same syntax of the corresponding option.
  10301. If the specified expression is not valid, it is kept at its current
  10302. value.
  10303. @section find_rect
  10304. Find a rectangular object
  10305. It accepts the following options:
  10306. @table @option
  10307. @item object
  10308. Filepath of the object image, needs to be in gray8.
  10309. @item threshold
  10310. Detection threshold, default is 0.5.
  10311. @item mipmaps
  10312. Number of mipmaps, default is 3.
  10313. @item xmin, ymin, xmax, ymax
  10314. Specifies the rectangle in which to search.
  10315. @item discard
  10316. Discard frames where object is not detected. Default is disabled.
  10317. @end table
  10318. @subsection Examples
  10319. @itemize
  10320. @item
  10321. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  10322. @example
  10323. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  10324. @end example
  10325. @end itemize
  10326. @section floodfill
  10327. Flood area with values of same pixel components with another values.
  10328. It accepts the following options:
  10329. @table @option
  10330. @item x
  10331. Set pixel x coordinate.
  10332. @item y
  10333. Set pixel y coordinate.
  10334. @item s0
  10335. Set source #0 component value.
  10336. @item s1
  10337. Set source #1 component value.
  10338. @item s2
  10339. Set source #2 component value.
  10340. @item s3
  10341. Set source #3 component value.
  10342. @item d0
  10343. Set destination #0 component value.
  10344. @item d1
  10345. Set destination #1 component value.
  10346. @item d2
  10347. Set destination #2 component value.
  10348. @item d3
  10349. Set destination #3 component value.
  10350. @end table
  10351. @anchor{format}
  10352. @section format
  10353. Convert the input video to one of the specified pixel formats.
  10354. Libavfilter will try to pick one that is suitable as input to
  10355. the next filter.
  10356. It accepts the following parameters:
  10357. @table @option
  10358. @item pix_fmts
  10359. A '|'-separated list of pixel format names, such as
  10360. "pix_fmts=yuv420p|monow|rgb24".
  10361. @end table
  10362. @subsection Examples
  10363. @itemize
  10364. @item
  10365. Convert the input video to the @var{yuv420p} format
  10366. @example
  10367. format=pix_fmts=yuv420p
  10368. @end example
  10369. Convert the input video to any of the formats in the list
  10370. @example
  10371. format=pix_fmts=yuv420p|yuv444p|yuv410p
  10372. @end example
  10373. @end itemize
  10374. @anchor{fps}
  10375. @section fps
  10376. Convert the video to specified constant frame rate by duplicating or dropping
  10377. frames as necessary.
  10378. It accepts the following parameters:
  10379. @table @option
  10380. @item fps
  10381. The desired output frame rate. It accepts expressions containing the following
  10382. constants:
  10383. @table @samp
  10384. @item source_fps
  10385. The input's frame rate
  10386. @item ntsc
  10387. NTSC frame rate of @code{30000/1001}
  10388. @item pal
  10389. PAL frame rate of @code{25.0}
  10390. @item film
  10391. Film frame rate of @code{24.0}
  10392. @item ntsc_film
  10393. NTSC-film frame rate of @code{24000/1001}
  10394. @end table
  10395. The default is @code{25}.
  10396. @item start_time
  10397. Assume the first PTS should be the given value, in seconds. This allows for
  10398. padding/trimming at the start of stream. By default, no assumption is made
  10399. about the first frame's expected PTS, so no padding or trimming is done.
  10400. For example, this could be set to 0 to pad the beginning with duplicates of
  10401. the first frame if a video stream starts after the audio stream or to trim any
  10402. frames with a negative PTS.
  10403. @item round
  10404. Timestamp (PTS) rounding method.
  10405. Possible values are:
  10406. @table @option
  10407. @item zero
  10408. round towards 0
  10409. @item inf
  10410. round away from 0
  10411. @item down
  10412. round towards -infinity
  10413. @item up
  10414. round towards +infinity
  10415. @item near
  10416. round to nearest
  10417. @end table
  10418. The default is @code{near}.
  10419. @item eof_action
  10420. Action performed when reading the last frame.
  10421. Possible values are:
  10422. @table @option
  10423. @item round
  10424. Use same timestamp rounding method as used for other frames.
  10425. @item pass
  10426. Pass through last frame if input duration has not been reached yet.
  10427. @end table
  10428. The default is @code{round}.
  10429. @end table
  10430. Alternatively, the options can be specified as a flat string:
  10431. @var{fps}[:@var{start_time}[:@var{round}]].
  10432. See also the @ref{setpts} filter.
  10433. @subsection Examples
  10434. @itemize
  10435. @item
  10436. A typical usage in order to set the fps to 25:
  10437. @example
  10438. fps=fps=25
  10439. @end example
  10440. @item
  10441. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  10442. @example
  10443. fps=fps=film:round=near
  10444. @end example
  10445. @end itemize
  10446. @section framepack
  10447. Pack two different video streams into a stereoscopic video, setting proper
  10448. metadata on supported codecs. The two views should have the same size and
  10449. framerate and processing will stop when the shorter video ends. Please note
  10450. that you may conveniently adjust view properties with the @ref{scale} and
  10451. @ref{fps} filters.
  10452. It accepts the following parameters:
  10453. @table @option
  10454. @item format
  10455. The desired packing format. Supported values are:
  10456. @table @option
  10457. @item sbs
  10458. The views are next to each other (default).
  10459. @item tab
  10460. The views are on top of each other.
  10461. @item lines
  10462. The views are packed by line.
  10463. @item columns
  10464. The views are packed by column.
  10465. @item frameseq
  10466. The views are temporally interleaved.
  10467. @end table
  10468. @end table
  10469. Some examples:
  10470. @example
  10471. # Convert left and right views into a frame-sequential video
  10472. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  10473. # Convert views into a side-by-side video with the same output resolution as the input
  10474. 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
  10475. @end example
  10476. @section framerate
  10477. Change the frame rate by interpolating new video output frames from the source
  10478. frames.
  10479. This filter is not designed to function correctly with interlaced media. If
  10480. you wish to change the frame rate of interlaced media then you are required
  10481. to deinterlace before this filter and re-interlace after this filter.
  10482. A description of the accepted options follows.
  10483. @table @option
  10484. @item fps
  10485. Specify the output frames per second. This option can also be specified
  10486. as a value alone. The default is @code{50}.
  10487. @item interp_start
  10488. Specify the start of a range where the output frame will be created as a
  10489. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10490. the default is @code{15}.
  10491. @item interp_end
  10492. Specify the end of a range where the output frame will be created as a
  10493. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10494. the default is @code{240}.
  10495. @item scene
  10496. Specify the level at which a scene change is detected as a value between
  10497. 0 and 100 to indicate a new scene; a low value reflects a low
  10498. probability for the current frame to introduce a new scene, while a higher
  10499. value means the current frame is more likely to be one.
  10500. The default is @code{8.2}.
  10501. @item flags
  10502. Specify flags influencing the filter process.
  10503. Available value for @var{flags} is:
  10504. @table @option
  10505. @item scene_change_detect, scd
  10506. Enable scene change detection using the value of the option @var{scene}.
  10507. This flag is enabled by default.
  10508. @end table
  10509. @end table
  10510. @section framestep
  10511. Select one frame every N-th frame.
  10512. This filter accepts the following option:
  10513. @table @option
  10514. @item step
  10515. Select frame after every @code{step} frames.
  10516. Allowed values are positive integers higher than 0. Default value is @code{1}.
  10517. @end table
  10518. @section freezedetect
  10519. Detect frozen video.
  10520. This filter logs a message and sets frame metadata when it detects that the
  10521. input video has no significant change in content during a specified duration.
  10522. Video freeze detection calculates the mean average absolute difference of all
  10523. the components of video frames and compares it to a noise floor.
  10524. The printed times and duration are expressed in seconds. The
  10525. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  10526. whose timestamp equals or exceeds the detection duration and it contains the
  10527. timestamp of the first frame of the freeze. The
  10528. @code{lavfi.freezedetect.freeze_duration} and
  10529. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  10530. after the freeze.
  10531. The filter accepts the following options:
  10532. @table @option
  10533. @item noise, n
  10534. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  10535. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  10536. 0.001.
  10537. @item duration, d
  10538. Set freeze duration until notification (default is 2 seconds).
  10539. @end table
  10540. @section freezeframes
  10541. Freeze video frames.
  10542. This filter freezes video frames using frame from 2nd input.
  10543. The filter accepts the following options:
  10544. @table @option
  10545. @item first
  10546. Set number of first frame from which to start freeze.
  10547. @item last
  10548. Set number of last frame from which to end freeze.
  10549. @item replace
  10550. Set number of frame from 2nd input which will be used instead of replaced frames.
  10551. @end table
  10552. @anchor{frei0r}
  10553. @section frei0r
  10554. Apply a frei0r effect to the input video.
  10555. To enable the compilation of this filter, you need to install the frei0r
  10556. header and configure FFmpeg with @code{--enable-frei0r}.
  10557. It accepts the following parameters:
  10558. @table @option
  10559. @item filter_name
  10560. The name of the frei0r effect to load. If the environment variable
  10561. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  10562. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  10563. Otherwise, the standard frei0r paths are searched, in this order:
  10564. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  10565. @file{/usr/lib/frei0r-1/}.
  10566. @item filter_params
  10567. A '|'-separated list of parameters to pass to the frei0r effect.
  10568. @end table
  10569. A frei0r effect parameter can be a boolean (its value is either
  10570. "y" or "n"), a double, a color (specified as
  10571. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  10572. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  10573. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  10574. a position (specified as @var{X}/@var{Y}, where
  10575. @var{X} and @var{Y} are floating point numbers) and/or a string.
  10576. The number and types of parameters depend on the loaded effect. If an
  10577. effect parameter is not specified, the default value is set.
  10578. @subsection Examples
  10579. @itemize
  10580. @item
  10581. Apply the distort0r effect, setting the first two double parameters:
  10582. @example
  10583. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  10584. @end example
  10585. @item
  10586. Apply the colordistance effect, taking a color as the first parameter:
  10587. @example
  10588. frei0r=colordistance:0.2/0.3/0.4
  10589. frei0r=colordistance:violet
  10590. frei0r=colordistance:0x112233
  10591. @end example
  10592. @item
  10593. Apply the perspective effect, specifying the top left and top right image
  10594. positions:
  10595. @example
  10596. frei0r=perspective:0.2/0.2|0.8/0.2
  10597. @end example
  10598. @end itemize
  10599. For more information, see
  10600. @url{http://frei0r.dyne.org}
  10601. @subsection Commands
  10602. This filter supports the @option{filter_params} option as @ref{commands}.
  10603. @section fspp
  10604. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  10605. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  10606. processing filter, one of them is performed once per block, not per pixel.
  10607. This allows for much higher speed.
  10608. The filter accepts the following options:
  10609. @table @option
  10610. @item quality
  10611. Set quality. This option defines the number of levels for averaging. It accepts
  10612. an integer in the range 4-5. Default value is @code{4}.
  10613. @item qp
  10614. Force a constant quantization parameter. It accepts an integer in range 0-63.
  10615. If not set, the filter will use the QP from the video stream (if available).
  10616. @item strength
  10617. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  10618. more details but also more artifacts, while higher values make the image smoother
  10619. but also blurrier. Default value is @code{0} − PSNR optimal.
  10620. @item use_bframe_qp
  10621. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10622. option may cause flicker since the B-Frames have often larger QP. Default is
  10623. @code{0} (not enabled).
  10624. @end table
  10625. @section gblur
  10626. Apply Gaussian blur filter.
  10627. The filter accepts the following options:
  10628. @table @option
  10629. @item sigma
  10630. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  10631. @item steps
  10632. Set number of steps for Gaussian approximation. Default is @code{1}.
  10633. @item planes
  10634. Set which planes to filter. By default all planes are filtered.
  10635. @item sigmaV
  10636. Set vertical sigma, if negative it will be same as @code{sigma}.
  10637. Default is @code{-1}.
  10638. @end table
  10639. @subsection Commands
  10640. This filter supports same commands as options.
  10641. The command accepts the same syntax of the corresponding option.
  10642. If the specified expression is not valid, it is kept at its current
  10643. value.
  10644. @section geq
  10645. Apply generic equation to each pixel.
  10646. The filter accepts the following options:
  10647. @table @option
  10648. @item lum_expr, lum
  10649. Set the luminance expression.
  10650. @item cb_expr, cb
  10651. Set the chrominance blue expression.
  10652. @item cr_expr, cr
  10653. Set the chrominance red expression.
  10654. @item alpha_expr, a
  10655. Set the alpha expression.
  10656. @item red_expr, r
  10657. Set the red expression.
  10658. @item green_expr, g
  10659. Set the green expression.
  10660. @item blue_expr, b
  10661. Set the blue expression.
  10662. @end table
  10663. The colorspace is selected according to the specified options. If one
  10664. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  10665. options is specified, the filter will automatically select a YCbCr
  10666. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  10667. @option{blue_expr} options is specified, it will select an RGB
  10668. colorspace.
  10669. If one of the chrominance expression is not defined, it falls back on the other
  10670. one. If no alpha expression is specified it will evaluate to opaque value.
  10671. If none of chrominance expressions are specified, they will evaluate
  10672. to the luminance expression.
  10673. The expressions can use the following variables and functions:
  10674. @table @option
  10675. @item N
  10676. The sequential number of the filtered frame, starting from @code{0}.
  10677. @item X
  10678. @item Y
  10679. The coordinates of the current sample.
  10680. @item W
  10681. @item H
  10682. The width and height of the image.
  10683. @item SW
  10684. @item SH
  10685. Width and height scale depending on the currently filtered plane. It is the
  10686. ratio between the corresponding luma plane number of pixels and the current
  10687. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  10688. @code{0.5,0.5} for chroma planes.
  10689. @item T
  10690. Time of the current frame, expressed in seconds.
  10691. @item p(x, y)
  10692. Return the value of the pixel at location (@var{x},@var{y}) of the current
  10693. plane.
  10694. @item lum(x, y)
  10695. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  10696. plane.
  10697. @item cb(x, y)
  10698. Return the value of the pixel at location (@var{x},@var{y}) of the
  10699. blue-difference chroma plane. Return 0 if there is no such plane.
  10700. @item cr(x, y)
  10701. Return the value of the pixel at location (@var{x},@var{y}) of the
  10702. red-difference chroma plane. Return 0 if there is no such plane.
  10703. @item r(x, y)
  10704. @item g(x, y)
  10705. @item b(x, y)
  10706. Return the value of the pixel at location (@var{x},@var{y}) of the
  10707. red/green/blue component. Return 0 if there is no such component.
  10708. @item alpha(x, y)
  10709. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  10710. plane. Return 0 if there is no such plane.
  10711. @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)
  10712. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  10713. sums of samples within a rectangle. See the functions without the sum postfix.
  10714. @item interpolation
  10715. Set one of interpolation methods:
  10716. @table @option
  10717. @item nearest, n
  10718. @item bilinear, b
  10719. @end table
  10720. Default is bilinear.
  10721. @end table
  10722. For functions, if @var{x} and @var{y} are outside the area, the value will be
  10723. automatically clipped to the closer edge.
  10724. Please note that this filter can use multiple threads in which case each slice
  10725. will have its own expression state. If you want to use only a single expression
  10726. state because your expressions depend on previous state then you should limit
  10727. the number of filter threads to 1.
  10728. @subsection Examples
  10729. @itemize
  10730. @item
  10731. Flip the image horizontally:
  10732. @example
  10733. geq=p(W-X\,Y)
  10734. @end example
  10735. @item
  10736. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  10737. wavelength of 100 pixels:
  10738. @example
  10739. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  10740. @end example
  10741. @item
  10742. Generate a fancy enigmatic moving light:
  10743. @example
  10744. 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
  10745. @end example
  10746. @item
  10747. Generate a quick emboss effect:
  10748. @example
  10749. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  10750. @end example
  10751. @item
  10752. Modify RGB components depending on pixel position:
  10753. @example
  10754. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  10755. @end example
  10756. @item
  10757. Create a radial gradient that is the same size as the input (also see
  10758. the @ref{vignette} filter):
  10759. @example
  10760. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  10761. @end example
  10762. @end itemize
  10763. @section gradfun
  10764. Fix the banding artifacts that are sometimes introduced into nearly flat
  10765. regions by truncation to 8-bit color depth.
  10766. Interpolate the gradients that should go where the bands are, and
  10767. dither them.
  10768. It is designed for playback only. Do not use it prior to
  10769. lossy compression, because compression tends to lose the dither and
  10770. bring back the bands.
  10771. It accepts the following parameters:
  10772. @table @option
  10773. @item strength
  10774. The maximum amount by which the filter will change any one pixel. This is also
  10775. the threshold for detecting nearly flat regions. Acceptable values range from
  10776. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  10777. valid range.
  10778. @item radius
  10779. The neighborhood to fit the gradient to. A larger radius makes for smoother
  10780. gradients, but also prevents the filter from modifying the pixels near detailed
  10781. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  10782. values will be clipped to the valid range.
  10783. @end table
  10784. Alternatively, the options can be specified as a flat string:
  10785. @var{strength}[:@var{radius}]
  10786. @subsection Examples
  10787. @itemize
  10788. @item
  10789. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  10790. @example
  10791. gradfun=3.5:8
  10792. @end example
  10793. @item
  10794. Specify radius, omitting the strength (which will fall-back to the default
  10795. value):
  10796. @example
  10797. gradfun=radius=8
  10798. @end example
  10799. @end itemize
  10800. @anchor{graphmonitor}
  10801. @section graphmonitor
  10802. Show various filtergraph stats.
  10803. With this filter one can debug complete filtergraph.
  10804. Especially issues with links filling with queued frames.
  10805. The filter accepts the following options:
  10806. @table @option
  10807. @item size, s
  10808. Set video output size. Default is @var{hd720}.
  10809. @item opacity, o
  10810. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  10811. @item mode, m
  10812. Set output mode, can be @var{fulll} or @var{compact}.
  10813. In @var{compact} mode only filters with some queued frames have displayed stats.
  10814. @item flags, f
  10815. Set flags which enable which stats are shown in video.
  10816. Available values for flags are:
  10817. @table @samp
  10818. @item queue
  10819. Display number of queued frames in each link.
  10820. @item frame_count_in
  10821. Display number of frames taken from filter.
  10822. @item frame_count_out
  10823. Display number of frames given out from filter.
  10824. @item frame_count_delta
  10825. Display delta number of frames between above two values.
  10826. @item pts
  10827. Display current filtered frame pts.
  10828. @item pts_delta
  10829. Display pts delta between current and previous frame.
  10830. @item time
  10831. Display current filtered frame time.
  10832. @item time_delta
  10833. Display time delta between current and previous frame.
  10834. @item timebase
  10835. Display time base for filter link.
  10836. @item format
  10837. Display used format for filter link.
  10838. @item size
  10839. Display video size or number of audio channels in case of audio used by filter link.
  10840. @item rate
  10841. Display video frame rate or sample rate in case of audio used by filter link.
  10842. @item eof
  10843. Display link output status.
  10844. @item sample_count_in
  10845. Display number of samples taken from filter.
  10846. @item sample_count_out
  10847. Display number of samples given out from filter.
  10848. @item sample_count_delta
  10849. Display delta number of samples between above two values.
  10850. @end table
  10851. @item rate, r
  10852. Set upper limit for video rate of output stream, Default value is @var{25}.
  10853. This guarantee that output video frame rate will not be higher than this value.
  10854. @end table
  10855. @section grayworld
  10856. A color constancy filter that applies color correction based on the grayworld assumption
  10857. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  10858. The algorithm uses linear light, so input
  10859. data should be linearized beforehand (and possibly correctly tagged).
  10860. @example
  10861. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  10862. @end example
  10863. @section greyedge
  10864. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  10865. and corrects the scene colors accordingly.
  10866. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  10867. The filter accepts the following options:
  10868. @table @option
  10869. @item difford
  10870. The order of differentiation to be applied on the scene. Must be chosen in the range
  10871. [0,2] and default value is 1.
  10872. @item minknorm
  10873. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  10874. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  10875. max value instead of calculating Minkowski distance.
  10876. @item sigma
  10877. The standard deviation of Gaussian blur to be applied on the scene. Must be
  10878. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  10879. can't be equal to 0 if @var{difford} is greater than 0.
  10880. @end table
  10881. @subsection Examples
  10882. @itemize
  10883. @item
  10884. Grey Edge:
  10885. @example
  10886. greyedge=difford=1:minknorm=5:sigma=2
  10887. @end example
  10888. @item
  10889. Max Edge:
  10890. @example
  10891. greyedge=difford=1:minknorm=0:sigma=2
  10892. @end example
  10893. @end itemize
  10894. @section guided
  10895. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  10896. The filter accepts the following options:
  10897. @table @option
  10898. @item radius
  10899. Set the box radius in pixels.
  10900. Allowed range is 1 to 20. Default is 3.
  10901. @item eps
  10902. Set regularization parameter (with square).
  10903. Allowed range is 0 to 1. Default is 0.01.
  10904. @item mode
  10905. Set filter mode. Can be @code{basic} or @code{fast}.
  10906. Default is @code{basic}.
  10907. @item sub
  10908. Set subsampling ratio for @code{fast} mode.
  10909. Range is 2 to 64. Default is 4.
  10910. No subsampling occurs in @code{basic} mode.
  10911. @item guidance
  10912. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  10913. If @code{off}, single input is required.
  10914. If @code{on}, two inputs of the same resolution and pixel format are required.
  10915. The second input serves as the guidance.
  10916. @item planes
  10917. Set planes to filter. Default is first only.
  10918. @end table
  10919. @subsection Commands
  10920. This filter supports the all above options as @ref{commands}.
  10921. @subsection Examples
  10922. @itemize
  10923. @item
  10924. Edge-preserving smoothing with guided filter:
  10925. @example
  10926. ffmpeg -i in.png -vf guided out.png
  10927. @end example
  10928. @item
  10929. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  10930. For the generation of guidance image, refer to paper "Guided Image Filtering".
  10931. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  10932. @example
  10933. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  10934. @end example
  10935. @end itemize
  10936. @anchor{haldclut}
  10937. @section haldclut
  10938. Apply a Hald CLUT to a video stream.
  10939. First input is the video stream to process, and second one is the Hald CLUT.
  10940. The Hald CLUT input can be a simple picture or a complete video stream.
  10941. The filter accepts the following options:
  10942. @table @option
  10943. @item clut
  10944. Set which CLUT video frames will be processed from second input stream,
  10945. can be @var{first} or @var{all}. Default is @var{all}.
  10946. @item shortest
  10947. Force termination when the shortest input terminates. Default is @code{0}.
  10948. @item repeatlast
  10949. Continue applying the last CLUT after the end of the stream. A value of
  10950. @code{0} disable the filter after the last frame of the CLUT is reached.
  10951. Default is @code{1}.
  10952. @end table
  10953. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  10954. filters share the same internals).
  10955. This filter also supports the @ref{framesync} options.
  10956. More information about the Hald CLUT can be found on Eskil Steenberg's website
  10957. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  10958. @subsection Commands
  10959. This filter supports the @code{interp} option as @ref{commands}.
  10960. @subsection Workflow examples
  10961. @subsubsection Hald CLUT video stream
  10962. Generate an identity Hald CLUT stream altered with various effects:
  10963. @example
  10964. 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
  10965. @end example
  10966. Note: make sure you use a lossless codec.
  10967. Then use it with @code{haldclut} to apply it on some random stream:
  10968. @example
  10969. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  10970. @end example
  10971. The Hald CLUT will be applied to the 10 first seconds (duration of
  10972. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  10973. to the remaining frames of the @code{mandelbrot} stream.
  10974. @subsubsection Hald CLUT with preview
  10975. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  10976. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  10977. biggest possible square starting at the top left of the picture. The remaining
  10978. padding pixels (bottom or right) will be ignored. This area can be used to add
  10979. a preview of the Hald CLUT.
  10980. Typically, the following generated Hald CLUT will be supported by the
  10981. @code{haldclut} filter:
  10982. @example
  10983. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  10984. pad=iw+320 [padded_clut];
  10985. smptebars=s=320x256, split [a][b];
  10986. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  10987. [main][b] overlay=W-320" -frames:v 1 clut.png
  10988. @end example
  10989. It contains the original and a preview of the effect of the CLUT: SMPTE color
  10990. bars are displayed on the right-top, and below the same color bars processed by
  10991. the color changes.
  10992. Then, the effect of this Hald CLUT can be visualized with:
  10993. @example
  10994. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  10995. @end example
  10996. @section hflip
  10997. Flip the input video horizontally.
  10998. For example, to horizontally flip the input video with @command{ffmpeg}:
  10999. @example
  11000. ffmpeg -i in.avi -vf "hflip" out.avi
  11001. @end example
  11002. @section histeq
  11003. This filter applies a global color histogram equalization on a
  11004. per-frame basis.
  11005. It can be used to correct video that has a compressed range of pixel
  11006. intensities. The filter redistributes the pixel intensities to
  11007. equalize their distribution across the intensity range. It may be
  11008. viewed as an "automatically adjusting contrast filter". This filter is
  11009. useful only for correcting degraded or poorly captured source
  11010. video.
  11011. The filter accepts the following options:
  11012. @table @option
  11013. @item strength
  11014. Determine the amount of equalization to be applied. As the strength
  11015. is reduced, the distribution of pixel intensities more-and-more
  11016. approaches that of the input frame. The value must be a float number
  11017. in the range [0,1] and defaults to 0.200.
  11018. @item intensity
  11019. Set the maximum intensity that can generated and scale the output
  11020. values appropriately. The strength should be set as desired and then
  11021. the intensity can be limited if needed to avoid washing-out. The value
  11022. must be a float number in the range [0,1] and defaults to 0.210.
  11023. @item antibanding
  11024. Set the antibanding level. If enabled the filter will randomly vary
  11025. the luminance of output pixels by a small amount to avoid banding of
  11026. the histogram. Possible values are @code{none}, @code{weak} or
  11027. @code{strong}. It defaults to @code{none}.
  11028. @end table
  11029. @anchor{histogram}
  11030. @section histogram
  11031. Compute and draw a color distribution histogram for the input video.
  11032. The computed histogram is a representation of the color component
  11033. distribution in an image.
  11034. Standard histogram displays the color components distribution in an image.
  11035. Displays color graph for each color component. Shows distribution of
  11036. the Y, U, V, A or R, G, B components, depending on input format, in the
  11037. current frame. Below each graph a color component scale meter is shown.
  11038. The filter accepts the following options:
  11039. @table @option
  11040. @item level_height
  11041. Set height of level. Default value is @code{200}.
  11042. Allowed range is [50, 2048].
  11043. @item scale_height
  11044. Set height of color scale. Default value is @code{12}.
  11045. Allowed range is [0, 40].
  11046. @item display_mode
  11047. Set display mode.
  11048. It accepts the following values:
  11049. @table @samp
  11050. @item stack
  11051. Per color component graphs are placed below each other.
  11052. @item parade
  11053. Per color component graphs are placed side by side.
  11054. @item overlay
  11055. Presents information identical to that in the @code{parade}, except
  11056. that the graphs representing color components are superimposed directly
  11057. over one another.
  11058. @end table
  11059. Default is @code{stack}.
  11060. @item levels_mode
  11061. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  11062. Default is @code{linear}.
  11063. @item components
  11064. Set what color components to display.
  11065. Default is @code{7}.
  11066. @item fgopacity
  11067. Set foreground opacity. Default is @code{0.7}.
  11068. @item bgopacity
  11069. Set background opacity. Default is @code{0.5}.
  11070. @item colors_mode
  11071. Set colors mode.
  11072. It accepts the following values:
  11073. @table @samp
  11074. @item whiteonblack
  11075. @item blackonwhite
  11076. @item whiteongray
  11077. @item blackongray
  11078. @item coloronblack
  11079. @item coloronwhite
  11080. @item colorongray
  11081. @item blackoncolor
  11082. @item whiteoncolor
  11083. @item grayoncolor
  11084. @end table
  11085. Default is @code{whiteonblack}.
  11086. @end table
  11087. @subsection Examples
  11088. @itemize
  11089. @item
  11090. Calculate and draw histogram:
  11091. @example
  11092. ffplay -i input -vf histogram
  11093. @end example
  11094. @end itemize
  11095. @anchor{hqdn3d}
  11096. @section hqdn3d
  11097. This is a high precision/quality 3d denoise filter. It aims to reduce
  11098. image noise, producing smooth images and making still images really
  11099. still. It should enhance compressibility.
  11100. It accepts the following optional parameters:
  11101. @table @option
  11102. @item luma_spatial
  11103. A non-negative floating point number which specifies spatial luma strength.
  11104. It defaults to 4.0.
  11105. @item chroma_spatial
  11106. A non-negative floating point number which specifies spatial chroma strength.
  11107. It defaults to 3.0*@var{luma_spatial}/4.0.
  11108. @item luma_tmp
  11109. A floating point number which specifies luma temporal strength. It defaults to
  11110. 6.0*@var{luma_spatial}/4.0.
  11111. @item chroma_tmp
  11112. A floating point number which specifies chroma temporal strength. It defaults to
  11113. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  11114. @end table
  11115. @subsection Commands
  11116. This filter supports same @ref{commands} as options.
  11117. The command accepts the same syntax of the corresponding option.
  11118. If the specified expression is not valid, it is kept at its current
  11119. value.
  11120. @anchor{hwdownload}
  11121. @section hwdownload
  11122. Download hardware frames to system memory.
  11123. The input must be in hardware frames, and the output a non-hardware format.
  11124. Not all formats will be supported on the output - it may be necessary to insert
  11125. an additional @option{format} filter immediately following in the graph to get
  11126. the output in a supported format.
  11127. @section hwmap
  11128. Map hardware frames to system memory or to another device.
  11129. This filter has several different modes of operation; which one is used depends
  11130. on the input and output formats:
  11131. @itemize
  11132. @item
  11133. Hardware frame input, normal frame output
  11134. Map the input frames to system memory and pass them to the output. If the
  11135. original hardware frame is later required (for example, after overlaying
  11136. something else on part of it), the @option{hwmap} filter can be used again
  11137. in the next mode to retrieve it.
  11138. @item
  11139. Normal frame input, hardware frame output
  11140. If the input is actually a software-mapped hardware frame, then unmap it -
  11141. that is, return the original hardware frame.
  11142. Otherwise, a device must be provided. Create new hardware surfaces on that
  11143. device for the output, then map them back to the software format at the input
  11144. and give those frames to the preceding filter. This will then act like the
  11145. @option{hwupload} filter, but may be able to avoid an additional copy when
  11146. the input is already in a compatible format.
  11147. @item
  11148. Hardware frame input and output
  11149. A device must be supplied for the output, either directly or with the
  11150. @option{derive_device} option. The input and output devices must be of
  11151. different types and compatible - the exact meaning of this is
  11152. system-dependent, but typically it means that they must refer to the same
  11153. underlying hardware context (for example, refer to the same graphics card).
  11154. If the input frames were originally created on the output device, then unmap
  11155. to retrieve the original frames.
  11156. Otherwise, map the frames to the output device - create new hardware frames
  11157. on the output corresponding to the frames on the input.
  11158. @end itemize
  11159. The following additional parameters are accepted:
  11160. @table @option
  11161. @item mode
  11162. Set the frame mapping mode. Some combination of:
  11163. @table @var
  11164. @item read
  11165. The mapped frame should be readable.
  11166. @item write
  11167. The mapped frame should be writeable.
  11168. @item overwrite
  11169. The mapping will always overwrite the entire frame.
  11170. This may improve performance in some cases, as the original contents of the
  11171. frame need not be loaded.
  11172. @item direct
  11173. The mapping must not involve any copying.
  11174. Indirect mappings to copies of frames are created in some cases where either
  11175. direct mapping is not possible or it would have unexpected properties.
  11176. Setting this flag ensures that the mapping is direct and will fail if that is
  11177. not possible.
  11178. @end table
  11179. Defaults to @var{read+write} if not specified.
  11180. @item derive_device @var{type}
  11181. Rather than using the device supplied at initialisation, instead derive a new
  11182. device of type @var{type} from the device the input frames exist on.
  11183. @item reverse
  11184. In a hardware to hardware mapping, map in reverse - create frames in the sink
  11185. and map them back to the source. This may be necessary in some cases where
  11186. a mapping in one direction is required but only the opposite direction is
  11187. supported by the devices being used.
  11188. This option is dangerous - it may break the preceding filter in undefined
  11189. ways if there are any additional constraints on that filter's output.
  11190. Do not use it without fully understanding the implications of its use.
  11191. @end table
  11192. @anchor{hwupload}
  11193. @section hwupload
  11194. Upload system memory frames to hardware surfaces.
  11195. The device to upload to must be supplied when the filter is initialised. If
  11196. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  11197. option or with the @option{derive_device} option. The input and output devices
  11198. must be of different types and compatible - the exact meaning of this is
  11199. system-dependent, but typically it means that they must refer to the same
  11200. underlying hardware context (for example, refer to the same graphics card).
  11201. The following additional parameters are accepted:
  11202. @table @option
  11203. @item derive_device @var{type}
  11204. Rather than using the device supplied at initialisation, instead derive a new
  11205. device of type @var{type} from the device the input frames exist on.
  11206. @end table
  11207. @anchor{hwupload_cuda}
  11208. @section hwupload_cuda
  11209. Upload system memory frames to a CUDA device.
  11210. It accepts the following optional parameters:
  11211. @table @option
  11212. @item device
  11213. The number of the CUDA device to use
  11214. @end table
  11215. @section hqx
  11216. Apply a high-quality magnification filter designed for pixel art. This filter
  11217. was originally created by Maxim Stepin.
  11218. It accepts the following option:
  11219. @table @option
  11220. @item n
  11221. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  11222. @code{hq3x} and @code{4} for @code{hq4x}.
  11223. Default is @code{3}.
  11224. @end table
  11225. @section hstack
  11226. Stack input videos horizontally.
  11227. All streams must be of same pixel format and of same height.
  11228. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11229. to create same output.
  11230. The filter accepts the following option:
  11231. @table @option
  11232. @item inputs
  11233. Set number of input streams. Default is 2.
  11234. @item shortest
  11235. If set to 1, force the output to terminate when the shortest input
  11236. terminates. Default value is 0.
  11237. @end table
  11238. @section hsvhold
  11239. Turns a certain HSV range into gray values.
  11240. This filter measures color difference between set HSV color in options
  11241. and ones measured in video stream. Depending on options, output
  11242. colors can be changed to be gray or not.
  11243. The filter accepts the following options:
  11244. @table @option
  11245. @item hue
  11246. Set the hue value which will be used in color difference calculation.
  11247. Allowed range is from -360 to 360. Default value is 0.
  11248. @item sat
  11249. Set the saturation value which will be used in color difference calculation.
  11250. Allowed range is from -1 to 1. Default value is 0.
  11251. @item val
  11252. Set the value which will be used in color difference calculation.
  11253. Allowed range is from -1 to 1. Default value is 0.
  11254. @item similarity
  11255. Set similarity percentage with the key color.
  11256. Allowed range is from 0 to 1. Default value is 0.01.
  11257. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11258. @item blend
  11259. Blend percentage.
  11260. Allowed range is from 0 to 1. Default value is 0.
  11261. 0.0 makes pixels either fully gray, or not gray at all.
  11262. Higher values result in more gray pixels, with a higher gray pixel
  11263. the more similar the pixels color is to the key color.
  11264. @end table
  11265. @section hsvkey
  11266. Turns a certain HSV range into transparency.
  11267. This filter measures color difference between set HSV color in options
  11268. and ones measured in video stream. Depending on options, output
  11269. colors can be changed to transparent by adding alpha channel.
  11270. The filter accepts the following options:
  11271. @table @option
  11272. @item hue
  11273. Set the hue value which will be used in color difference calculation.
  11274. Allowed range is from -360 to 360. Default value is 0.
  11275. @item sat
  11276. Set the saturation value which will be used in color difference calculation.
  11277. Allowed range is from -1 to 1. Default value is 0.
  11278. @item val
  11279. Set the value which will be used in color difference calculation.
  11280. Allowed range is from -1 to 1. Default value is 0.
  11281. @item similarity
  11282. Set similarity percentage with the key color.
  11283. Allowed range is from 0 to 1. Default value is 0.01.
  11284. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11285. @item blend
  11286. Blend percentage.
  11287. Allowed range is from 0 to 1. Default value is 0.
  11288. 0.0 makes pixels either fully transparent, or not transparent at all.
  11289. Higher values result in semi-transparent pixels, with a higher transparency
  11290. the more similar the pixels color is to the key color.
  11291. @end table
  11292. @section hue
  11293. Modify the hue and/or the saturation of the input.
  11294. It accepts the following parameters:
  11295. @table @option
  11296. @item h
  11297. Specify the hue angle as a number of degrees. It accepts an expression,
  11298. and defaults to "0".
  11299. @item s
  11300. Specify the saturation in the [-10,10] range. It accepts an expression and
  11301. defaults to "1".
  11302. @item H
  11303. Specify the hue angle as a number of radians. It accepts an
  11304. expression, and defaults to "0".
  11305. @item b
  11306. Specify the brightness in the [-10,10] range. It accepts an expression and
  11307. defaults to "0".
  11308. @end table
  11309. @option{h} and @option{H} are mutually exclusive, and can't be
  11310. specified at the same time.
  11311. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  11312. expressions containing the following constants:
  11313. @table @option
  11314. @item n
  11315. frame count of the input frame starting from 0
  11316. @item pts
  11317. presentation timestamp of the input frame expressed in time base units
  11318. @item r
  11319. frame rate of the input video, NAN if the input frame rate is unknown
  11320. @item t
  11321. timestamp expressed in seconds, NAN if the input timestamp is unknown
  11322. @item tb
  11323. time base of the input video
  11324. @end table
  11325. @subsection Examples
  11326. @itemize
  11327. @item
  11328. Set the hue to 90 degrees and the saturation to 1.0:
  11329. @example
  11330. hue=h=90:s=1
  11331. @end example
  11332. @item
  11333. Same command but expressing the hue in radians:
  11334. @example
  11335. hue=H=PI/2:s=1
  11336. @end example
  11337. @item
  11338. Rotate hue and make the saturation swing between 0
  11339. and 2 over a period of 1 second:
  11340. @example
  11341. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  11342. @end example
  11343. @item
  11344. Apply a 3 seconds saturation fade-in effect starting at 0:
  11345. @example
  11346. hue="s=min(t/3\,1)"
  11347. @end example
  11348. The general fade-in expression can be written as:
  11349. @example
  11350. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  11351. @end example
  11352. @item
  11353. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  11354. @example
  11355. hue="s=max(0\, min(1\, (8-t)/3))"
  11356. @end example
  11357. The general fade-out expression can be written as:
  11358. @example
  11359. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  11360. @end example
  11361. @end itemize
  11362. @subsection Commands
  11363. This filter supports the following commands:
  11364. @table @option
  11365. @item b
  11366. @item s
  11367. @item h
  11368. @item H
  11369. Modify the hue and/or the saturation and/or brightness of the input video.
  11370. The command accepts the same syntax of the corresponding option.
  11371. If the specified expression is not valid, it is kept at its current
  11372. value.
  11373. @end table
  11374. @section huesaturation
  11375. Apply hue-saturation-intensity adjustments to input video stream.
  11376. This filter operates in RGB colorspace.
  11377. This filter accepts the following options:
  11378. @table @option
  11379. @item hue
  11380. Set the hue shift in degrees to apply. Default is 0.
  11381. Allowed range is from -180 to 180.
  11382. @item saturation
  11383. Set the saturation shift. Default is 0.
  11384. Allowed range is from -1 to 1.
  11385. @item intensity
  11386. Set the intensity shift. Default is 0.
  11387. Allowed range is from -1 to 1.
  11388. @item colors
  11389. Set which primary and complementary colors are going to be adjusted.
  11390. This options is set by providing one or multiple values.
  11391. This can select multiple colors at once. By default all colors are selected.
  11392. @table @samp
  11393. @item r
  11394. Adjust reds.
  11395. @item y
  11396. Adjust yellows.
  11397. @item g
  11398. Adjust greens.
  11399. @item c
  11400. Adjust cyans.
  11401. @item b
  11402. Adjust blues.
  11403. @item m
  11404. Adjust magentas.
  11405. @item a
  11406. Adjust all colors.
  11407. @end table
  11408. @item strength
  11409. Set strength of filtering. Allowed range is from 0 to 100.
  11410. Default value is 1.
  11411. @item rw, gw, bw
  11412. Set weight for each RGB component. Allowed range is from 0 to 1.
  11413. By default is set to 0.333, 0.334, 0.333.
  11414. Those options are used in saturation and lightess processing.
  11415. @item lightness
  11416. Set preserving lightness, by default is disabled.
  11417. Adjusting hues can change lightness from original RGB triplet,
  11418. with this option enabled lightness is kept at same value.
  11419. @end table
  11420. @section hysteresis
  11421. Grow first stream into second stream by connecting components.
  11422. This makes it possible to build more robust edge masks.
  11423. This filter accepts the following options:
  11424. @table @option
  11425. @item planes
  11426. Set which planes will be processed as bitmap, unprocessed planes will be
  11427. copied from first stream.
  11428. By default value 0xf, all planes will be processed.
  11429. @item threshold
  11430. Set threshold which is used in filtering. If pixel component value is higher than
  11431. this value filter algorithm for connecting components is activated.
  11432. By default value is 0.
  11433. @end table
  11434. The @code{hysteresis} filter also supports the @ref{framesync} options.
  11435. @section iccdetect
  11436. Detect the colorspace from an embedded ICC profile (if present), and update
  11437. the frame's tags accordingly.
  11438. This filter accepts the following options:
  11439. @table @option
  11440. @item force
  11441. If true, the frame's existing colorspace tags will always be overridden by
  11442. values detected from an ICC profile. Otherwise, they will only be assigned if
  11443. they contain @code{unknown}. Enabled by default.
  11444. @end table
  11445. @section iccgen
  11446. Generate ICC profiles and attach them to frames.
  11447. This filter accepts the following options:
  11448. @table @option
  11449. @item color_primaries
  11450. @item color_trc
  11451. Configure the colorspace that the ICC profile will be generated for. The
  11452. default value of @code{auto} infers the value from the input frame's metadata,
  11453. defaulting to BT.709/sRGB as appropriate.
  11454. See the @ref{setparams} filter for a list of possible values, but note that
  11455. @code{unknown} are not valid values for this filter.
  11456. @item force
  11457. If true, an ICC profile will be generated even if it would overwrite an
  11458. already existing ICC profile. Disabled by default.
  11459. @end table
  11460. @section identity
  11461. Obtain the identity score between two input videos.
  11462. This filter takes two input videos.
  11463. Both input videos must have the same resolution and pixel format for
  11464. this filter to work correctly. Also it assumes that both inputs
  11465. have the same number of frames, which are compared one by one.
  11466. The obtained per component, average, min and max identity score is printed through
  11467. the logging system.
  11468. The filter stores the calculated identity scores of each frame in frame metadata.
  11469. In the below example the input file @file{main.mpg} being processed is compared
  11470. with the reference file @file{ref.mpg}.
  11471. @example
  11472. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  11473. @end example
  11474. @section idet
  11475. Detect video interlacing type.
  11476. This filter tries to detect if the input frames are interlaced, progressive,
  11477. top or bottom field first. It will also try to detect fields that are
  11478. repeated between adjacent frames (a sign of telecine).
  11479. Single frame detection considers only immediately adjacent frames when classifying each frame.
  11480. Multiple frame detection incorporates the classification history of previous frames.
  11481. The filter will log these metadata values:
  11482. @table @option
  11483. @item single.current_frame
  11484. Detected type of current frame using single-frame detection. One of:
  11485. ``tff'' (top field first), ``bff'' (bottom field first),
  11486. ``progressive'', or ``undetermined''
  11487. @item single.tff
  11488. Cumulative number of frames detected as top field first using single-frame detection.
  11489. @item multiple.tff
  11490. Cumulative number of frames detected as top field first using multiple-frame detection.
  11491. @item single.bff
  11492. Cumulative number of frames detected as bottom field first using single-frame detection.
  11493. @item multiple.current_frame
  11494. Detected type of current frame using multiple-frame detection. One of:
  11495. ``tff'' (top field first), ``bff'' (bottom field first),
  11496. ``progressive'', or ``undetermined''
  11497. @item multiple.bff
  11498. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  11499. @item single.progressive
  11500. Cumulative number of frames detected as progressive using single-frame detection.
  11501. @item multiple.progressive
  11502. Cumulative number of frames detected as progressive using multiple-frame detection.
  11503. @item single.undetermined
  11504. Cumulative number of frames that could not be classified using single-frame detection.
  11505. @item multiple.undetermined
  11506. Cumulative number of frames that could not be classified using multiple-frame detection.
  11507. @item repeated.current_frame
  11508. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  11509. @item repeated.neither
  11510. Cumulative number of frames with no repeated field.
  11511. @item repeated.top
  11512. Cumulative number of frames with the top field repeated from the previous frame's top field.
  11513. @item repeated.bottom
  11514. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  11515. @end table
  11516. The filter accepts the following options:
  11517. @table @option
  11518. @item intl_thres
  11519. Set interlacing threshold.
  11520. @item prog_thres
  11521. Set progressive threshold.
  11522. @item rep_thres
  11523. Threshold for repeated field detection.
  11524. @item half_life
  11525. Number of frames after which a given frame's contribution to the
  11526. statistics is halved (i.e., it contributes only 0.5 to its
  11527. classification). The default of 0 means that all frames seen are given
  11528. full weight of 1.0 forever.
  11529. @item analyze_interlaced_flag
  11530. When this is not 0 then idet will use the specified number of frames to determine
  11531. if the interlaced flag is accurate, it will not count undetermined frames.
  11532. If the flag is found to be accurate it will be used without any further
  11533. computations, if it is found to be inaccurate it will be cleared without any
  11534. further computations. This allows inserting the idet filter as a low computational
  11535. method to clean up the interlaced flag
  11536. @end table
  11537. @section il
  11538. Deinterleave or interleave fields.
  11539. This filter allows one to process interlaced images fields without
  11540. deinterlacing them. Deinterleaving splits the input frame into 2
  11541. fields (so called half pictures). Odd lines are moved to the top
  11542. half of the output image, even lines to the bottom half.
  11543. You can process (filter) them independently and then re-interleave them.
  11544. The filter accepts the following options:
  11545. @table @option
  11546. @item luma_mode, l
  11547. @item chroma_mode, c
  11548. @item alpha_mode, a
  11549. Available values for @var{luma_mode}, @var{chroma_mode} and
  11550. @var{alpha_mode} are:
  11551. @table @samp
  11552. @item none
  11553. Do nothing.
  11554. @item deinterleave, d
  11555. Deinterleave fields, placing one above the other.
  11556. @item interleave, i
  11557. Interleave fields. Reverse the effect of deinterleaving.
  11558. @end table
  11559. Default value is @code{none}.
  11560. @item luma_swap, ls
  11561. @item chroma_swap, cs
  11562. @item alpha_swap, as
  11563. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  11564. @end table
  11565. @subsection Commands
  11566. This filter supports the all above options as @ref{commands}.
  11567. @section inflate
  11568. Apply inflate effect to the video.
  11569. This filter replaces the pixel by the local(3x3) average by taking into account
  11570. only values higher than the pixel.
  11571. It accepts the following options:
  11572. @table @option
  11573. @item threshold0
  11574. @item threshold1
  11575. @item threshold2
  11576. @item threshold3
  11577. Limit the maximum change for each plane, default is 65535.
  11578. If 0, plane will remain unchanged.
  11579. @end table
  11580. @subsection Commands
  11581. This filter supports the all above options as @ref{commands}.
  11582. @section interlace
  11583. Simple interlacing filter from progressive contents. This interleaves upper (or
  11584. lower) lines from odd frames with lower (or upper) lines from even frames,
  11585. halving the frame rate and preserving image height.
  11586. @example
  11587. Original Original New Frame
  11588. Frame 'j' Frame 'j+1' (tff)
  11589. ========== =========== ==================
  11590. Line 0 --------------------> Frame 'j' Line 0
  11591. Line 1 Line 1 ----> Frame 'j+1' Line 1
  11592. Line 2 ---------------------> Frame 'j' Line 2
  11593. Line 3 Line 3 ----> Frame 'j+1' Line 3
  11594. ... ... ...
  11595. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  11596. @end example
  11597. It accepts the following optional parameters:
  11598. @table @option
  11599. @item scan
  11600. This determines whether the interlaced frame is taken from the even
  11601. (tff - default) or odd (bff) lines of the progressive frame.
  11602. @item lowpass
  11603. Vertical lowpass filter to avoid twitter interlacing and
  11604. reduce moire patterns.
  11605. @table @samp
  11606. @item 0, off
  11607. Disable vertical lowpass filter
  11608. @item 1, linear
  11609. Enable linear filter (default)
  11610. @item 2, complex
  11611. Enable complex filter. This will slightly less reduce twitter and moire
  11612. but better retain detail and subjective sharpness impression.
  11613. @end table
  11614. @end table
  11615. @section kerndeint
  11616. Deinterlace input video by applying Donald Graft's adaptive kernel
  11617. deinterling. Work on interlaced parts of a video to produce
  11618. progressive frames.
  11619. The description of the accepted parameters follows.
  11620. @table @option
  11621. @item thresh
  11622. Set the threshold which affects the filter's tolerance when
  11623. determining if a pixel line must be processed. It must be an integer
  11624. in the range [0,255] and defaults to 10. A value of 0 will result in
  11625. applying the process on every pixels.
  11626. @item map
  11627. Paint pixels exceeding the threshold value to white if set to 1.
  11628. Default is 0.
  11629. @item order
  11630. Set the fields order. Swap fields if set to 1, leave fields alone if
  11631. 0. Default is 0.
  11632. @item sharp
  11633. Enable additional sharpening if set to 1. Default is 0.
  11634. @item twoway
  11635. Enable twoway sharpening if set to 1. Default is 0.
  11636. @end table
  11637. @subsection Examples
  11638. @itemize
  11639. @item
  11640. Apply default values:
  11641. @example
  11642. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  11643. @end example
  11644. @item
  11645. Enable additional sharpening:
  11646. @example
  11647. kerndeint=sharp=1
  11648. @end example
  11649. @item
  11650. Paint processed pixels in white:
  11651. @example
  11652. kerndeint=map=1
  11653. @end example
  11654. @end itemize
  11655. @section kirsch
  11656. Apply kirsch operator to input video stream.
  11657. The filter accepts the following option:
  11658. @table @option
  11659. @item planes
  11660. Set which planes will be processed, unprocessed planes will be copied.
  11661. By default value 0xf, all planes will be processed.
  11662. @item scale
  11663. Set value which will be multiplied with filtered result.
  11664. @item delta
  11665. Set value which will be added to filtered result.
  11666. @end table
  11667. @subsection Commands
  11668. This filter supports the all above options as @ref{commands}.
  11669. @section lagfun
  11670. Slowly update darker pixels.
  11671. This filter makes short flashes of light appear longer.
  11672. This filter accepts the following options:
  11673. @table @option
  11674. @item decay
  11675. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  11676. @item planes
  11677. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  11678. @end table
  11679. @subsection Commands
  11680. This filter supports the all above options as @ref{commands}.
  11681. @section lenscorrection
  11682. Correct radial lens distortion
  11683. This filter can be used to correct for radial distortion as can result from the use
  11684. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  11685. one can use tools available for example as part of opencv or simply trial-and-error.
  11686. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  11687. and extract the k1 and k2 coefficients from the resulting matrix.
  11688. Note that effectively the same filter is available in the open-source tools Krita and
  11689. Digikam from the KDE project.
  11690. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  11691. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  11692. brightness distribution, so you may want to use both filters together in certain
  11693. cases, though you will have to take care of ordering, i.e. whether vignetting should
  11694. be applied before or after lens correction.
  11695. @subsection Options
  11696. The filter accepts the following options:
  11697. @table @option
  11698. @item cx
  11699. Relative x-coordinate of the focal point of the image, and thereby the center of the
  11700. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11701. width. Default is 0.5.
  11702. @item cy
  11703. Relative y-coordinate of the focal point of the image, and thereby the center of the
  11704. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11705. height. Default is 0.5.
  11706. @item k1
  11707. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  11708. no correction. Default is 0.
  11709. @item k2
  11710. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  11711. 0 means no correction. Default is 0.
  11712. @item i
  11713. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  11714. Default is @code{nearest}.
  11715. @item fc
  11716. Specify the color of the unmapped pixels. For the syntax of this option,
  11717. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11718. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  11719. @end table
  11720. The formula that generates the correction is:
  11721. @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)
  11722. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  11723. distances from the focal point in the source and target images, respectively.
  11724. @subsection Commands
  11725. This filter supports the all above options as @ref{commands}.
  11726. @section lensfun
  11727. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  11728. The @code{lensfun} filter requires the camera make, camera model, and lens model
  11729. to apply the lens correction. The filter will load the lensfun database and
  11730. query it to find the corresponding camera and lens entries in the database. As
  11731. long as these entries can be found with the given options, the filter can
  11732. perform corrections on frames. Note that incomplete strings will result in the
  11733. filter choosing the best match with the given options, and the filter will
  11734. output the chosen camera and lens models (logged with level "info"). You must
  11735. provide the make, camera model, and lens model as they are required.
  11736. To obtain a list of available makes and models, leave out one or both of @code{make} and
  11737. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  11738. The first column is the make and the second column is the model.
  11739. To obtain a list of available lenses, set any values for make and model and leave out the
  11740. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  11741. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  11742. The filter accepts the following options:
  11743. @table @option
  11744. @item make
  11745. The make of the camera (for example, "Canon"). This option is required.
  11746. @item model
  11747. The model of the camera (for example, "Canon EOS 100D"). This option is
  11748. required.
  11749. @item lens_model
  11750. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  11751. option is required.
  11752. @item db_path
  11753. The full path to the lens database folder. If not set, the filter will attempt to
  11754. load the database from the install path when the library was built. Default is unset.
  11755. @item mode
  11756. The type of correction to apply. The following values are valid options:
  11757. @table @samp
  11758. @item vignetting
  11759. Enables fixing lens vignetting.
  11760. @item geometry
  11761. Enables fixing lens geometry. This is the default.
  11762. @item subpixel
  11763. Enables fixing chromatic aberrations.
  11764. @item vig_geo
  11765. Enables fixing lens vignetting and lens geometry.
  11766. @item vig_subpixel
  11767. Enables fixing lens vignetting and chromatic aberrations.
  11768. @item distortion
  11769. Enables fixing both lens geometry and chromatic aberrations.
  11770. @item all
  11771. Enables all possible corrections.
  11772. @end table
  11773. @item focal_length
  11774. The focal length of the image/video (zoom; expected constant for video). For
  11775. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  11776. range should be chosen when using that lens. Default 18.
  11777. @item aperture
  11778. The aperture of the image/video (expected constant for video). Note that
  11779. aperture is only used for vignetting correction. Default 3.5.
  11780. @item focus_distance
  11781. The focus distance of the image/video (expected constant for video). Note that
  11782. focus distance is only used for vignetting and only slightly affects the
  11783. vignetting correction process. If unknown, leave it at the default value (which
  11784. is 1000).
  11785. @item scale
  11786. The scale factor which is applied after transformation. After correction the
  11787. video is no longer necessarily rectangular. This parameter controls how much of
  11788. the resulting image is visible. The value 0 means that a value will be chosen
  11789. automatically such that there is little or no unmapped area in the output
  11790. image. 1.0 means that no additional scaling is done. Lower values may result
  11791. in more of the corrected image being visible, while higher values may avoid
  11792. unmapped areas in the output.
  11793. @item target_geometry
  11794. The target geometry of the output image/video. The following values are valid
  11795. options:
  11796. @table @samp
  11797. @item rectilinear (default)
  11798. @item fisheye
  11799. @item panoramic
  11800. @item equirectangular
  11801. @item fisheye_orthographic
  11802. @item fisheye_stereographic
  11803. @item fisheye_equisolid
  11804. @item fisheye_thoby
  11805. @end table
  11806. @item reverse
  11807. Apply the reverse of image correction (instead of correcting distortion, apply
  11808. it).
  11809. @item interpolation
  11810. The type of interpolation used when correcting distortion. The following values
  11811. are valid options:
  11812. @table @samp
  11813. @item nearest
  11814. @item linear (default)
  11815. @item lanczos
  11816. @end table
  11817. @end table
  11818. @subsection Examples
  11819. @itemize
  11820. @item
  11821. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  11822. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  11823. aperture of "8.0".
  11824. @example
  11825. 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
  11826. @end example
  11827. @item
  11828. Apply the same as before, but only for the first 5 seconds of video.
  11829. @example
  11830. 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
  11831. @end example
  11832. @end itemize
  11833. @section libplacebo
  11834. Flexible GPU-accelerated processing filter based on libplacebo
  11835. (@url{https://code.videolan.org/videolan/libplacebo}). Note that this filter
  11836. currently only accepts Vulkan input frames.
  11837. @subsection Options
  11838. The options for this filter are divided into the following sections:
  11839. @subsubsection Output mode
  11840. These options control the overall output mode. By default, libplacebo will try
  11841. to preserve the source colorimetry and size as best as it can, but it will
  11842. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  11843. in source frames.
  11844. @table @option
  11845. @item w
  11846. @item h
  11847. Set the output video dimension expression. Default value is the input dimension.
  11848. Allows for the same expressions as the @ref{scale} filter.
  11849. @item format
  11850. Set the output format override. If unset (the default), frames will be output
  11851. in the same format as the respective input frames. Otherwise, format conversion
  11852. will be performed.
  11853. @item force_original_aspect_ratio
  11854. @item force_divisible_by
  11855. Work the same as the identical @ref{scale} filter options.
  11856. @item normalize_sar
  11857. If enabled (the default), output frames will always have a pixel aspect ratio
  11858. of 1:1. If disabled, any aspect ratio mismatches, including those from e.g.
  11859. anamorphic video sources, are forwarded to the output pixel aspect ratio.
  11860. @item pad_crop_ratio
  11861. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  11862. cropping when the input aspect ratio does not match the output aspect ratio and
  11863. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  11864. content with black borders, while a value of @code{1.0} always crops off parts
  11865. of the content. Intermediate values are possible, leading to a mix of the two
  11866. approaches.
  11867. @item colorspace
  11868. @item color_primaries
  11869. @item color_trc
  11870. @item range
  11871. Configure the colorspace that output frames will be delivered in. The default
  11872. value of @code{auto} outputs frames in the same format as the input frames,
  11873. leading to no change. For any other value, conversion will be performed.
  11874. See the @ref{setparams} filter for a list of possible values.
  11875. @item apply_filmgrain
  11876. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  11877. it from the output. Enabled by default.
  11878. @item apply_dolbyvision
  11879. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  11880. the output. Enabled by default. Note that Dolby Vision will always output
  11881. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  11882. picked as the values of @code{auto} for the respective frame output options.
  11883. @end table
  11884. @subsubsection Scaling
  11885. The options in this section control how libplacebo performs upscaling and (if
  11886. necessary) downscaling. Note that libplacebo will always internally operate on
  11887. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  11888. necessarily be upsampled and downsampled as part of the rendering process. That
  11889. means scaling might be in effect even if the source and destination resolution
  11890. are the same.
  11891. @table @option
  11892. @item upscaler
  11893. @item downscaler
  11894. Configure the filter kernel used for upscaling and downscaling. The respective
  11895. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  11896. values, pass @code{help} to these options. The most important values are:
  11897. @table @samp
  11898. @item none
  11899. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  11900. fast but poor quality, especially when downscaling.
  11901. @item bilinear
  11902. Bilinear interpolation. Can generally be done for free on GPUs, except when
  11903. doing so would lead to aliasing. Fast and low quality.
  11904. @item nearest
  11905. Nearest-neighbour interpolation. Sharp but highly aliasing.
  11906. @item oversample
  11907. Algorithm that looks visually similar to nearest-neighbour interpolation but
  11908. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  11909. minimal distortion of the artistic appearance.
  11910. @item lanczos
  11911. Standard sinc-sinc interpolation kernel.
  11912. @item spline36
  11913. Cubic spline approximation of lanczos. No difference in performance, but has
  11914. very slightly less ringing.
  11915. @item ewa_lanczos
  11916. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  11917. This is also popularly referred to as just "Jinc scaling". Slow but very high
  11918. quality.
  11919. @item gaussian
  11920. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  11921. very blurry.
  11922. @item mitchell
  11923. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  11924. little ringing.
  11925. @end table
  11926. @item lut_entries
  11927. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  11928. default of @code{0} will pick libplacebo's internal default, typically
  11929. @code{64}.
  11930. @item antiringing
  11931. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  11932. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  11933. aliasing if set too high. Disabled by default.
  11934. @item sigmoid
  11935. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  11936. Enabled by default.
  11937. @end table
  11938. @subsubsection Debanding
  11939. Libplacebo comes with a built-in debanding filter that is good at counteracting
  11940. many common sources of banding and blocking. Turning this on is highly
  11941. recommended whenever quality is desired.
  11942. @table @option
  11943. @item deband
  11944. Enable (fast) debanding algorithm. Disabled by default.
  11945. @item deband_iterations
  11946. Number of deband iterations of the debanding algorithm. Each iteration is
  11947. performed with progressively increased radius (and diminished threshold).
  11948. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  11949. @item deband_threshold
  11950. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  11951. Defaults to @code{4.0}.
  11952. @item deband_radius
  11953. Debanding filter radius. A higher radius is better for slow gradients, while
  11954. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  11955. @item deband_grain
  11956. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  11957. @code{6.0}.
  11958. @end table
  11959. @subsubsection Color adjustment
  11960. A collection of subjective color controls. Not very rigorous, so the exact
  11961. effect will vary somewhat depending on the input primaries and colorspace.
  11962. @table @option
  11963. @item brightness
  11964. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  11965. @item contrast
  11966. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11967. @item saturation
  11968. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11969. @item hue
  11970. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  11971. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  11972. coefficients for RGB inputs.
  11973. @item gamma
  11974. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11975. @item cones
  11976. Cone model to use for color blindness simulation. Accepts any combination of
  11977. @code{l}, @code{m} and @code{s}. Here are some examples:
  11978. @table @samp
  11979. @item m
  11980. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  11981. @item l
  11982. Protanomaly / protanopia (affecting 1%-2% of the population)
  11983. @item l+m
  11984. Monochromacy (very rare)
  11985. @item l+m+s
  11986. Achromatopsy (complete loss of daytime vision, extremely rare)
  11987. @end table
  11988. @item cone-strength
  11989. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  11990. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  11991. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  11992. above @code{1.0} result in exaggerating the differences between cones, which
  11993. may help compensate for reduced color vision.
  11994. @end table
  11995. @subsubsection Peak detection
  11996. To help deal with sources that only have static HDR10 metadata (or no tagging
  11997. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  11998. analyze source frames and adapt the tone mapping function in realtime. If this
  11999. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  12000. recommended to turn this feature off.
  12001. @table @option
  12002. @item peak_detect
  12003. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  12004. dynamic detection from the input. Note that the detected values do not get
  12005. written back to the output frames, they merely guide the internal tone mapping
  12006. process. Enabled by default.
  12007. @item smoothing_period
  12008. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  12009. values result in peak detection becoming less responsive to changes in the
  12010. input. Defaults to @code{100.0}.
  12011. @item minimum_peak
  12012. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  12013. and @code{100.0}. Defaults to @code{1.0}.
  12014. @item scene_threshold_low
  12015. @item scene_threshold_high
  12016. Lower and upper thresholds for scene change detection. Expressed in a
  12017. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  12018. and @code{10.0}, respectively. Setting either to a negative value disables
  12019. this functionality.
  12020. @item overshoot
  12021. Peak smoothing overshoot margin, between @code{0.0} and @code{1.0}. Provides a
  12022. safety margin to prevent clipping as a result of peak smoothing. Defaults to
  12023. @code{0.05}, corresponding to a margin of 5%.
  12024. @end table
  12025. @subsubsection Tone mapping
  12026. The options in this section control how libplacebo performs tone-mapping and
  12027. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  12028. In general, libplacebo relies on accurate source tagging and mastering display
  12029. gamut information to produce the best results.
  12030. @table @option
  12031. @item intent
  12032. Rendering intent to use when adapting between different primary color gamuts
  12033. (after tone-mapping).
  12034. @table @samp
  12035. @item perceptual
  12036. Perceptual gamut mapping. Currently equivalent to relative colorimetric.
  12037. @item relative
  12038. Relative colorimetric. This is the default.
  12039. @item absolute
  12040. Absolute colorimetric.
  12041. @item saturation
  12042. Saturation mapping. Forcibly stretches the source gamut to the target gamut.
  12043. @end table
  12044. @item gamut_mode
  12045. How to handle out-of-gamut colors that can occur as a result of colorimetric
  12046. gamut mapping.
  12047. @table @samp
  12048. @item clip
  12049. Do nothing, simply clip out-of-range colors to the RGB volume. This is the
  12050. default.
  12051. @item warn
  12052. Highlight out-of-gamut pixels (by coloring them pink).
  12053. @item darken
  12054. Linearly reduces content brightness to preserves saturated details, followed by
  12055. clipping the remaining out-of-gamut colors. As the name implies, this makes
  12056. everything darker, but provides a good balance between preserving details and
  12057. colors.
  12058. @item desaturate
  12059. Hard-desaturates out-of-gamut colors towards white, while preserving the
  12060. luminance. Has a tendency to shift colors.
  12061. @end table
  12062. @item tonemapping
  12063. Tone-mapping algorithm to use. Available values are:
  12064. @table @samp
  12065. @item auto
  12066. Automatic selection based on internal heuristics. This is the default.
  12067. @item clip
  12068. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  12069. accuracy for in-range colors but completely destroys out-of-range information.
  12070. Does not perform any black point adaptation. Not configurable.
  12071. @item bt.2390
  12072. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  12073. segment. The knee point offset is configurable. Note that this parameter
  12074. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  12075. spec.
  12076. @item bt.2446a
  12077. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  12078. sources. Can be used for both forward and inverse tone mapping. Not
  12079. configurable.
  12080. @item spline
  12081. Simple spline consisting of two polynomials, joined by a single pivot point.
  12082. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  12083. Can be used for both forward and inverse tone mapping.
  12084. @item reinhard
  12085. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  12086. local contrast coefficient at the display peak. Essentially, a parameter of
  12087. @code{0.5} implies that the reference white will be about half as bright as
  12088. when clipping. Defaults to @code{0.5}, which results in the simplest
  12089. formulation of this function.
  12090. @item mobius
  12091. Generalization of the reinhard tone mapping algorithm to support an additional
  12092. linear slope near black. The tone mapping parameter indicates the trade-off
  12093. between the linear section and the non-linear section. Essentially, for a given
  12094. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  12095. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  12096. this curve behave like @code{clip}, while values near @code{0.0} make this
  12097. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  12098. provides a good balance between colorimetric accuracy and preserving
  12099. out-of-gamut details.
  12100. @item hable
  12101. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  12102. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  12103. Popularized by its use in video games with HDR rendering. Preserves both dark
  12104. and bright details very well, but comes with the drawback of changing the
  12105. average brightness quite significantly. This is sort of similar to
  12106. @code{reinhard} with parameter @code{0.24}.
  12107. @item gamma
  12108. Fits a gamma (power) function to transfer between the source and target color
  12109. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  12110. linear sections. This preserves details at all scales fairly accurately, but
  12111. can result in an image with a muted or dull appearance. The parameter is used
  12112. as the cutoff point, defaulting to @code{0.5}.
  12113. @item linear
  12114. Linearly stretches the input range to the output range, in PQ space. This will
  12115. preserve all details accurately, but results in a significantly different
  12116. average brightness. Can be used for inverse tone-mapping in addition to regular
  12117. tone-mapping. The parameter can be used as an additional linear gain
  12118. coefficient (defaulting to @code{1.0}).
  12119. @end table
  12120. @item tonemapping_param
  12121. For tunable tone mapping functions, this parameter can be used to fine-tune the
  12122. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  12123. value of @code{0.0} is replaced by the curve's preferred default setting.
  12124. @item tonemapping_mode
  12125. This option determines how the tone mapping function specified by
  12126. @code{tonemapping} is applied to the colors in a scene. Possible values are:
  12127. @table @samp
  12128. @item auto
  12129. Automatic selection based on internal heuristics. This is the default.
  12130. @item rgb
  12131. Apply the function per-channel in the RGB colorspace.
  12132. Per-channel tone-mapping in RGB. Guarantees no clipping and heavily desaturates
  12133. the output, but distorts the colors quite significantly. Very similar to the
  12134. "Hollywood" look and feel.
  12135. @item max
  12136. Tone-mapping is performed on the brightest component found in the signal. Good
  12137. at preserving details in highlights, but has a tendency to crush blacks.
  12138. @item hybrid
  12139. Tone-map per-channel for highlights and linearly (luma-based) for
  12140. midtones/shadows, based on a fixed gamma @code{2.4} coefficient curve.
  12141. @item luma
  12142. Tone-map linearly on the luma component (CIE Y), and adjust (desaturate) the
  12143. chromaticities to compensate using a simple constant factor. This is
  12144. essentially the mode used in ITU-R BT.2446 method A.
  12145. @end table
  12146. @item inverse_tonemapping
  12147. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  12148. output color volumes. Disabled by default.
  12149. @item tonemapping_crosstalk
  12150. Extra tone-mapping crosstalk factor, between @code{0.0} and @code{0.3}. This
  12151. can help reduce issues tone-mapping certain bright spectral colors. Defaults to
  12152. @code{0.04}.
  12153. @item tonemapping_lut_size
  12154. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  12155. @code{256}. Note that this figure is squared when combined with
  12156. @code{peak_detect}.
  12157. @end table
  12158. @subsubsection Dithering
  12159. By default, libplacebo will dither whenever necessary, which includes rendering
  12160. to any integer format below 16-bit precision. It's recommended to always leave
  12161. this on, since not doing so may result in visible banding in the output, even
  12162. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12163. use @code{ordered_fixed} instead of disabling dithering.
  12164. @table @option
  12165. @item dithering
  12166. Dithering method to use. Accepts the following values:
  12167. @table @samp
  12168. @item none
  12169. Disables dithering completely. May result in visible banding.
  12170. @item blue
  12171. Dither with pseudo-blue noise. This is the default.
  12172. @item ordered
  12173. Tunable ordered dither pattern.
  12174. @item ordered_fixed
  12175. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12176. @item white
  12177. Dither with white noise. Texture-less.
  12178. @end table
  12179. @item dither_lut_size
  12180. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12181. @code{6}, corresponding to a LUT size of @code{64x64}.
  12182. @item dither_temporal
  12183. Enables temporal dithering. Disabled by default.
  12184. @end table
  12185. @subsubsection Custom shaders
  12186. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12187. syntax. A collection of such shaders can be found here:
  12188. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12189. A full description of the mpv shader format is beyond the scope of this
  12190. section, but a summary can be found here:
  12191. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12192. @table @option
  12193. @item custom_shader_path
  12194. Specifies a path to a custom shader file to load at runtime.
  12195. @item custom_shader_bin
  12196. Specifies a complete custom shader as a raw string.
  12197. @end table
  12198. @subsubsection Debugging / performance
  12199. All of the options in this section default off. They may be of assistance when
  12200. attempting to squeeze the maximum performance at the cost of quality.
  12201. @table @option
  12202. @item skip_aa
  12203. Disable anti-aliasing when downscaling.
  12204. @item polar_cutoff
  12205. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  12206. @code{0.0} and @code{1.0}.
  12207. @item disable_linear
  12208. Disable linear light scaling.
  12209. @item disable_builtin
  12210. Disable built-in GPU sampling (forces LUT).
  12211. @item force_icc_lut
  12212. Force the use of a full ICC 3DLUT for gamut mapping.
  12213. @item disable_fbos
  12214. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12215. offering the maximum possible speed.
  12216. @end table
  12217. @subsection Commands
  12218. This filter supports almost all of the above options as @ref{commands}.
  12219. @subsection Examples
  12220. @itemize
  12221. @item
  12222. Complete example for how to initialize the Vulkan device, upload frames to the
  12223. GPU, perform filter conversion to yuv420p, and download frames back to the CPU
  12224. for output. Note that in specific cases you can get around the need to perform
  12225. format conversion by specifying the correct @code{format} filter option
  12226. corresponding to the input frames.
  12227. @example
  12228. ffmpeg -i $INPUT -init_hw_device vulkan -vf hwupload,libplacebo=format=yuv420p,hwdownload,format=yuv420p $OUTPUT
  12229. @end example
  12230. @item
  12231. Tone-map input to standard gamut BT.709 output:
  12232. @example
  12233. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12234. @end example
  12235. @item
  12236. Rescale input to fit into standard 1080p, with high quality scaling:
  12237. @example
  12238. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12239. @end example
  12240. @item
  12241. Convert input to standard sRGB JPEG:
  12242. @example
  12243. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12244. @end example
  12245. @item
  12246. Use higher quality debanding settings:
  12247. @example
  12248. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  12249. @end example
  12250. @item
  12251. Run this filter on the CPU, on systems with Mesa installed (and with the most
  12252. expensive options disabled):
  12253. @example
  12254. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  12255. @end example
  12256. @item
  12257. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  12258. doing it with this filter. Note that this is only a gain if the frames are
  12259. either already on the GPU, or if you're using libplacebo for other purposes,
  12260. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  12261. @example
  12262. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  12263. @end example
  12264. @end itemize
  12265. @section libvmaf
  12266. Calulate the VMAF (Video Multi-Method Assessment Fusion) score for a
  12267. reference/distorted pair of input videos.
  12268. The first input is the distorted video, and the second input is the reference video.
  12269. The obtained VMAF score is printed through the logging system.
  12270. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12271. After installing the library it can be enabled using:
  12272. @code{./configure --enable-libvmaf}.
  12273. The filter has following options:
  12274. @table @option
  12275. @item model
  12276. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  12277. Default value: @code{"version=vmaf_v0.6.1"}
  12278. @item model_path
  12279. Deprecated, use model='path=...'.
  12280. @item enable_transform
  12281. Deprecated, use model='enable_transform=true'.
  12282. @item phone_model
  12283. Deprecated, use model='enable_transform=true'.
  12284. @item enable_conf_interval
  12285. Deprecated, use model='enable_conf_interval=true'.
  12286. @item feature
  12287. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  12288. @item psnr
  12289. Deprecated, use feature='name=psnr'.
  12290. @item ssim
  12291. Deprecated, use feature='name=ssim'.
  12292. @item ms_ssim
  12293. Deprecated, use feature='name=ms_ssim'.
  12294. @item log_path
  12295. Set the file path to be used to store log files.
  12296. @item log_fmt
  12297. Set the format of the log file (xml, json, csv, or sub).
  12298. @item n_threads
  12299. Set number of threads to be used when initializing libvmaf.
  12300. Default value: @code{0}, no threads.
  12301. @item n_subsample
  12302. Set frame subsampling interval to be used.
  12303. @end table
  12304. This filter also supports the @ref{framesync} options.
  12305. @subsection Examples
  12306. @itemize
  12307. @item
  12308. In the examples below, a distorted video @file{distorted.mpg} is
  12309. compared with a reference file @file{reference.mpg}.
  12310. @item
  12311. Basic usage:
  12312. @example
  12313. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  12314. @end example
  12315. @item
  12316. Example with multiple models:
  12317. @example
  12318. 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 -
  12319. @end example
  12320. @item
  12321. Example with multiple addtional features:
  12322. @example
  12323. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  12324. @end example
  12325. @item
  12326. Example with options and different containers:
  12327. @example
  12328. 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 -
  12329. @end example
  12330. @end itemize
  12331. @section limitdiff
  12332. Apply limited difference filter using second and optionally third video stream.
  12333. The filter accepts the following options:
  12334. @table @option
  12335. @item threshold
  12336. Set the threshold to use when allowing certain differences between video streams.
  12337. Any absolute difference value lower or exact than this threshold will pick pixel components from
  12338. first video stream.
  12339. @item elasticity
  12340. Set the elasticity of soft thresholding when processing video streams.
  12341. This value multiplied with first one sets second threshold.
  12342. Any absolute difference value greater or exact than second threshold will pick pixel components
  12343. from second video stream. For values between those two threshold
  12344. linear interpolation between first and second video stream will be used.
  12345. @item reference
  12346. Enable the reference (third) video stream processing. By default is disabled.
  12347. If set, this video stream will be used for calculating absolute difference with first video
  12348. stream.
  12349. @item planes
  12350. Specify which planes will be processed. Defaults to all available.
  12351. @end table
  12352. @subsection Commands
  12353. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  12354. @section limiter
  12355. Limits the pixel components values to the specified range [min, max].
  12356. The filter accepts the following options:
  12357. @table @option
  12358. @item min
  12359. Lower bound. Defaults to the lowest allowed value for the input.
  12360. @item max
  12361. Upper bound. Defaults to the highest allowed value for the input.
  12362. @item planes
  12363. Specify which planes will be processed. Defaults to all available.
  12364. @end table
  12365. @subsection Commands
  12366. This filter supports the all above options as @ref{commands}.
  12367. @section loop
  12368. Loop video frames.
  12369. The filter accepts the following options:
  12370. @table @option
  12371. @item loop
  12372. Set the number of loops. Setting this value to -1 will result in infinite loops.
  12373. Default is 0.
  12374. @item size
  12375. Set maximal size in number of frames. Default is 0.
  12376. @item start
  12377. Set first frame of loop. Default is 0.
  12378. @end table
  12379. @subsection Examples
  12380. @itemize
  12381. @item
  12382. Loop single first frame infinitely:
  12383. @example
  12384. loop=loop=-1:size=1:start=0
  12385. @end example
  12386. @item
  12387. Loop single first frame 10 times:
  12388. @example
  12389. loop=loop=10:size=1:start=0
  12390. @end example
  12391. @item
  12392. Loop 10 first frames 5 times:
  12393. @example
  12394. loop=loop=5:size=10:start=0
  12395. @end example
  12396. @end itemize
  12397. @section lut1d
  12398. Apply a 1D LUT to an input video.
  12399. The filter accepts the following options:
  12400. @table @option
  12401. @item file
  12402. Set the 1D LUT file name.
  12403. Currently supported formats:
  12404. @table @samp
  12405. @item cube
  12406. Iridas
  12407. @item csp
  12408. cineSpace
  12409. @end table
  12410. @item interp
  12411. Select interpolation mode.
  12412. Available values are:
  12413. @table @samp
  12414. @item nearest
  12415. Use values from the nearest defined point.
  12416. @item linear
  12417. Interpolate values using the linear interpolation.
  12418. @item cosine
  12419. Interpolate values using the cosine interpolation.
  12420. @item cubic
  12421. Interpolate values using the cubic interpolation.
  12422. @item spline
  12423. Interpolate values using the spline interpolation.
  12424. @end table
  12425. @end table
  12426. @subsection Commands
  12427. This filter supports the all above options as @ref{commands}.
  12428. @anchor{lut3d}
  12429. @section lut3d
  12430. Apply a 3D LUT to an input video.
  12431. The filter accepts the following options:
  12432. @table @option
  12433. @item file
  12434. Set the 3D LUT file name.
  12435. Currently supported formats:
  12436. @table @samp
  12437. @item 3dl
  12438. AfterEffects
  12439. @item cube
  12440. Iridas
  12441. @item dat
  12442. DaVinci
  12443. @item m3d
  12444. Pandora
  12445. @item csp
  12446. cineSpace
  12447. @end table
  12448. @item interp
  12449. Select interpolation mode.
  12450. Available values are:
  12451. @table @samp
  12452. @item nearest
  12453. Use values from the nearest defined point.
  12454. @item trilinear
  12455. Interpolate values using the 8 points defining a cube.
  12456. @item tetrahedral
  12457. Interpolate values using a tetrahedron.
  12458. @item pyramid
  12459. Interpolate values using a pyramid.
  12460. @item prism
  12461. Interpolate values using a prism.
  12462. @end table
  12463. @end table
  12464. @subsection Commands
  12465. This filter supports the @code{interp} option as @ref{commands}.
  12466. @section lumakey
  12467. Turn certain luma values into transparency.
  12468. The filter accepts the following options:
  12469. @table @option
  12470. @item threshold
  12471. Set the luma which will be used as base for transparency.
  12472. Default value is @code{0}.
  12473. @item tolerance
  12474. Set the range of luma values to be keyed out.
  12475. Default value is @code{0.01}.
  12476. @item softness
  12477. Set the range of softness. Default value is @code{0}.
  12478. Use this to control gradual transition from zero to full transparency.
  12479. @end table
  12480. @subsection Commands
  12481. This filter supports same @ref{commands} as options.
  12482. The command accepts the same syntax of the corresponding option.
  12483. If the specified expression is not valid, it is kept at its current
  12484. value.
  12485. @section lut, lutrgb, lutyuv
  12486. Compute a look-up table for binding each pixel component input value
  12487. to an output value, and apply it to the input video.
  12488. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  12489. to an RGB input video.
  12490. These filters accept the following parameters:
  12491. @table @option
  12492. @item c0
  12493. set first pixel component expression
  12494. @item c1
  12495. set second pixel component expression
  12496. @item c2
  12497. set third pixel component expression
  12498. @item c3
  12499. set fourth pixel component expression, corresponds to the alpha component
  12500. @item r
  12501. set red component expression
  12502. @item g
  12503. set green component expression
  12504. @item b
  12505. set blue component expression
  12506. @item a
  12507. alpha component expression
  12508. @item y
  12509. set Y/luminance component expression
  12510. @item u
  12511. set U/Cb component expression
  12512. @item v
  12513. set V/Cr component expression
  12514. @end table
  12515. Each of them specifies the expression to use for computing the lookup table for
  12516. the corresponding pixel component values.
  12517. The exact component associated to each of the @var{c*} options depends on the
  12518. format in input.
  12519. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  12520. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  12521. The expressions can contain the following constants and functions:
  12522. @table @option
  12523. @item w
  12524. @item h
  12525. The input width and height.
  12526. @item val
  12527. The input value for the pixel component.
  12528. @item clipval
  12529. The input value, clipped to the @var{minval}-@var{maxval} range.
  12530. @item maxval
  12531. The maximum value for the pixel component.
  12532. @item minval
  12533. The minimum value for the pixel component.
  12534. @item negval
  12535. The negated value for the pixel component value, clipped to the
  12536. @var{minval}-@var{maxval} range; it corresponds to the expression
  12537. "maxval-clipval+minval".
  12538. @item clip(val)
  12539. The computed value in @var{val}, clipped to the
  12540. @var{minval}-@var{maxval} range.
  12541. @item gammaval(gamma)
  12542. The computed gamma correction value of the pixel component value,
  12543. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  12544. expression
  12545. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  12546. @end table
  12547. All expressions default to "clipval".
  12548. @subsection Commands
  12549. This filter supports same @ref{commands} as options.
  12550. @subsection Examples
  12551. @itemize
  12552. @item
  12553. Negate input video:
  12554. @example
  12555. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  12556. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  12557. @end example
  12558. The above is the same as:
  12559. @example
  12560. lutrgb="r=negval:g=negval:b=negval"
  12561. lutyuv="y=negval:u=negval:v=negval"
  12562. @end example
  12563. @item
  12564. Negate luminance:
  12565. @example
  12566. lutyuv=y=negval
  12567. @end example
  12568. @item
  12569. Remove chroma components, turning the video into a graytone image:
  12570. @example
  12571. lutyuv="u=128:v=128"
  12572. @end example
  12573. @item
  12574. Apply a luma burning effect:
  12575. @example
  12576. lutyuv="y=2*val"
  12577. @end example
  12578. @item
  12579. Remove green and blue components:
  12580. @example
  12581. lutrgb="g=0:b=0"
  12582. @end example
  12583. @item
  12584. Set a constant alpha channel value on input:
  12585. @example
  12586. format=rgba,lutrgb=a="maxval-minval/2"
  12587. @end example
  12588. @item
  12589. Correct luminance gamma by a factor of 0.5:
  12590. @example
  12591. lutyuv=y=gammaval(0.5)
  12592. @end example
  12593. @item
  12594. Discard least significant bits of luma:
  12595. @example
  12596. lutyuv=y='bitand(val, 128+64+32)'
  12597. @end example
  12598. @item
  12599. Technicolor like effect:
  12600. @example
  12601. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  12602. @end example
  12603. @end itemize
  12604. @section lut2, tlut2
  12605. The @code{lut2} filter takes two input streams and outputs one
  12606. stream.
  12607. The @code{tlut2} (time lut2) filter takes two consecutive frames
  12608. from one single stream.
  12609. This filter accepts the following parameters:
  12610. @table @option
  12611. @item c0
  12612. set first pixel component expression
  12613. @item c1
  12614. set second pixel component expression
  12615. @item c2
  12616. set third pixel component expression
  12617. @item c3
  12618. set fourth pixel component expression, corresponds to the alpha component
  12619. @item d
  12620. set output bit depth, only available for @code{lut2} filter. By default is 0,
  12621. which means bit depth is automatically picked from first input format.
  12622. @end table
  12623. The @code{lut2} filter also supports the @ref{framesync} options.
  12624. Each of them specifies the expression to use for computing the lookup table for
  12625. the corresponding pixel component values.
  12626. The exact component associated to each of the @var{c*} options depends on the
  12627. format in inputs.
  12628. The expressions can contain the following constants:
  12629. @table @option
  12630. @item w
  12631. @item h
  12632. The input width and height.
  12633. @item x
  12634. The first input value for the pixel component.
  12635. @item y
  12636. The second input value for the pixel component.
  12637. @item bdx
  12638. The first input video bit depth.
  12639. @item bdy
  12640. The second input video bit depth.
  12641. @end table
  12642. All expressions default to "x".
  12643. @subsection Commands
  12644. This filter supports the all above options as @ref{commands} except option @code{d}.
  12645. @subsection Examples
  12646. @itemize
  12647. @item
  12648. Highlight differences between two RGB video streams:
  12649. @example
  12650. 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)'
  12651. @end example
  12652. @item
  12653. Highlight differences between two YUV video streams:
  12654. @example
  12655. 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)'
  12656. @end example
  12657. @item
  12658. Show max difference between two video streams:
  12659. @example
  12660. 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)))'
  12661. @end example
  12662. @end itemize
  12663. @section maskedclamp
  12664. Clamp the first input stream with the second input and third input stream.
  12665. Returns the value of first stream to be between second input
  12666. stream - @code{undershoot} and third input stream + @code{overshoot}.
  12667. This filter accepts the following options:
  12668. @table @option
  12669. @item undershoot
  12670. Default value is @code{0}.
  12671. @item overshoot
  12672. Default value is @code{0}.
  12673. @item planes
  12674. Set which planes will be processed as bitmap, unprocessed planes will be
  12675. copied from first stream.
  12676. By default value 0xf, all planes will be processed.
  12677. @end table
  12678. @subsection Commands
  12679. This filter supports the all above options as @ref{commands}.
  12680. @section maskedmax
  12681. Merge the second and third input stream into output stream using absolute differences
  12682. between second input stream and first input stream and absolute difference between
  12683. third input stream and first input stream. The picked value will be from second input
  12684. stream if second absolute difference is greater than first one or from third input stream
  12685. otherwise.
  12686. This filter accepts the following options:
  12687. @table @option
  12688. @item planes
  12689. Set which planes will be processed as bitmap, unprocessed planes will be
  12690. copied from first stream.
  12691. By default value 0xf, all planes will be processed.
  12692. @end table
  12693. @subsection Commands
  12694. This filter supports the all above options as @ref{commands}.
  12695. @section maskedmerge
  12696. Merge the first input stream with the second input stream using per pixel
  12697. weights in the third input stream.
  12698. A value of 0 in the third stream pixel component means that pixel component
  12699. from first stream is returned unchanged, while maximum value (eg. 255 for
  12700. 8-bit videos) means that pixel component from second stream is returned
  12701. unchanged. Intermediate values define the amount of merging between both
  12702. input stream's pixel components.
  12703. This filter accepts the following options:
  12704. @table @option
  12705. @item planes
  12706. Set which planes will be processed as bitmap, unprocessed planes will be
  12707. copied from first stream.
  12708. By default value 0xf, all planes will be processed.
  12709. @end table
  12710. @subsection Commands
  12711. This filter supports the all above options as @ref{commands}.
  12712. @section maskedmin
  12713. Merge the second and third input stream into output stream using absolute differences
  12714. between second input stream and first input stream and absolute difference between
  12715. third input stream and first input stream. The picked value will be from second input
  12716. stream if second absolute difference is less than first one or from third input stream
  12717. otherwise.
  12718. This filter accepts the following options:
  12719. @table @option
  12720. @item planes
  12721. Set which planes will be processed as bitmap, unprocessed planes will be
  12722. copied from first stream.
  12723. By default value 0xf, all planes will be processed.
  12724. @end table
  12725. @subsection Commands
  12726. This filter supports the all above options as @ref{commands}.
  12727. @section maskedthreshold
  12728. Pick pixels comparing absolute difference of two video streams with fixed
  12729. threshold.
  12730. If absolute difference between pixel component of first and second video
  12731. stream is equal or lower than user supplied threshold than pixel component
  12732. from first video stream is picked, otherwise pixel component from second
  12733. video stream is picked.
  12734. This filter accepts the following options:
  12735. @table @option
  12736. @item threshold
  12737. Set threshold used when picking pixels from absolute difference from two input
  12738. video streams.
  12739. @item planes
  12740. Set which planes will be processed as bitmap, unprocessed planes will be
  12741. copied from second stream.
  12742. By default value 0xf, all planes will be processed.
  12743. @item mode
  12744. Set mode of filter operation. Can be @code{abs} or @code{diff}.
  12745. Default is @code{abs}.
  12746. @end table
  12747. @subsection Commands
  12748. This filter supports the all above options as @ref{commands}.
  12749. @section maskfun
  12750. Create mask from input video.
  12751. For example it is useful to create motion masks after @code{tblend} filter.
  12752. This filter accepts the following options:
  12753. @table @option
  12754. @item low
  12755. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  12756. @item high
  12757. Set high threshold. Any pixel component higher than this value will be set to max value
  12758. allowed for current pixel format.
  12759. @item planes
  12760. Set planes to filter, by default all available planes are filtered.
  12761. @item fill
  12762. Fill all frame pixels with this value.
  12763. @item sum
  12764. Set max average pixel value for frame. If sum of all pixel components is higher that this
  12765. average, output frame will be completely filled with value set by @var{fill} option.
  12766. Typically useful for scene changes when used in combination with @code{tblend} filter.
  12767. @end table
  12768. @subsection Commands
  12769. This filter supports the all above options as @ref{commands}.
  12770. @section mcdeint
  12771. Apply motion-compensation deinterlacing.
  12772. It needs one field per frame as input and must thus be used together
  12773. with yadif=1/3 or equivalent.
  12774. This filter is only available in ffmpeg version 4.4 or earlier.
  12775. This filter accepts the following options:
  12776. @table @option
  12777. @item mode
  12778. Set the deinterlacing mode.
  12779. It accepts one of the following values:
  12780. @table @samp
  12781. @item fast
  12782. @item medium
  12783. @item slow
  12784. use iterative motion estimation
  12785. @item extra_slow
  12786. like @samp{slow}, but use multiple reference frames.
  12787. @end table
  12788. Default value is @samp{fast}.
  12789. @item parity
  12790. Set the picture field parity assumed for the input video. It must be
  12791. one of the following values:
  12792. @table @samp
  12793. @item 0, tff
  12794. assume top field first
  12795. @item 1, bff
  12796. assume bottom field first
  12797. @end table
  12798. Default value is @samp{bff}.
  12799. @item qp
  12800. Set per-block quantization parameter (QP) used by the internal
  12801. encoder.
  12802. Higher values should result in a smoother motion vector field but less
  12803. optimal individual vectors. Default value is 1.
  12804. @end table
  12805. @section median
  12806. Pick median pixel from certain rectangle defined by radius.
  12807. This filter accepts the following options:
  12808. @table @option
  12809. @item radius
  12810. Set horizontal radius size. Default value is @code{1}.
  12811. Allowed range is integer from 1 to 127.
  12812. @item planes
  12813. Set which planes to process. Default is @code{15}, which is all available planes.
  12814. @item radiusV
  12815. Set vertical radius size. Default value is @code{0}.
  12816. Allowed range is integer from 0 to 127.
  12817. If it is 0, value will be picked from horizontal @code{radius} option.
  12818. @item percentile
  12819. Set median percentile. Default value is @code{0.5}.
  12820. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  12821. minimum values, and @code{1} maximum values.
  12822. @end table
  12823. @subsection Commands
  12824. This filter supports same @ref{commands} as options.
  12825. The command accepts the same syntax of the corresponding option.
  12826. If the specified expression is not valid, it is kept at its current
  12827. value.
  12828. @section mergeplanes
  12829. Merge color channel components from several video streams.
  12830. The filter accepts up to 4 input streams, and merge selected input
  12831. planes to the output video.
  12832. This filter accepts the following options:
  12833. @table @option
  12834. @item mapping
  12835. Set input to output plane mapping. Default is @code{0}.
  12836. The mappings is specified as a bitmap. It should be specified as a
  12837. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  12838. mapping for the first plane of the output stream. 'A' sets the number of
  12839. the input stream to use (from 0 to 3), and 'a' the plane number of the
  12840. corresponding input to use (from 0 to 3). The rest of the mappings is
  12841. similar, 'Bb' describes the mapping for the output stream second
  12842. plane, 'Cc' describes the mapping for the output stream third plane and
  12843. 'Dd' describes the mapping for the output stream fourth plane.
  12844. @item format
  12845. Set output pixel format. Default is @code{yuva444p}.
  12846. @item map0s
  12847. @item map1s
  12848. @item map2s
  12849. @item map3s
  12850. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  12851. @item map0p
  12852. @item map1p
  12853. @item map2p
  12854. @item map3p
  12855. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  12856. @end table
  12857. @subsection Examples
  12858. @itemize
  12859. @item
  12860. Merge three gray video streams of same width and height into single video stream:
  12861. @example
  12862. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  12863. @end example
  12864. @item
  12865. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  12866. @example
  12867. [a0][a1]mergeplanes=0x00010210:yuva444p
  12868. @end example
  12869. @item
  12870. Swap Y and A plane in yuva444p stream:
  12871. @example
  12872. format=yuva444p,mergeplanes=0x03010200:yuva444p
  12873. @end example
  12874. @item
  12875. Swap U and V plane in yuv420p stream:
  12876. @example
  12877. format=yuv420p,mergeplanes=0x000201:yuv420p
  12878. @end example
  12879. @item
  12880. Cast a rgb24 clip to yuv444p:
  12881. @example
  12882. format=rgb24,mergeplanes=0x000102:yuv444p
  12883. @end example
  12884. @end itemize
  12885. @section mestimate
  12886. Estimate and export motion vectors using block matching algorithms.
  12887. Motion vectors are stored in frame side data to be used by other filters.
  12888. This filter accepts the following options:
  12889. @table @option
  12890. @item method
  12891. Specify the motion estimation method. Accepts one of the following values:
  12892. @table @samp
  12893. @item esa
  12894. Exhaustive search algorithm.
  12895. @item tss
  12896. Three step search algorithm.
  12897. @item tdls
  12898. Two dimensional logarithmic search algorithm.
  12899. @item ntss
  12900. New three step search algorithm.
  12901. @item fss
  12902. Four step search algorithm.
  12903. @item ds
  12904. Diamond search algorithm.
  12905. @item hexbs
  12906. Hexagon-based search algorithm.
  12907. @item epzs
  12908. Enhanced predictive zonal search algorithm.
  12909. @item umh
  12910. Uneven multi-hexagon search algorithm.
  12911. @end table
  12912. Default value is @samp{esa}.
  12913. @item mb_size
  12914. Macroblock size. Default @code{16}.
  12915. @item search_param
  12916. Search parameter. Default @code{7}.
  12917. @end table
  12918. @section midequalizer
  12919. Apply Midway Image Equalization effect using two video streams.
  12920. Midway Image Equalization adjusts a pair of images to have the same
  12921. histogram, while maintaining their dynamics as much as possible. It's
  12922. useful for e.g. matching exposures from a pair of stereo cameras.
  12923. This filter has two inputs and one output, which must be of same pixel format, but
  12924. may be of different sizes. The output of filter is first input adjusted with
  12925. midway histogram of both inputs.
  12926. This filter accepts the following option:
  12927. @table @option
  12928. @item planes
  12929. Set which planes to process. Default is @code{15}, which is all available planes.
  12930. @end table
  12931. @section minterpolate
  12932. Convert the video to specified frame rate using motion interpolation.
  12933. This filter accepts the following options:
  12934. @table @option
  12935. @item fps
  12936. 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}.
  12937. @item mi_mode
  12938. Motion interpolation mode. Following values are accepted:
  12939. @table @samp
  12940. @item dup
  12941. Duplicate previous or next frame for interpolating new ones.
  12942. @item blend
  12943. Blend source frames. Interpolated frame is mean of previous and next frames.
  12944. @item mci
  12945. Motion compensated interpolation. Following options are effective when this mode is selected:
  12946. @table @samp
  12947. @item mc_mode
  12948. Motion compensation mode. Following values are accepted:
  12949. @table @samp
  12950. @item obmc
  12951. Overlapped block motion compensation.
  12952. @item aobmc
  12953. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  12954. @end table
  12955. Default mode is @samp{obmc}.
  12956. @item me_mode
  12957. Motion estimation mode. Following values are accepted:
  12958. @table @samp
  12959. @item bidir
  12960. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  12961. @item bilat
  12962. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  12963. @end table
  12964. Default mode is @samp{bilat}.
  12965. @item me
  12966. The algorithm to be used for motion estimation. Following values are accepted:
  12967. @table @samp
  12968. @item esa
  12969. Exhaustive search algorithm.
  12970. @item tss
  12971. Three step search algorithm.
  12972. @item tdls
  12973. Two dimensional logarithmic search algorithm.
  12974. @item ntss
  12975. New three step search algorithm.
  12976. @item fss
  12977. Four step search algorithm.
  12978. @item ds
  12979. Diamond search algorithm.
  12980. @item hexbs
  12981. Hexagon-based search algorithm.
  12982. @item epzs
  12983. Enhanced predictive zonal search algorithm.
  12984. @item umh
  12985. Uneven multi-hexagon search algorithm.
  12986. @end table
  12987. Default algorithm is @samp{epzs}.
  12988. @item mb_size
  12989. Macroblock size. Default @code{16}.
  12990. @item search_param
  12991. Motion estimation search parameter. Default @code{32}.
  12992. @item vsbmc
  12993. 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).
  12994. @end table
  12995. @end table
  12996. @item scd
  12997. 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:
  12998. @table @samp
  12999. @item none
  13000. Disable scene change detection.
  13001. @item fdiff
  13002. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  13003. @end table
  13004. Default method is @samp{fdiff}.
  13005. @item scd_threshold
  13006. Scene change detection threshold. Default is @code{10.}.
  13007. @end table
  13008. @section mix
  13009. Mix several video input streams into one video stream.
  13010. A description of the accepted options follows.
  13011. @table @option
  13012. @item inputs
  13013. The number of inputs. If unspecified, it defaults to 2.
  13014. @item weights
  13015. Specify weight of each input video stream as sequence.
  13016. Each weight is separated by space. If number of weights
  13017. is smaller than number of @var{frames} last specified
  13018. weight will be used for all remaining unset weights.
  13019. @item scale
  13020. Specify scale, if it is set it will be multiplied with sum
  13021. of each weight multiplied with pixel values to give final destination
  13022. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13023. @item planes
  13024. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  13025. @item duration
  13026. Specify how end of stream is determined.
  13027. @table @samp
  13028. @item longest
  13029. The duration of the longest input. (default)
  13030. @item shortest
  13031. The duration of the shortest input.
  13032. @item first
  13033. The duration of the first input.
  13034. @end table
  13035. @end table
  13036. @subsection Commands
  13037. This filter supports the following commands:
  13038. @table @option
  13039. @item weights
  13040. @item scale
  13041. @item planes
  13042. Syntax is same as option with same name.
  13043. @end table
  13044. @section monochrome
  13045. Convert video to gray using custom color filter.
  13046. A description of the accepted options follows.
  13047. @table @option
  13048. @item cb
  13049. Set the chroma blue spot. Allowed range is from -1 to 1.
  13050. Default value is 0.
  13051. @item cr
  13052. Set the chroma red spot. Allowed range is from -1 to 1.
  13053. Default value is 0.
  13054. @item size
  13055. Set the color filter size. Allowed range is from .1 to 10.
  13056. Default value is 1.
  13057. @item high
  13058. Set the highlights strength. Allowed range is from 0 to 1.
  13059. Default value is 0.
  13060. @end table
  13061. @subsection Commands
  13062. This filter supports the all above options as @ref{commands}.
  13063. @section morpho
  13064. This filter allows to apply main morphological grayscale transforms,
  13065. erode and dilate with arbitrary structures set in second input stream.
  13066. Unlike naive implementation and much slower performance in @ref{erosion}
  13067. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  13068. should be used instead.
  13069. A description of accepted options follows,
  13070. @table @option
  13071. @item mode
  13072. Set morphological transform to apply, can be:
  13073. @table @samp
  13074. @item erode
  13075. @item dilate
  13076. @item open
  13077. @item close
  13078. @item gradient
  13079. @item tophat
  13080. @item blackhat
  13081. @end table
  13082. Default is @code{erode}.
  13083. @item planes
  13084. Set planes to filter, by default all planes except alpha are filtered.
  13085. @item structure
  13086. Set which structure video frames will be processed from second input stream,
  13087. can be @var{first} or @var{all}. Default is @var{all}.
  13088. @end table
  13089. The @code{morpho} filter also supports the @ref{framesync} options.
  13090. @subsection Commands
  13091. This filter supports same @ref{commands} as options.
  13092. @section mpdecimate
  13093. Drop frames that do not differ greatly from the previous frame in
  13094. order to reduce frame rate.
  13095. The main use of this filter is for very-low-bitrate encoding
  13096. (e.g. streaming over dialup modem), but it could in theory be used for
  13097. fixing movies that were inverse-telecined incorrectly.
  13098. A description of the accepted options follows.
  13099. @table @option
  13100. @item max
  13101. Set the maximum number of consecutive frames which can be dropped (if
  13102. positive), or the minimum interval between dropped frames (if
  13103. negative). If the value is 0, the frame is dropped disregarding the
  13104. number of previous sequentially dropped frames.
  13105. Default value is 0.
  13106. @item hi
  13107. @item lo
  13108. @item frac
  13109. Set the dropping threshold values.
  13110. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  13111. represent actual pixel value differences, so a threshold of 64
  13112. corresponds to 1 unit of difference for each pixel, or the same spread
  13113. out differently over the block.
  13114. A frame is a candidate for dropping if no 8x8 blocks differ by more
  13115. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  13116. meaning the whole image) differ by more than a threshold of @option{lo}.
  13117. Default value for @option{hi} is 64*12, default value for @option{lo} is
  13118. 64*5, and default value for @option{frac} is 0.33.
  13119. @end table
  13120. @section msad
  13121. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  13122. This filter takes two input videos.
  13123. Both input videos must have the same resolution and pixel format for
  13124. this filter to work correctly. Also it assumes that both inputs
  13125. have the same number of frames, which are compared one by one.
  13126. The obtained per component, average, min and max MSAD is printed through
  13127. the logging system.
  13128. The filter stores the calculated MSAD of each frame in frame metadata.
  13129. In the below example the input file @file{main.mpg} being processed is compared
  13130. with the reference file @file{ref.mpg}.
  13131. @example
  13132. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  13133. @end example
  13134. @section multiply
  13135. Multiply first video stream pixels values with second video stream pixels values.
  13136. The filter accepts the following options:
  13137. @table @option
  13138. @item scale
  13139. Set the scale applied to second video stream. By default is @code{1}.
  13140. Allowed range is from @code{0} to @code{9}.
  13141. @item offset
  13142. Set the offset applied to second video stream. By default is @code{0.5}.
  13143. Allowed range is from @code{-1} to @code{1}.
  13144. @item planes
  13145. Specify planes from input video stream that will be processed.
  13146. By default all planes are processed.
  13147. @end table
  13148. @subsection Commands
  13149. This filter supports same @ref{commands} as options.
  13150. @section negate
  13151. Negate (invert) the input video.
  13152. It accepts the following option:
  13153. @table @option
  13154. @item components
  13155. Set components to negate.
  13156. Available values for components are:
  13157. @table @samp
  13158. @item y
  13159. @item u
  13160. @item v
  13161. @item a
  13162. @item r
  13163. @item g
  13164. @item b
  13165. @end table
  13166. @item negate_alpha
  13167. With value 1, it negates the alpha component, if present. Default value is 0.
  13168. @end table
  13169. @subsection Commands
  13170. This filter supports same @ref{commands} as options.
  13171. @anchor{nlmeans}
  13172. @section nlmeans
  13173. Denoise frames using Non-Local Means algorithm.
  13174. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13175. context similarity is defined by comparing their surrounding patches of size
  13176. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13177. around the pixel.
  13178. Note that the research area defines centers for patches, which means some
  13179. patches will be made of pixels outside that research area.
  13180. The filter accepts the following options.
  13181. @table @option
  13182. @item s
  13183. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13184. @item p
  13185. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13186. @item pc
  13187. Same as @option{p} but for chroma planes.
  13188. The default value is @var{0} and means automatic.
  13189. @item r
  13190. Set research size. Default is 15. Must be odd number in range [0, 99].
  13191. @item rc
  13192. Same as @option{r} but for chroma planes.
  13193. The default value is @var{0} and means automatic.
  13194. @end table
  13195. @section nnedi
  13196. Deinterlace video using neural network edge directed interpolation.
  13197. This filter accepts the following options:
  13198. @table @option
  13199. @item weights
  13200. Mandatory option, without binary file filter can not work.
  13201. Currently file can be found here:
  13202. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13203. @item deint
  13204. Set which frames to deinterlace, by default it is @code{all}.
  13205. Can be @code{all} or @code{interlaced}.
  13206. @item field
  13207. Set mode of operation.
  13208. Can be one of the following:
  13209. @table @samp
  13210. @item af
  13211. Use frame flags, both fields.
  13212. @item a
  13213. Use frame flags, single field.
  13214. @item t
  13215. Use top field only.
  13216. @item b
  13217. Use bottom field only.
  13218. @item tf
  13219. Use both fields, top first.
  13220. @item bf
  13221. Use both fields, bottom first.
  13222. @end table
  13223. @item planes
  13224. Set which planes to process, by default filter process all frames.
  13225. @item nsize
  13226. Set size of local neighborhood around each pixel, used by the predictor neural
  13227. network.
  13228. Can be one of the following:
  13229. @table @samp
  13230. @item s8x6
  13231. @item s16x6
  13232. @item s32x6
  13233. @item s48x6
  13234. @item s8x4
  13235. @item s16x4
  13236. @item s32x4
  13237. @end table
  13238. @item nns
  13239. Set the number of neurons in predictor neural network.
  13240. Can be one of the following:
  13241. @table @samp
  13242. @item n16
  13243. @item n32
  13244. @item n64
  13245. @item n128
  13246. @item n256
  13247. @end table
  13248. @item qual
  13249. Controls the number of different neural network predictions that are blended
  13250. together to compute the final output value. Can be @code{fast}, default or
  13251. @code{slow}.
  13252. @item etype
  13253. Set which set of weights to use in the predictor.
  13254. Can be one of the following:
  13255. @table @samp
  13256. @item a, abs
  13257. weights trained to minimize absolute error
  13258. @item s, mse
  13259. weights trained to minimize squared error
  13260. @end table
  13261. @item pscrn
  13262. Controls whether or not the prescreener neural network is used to decide
  13263. which pixels should be processed by the predictor neural network and which
  13264. can be handled by simple cubic interpolation.
  13265. The prescreener is trained to know whether cubic interpolation will be
  13266. sufficient for a pixel or whether it should be predicted by the predictor nn.
  13267. The computational complexity of the prescreener nn is much less than that of
  13268. the predictor nn. Since most pixels can be handled by cubic interpolation,
  13269. using the prescreener generally results in much faster processing.
  13270. The prescreener is pretty accurate, so the difference between using it and not
  13271. using it is almost always unnoticeable.
  13272. Can be one of the following:
  13273. @table @samp
  13274. @item none
  13275. @item original
  13276. @item new
  13277. @item new2
  13278. @item new3
  13279. @end table
  13280. Default is @code{new}.
  13281. @end table
  13282. @subsection Commands
  13283. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  13284. @section noformat
  13285. Force libavfilter not to use any of the specified pixel formats for the
  13286. input to the next filter.
  13287. It accepts the following parameters:
  13288. @table @option
  13289. @item pix_fmts
  13290. A '|'-separated list of pixel format names, such as
  13291. pix_fmts=yuv420p|monow|rgb24".
  13292. @end table
  13293. @subsection Examples
  13294. @itemize
  13295. @item
  13296. Force libavfilter to use a format different from @var{yuv420p} for the
  13297. input to the vflip filter:
  13298. @example
  13299. noformat=pix_fmts=yuv420p,vflip
  13300. @end example
  13301. @item
  13302. Convert the input video to any of the formats not contained in the list:
  13303. @example
  13304. noformat=yuv420p|yuv444p|yuv410p
  13305. @end example
  13306. @end itemize
  13307. @section noise
  13308. Add noise on video input frame.
  13309. The filter accepts the following options:
  13310. @table @option
  13311. @item all_seed
  13312. @item c0_seed
  13313. @item c1_seed
  13314. @item c2_seed
  13315. @item c3_seed
  13316. Set noise seed for specific pixel component or all pixel components in case
  13317. of @var{all_seed}. Default value is @code{123457}.
  13318. @item all_strength, alls
  13319. @item c0_strength, c0s
  13320. @item c1_strength, c1s
  13321. @item c2_strength, c2s
  13322. @item c3_strength, c3s
  13323. Set noise strength for specific pixel component or all pixel components in case
  13324. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  13325. @item all_flags, allf
  13326. @item c0_flags, c0f
  13327. @item c1_flags, c1f
  13328. @item c2_flags, c2f
  13329. @item c3_flags, c3f
  13330. Set pixel component flags or set flags for all components if @var{all_flags}.
  13331. Available values for component flags are:
  13332. @table @samp
  13333. @item a
  13334. averaged temporal noise (smoother)
  13335. @item p
  13336. mix random noise with a (semi)regular pattern
  13337. @item t
  13338. temporal noise (noise pattern changes between frames)
  13339. @item u
  13340. uniform noise (gaussian otherwise)
  13341. @end table
  13342. @end table
  13343. @subsection Examples
  13344. Add temporal and uniform noise to input video:
  13345. @example
  13346. noise=alls=20:allf=t+u
  13347. @end example
  13348. @section normalize
  13349. Normalize RGB video (aka histogram stretching, contrast stretching).
  13350. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  13351. For each channel of each frame, the filter computes the input range and maps
  13352. it linearly to the user-specified output range. The output range defaults
  13353. to the full dynamic range from pure black to pure white.
  13354. Temporal smoothing can be used on the input range to reduce flickering (rapid
  13355. changes in brightness) caused when small dark or bright objects enter or leave
  13356. the scene. This is similar to the auto-exposure (automatic gain control) on a
  13357. video camera, and, like a video camera, it may cause a period of over- or
  13358. under-exposure of the video.
  13359. The R,G,B channels can be normalized independently, which may cause some
  13360. color shifting, or linked together as a single channel, which prevents
  13361. color shifting. Linked normalization preserves hue. Independent normalization
  13362. does not, so it can be used to remove some color casts. Independent and linked
  13363. normalization can be combined in any ratio.
  13364. The normalize filter accepts the following options:
  13365. @table @option
  13366. @item blackpt
  13367. @item whitept
  13368. Colors which define the output range. The minimum input value is mapped to
  13369. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  13370. The defaults are black and white respectively. Specifying white for
  13371. @var{blackpt} and black for @var{whitept} will give color-inverted,
  13372. normalized video. Shades of grey can be used to reduce the dynamic range
  13373. (contrast). Specifying saturated colors here can create some interesting
  13374. effects.
  13375. @item smoothing
  13376. The number of previous frames to use for temporal smoothing. The input range
  13377. of each channel is smoothed using a rolling average over the current frame
  13378. and the @var{smoothing} previous frames. The default is 0 (no temporal
  13379. smoothing).
  13380. @item independence
  13381. Controls the ratio of independent (color shifting) channel normalization to
  13382. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  13383. independent. Defaults to 1.0 (fully independent).
  13384. @item strength
  13385. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  13386. expensive no-op. Defaults to 1.0 (full strength).
  13387. @end table
  13388. @subsection Commands
  13389. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  13390. The command accepts the same syntax of the corresponding option.
  13391. If the specified expression is not valid, it is kept at its current
  13392. value.
  13393. @subsection Examples
  13394. Stretch video contrast to use the full dynamic range, with no temporal
  13395. smoothing; may flicker depending on the source content:
  13396. @example
  13397. normalize=blackpt=black:whitept=white:smoothing=0
  13398. @end example
  13399. As above, but with 50 frames of temporal smoothing; flicker should be
  13400. reduced, depending on the source content:
  13401. @example
  13402. normalize=blackpt=black:whitept=white:smoothing=50
  13403. @end example
  13404. As above, but with hue-preserving linked channel normalization:
  13405. @example
  13406. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  13407. @end example
  13408. As above, but with half strength:
  13409. @example
  13410. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  13411. @end example
  13412. Map the darkest input color to red, the brightest input color to cyan:
  13413. @example
  13414. normalize=blackpt=red:whitept=cyan
  13415. @end example
  13416. @section null
  13417. Pass the video source unchanged to the output.
  13418. @section ocr
  13419. Optical Character Recognition
  13420. This filter uses Tesseract for optical character recognition. To enable
  13421. compilation of this filter, you need to configure FFmpeg with
  13422. @code{--enable-libtesseract}.
  13423. It accepts the following options:
  13424. @table @option
  13425. @item datapath
  13426. Set datapath to tesseract data. Default is to use whatever was
  13427. set at installation.
  13428. @item language
  13429. Set language, default is "eng".
  13430. @item whitelist
  13431. Set character whitelist.
  13432. @item blacklist
  13433. Set character blacklist.
  13434. @end table
  13435. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  13436. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  13437. @section ocv
  13438. Apply a video transform using libopencv.
  13439. To enable this filter, install the libopencv library and headers and
  13440. configure FFmpeg with @code{--enable-libopencv}.
  13441. It accepts the following parameters:
  13442. @table @option
  13443. @item filter_name
  13444. The name of the libopencv filter to apply.
  13445. @item filter_params
  13446. The parameters to pass to the libopencv filter. If not specified, the default
  13447. values are assumed.
  13448. @end table
  13449. Refer to the official libopencv documentation for more precise
  13450. information:
  13451. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  13452. Several libopencv filters are supported; see the following subsections.
  13453. @anchor{dilate}
  13454. @subsection dilate
  13455. Dilate an image by using a specific structuring element.
  13456. It corresponds to the libopencv function @code{cvDilate}.
  13457. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  13458. @var{struct_el} represents a structuring element, and has the syntax:
  13459. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  13460. @var{cols} and @var{rows} represent the number of columns and rows of
  13461. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  13462. point, and @var{shape} the shape for the structuring element. @var{shape}
  13463. must be "rect", "cross", "ellipse", or "custom".
  13464. If the value for @var{shape} is "custom", it must be followed by a
  13465. string of the form "=@var{filename}". The file with name
  13466. @var{filename} is assumed to represent a binary image, with each
  13467. printable character corresponding to a bright pixel. When a custom
  13468. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  13469. or columns and rows of the read file are assumed instead.
  13470. The default value for @var{struct_el} is "3x3+0x0/rect".
  13471. @var{nb_iterations} specifies the number of times the transform is
  13472. applied to the image, and defaults to 1.
  13473. Some examples:
  13474. @example
  13475. # Use the default values
  13476. ocv=dilate
  13477. # Dilate using a structuring element with a 5x5 cross, iterating two times
  13478. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  13479. # Read the shape from the file diamond.shape, iterating two times.
  13480. # The file diamond.shape may contain a pattern of characters like this
  13481. # *
  13482. # ***
  13483. # *****
  13484. # ***
  13485. # *
  13486. # The specified columns and rows are ignored
  13487. # but the anchor point coordinates are not
  13488. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  13489. @end example
  13490. @subsection erode
  13491. Erode an image by using a specific structuring element.
  13492. It corresponds to the libopencv function @code{cvErode}.
  13493. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  13494. with the same syntax and semantics as the @ref{dilate} filter.
  13495. @subsection smooth
  13496. Smooth the input video.
  13497. The filter takes the following parameters:
  13498. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  13499. @var{type} is the type of smooth filter to apply, and must be one of
  13500. the following values: "blur", "blur_no_scale", "median", "gaussian",
  13501. or "bilateral". The default value is "gaussian".
  13502. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  13503. depends on the smooth type. @var{param1} and
  13504. @var{param2} accept integer positive values or 0. @var{param3} and
  13505. @var{param4} accept floating point values.
  13506. The default value for @var{param1} is 3. The default value for the
  13507. other parameters is 0.
  13508. These parameters correspond to the parameters assigned to the
  13509. libopencv function @code{cvSmooth}.
  13510. @section oscilloscope
  13511. 2D Video Oscilloscope.
  13512. Useful to measure spatial impulse, step responses, chroma delays, etc.
  13513. It accepts the following parameters:
  13514. @table @option
  13515. @item x
  13516. Set scope center x position.
  13517. @item y
  13518. Set scope center y position.
  13519. @item s
  13520. Set scope size, relative to frame diagonal.
  13521. @item t
  13522. Set scope tilt/rotation.
  13523. @item o
  13524. Set trace opacity.
  13525. @item tx
  13526. Set trace center x position.
  13527. @item ty
  13528. Set trace center y position.
  13529. @item tw
  13530. Set trace width, relative to width of frame.
  13531. @item th
  13532. Set trace height, relative to height of frame.
  13533. @item c
  13534. Set which components to trace. By default it traces first three components.
  13535. @item g
  13536. Draw trace grid. By default is enabled.
  13537. @item st
  13538. Draw some statistics. By default is enabled.
  13539. @item sc
  13540. Draw scope. By default is enabled.
  13541. @end table
  13542. @subsection Commands
  13543. This filter supports same @ref{commands} as options.
  13544. The command accepts the same syntax of the corresponding option.
  13545. If the specified expression is not valid, it is kept at its current
  13546. value.
  13547. @subsection Examples
  13548. @itemize
  13549. @item
  13550. Inspect full first row of video frame.
  13551. @example
  13552. oscilloscope=x=0.5:y=0:s=1
  13553. @end example
  13554. @item
  13555. Inspect full last row of video frame.
  13556. @example
  13557. oscilloscope=x=0.5:y=1:s=1
  13558. @end example
  13559. @item
  13560. Inspect full 5th line of video frame of height 1080.
  13561. @example
  13562. oscilloscope=x=0.5:y=5/1080:s=1
  13563. @end example
  13564. @item
  13565. Inspect full last column of video frame.
  13566. @example
  13567. oscilloscope=x=1:y=0.5:s=1:t=1
  13568. @end example
  13569. @end itemize
  13570. @anchor{overlay}
  13571. @section overlay
  13572. Overlay one video on top of another.
  13573. It takes two inputs and has one output. The first input is the "main"
  13574. video on which the second input is overlaid.
  13575. It accepts the following parameters:
  13576. A description of the accepted options follows.
  13577. @table @option
  13578. @item x
  13579. @item y
  13580. Set the expression for the x and y coordinates of the overlaid video
  13581. on the main video. Default value is "0" for both expressions. In case
  13582. the expression is invalid, it is set to a huge value (meaning that the
  13583. overlay will not be displayed within the output visible area).
  13584. @item eof_action
  13585. See @ref{framesync}.
  13586. @item eval
  13587. Set when the expressions for @option{x}, and @option{y} are evaluated.
  13588. It accepts the following values:
  13589. @table @samp
  13590. @item init
  13591. only evaluate expressions once during the filter initialization or
  13592. when a command is processed
  13593. @item frame
  13594. evaluate expressions for each incoming frame
  13595. @end table
  13596. Default value is @samp{frame}.
  13597. @item shortest
  13598. See @ref{framesync}.
  13599. @item format
  13600. Set the format for the output video.
  13601. It accepts the following values:
  13602. @table @samp
  13603. @item yuv420
  13604. force YUV420 output
  13605. @item yuv420p10
  13606. force YUV420p10 output
  13607. @item yuv422
  13608. force YUV422 output
  13609. @item yuv422p10
  13610. force YUV422p10 output
  13611. @item yuv444
  13612. force YUV444 output
  13613. @item rgb
  13614. force packed RGB output
  13615. @item gbrp
  13616. force planar RGB output
  13617. @item auto
  13618. automatically pick format
  13619. @end table
  13620. Default value is @samp{yuv420}.
  13621. @item repeatlast
  13622. See @ref{framesync}.
  13623. @item alpha
  13624. Set format of alpha of the overlaid video, it can be @var{straight} or
  13625. @var{premultiplied}. Default is @var{straight}.
  13626. @end table
  13627. The @option{x}, and @option{y} expressions can contain the following
  13628. parameters.
  13629. @table @option
  13630. @item main_w, W
  13631. @item main_h, H
  13632. The main input width and height.
  13633. @item overlay_w, w
  13634. @item overlay_h, h
  13635. The overlay input width and height.
  13636. @item x
  13637. @item y
  13638. The computed values for @var{x} and @var{y}. They are evaluated for
  13639. each new frame.
  13640. @item hsub
  13641. @item vsub
  13642. horizontal and vertical chroma subsample values of the output
  13643. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  13644. @var{vsub} is 1.
  13645. @item n
  13646. the number of input frame, starting from 0
  13647. @item pos
  13648. the position in the file of the input frame, NAN if unknown
  13649. @item t
  13650. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  13651. @end table
  13652. This filter also supports the @ref{framesync} options.
  13653. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  13654. when evaluation is done @emph{per frame}, and will evaluate to NAN
  13655. when @option{eval} is set to @samp{init}.
  13656. Be aware that frames are taken from each input video in timestamp
  13657. order, hence, if their initial timestamps differ, it is a good idea
  13658. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  13659. have them begin in the same zero timestamp, as the example for
  13660. the @var{movie} filter does.
  13661. You can chain together more overlays but you should test the
  13662. efficiency of such approach.
  13663. @subsection Commands
  13664. This filter supports the following commands:
  13665. @table @option
  13666. @item x
  13667. @item y
  13668. Modify the x and y of the overlay input.
  13669. The command accepts the same syntax of the corresponding option.
  13670. If the specified expression is not valid, it is kept at its current
  13671. value.
  13672. @end table
  13673. @subsection Examples
  13674. @itemize
  13675. @item
  13676. Draw the overlay at 10 pixels from the bottom right corner of the main
  13677. video:
  13678. @example
  13679. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  13680. @end example
  13681. Using named options the example above becomes:
  13682. @example
  13683. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  13684. @end example
  13685. @item
  13686. Insert a transparent PNG logo in the bottom left corner of the input,
  13687. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  13688. @example
  13689. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  13690. @end example
  13691. @item
  13692. Insert 2 different transparent PNG logos (second logo on bottom
  13693. right corner) using the @command{ffmpeg} tool:
  13694. @example
  13695. 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
  13696. @end example
  13697. @item
  13698. Add a transparent color layer on top of the main video; @code{WxH}
  13699. must specify the size of the main input to the overlay filter:
  13700. @example
  13701. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  13702. @end example
  13703. @item
  13704. Play an original video and a filtered version (here with the deshake
  13705. filter) side by side using the @command{ffplay} tool:
  13706. @example
  13707. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  13708. @end example
  13709. The above command is the same as:
  13710. @example
  13711. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  13712. @end example
  13713. @item
  13714. Make a sliding overlay appearing from the left to the right top part of the
  13715. screen starting since time 2:
  13716. @example
  13717. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  13718. @end example
  13719. @item
  13720. Compose output by putting two input videos side to side:
  13721. @example
  13722. ffmpeg -i left.avi -i right.avi -filter_complex "
  13723. nullsrc=size=200x100 [background];
  13724. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  13725. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  13726. [background][left] overlay=shortest=1 [background+left];
  13727. [background+left][right] overlay=shortest=1:x=100 [left+right]
  13728. "
  13729. @end example
  13730. @item
  13731. Mask 10-20 seconds of a video by applying the delogo filter to a section
  13732. @example
  13733. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  13734. -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]'
  13735. masked.avi
  13736. @end example
  13737. @item
  13738. Chain several overlays in cascade:
  13739. @example
  13740. nullsrc=s=200x200 [bg];
  13741. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  13742. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  13743. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  13744. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  13745. [in3] null, [mid2] overlay=100:100 [out0]
  13746. @end example
  13747. @end itemize
  13748. @anchor{overlay_cuda}
  13749. @section overlay_cuda
  13750. Overlay one video on top of another.
  13751. This is the CUDA variant of the @ref{overlay} filter.
  13752. It only accepts CUDA frames. The underlying input pixel formats have to match.
  13753. It takes two inputs and has one output. The first input is the "main"
  13754. video on which the second input is overlaid.
  13755. It accepts the following parameters:
  13756. @table @option
  13757. @item x
  13758. @item y
  13759. Set expressions for the x and y coordinates of the overlaid video
  13760. on the main video.
  13761. They can contain the following parameters:
  13762. @table @option
  13763. @item main_w, W
  13764. @item main_h, H
  13765. The main input width and height.
  13766. @item overlay_w, w
  13767. @item overlay_h, h
  13768. The overlay input width and height.
  13769. @item x
  13770. @item y
  13771. The computed values for @var{x} and @var{y}. They are evaluated for
  13772. each new frame.
  13773. @item n
  13774. The ordinal index of the main input frame, starting from 0.
  13775. @item pos
  13776. The byte offset position in the file of the main input frame, NAN if unknown.
  13777. @item t
  13778. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  13779. @end table
  13780. Default value is "0" for both expressions.
  13781. @item eval
  13782. Set when the expressions for @option{x} and @option{y} are evaluated.
  13783. It accepts the following values:
  13784. @table @option
  13785. @item init
  13786. Evaluate expressions once during filter initialization or
  13787. when a command is processed.
  13788. @item frame
  13789. Evaluate expressions for each incoming frame
  13790. @end table
  13791. Default value is @option{frame}.
  13792. @item eof_action
  13793. See @ref{framesync}.
  13794. @item shortest
  13795. See @ref{framesync}.
  13796. @item repeatlast
  13797. See @ref{framesync}.
  13798. @end table
  13799. This filter also supports the @ref{framesync} options.
  13800. @section owdenoise
  13801. Apply Overcomplete Wavelet denoiser.
  13802. The filter accepts the following options:
  13803. @table @option
  13804. @item depth
  13805. Set depth.
  13806. Larger depth values will denoise lower frequency components more, but
  13807. slow down filtering.
  13808. Must be an int in the range 8-16, default is @code{8}.
  13809. @item luma_strength, ls
  13810. Set luma strength.
  13811. Must be a double value in the range 0-1000, default is @code{1.0}.
  13812. @item chroma_strength, cs
  13813. Set chroma strength.
  13814. Must be a double value in the range 0-1000, default is @code{1.0}.
  13815. @end table
  13816. @anchor{pad}
  13817. @section pad
  13818. Add paddings to the input image, and place the original input at the
  13819. provided @var{x}, @var{y} coordinates.
  13820. It accepts the following parameters:
  13821. @table @option
  13822. @item width, w
  13823. @item height, h
  13824. Specify an expression for the size of the output image with the
  13825. paddings added. If the value for @var{width} or @var{height} is 0, the
  13826. corresponding input size is used for the output.
  13827. The @var{width} expression can reference the value set by the
  13828. @var{height} expression, and vice versa.
  13829. The default value of @var{width} and @var{height} is 0.
  13830. @item x
  13831. @item y
  13832. Specify the offsets to place the input image at within the padded area,
  13833. with respect to the top/left border of the output image.
  13834. The @var{x} expression can reference the value set by the @var{y}
  13835. expression, and vice versa.
  13836. The default value of @var{x} and @var{y} is 0.
  13837. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  13838. so the input image is centered on the padded area.
  13839. @item color
  13840. Specify the color of the padded area. For the syntax of this option,
  13841. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13842. manual,ffmpeg-utils}.
  13843. The default value of @var{color} is "black".
  13844. @item eval
  13845. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  13846. It accepts the following values:
  13847. @table @samp
  13848. @item init
  13849. Only evaluate expressions once during the filter initialization or when
  13850. a command is processed.
  13851. @item frame
  13852. Evaluate expressions for each incoming frame.
  13853. @end table
  13854. Default value is @samp{init}.
  13855. @item aspect
  13856. Pad to aspect instead to a resolution.
  13857. @end table
  13858. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  13859. options are expressions containing the following constants:
  13860. @table @option
  13861. @item in_w
  13862. @item in_h
  13863. The input video width and height.
  13864. @item iw
  13865. @item ih
  13866. These are the same as @var{in_w} and @var{in_h}.
  13867. @item out_w
  13868. @item out_h
  13869. The output width and height (the size of the padded area), as
  13870. specified by the @var{width} and @var{height} expressions.
  13871. @item ow
  13872. @item oh
  13873. These are the same as @var{out_w} and @var{out_h}.
  13874. @item x
  13875. @item y
  13876. The x and y offsets as specified by the @var{x} and @var{y}
  13877. expressions, or NAN if not yet specified.
  13878. @item a
  13879. same as @var{iw} / @var{ih}
  13880. @item sar
  13881. input sample aspect ratio
  13882. @item dar
  13883. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  13884. @item hsub
  13885. @item vsub
  13886. The horizontal and vertical chroma subsample values. For example for the
  13887. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13888. @end table
  13889. @subsection Examples
  13890. @itemize
  13891. @item
  13892. Add paddings with the color "violet" to the input video. The output video
  13893. size is 640x480, and the top-left corner of the input video is placed at
  13894. column 0, row 40
  13895. @example
  13896. pad=640:480:0:40:violet
  13897. @end example
  13898. The example above is equivalent to the following command:
  13899. @example
  13900. pad=width=640:height=480:x=0:y=40:color=violet
  13901. @end example
  13902. @item
  13903. Pad the input to get an output with dimensions increased by 3/2,
  13904. and put the input video at the center of the padded area:
  13905. @example
  13906. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  13907. @end example
  13908. @item
  13909. Pad the input to get a squared output with size equal to the maximum
  13910. value between the input width and height, and put the input video at
  13911. the center of the padded area:
  13912. @example
  13913. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  13914. @end example
  13915. @item
  13916. Pad the input to get a final w/h ratio of 16:9:
  13917. @example
  13918. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  13919. @end example
  13920. @item
  13921. In case of anamorphic video, in order to set the output display aspect
  13922. correctly, it is necessary to use @var{sar} in the expression,
  13923. according to the relation:
  13924. @example
  13925. (ih * X / ih) * sar = output_dar
  13926. X = output_dar / sar
  13927. @end example
  13928. Thus the previous example needs to be modified to:
  13929. @example
  13930. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  13931. @end example
  13932. @item
  13933. Double the output size and put the input video in the bottom-right
  13934. corner of the output padded area:
  13935. @example
  13936. pad="2*iw:2*ih:ow-iw:oh-ih"
  13937. @end example
  13938. @end itemize
  13939. @anchor{palettegen}
  13940. @section palettegen
  13941. Generate one palette for a whole video stream.
  13942. It accepts the following options:
  13943. @table @option
  13944. @item max_colors
  13945. Set the maximum number of colors to quantize in the palette.
  13946. Note: the palette will still contain 256 colors; the unused palette entries
  13947. will be black.
  13948. @item reserve_transparent
  13949. Create a palette of 255 colors maximum and reserve the last one for
  13950. transparency. Reserving the transparency color is useful for GIF optimization.
  13951. If not set, the maximum of colors in the palette will be 256. You probably want
  13952. to disable this option for a standalone image.
  13953. Set by default.
  13954. @item transparency_color
  13955. Set the color that will be used as background for transparency.
  13956. @item stats_mode
  13957. Set statistics mode.
  13958. It accepts the following values:
  13959. @table @samp
  13960. @item full
  13961. Compute full frame histograms.
  13962. @item diff
  13963. Compute histograms only for the part that differs from previous frame. This
  13964. might be relevant to give more importance to the moving part of your input if
  13965. the background is static.
  13966. @item single
  13967. Compute new histogram for each frame.
  13968. @end table
  13969. Default value is @var{full}.
  13970. @item use_alpha
  13971. Create a palette of colors with alpha components.
  13972. Setting this, will automatically disable 'reserve_transparent'.
  13973. @end table
  13974. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  13975. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  13976. color quantization of the palette. This information is also visible at
  13977. @var{info} logging level.
  13978. @subsection Examples
  13979. @itemize
  13980. @item
  13981. Generate a representative palette of a given video using @command{ffmpeg}:
  13982. @example
  13983. ffmpeg -i input.mkv -vf palettegen palette.png
  13984. @end example
  13985. @end itemize
  13986. @section paletteuse
  13987. Use a palette to downsample an input video stream.
  13988. The filter takes two inputs: one video stream and a palette. The palette must
  13989. be a 256 pixels image.
  13990. It accepts the following options:
  13991. @table @option
  13992. @item dither
  13993. Select dithering mode. Available algorithms are:
  13994. @table @samp
  13995. @item bayer
  13996. Ordered 8x8 bayer dithering (deterministic)
  13997. @item heckbert
  13998. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  13999. Note: this dithering is sometimes considered "wrong" and is included as a
  14000. reference.
  14001. @item floyd_steinberg
  14002. Floyd and Steingberg dithering (error diffusion)
  14003. @item sierra2
  14004. Frankie Sierra dithering v2 (error diffusion)
  14005. @item sierra2_4a
  14006. Frankie Sierra dithering v2 "Lite" (error diffusion)
  14007. @end table
  14008. Default is @var{sierra2_4a}.
  14009. @item bayer_scale
  14010. When @var{bayer} dithering is selected, this option defines the scale of the
  14011. pattern (how much the crosshatch pattern is visible). A low value means more
  14012. visible pattern for less banding, and higher value means less visible pattern
  14013. at the cost of more banding.
  14014. The option must be an integer value in the range [0,5]. Default is @var{2}.
  14015. @item diff_mode
  14016. If set, define the zone to process
  14017. @table @samp
  14018. @item rectangle
  14019. Only the changing rectangle will be reprocessed. This is similar to GIF
  14020. cropping/offsetting compression mechanism. This option can be useful for speed
  14021. if only a part of the image is changing, and has use cases such as limiting the
  14022. scope of the error diffusal @option{dither} to the rectangle that bounds the
  14023. moving scene (it leads to more deterministic output if the scene doesn't change
  14024. much, and as a result less moving noise and better GIF compression).
  14025. @end table
  14026. Default is @var{none}.
  14027. @item new
  14028. Take new palette for each output frame.
  14029. @item alpha_threshold
  14030. Sets the alpha threshold for transparency. Alpha values above this threshold
  14031. will be treated as completely opaque, and values below this threshold will be
  14032. treated as completely transparent.
  14033. The option must be an integer value in the range [0,255]. Default is @var{128}.
  14034. @item use_alpha
  14035. Apply the palette by taking alpha values into account. Only useful with
  14036. palettes that are containing multiple colors with alpha components.
  14037. Setting this will automatically disable 'alpha_treshold'.
  14038. @end table
  14039. @subsection Examples
  14040. @itemize
  14041. @item
  14042. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  14043. using @command{ffmpeg}:
  14044. @example
  14045. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  14046. @end example
  14047. @end itemize
  14048. @section perspective
  14049. Correct perspective of video not recorded perpendicular to the screen.
  14050. A description of the accepted parameters follows.
  14051. @table @option
  14052. @item x0
  14053. @item y0
  14054. @item x1
  14055. @item y1
  14056. @item x2
  14057. @item y2
  14058. @item x3
  14059. @item y3
  14060. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  14061. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  14062. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  14063. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  14064. then the corners of the source will be sent to the specified coordinates.
  14065. The expressions can use the following variables:
  14066. @table @option
  14067. @item W
  14068. @item H
  14069. the width and height of video frame.
  14070. @item in
  14071. Input frame count.
  14072. @item on
  14073. Output frame count.
  14074. @end table
  14075. @item interpolation
  14076. Set interpolation for perspective correction.
  14077. It accepts the following values:
  14078. @table @samp
  14079. @item linear
  14080. @item cubic
  14081. @end table
  14082. Default value is @samp{linear}.
  14083. @item sense
  14084. Set interpretation of coordinate options.
  14085. It accepts the following values:
  14086. @table @samp
  14087. @item 0, source
  14088. Send point in the source specified by the given coordinates to
  14089. the corners of the destination.
  14090. @item 1, destination
  14091. Send the corners of the source to the point in the destination specified
  14092. by the given coordinates.
  14093. Default value is @samp{source}.
  14094. @end table
  14095. @item eval
  14096. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  14097. It accepts the following values:
  14098. @table @samp
  14099. @item init
  14100. only evaluate expressions once during the filter initialization or
  14101. when a command is processed
  14102. @item frame
  14103. evaluate expressions for each incoming frame
  14104. @end table
  14105. Default value is @samp{init}.
  14106. @end table
  14107. @section phase
  14108. Delay interlaced video by one field time so that the field order changes.
  14109. The intended use is to fix PAL movies that have been captured with the
  14110. opposite field order to the film-to-video transfer.
  14111. A description of the accepted parameters follows.
  14112. @table @option
  14113. @item mode
  14114. Set phase mode.
  14115. It accepts the following values:
  14116. @table @samp
  14117. @item t
  14118. Capture field order top-first, transfer bottom-first.
  14119. Filter will delay the bottom field.
  14120. @item b
  14121. Capture field order bottom-first, transfer top-first.
  14122. Filter will delay the top field.
  14123. @item p
  14124. Capture and transfer with the same field order. This mode only exists
  14125. for the documentation of the other options to refer to, but if you
  14126. actually select it, the filter will faithfully do nothing.
  14127. @item a
  14128. Capture field order determined automatically by field flags, transfer
  14129. opposite.
  14130. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  14131. basis using field flags. If no field information is available,
  14132. then this works just like @samp{u}.
  14133. @item u
  14134. Capture unknown or varying, transfer opposite.
  14135. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  14136. analyzing the images and selecting the alternative that produces best
  14137. match between the fields.
  14138. @item T
  14139. Capture top-first, transfer unknown or varying.
  14140. Filter selects among @samp{t} and @samp{p} using image analysis.
  14141. @item B
  14142. Capture bottom-first, transfer unknown or varying.
  14143. Filter selects among @samp{b} and @samp{p} using image analysis.
  14144. @item A
  14145. Capture determined by field flags, transfer unknown or varying.
  14146. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  14147. image analysis. If no field information is available, then this works just
  14148. like @samp{U}. This is the default mode.
  14149. @item U
  14150. Both capture and transfer unknown or varying.
  14151. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  14152. @end table
  14153. @end table
  14154. @subsection Commands
  14155. This filter supports the all above options as @ref{commands}.
  14156. @section photosensitivity
  14157. Reduce various flashes in video, so to help users with epilepsy.
  14158. It accepts the following options:
  14159. @table @option
  14160. @item frames, f
  14161. Set how many frames to use when filtering. Default is 30.
  14162. @item threshold, t
  14163. Set detection threshold factor. Default is 1.
  14164. Lower is stricter.
  14165. @item skip
  14166. Set how many pixels to skip when sampling frames. Default is 1.
  14167. Allowed range is from 1 to 1024.
  14168. @item bypass
  14169. Leave frames unchanged. Default is disabled.
  14170. @end table
  14171. @section pixdesctest
  14172. Pixel format descriptor test filter, mainly useful for internal
  14173. testing. The output video should be equal to the input video.
  14174. For example:
  14175. @example
  14176. format=monow, pixdesctest
  14177. @end example
  14178. can be used to test the monowhite pixel format descriptor definition.
  14179. @section pixelize
  14180. Apply pixelization to video stream.
  14181. The filter accepts the following options:
  14182. @table @option
  14183. @item width, w
  14184. @item height, h
  14185. Set block dimensions that will be used for pixelization.
  14186. Default value is @code{16}.
  14187. @item mode, m
  14188. Set the mode of pixelization used.
  14189. Possible values are:
  14190. @table @samp
  14191. @item avg
  14192. @item min
  14193. @item max
  14194. @end table
  14195. Default value is @code{avg}.
  14196. @item planes, p
  14197. Set what planes to filter. Default is to filter all planes.
  14198. @end table
  14199. @subsection Commands
  14200. This filter supports all options as @ref{commands}.
  14201. @section pixscope
  14202. Display sample values of color channels. Mainly useful for checking color
  14203. and levels. Minimum supported resolution is 640x480.
  14204. The filters accept the following options:
  14205. @table @option
  14206. @item x
  14207. Set scope X position, relative offset on X axis.
  14208. @item y
  14209. Set scope Y position, relative offset on Y axis.
  14210. @item w
  14211. Set scope width.
  14212. @item h
  14213. Set scope height.
  14214. @item o
  14215. Set window opacity. This window also holds statistics about pixel area.
  14216. @item wx
  14217. Set window X position, relative offset on X axis.
  14218. @item wy
  14219. Set window Y position, relative offset on Y axis.
  14220. @end table
  14221. @subsection Commands
  14222. This filter supports same @ref{commands} as options.
  14223. @section pp
  14224. Enable the specified chain of postprocessing subfilters using libpostproc. This
  14225. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  14226. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  14227. Each subfilter and some options have a short and a long name that can be used
  14228. interchangeably, i.e. dr/dering are the same.
  14229. The filters accept the following options:
  14230. @table @option
  14231. @item subfilters
  14232. Set postprocessing subfilters string.
  14233. @end table
  14234. All subfilters share common options to determine their scope:
  14235. @table @option
  14236. @item a/autoq
  14237. Honor the quality commands for this subfilter.
  14238. @item c/chrom
  14239. Do chrominance filtering, too (default).
  14240. @item y/nochrom
  14241. Do luminance filtering only (no chrominance).
  14242. @item n/noluma
  14243. Do chrominance filtering only (no luminance).
  14244. @end table
  14245. These options can be appended after the subfilter name, separated by a '|'.
  14246. Available subfilters are:
  14247. @table @option
  14248. @item hb/hdeblock[|difference[|flatness]]
  14249. Horizontal deblocking filter
  14250. @table @option
  14251. @item difference
  14252. Difference factor where higher values mean more deblocking (default: @code{32}).
  14253. @item flatness
  14254. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14255. @end table
  14256. @item vb/vdeblock[|difference[|flatness]]
  14257. Vertical deblocking filter
  14258. @table @option
  14259. @item difference
  14260. Difference factor where higher values mean more deblocking (default: @code{32}).
  14261. @item flatness
  14262. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14263. @end table
  14264. @item ha/hadeblock[|difference[|flatness]]
  14265. Accurate horizontal deblocking filter
  14266. @table @option
  14267. @item difference
  14268. Difference factor where higher values mean more deblocking (default: @code{32}).
  14269. @item flatness
  14270. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14271. @end table
  14272. @item va/vadeblock[|difference[|flatness]]
  14273. Accurate vertical deblocking filter
  14274. @table @option
  14275. @item difference
  14276. Difference factor where higher values mean more deblocking (default: @code{32}).
  14277. @item flatness
  14278. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14279. @end table
  14280. @end table
  14281. The horizontal and vertical deblocking filters share the difference and
  14282. flatness values so you cannot set different horizontal and vertical
  14283. thresholds.
  14284. @table @option
  14285. @item h1/x1hdeblock
  14286. Experimental horizontal deblocking filter
  14287. @item v1/x1vdeblock
  14288. Experimental vertical deblocking filter
  14289. @item dr/dering
  14290. Deringing filter
  14291. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  14292. @table @option
  14293. @item threshold1
  14294. larger -> stronger filtering
  14295. @item threshold2
  14296. larger -> stronger filtering
  14297. @item threshold3
  14298. larger -> stronger filtering
  14299. @end table
  14300. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  14301. @table @option
  14302. @item f/fullyrange
  14303. Stretch luminance to @code{0-255}.
  14304. @end table
  14305. @item lb/linblenddeint
  14306. Linear blend deinterlacing filter that deinterlaces the given block by
  14307. filtering all lines with a @code{(1 2 1)} filter.
  14308. @item li/linipoldeint
  14309. Linear interpolating deinterlacing filter that deinterlaces the given block by
  14310. linearly interpolating every second line.
  14311. @item ci/cubicipoldeint
  14312. Cubic interpolating deinterlacing filter deinterlaces the given block by
  14313. cubically interpolating every second line.
  14314. @item md/mediandeint
  14315. Median deinterlacing filter that deinterlaces the given block by applying a
  14316. median filter to every second line.
  14317. @item fd/ffmpegdeint
  14318. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  14319. second line with a @code{(-1 4 2 4 -1)} filter.
  14320. @item l5/lowpass5
  14321. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  14322. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  14323. @item fq/forceQuant[|quantizer]
  14324. Overrides the quantizer table from the input with the constant quantizer you
  14325. specify.
  14326. @table @option
  14327. @item quantizer
  14328. Quantizer to use
  14329. @end table
  14330. @item de/default
  14331. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  14332. @item fa/fast
  14333. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  14334. @item ac
  14335. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  14336. @end table
  14337. @subsection Examples
  14338. @itemize
  14339. @item
  14340. Apply horizontal and vertical deblocking, deringing and automatic
  14341. brightness/contrast:
  14342. @example
  14343. pp=hb/vb/dr/al
  14344. @end example
  14345. @item
  14346. Apply default filters without brightness/contrast correction:
  14347. @example
  14348. pp=de/-al
  14349. @end example
  14350. @item
  14351. Apply default filters and temporal denoiser:
  14352. @example
  14353. pp=default/tmpnoise|1|2|3
  14354. @end example
  14355. @item
  14356. Apply deblocking on luminance only, and switch vertical deblocking on or off
  14357. automatically depending on available CPU time:
  14358. @example
  14359. pp=hb|y/vb|a
  14360. @end example
  14361. @end itemize
  14362. @section pp7
  14363. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  14364. similar to spp = 6 with 7 point DCT, where only the center sample is
  14365. used after IDCT.
  14366. The filter accepts the following options:
  14367. @table @option
  14368. @item qp
  14369. Force a constant quantization parameter. It accepts an integer in range
  14370. 0 to 63. If not set, the filter will use the QP from the video stream
  14371. (if available).
  14372. @item mode
  14373. Set thresholding mode. Available modes are:
  14374. @table @samp
  14375. @item hard
  14376. Set hard thresholding.
  14377. @item soft
  14378. Set soft thresholding (better de-ringing effect, but likely blurrier).
  14379. @item medium
  14380. Set medium thresholding (good results, default).
  14381. @end table
  14382. @end table
  14383. @section premultiply
  14384. Apply alpha premultiply effect to input video stream using first plane
  14385. of second stream as alpha.
  14386. Both streams must have same dimensions and same pixel format.
  14387. The filter accepts the following option:
  14388. @table @option
  14389. @item planes
  14390. Set which planes will be processed, unprocessed planes will be copied.
  14391. By default value 0xf, all planes will be processed.
  14392. @item inplace
  14393. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14394. @end table
  14395. @section prewitt
  14396. Apply prewitt operator to input video stream.
  14397. The filter accepts the following option:
  14398. @table @option
  14399. @item planes
  14400. Set which planes will be processed, unprocessed planes will be copied.
  14401. By default value 0xf, all planes will be processed.
  14402. @item scale
  14403. Set value which will be multiplied with filtered result.
  14404. @item delta
  14405. Set value which will be added to filtered result.
  14406. @end table
  14407. @subsection Commands
  14408. This filter supports the all above options as @ref{commands}.
  14409. @section pseudocolor
  14410. Alter frame colors in video with pseudocolors.
  14411. This filter accepts the following options:
  14412. @table @option
  14413. @item c0
  14414. set pixel first component expression
  14415. @item c1
  14416. set pixel second component expression
  14417. @item c2
  14418. set pixel third component expression
  14419. @item c3
  14420. set pixel fourth component expression, corresponds to the alpha component
  14421. @item index, i
  14422. set component to use as base for altering colors
  14423. @item preset, p
  14424. Pick one of built-in LUTs. By default is set to none.
  14425. Available LUTs:
  14426. @table @samp
  14427. @item magma
  14428. @item inferno
  14429. @item plasma
  14430. @item viridis
  14431. @item turbo
  14432. @item cividis
  14433. @item range1
  14434. @item range2
  14435. @item shadows
  14436. @item highlights
  14437. @item solar
  14438. @item nominal
  14439. @item preferred
  14440. @item total
  14441. @item spectral
  14442. @end table
  14443. @item opacity
  14444. Set opacity of output colors. Allowed range is from 0 to 1.
  14445. Default value is set to 1.
  14446. @end table
  14447. Each of the expression options specifies the expression to use for computing
  14448. the lookup table for the corresponding pixel component values.
  14449. The expressions can contain the following constants and functions:
  14450. @table @option
  14451. @item w
  14452. @item h
  14453. The input width and height.
  14454. @item val
  14455. The input value for the pixel component.
  14456. @item ymin, umin, vmin, amin
  14457. The minimum allowed component value.
  14458. @item ymax, umax, vmax, amax
  14459. The maximum allowed component value.
  14460. @end table
  14461. All expressions default to "val".
  14462. @subsection Commands
  14463. This filter supports the all above options as @ref{commands}.
  14464. @subsection Examples
  14465. @itemize
  14466. @item
  14467. Change too high luma values to gradient:
  14468. @example
  14469. 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'"
  14470. @end example
  14471. @end itemize
  14472. @section psnr
  14473. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  14474. Ratio) between two input videos.
  14475. This filter takes in input two input videos, the first input is
  14476. considered the "main" source and is passed unchanged to the
  14477. output. The second input is used as a "reference" video for computing
  14478. the PSNR.
  14479. Both video inputs must have the same resolution and pixel format for
  14480. this filter to work correctly. Also it assumes that both inputs
  14481. have the same number of frames, which are compared one by one.
  14482. The obtained average PSNR is printed through the logging system.
  14483. The filter stores the accumulated MSE (mean squared error) of each
  14484. frame, and at the end of the processing it is averaged across all frames
  14485. equally, and the following formula is applied to obtain the PSNR:
  14486. @example
  14487. PSNR = 10*log10(MAX^2/MSE)
  14488. @end example
  14489. Where MAX is the average of the maximum values of each component of the
  14490. image.
  14491. The description of the accepted parameters follows.
  14492. @table @option
  14493. @item stats_file, f
  14494. If specified the filter will use the named file to save the PSNR of
  14495. each individual frame. When filename equals "-" the data is sent to
  14496. standard output.
  14497. @item stats_version
  14498. Specifies which version of the stats file format to use. Details of
  14499. each format are written below.
  14500. Default value is 1.
  14501. @item stats_add_max
  14502. Determines whether the max value is output to the stats log.
  14503. Default value is 0.
  14504. Requires stats_version >= 2. If this is set and stats_version < 2,
  14505. the filter will return an error.
  14506. @end table
  14507. This filter also supports the @ref{framesync} options.
  14508. The file printed if @var{stats_file} is selected, contains a sequence of
  14509. key/value pairs of the form @var{key}:@var{value} for each compared
  14510. couple of frames.
  14511. If a @var{stats_version} greater than 1 is specified, a header line precedes
  14512. the list of per-frame-pair stats, with key value pairs following the frame
  14513. format with the following parameters:
  14514. @table @option
  14515. @item psnr_log_version
  14516. The version of the log file format. Will match @var{stats_version}.
  14517. @item fields
  14518. A comma separated list of the per-frame-pair parameters included in
  14519. the log.
  14520. @end table
  14521. A description of each shown per-frame-pair parameter follows:
  14522. @table @option
  14523. @item n
  14524. sequential number of the input frame, starting from 1
  14525. @item mse_avg
  14526. Mean Square Error pixel-by-pixel average difference of the compared
  14527. frames, averaged over all the image components.
  14528. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  14529. Mean Square Error pixel-by-pixel average difference of the compared
  14530. frames for the component specified by the suffix.
  14531. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  14532. Peak Signal to Noise ratio of the compared frames for the component
  14533. specified by the suffix.
  14534. @item max_avg, max_y, max_u, max_v
  14535. Maximum allowed value for each channel, and average over all
  14536. channels.
  14537. @end table
  14538. @subsection Examples
  14539. @itemize
  14540. @item
  14541. For example:
  14542. @example
  14543. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14544. [main][ref] psnr="stats_file=stats.log" [out]
  14545. @end example
  14546. On this example the input file being processed is compared with the
  14547. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  14548. is stored in @file{stats.log}.
  14549. @item
  14550. Another example with different containers:
  14551. @example
  14552. 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 -
  14553. @end example
  14554. @end itemize
  14555. @anchor{pullup}
  14556. @section pullup
  14557. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  14558. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  14559. content.
  14560. The pullup filter is designed to take advantage of future context in making
  14561. its decisions. This filter is stateless in the sense that it does not lock
  14562. onto a pattern to follow, but it instead looks forward to the following
  14563. fields in order to identify matches and rebuild progressive frames.
  14564. To produce content with an even framerate, insert the fps filter after
  14565. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  14566. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  14567. The filter accepts the following options:
  14568. @table @option
  14569. @item jl
  14570. @item jr
  14571. @item jt
  14572. @item jb
  14573. These options set the amount of "junk" to ignore at the left, right, top, and
  14574. bottom of the image, respectively. Left and right are in units of 8 pixels,
  14575. while top and bottom are in units of 2 lines.
  14576. The default is 8 pixels on each side.
  14577. @item sb
  14578. Set the strict breaks. Setting this option to 1 will reduce the chances of
  14579. filter generating an occasional mismatched frame, but it may also cause an
  14580. excessive number of frames to be dropped during high motion sequences.
  14581. Conversely, setting it to -1 will make filter match fields more easily.
  14582. This may help processing of video where there is slight blurring between
  14583. the fields, but may also cause there to be interlaced frames in the output.
  14584. Default value is @code{0}.
  14585. @item mp
  14586. Set the metric plane to use. It accepts the following values:
  14587. @table @samp
  14588. @item l
  14589. Use luma plane.
  14590. @item u
  14591. Use chroma blue plane.
  14592. @item v
  14593. Use chroma red plane.
  14594. @end table
  14595. This option may be set to use chroma plane instead of the default luma plane
  14596. for doing filter's computations. This may improve accuracy on very clean
  14597. source material, but more likely will decrease accuracy, especially if there
  14598. is chroma noise (rainbow effect) or any grayscale video.
  14599. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  14600. load and make pullup usable in realtime on slow machines.
  14601. @end table
  14602. For best results (without duplicated frames in the output file) it is
  14603. necessary to change the output frame rate. For example, to inverse
  14604. telecine NTSC input:
  14605. @example
  14606. ffmpeg -i input -vf pullup -r 24000/1001 ...
  14607. @end example
  14608. @section qp
  14609. Change video quantization parameters (QP).
  14610. The filter accepts the following option:
  14611. @table @option
  14612. @item qp
  14613. Set expression for quantization parameter.
  14614. @end table
  14615. The expression is evaluated through the eval API and can contain, among others,
  14616. the following constants:
  14617. @table @var
  14618. @item known
  14619. 1 if index is not 129, 0 otherwise.
  14620. @item qp
  14621. Sequential index starting from -129 to 128.
  14622. @end table
  14623. @subsection Examples
  14624. @itemize
  14625. @item
  14626. Some equation like:
  14627. @example
  14628. qp=2+2*sin(PI*qp)
  14629. @end example
  14630. @end itemize
  14631. @section random
  14632. Flush video frames from internal cache of frames into a random order.
  14633. No frame is discarded.
  14634. Inspired by @ref{frei0r} nervous filter.
  14635. @table @option
  14636. @item frames
  14637. Set size in number of frames of internal cache, in range from @code{2} to
  14638. @code{512}. Default is @code{30}.
  14639. @item seed
  14640. Set seed for random number generator, must be an integer included between
  14641. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14642. less than @code{0}, the filter will try to use a good random seed on a
  14643. best effort basis.
  14644. @end table
  14645. @section readeia608
  14646. Read closed captioning (EIA-608) information from the top lines of a video frame.
  14647. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  14648. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  14649. with EIA-608 data (starting from 0). A description of each metadata value follows:
  14650. @table @option
  14651. @item lavfi.readeia608.X.cc
  14652. The two bytes stored as EIA-608 data (printed in hexadecimal).
  14653. @item lavfi.readeia608.X.line
  14654. The number of the line on which the EIA-608 data was identified and read.
  14655. @end table
  14656. This filter accepts the following options:
  14657. @table @option
  14658. @item scan_min
  14659. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  14660. @item scan_max
  14661. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  14662. @item spw
  14663. Set the ratio of width reserved for sync code detection.
  14664. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  14665. @item chp
  14666. Enable checking the parity bit. In the event of a parity error, the filter will output
  14667. @code{0x00} for that character. Default is false.
  14668. @item lp
  14669. Lowpass lines prior to further processing. Default is enabled.
  14670. @end table
  14671. @subsection Commands
  14672. This filter supports the all above options as @ref{commands}.
  14673. @subsection Examples
  14674. @itemize
  14675. @item
  14676. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  14677. @example
  14678. 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
  14679. @end example
  14680. @end itemize
  14681. @section readvitc
  14682. Read vertical interval timecode (VITC) information from the top lines of a
  14683. video frame.
  14684. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  14685. timecode value, if a valid timecode has been detected. Further metadata key
  14686. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  14687. timecode data has been found or not.
  14688. This filter accepts the following options:
  14689. @table @option
  14690. @item scan_max
  14691. Set the maximum number of lines to scan for VITC data. If the value is set to
  14692. @code{-1} the full video frame is scanned. Default is @code{45}.
  14693. @item thr_b
  14694. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  14695. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  14696. @item thr_w
  14697. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  14698. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  14699. @end table
  14700. @subsection Examples
  14701. @itemize
  14702. @item
  14703. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  14704. draw @code{--:--:--:--} as a placeholder:
  14705. @example
  14706. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  14707. @end example
  14708. @end itemize
  14709. @section remap
  14710. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  14711. Destination pixel at position (X, Y) will be picked from source (x, y) position
  14712. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  14713. value for pixel will be used for destination pixel.
  14714. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  14715. will have Xmap/Ymap video stream dimensions.
  14716. Xmap and Ymap input video streams are 16bit depth, single channel.
  14717. @table @option
  14718. @item format
  14719. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  14720. Default is @code{color}.
  14721. @item fill
  14722. Specify the color of the unmapped pixels. For the syntax of this option,
  14723. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14724. manual,ffmpeg-utils}. Default color is @code{black}.
  14725. @end table
  14726. @section removegrain
  14727. The removegrain filter is a spatial denoiser for progressive video.
  14728. @table @option
  14729. @item m0
  14730. Set mode for the first plane.
  14731. @item m1
  14732. Set mode for the second plane.
  14733. @item m2
  14734. Set mode for the third plane.
  14735. @item m3
  14736. Set mode for the fourth plane.
  14737. @end table
  14738. Range of mode is from 0 to 24. Description of each mode follows:
  14739. @table @var
  14740. @item 0
  14741. Leave input plane unchanged. Default.
  14742. @item 1
  14743. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  14744. @item 2
  14745. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  14746. @item 3
  14747. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  14748. @item 4
  14749. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  14750. This is equivalent to a median filter.
  14751. @item 5
  14752. Line-sensitive clipping giving the minimal change.
  14753. @item 6
  14754. Line-sensitive clipping, intermediate.
  14755. @item 7
  14756. Line-sensitive clipping, intermediate.
  14757. @item 8
  14758. Line-sensitive clipping, intermediate.
  14759. @item 9
  14760. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  14761. @item 10
  14762. Replaces the target pixel with the closest neighbour.
  14763. @item 11
  14764. [1 2 1] horizontal and vertical kernel blur.
  14765. @item 12
  14766. Same as mode 11.
  14767. @item 13
  14768. Bob mode, interpolates top field from the line where the neighbours
  14769. pixels are the closest.
  14770. @item 14
  14771. Bob mode, interpolates bottom field from the line where the neighbours
  14772. pixels are the closest.
  14773. @item 15
  14774. Bob mode, interpolates top field. Same as 13 but with a more complicated
  14775. interpolation formula.
  14776. @item 16
  14777. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  14778. interpolation formula.
  14779. @item 17
  14780. Clips the pixel with the minimum and maximum of respectively the maximum and
  14781. minimum of each pair of opposite neighbour pixels.
  14782. @item 18
  14783. Line-sensitive clipping using opposite neighbours whose greatest distance from
  14784. the current pixel is minimal.
  14785. @item 19
  14786. Replaces the pixel with the average of its 8 neighbours.
  14787. @item 20
  14788. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  14789. @item 21
  14790. Clips pixels using the averages of opposite neighbour.
  14791. @item 22
  14792. Same as mode 21 but simpler and faster.
  14793. @item 23
  14794. Small edge and halo removal, but reputed useless.
  14795. @item 24
  14796. Similar as 23.
  14797. @end table
  14798. @section removelogo
  14799. Suppress a TV station logo, using an image file to determine which
  14800. pixels comprise the logo. It works by filling in the pixels that
  14801. comprise the logo with neighboring pixels.
  14802. The filter accepts the following options:
  14803. @table @option
  14804. @item filename, f
  14805. Set the filter bitmap file, which can be any image format supported by
  14806. libavformat. The width and height of the image file must match those of the
  14807. video stream being processed.
  14808. @end table
  14809. Pixels in the provided bitmap image with a value of zero are not
  14810. considered part of the logo, non-zero pixels are considered part of
  14811. the logo. If you use white (255) for the logo and black (0) for the
  14812. rest, you will be safe. For making the filter bitmap, it is
  14813. recommended to take a screen capture of a black frame with the logo
  14814. visible, and then using a threshold filter followed by the erode
  14815. filter once or twice.
  14816. If needed, little splotches can be fixed manually. Remember that if
  14817. logo pixels are not covered, the filter quality will be much
  14818. reduced. Marking too many pixels as part of the logo does not hurt as
  14819. much, but it will increase the amount of blurring needed to cover over
  14820. the image and will destroy more information than necessary, and extra
  14821. pixels will slow things down on a large logo.
  14822. @section repeatfields
  14823. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  14824. fields based on its value.
  14825. @section reverse
  14826. Reverse a video clip.
  14827. Warning: This filter requires memory to buffer the entire clip, so trimming
  14828. is suggested.
  14829. @subsection Examples
  14830. @itemize
  14831. @item
  14832. Take the first 5 seconds of a clip, and reverse it.
  14833. @example
  14834. trim=end=5,reverse
  14835. @end example
  14836. @end itemize
  14837. @section rgbashift
  14838. Shift R/G/B/A pixels horizontally and/or vertically.
  14839. The filter accepts the following options:
  14840. @table @option
  14841. @item rh
  14842. Set amount to shift red horizontally.
  14843. @item rv
  14844. Set amount to shift red vertically.
  14845. @item gh
  14846. Set amount to shift green horizontally.
  14847. @item gv
  14848. Set amount to shift green vertically.
  14849. @item bh
  14850. Set amount to shift blue horizontally.
  14851. @item bv
  14852. Set amount to shift blue vertically.
  14853. @item ah
  14854. Set amount to shift alpha horizontally.
  14855. @item av
  14856. Set amount to shift alpha vertically.
  14857. @item edge
  14858. Set edge mode, can be @var{smear}, default, or @var{warp}.
  14859. @end table
  14860. @subsection Commands
  14861. This filter supports the all above options as @ref{commands}.
  14862. @section roberts
  14863. Apply roberts cross operator to input video stream.
  14864. The filter accepts the following option:
  14865. @table @option
  14866. @item planes
  14867. Set which planes will be processed, unprocessed planes will be copied.
  14868. By default value 0xf, all planes will be processed.
  14869. @item scale
  14870. Set value which will be multiplied with filtered result.
  14871. @item delta
  14872. Set value which will be added to filtered result.
  14873. @end table
  14874. @subsection Commands
  14875. This filter supports the all above options as @ref{commands}.
  14876. @section rotate
  14877. Rotate video by an arbitrary angle expressed in radians.
  14878. The filter accepts the following options:
  14879. A description of the optional parameters follows.
  14880. @table @option
  14881. @item angle, a
  14882. Set an expression for the angle by which to rotate the input video
  14883. clockwise, expressed as a number of radians. A negative value will
  14884. result in a counter-clockwise rotation. By default it is set to "0".
  14885. This expression is evaluated for each frame.
  14886. @item out_w, ow
  14887. Set the output width expression, default value is "iw".
  14888. This expression is evaluated just once during configuration.
  14889. @item out_h, oh
  14890. Set the output height expression, default value is "ih".
  14891. This expression is evaluated just once during configuration.
  14892. @item bilinear
  14893. Enable bilinear interpolation if set to 1, a value of 0 disables
  14894. it. Default value is 1.
  14895. @item fillcolor, c
  14896. Set the color used to fill the output area not covered by the rotated
  14897. image. For the general syntax of this option, check the
  14898. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14899. If the special value "none" is selected then no
  14900. background is printed (useful for example if the background is never shown).
  14901. Default value is "black".
  14902. @end table
  14903. The expressions for the angle and the output size can contain the
  14904. following constants and functions:
  14905. @table @option
  14906. @item n
  14907. sequential number of the input frame, starting from 0. It is always NAN
  14908. before the first frame is filtered.
  14909. @item t
  14910. time in seconds of the input frame, it is set to 0 when the filter is
  14911. configured. It is always NAN before the first frame is filtered.
  14912. @item hsub
  14913. @item vsub
  14914. horizontal and vertical chroma subsample values. For example for the
  14915. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14916. @item in_w, iw
  14917. @item in_h, ih
  14918. the input video width and height
  14919. @item out_w, ow
  14920. @item out_h, oh
  14921. the output width and height, that is the size of the padded area as
  14922. specified by the @var{width} and @var{height} expressions
  14923. @item rotw(a)
  14924. @item roth(a)
  14925. the minimal width/height required for completely containing the input
  14926. video rotated by @var{a} radians.
  14927. These are only available when computing the @option{out_w} and
  14928. @option{out_h} expressions.
  14929. @end table
  14930. @subsection Examples
  14931. @itemize
  14932. @item
  14933. Rotate the input by PI/6 radians clockwise:
  14934. @example
  14935. rotate=PI/6
  14936. @end example
  14937. @item
  14938. Rotate the input by PI/6 radians counter-clockwise:
  14939. @example
  14940. rotate=-PI/6
  14941. @end example
  14942. @item
  14943. Rotate the input by 45 degrees clockwise:
  14944. @example
  14945. rotate=45*PI/180
  14946. @end example
  14947. @item
  14948. Apply a constant rotation with period T, starting from an angle of PI/3:
  14949. @example
  14950. rotate=PI/3+2*PI*t/T
  14951. @end example
  14952. @item
  14953. Make the input video rotation oscillating with a period of T
  14954. seconds and an amplitude of A radians:
  14955. @example
  14956. rotate=A*sin(2*PI/T*t)
  14957. @end example
  14958. @item
  14959. Rotate the video, output size is chosen so that the whole rotating
  14960. input video is always completely contained in the output:
  14961. @example
  14962. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  14963. @end example
  14964. @item
  14965. Rotate the video, reduce the output size so that no background is ever
  14966. shown:
  14967. @example
  14968. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  14969. @end example
  14970. @end itemize
  14971. @subsection Commands
  14972. The filter supports the following commands:
  14973. @table @option
  14974. @item a, angle
  14975. Set the angle expression.
  14976. The command accepts the same syntax of the corresponding option.
  14977. If the specified expression is not valid, it is kept at its current
  14978. value.
  14979. @end table
  14980. @section sab
  14981. Apply Shape Adaptive Blur.
  14982. The filter accepts the following options:
  14983. @table @option
  14984. @item luma_radius, lr
  14985. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  14986. value is 1.0. A greater value will result in a more blurred image, and
  14987. in slower processing.
  14988. @item luma_pre_filter_radius, lpfr
  14989. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  14990. value is 1.0.
  14991. @item luma_strength, ls
  14992. Set luma maximum difference between pixels to still be considered, must
  14993. be a value in the 0.1-100.0 range, default value is 1.0.
  14994. @item chroma_radius, cr
  14995. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  14996. greater value will result in a more blurred image, and in slower
  14997. processing.
  14998. @item chroma_pre_filter_radius, cpfr
  14999. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  15000. @item chroma_strength, cs
  15001. Set chroma maximum difference between pixels to still be considered,
  15002. must be a value in the -0.9-100.0 range.
  15003. @end table
  15004. Each chroma option value, if not explicitly specified, is set to the
  15005. corresponding luma option value.
  15006. @anchor{scale}
  15007. @section scale
  15008. Scale (resize) the input video, using the libswscale library.
  15009. The scale filter forces the output display aspect ratio to be the same
  15010. of the input, by changing the output sample aspect ratio.
  15011. If the input image format is different from the format requested by
  15012. the next filter, the scale filter will convert the input to the
  15013. requested format.
  15014. @subsection Options
  15015. The filter accepts the following options, or any of the options
  15016. supported by the libswscale scaler.
  15017. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  15018. the complete list of scaler options.
  15019. @table @option
  15020. @item width, w
  15021. @item height, h
  15022. Set the output video dimension expression. Default value is the input
  15023. dimension.
  15024. If the @var{width} or @var{w} value is 0, the input width is used for
  15025. the output. If the @var{height} or @var{h} value is 0, the input height
  15026. is used for the output.
  15027. If one and only one of the values is -n with n >= 1, the scale filter
  15028. will use a value that maintains the aspect ratio of the input image,
  15029. calculated from the other specified dimension. After that it will,
  15030. however, make sure that the calculated dimension is divisible by n and
  15031. adjust the value if necessary.
  15032. If both values are -n with n >= 1, the behavior will be identical to
  15033. both values being set to 0 as previously detailed.
  15034. See below for the list of accepted constants for use in the dimension
  15035. expression.
  15036. @item eval
  15037. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15038. @table @samp
  15039. @item init
  15040. Only evaluate expressions once during the filter initialization or when a command is processed.
  15041. @item frame
  15042. Evaluate expressions for each incoming frame.
  15043. @end table
  15044. Default value is @samp{init}.
  15045. @item interl
  15046. Set the interlacing mode. It accepts the following values:
  15047. @table @samp
  15048. @item 1
  15049. Force interlaced aware scaling.
  15050. @item 0
  15051. Do not apply interlaced scaling.
  15052. @item -1
  15053. Select interlaced aware scaling depending on whether the source frames
  15054. are flagged as interlaced or not.
  15055. @end table
  15056. Default value is @samp{0}.
  15057. @item flags
  15058. Set libswscale scaling flags. See
  15059. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15060. complete list of values. If not explicitly specified the filter applies
  15061. the default flags.
  15062. @item param0, param1
  15063. Set libswscale input parameters for scaling algorithms that need them. See
  15064. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15065. complete documentation. If not explicitly specified the filter applies
  15066. empty parameters.
  15067. @item size, s
  15068. Set the video size. For the syntax of this option, check the
  15069. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15070. @item in_color_matrix
  15071. @item out_color_matrix
  15072. Set in/output YCbCr color space type.
  15073. This allows the autodetected value to be overridden as well as allows forcing
  15074. a specific value used for the output and encoder.
  15075. If not specified, the color space type depends on the pixel format.
  15076. Possible values:
  15077. @table @samp
  15078. @item auto
  15079. Choose automatically.
  15080. @item bt709
  15081. Format conforming to International Telecommunication Union (ITU)
  15082. Recommendation BT.709.
  15083. @item fcc
  15084. Set color space conforming to the United States Federal Communications
  15085. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  15086. @item bt601
  15087. @item bt470
  15088. @item smpte170m
  15089. Set color space conforming to:
  15090. @itemize
  15091. @item
  15092. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  15093. @item
  15094. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  15095. @item
  15096. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  15097. @end itemize
  15098. @item smpte240m
  15099. Set color space conforming to SMPTE ST 240:1999.
  15100. @item bt2020
  15101. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  15102. @end table
  15103. @item in_range
  15104. @item out_range
  15105. Set in/output YCbCr sample range.
  15106. This allows the autodetected value to be overridden as well as allows forcing
  15107. a specific value used for the output and encoder. If not specified, the
  15108. range depends on the pixel format. Possible values:
  15109. @table @samp
  15110. @item auto/unknown
  15111. Choose automatically.
  15112. @item jpeg/full/pc
  15113. Set full range (0-255 in case of 8-bit luma).
  15114. @item mpeg/limited/tv
  15115. Set "MPEG" range (16-235 in case of 8-bit luma).
  15116. @end table
  15117. @item force_original_aspect_ratio
  15118. Enable decreasing or increasing output video width or height if necessary to
  15119. keep the original aspect ratio. Possible values:
  15120. @table @samp
  15121. @item disable
  15122. Scale the video as specified and disable this feature.
  15123. @item decrease
  15124. The output video dimensions will automatically be decreased if needed.
  15125. @item increase
  15126. The output video dimensions will automatically be increased if needed.
  15127. @end table
  15128. One useful instance of this option is that when you know a specific device's
  15129. maximum allowed resolution, you can use this to limit the output video to
  15130. that, while retaining the aspect ratio. For example, device A allows
  15131. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15132. decrease) and specifying 1280x720 to the command line makes the output
  15133. 1280x533.
  15134. Please note that this is a different thing than specifying -1 for @option{w}
  15135. or @option{h}, you still need to specify the output resolution for this option
  15136. to work.
  15137. @item force_divisible_by
  15138. Ensures that both the output dimensions, width and height, are divisible by the
  15139. given integer when used together with @option{force_original_aspect_ratio}. This
  15140. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15141. This option respects the value set for @option{force_original_aspect_ratio},
  15142. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15143. may be slightly modified.
  15144. This option can be handy if you need to have a video fit within or exceed
  15145. a defined resolution using @option{force_original_aspect_ratio} but also have
  15146. encoder restrictions on width or height divisibility.
  15147. @end table
  15148. The values of the @option{w} and @option{h} options are expressions
  15149. containing the following constants:
  15150. @table @var
  15151. @item in_w
  15152. @item in_h
  15153. The input width and height
  15154. @item iw
  15155. @item ih
  15156. These are the same as @var{in_w} and @var{in_h}.
  15157. @item out_w
  15158. @item out_h
  15159. The output (scaled) width and height
  15160. @item ow
  15161. @item oh
  15162. These are the same as @var{out_w} and @var{out_h}
  15163. @item a
  15164. The same as @var{iw} / @var{ih}
  15165. @item sar
  15166. input sample aspect ratio
  15167. @item dar
  15168. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15169. @item hsub
  15170. @item vsub
  15171. horizontal and vertical input chroma subsample values. For example for the
  15172. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15173. @item ohsub
  15174. @item ovsub
  15175. horizontal and vertical output chroma subsample values. For example for the
  15176. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15177. @item n
  15178. The (sequential) number of the input frame, starting from 0.
  15179. Only available with @code{eval=frame}.
  15180. @item t
  15181. The presentation timestamp of the input frame, expressed as a number of
  15182. seconds. Only available with @code{eval=frame}.
  15183. @item pos
  15184. The position (byte offset) of the frame in the input stream, or NaN if
  15185. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15186. Only available with @code{eval=frame}.
  15187. @end table
  15188. @subsection Examples
  15189. @itemize
  15190. @item
  15191. Scale the input video to a size of 200x100
  15192. @example
  15193. scale=w=200:h=100
  15194. @end example
  15195. This is equivalent to:
  15196. @example
  15197. scale=200:100
  15198. @end example
  15199. or:
  15200. @example
  15201. scale=200x100
  15202. @end example
  15203. @item
  15204. Specify a size abbreviation for the output size:
  15205. @example
  15206. scale=qcif
  15207. @end example
  15208. which can also be written as:
  15209. @example
  15210. scale=size=qcif
  15211. @end example
  15212. @item
  15213. Scale the input to 2x:
  15214. @example
  15215. scale=w=2*iw:h=2*ih
  15216. @end example
  15217. @item
  15218. The above is the same as:
  15219. @example
  15220. scale=2*in_w:2*in_h
  15221. @end example
  15222. @item
  15223. Scale the input to 2x with forced interlaced scaling:
  15224. @example
  15225. scale=2*iw:2*ih:interl=1
  15226. @end example
  15227. @item
  15228. Scale the input to half size:
  15229. @example
  15230. scale=w=iw/2:h=ih/2
  15231. @end example
  15232. @item
  15233. Increase the width, and set the height to the same size:
  15234. @example
  15235. scale=3/2*iw:ow
  15236. @end example
  15237. @item
  15238. Seek Greek harmony:
  15239. @example
  15240. scale=iw:1/PHI*iw
  15241. scale=ih*PHI:ih
  15242. @end example
  15243. @item
  15244. Increase the height, and set the width to 3/2 of the height:
  15245. @example
  15246. scale=w=3/2*oh:h=3/5*ih
  15247. @end example
  15248. @item
  15249. Increase the size, making the size a multiple of the chroma
  15250. subsample values:
  15251. @example
  15252. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  15253. @end example
  15254. @item
  15255. Increase the width to a maximum of 500 pixels,
  15256. keeping the same aspect ratio as the input:
  15257. @example
  15258. scale=w='min(500\, iw*3/2):h=-1'
  15259. @end example
  15260. @item
  15261. Make pixels square by combining scale and setsar:
  15262. @example
  15263. scale='trunc(ih*dar):ih',setsar=1/1
  15264. @end example
  15265. @item
  15266. Make pixels square by combining scale and setsar,
  15267. making sure the resulting resolution is even (required by some codecs):
  15268. @example
  15269. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  15270. @end example
  15271. @end itemize
  15272. @subsection Commands
  15273. This filter supports the following commands:
  15274. @table @option
  15275. @item width, w
  15276. @item height, h
  15277. Set the output video dimension expression.
  15278. The command accepts the same syntax of the corresponding option.
  15279. If the specified expression is not valid, it is kept at its current
  15280. value.
  15281. @end table
  15282. @section scale_cuda
  15283. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  15284. Setting the output width and height works in the same way as for the @ref{scale} filter.
  15285. The filter accepts the following options:
  15286. @table @option
  15287. @item w
  15288. @item h
  15289. Set the output video dimension expression. Default value is the input dimension.
  15290. Allows for the same expressions as the @ref{scale} filter.
  15291. @item interp_algo
  15292. Sets the algorithm used for scaling:
  15293. @table @var
  15294. @item nearest
  15295. Nearest neighbour
  15296. Used by default if input parameters match the desired output.
  15297. @item bilinear
  15298. Bilinear
  15299. @item bicubic
  15300. Bicubic
  15301. This is the default.
  15302. @item lanczos
  15303. Lanczos
  15304. @end table
  15305. @item format
  15306. Controls the output pixel format. By default, or if none is specified, the input
  15307. pixel format is used.
  15308. The filter does not support converting between YUV and RGB pixel formats.
  15309. @item passthrough
  15310. If set to 0, every frame is processed, even if no conversion is neccesary.
  15311. This mode can be useful to use the filter as a buffer for a downstream
  15312. frame-consumer that exhausts the limited decoder frame pool.
  15313. If set to 1, frames are passed through as-is if they match the desired output
  15314. parameters. This is the default behaviour.
  15315. @item param
  15316. Algorithm-Specific parameter.
  15317. Affects the curves of the bicubic algorithm.
  15318. @item force_original_aspect_ratio
  15319. @item force_divisible_by
  15320. Work the same as the identical @ref{scale} filter options.
  15321. @end table
  15322. @subsection Examples
  15323. @itemize
  15324. @item
  15325. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  15326. @example
  15327. scale_cuda=-2:720:format=yuv420p
  15328. @end example
  15329. @item
  15330. Upscale to 4K using nearest neighbour algorithm.
  15331. @example
  15332. scale_cuda=4096:2160:interp_algo=nearest
  15333. @end example
  15334. @item
  15335. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  15336. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  15337. decoders frame pool.
  15338. @example
  15339. scale_cuda=passthrough=0
  15340. @end example
  15341. @end itemize
  15342. @anchor{scale_npp}
  15343. @section scale_npp
  15344. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  15345. format conversion on CUDA video frames. Setting the output width and height
  15346. works in the same way as for the @var{scale} filter.
  15347. The following additional options are accepted:
  15348. @table @option
  15349. @item format
  15350. The pixel format of the output CUDA frames. If set to the string "same" (the
  15351. default), the input format will be kept. Note that automatic format negotiation
  15352. and conversion is not yet supported for hardware frames
  15353. @item interp_algo
  15354. The interpolation algorithm used for resizing. One of the following:
  15355. @table @option
  15356. @item nn
  15357. Nearest neighbour.
  15358. @item linear
  15359. @item cubic
  15360. @item cubic2p_bspline
  15361. 2-parameter cubic (B=1, C=0)
  15362. @item cubic2p_catmullrom
  15363. 2-parameter cubic (B=0, C=1/2)
  15364. @item cubic2p_b05c03
  15365. 2-parameter cubic (B=1/2, C=3/10)
  15366. @item super
  15367. Supersampling
  15368. @item lanczos
  15369. @end table
  15370. @item force_original_aspect_ratio
  15371. Enable decreasing or increasing output video width or height if necessary to
  15372. keep the original aspect ratio. Possible values:
  15373. @table @samp
  15374. @item disable
  15375. Scale the video as specified and disable this feature.
  15376. @item decrease
  15377. The output video dimensions will automatically be decreased if needed.
  15378. @item increase
  15379. The output video dimensions will automatically be increased if needed.
  15380. @end table
  15381. One useful instance of this option is that when you know a specific device's
  15382. maximum allowed resolution, you can use this to limit the output video to
  15383. that, while retaining the aspect ratio. For example, device A allows
  15384. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15385. decrease) and specifying 1280x720 to the command line makes the output
  15386. 1280x533.
  15387. Please note that this is a different thing than specifying -1 for @option{w}
  15388. or @option{h}, you still need to specify the output resolution for this option
  15389. to work.
  15390. @item force_divisible_by
  15391. Ensures that both the output dimensions, width and height, are divisible by the
  15392. given integer when used together with @option{force_original_aspect_ratio}. This
  15393. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15394. This option respects the value set for @option{force_original_aspect_ratio},
  15395. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15396. may be slightly modified.
  15397. This option can be handy if you need to have a video fit within or exceed
  15398. a defined resolution using @option{force_original_aspect_ratio} but also have
  15399. encoder restrictions on width or height divisibility.
  15400. @item eval
  15401. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15402. @table @samp
  15403. @item init
  15404. Only evaluate expressions once during the filter initialization or when a command is processed.
  15405. @item frame
  15406. Evaluate expressions for each incoming frame.
  15407. @end table
  15408. @end table
  15409. The values of the @option{w} and @option{h} options are expressions
  15410. containing the following constants:
  15411. @table @var
  15412. @item in_w
  15413. @item in_h
  15414. The input width and height
  15415. @item iw
  15416. @item ih
  15417. These are the same as @var{in_w} and @var{in_h}.
  15418. @item out_w
  15419. @item out_h
  15420. The output (scaled) width and height
  15421. @item ow
  15422. @item oh
  15423. These are the same as @var{out_w} and @var{out_h}
  15424. @item a
  15425. The same as @var{iw} / @var{ih}
  15426. @item sar
  15427. input sample aspect ratio
  15428. @item dar
  15429. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15430. @item n
  15431. The (sequential) number of the input frame, starting from 0.
  15432. Only available with @code{eval=frame}.
  15433. @item t
  15434. The presentation timestamp of the input frame, expressed as a number of
  15435. seconds. Only available with @code{eval=frame}.
  15436. @item pos
  15437. The position (byte offset) of the frame in the input stream, or NaN if
  15438. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15439. Only available with @code{eval=frame}.
  15440. @end table
  15441. @section scale2ref
  15442. Scale (resize) the input video, based on a reference video.
  15443. See the scale filter for available options, scale2ref supports the same but
  15444. uses the reference video instead of the main input as basis. scale2ref also
  15445. supports the following additional constants for the @option{w} and
  15446. @option{h} options:
  15447. @table @var
  15448. @item main_w
  15449. @item main_h
  15450. The main input video's width and height
  15451. @item main_a
  15452. The same as @var{main_w} / @var{main_h}
  15453. @item main_sar
  15454. The main input video's sample aspect ratio
  15455. @item main_dar, mdar
  15456. The main input video's display aspect ratio. Calculated from
  15457. @code{(main_w / main_h) * main_sar}.
  15458. @item main_hsub
  15459. @item main_vsub
  15460. The main input video's horizontal and vertical chroma subsample values.
  15461. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  15462. is 1.
  15463. @item main_n
  15464. The (sequential) number of the main input frame, starting from 0.
  15465. Only available with @code{eval=frame}.
  15466. @item main_t
  15467. The presentation timestamp of the main input frame, expressed as a number of
  15468. seconds. Only available with @code{eval=frame}.
  15469. @item main_pos
  15470. The position (byte offset) of the frame in the main input stream, or NaN if
  15471. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15472. Only available with @code{eval=frame}.
  15473. @end table
  15474. @subsection Examples
  15475. @itemize
  15476. @item
  15477. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15478. @example
  15479. 'scale2ref[b][a];[a][b]overlay'
  15480. @end example
  15481. @item
  15482. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15483. @example
  15484. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  15485. @end example
  15486. @end itemize
  15487. @subsection Commands
  15488. This filter supports the following commands:
  15489. @table @option
  15490. @item width, w
  15491. @item height, h
  15492. Set the output video dimension expression.
  15493. The command accepts the same syntax of the corresponding option.
  15494. If the specified expression is not valid, it is kept at its current
  15495. value.
  15496. @end table
  15497. @section scale2ref_npp
  15498. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  15499. video, based on a reference video.
  15500. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  15501. but uses the reference video instead of the main input as basis. scale2ref_npp
  15502. also supports the following additional constants for the @option{w} and
  15503. @option{h} options:
  15504. @table @var
  15505. @item main_w
  15506. @item main_h
  15507. The main input video's width and height
  15508. @item main_a
  15509. The same as @var{main_w} / @var{main_h}
  15510. @item main_sar
  15511. The main input video's sample aspect ratio
  15512. @item main_dar, mdar
  15513. The main input video's display aspect ratio. Calculated from
  15514. @code{(main_w / main_h) * main_sar}.
  15515. @item main_n
  15516. The (sequential) number of the main input frame, starting from 0.
  15517. Only available with @code{eval=frame}.
  15518. @item main_t
  15519. The presentation timestamp of the main input frame, expressed as a number of
  15520. seconds. Only available with @code{eval=frame}.
  15521. @item main_pos
  15522. The position (byte offset) of the frame in the main input stream, or NaN if
  15523. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15524. Only available with @code{eval=frame}.
  15525. @end table
  15526. @subsection Examples
  15527. @itemize
  15528. @item
  15529. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15530. @example
  15531. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  15532. @end example
  15533. @item
  15534. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15535. @example
  15536. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  15537. @end example
  15538. @end itemize
  15539. @section scharr
  15540. Apply scharr operator to input video stream.
  15541. The filter accepts the following option:
  15542. @table @option
  15543. @item planes
  15544. Set which planes will be processed, unprocessed planes will be copied.
  15545. By default value 0xf, all planes will be processed.
  15546. @item scale
  15547. Set value which will be multiplied with filtered result.
  15548. @item delta
  15549. Set value which will be added to filtered result.
  15550. @end table
  15551. @subsection Commands
  15552. This filter supports the all above options as @ref{commands}.
  15553. @section scroll
  15554. Scroll input video horizontally and/or vertically by constant speed.
  15555. The filter accepts the following options:
  15556. @table @option
  15557. @item horizontal, h
  15558. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15559. Negative values changes scrolling direction.
  15560. @item vertical, v
  15561. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15562. Negative values changes scrolling direction.
  15563. @item hpos
  15564. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  15565. @item vpos
  15566. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  15567. @end table
  15568. @subsection Commands
  15569. This filter supports the following @ref{commands}:
  15570. @table @option
  15571. @item horizontal, h
  15572. Set the horizontal scrolling speed.
  15573. @item vertical, v
  15574. Set the vertical scrolling speed.
  15575. @end table
  15576. @anchor{scdet}
  15577. @section scdet
  15578. Detect video scene change.
  15579. This filter sets frame metadata with mafd between frame, the scene score, and
  15580. forward the frame to the next filter, so they can use these metadata to detect
  15581. scene change or others.
  15582. In addition, this filter logs a message and sets frame metadata when it detects
  15583. a scene change by @option{threshold}.
  15584. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  15585. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  15586. to detect scene change.
  15587. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  15588. detect scene change with @option{threshold}.
  15589. The filter accepts the following options:
  15590. @table @option
  15591. @item threshold, t
  15592. Set the scene change detection threshold as a percentage of maximum change. Good
  15593. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  15594. @code{[0., 100.]}.
  15595. Default value is @code{10.}.
  15596. @item sc_pass, s
  15597. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  15598. You can enable it if you want to get snapshot of scene change frames only.
  15599. @end table
  15600. @anchor{selectivecolor}
  15601. @section selectivecolor
  15602. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  15603. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  15604. by the "purity" of the color (that is, how saturated it already is).
  15605. This filter is similar to the Adobe Photoshop Selective Color tool.
  15606. The filter accepts the following options:
  15607. @table @option
  15608. @item correction_method
  15609. Select color correction method.
  15610. Available values are:
  15611. @table @samp
  15612. @item absolute
  15613. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  15614. component value).
  15615. @item relative
  15616. Specified adjustments are relative to the original component value.
  15617. @end table
  15618. Default is @code{absolute}.
  15619. @item reds
  15620. Adjustments for red pixels (pixels where the red component is the maximum)
  15621. @item yellows
  15622. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  15623. @item greens
  15624. Adjustments for green pixels (pixels where the green component is the maximum)
  15625. @item cyans
  15626. Adjustments for cyan pixels (pixels where the red component is the minimum)
  15627. @item blues
  15628. Adjustments for blue pixels (pixels where the blue component is the maximum)
  15629. @item magentas
  15630. Adjustments for magenta pixels (pixels where the green component is the minimum)
  15631. @item whites
  15632. Adjustments for white pixels (pixels where all components are greater than 128)
  15633. @item neutrals
  15634. Adjustments for all pixels except pure black and pure white
  15635. @item blacks
  15636. Adjustments for black pixels (pixels where all components are lesser than 128)
  15637. @item psfile
  15638. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  15639. @end table
  15640. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  15641. 4 space separated floating point adjustment values in the [-1,1] range,
  15642. respectively to adjust the amount of cyan, magenta, yellow and black for the
  15643. pixels of its range.
  15644. @subsection Examples
  15645. @itemize
  15646. @item
  15647. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  15648. increase magenta by 27% in blue areas:
  15649. @example
  15650. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  15651. @end example
  15652. @item
  15653. Use a Photoshop selective color preset:
  15654. @example
  15655. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  15656. @end example
  15657. @end itemize
  15658. @anchor{separatefields}
  15659. @section separatefields
  15660. The @code{separatefields} takes a frame-based video input and splits
  15661. each frame into its components fields, producing a new half height clip
  15662. with twice the frame rate and twice the frame count.
  15663. This filter use field-dominance information in frame to decide which
  15664. of each pair of fields to place first in the output.
  15665. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  15666. @section setdar, setsar
  15667. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  15668. output video.
  15669. This is done by changing the specified Sample (aka Pixel) Aspect
  15670. Ratio, according to the following equation:
  15671. @example
  15672. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  15673. @end example
  15674. Keep in mind that the @code{setdar} filter does not modify the pixel
  15675. dimensions of the video frame. Also, the display aspect ratio set by
  15676. this filter may be changed by later filters in the filterchain,
  15677. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  15678. applied.
  15679. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  15680. the filter output video.
  15681. Note that as a consequence of the application of this filter, the
  15682. output display aspect ratio will change according to the equation
  15683. above.
  15684. Keep in mind that the sample aspect ratio set by the @code{setsar}
  15685. filter may be changed by later filters in the filterchain, e.g. if
  15686. another "setsar" or a "setdar" filter is applied.
  15687. It accepts the following parameters:
  15688. @table @option
  15689. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  15690. Set the aspect ratio used by the filter.
  15691. The parameter can be a floating point number string, an expression, or
  15692. a string of the form @var{num}:@var{den}, where @var{num} and
  15693. @var{den} are the numerator and denominator of the aspect ratio. If
  15694. the parameter is not specified, it is assumed the value "0".
  15695. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  15696. should be escaped.
  15697. @item max
  15698. Set the maximum integer value to use for expressing numerator and
  15699. denominator when reducing the expressed aspect ratio to a rational.
  15700. Default value is @code{100}.
  15701. @end table
  15702. The parameter @var{sar} is an expression containing
  15703. the following constants:
  15704. @table @option
  15705. @item E, PI, PHI
  15706. These are approximated values for the mathematical constants e
  15707. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  15708. @item w, h
  15709. The input width and height.
  15710. @item a
  15711. These are the same as @var{w} / @var{h}.
  15712. @item sar
  15713. The input sample aspect ratio.
  15714. @item dar
  15715. The input display aspect ratio. It is the same as
  15716. (@var{w} / @var{h}) * @var{sar}.
  15717. @item hsub, vsub
  15718. Horizontal and vertical chroma subsample values. For example, for the
  15719. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15720. @end table
  15721. @subsection Examples
  15722. @itemize
  15723. @item
  15724. To change the display aspect ratio to 16:9, specify one of the following:
  15725. @example
  15726. setdar=dar=1.77777
  15727. setdar=dar=16/9
  15728. @end example
  15729. @item
  15730. To change the sample aspect ratio to 10:11, specify:
  15731. @example
  15732. setsar=sar=10/11
  15733. @end example
  15734. @item
  15735. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  15736. 1000 in the aspect ratio reduction, use the command:
  15737. @example
  15738. setdar=ratio=16/9:max=1000
  15739. @end example
  15740. @end itemize
  15741. @anchor{setfield}
  15742. @section setfield
  15743. Force field for the output video frame.
  15744. The @code{setfield} filter marks the interlace type field for the
  15745. output frames. It does not change the input frame, but only sets the
  15746. corresponding property, which affects how the frame is treated by
  15747. following filters (e.g. @code{fieldorder} or @code{yadif}).
  15748. The filter accepts the following options:
  15749. @table @option
  15750. @item mode
  15751. Available values are:
  15752. @table @samp
  15753. @item auto
  15754. Keep the same field property.
  15755. @item bff
  15756. Mark the frame as bottom-field-first.
  15757. @item tff
  15758. Mark the frame as top-field-first.
  15759. @item prog
  15760. Mark the frame as progressive.
  15761. @end table
  15762. @end table
  15763. @anchor{setparams}
  15764. @section setparams
  15765. Force frame parameter for the output video frame.
  15766. The @code{setparams} filter marks interlace and color range for the
  15767. output frames. It does not change the input frame, but only sets the
  15768. corresponding property, which affects how the frame is treated by
  15769. filters/encoders.
  15770. @table @option
  15771. @item field_mode
  15772. Available values are:
  15773. @table @samp
  15774. @item auto
  15775. Keep the same field property (default).
  15776. @item bff
  15777. Mark the frame as bottom-field-first.
  15778. @item tff
  15779. Mark the frame as top-field-first.
  15780. @item prog
  15781. Mark the frame as progressive.
  15782. @end table
  15783. @item range
  15784. Available values are:
  15785. @table @samp
  15786. @item auto
  15787. Keep the same color range property (default).
  15788. @item unspecified, unknown
  15789. Mark the frame as unspecified color range.
  15790. @item limited, tv, mpeg
  15791. Mark the frame as limited range.
  15792. @item full, pc, jpeg
  15793. Mark the frame as full range.
  15794. @end table
  15795. @item color_primaries
  15796. Set the color primaries.
  15797. Available values are:
  15798. @table @samp
  15799. @item auto
  15800. Keep the same color primaries property (default).
  15801. @item bt709
  15802. @item unknown
  15803. @item bt470m
  15804. @item bt470bg
  15805. @item smpte170m
  15806. @item smpte240m
  15807. @item film
  15808. @item bt2020
  15809. @item smpte428
  15810. @item smpte431
  15811. @item smpte432
  15812. @item jedec-p22
  15813. @end table
  15814. @item color_trc
  15815. Set the color transfer.
  15816. Available values are:
  15817. @table @samp
  15818. @item auto
  15819. Keep the same color trc property (default).
  15820. @item bt709
  15821. @item unknown
  15822. @item bt470m
  15823. @item bt470bg
  15824. @item smpte170m
  15825. @item smpte240m
  15826. @item linear
  15827. @item log100
  15828. @item log316
  15829. @item iec61966-2-4
  15830. @item bt1361e
  15831. @item iec61966-2-1
  15832. @item bt2020-10
  15833. @item bt2020-12
  15834. @item smpte2084
  15835. @item smpte428
  15836. @item arib-std-b67
  15837. @end table
  15838. @item colorspace
  15839. Set the colorspace.
  15840. Available values are:
  15841. @table @samp
  15842. @item auto
  15843. Keep the same colorspace property (default).
  15844. @item gbr
  15845. @item bt709
  15846. @item unknown
  15847. @item fcc
  15848. @item bt470bg
  15849. @item smpte170m
  15850. @item smpte240m
  15851. @item ycgco
  15852. @item bt2020nc
  15853. @item bt2020c
  15854. @item smpte2085
  15855. @item chroma-derived-nc
  15856. @item chroma-derived-c
  15857. @item ictcp
  15858. @end table
  15859. @end table
  15860. @section sharpen_npp
  15861. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  15862. border control.
  15863. The following additional options are accepted:
  15864. @table @option
  15865. @item border_type
  15866. Type of sampling to be used ad frame borders. One of the following:
  15867. @table @option
  15868. @item replicate
  15869. Replicate pixel values.
  15870. @end table
  15871. @end table
  15872. @section shear
  15873. Apply shear transform to input video.
  15874. This filter supports the following options:
  15875. @table @option
  15876. @item shx
  15877. Shear factor in X-direction. Default value is 0.
  15878. Allowed range is from -2 to 2.
  15879. @item shy
  15880. Shear factor in Y-direction. Default value is 0.
  15881. Allowed range is from -2 to 2.
  15882. @item fillcolor, c
  15883. Set the color used to fill the output area not covered by the transformed
  15884. video. For the general syntax of this option, check the
  15885. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15886. If the special value "none" is selected then no
  15887. background is printed (useful for example if the background is never shown).
  15888. Default value is "black".
  15889. @item interp
  15890. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  15891. @end table
  15892. @subsection Commands
  15893. This filter supports the all above options as @ref{commands}.
  15894. @section showinfo
  15895. Show a line containing various information for each input video frame.
  15896. The input video is not modified.
  15897. This filter supports the following options:
  15898. @table @option
  15899. @item checksum
  15900. Calculate checksums of each plane. By default enabled.
  15901. @end table
  15902. The shown line contains a sequence of key/value pairs of the form
  15903. @var{key}:@var{value}.
  15904. The following values are shown in the output:
  15905. @table @option
  15906. @item n
  15907. The (sequential) number of the input frame, starting from 0.
  15908. @item pts
  15909. The Presentation TimeStamp of the input frame, expressed as a number of
  15910. time base units. The time base unit depends on the filter input pad.
  15911. @item pts_time
  15912. The Presentation TimeStamp of the input frame, expressed as a number of
  15913. seconds.
  15914. @item pos
  15915. The position of the frame in the input stream, or -1 if this information is
  15916. unavailable and/or meaningless (for example in case of synthetic video).
  15917. @item fmt
  15918. The pixel format name.
  15919. @item sar
  15920. The sample aspect ratio of the input frame, expressed in the form
  15921. @var{num}/@var{den}.
  15922. @item s
  15923. The size of the input frame. For the syntax of this option, check the
  15924. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15925. @item i
  15926. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  15927. for bottom field first).
  15928. @item iskey
  15929. This is 1 if the frame is a key frame, 0 otherwise.
  15930. @item type
  15931. The picture type of the input frame ("I" for an I-frame, "P" for a
  15932. P-frame, "B" for a B-frame, or "?" for an unknown type).
  15933. Also refer to the documentation of the @code{AVPictureType} enum and of
  15934. the @code{av_get_picture_type_char} function defined in
  15935. @file{libavutil/avutil.h}.
  15936. @item checksum
  15937. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  15938. @item plane_checksum
  15939. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  15940. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  15941. @item mean
  15942. The mean value of pixels in each plane of the input frame, expressed in the form
  15943. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  15944. @item stdev
  15945. The standard deviation of pixel values in each plane of the input frame, expressed
  15946. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  15947. @end table
  15948. @section showpalette
  15949. Displays the 256 colors palette of each frame. This filter is only relevant for
  15950. @var{pal8} pixel format frames.
  15951. It accepts the following option:
  15952. @table @option
  15953. @item s
  15954. Set the size of the box used to represent one palette color entry. Default is
  15955. @code{30} (for a @code{30x30} pixel box).
  15956. @end table
  15957. @section shuffleframes
  15958. Reorder and/or duplicate and/or drop video frames.
  15959. It accepts the following parameters:
  15960. @table @option
  15961. @item mapping
  15962. Set the destination indexes of input frames.
  15963. This is space or '|' separated list of indexes that maps input frames to output
  15964. frames. Number of indexes also sets maximal value that each index may have.
  15965. '-1' index have special meaning and that is to drop frame.
  15966. @end table
  15967. The first frame has the index 0. The default is to keep the input unchanged.
  15968. @subsection Examples
  15969. @itemize
  15970. @item
  15971. Swap second and third frame of every three frames of the input:
  15972. @example
  15973. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  15974. @end example
  15975. @item
  15976. Swap 10th and 1st frame of every ten frames of the input:
  15977. @example
  15978. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  15979. @end example
  15980. @end itemize
  15981. @section shufflepixels
  15982. Reorder pixels in video frames.
  15983. This filter accepts the following options:
  15984. @table @option
  15985. @item direction, d
  15986. Set shuffle direction. Can be forward or inverse direction.
  15987. Default direction is forward.
  15988. @item mode, m
  15989. Set shuffle mode. Can be horizontal, vertical or block mode.
  15990. @item width, w
  15991. @item height, h
  15992. Set shuffle block_size. In case of horizontal shuffle mode only width
  15993. part of size is used, and in case of vertical shuffle mode only height
  15994. part of size is used.
  15995. @item seed, s
  15996. Set random seed used with shuffling pixels. Mainly useful to set to be able
  15997. to reverse filtering process to get original input.
  15998. For example, to reverse forward shuffle you need to use same parameters
  15999. and exact same seed and to set direction to inverse.
  16000. @end table
  16001. @section shuffleplanes
  16002. Reorder and/or duplicate video planes.
  16003. It accepts the following parameters:
  16004. @table @option
  16005. @item map0
  16006. The index of the input plane to be used as the first output plane.
  16007. @item map1
  16008. The index of the input plane to be used as the second output plane.
  16009. @item map2
  16010. The index of the input plane to be used as the third output plane.
  16011. @item map3
  16012. The index of the input plane to be used as the fourth output plane.
  16013. @end table
  16014. The first plane has the index 0. The default is to keep the input unchanged.
  16015. @subsection Examples
  16016. @itemize
  16017. @item
  16018. Swap the second and third planes of the input:
  16019. @example
  16020. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  16021. @end example
  16022. @end itemize
  16023. @anchor{signalstats}
  16024. @section signalstats
  16025. Evaluate various visual metrics that assist in determining issues associated
  16026. with the digitization of analog video media.
  16027. By default the filter will log these metadata values:
  16028. @table @option
  16029. @item YMIN
  16030. Display the minimal Y value contained within the input frame. Expressed in
  16031. range of [0-255].
  16032. @item YLOW
  16033. Display the Y value at the 10% percentile within the input frame. Expressed in
  16034. range of [0-255].
  16035. @item YAVG
  16036. Display the average Y value within the input frame. Expressed in range of
  16037. [0-255].
  16038. @item YHIGH
  16039. Display the Y value at the 90% percentile within the input frame. Expressed in
  16040. range of [0-255].
  16041. @item YMAX
  16042. Display the maximum Y value contained within the input frame. Expressed in
  16043. range of [0-255].
  16044. @item UMIN
  16045. Display the minimal U value contained within the input frame. Expressed in
  16046. range of [0-255].
  16047. @item ULOW
  16048. Display the U value at the 10% percentile within the input frame. Expressed in
  16049. range of [0-255].
  16050. @item UAVG
  16051. Display the average U value within the input frame. Expressed in range of
  16052. [0-255].
  16053. @item UHIGH
  16054. Display the U value at the 90% percentile within the input frame. Expressed in
  16055. range of [0-255].
  16056. @item UMAX
  16057. Display the maximum U value contained within the input frame. Expressed in
  16058. range of [0-255].
  16059. @item VMIN
  16060. Display the minimal V value contained within the input frame. Expressed in
  16061. range of [0-255].
  16062. @item VLOW
  16063. Display the V value at the 10% percentile within the input frame. Expressed in
  16064. range of [0-255].
  16065. @item VAVG
  16066. Display the average V value within the input frame. Expressed in range of
  16067. [0-255].
  16068. @item VHIGH
  16069. Display the V value at the 90% percentile within the input frame. Expressed in
  16070. range of [0-255].
  16071. @item VMAX
  16072. Display the maximum V value contained within the input frame. Expressed in
  16073. range of [0-255].
  16074. @item SATMIN
  16075. Display the minimal saturation value contained within the input frame.
  16076. Expressed in range of [0-~181.02].
  16077. @item SATLOW
  16078. Display the saturation value at the 10% percentile within the input frame.
  16079. Expressed in range of [0-~181.02].
  16080. @item SATAVG
  16081. Display the average saturation value within the input frame. Expressed in range
  16082. of [0-~181.02].
  16083. @item SATHIGH
  16084. Display the saturation value at the 90% percentile within the input frame.
  16085. Expressed in range of [0-~181.02].
  16086. @item SATMAX
  16087. Display the maximum saturation value contained within the input frame.
  16088. Expressed in range of [0-~181.02].
  16089. @item HUEMED
  16090. Display the median value for hue within the input frame. Expressed in range of
  16091. [0-360].
  16092. @item HUEAVG
  16093. Display the average value for hue within the input frame. Expressed in range of
  16094. [0-360].
  16095. @item YDIF
  16096. Display the average of sample value difference between all values of the Y
  16097. plane in the current frame and corresponding values of the previous input frame.
  16098. Expressed in range of [0-255].
  16099. @item UDIF
  16100. Display the average of sample value difference between all values of the U
  16101. plane in the current frame and corresponding values of the previous input frame.
  16102. Expressed in range of [0-255].
  16103. @item VDIF
  16104. Display the average of sample value difference between all values of the V
  16105. plane in the current frame and corresponding values of the previous input frame.
  16106. Expressed in range of [0-255].
  16107. @item YBITDEPTH
  16108. Display bit depth of Y plane in current frame.
  16109. Expressed in range of [0-16].
  16110. @item UBITDEPTH
  16111. Display bit depth of U plane in current frame.
  16112. Expressed in range of [0-16].
  16113. @item VBITDEPTH
  16114. Display bit depth of V plane in current frame.
  16115. Expressed in range of [0-16].
  16116. @end table
  16117. The filter accepts the following options:
  16118. @table @option
  16119. @item stat
  16120. @item out
  16121. @option{stat} specify an additional form of image analysis.
  16122. @option{out} output video with the specified type of pixel highlighted.
  16123. Both options accept the following values:
  16124. @table @samp
  16125. @item tout
  16126. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  16127. unlike the neighboring pixels of the same field. Examples of temporal outliers
  16128. include the results of video dropouts, head clogs, or tape tracking issues.
  16129. @item vrep
  16130. Identify @var{vertical line repetition}. Vertical line repetition includes
  16131. similar rows of pixels within a frame. In born-digital video vertical line
  16132. repetition is common, but this pattern is uncommon in video digitized from an
  16133. analog source. When it occurs in video that results from the digitization of an
  16134. analog source it can indicate concealment from a dropout compensator.
  16135. @item brng
  16136. Identify pixels that fall outside of legal broadcast range.
  16137. @end table
  16138. @item color, c
  16139. Set the highlight color for the @option{out} option. The default color is
  16140. yellow.
  16141. @end table
  16142. @subsection Examples
  16143. @itemize
  16144. @item
  16145. Output data of various video metrics:
  16146. @example
  16147. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  16148. @end example
  16149. @item
  16150. Output specific data about the minimum and maximum values of the Y plane per frame:
  16151. @example
  16152. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  16153. @end example
  16154. @item
  16155. Playback video while highlighting pixels that are outside of broadcast range in red.
  16156. @example
  16157. ffplay example.mov -vf signalstats="out=brng:color=red"
  16158. @end example
  16159. @item
  16160. Playback video with signalstats metadata drawn over the frame.
  16161. @example
  16162. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  16163. @end example
  16164. The contents of signalstat_drawtext.txt used in the command are:
  16165. @example
  16166. time %@{pts:hms@}
  16167. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  16168. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  16169. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  16170. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  16171. @end example
  16172. @end itemize
  16173. @anchor{signature}
  16174. @section signature
  16175. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  16176. input. In this case the matching between the inputs can be calculated additionally.
  16177. The filter always passes through the first input. The signature of each stream can
  16178. be written into a file.
  16179. It accepts the following options:
  16180. @table @option
  16181. @item detectmode
  16182. Enable or disable the matching process.
  16183. Available values are:
  16184. @table @samp
  16185. @item off
  16186. Disable the calculation of a matching (default).
  16187. @item full
  16188. Calculate the matching for the whole video and output whether the whole video
  16189. matches or only parts.
  16190. @item fast
  16191. Calculate only until a matching is found or the video ends. Should be faster in
  16192. some cases.
  16193. @end table
  16194. @item nb_inputs
  16195. Set the number of inputs. The option value must be a non negative integer.
  16196. Default value is 1.
  16197. @item filename
  16198. Set the path to which the output is written. If there is more than one input,
  16199. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  16200. integer), that will be replaced with the input number. If no filename is
  16201. specified, no output will be written. This is the default.
  16202. @item format
  16203. Choose the output format.
  16204. Available values are:
  16205. @table @samp
  16206. @item binary
  16207. Use the specified binary representation (default).
  16208. @item xml
  16209. Use the specified xml representation.
  16210. @end table
  16211. @item th_d
  16212. Set threshold to detect one word as similar. The option value must be an integer
  16213. greater than zero. The default value is 9000.
  16214. @item th_dc
  16215. Set threshold to detect all words as similar. The option value must be an integer
  16216. greater than zero. The default value is 60000.
  16217. @item th_xh
  16218. Set threshold to detect frames as similar. The option value must be an integer
  16219. greater than zero. The default value is 116.
  16220. @item th_di
  16221. Set the minimum length of a sequence in frames to recognize it as matching
  16222. sequence. The option value must be a non negative integer value.
  16223. The default value is 0.
  16224. @item th_it
  16225. Set the minimum relation, that matching frames to all frames must have.
  16226. The option value must be a double value between 0 and 1. The default value is 0.5.
  16227. @end table
  16228. @subsection Examples
  16229. @itemize
  16230. @item
  16231. To calculate the signature of an input video and store it in signature.bin:
  16232. @example
  16233. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  16234. @end example
  16235. @item
  16236. To detect whether two videos match and store the signatures in XML format in
  16237. signature0.xml and signature1.xml:
  16238. @example
  16239. 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 -
  16240. @end example
  16241. @end itemize
  16242. @anchor{siti}
  16243. @section siti
  16244. Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as defined
  16245. in ITU-T P.910: Subjective video quality assessment methods for multimedia
  16246. applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
  16247. It accepts the following option:
  16248. @table @option
  16249. @item print_summary
  16250. If set to 1, Summary statistics will be printed to the console. Default 0.
  16251. @end table
  16252. @subsection Examples
  16253. @itemize
  16254. @item
  16255. To calculate SI/TI metrics and print summary:
  16256. @example
  16257. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  16258. @end example
  16259. @end itemize
  16260. @anchor{smartblur}
  16261. @section smartblur
  16262. Blur the input video without impacting the outlines.
  16263. It accepts the following options:
  16264. @table @option
  16265. @item luma_radius, lr
  16266. Set the luma radius. The option value must be a float number in
  16267. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16268. used to blur the image (slower if larger). Default value is 1.0.
  16269. @item luma_strength, ls
  16270. Set the luma strength. The option value must be a float number
  16271. in the range [-1.0,1.0] that configures the blurring. A value included
  16272. in [0.0,1.0] will blur the image whereas a value included in
  16273. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  16274. @item luma_threshold, lt
  16275. Set the luma threshold used as a coefficient to determine
  16276. whether a pixel should be blurred or not. The option value must be an
  16277. integer in the range [-30,30]. A value of 0 will filter all the image,
  16278. a value included in [0,30] will filter flat areas and a value included
  16279. in [-30,0] will filter edges. Default value is 0.
  16280. @item chroma_radius, cr
  16281. Set the chroma radius. The option value must be a float number in
  16282. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16283. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  16284. @item chroma_strength, cs
  16285. Set the chroma strength. The option value must be a float number
  16286. in the range [-1.0,1.0] that configures the blurring. A value included
  16287. in [0.0,1.0] will blur the image whereas a value included in
  16288. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  16289. @item chroma_threshold, ct
  16290. Set the chroma threshold used as a coefficient to determine
  16291. whether a pixel should be blurred or not. The option value must be an
  16292. integer in the range [-30,30]. A value of 0 will filter all the image,
  16293. a value included in [0,30] will filter flat areas and a value included
  16294. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  16295. @end table
  16296. If a chroma option is not explicitly set, the corresponding luma value
  16297. is set.
  16298. @section sobel
  16299. Apply sobel operator to input video stream.
  16300. The filter accepts the following option:
  16301. @table @option
  16302. @item planes
  16303. Set which planes will be processed, unprocessed planes will be copied.
  16304. By default value 0xf, all planes will be processed.
  16305. @item scale
  16306. Set value which will be multiplied with filtered result.
  16307. @item delta
  16308. Set value which will be added to filtered result.
  16309. @end table
  16310. @subsection Commands
  16311. This filter supports the all above options as @ref{commands}.
  16312. @anchor{spp}
  16313. @section spp
  16314. Apply a simple postprocessing filter that compresses and decompresses the image
  16315. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  16316. and average the results.
  16317. The filter accepts the following options:
  16318. @table @option
  16319. @item quality
  16320. Set quality. This option defines the number of levels for averaging. It accepts
  16321. an integer in the range 0-6. If set to @code{0}, the filter will have no
  16322. effect. A value of @code{6} means the higher quality. For each increment of
  16323. that value the speed drops by a factor of approximately 2. Default value is
  16324. @code{3}.
  16325. @item qp
  16326. Force a constant quantization parameter. If not set, the filter will use the QP
  16327. from the video stream (if available).
  16328. @item mode
  16329. Set thresholding mode. Available modes are:
  16330. @table @samp
  16331. @item hard
  16332. Set hard thresholding (default).
  16333. @item soft
  16334. Set soft thresholding (better de-ringing effect, but likely blurrier).
  16335. @end table
  16336. @item use_bframe_qp
  16337. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  16338. option may cause flicker since the B-Frames have often larger QP. Default is
  16339. @code{0} (not enabled).
  16340. @end table
  16341. @subsection Commands
  16342. This filter supports the following commands:
  16343. @table @option
  16344. @item quality, level
  16345. Set quality level. The value @code{max} can be used to set the maximum level,
  16346. currently @code{6}.
  16347. @end table
  16348. @anchor{sr}
  16349. @section sr
  16350. Scale the input by applying one of the super-resolution methods based on
  16351. convolutional neural networks. Supported models:
  16352. @itemize
  16353. @item
  16354. Super-Resolution Convolutional Neural Network model (SRCNN).
  16355. See @url{https://arxiv.org/abs/1501.00092}.
  16356. @item
  16357. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  16358. See @url{https://arxiv.org/abs/1609.05158}.
  16359. @end itemize
  16360. Training scripts as well as scripts for model file (.pb) saving can be found at
  16361. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  16362. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  16363. Native model files (.model) can be generated from TensorFlow model
  16364. files (.pb) by using tools/python/convert.py
  16365. The filter accepts the following options:
  16366. @table @option
  16367. @item dnn_backend
  16368. Specify which DNN backend to use for model loading and execution. This option accepts
  16369. the following values:
  16370. @table @samp
  16371. @item native
  16372. Native implementation of DNN loading and execution.
  16373. @item tensorflow
  16374. TensorFlow backend. To enable this backend you
  16375. need to install the TensorFlow for C library (see
  16376. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  16377. @code{--enable-libtensorflow}
  16378. @end table
  16379. Default value is @samp{native}.
  16380. @item model
  16381. Set path to model file specifying network architecture and its parameters.
  16382. Note that different backends use different file formats. TensorFlow backend
  16383. can load files for both formats, while native backend can load files for only
  16384. its format.
  16385. @item scale_factor
  16386. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  16387. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  16388. input upscaled using bicubic upscaling with proper scale factor.
  16389. @end table
  16390. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  16391. @section ssim
  16392. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  16393. This filter takes in input two input videos, the first input is
  16394. considered the "main" source and is passed unchanged to the
  16395. output. The second input is used as a "reference" video for computing
  16396. the SSIM.
  16397. Both video inputs must have the same resolution and pixel format for
  16398. this filter to work correctly. Also it assumes that both inputs
  16399. have the same number of frames, which are compared one by one.
  16400. The filter stores the calculated SSIM of each frame.
  16401. The description of the accepted parameters follows.
  16402. @table @option
  16403. @item stats_file, f
  16404. If specified the filter will use the named file to save the SSIM of
  16405. each individual frame. When filename equals "-" the data is sent to
  16406. standard output.
  16407. @end table
  16408. The file printed if @var{stats_file} is selected, contains a sequence of
  16409. key/value pairs of the form @var{key}:@var{value} for each compared
  16410. couple of frames.
  16411. A description of each shown parameter follows:
  16412. @table @option
  16413. @item n
  16414. sequential number of the input frame, starting from 1
  16415. @item Y, U, V, R, G, B
  16416. SSIM of the compared frames for the component specified by the suffix.
  16417. @item All
  16418. SSIM of the compared frames for the whole frame.
  16419. @item dB
  16420. Same as above but in dB representation.
  16421. @end table
  16422. This filter also supports the @ref{framesync} options.
  16423. @subsection Examples
  16424. @itemize
  16425. @item
  16426. For example:
  16427. @example
  16428. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  16429. [main][ref] ssim="stats_file=stats.log" [out]
  16430. @end example
  16431. On this example the input file being processed is compared with the
  16432. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  16433. is stored in @file{stats.log}.
  16434. @item
  16435. Another example with both psnr and ssim at same time:
  16436. @example
  16437. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  16438. @end example
  16439. @item
  16440. Another example with different containers:
  16441. @example
  16442. 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 -
  16443. @end example
  16444. @end itemize
  16445. @section stereo3d
  16446. Convert between different stereoscopic image formats.
  16447. The filters accept the following options:
  16448. @table @option
  16449. @item in
  16450. Set stereoscopic image format of input.
  16451. Available values for input image formats are:
  16452. @table @samp
  16453. @item sbsl
  16454. side by side parallel (left eye left, right eye right)
  16455. @item sbsr
  16456. side by side crosseye (right eye left, left eye right)
  16457. @item sbs2l
  16458. side by side parallel with half width resolution
  16459. (left eye left, right eye right)
  16460. @item sbs2r
  16461. side by side crosseye with half width resolution
  16462. (right eye left, left eye right)
  16463. @item abl
  16464. @item tbl
  16465. above-below (left eye above, right eye below)
  16466. @item abr
  16467. @item tbr
  16468. above-below (right eye above, left eye below)
  16469. @item ab2l
  16470. @item tb2l
  16471. above-below with half height resolution
  16472. (left eye above, right eye below)
  16473. @item ab2r
  16474. @item tb2r
  16475. above-below with half height resolution
  16476. (right eye above, left eye below)
  16477. @item al
  16478. alternating frames (left eye first, right eye second)
  16479. @item ar
  16480. alternating frames (right eye first, left eye second)
  16481. @item irl
  16482. interleaved rows (left eye has top row, right eye starts on next row)
  16483. @item irr
  16484. interleaved rows (right eye has top row, left eye starts on next row)
  16485. @item icl
  16486. interleaved columns, left eye first
  16487. @item icr
  16488. interleaved columns, right eye first
  16489. Default value is @samp{sbsl}.
  16490. @end table
  16491. @item out
  16492. Set stereoscopic image format of output.
  16493. @table @samp
  16494. @item sbsl
  16495. side by side parallel (left eye left, right eye right)
  16496. @item sbsr
  16497. side by side crosseye (right eye left, left eye right)
  16498. @item sbs2l
  16499. side by side parallel with half width resolution
  16500. (left eye left, right eye right)
  16501. @item sbs2r
  16502. side by side crosseye with half width resolution
  16503. (right eye left, left eye right)
  16504. @item abl
  16505. @item tbl
  16506. above-below (left eye above, right eye below)
  16507. @item abr
  16508. @item tbr
  16509. above-below (right eye above, left eye below)
  16510. @item ab2l
  16511. @item tb2l
  16512. above-below with half height resolution
  16513. (left eye above, right eye below)
  16514. @item ab2r
  16515. @item tb2r
  16516. above-below with half height resolution
  16517. (right eye above, left eye below)
  16518. @item al
  16519. alternating frames (left eye first, right eye second)
  16520. @item ar
  16521. alternating frames (right eye first, left eye second)
  16522. @item irl
  16523. interleaved rows (left eye has top row, right eye starts on next row)
  16524. @item irr
  16525. interleaved rows (right eye has top row, left eye starts on next row)
  16526. @item arbg
  16527. anaglyph red/blue gray
  16528. (red filter on left eye, blue filter on right eye)
  16529. @item argg
  16530. anaglyph red/green gray
  16531. (red filter on left eye, green filter on right eye)
  16532. @item arcg
  16533. anaglyph red/cyan gray
  16534. (red filter on left eye, cyan filter on right eye)
  16535. @item arch
  16536. anaglyph red/cyan half colored
  16537. (red filter on left eye, cyan filter on right eye)
  16538. @item arcc
  16539. anaglyph red/cyan color
  16540. (red filter on left eye, cyan filter on right eye)
  16541. @item arcd
  16542. anaglyph red/cyan color optimized with the least squares projection of dubois
  16543. (red filter on left eye, cyan filter on right eye)
  16544. @item agmg
  16545. anaglyph green/magenta gray
  16546. (green filter on left eye, magenta filter on right eye)
  16547. @item agmh
  16548. anaglyph green/magenta half colored
  16549. (green filter on left eye, magenta filter on right eye)
  16550. @item agmc
  16551. anaglyph green/magenta colored
  16552. (green filter on left eye, magenta filter on right eye)
  16553. @item agmd
  16554. anaglyph green/magenta color optimized with the least squares projection of dubois
  16555. (green filter on left eye, magenta filter on right eye)
  16556. @item aybg
  16557. anaglyph yellow/blue gray
  16558. (yellow filter on left eye, blue filter on right eye)
  16559. @item aybh
  16560. anaglyph yellow/blue half colored
  16561. (yellow filter on left eye, blue filter on right eye)
  16562. @item aybc
  16563. anaglyph yellow/blue colored
  16564. (yellow filter on left eye, blue filter on right eye)
  16565. @item aybd
  16566. anaglyph yellow/blue color optimized with the least squares projection of dubois
  16567. (yellow filter on left eye, blue filter on right eye)
  16568. @item ml
  16569. mono output (left eye only)
  16570. @item mr
  16571. mono output (right eye only)
  16572. @item chl
  16573. checkerboard, left eye first
  16574. @item chr
  16575. checkerboard, right eye first
  16576. @item icl
  16577. interleaved columns, left eye first
  16578. @item icr
  16579. interleaved columns, right eye first
  16580. @item hdmi
  16581. HDMI frame pack
  16582. @end table
  16583. Default value is @samp{arcd}.
  16584. @end table
  16585. @subsection Examples
  16586. @itemize
  16587. @item
  16588. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  16589. @example
  16590. stereo3d=sbsl:aybd
  16591. @end example
  16592. @item
  16593. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  16594. @example
  16595. stereo3d=abl:sbsr
  16596. @end example
  16597. @end itemize
  16598. @section streamselect, astreamselect
  16599. Select video or audio streams.
  16600. The filter accepts the following options:
  16601. @table @option
  16602. @item inputs
  16603. Set number of inputs. Default is 2.
  16604. @item map
  16605. Set input indexes to remap to outputs.
  16606. @end table
  16607. @subsection Commands
  16608. The @code{streamselect} and @code{astreamselect} filter supports the following
  16609. commands:
  16610. @table @option
  16611. @item map
  16612. Set input indexes to remap to outputs.
  16613. @end table
  16614. @subsection Examples
  16615. @itemize
  16616. @item
  16617. Select first 5 seconds 1st stream and rest of time 2nd stream:
  16618. @example
  16619. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  16620. @end example
  16621. @item
  16622. Same as above, but for audio:
  16623. @example
  16624. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  16625. @end example
  16626. @end itemize
  16627. @anchor{subtitles}
  16628. @section subtitles
  16629. Draw subtitles on top of input video using the libass library.
  16630. To enable compilation of this filter you need to configure FFmpeg with
  16631. @code{--enable-libass}. This filter also requires a build with libavcodec and
  16632. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  16633. Alpha) subtitles format.
  16634. The filter accepts the following options:
  16635. @table @option
  16636. @item filename, f
  16637. Set the filename of the subtitle file to read. It must be specified.
  16638. @item original_size
  16639. Specify the size of the original video, the video for which the ASS file
  16640. was composed. For the syntax of this option, check the
  16641. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16642. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  16643. correctly scale the fonts if the aspect ratio has been changed.
  16644. @item fontsdir
  16645. Set a directory path containing fonts that can be used by the filter.
  16646. These fonts will be used in addition to whatever the font provider uses.
  16647. @item alpha
  16648. Process alpha channel, by default alpha channel is untouched.
  16649. @item charenc
  16650. Set subtitles input character encoding. @code{subtitles} filter only. Only
  16651. useful if not UTF-8.
  16652. @item stream_index, si
  16653. Set subtitles stream index. @code{subtitles} filter only.
  16654. @item force_style
  16655. Override default style or script info parameters of the subtitles. It accepts a
  16656. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  16657. @end table
  16658. If the first key is not specified, it is assumed that the first value
  16659. specifies the @option{filename}.
  16660. For example, to render the file @file{sub.srt} on top of the input
  16661. video, use the command:
  16662. @example
  16663. subtitles=sub.srt
  16664. @end example
  16665. which is equivalent to:
  16666. @example
  16667. subtitles=filename=sub.srt
  16668. @end example
  16669. To render the default subtitles stream from file @file{video.mkv}, use:
  16670. @example
  16671. subtitles=video.mkv
  16672. @end example
  16673. To render the second subtitles stream from that file, use:
  16674. @example
  16675. subtitles=video.mkv:si=1
  16676. @end example
  16677. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  16678. @code{DejaVu Serif}, use:
  16679. @example
  16680. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  16681. @end example
  16682. @section super2xsai
  16683. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  16684. Interpolate) pixel art scaling algorithm.
  16685. Useful for enlarging pixel art images without reducing sharpness.
  16686. @section swaprect
  16687. Swap two rectangular objects in video.
  16688. This filter accepts the following options:
  16689. @table @option
  16690. @item w
  16691. Set object width.
  16692. @item h
  16693. Set object height.
  16694. @item x1
  16695. Set 1st rect x coordinate.
  16696. @item y1
  16697. Set 1st rect y coordinate.
  16698. @item x2
  16699. Set 2nd rect x coordinate.
  16700. @item y2
  16701. Set 2nd rect y coordinate.
  16702. All expressions are evaluated once for each frame.
  16703. @end table
  16704. The all options are expressions containing the following constants:
  16705. @table @option
  16706. @item w
  16707. @item h
  16708. The input width and height.
  16709. @item a
  16710. same as @var{w} / @var{h}
  16711. @item sar
  16712. input sample aspect ratio
  16713. @item dar
  16714. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  16715. @item n
  16716. The number of the input frame, starting from 0.
  16717. @item t
  16718. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16719. @item pos
  16720. the position in the file of the input frame, NAN if unknown
  16721. @end table
  16722. @subsection Commands
  16723. This filter supports the all above options as @ref{commands}.
  16724. @section swapuv
  16725. Swap U & V plane.
  16726. @section tblend
  16727. Blend successive video frames.
  16728. See @ref{blend}
  16729. @section telecine
  16730. Apply telecine process to the video.
  16731. This filter accepts the following options:
  16732. @table @option
  16733. @item first_field
  16734. @table @samp
  16735. @item top, t
  16736. top field first
  16737. @item bottom, b
  16738. bottom field first
  16739. The default value is @code{top}.
  16740. @end table
  16741. @item pattern
  16742. A string of numbers representing the pulldown pattern you wish to apply.
  16743. The default value is @code{23}.
  16744. @end table
  16745. @example
  16746. Some typical patterns:
  16747. NTSC output (30i):
  16748. 27.5p: 32222
  16749. 24p: 23 (classic)
  16750. 24p: 2332 (preferred)
  16751. 20p: 33
  16752. 18p: 334
  16753. 16p: 3444
  16754. PAL output (25i):
  16755. 27.5p: 12222
  16756. 24p: 222222222223 ("Euro pulldown")
  16757. 16.67p: 33
  16758. 16p: 33333334
  16759. @end example
  16760. @section thistogram
  16761. Compute and draw a color distribution histogram for the input video across time.
  16762. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  16763. at certain time, this filter shows also past histograms of number of frames defined
  16764. by @code{width} option.
  16765. The computed histogram is a representation of the color component
  16766. distribution in an image.
  16767. The filter accepts the following options:
  16768. @table @option
  16769. @item width, w
  16770. Set width of single color component output. Default value is @code{0}.
  16771. Value of @code{0} means width will be picked from input video.
  16772. This also set number of passed histograms to keep.
  16773. Allowed range is [0, 8192].
  16774. @item display_mode, d
  16775. Set display mode.
  16776. It accepts the following values:
  16777. @table @samp
  16778. @item stack
  16779. Per color component graphs are placed below each other.
  16780. @item parade
  16781. Per color component graphs are placed side by side.
  16782. @item overlay
  16783. Presents information identical to that in the @code{parade}, except
  16784. that the graphs representing color components are superimposed directly
  16785. over one another.
  16786. @end table
  16787. Default is @code{stack}.
  16788. @item levels_mode, m
  16789. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  16790. Default is @code{linear}.
  16791. @item components, c
  16792. Set what color components to display.
  16793. Default is @code{7}.
  16794. @item bgopacity, b
  16795. Set background opacity. Default is @code{0.9}.
  16796. @item envelope, e
  16797. Show envelope. Default is disabled.
  16798. @item ecolor, ec
  16799. Set envelope color. Default is @code{gold}.
  16800. @item slide
  16801. Set slide mode.
  16802. Available values for slide is:
  16803. @table @samp
  16804. @item frame
  16805. Draw new frame when right border is reached.
  16806. @item replace
  16807. Replace old columns with new ones.
  16808. @item scroll
  16809. Scroll from right to left.
  16810. @item rscroll
  16811. Scroll from left to right.
  16812. @item picture
  16813. Draw single picture.
  16814. @end table
  16815. Default is @code{replace}.
  16816. @end table
  16817. @section threshold
  16818. Apply threshold effect to video stream.
  16819. This filter needs four video streams to perform thresholding.
  16820. First stream is stream we are filtering.
  16821. Second stream is holding threshold values, third stream is holding min values,
  16822. and last, fourth stream is holding max values.
  16823. The filter accepts the following option:
  16824. @table @option
  16825. @item planes
  16826. Set which planes will be processed, unprocessed planes will be copied.
  16827. By default value 0xf, all planes will be processed.
  16828. @end table
  16829. For example if first stream pixel's component value is less then threshold value
  16830. of pixel component from 2nd threshold stream, third stream value will picked,
  16831. otherwise fourth stream pixel component value will be picked.
  16832. Using color source filter one can perform various types of thresholding:
  16833. @subsection Commands
  16834. This filter supports the all options as @ref{commands}.
  16835. @subsection Examples
  16836. @itemize
  16837. @item
  16838. Binary threshold, using gray color as threshold:
  16839. @example
  16840. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  16841. @end example
  16842. @item
  16843. Inverted binary threshold, using gray color as threshold:
  16844. @example
  16845. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  16846. @end example
  16847. @item
  16848. Truncate binary threshold, using gray color as threshold:
  16849. @example
  16850. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  16851. @end example
  16852. @item
  16853. Threshold to zero, using gray color as threshold:
  16854. @example
  16855. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  16856. @end example
  16857. @item
  16858. Inverted threshold to zero, using gray color as threshold:
  16859. @example
  16860. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  16861. @end example
  16862. @end itemize
  16863. @section thumbnail
  16864. Select the most representative frame in a given sequence of consecutive frames.
  16865. The filter accepts the following options:
  16866. @table @option
  16867. @item n
  16868. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  16869. will pick one of them, and then handle the next batch of @var{n} frames until
  16870. the end. Default is @code{100}.
  16871. @end table
  16872. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  16873. value will result in a higher memory usage, so a high value is not recommended.
  16874. @subsection Examples
  16875. @itemize
  16876. @item
  16877. Extract one picture each 50 frames:
  16878. @example
  16879. thumbnail=50
  16880. @end example
  16881. @item
  16882. Complete example of a thumbnail creation with @command{ffmpeg}:
  16883. @example
  16884. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  16885. @end example
  16886. @end itemize
  16887. @anchor{tile}
  16888. @section tile
  16889. Tile several successive frames together.
  16890. The @ref{untile} filter can do the reverse.
  16891. The filter accepts the following options:
  16892. @table @option
  16893. @item layout
  16894. Set the grid size in the form @code{COLUMNSxROWS}. Range is upto UINT_MAX cells.
  16895. Default is @code{6x5}.
  16896. @item nb_frames
  16897. Set the maximum number of frames to render in the given area. It must be less
  16898. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  16899. the area will be used.
  16900. @item margin
  16901. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  16902. @item padding
  16903. Set the inner border thickness (i.e. the number of pixels between frames). For
  16904. more advanced padding options (such as having different values for the edges),
  16905. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  16906. @item color
  16907. Specify the color of the unused area. For the syntax of this option, check the
  16908. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16909. The default value of @var{color} is "black".
  16910. @item overlap
  16911. Set the number of frames to overlap when tiling several successive frames together.
  16912. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  16913. @item init_padding
  16914. Set the number of frames to initially be empty before displaying first output frame.
  16915. This controls how soon will one get first output frame.
  16916. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  16917. @end table
  16918. @subsection Examples
  16919. @itemize
  16920. @item
  16921. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  16922. @example
  16923. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  16924. @end example
  16925. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  16926. duplicating each output frame to accommodate the originally detected frame
  16927. rate.
  16928. @item
  16929. Display @code{5} pictures in an area of @code{3x2} frames,
  16930. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  16931. mixed flat and named options:
  16932. @example
  16933. tile=3x2:nb_frames=5:padding=7:margin=2
  16934. @end example
  16935. @end itemize
  16936. @section tinterlace
  16937. Perform various types of temporal field interlacing.
  16938. Frames are counted starting from 1, so the first input frame is
  16939. considered odd.
  16940. The filter accepts the following options:
  16941. @table @option
  16942. @item mode
  16943. Specify the mode of the interlacing. This option can also be specified
  16944. as a value alone. See below for a list of values for this option.
  16945. Available values are:
  16946. @table @samp
  16947. @item merge, 0
  16948. Move odd frames into the upper field, even into the lower field,
  16949. generating a double height frame at half frame rate.
  16950. @example
  16951. ------> time
  16952. Input:
  16953. Frame 1 Frame 2 Frame 3 Frame 4
  16954. 11111 22222 33333 44444
  16955. 11111 22222 33333 44444
  16956. 11111 22222 33333 44444
  16957. 11111 22222 33333 44444
  16958. Output:
  16959. 11111 33333
  16960. 22222 44444
  16961. 11111 33333
  16962. 22222 44444
  16963. 11111 33333
  16964. 22222 44444
  16965. 11111 33333
  16966. 22222 44444
  16967. @end example
  16968. @item drop_even, 1
  16969. Only output odd frames, even frames are dropped, generating a frame with
  16970. unchanged height at half frame rate.
  16971. @example
  16972. ------> time
  16973. Input:
  16974. Frame 1 Frame 2 Frame 3 Frame 4
  16975. 11111 22222 33333 44444
  16976. 11111 22222 33333 44444
  16977. 11111 22222 33333 44444
  16978. 11111 22222 33333 44444
  16979. Output:
  16980. 11111 33333
  16981. 11111 33333
  16982. 11111 33333
  16983. 11111 33333
  16984. @end example
  16985. @item drop_odd, 2
  16986. Only output even frames, odd frames are dropped, generating a frame with
  16987. unchanged height at half frame rate.
  16988. @example
  16989. ------> time
  16990. Input:
  16991. Frame 1 Frame 2 Frame 3 Frame 4
  16992. 11111 22222 33333 44444
  16993. 11111 22222 33333 44444
  16994. 11111 22222 33333 44444
  16995. 11111 22222 33333 44444
  16996. Output:
  16997. 22222 44444
  16998. 22222 44444
  16999. 22222 44444
  17000. 22222 44444
  17001. @end example
  17002. @item pad, 3
  17003. Expand each frame to full height, but pad alternate lines with black,
  17004. generating a frame with double height at the same input frame rate.
  17005. @example
  17006. ------> time
  17007. Input:
  17008. Frame 1 Frame 2 Frame 3 Frame 4
  17009. 11111 22222 33333 44444
  17010. 11111 22222 33333 44444
  17011. 11111 22222 33333 44444
  17012. 11111 22222 33333 44444
  17013. Output:
  17014. 11111 ..... 33333 .....
  17015. ..... 22222 ..... 44444
  17016. 11111 ..... 33333 .....
  17017. ..... 22222 ..... 44444
  17018. 11111 ..... 33333 .....
  17019. ..... 22222 ..... 44444
  17020. 11111 ..... 33333 .....
  17021. ..... 22222 ..... 44444
  17022. @end example
  17023. @item interleave_top, 4
  17024. Interleave the upper field from odd frames with the lower field from
  17025. even frames, generating a frame with unchanged height at half frame rate.
  17026. @example
  17027. ------> time
  17028. Input:
  17029. Frame 1 Frame 2 Frame 3 Frame 4
  17030. 11111<- 22222 33333<- 44444
  17031. 11111 22222<- 33333 44444<-
  17032. 11111<- 22222 33333<- 44444
  17033. 11111 22222<- 33333 44444<-
  17034. Output:
  17035. 11111 33333
  17036. 22222 44444
  17037. 11111 33333
  17038. 22222 44444
  17039. @end example
  17040. @item interleave_bottom, 5
  17041. Interleave the lower field from odd frames with the upper field from
  17042. even frames, generating a frame with unchanged height at half frame rate.
  17043. @example
  17044. ------> time
  17045. Input:
  17046. Frame 1 Frame 2 Frame 3 Frame 4
  17047. 11111 22222<- 33333 44444<-
  17048. 11111<- 22222 33333<- 44444
  17049. 11111 22222<- 33333 44444<-
  17050. 11111<- 22222 33333<- 44444
  17051. Output:
  17052. 22222 44444
  17053. 11111 33333
  17054. 22222 44444
  17055. 11111 33333
  17056. @end example
  17057. @item interlacex2, 6
  17058. Double frame rate with unchanged height. Frames are inserted each
  17059. containing the second temporal field from the previous input frame and
  17060. the first temporal field from the next input frame. This mode relies on
  17061. the top_field_first flag. Useful for interlaced video displays with no
  17062. field synchronisation.
  17063. @example
  17064. ------> time
  17065. Input:
  17066. Frame 1 Frame 2 Frame 3 Frame 4
  17067. 11111 22222 33333 44444
  17068. 11111 22222 33333 44444
  17069. 11111 22222 33333 44444
  17070. 11111 22222 33333 44444
  17071. Output:
  17072. 11111 22222 22222 33333 33333 44444 44444
  17073. 11111 11111 22222 22222 33333 33333 44444
  17074. 11111 22222 22222 33333 33333 44444 44444
  17075. 11111 11111 22222 22222 33333 33333 44444
  17076. @end example
  17077. @item mergex2, 7
  17078. Move odd frames into the upper field, even into the lower field,
  17079. generating a double height frame at same frame rate.
  17080. @example
  17081. ------> time
  17082. Input:
  17083. Frame 1 Frame 2 Frame 3 Frame 4
  17084. 11111 22222 33333 44444
  17085. 11111 22222 33333 44444
  17086. 11111 22222 33333 44444
  17087. 11111 22222 33333 44444
  17088. Output:
  17089. 11111 33333 33333 55555
  17090. 22222 22222 44444 44444
  17091. 11111 33333 33333 55555
  17092. 22222 22222 44444 44444
  17093. 11111 33333 33333 55555
  17094. 22222 22222 44444 44444
  17095. 11111 33333 33333 55555
  17096. 22222 22222 44444 44444
  17097. @end example
  17098. @end table
  17099. Numeric values are deprecated but are accepted for backward
  17100. compatibility reasons.
  17101. Default mode is @code{merge}.
  17102. @item flags
  17103. Specify flags influencing the filter process.
  17104. Available value for @var{flags} is:
  17105. @table @option
  17106. @item low_pass_filter, vlpf
  17107. Enable linear vertical low-pass filtering in the filter.
  17108. Vertical low-pass filtering is required when creating an interlaced
  17109. destination from a progressive source which contains high-frequency
  17110. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  17111. patterning.
  17112. @item complex_filter, cvlpf
  17113. Enable complex vertical low-pass filtering.
  17114. This will slightly less reduce interlace 'twitter' and Moire
  17115. patterning but better retain detail and subjective sharpness impression.
  17116. @item bypass_il
  17117. Bypass already interlaced frames, only adjust the frame rate.
  17118. @end table
  17119. Vertical low-pass filtering and bypassing already interlaced frames can only be
  17120. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  17121. @end table
  17122. @section tmedian
  17123. Pick median pixels from several successive input video frames.
  17124. The filter accepts the following options:
  17125. @table @option
  17126. @item radius
  17127. Set radius of median filter.
  17128. Default is 1. Allowed range is from 1 to 127.
  17129. @item planes
  17130. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  17131. @item percentile
  17132. Set median percentile. Default value is @code{0.5}.
  17133. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  17134. minimum values, and @code{1} maximum values.
  17135. @end table
  17136. @subsection Commands
  17137. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  17138. @section tmidequalizer
  17139. Apply Temporal Midway Video Equalization effect.
  17140. Midway Video Equalization adjusts a sequence of video frames to have the same
  17141. histograms, while maintaining their dynamics as much as possible. It's
  17142. useful for e.g. matching exposures from a video frames sequence.
  17143. This filter accepts the following option:
  17144. @table @option
  17145. @item radius
  17146. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  17147. @item sigma
  17148. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  17149. Setting this option to 0 effectively does nothing.
  17150. @item planes
  17151. Set which planes to process. Default is @code{15}, which is all available planes.
  17152. @end table
  17153. @section tmix
  17154. Mix successive video frames.
  17155. A description of the accepted options follows.
  17156. @table @option
  17157. @item frames
  17158. The number of successive frames to mix. If unspecified, it defaults to 3.
  17159. @item weights
  17160. Specify weight of each input video frame.
  17161. Each weight is separated by space. If number of weights is smaller than
  17162. number of @var{frames} last specified weight will be used for all remaining
  17163. unset weights.
  17164. @item scale
  17165. Specify scale, if it is set it will be multiplied with sum
  17166. of each weight multiplied with pixel values to give final destination
  17167. pixel value. By default @var{scale} is auto scaled to sum of weights.
  17168. @item planes
  17169. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  17170. @end table
  17171. @subsection Examples
  17172. @itemize
  17173. @item
  17174. Average 7 successive frames:
  17175. @example
  17176. tmix=frames=7:weights="1 1 1 1 1 1 1"
  17177. @end example
  17178. @item
  17179. Apply simple temporal convolution:
  17180. @example
  17181. tmix=frames=3:weights="-1 3 -1"
  17182. @end example
  17183. @item
  17184. Similar as above but only showing temporal differences:
  17185. @example
  17186. tmix=frames=3:weights="-1 2 -1":scale=1
  17187. @end example
  17188. @end itemize
  17189. @subsection Commands
  17190. This filter supports the following commands:
  17191. @table @option
  17192. @item weights
  17193. @item scale
  17194. @item planes
  17195. Syntax is same as option with same name.
  17196. @end table
  17197. @anchor{tonemap}
  17198. @section tonemap
  17199. Tone map colors from different dynamic ranges.
  17200. This filter expects data in single precision floating point, as it needs to
  17201. operate on (and can output) out-of-range values. Another filter, such as
  17202. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  17203. The tonemapping algorithms implemented only work on linear light, so input
  17204. data should be linearized beforehand (and possibly correctly tagged).
  17205. @example
  17206. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  17207. @end example
  17208. @subsection Options
  17209. The filter accepts the following options.
  17210. @table @option
  17211. @item tonemap
  17212. Set the tone map algorithm to use.
  17213. Possible values are:
  17214. @table @var
  17215. @item none
  17216. Do not apply any tone map, only desaturate overbright pixels.
  17217. @item clip
  17218. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  17219. in-range values, while distorting out-of-range values.
  17220. @item linear
  17221. Stretch the entire reference gamut to a linear multiple of the display.
  17222. @item gamma
  17223. Fit a logarithmic transfer between the tone curves.
  17224. @item reinhard
  17225. Preserve overall image brightness with a simple curve, using nonlinear
  17226. contrast, which results in flattening details and degrading color accuracy.
  17227. @item hable
  17228. Preserve both dark and bright details better than @var{reinhard}, at the cost
  17229. of slightly darkening everything. Use it when detail preservation is more
  17230. important than color and brightness accuracy.
  17231. @item mobius
  17232. Smoothly map out-of-range values, while retaining contrast and colors for
  17233. in-range material as much as possible. Use it when color accuracy is more
  17234. important than detail preservation.
  17235. @end table
  17236. Default is none.
  17237. @item param
  17238. Tune the tone mapping algorithm.
  17239. This affects the following algorithms:
  17240. @table @var
  17241. @item none
  17242. Ignored.
  17243. @item linear
  17244. Specifies the scale factor to use while stretching.
  17245. Default to 1.0.
  17246. @item gamma
  17247. Specifies the exponent of the function.
  17248. Default to 1.8.
  17249. @item clip
  17250. Specify an extra linear coefficient to multiply into the signal before clipping.
  17251. Default to 1.0.
  17252. @item reinhard
  17253. Specify the local contrast coefficient at the display peak.
  17254. Default to 0.5, which means that in-gamut values will be about half as bright
  17255. as when clipping.
  17256. @item hable
  17257. Ignored.
  17258. @item mobius
  17259. Specify the transition point from linear to mobius transform. Every value
  17260. below this point is guaranteed to be mapped 1:1. The higher the value, the
  17261. more accurate the result will be, at the cost of losing bright details.
  17262. Default to 0.3, which due to the steep initial slope still preserves in-range
  17263. colors fairly accurately.
  17264. @end table
  17265. @item desat
  17266. Apply desaturation for highlights that exceed this level of brightness. The
  17267. higher the parameter, the more color information will be preserved. This
  17268. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17269. (smoothly) turning into white instead. This makes images feel more natural,
  17270. at the cost of reducing information about out-of-range colors.
  17271. The default of 2.0 is somewhat conservative and will mostly just apply to
  17272. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  17273. This option works only if the input frame has a supported color tag.
  17274. @item peak
  17275. Override signal/nominal/reference peak with this value. Useful when the
  17276. embedded peak information in display metadata is not reliable or when tone
  17277. mapping from a lower range to a higher range.
  17278. @end table
  17279. @section tpad
  17280. Temporarily pad video frames.
  17281. The filter accepts the following options:
  17282. @table @option
  17283. @item start
  17284. Specify number of delay frames before input video stream. Default is 0.
  17285. @item stop
  17286. Specify number of padding frames after input video stream.
  17287. Set to -1 to pad indefinitely. Default is 0.
  17288. @item start_mode
  17289. Set kind of frames added to beginning of stream.
  17290. Can be either @var{add} or @var{clone}.
  17291. With @var{add} frames of solid-color are added.
  17292. With @var{clone} frames are clones of first frame.
  17293. Default is @var{add}.
  17294. @item stop_mode
  17295. Set kind of frames added to end of stream.
  17296. Can be either @var{add} or @var{clone}.
  17297. With @var{add} frames of solid-color are added.
  17298. With @var{clone} frames are clones of last frame.
  17299. Default is @var{add}.
  17300. @item start_duration, stop_duration
  17301. Specify the duration of the start/stop delay. See
  17302. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17303. for the accepted syntax.
  17304. These options override @var{start} and @var{stop}. Default is 0.
  17305. @item color
  17306. Specify the color of the padded area. For the syntax of this option,
  17307. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17308. manual,ffmpeg-utils}.
  17309. The default value of @var{color} is "black".
  17310. @end table
  17311. @anchor{transpose}
  17312. @section transpose
  17313. Transpose rows with columns in the input video and optionally flip it.
  17314. It accepts the following parameters:
  17315. @table @option
  17316. @item dir
  17317. Specify the transposition direction.
  17318. Can assume the following values:
  17319. @table @samp
  17320. @item 0, 4, cclock_flip
  17321. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  17322. @example
  17323. L.R L.l
  17324. . . -> . .
  17325. l.r R.r
  17326. @end example
  17327. @item 1, 5, clock
  17328. Rotate by 90 degrees clockwise, that is:
  17329. @example
  17330. L.R l.L
  17331. . . -> . .
  17332. l.r r.R
  17333. @end example
  17334. @item 2, 6, cclock
  17335. Rotate by 90 degrees counterclockwise, that is:
  17336. @example
  17337. L.R R.r
  17338. . . -> . .
  17339. l.r L.l
  17340. @end example
  17341. @item 3, 7, clock_flip
  17342. Rotate by 90 degrees clockwise and vertically flip, that is:
  17343. @example
  17344. L.R r.R
  17345. . . -> . .
  17346. l.r l.L
  17347. @end example
  17348. @end table
  17349. For values between 4-7, the transposition is only done if the input
  17350. video geometry is portrait and not landscape. These values are
  17351. deprecated, the @code{passthrough} option should be used instead.
  17352. Numerical values are deprecated, and should be dropped in favor of
  17353. symbolic constants.
  17354. @item passthrough
  17355. Do not apply the transposition if the input geometry matches the one
  17356. specified by the specified value. It accepts the following values:
  17357. @table @samp
  17358. @item none
  17359. Always apply transposition.
  17360. @item portrait
  17361. Preserve portrait geometry (when @var{height} >= @var{width}).
  17362. @item landscape
  17363. Preserve landscape geometry (when @var{width} >= @var{height}).
  17364. @end table
  17365. Default value is @code{none}.
  17366. @end table
  17367. For example to rotate by 90 degrees clockwise and preserve portrait
  17368. layout:
  17369. @example
  17370. transpose=dir=1:passthrough=portrait
  17371. @end example
  17372. The command above can also be specified as:
  17373. @example
  17374. transpose=1:portrait
  17375. @end example
  17376. @section transpose_npp
  17377. Transpose rows with columns in the input video and optionally flip it.
  17378. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  17379. It accepts the following parameters:
  17380. @table @option
  17381. @item dir
  17382. Specify the transposition direction.
  17383. Can assume the following values:
  17384. @table @samp
  17385. @item cclock_flip
  17386. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  17387. @item clock
  17388. Rotate by 90 degrees clockwise.
  17389. @item cclock
  17390. Rotate by 90 degrees counterclockwise.
  17391. @item clock_flip
  17392. Rotate by 90 degrees clockwise and vertically flip.
  17393. @end table
  17394. @item passthrough
  17395. Do not apply the transposition if the input geometry matches the one
  17396. specified by the specified value. It accepts the following values:
  17397. @table @samp
  17398. @item none
  17399. Always apply transposition. (default)
  17400. @item portrait
  17401. Preserve portrait geometry (when @var{height} >= @var{width}).
  17402. @item landscape
  17403. Preserve landscape geometry (when @var{width} >= @var{height}).
  17404. @end table
  17405. @end table
  17406. @section trim
  17407. Trim the input so that the output contains one continuous subpart of the input.
  17408. It accepts the following parameters:
  17409. @table @option
  17410. @item start
  17411. Specify the time of the start of the kept section, i.e. the frame with the
  17412. timestamp @var{start} will be the first frame in the output.
  17413. @item end
  17414. Specify the time of the first frame that will be dropped, i.e. the frame
  17415. immediately preceding the one with the timestamp @var{end} will be the last
  17416. frame in the output.
  17417. @item start_pts
  17418. This is the same as @var{start}, except this option sets the start timestamp
  17419. in timebase units instead of seconds.
  17420. @item end_pts
  17421. This is the same as @var{end}, except this option sets the end timestamp
  17422. in timebase units instead of seconds.
  17423. @item duration
  17424. The maximum duration of the output in seconds.
  17425. @item start_frame
  17426. The number of the first frame that should be passed to the output.
  17427. @item end_frame
  17428. The number of the first frame that should be dropped.
  17429. @end table
  17430. @option{start}, @option{end}, and @option{duration} are expressed as time
  17431. duration specifications; see
  17432. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17433. for the accepted syntax.
  17434. Note that the first two sets of the start/end options and the @option{duration}
  17435. option look at the frame timestamp, while the _frame variants simply count the
  17436. frames that pass through the filter. Also note that this filter does not modify
  17437. the timestamps. If you wish for the output timestamps to start at zero, insert a
  17438. setpts filter after the trim filter.
  17439. If multiple start or end options are set, this filter tries to be greedy and
  17440. keep all the frames that match at least one of the specified constraints. To keep
  17441. only the part that matches all the constraints at once, chain multiple trim
  17442. filters.
  17443. The defaults are such that all the input is kept. So it is possible to set e.g.
  17444. just the end values to keep everything before the specified time.
  17445. Examples:
  17446. @itemize
  17447. @item
  17448. Drop everything except the second minute of input:
  17449. @example
  17450. ffmpeg -i INPUT -vf trim=60:120
  17451. @end example
  17452. @item
  17453. Keep only the first second:
  17454. @example
  17455. ffmpeg -i INPUT -vf trim=duration=1
  17456. @end example
  17457. @end itemize
  17458. @section unpremultiply
  17459. Apply alpha unpremultiply effect to input video stream using first plane
  17460. of second stream as alpha.
  17461. Both streams must have same dimensions and same pixel format.
  17462. The filter accepts the following option:
  17463. @table @option
  17464. @item planes
  17465. Set which planes will be processed, unprocessed planes will be copied.
  17466. By default value 0xf, all planes will be processed.
  17467. If the format has 1 or 2 components, then luma is bit 0.
  17468. If the format has 3 or 4 components:
  17469. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  17470. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  17471. If present, the alpha channel is always the last bit.
  17472. @item inplace
  17473. Do not require 2nd input for processing, instead use alpha plane from input stream.
  17474. @end table
  17475. @anchor{unsharp}
  17476. @section unsharp
  17477. Sharpen or blur the input video.
  17478. It accepts the following parameters:
  17479. @table @option
  17480. @item luma_msize_x, lx
  17481. Set the luma matrix horizontal size. It must be an odd integer between
  17482. 3 and 23. The default value is 5.
  17483. @item luma_msize_y, ly
  17484. Set the luma matrix vertical size. It must be an odd integer between 3
  17485. and 23. The default value is 5.
  17486. @item luma_amount, la
  17487. Set the luma effect strength. It must be a floating point number, reasonable
  17488. values lay between -1.5 and 1.5.
  17489. Negative values will blur the input video, while positive values will
  17490. sharpen it, a value of zero will disable the effect.
  17491. Default value is 1.0.
  17492. @item chroma_msize_x, cx
  17493. Set the chroma matrix horizontal size. It must be an odd integer
  17494. between 3 and 23. The default value is 5.
  17495. @item chroma_msize_y, cy
  17496. Set the chroma matrix vertical size. It must be an odd integer
  17497. between 3 and 23. The default value is 5.
  17498. @item chroma_amount, ca
  17499. Set the chroma effect strength. It must be a floating point number, reasonable
  17500. values lay between -1.5 and 1.5.
  17501. Negative values will blur the input video, while positive values will
  17502. sharpen it, a value of zero will disable the effect.
  17503. Default value is 0.0.
  17504. @item alpha_msize_x, ax
  17505. Set the alpha matrix horizontal size. It must be an odd integer
  17506. between 3 and 23. The default value is 5.
  17507. @item alpha_msize_y, ay
  17508. Set the alpha matrix vertical size. It must be an odd integer
  17509. between 3 and 23. The default value is 5.
  17510. @item alpha_amount, aa
  17511. Set the alpha effect strength. It must be a floating point number, reasonable
  17512. values lay between -1.5 and 1.5.
  17513. Negative values will blur the input video, while positive values will
  17514. sharpen it, a value of zero will disable the effect.
  17515. Default value is 0.0.
  17516. @end table
  17517. All parameters are optional and default to the equivalent of the
  17518. string '5:5:1.0:5:5:0.0'.
  17519. @subsection Examples
  17520. @itemize
  17521. @item
  17522. Apply strong luma sharpen effect:
  17523. @example
  17524. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  17525. @end example
  17526. @item
  17527. Apply a strong blur of both luma and chroma parameters:
  17528. @example
  17529. unsharp=7:7:-2:7:7:-2
  17530. @end example
  17531. @end itemize
  17532. @anchor{untile}
  17533. @section untile
  17534. Decompose a video made of tiled images into the individual images.
  17535. The frame rate of the output video is the frame rate of the input video
  17536. multiplied by the number of tiles.
  17537. This filter does the reverse of @ref{tile}.
  17538. The filter accepts the following options:
  17539. @table @option
  17540. @item layout
  17541. Set the grid size (i.e. the number of lines and columns). For the syntax of
  17542. this option, check the
  17543. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17544. @end table
  17545. @subsection Examples
  17546. @itemize
  17547. @item
  17548. Produce a 1-second video from a still image file made of 25 frames stacked
  17549. vertically, like an analogic film reel:
  17550. @example
  17551. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  17552. @end example
  17553. @end itemize
  17554. @section uspp
  17555. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  17556. the image at several (or - in the case of @option{quality} level @code{8} - all)
  17557. shifts and average the results.
  17558. The way this differs from the behavior of spp is that uspp actually encodes &
  17559. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  17560. DCT similar to MJPEG.
  17561. This filter is only available in ffmpeg version 4.4 or earlier.
  17562. The filter accepts the following options:
  17563. @table @option
  17564. @item quality
  17565. Set quality. This option defines the number of levels for averaging. It accepts
  17566. an integer in the range 0-8. If set to @code{0}, the filter will have no
  17567. effect. A value of @code{8} means the higher quality. For each increment of
  17568. that value the speed drops by a factor of approximately 2. Default value is
  17569. @code{3}.
  17570. @item qp
  17571. Force a constant quantization parameter. If not set, the filter will use the QP
  17572. from the video stream (if available).
  17573. @end table
  17574. @section v360
  17575. Convert 360 videos between various formats.
  17576. The filter accepts the following options:
  17577. @table @option
  17578. @item input
  17579. @item output
  17580. Set format of the input/output video.
  17581. Available formats:
  17582. @table @samp
  17583. @item e
  17584. @item equirect
  17585. Equirectangular projection.
  17586. @item c3x2
  17587. @item c6x1
  17588. @item c1x6
  17589. Cubemap with 3x2/6x1/1x6 layout.
  17590. Format specific options:
  17591. @table @option
  17592. @item in_pad
  17593. @item out_pad
  17594. Set padding proportion for the input/output cubemap. Values in decimals.
  17595. Example values:
  17596. @table @samp
  17597. @item 0
  17598. No padding.
  17599. @item 0.01
  17600. 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)
  17601. @end table
  17602. Default value is @b{@samp{0}}.
  17603. Maximum value is @b{@samp{0.1}}.
  17604. @item fin_pad
  17605. @item fout_pad
  17606. Set fixed padding for the input/output cubemap. Values in pixels.
  17607. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  17608. @item in_forder
  17609. @item out_forder
  17610. Set order of faces for the input/output cubemap. Choose one direction for each position.
  17611. Designation of directions:
  17612. @table @samp
  17613. @item r
  17614. right
  17615. @item l
  17616. left
  17617. @item u
  17618. up
  17619. @item d
  17620. down
  17621. @item f
  17622. forward
  17623. @item b
  17624. back
  17625. @end table
  17626. Default value is @b{@samp{rludfb}}.
  17627. @item in_frot
  17628. @item out_frot
  17629. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  17630. Designation of angles:
  17631. @table @samp
  17632. @item 0
  17633. 0 degrees clockwise
  17634. @item 1
  17635. 90 degrees clockwise
  17636. @item 2
  17637. 180 degrees clockwise
  17638. @item 3
  17639. 270 degrees clockwise
  17640. @end table
  17641. Default value is @b{@samp{000000}}.
  17642. @end table
  17643. @item eac
  17644. Equi-Angular Cubemap.
  17645. @item flat
  17646. @item gnomonic
  17647. @item rectilinear
  17648. Regular video.
  17649. Format specific options:
  17650. @table @option
  17651. @item h_fov
  17652. @item v_fov
  17653. @item d_fov
  17654. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17655. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17656. @item ih_fov
  17657. @item iv_fov
  17658. @item id_fov
  17659. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17660. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17661. @end table
  17662. @item dfisheye
  17663. Dual fisheye.
  17664. Format specific options:
  17665. @table @option
  17666. @item h_fov
  17667. @item v_fov
  17668. @item d_fov
  17669. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17670. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17671. @item ih_fov
  17672. @item iv_fov
  17673. @item id_fov
  17674. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17675. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17676. @end table
  17677. @item barrel
  17678. @item fb
  17679. @item barrelsplit
  17680. Facebook's 360 formats.
  17681. @item sg
  17682. Stereographic format.
  17683. Format specific options:
  17684. @table @option
  17685. @item h_fov
  17686. @item v_fov
  17687. @item d_fov
  17688. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17689. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17690. @item ih_fov
  17691. @item iv_fov
  17692. @item id_fov
  17693. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17694. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17695. @end table
  17696. @item mercator
  17697. Mercator format.
  17698. @item ball
  17699. Ball format, gives significant distortion toward the back.
  17700. @item hammer
  17701. Hammer-Aitoff map projection format.
  17702. @item sinusoidal
  17703. Sinusoidal map projection format.
  17704. @item fisheye
  17705. Fisheye projection.
  17706. Format specific options:
  17707. @table @option
  17708. @item h_fov
  17709. @item v_fov
  17710. @item d_fov
  17711. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17712. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17713. @item ih_fov
  17714. @item iv_fov
  17715. @item id_fov
  17716. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17717. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17718. @end table
  17719. @item pannini
  17720. Pannini projection.
  17721. Format specific options:
  17722. @table @option
  17723. @item h_fov
  17724. Set output pannini parameter.
  17725. @item ih_fov
  17726. Set input pannini parameter.
  17727. @end table
  17728. @item cylindrical
  17729. Cylindrical projection.
  17730. Format specific options:
  17731. @table @option
  17732. @item h_fov
  17733. @item v_fov
  17734. @item d_fov
  17735. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17736. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17737. @item ih_fov
  17738. @item iv_fov
  17739. @item id_fov
  17740. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17741. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17742. @end table
  17743. @item perspective
  17744. Perspective projection. @i{(output only)}
  17745. Format specific options:
  17746. @table @option
  17747. @item v_fov
  17748. Set perspective parameter.
  17749. @end table
  17750. @item tetrahedron
  17751. Tetrahedron projection.
  17752. @item tsp
  17753. Truncated square pyramid projection.
  17754. @item he
  17755. @item hequirect
  17756. Half equirectangular projection.
  17757. @item equisolid
  17758. Equisolid format.
  17759. Format specific options:
  17760. @table @option
  17761. @item h_fov
  17762. @item v_fov
  17763. @item d_fov
  17764. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17765. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17766. @item ih_fov
  17767. @item iv_fov
  17768. @item id_fov
  17769. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17770. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17771. @end table
  17772. @item og
  17773. Orthographic format.
  17774. Format specific options:
  17775. @table @option
  17776. @item h_fov
  17777. @item v_fov
  17778. @item d_fov
  17779. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17780. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17781. @item ih_fov
  17782. @item iv_fov
  17783. @item id_fov
  17784. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17785. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17786. @end table
  17787. @item octahedron
  17788. Octahedron projection.
  17789. @item cylindricalea
  17790. Cylindrical Equal Area projection.
  17791. @end table
  17792. @item interp
  17793. Set interpolation method.@*
  17794. @i{Note: more complex interpolation methods require much more memory to run.}
  17795. Available methods:
  17796. @table @samp
  17797. @item near
  17798. @item nearest
  17799. Nearest neighbour.
  17800. @item line
  17801. @item linear
  17802. Bilinear interpolation.
  17803. @item lagrange9
  17804. Lagrange9 interpolation.
  17805. @item cube
  17806. @item cubic
  17807. Bicubic interpolation.
  17808. @item lanc
  17809. @item lanczos
  17810. Lanczos interpolation.
  17811. @item sp16
  17812. @item spline16
  17813. Spline16 interpolation.
  17814. @item gauss
  17815. @item gaussian
  17816. Gaussian interpolation.
  17817. @item mitchell
  17818. Mitchell interpolation.
  17819. @end table
  17820. Default value is @b{@samp{line}}.
  17821. @item w
  17822. @item h
  17823. Set the output video resolution.
  17824. Default resolution depends on formats.
  17825. @item in_stereo
  17826. @item out_stereo
  17827. Set the input/output stereo format.
  17828. @table @samp
  17829. @item 2d
  17830. 2D mono
  17831. @item sbs
  17832. Side by side
  17833. @item tb
  17834. Top bottom
  17835. @end table
  17836. Default value is @b{@samp{2d}} for input and output format.
  17837. @item yaw
  17838. @item pitch
  17839. @item roll
  17840. Set rotation for the output video. Values in degrees.
  17841. @item rorder
  17842. Set rotation order for the output video. Choose one item for each position.
  17843. @table @samp
  17844. @item y, Y
  17845. yaw
  17846. @item p, P
  17847. pitch
  17848. @item r, R
  17849. roll
  17850. @end table
  17851. Default value is @b{@samp{ypr}}.
  17852. @item h_flip
  17853. @item v_flip
  17854. @item d_flip
  17855. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  17856. @item ih_flip
  17857. @item iv_flip
  17858. Set if input video is flipped horizontally/vertically. Boolean values.
  17859. @item in_trans
  17860. Set if input video is transposed. Boolean value, by default disabled.
  17861. @item out_trans
  17862. Set if output video needs to be transposed. Boolean value, by default disabled.
  17863. @item h_offset
  17864. @item v_offset
  17865. Set output horizontal/vertical off-axis offset. Default is set to 0.
  17866. Allowed range is from -1 to 1.
  17867. @item alpha_mask
  17868. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  17869. @item reset_rot
  17870. Reset rotation of output video. Boolean value, by default disabled.
  17871. @end table
  17872. @subsection Examples
  17873. @itemize
  17874. @item
  17875. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  17876. @example
  17877. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  17878. @end example
  17879. @item
  17880. Extract back view of Equi-Angular Cubemap:
  17881. @example
  17882. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  17883. @end example
  17884. @item
  17885. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  17886. @example
  17887. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  17888. @end example
  17889. @end itemize
  17890. @subsection Commands
  17891. This filter supports subset of above options as @ref{commands}.
  17892. @section vaguedenoiser
  17893. Apply a wavelet based denoiser.
  17894. It transforms each frame from the video input into the wavelet domain,
  17895. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  17896. the obtained coefficients. It does an inverse wavelet transform after.
  17897. Due to wavelet properties, it should give a nice smoothed result, and
  17898. reduced noise, without blurring picture features.
  17899. This filter accepts the following options:
  17900. @table @option
  17901. @item threshold
  17902. The filtering strength. The higher, the more filtered the video will be.
  17903. Hard thresholding can use a higher threshold than soft thresholding
  17904. before the video looks overfiltered. Default value is 2.
  17905. @item method
  17906. The filtering method the filter will use.
  17907. It accepts the following values:
  17908. @table @samp
  17909. @item hard
  17910. All values under the threshold will be zeroed.
  17911. @item soft
  17912. All values under the threshold will be zeroed. All values above will be
  17913. reduced by the threshold.
  17914. @item garrote
  17915. Scales or nullifies coefficients - intermediary between (more) soft and
  17916. (less) hard thresholding.
  17917. @end table
  17918. Default is garrote.
  17919. @item nsteps
  17920. Number of times, the wavelet will decompose the picture. Picture can't
  17921. be decomposed beyond a particular point (typically, 8 for a 640x480
  17922. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  17923. @item percent
  17924. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  17925. @item planes
  17926. A list of the planes to process. By default all planes are processed.
  17927. @item type
  17928. The threshold type the filter will use.
  17929. It accepts the following values:
  17930. @table @samp
  17931. @item universal
  17932. Threshold used is same for all decompositions.
  17933. @item bayes
  17934. Threshold used depends also on each decomposition coefficients.
  17935. @end table
  17936. Default is universal.
  17937. @end table
  17938. @section varblur
  17939. Apply variable blur filter by using 2nd video stream to set blur radius.
  17940. The 2nd stream must have the same dimensions.
  17941. This filter accepts the following options:
  17942. @table @option
  17943. @item min_r
  17944. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  17945. @item max_r
  17946. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  17947. @item planes
  17948. Set which planes to process. By default, all are used.
  17949. @end table
  17950. The @code{varblur} filter also supports the @ref{framesync} options.
  17951. @subsection Commands
  17952. This filter supports all the above options as @ref{commands}.
  17953. @section vectorscope
  17954. Display 2 color component values in the two dimensional graph (which is called
  17955. a vectorscope).
  17956. This filter accepts the following options:
  17957. @table @option
  17958. @item mode, m
  17959. Set vectorscope mode.
  17960. It accepts the following values:
  17961. @table @samp
  17962. @item gray
  17963. @item tint
  17964. Gray values are displayed on graph, higher brightness means more pixels have
  17965. same component color value on location in graph. This is the default mode.
  17966. @item color
  17967. Gray values are displayed on graph. Surrounding pixels values which are not
  17968. present in video frame are drawn in gradient of 2 color components which are
  17969. set by option @code{x} and @code{y}. The 3rd color component is static.
  17970. @item color2
  17971. Actual color components values present in video frame are displayed on graph.
  17972. @item color3
  17973. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  17974. on graph increases value of another color component, which is luminance by
  17975. default values of @code{x} and @code{y}.
  17976. @item color4
  17977. Actual colors present in video frame are displayed on graph. If two different
  17978. colors map to same position on graph then color with higher value of component
  17979. not present in graph is picked.
  17980. @item color5
  17981. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  17982. component picked from radial gradient.
  17983. @end table
  17984. @item x
  17985. Set which color component will be represented on X-axis. Default is @code{1}.
  17986. @item y
  17987. Set which color component will be represented on Y-axis. Default is @code{2}.
  17988. @item intensity, i
  17989. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  17990. of color component which represents frequency of (X, Y) location in graph.
  17991. @item envelope, e
  17992. @table @samp
  17993. @item none
  17994. No envelope, this is default.
  17995. @item instant
  17996. Instant envelope, even darkest single pixel will be clearly highlighted.
  17997. @item peak
  17998. Hold maximum and minimum values presented in graph over time. This way you
  17999. can still spot out of range values without constantly looking at vectorscope.
  18000. @item peak+instant
  18001. Peak and instant envelope combined together.
  18002. @end table
  18003. @item graticule, g
  18004. Set what kind of graticule to draw.
  18005. @table @samp
  18006. @item none
  18007. @item green
  18008. @item color
  18009. @item invert
  18010. @end table
  18011. @item opacity, o
  18012. Set graticule opacity.
  18013. @item flags, f
  18014. Set graticule flags.
  18015. @table @samp
  18016. @item white
  18017. Draw graticule for white point.
  18018. @item black
  18019. Draw graticule for black point.
  18020. @item name
  18021. Draw color points short names.
  18022. @end table
  18023. @item bgopacity, b
  18024. Set background opacity.
  18025. @item lthreshold, l
  18026. Set low threshold for color component not represented on X or Y axis.
  18027. Values lower than this value will be ignored. Default is 0.
  18028. Note this value is multiplied with actual max possible value one pixel component
  18029. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  18030. is 0.1 * 255 = 25.
  18031. @item hthreshold, h
  18032. Set high threshold for color component not represented on X or Y axis.
  18033. Values higher than this value will be ignored. Default is 1.
  18034. Note this value is multiplied with actual max possible value one pixel component
  18035. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  18036. is 0.9 * 255 = 230.
  18037. @item colorspace, c
  18038. Set what kind of colorspace to use when drawing graticule.
  18039. @table @samp
  18040. @item auto
  18041. @item 601
  18042. @item 709
  18043. @end table
  18044. Default is auto.
  18045. @item tint0, t0
  18046. @item tint1, t1
  18047. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  18048. This means no tint, and output will remain gray.
  18049. @end table
  18050. @anchor{vidstabdetect}
  18051. @section vidstabdetect
  18052. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  18053. @ref{vidstabtransform} for pass 2.
  18054. This filter generates a file with relative translation and rotation
  18055. transform information about subsequent frames, which is then used by
  18056. the @ref{vidstabtransform} filter.
  18057. To enable compilation of this filter you need to configure FFmpeg with
  18058. @code{--enable-libvidstab}.
  18059. This filter accepts the following options:
  18060. @table @option
  18061. @item result
  18062. Set the path to the file used to write the transforms information.
  18063. Default value is @file{transforms.trf}.
  18064. @item shakiness
  18065. Set how shaky the video is and how quick the camera is. It accepts an
  18066. integer in the range 1-10, a value of 1 means little shakiness, a
  18067. value of 10 means strong shakiness. Default value is 5.
  18068. @item accuracy
  18069. Set the accuracy of the detection process. It must be a value in the
  18070. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  18071. accuracy. Default value is 15.
  18072. @item stepsize
  18073. Set stepsize of the search process. The region around minimum is
  18074. scanned with 1 pixel resolution. Default value is 6.
  18075. @item mincontrast
  18076. Set minimum contrast. Below this value a local measurement field is
  18077. discarded. Must be a floating point value in the range 0-1. Default
  18078. value is 0.3.
  18079. @item tripod
  18080. Set reference frame number for tripod mode.
  18081. If enabled, the motion of the frames is compared to a reference frame
  18082. in the filtered stream, identified by the specified number. The idea
  18083. is to compensate all movements in a more-or-less static scene and keep
  18084. the camera view absolutely still.
  18085. If set to 0, it is disabled. The frames are counted starting from 1.
  18086. @item show
  18087. Show fields and transforms in the resulting frames. It accepts an
  18088. integer in the range 0-2. Default value is 0, which disables any
  18089. visualization.
  18090. @end table
  18091. @subsection Examples
  18092. @itemize
  18093. @item
  18094. Use default values:
  18095. @example
  18096. vidstabdetect
  18097. @end example
  18098. @item
  18099. Analyze strongly shaky movie and put the results in file
  18100. @file{mytransforms.trf}:
  18101. @example
  18102. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  18103. @end example
  18104. @item
  18105. Visualize the result of internal transformations in the resulting
  18106. video:
  18107. @example
  18108. vidstabdetect=show=1
  18109. @end example
  18110. @item
  18111. Analyze a video with medium shakiness using @command{ffmpeg}:
  18112. @example
  18113. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  18114. @end example
  18115. @end itemize
  18116. @anchor{vidstabtransform}
  18117. @section vidstabtransform
  18118. Video stabilization/deshaking: pass 2 of 2,
  18119. see @ref{vidstabdetect} for pass 1.
  18120. Read a file with transform information for each frame and
  18121. apply/compensate them. Together with the @ref{vidstabdetect}
  18122. filter this can be used to deshake videos. See also
  18123. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  18124. the @ref{unsharp} filter, see below.
  18125. To enable compilation of this filter you need to configure FFmpeg with
  18126. @code{--enable-libvidstab}.
  18127. @subsection Options
  18128. @table @option
  18129. @item input
  18130. Set path to the file used to read the transforms. Default value is
  18131. @file{transforms.trf}.
  18132. @item smoothing
  18133. Set the number of frames (value*2 + 1) used for lowpass filtering the
  18134. camera movements. Default value is 10.
  18135. For example a number of 10 means that 21 frames are used (10 in the
  18136. past and 10 in the future) to smoothen the motion in the video. A
  18137. larger value leads to a smoother video, but limits the acceleration of
  18138. the camera (pan/tilt movements). 0 is a special case where a static
  18139. camera is simulated.
  18140. @item optalgo
  18141. Set the camera path optimization algorithm.
  18142. Accepted values are:
  18143. @table @samp
  18144. @item gauss
  18145. gaussian kernel low-pass filter on camera motion (default)
  18146. @item avg
  18147. averaging on transformations
  18148. @end table
  18149. @item maxshift
  18150. Set maximal number of pixels to translate frames. Default value is -1,
  18151. meaning no limit.
  18152. @item maxangle
  18153. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  18154. value is -1, meaning no limit.
  18155. @item crop
  18156. Specify how to deal with borders that may be visible due to movement
  18157. compensation.
  18158. Available values are:
  18159. @table @samp
  18160. @item keep
  18161. keep image information from previous frame (default)
  18162. @item black
  18163. fill the border black
  18164. @end table
  18165. @item invert
  18166. Invert transforms if set to 1. Default value is 0.
  18167. @item relative
  18168. Consider transforms as relative to previous frame if set to 1,
  18169. absolute if set to 0. Default value is 0.
  18170. @item zoom
  18171. Set percentage to zoom. A positive value will result in a zoom-in
  18172. effect, a negative value in a zoom-out effect. Default value is 0 (no
  18173. zoom).
  18174. @item optzoom
  18175. Set optimal zooming to avoid borders.
  18176. Accepted values are:
  18177. @table @samp
  18178. @item 0
  18179. disabled
  18180. @item 1
  18181. optimal static zoom value is determined (only very strong movements
  18182. will lead to visible borders) (default)
  18183. @item 2
  18184. optimal adaptive zoom value is determined (no borders will be
  18185. visible), see @option{zoomspeed}
  18186. @end table
  18187. Note that the value given at zoom is added to the one calculated here.
  18188. @item zoomspeed
  18189. Set percent to zoom maximally each frame (enabled when
  18190. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  18191. 0.25.
  18192. @item interpol
  18193. Specify type of interpolation.
  18194. Available values are:
  18195. @table @samp
  18196. @item no
  18197. no interpolation
  18198. @item linear
  18199. linear only horizontal
  18200. @item bilinear
  18201. linear in both directions (default)
  18202. @item bicubic
  18203. cubic in both directions (slow)
  18204. @end table
  18205. @item tripod
  18206. Enable virtual tripod mode if set to 1, which is equivalent to
  18207. @code{relative=0:smoothing=0}. Default value is 0.
  18208. Use also @code{tripod} option of @ref{vidstabdetect}.
  18209. @item debug
  18210. Increase log verbosity if set to 1. Also the detected global motions
  18211. are written to the temporary file @file{global_motions.trf}. Default
  18212. value is 0.
  18213. @end table
  18214. @subsection Examples
  18215. @itemize
  18216. @item
  18217. Use @command{ffmpeg} for a typical stabilization with default values:
  18218. @example
  18219. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  18220. @end example
  18221. Note the use of the @ref{unsharp} filter which is always recommended.
  18222. @item
  18223. Zoom in a bit more and load transform data from a given file:
  18224. @example
  18225. vidstabtransform=zoom=5:input="mytransforms.trf"
  18226. @end example
  18227. @item
  18228. Smoothen the video even more:
  18229. @example
  18230. vidstabtransform=smoothing=30
  18231. @end example
  18232. @end itemize
  18233. @section vflip
  18234. Flip the input video vertically.
  18235. For example, to vertically flip a video with @command{ffmpeg}:
  18236. @example
  18237. ffmpeg -i in.avi -vf "vflip" out.avi
  18238. @end example
  18239. @section vfrdet
  18240. Detect variable frame rate video.
  18241. This filter tries to detect if the input is variable or constant frame rate.
  18242. At end it will output number of frames detected as having variable delta pts,
  18243. and ones with constant delta pts.
  18244. If there was frames with variable delta, than it will also show min, max and
  18245. average delta encountered.
  18246. @section vibrance
  18247. Boost or alter saturation.
  18248. The filter accepts the following options:
  18249. @table @option
  18250. @item intensity
  18251. Set strength of boost if positive value or strength of alter if negative value.
  18252. Default is 0. Allowed range is from -2 to 2.
  18253. @item rbal
  18254. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  18255. @item gbal
  18256. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  18257. @item bbal
  18258. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  18259. @item rlum
  18260. Set the red luma coefficient.
  18261. @item glum
  18262. Set the green luma coefficient.
  18263. @item blum
  18264. Set the blue luma coefficient.
  18265. @item alternate
  18266. If @code{intensity} is negative and this is set to 1, colors will change,
  18267. otherwise colors will be less saturated, more towards gray.
  18268. @end table
  18269. @subsection Commands
  18270. This filter supports the all above options as @ref{commands}.
  18271. @section vif
  18272. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  18273. This filter takes two input videos.
  18274. Both input videos must have the same resolution and pixel format for
  18275. this filter to work correctly. Also it assumes that both inputs
  18276. have the same number of frames, which are compared one by one.
  18277. The obtained average VIF score is printed through the logging system.
  18278. The filter stores the calculated VIF score of each frame.
  18279. In the below example the input file @file{main.mpg} being processed is compared
  18280. with the reference file @file{ref.mpg}.
  18281. @example
  18282. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  18283. @end example
  18284. @anchor{vignette}
  18285. @section vignette
  18286. Make or reverse a natural vignetting effect.
  18287. The filter accepts the following options:
  18288. @table @option
  18289. @item angle, a
  18290. Set lens angle expression as a number of radians.
  18291. The value is clipped in the @code{[0,PI/2]} range.
  18292. Default value: @code{"PI/5"}
  18293. @item x0
  18294. @item y0
  18295. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  18296. by default.
  18297. @item mode
  18298. Set forward/backward mode.
  18299. Available modes are:
  18300. @table @samp
  18301. @item forward
  18302. The larger the distance from the central point, the darker the image becomes.
  18303. @item backward
  18304. The larger the distance from the central point, the brighter the image becomes.
  18305. This can be used to reverse a vignette effect, though there is no automatic
  18306. detection to extract the lens @option{angle} and other settings (yet). It can
  18307. also be used to create a burning effect.
  18308. @end table
  18309. Default value is @samp{forward}.
  18310. @item eval
  18311. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  18312. It accepts the following values:
  18313. @table @samp
  18314. @item init
  18315. Evaluate expressions only once during the filter initialization.
  18316. @item frame
  18317. Evaluate expressions for each incoming frame. This is way slower than the
  18318. @samp{init} mode since it requires all the scalers to be re-computed, but it
  18319. allows advanced dynamic expressions.
  18320. @end table
  18321. Default value is @samp{init}.
  18322. @item dither
  18323. Set dithering to reduce the circular banding effects. Default is @code{1}
  18324. (enabled).
  18325. @item aspect
  18326. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  18327. Setting this value to the SAR of the input will make a rectangular vignetting
  18328. following the dimensions of the video.
  18329. Default is @code{1/1}.
  18330. @end table
  18331. @subsection Expressions
  18332. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  18333. following parameters.
  18334. @table @option
  18335. @item w
  18336. @item h
  18337. input width and height
  18338. @item n
  18339. the number of input frame, starting from 0
  18340. @item pts
  18341. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  18342. @var{TB} units, NAN if undefined
  18343. @item r
  18344. frame rate of the input video, NAN if the input frame rate is unknown
  18345. @item t
  18346. the PTS (Presentation TimeStamp) of the filtered video frame,
  18347. expressed in seconds, NAN if undefined
  18348. @item tb
  18349. time base of the input video
  18350. @end table
  18351. @subsection Examples
  18352. @itemize
  18353. @item
  18354. Apply simple strong vignetting effect:
  18355. @example
  18356. vignette=PI/4
  18357. @end example
  18358. @item
  18359. Make a flickering vignetting:
  18360. @example
  18361. vignette='PI/4+random(1)*PI/50':eval=frame
  18362. @end example
  18363. @end itemize
  18364. @section vmafmotion
  18365. Obtain the average VMAF motion score of a video.
  18366. It is one of the component metrics of VMAF.
  18367. The obtained average motion score is printed through the logging system.
  18368. The filter accepts the following options:
  18369. @table @option
  18370. @item stats_file
  18371. If specified, the filter will use the named file to save the motion score of
  18372. each frame with respect to the previous frame.
  18373. When filename equals "-" the data is sent to standard output.
  18374. @end table
  18375. Example:
  18376. @example
  18377. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  18378. @end example
  18379. @section vstack
  18380. Stack input videos vertically.
  18381. All streams must be of same pixel format and of same width.
  18382. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  18383. to create same output.
  18384. The filter accepts the following options:
  18385. @table @option
  18386. @item inputs
  18387. Set number of input streams. Default is 2.
  18388. @item shortest
  18389. If set to 1, force the output to terminate when the shortest input
  18390. terminates. Default value is 0.
  18391. @end table
  18392. @section w3fdif
  18393. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  18394. Deinterlacing Filter").
  18395. Based on the process described by Martin Weston for BBC R&D, and
  18396. implemented based on the de-interlace algorithm written by Jim
  18397. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  18398. uses filter coefficients calculated by BBC R&D.
  18399. This filter uses field-dominance information in frame to decide which
  18400. of each pair of fields to place first in the output.
  18401. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  18402. There are two sets of filter coefficients, so called "simple"
  18403. and "complex". Which set of filter coefficients is used can
  18404. be set by passing an optional parameter:
  18405. @table @option
  18406. @item filter
  18407. Set the interlacing filter coefficients. Accepts one of the following values:
  18408. @table @samp
  18409. @item simple
  18410. Simple filter coefficient set.
  18411. @item complex
  18412. More-complex filter coefficient set.
  18413. @end table
  18414. Default value is @samp{complex}.
  18415. @item mode
  18416. The interlacing mode to adopt. It accepts one of the following values:
  18417. @table @option
  18418. @item frame
  18419. Output one frame for each frame.
  18420. @item field
  18421. Output one frame for each field.
  18422. @end table
  18423. The default value is @code{field}.
  18424. @item parity
  18425. The picture field parity assumed for the input interlaced video. It accepts one
  18426. of the following values:
  18427. @table @option
  18428. @item tff
  18429. Assume the top field is first.
  18430. @item bff
  18431. Assume the bottom field is first.
  18432. @item auto
  18433. Enable automatic detection of field parity.
  18434. @end table
  18435. The default value is @code{auto}.
  18436. If the interlacing is unknown or the decoder does not export this information,
  18437. top field first will be assumed.
  18438. @item deint
  18439. Specify which frames to deinterlace. Accepts one of the following values:
  18440. @table @samp
  18441. @item all
  18442. Deinterlace all frames,
  18443. @item interlaced
  18444. Only deinterlace frames marked as interlaced.
  18445. @end table
  18446. Default value is @samp{all}.
  18447. @end table
  18448. @subsection Commands
  18449. This filter supports same @ref{commands} as options.
  18450. @section waveform
  18451. Video waveform monitor.
  18452. The waveform monitor plots color component intensity. By default luminance
  18453. only. Each column of the waveform corresponds to a column of pixels in the
  18454. source video.
  18455. It accepts the following options:
  18456. @table @option
  18457. @item mode, m
  18458. Can be either @code{row}, or @code{column}. Default is @code{column}.
  18459. In row mode, the graph on the left side represents color component value 0 and
  18460. the right side represents value = 255. In column mode, the top side represents
  18461. color component value = 0 and bottom side represents value = 255.
  18462. @item intensity, i
  18463. Set intensity. Smaller values are useful to find out how many values of the same
  18464. luminance are distributed across input rows/columns.
  18465. Default value is @code{0.04}. Allowed range is [0, 1].
  18466. @item mirror, r
  18467. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  18468. In mirrored mode, higher values will be represented on the left
  18469. side for @code{row} mode and at the top for @code{column} mode. Default is
  18470. @code{1} (mirrored).
  18471. @item display, d
  18472. Set display mode.
  18473. It accepts the following values:
  18474. @table @samp
  18475. @item overlay
  18476. Presents information identical to that in the @code{parade}, except
  18477. that the graphs representing color components are superimposed directly
  18478. over one another.
  18479. This display mode makes it easier to spot relative differences or similarities
  18480. in overlapping areas of the color components that are supposed to be identical,
  18481. such as neutral whites, grays, or blacks.
  18482. @item stack
  18483. Display separate graph for the color components side by side in
  18484. @code{row} mode or one below the other in @code{column} mode.
  18485. @item parade
  18486. Display separate graph for the color components side by side in
  18487. @code{column} mode or one below the other in @code{row} mode.
  18488. Using this display mode makes it easy to spot color casts in the highlights
  18489. and shadows of an image, by comparing the contours of the top and the bottom
  18490. graphs of each waveform. Since whites, grays, and blacks are characterized
  18491. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  18492. should display three waveforms of roughly equal width/height. If not, the
  18493. correction is easy to perform by making level adjustments the three waveforms.
  18494. @end table
  18495. Default is @code{stack}.
  18496. @item components, c
  18497. Set which color components to display. Default is 1, which means only luminance
  18498. or red color component if input is in RGB colorspace. If is set for example to
  18499. 7 it will display all 3 (if) available color components.
  18500. @item envelope, e
  18501. @table @samp
  18502. @item none
  18503. No envelope, this is default.
  18504. @item instant
  18505. Instant envelope, minimum and maximum values presented in graph will be easily
  18506. visible even with small @code{step} value.
  18507. @item peak
  18508. Hold minimum and maximum values presented in graph across time. This way you
  18509. can still spot out of range values without constantly looking at waveforms.
  18510. @item peak+instant
  18511. Peak and instant envelope combined together.
  18512. @end table
  18513. @item filter, f
  18514. @table @samp
  18515. @item lowpass
  18516. No filtering, this is default.
  18517. @item flat
  18518. Luma and chroma combined together.
  18519. @item aflat
  18520. Similar as above, but shows difference between blue and red chroma.
  18521. @item xflat
  18522. Similar as above, but use different colors.
  18523. @item yflat
  18524. Similar as above, but again with different colors.
  18525. @item chroma
  18526. Displays only chroma.
  18527. @item color
  18528. Displays actual color value on waveform.
  18529. @item acolor
  18530. Similar as above, but with luma showing frequency of chroma values.
  18531. @end table
  18532. @item graticule, g
  18533. Set which graticule to display.
  18534. @table @samp
  18535. @item none
  18536. Do not display graticule.
  18537. @item green
  18538. Display green graticule showing legal broadcast ranges.
  18539. @item orange
  18540. Display orange graticule showing legal broadcast ranges.
  18541. @item invert
  18542. Display invert graticule showing legal broadcast ranges.
  18543. @end table
  18544. @item opacity, o
  18545. Set graticule opacity.
  18546. @item flags, fl
  18547. Set graticule flags.
  18548. @table @samp
  18549. @item numbers
  18550. Draw numbers above lines. By default enabled.
  18551. @item dots
  18552. Draw dots instead of lines.
  18553. @end table
  18554. @item scale, s
  18555. Set scale used for displaying graticule.
  18556. @table @samp
  18557. @item digital
  18558. @item millivolts
  18559. @item ire
  18560. @end table
  18561. Default is digital.
  18562. @item bgopacity, b
  18563. Set background opacity.
  18564. @item tint0, t0
  18565. @item tint1, t1
  18566. Set tint for output.
  18567. Only used with lowpass filter and when display is not overlay and input
  18568. pixel formats are not RGB.
  18569. @item fitmode, fm
  18570. Set sample aspect ratio of video output frames.
  18571. Can be used to configure waveform so it is not
  18572. streched too much in one of directions.
  18573. @table @samp
  18574. @item none
  18575. Set sample aspect ration to 1/1.
  18576. @item size
  18577. Set sample aspect ratio to match input size of video
  18578. @end table
  18579. Default is @samp{none}.
  18580. @end table
  18581. @section weave, doubleweave
  18582. The @code{weave} takes a field-based video input and join
  18583. each two sequential fields into single frame, producing a new double
  18584. height clip with half the frame rate and half the frame count.
  18585. The @code{doubleweave} works same as @code{weave} but without
  18586. halving frame rate and frame count.
  18587. It accepts the following option:
  18588. @table @option
  18589. @item first_field
  18590. Set first field. Available values are:
  18591. @table @samp
  18592. @item top, t
  18593. Set the frame as top-field-first.
  18594. @item bottom, b
  18595. Set the frame as bottom-field-first.
  18596. @end table
  18597. @end table
  18598. @subsection Examples
  18599. @itemize
  18600. @item
  18601. Interlace video using @ref{select} and @ref{separatefields} filter:
  18602. @example
  18603. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  18604. @end example
  18605. @end itemize
  18606. @section xbr
  18607. Apply the xBR high-quality magnification filter which is designed for pixel
  18608. art. It follows a set of edge-detection rules, see
  18609. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  18610. It accepts the following option:
  18611. @table @option
  18612. @item n
  18613. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  18614. @code{3xBR} and @code{4} for @code{4xBR}.
  18615. Default is @code{3}.
  18616. @end table
  18617. @section xcorrelate
  18618. Apply normalized cross-correlation between first and second input video stream.
  18619. Second input video stream dimensions must be lower than first input video stream.
  18620. The filter accepts the following options:
  18621. @table @option
  18622. @item planes
  18623. Set which planes to process.
  18624. @item secondary
  18625. Set which secondary video frames will be processed from second input video stream,
  18626. can be @var{first} or @var{all}. Default is @var{all}.
  18627. @end table
  18628. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  18629. @section xfade
  18630. Apply cross fade from one input video stream to another input video stream.
  18631. The cross fade is applied for specified duration.
  18632. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  18633. frame rate and timebase.
  18634. The filter accepts the following options:
  18635. @table @option
  18636. @item transition
  18637. Set one of available transition effects:
  18638. @table @samp
  18639. @item custom
  18640. @item fade
  18641. @item wipeleft
  18642. @item wiperight
  18643. @item wipeup
  18644. @item wipedown
  18645. @item slideleft
  18646. @item slideright
  18647. @item slideup
  18648. @item slidedown
  18649. @item circlecrop
  18650. @item rectcrop
  18651. @item distance
  18652. @item fadeblack
  18653. @item fadewhite
  18654. @item radial
  18655. @item smoothleft
  18656. @item smoothright
  18657. @item smoothup
  18658. @item smoothdown
  18659. @item circleopen
  18660. @item circleclose
  18661. @item vertopen
  18662. @item vertclose
  18663. @item horzopen
  18664. @item horzclose
  18665. @item dissolve
  18666. @item pixelize
  18667. @item diagtl
  18668. @item diagtr
  18669. @item diagbl
  18670. @item diagbr
  18671. @item hlslice
  18672. @item hrslice
  18673. @item vuslice
  18674. @item vdslice
  18675. @item hblur
  18676. @item fadegrays
  18677. @item wipetl
  18678. @item wipetr
  18679. @item wipebl
  18680. @item wipebr
  18681. @item squeezeh
  18682. @item squeezev
  18683. @item zoomin
  18684. @item fadefast
  18685. @item fadeslow
  18686. @end table
  18687. Default transition effect is fade.
  18688. @item duration
  18689. Set cross fade duration in seconds.
  18690. Range is 0 to 60 seconds.
  18691. Default duration is 1 second.
  18692. @item offset
  18693. Set cross fade start relative to first input stream in seconds.
  18694. Default offset is 0.
  18695. @item expr
  18696. Set expression for custom transition effect.
  18697. The expressions can use the following variables and functions:
  18698. @table @option
  18699. @item X
  18700. @item Y
  18701. The coordinates of the current sample.
  18702. @item W
  18703. @item H
  18704. The width and height of the image.
  18705. @item P
  18706. Progress of transition effect.
  18707. @item PLANE
  18708. Currently processed plane.
  18709. @item A
  18710. Return value of first input at current location and plane.
  18711. @item B
  18712. Return value of second input at current location and plane.
  18713. @item a0(x, y)
  18714. @item a1(x, y)
  18715. @item a2(x, y)
  18716. @item a3(x, y)
  18717. Return the value of the pixel at location (@var{x},@var{y}) of the
  18718. first/second/third/fourth component of first input.
  18719. @item b0(x, y)
  18720. @item b1(x, y)
  18721. @item b2(x, y)
  18722. @item b3(x, y)
  18723. Return the value of the pixel at location (@var{x},@var{y}) of the
  18724. first/second/third/fourth component of second input.
  18725. @end table
  18726. @end table
  18727. @subsection Examples
  18728. @itemize
  18729. @item
  18730. Cross fade from one input video to another input video, with fade transition and duration of transition
  18731. of 2 seconds starting at offset of 5 seconds:
  18732. @example
  18733. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  18734. @end example
  18735. @end itemize
  18736. @section xmedian
  18737. Pick median pixels from several input videos.
  18738. The filter accepts the following options:
  18739. @table @option
  18740. @item inputs
  18741. Set number of inputs.
  18742. Default is 3. Allowed range is from 3 to 255.
  18743. If number of inputs is even number, than result will be mean value between two median values.
  18744. @item planes
  18745. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  18746. @item percentile
  18747. Set median percentile. Default value is @code{0.5}.
  18748. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  18749. minimum values, and @code{1} maximum values.
  18750. @end table
  18751. @subsection Commands
  18752. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  18753. @section xstack
  18754. Stack video inputs into custom layout.
  18755. All streams must be of same pixel format.
  18756. The filter accepts the following options:
  18757. @table @option
  18758. @item inputs
  18759. Set number of input streams. Default is 2.
  18760. @item layout
  18761. Specify layout of inputs.
  18762. This option requires the desired layout configuration to be explicitly set by the user.
  18763. This sets position of each video input in output. Each input
  18764. is separated by '|'.
  18765. The first number represents the column, and the second number represents the row.
  18766. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  18767. where X is video input from which to take width or height.
  18768. Multiple values can be used when separated by '+'. In such
  18769. case values are summed together.
  18770. Note that if inputs are of different sizes gaps may appear, as not all of
  18771. the output video frame will be filled. Similarly, videos can overlap each
  18772. other if their position doesn't leave enough space for the full frame of
  18773. adjoining videos.
  18774. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  18775. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  18776. the user. Either @code{grid} or @code{layout} can be specified at a time.
  18777. Specifying both will result in an error.
  18778. @item grid
  18779. Specify a fixed size grid of inputs.
  18780. This option is used to create a fixed size grid of the input streams. Set the
  18781. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  18782. input streams and they will be arranged as a grid with @code{ROWS} rows and
  18783. @code{COLUMNS} columns. When using this option, each input stream within a row
  18784. must have the same height and all the rows must have the same width.
  18785. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  18786. set to @code{ROWS * COLUMNS}.
  18787. For 2 inputs, a default grid of @code{2x1} (equivalent to
  18788. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  18789. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  18790. Specifying both will result in an error.
  18791. @item shortest
  18792. If set to 1, force the output to terminate when the shortest input
  18793. terminates. Default value is 0.
  18794. @item fill
  18795. If set to valid color, all unused pixels will be filled with that color.
  18796. By default fill is set to none, so it is disabled.
  18797. @end table
  18798. @subsection Examples
  18799. @itemize
  18800. @item
  18801. Display 4 inputs into 2x2 grid.
  18802. Layout:
  18803. @example
  18804. input1(0, 0) | input3(w0, 0)
  18805. input2(0, h0) | input4(w0, h0)
  18806. @end example
  18807. @example
  18808. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  18809. @end example
  18810. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18811. @item
  18812. Display 4 inputs into 1x4 grid.
  18813. Layout:
  18814. @example
  18815. input1(0, 0)
  18816. input2(0, h0)
  18817. input3(0, h0+h1)
  18818. input4(0, h0+h1+h2)
  18819. @end example
  18820. @example
  18821. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  18822. @end example
  18823. Note that if inputs are of different widths, unused space will appear.
  18824. @item
  18825. Display 9 inputs into 3x3 grid.
  18826. Layout:
  18827. @example
  18828. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  18829. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  18830. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  18831. @end example
  18832. @example
  18833. 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
  18834. @end example
  18835. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18836. @item
  18837. Display 16 inputs into 4x4 grid.
  18838. Layout:
  18839. @example
  18840. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  18841. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  18842. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  18843. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  18844. @end example
  18845. @example
  18846. 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|
  18847. 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
  18848. @end example
  18849. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18850. @end itemize
  18851. @anchor{yadif}
  18852. @section yadif
  18853. Deinterlace the input video ("yadif" means "yet another deinterlacing
  18854. filter").
  18855. It accepts the following parameters:
  18856. @table @option
  18857. @item mode
  18858. The interlacing mode to adopt. It accepts one of the following values:
  18859. @table @option
  18860. @item 0, send_frame
  18861. Output one frame for each frame.
  18862. @item 1, send_field
  18863. Output one frame for each field.
  18864. @item 2, send_frame_nospatial
  18865. Like @code{send_frame}, but it skips the spatial interlacing check.
  18866. @item 3, send_field_nospatial
  18867. Like @code{send_field}, but it skips the spatial interlacing check.
  18868. @end table
  18869. The default value is @code{send_frame}.
  18870. @item parity
  18871. The picture field parity assumed for the input interlaced video. It accepts one
  18872. of the following values:
  18873. @table @option
  18874. @item 0, tff
  18875. Assume the top field is first.
  18876. @item 1, bff
  18877. Assume the bottom field is first.
  18878. @item -1, auto
  18879. Enable automatic detection of field parity.
  18880. @end table
  18881. The default value is @code{auto}.
  18882. If the interlacing is unknown or the decoder does not export this information,
  18883. top field first will be assumed.
  18884. @item deint
  18885. Specify which frames to deinterlace. Accepts one of the following
  18886. values:
  18887. @table @option
  18888. @item 0, all
  18889. Deinterlace all frames.
  18890. @item 1, interlaced
  18891. Only deinterlace frames marked as interlaced.
  18892. @end table
  18893. The default value is @code{all}.
  18894. @end table
  18895. @section yadif_cuda
  18896. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  18897. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  18898. and/or nvenc.
  18899. It accepts the following parameters:
  18900. @table @option
  18901. @item mode
  18902. The interlacing mode to adopt. It accepts one of the following values:
  18903. @table @option
  18904. @item 0, send_frame
  18905. Output one frame for each frame.
  18906. @item 1, send_field
  18907. Output one frame for each field.
  18908. @item 2, send_frame_nospatial
  18909. Like @code{send_frame}, but it skips the spatial interlacing check.
  18910. @item 3, send_field_nospatial
  18911. Like @code{send_field}, but it skips the spatial interlacing check.
  18912. @end table
  18913. The default value is @code{send_frame}.
  18914. @item parity
  18915. The picture field parity assumed for the input interlaced video. It accepts one
  18916. of the following values:
  18917. @table @option
  18918. @item 0, tff
  18919. Assume the top field is first.
  18920. @item 1, bff
  18921. Assume the bottom field is first.
  18922. @item -1, auto
  18923. Enable automatic detection of field parity.
  18924. @end table
  18925. The default value is @code{auto}.
  18926. If the interlacing is unknown or the decoder does not export this information,
  18927. top field first will be assumed.
  18928. @item deint
  18929. Specify which frames to deinterlace. Accepts one of the following
  18930. values:
  18931. @table @option
  18932. @item 0, all
  18933. Deinterlace all frames.
  18934. @item 1, interlaced
  18935. Only deinterlace frames marked as interlaced.
  18936. @end table
  18937. The default value is @code{all}.
  18938. @end table
  18939. @section yaepblur
  18940. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  18941. The algorithm is described in
  18942. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  18943. It accepts the following parameters:
  18944. @table @option
  18945. @item radius, r
  18946. Set the window radius. Default value is 3.
  18947. @item planes, p
  18948. Set which planes to filter. Default is only the first plane.
  18949. @item sigma, s
  18950. Set blur strength. Default value is 128.
  18951. @end table
  18952. @subsection Commands
  18953. This filter supports same @ref{commands} as options.
  18954. @section zoompan
  18955. Apply Zoom & Pan effect.
  18956. This filter accepts the following options:
  18957. @table @option
  18958. @item zoom, z
  18959. Set the zoom expression. Range is 1-10. Default is 1.
  18960. @item x
  18961. @item y
  18962. Set the x and y expression. Default is 0.
  18963. @item d
  18964. Set the duration expression in number of frames.
  18965. This sets for how many number of frames effect will last for
  18966. single input image. Default is 90.
  18967. @item s
  18968. Set the output image size, default is 'hd720'.
  18969. @item fps
  18970. Set the output frame rate, default is '25'.
  18971. @end table
  18972. Each expression can contain the following constants:
  18973. @table @option
  18974. @item in_w, iw
  18975. Input width.
  18976. @item in_h, ih
  18977. Input height.
  18978. @item out_w, ow
  18979. Output width.
  18980. @item out_h, oh
  18981. Output height.
  18982. @item in
  18983. Input frame count.
  18984. @item on
  18985. Output frame count.
  18986. @item in_time, it
  18987. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  18988. @item out_time, time, ot
  18989. The output timestamp expressed in seconds.
  18990. @item x
  18991. @item y
  18992. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  18993. for current input frame.
  18994. @item px
  18995. @item py
  18996. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  18997. not yet such frame (first input frame).
  18998. @item zoom
  18999. Last calculated zoom from 'z' expression for current input frame.
  19000. @item pzoom
  19001. Last calculated zoom of last output frame of previous input frame.
  19002. @item duration
  19003. Number of output frames for current input frame. Calculated from 'd' expression
  19004. for each input frame.
  19005. @item pduration
  19006. number of output frames created for previous input frame
  19007. @item a
  19008. Rational number: input width / input height
  19009. @item sar
  19010. sample aspect ratio
  19011. @item dar
  19012. display aspect ratio
  19013. @end table
  19014. @subsection Examples
  19015. @itemize
  19016. @item
  19017. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  19018. @example
  19019. 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
  19020. @end example
  19021. @item
  19022. Zoom in up to 1.5x and pan always at center of picture:
  19023. @example
  19024. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19025. @end example
  19026. @item
  19027. Same as above but without pausing:
  19028. @example
  19029. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19030. @end example
  19031. @item
  19032. Zoom in 2x into center of picture only for the first second of the input video:
  19033. @example
  19034. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19035. @end example
  19036. @end itemize
  19037. @anchor{zscale}
  19038. @section zscale
  19039. Scale (resize) the input video, using the z.lib library:
  19040. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  19041. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  19042. The zscale filter forces the output display aspect ratio to be the same
  19043. as the input, by changing the output sample aspect ratio.
  19044. If the input image format is different from the format requested by
  19045. the next filter, the zscale filter will convert the input to the
  19046. requested format.
  19047. @subsection Options
  19048. The filter accepts the following options.
  19049. @table @option
  19050. @item width, w
  19051. @item height, h
  19052. Set the output video dimension expression. Default value is the input
  19053. dimension.
  19054. If the @var{width} or @var{w} value is 0, the input width is used for
  19055. the output. If the @var{height} or @var{h} value is 0, the input height
  19056. is used for the output.
  19057. If one and only one of the values is -n with n >= 1, the zscale filter
  19058. will use a value that maintains the aspect ratio of the input image,
  19059. calculated from the other specified dimension. After that it will,
  19060. however, make sure that the calculated dimension is divisible by n and
  19061. adjust the value if necessary.
  19062. If both values are -n with n >= 1, the behavior will be identical to
  19063. both values being set to 0 as previously detailed.
  19064. See below for the list of accepted constants for use in the dimension
  19065. expression.
  19066. @item size, s
  19067. Set the video size. For the syntax of this option, check the
  19068. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19069. @item dither, d
  19070. Set the dither type.
  19071. Possible values are:
  19072. @table @var
  19073. @item none
  19074. @item ordered
  19075. @item random
  19076. @item error_diffusion
  19077. @end table
  19078. Default is none.
  19079. @item filter, f
  19080. Set the resize filter type.
  19081. Possible values are:
  19082. @table @var
  19083. @item point
  19084. @item bilinear
  19085. @item bicubic
  19086. @item spline16
  19087. @item spline36
  19088. @item lanczos
  19089. @end table
  19090. Default is bilinear.
  19091. @item range, r
  19092. Set the color range.
  19093. Possible values are:
  19094. @table @var
  19095. @item input
  19096. @item limited
  19097. @item full
  19098. @end table
  19099. Default is same as input.
  19100. @item primaries, p
  19101. Set the color primaries.
  19102. Possible values are:
  19103. @table @var
  19104. @item input
  19105. @item 709
  19106. @item unspecified
  19107. @item 170m
  19108. @item 240m
  19109. @item 2020
  19110. @end table
  19111. Default is same as input.
  19112. @item transfer, t
  19113. Set the transfer characteristics.
  19114. Possible values are:
  19115. @table @var
  19116. @item input
  19117. @item 709
  19118. @item unspecified
  19119. @item 601
  19120. @item linear
  19121. @item 2020_10
  19122. @item 2020_12
  19123. @item smpte2084
  19124. @item iec61966-2-1
  19125. @item arib-std-b67
  19126. @end table
  19127. Default is same as input.
  19128. @item matrix, m
  19129. Set the colorspace matrix.
  19130. Possible value are:
  19131. @table @var
  19132. @item input
  19133. @item 709
  19134. @item unspecified
  19135. @item 470bg
  19136. @item 170m
  19137. @item 2020_ncl
  19138. @item 2020_cl
  19139. @end table
  19140. Default is same as input.
  19141. @item rangein, rin
  19142. Set the input color range.
  19143. Possible values are:
  19144. @table @var
  19145. @item input
  19146. @item limited
  19147. @item full
  19148. @end table
  19149. Default is same as input.
  19150. @item primariesin, pin
  19151. Set the input color primaries.
  19152. Possible values are:
  19153. @table @var
  19154. @item input
  19155. @item 709
  19156. @item unspecified
  19157. @item 170m
  19158. @item 240m
  19159. @item 2020
  19160. @end table
  19161. Default is same as input.
  19162. @item transferin, tin
  19163. Set the input transfer characteristics.
  19164. Possible values are:
  19165. @table @var
  19166. @item input
  19167. @item 709
  19168. @item unspecified
  19169. @item 601
  19170. @item linear
  19171. @item 2020_10
  19172. @item 2020_12
  19173. @end table
  19174. Default is same as input.
  19175. @item matrixin, min
  19176. Set the input colorspace matrix.
  19177. Possible value are:
  19178. @table @var
  19179. @item input
  19180. @item 709
  19181. @item unspecified
  19182. @item 470bg
  19183. @item 170m
  19184. @item 2020_ncl
  19185. @item 2020_cl
  19186. @end table
  19187. @item chromal, c
  19188. Set the output chroma location.
  19189. Possible values are:
  19190. @table @var
  19191. @item input
  19192. @item left
  19193. @item center
  19194. @item topleft
  19195. @item top
  19196. @item bottomleft
  19197. @item bottom
  19198. @end table
  19199. @item chromalin, cin
  19200. Set the input chroma location.
  19201. Possible values are:
  19202. @table @var
  19203. @item input
  19204. @item left
  19205. @item center
  19206. @item topleft
  19207. @item top
  19208. @item bottomleft
  19209. @item bottom
  19210. @end table
  19211. @item npl
  19212. Set the nominal peak luminance.
  19213. @item param_a
  19214. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  19215. filter taps for lanczos.
  19216. @item param_b
  19217. Parameter B for scaling filters. Parameter "c" for bicubic.
  19218. @end table
  19219. The values of the @option{w} and @option{h} options are expressions
  19220. containing the following constants:
  19221. @table @var
  19222. @item in_w
  19223. @item in_h
  19224. The input width and height
  19225. @item iw
  19226. @item ih
  19227. These are the same as @var{in_w} and @var{in_h}.
  19228. @item out_w
  19229. @item out_h
  19230. The output (scaled) width and height
  19231. @item ow
  19232. @item oh
  19233. These are the same as @var{out_w} and @var{out_h}
  19234. @item a
  19235. The same as @var{iw} / @var{ih}
  19236. @item sar
  19237. input sample aspect ratio
  19238. @item dar
  19239. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  19240. @item hsub
  19241. @item vsub
  19242. horizontal and vertical input chroma subsample values. For example for the
  19243. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19244. @item ohsub
  19245. @item ovsub
  19246. horizontal and vertical output chroma subsample values. For example for the
  19247. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19248. @end table
  19249. @subsection Commands
  19250. This filter supports the following commands:
  19251. @table @option
  19252. @item width, w
  19253. @item height, h
  19254. Set the output video dimension expression.
  19255. The command accepts the same syntax of the corresponding option.
  19256. If the specified expression is not valid, it is kept at its current
  19257. value.
  19258. @end table
  19259. @c man end VIDEO FILTERS
  19260. @chapter OpenCL Video Filters
  19261. @c man begin OPENCL VIDEO FILTERS
  19262. Below is a description of the currently available OpenCL video filters.
  19263. To enable compilation of these filters you need to configure FFmpeg with
  19264. @code{--enable-opencl}.
  19265. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  19266. @table @option
  19267. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  19268. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  19269. given device parameters.
  19270. @item -filter_hw_device @var{name}
  19271. Pass the hardware device called @var{name} to all filters in any filter graph.
  19272. @end table
  19273. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  19274. @itemize
  19275. @item
  19276. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  19277. @example
  19278. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  19279. @end example
  19280. @end itemize
  19281. 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.
  19282. @section avgblur_opencl
  19283. Apply average blur filter.
  19284. The filter accepts the following options:
  19285. @table @option
  19286. @item sizeX
  19287. Set horizontal radius size.
  19288. Range is @code{[1, 1024]} and default value is @code{1}.
  19289. @item planes
  19290. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19291. @item sizeY
  19292. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  19293. @end table
  19294. @subsection Example
  19295. @itemize
  19296. @item
  19297. 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.
  19298. @example
  19299. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  19300. @end example
  19301. @end itemize
  19302. @section boxblur_opencl
  19303. Apply a boxblur algorithm to the input video.
  19304. It accepts the following parameters:
  19305. @table @option
  19306. @item luma_radius, lr
  19307. @item luma_power, lp
  19308. @item chroma_radius, cr
  19309. @item chroma_power, cp
  19310. @item alpha_radius, ar
  19311. @item alpha_power, ap
  19312. @end table
  19313. A description of the accepted options follows.
  19314. @table @option
  19315. @item luma_radius, lr
  19316. @item chroma_radius, cr
  19317. @item alpha_radius, ar
  19318. Set an expression for the box radius in pixels used for blurring the
  19319. corresponding input plane.
  19320. The radius value must be a non-negative number, and must not be
  19321. greater than the value of the expression @code{min(w,h)/2} for the
  19322. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  19323. planes.
  19324. Default value for @option{luma_radius} is "2". If not specified,
  19325. @option{chroma_radius} and @option{alpha_radius} default to the
  19326. corresponding value set for @option{luma_radius}.
  19327. The expressions can contain the following constants:
  19328. @table @option
  19329. @item w
  19330. @item h
  19331. The input width and height in pixels.
  19332. @item cw
  19333. @item ch
  19334. The input chroma image width and height in pixels.
  19335. @item hsub
  19336. @item vsub
  19337. The horizontal and vertical chroma subsample values. For example, for the
  19338. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  19339. @end table
  19340. @item luma_power, lp
  19341. @item chroma_power, cp
  19342. @item alpha_power, ap
  19343. Specify how many times the boxblur filter is applied to the
  19344. corresponding plane.
  19345. Default value for @option{luma_power} is 2. If not specified,
  19346. @option{chroma_power} and @option{alpha_power} default to the
  19347. corresponding value set for @option{luma_power}.
  19348. A value of 0 will disable the effect.
  19349. @end table
  19350. @subsection Examples
  19351. 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.
  19352. @itemize
  19353. @item
  19354. Apply a boxblur filter with the luma, chroma, and alpha radius
  19355. 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.
  19356. @example
  19357. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  19358. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  19359. @end example
  19360. @item
  19361. 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.
  19362. For the luma plane, a 2x2 box radius will be run once.
  19363. For the chroma plane, a 4x4 box radius will be run 5 times.
  19364. For the alpha plane, a 3x3 box radius will be run 7 times.
  19365. @example
  19366. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  19367. @end example
  19368. @end itemize
  19369. @section colorkey_opencl
  19370. RGB colorspace color keying.
  19371. The filter accepts the following options:
  19372. @table @option
  19373. @item color
  19374. The color which will be replaced with transparency.
  19375. @item similarity
  19376. Similarity percentage with the key color.
  19377. 0.01 matches only the exact key color, while 1.0 matches everything.
  19378. @item blend
  19379. Blend percentage.
  19380. 0.0 makes pixels either fully transparent, or not transparent at all.
  19381. Higher values result in semi-transparent pixels, with a higher transparency
  19382. the more similar the pixels color is to the key color.
  19383. @end table
  19384. @subsection Examples
  19385. @itemize
  19386. @item
  19387. Make every semi-green pixel in the input transparent with some slight blending:
  19388. @example
  19389. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  19390. @end example
  19391. @end itemize
  19392. @section convolution_opencl
  19393. Apply convolution of 3x3, 5x5, 7x7 matrix.
  19394. The filter accepts the following options:
  19395. @table @option
  19396. @item 0m
  19397. @item 1m
  19398. @item 2m
  19399. @item 3m
  19400. Set matrix for each plane.
  19401. Matrix is sequence of 9, 25 or 49 signed numbers.
  19402. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  19403. @item 0rdiv
  19404. @item 1rdiv
  19405. @item 2rdiv
  19406. @item 3rdiv
  19407. Set multiplier for calculated value for each plane.
  19408. If unset or 0, it will be sum of all matrix elements.
  19409. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  19410. @item 0bias
  19411. @item 1bias
  19412. @item 2bias
  19413. @item 3bias
  19414. Set bias for each plane. This value is added to the result of the multiplication.
  19415. Useful for making the overall image brighter or darker.
  19416. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  19417. @end table
  19418. @subsection Examples
  19419. @itemize
  19420. @item
  19421. Apply sharpen:
  19422. @example
  19423. -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
  19424. @end example
  19425. @item
  19426. Apply blur:
  19427. @example
  19428. -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
  19429. @end example
  19430. @item
  19431. Apply edge enhance:
  19432. @example
  19433. -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
  19434. @end example
  19435. @item
  19436. Apply edge detect:
  19437. @example
  19438. -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
  19439. @end example
  19440. @item
  19441. Apply laplacian edge detector which includes diagonals:
  19442. @example
  19443. -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
  19444. @end example
  19445. @item
  19446. Apply emboss:
  19447. @example
  19448. -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
  19449. @end example
  19450. @end itemize
  19451. @section erosion_opencl
  19452. Apply erosion effect to the video.
  19453. This filter replaces the pixel by the local(3x3) minimum.
  19454. It accepts the following options:
  19455. @table @option
  19456. @item threshold0
  19457. @item threshold1
  19458. @item threshold2
  19459. @item threshold3
  19460. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19461. If @code{0}, plane will remain unchanged.
  19462. @item coordinates
  19463. Flag which specifies the pixel to refer to.
  19464. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19465. Flags to local 3x3 coordinates region centered on @code{x}:
  19466. 1 2 3
  19467. 4 x 5
  19468. 6 7 8
  19469. @end table
  19470. @subsection Example
  19471. @itemize
  19472. @item
  19473. 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.
  19474. @example
  19475. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19476. @end example
  19477. @end itemize
  19478. @section deshake_opencl
  19479. Feature-point based video stabilization filter.
  19480. The filter accepts the following options:
  19481. @table @option
  19482. @item tripod
  19483. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  19484. @item debug
  19485. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  19486. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  19487. Viewing point matches in the output video is only supported for RGB input.
  19488. Defaults to @code{0}.
  19489. @item adaptive_crop
  19490. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  19491. Defaults to @code{1}.
  19492. @item refine_features
  19493. Whether or not feature points should be refined at a sub-pixel level.
  19494. This can be turned off for a slight performance gain at the cost of precision.
  19495. Defaults to @code{1}.
  19496. @item smooth_strength
  19497. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  19498. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  19499. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  19500. Defaults to @code{0.0}.
  19501. @item smooth_window_multiplier
  19502. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  19503. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  19504. Acceptable values range from @code{0.1} to @code{10.0}.
  19505. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  19506. potentially improving smoothness, but also increase latency and memory usage.
  19507. Defaults to @code{2.0}.
  19508. @end table
  19509. @subsection Examples
  19510. @itemize
  19511. @item
  19512. Stabilize a video with a fixed, medium smoothing strength:
  19513. @example
  19514. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  19515. @end example
  19516. @item
  19517. Stabilize a video with debugging (both in console and in rendered video):
  19518. @example
  19519. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  19520. @end example
  19521. @end itemize
  19522. @section dilation_opencl
  19523. Apply dilation effect to the video.
  19524. This filter replaces the pixel by the local(3x3) maximum.
  19525. It accepts the following options:
  19526. @table @option
  19527. @item threshold0
  19528. @item threshold1
  19529. @item threshold2
  19530. @item threshold3
  19531. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19532. If @code{0}, plane will remain unchanged.
  19533. @item coordinates
  19534. Flag which specifies the pixel to refer to.
  19535. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19536. Flags to local 3x3 coordinates region centered on @code{x}:
  19537. 1 2 3
  19538. 4 x 5
  19539. 6 7 8
  19540. @end table
  19541. @subsection Example
  19542. @itemize
  19543. @item
  19544. 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.
  19545. @example
  19546. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19547. @end example
  19548. @end itemize
  19549. @section nlmeans_opencl
  19550. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  19551. @section overlay_opencl
  19552. Overlay one video on top of another.
  19553. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  19554. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  19555. The filter accepts the following options:
  19556. @table @option
  19557. @item x
  19558. Set the x coordinate of the overlaid video on the main video.
  19559. Default value is @code{0}.
  19560. @item y
  19561. Set the y coordinate of the overlaid video on the main video.
  19562. Default value is @code{0}.
  19563. @end table
  19564. @subsection Examples
  19565. @itemize
  19566. @item
  19567. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  19568. @example
  19569. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19570. @end example
  19571. @item
  19572. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  19573. @example
  19574. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19575. @end example
  19576. @end itemize
  19577. @section pad_opencl
  19578. Add paddings to the input image, and place the original input at the
  19579. provided @var{x}, @var{y} coordinates.
  19580. It accepts the following options:
  19581. @table @option
  19582. @item width, w
  19583. @item height, h
  19584. Specify an expression for the size of the output image with the
  19585. paddings added. If the value for @var{width} or @var{height} is 0, the
  19586. corresponding input size is used for the output.
  19587. The @var{width} expression can reference the value set by the
  19588. @var{height} expression, and vice versa.
  19589. The default value of @var{width} and @var{height} is 0.
  19590. @item x
  19591. @item y
  19592. Specify the offsets to place the input image at within the padded area,
  19593. with respect to the top/left border of the output image.
  19594. The @var{x} expression can reference the value set by the @var{y}
  19595. expression, and vice versa.
  19596. The default value of @var{x} and @var{y} is 0.
  19597. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  19598. so the input image is centered on the padded area.
  19599. @item color
  19600. Specify the color of the padded area. For the syntax of this option,
  19601. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  19602. manual,ffmpeg-utils}.
  19603. @item aspect
  19604. Pad to an aspect instead to a resolution.
  19605. @end table
  19606. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  19607. options are expressions containing the following constants:
  19608. @table @option
  19609. @item in_w
  19610. @item in_h
  19611. The input video width and height.
  19612. @item iw
  19613. @item ih
  19614. These are the same as @var{in_w} and @var{in_h}.
  19615. @item out_w
  19616. @item out_h
  19617. The output width and height (the size of the padded area), as
  19618. specified by the @var{width} and @var{height} expressions.
  19619. @item ow
  19620. @item oh
  19621. These are the same as @var{out_w} and @var{out_h}.
  19622. @item x
  19623. @item y
  19624. The x and y offsets as specified by the @var{x} and @var{y}
  19625. expressions, or NAN if not yet specified.
  19626. @item a
  19627. same as @var{iw} / @var{ih}
  19628. @item sar
  19629. input sample aspect ratio
  19630. @item dar
  19631. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  19632. @end table
  19633. @section prewitt_opencl
  19634. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  19635. The filter accepts the following option:
  19636. @table @option
  19637. @item planes
  19638. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19639. @item scale
  19640. Set value which will be multiplied with filtered result.
  19641. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19642. @item delta
  19643. Set value which will be added to filtered result.
  19644. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19645. @end table
  19646. @subsection Example
  19647. @itemize
  19648. @item
  19649. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  19650. @example
  19651. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19652. @end example
  19653. @end itemize
  19654. @anchor{program_opencl}
  19655. @section program_opencl
  19656. Filter video using an OpenCL program.
  19657. @table @option
  19658. @item source
  19659. OpenCL program source file.
  19660. @item kernel
  19661. Kernel name in program.
  19662. @item inputs
  19663. Number of inputs to the filter. Defaults to 1.
  19664. @item size, s
  19665. Size of output frames. Defaults to the same as the first input.
  19666. @end table
  19667. The @code{program_opencl} filter also supports the @ref{framesync} options.
  19668. The program source file must contain a kernel function with the given name,
  19669. which will be run once for each plane of the output. Each run on a plane
  19670. gets enqueued as a separate 2D global NDRange with one work-item for each
  19671. pixel to be generated. The global ID offset for each work-item is therefore
  19672. the coordinates of a pixel in the destination image.
  19673. The kernel function needs to take the following arguments:
  19674. @itemize
  19675. @item
  19676. Destination image, @var{__write_only image2d_t}.
  19677. This image will become the output; the kernel should write all of it.
  19678. @item
  19679. Frame index, @var{unsigned int}.
  19680. This is a counter starting from zero and increasing by one for each frame.
  19681. @item
  19682. Source images, @var{__read_only image2d_t}.
  19683. These are the most recent images on each input. The kernel may read from
  19684. them to generate the output, but they can't be written to.
  19685. @end itemize
  19686. Example programs:
  19687. @itemize
  19688. @item
  19689. Copy the input to the output (output must be the same size as the input).
  19690. @verbatim
  19691. __kernel void copy(__write_only image2d_t destination,
  19692. unsigned int index,
  19693. __read_only image2d_t source)
  19694. {
  19695. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  19696. int2 location = (int2)(get_global_id(0), get_global_id(1));
  19697. float4 value = read_imagef(source, sampler, location);
  19698. write_imagef(destination, location, value);
  19699. }
  19700. @end verbatim
  19701. @item
  19702. Apply a simple transformation, rotating the input by an amount increasing
  19703. with the index counter. Pixel values are linearly interpolated by the
  19704. sampler, and the output need not have the same dimensions as the input.
  19705. @verbatim
  19706. __kernel void rotate_image(__write_only image2d_t dst,
  19707. unsigned int index,
  19708. __read_only image2d_t src)
  19709. {
  19710. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19711. CLK_FILTER_LINEAR);
  19712. float angle = (float)index / 100.0f;
  19713. float2 dst_dim = convert_float2(get_image_dim(dst));
  19714. float2 src_dim = convert_float2(get_image_dim(src));
  19715. float2 dst_cen = dst_dim / 2.0f;
  19716. float2 src_cen = src_dim / 2.0f;
  19717. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19718. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  19719. float2 src_pos = {
  19720. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  19721. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  19722. };
  19723. src_pos = src_pos * src_dim / dst_dim;
  19724. float2 src_loc = src_pos + src_cen;
  19725. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  19726. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  19727. write_imagef(dst, dst_loc, 0.5f);
  19728. else
  19729. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  19730. }
  19731. @end verbatim
  19732. @item
  19733. Blend two inputs together, with the amount of each input used varying
  19734. with the index counter.
  19735. @verbatim
  19736. __kernel void blend_images(__write_only image2d_t dst,
  19737. unsigned int index,
  19738. __read_only image2d_t src1,
  19739. __read_only image2d_t src2)
  19740. {
  19741. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19742. CLK_FILTER_LINEAR);
  19743. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  19744. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19745. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  19746. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  19747. float4 val1 = read_imagef(src1, sampler, src1_loc);
  19748. float4 val2 = read_imagef(src2, sampler, src2_loc);
  19749. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  19750. }
  19751. @end verbatim
  19752. @end itemize
  19753. @section remap_opencl
  19754. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  19755. Destination pixel at position (X, Y) will be picked from source (x, y) position
  19756. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  19757. value for pixel will be used for destination pixel.
  19758. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  19759. will have Xmap/Ymap video stream dimensions.
  19760. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  19761. @table @option
  19762. @item interp
  19763. Specify interpolation used for remapping of pixels.
  19764. Allowed values are @code{near} and @code{linear}.
  19765. Default value is @code{linear}.
  19766. @item fill
  19767. Specify the color of the unmapped pixels. For the syntax of this option,
  19768. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  19769. manual,ffmpeg-utils}. Default color is @code{black}.
  19770. @end table
  19771. @section roberts_opencl
  19772. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  19773. The filter accepts the following option:
  19774. @table @option
  19775. @item planes
  19776. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19777. @item scale
  19778. Set value which will be multiplied with filtered result.
  19779. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19780. @item delta
  19781. Set value which will be added to filtered result.
  19782. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19783. @end table
  19784. @subsection Example
  19785. @itemize
  19786. @item
  19787. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  19788. @example
  19789. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19790. @end example
  19791. @end itemize
  19792. @section sobel_opencl
  19793. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  19794. The filter accepts the following option:
  19795. @table @option
  19796. @item planes
  19797. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19798. @item scale
  19799. Set value which will be multiplied with filtered result.
  19800. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19801. @item delta
  19802. Set value which will be added to filtered result.
  19803. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19804. @end table
  19805. @subsection Example
  19806. @itemize
  19807. @item
  19808. Apply sobel operator with scale set to 2 and delta set to 10
  19809. @example
  19810. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19811. @end example
  19812. @end itemize
  19813. @section tonemap_opencl
  19814. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  19815. It accepts the following parameters:
  19816. @table @option
  19817. @item tonemap
  19818. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  19819. @item param
  19820. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  19821. @item desat
  19822. Apply desaturation for highlights that exceed this level of brightness. The
  19823. higher the parameter, the more color information will be preserved. This
  19824. setting helps prevent unnaturally blown-out colors for super-highlights, by
  19825. (smoothly) turning into white instead. This makes images feel more natural,
  19826. at the cost of reducing information about out-of-range colors.
  19827. The default value is 0.5, and the algorithm here is a little different from
  19828. the cpu version tonemap currently. A setting of 0.0 disables this option.
  19829. @item threshold
  19830. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  19831. is used to detect whether the scene has changed or not. If the distance between
  19832. the current frame average brightness and the current running average exceeds
  19833. a threshold value, we would re-calculate scene average and peak brightness.
  19834. The default value is 0.2.
  19835. @item format
  19836. Specify the output pixel format.
  19837. Currently supported formats are:
  19838. @table @var
  19839. @item p010
  19840. @item nv12
  19841. @end table
  19842. @item range, r
  19843. Set the output color range.
  19844. Possible values are:
  19845. @table @var
  19846. @item tv/mpeg
  19847. @item pc/jpeg
  19848. @end table
  19849. Default is same as input.
  19850. @item primaries, p
  19851. Set the output color primaries.
  19852. Possible values are:
  19853. @table @var
  19854. @item bt709
  19855. @item bt2020
  19856. @end table
  19857. Default is same as input.
  19858. @item transfer, t
  19859. Set the output transfer characteristics.
  19860. Possible values are:
  19861. @table @var
  19862. @item bt709
  19863. @item bt2020
  19864. @end table
  19865. Default is bt709.
  19866. @item matrix, m
  19867. Set the output colorspace matrix.
  19868. Possible value are:
  19869. @table @var
  19870. @item bt709
  19871. @item bt2020
  19872. @end table
  19873. Default is same as input.
  19874. @end table
  19875. @subsection Example
  19876. @itemize
  19877. @item
  19878. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  19879. @example
  19880. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  19881. @end example
  19882. @end itemize
  19883. @section unsharp_opencl
  19884. Sharpen or blur the input video.
  19885. It accepts the following parameters:
  19886. @table @option
  19887. @item luma_msize_x, lx
  19888. Set the luma matrix horizontal size.
  19889. Range is @code{[1, 23]} and default value is @code{5}.
  19890. @item luma_msize_y, ly
  19891. Set the luma matrix vertical size.
  19892. Range is @code{[1, 23]} and default value is @code{5}.
  19893. @item luma_amount, la
  19894. Set the luma effect strength.
  19895. Range is @code{[-10, 10]} and default value is @code{1.0}.
  19896. Negative values will blur the input video, while positive values will
  19897. sharpen it, a value of zero will disable the effect.
  19898. @item chroma_msize_x, cx
  19899. Set the chroma matrix horizontal size.
  19900. Range is @code{[1, 23]} and default value is @code{5}.
  19901. @item chroma_msize_y, cy
  19902. Set the chroma matrix vertical size.
  19903. Range is @code{[1, 23]} and default value is @code{5}.
  19904. @item chroma_amount, ca
  19905. Set the chroma effect strength.
  19906. Range is @code{[-10, 10]} and default value is @code{0.0}.
  19907. Negative values will blur the input video, while positive values will
  19908. sharpen it, a value of zero will disable the effect.
  19909. @end table
  19910. All parameters are optional and default to the equivalent of the
  19911. string '5:5:1.0:5:5:0.0'.
  19912. @subsection Examples
  19913. @itemize
  19914. @item
  19915. Apply strong luma sharpen effect:
  19916. @example
  19917. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  19918. @end example
  19919. @item
  19920. Apply a strong blur of both luma and chroma parameters:
  19921. @example
  19922. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  19923. @end example
  19924. @end itemize
  19925. @section xfade_opencl
  19926. Cross fade two videos with custom transition effect by using OpenCL.
  19927. It accepts the following options:
  19928. @table @option
  19929. @item transition
  19930. Set one of possible transition effects.
  19931. @table @option
  19932. @item custom
  19933. Select custom transition effect, the actual transition description
  19934. will be picked from source and kernel options.
  19935. @item fade
  19936. @item wipeleft
  19937. @item wiperight
  19938. @item wipeup
  19939. @item wipedown
  19940. @item slideleft
  19941. @item slideright
  19942. @item slideup
  19943. @item slidedown
  19944. Default transition is fade.
  19945. @end table
  19946. @item source
  19947. OpenCL program source file for custom transition.
  19948. @item kernel
  19949. Set name of kernel to use for custom transition from program source file.
  19950. @item duration
  19951. Set duration of video transition.
  19952. @item offset
  19953. Set time of start of transition relative to first video.
  19954. @end table
  19955. The program source file must contain a kernel function with the given name,
  19956. which will be run once for each plane of the output. Each run on a plane
  19957. gets enqueued as a separate 2D global NDRange with one work-item for each
  19958. pixel to be generated. The global ID offset for each work-item is therefore
  19959. the coordinates of a pixel in the destination image.
  19960. The kernel function needs to take the following arguments:
  19961. @itemize
  19962. @item
  19963. Destination image, @var{__write_only image2d_t}.
  19964. This image will become the output; the kernel should write all of it.
  19965. @item
  19966. First Source image, @var{__read_only image2d_t}.
  19967. Second Source image, @var{__read_only image2d_t}.
  19968. These are the most recent images on each input. The kernel may read from
  19969. them to generate the output, but they can't be written to.
  19970. @item
  19971. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  19972. @end itemize
  19973. Example programs:
  19974. @itemize
  19975. @item
  19976. Apply dots curtain transition effect:
  19977. @verbatim
  19978. __kernel void blend_images(__write_only image2d_t dst,
  19979. __read_only image2d_t src1,
  19980. __read_only image2d_t src2,
  19981. float progress)
  19982. {
  19983. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19984. CLK_FILTER_LINEAR);
  19985. int2 p = (int2)(get_global_id(0), get_global_id(1));
  19986. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  19987. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  19988. rp = rp / dim;
  19989. float2 dots = (float2)(20.0, 20.0);
  19990. float2 center = (float2)(0,0);
  19991. float2 unused;
  19992. float4 val1 = read_imagef(src1, sampler, p);
  19993. float4 val2 = read_imagef(src2, sampler, p);
  19994. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  19995. write_imagef(dst, p, next ? val1 : val2);
  19996. }
  19997. @end verbatim
  19998. @end itemize
  19999. @c man end OPENCL VIDEO FILTERS
  20000. @chapter VAAPI Video Filters
  20001. @c man begin VAAPI VIDEO FILTERS
  20002. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  20003. To enable compilation of these filters you need to configure FFmpeg with
  20004. @code{--enable-vaapi}.
  20005. 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}
  20006. @section overlay_vaapi
  20007. Overlay one video on the top of another.
  20008. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20009. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  20010. The filter accepts the following options:
  20011. @table @option
  20012. @item x
  20013. Set the x coordinate of the overlaid video on the main video.
  20014. Default value is @code{0}.
  20015. @item y
  20016. Set the y coordinate of the overlaid video on the main video.
  20017. Default value is @code{0}.
  20018. @item w
  20019. Set the width of the overlaid video on the main video.
  20020. Default value is the width of input overlay video.
  20021. @item h
  20022. Set the height of the overlaid video on the main video.
  20023. Default value is the height of input overlay video.
  20024. @item alpha
  20025. Set transparency of overlaid video. Allowed range is 0.0 to 1.0.
  20026. Higher value means lower transparency.
  20027. Default value is @code{1.0}.
  20028. @end table
  20029. @subsection Examples
  20030. @itemize
  20031. @item
  20032. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  20033. @example
  20034. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  20035. @end example
  20036. @item
  20037. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  20038. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20039. @example
  20040. -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
  20041. @end example
  20042. @end itemize
  20043. @section tonemap_vaapi
  20044. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  20045. It maps the dynamic range of HDR10 content to the SDR content.
  20046. It currently only accepts HDR10 as input.
  20047. It accepts the following parameters:
  20048. @table @option
  20049. @item format
  20050. Specify the output pixel format.
  20051. Currently supported formats are:
  20052. @table @var
  20053. @item p010
  20054. @item nv12
  20055. @end table
  20056. Default is nv12.
  20057. @item primaries, p
  20058. Set the output color primaries.
  20059. Default is same as input.
  20060. @item transfer, t
  20061. Set the output transfer characteristics.
  20062. Default is bt709.
  20063. @item matrix, m
  20064. Set the output colorspace matrix.
  20065. Default is same as input.
  20066. @end table
  20067. @subsection Example
  20068. @itemize
  20069. @item
  20070. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  20071. @example
  20072. tonemap_vaapi=format=p010:t=bt2020-10
  20073. @end example
  20074. @end itemize
  20075. @c man end VAAPI VIDEO FILTERS
  20076. @chapter Video Sources
  20077. @c man begin VIDEO SOURCES
  20078. Below is a description of the currently available video sources.
  20079. @section buffer
  20080. Buffer video frames, and make them available to the filter chain.
  20081. This source is mainly intended for a programmatic use, in particular
  20082. through the interface defined in @file{libavfilter/buffersrc.h}.
  20083. It accepts the following parameters:
  20084. @table @option
  20085. @item video_size
  20086. Specify the size (width and height) of the buffered video frames. For the
  20087. syntax of this option, check the
  20088. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20089. @item width
  20090. The input video width.
  20091. @item height
  20092. The input video height.
  20093. @item pix_fmt
  20094. A string representing the pixel format of the buffered video frames.
  20095. It may be a number corresponding to a pixel format, or a pixel format
  20096. name.
  20097. @item time_base
  20098. Specify the timebase assumed by the timestamps of the buffered frames.
  20099. @item frame_rate
  20100. Specify the frame rate expected for the video stream.
  20101. @item pixel_aspect, sar
  20102. The sample (pixel) aspect ratio of the input video.
  20103. @item sws_param
  20104. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  20105. to the filtergraph description to specify swscale flags for automatically
  20106. inserted scalers. See @ref{Filtergraph syntax}.
  20107. @item hw_frames_ctx
  20108. When using a hardware pixel format, this should be a reference to an
  20109. AVHWFramesContext describing input frames.
  20110. @end table
  20111. For example:
  20112. @example
  20113. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  20114. @end example
  20115. will instruct the source to accept video frames with size 320x240 and
  20116. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  20117. square pixels (1:1 sample aspect ratio).
  20118. Since the pixel format with name "yuv410p" corresponds to the number 6
  20119. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  20120. this example corresponds to:
  20121. @example
  20122. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  20123. @end example
  20124. Alternatively, the options can be specified as a flat string, but this
  20125. syntax is deprecated:
  20126. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  20127. @section cellauto
  20128. Create a pattern generated by an elementary cellular automaton.
  20129. The initial state of the cellular automaton can be defined through the
  20130. @option{filename} and @option{pattern} options. If such options are
  20131. not specified an initial state is created randomly.
  20132. At each new frame a new row in the video is filled with the result of
  20133. the cellular automaton next generation. The behavior when the whole
  20134. frame is filled is defined by the @option{scroll} option.
  20135. This source accepts the following options:
  20136. @table @option
  20137. @item filename, f
  20138. Read the initial cellular automaton state, i.e. the starting row, from
  20139. the specified file.
  20140. In the file, each non-whitespace character is considered an alive
  20141. cell, a newline will terminate the row, and further characters in the
  20142. file will be ignored.
  20143. @item pattern, p
  20144. Read the initial cellular automaton state, i.e. the starting row, from
  20145. the specified string.
  20146. Each non-whitespace character in the string is considered an alive
  20147. cell, a newline will terminate the row, and further characters in the
  20148. string will be ignored.
  20149. @item rate, r
  20150. Set the video rate, that is the number of frames generated per second.
  20151. Default is 25.
  20152. @item random_fill_ratio, ratio
  20153. Set the random fill ratio for the initial cellular automaton row. It
  20154. is a floating point number value ranging from 0 to 1, defaults to
  20155. 1/PHI.
  20156. This option is ignored when a file or a pattern is specified.
  20157. @item random_seed, seed
  20158. Set the seed for filling randomly the initial row, must be an integer
  20159. included between 0 and UINT32_MAX. If not specified, or if explicitly
  20160. set to -1, the filter will try to use a good random seed on a best
  20161. effort basis.
  20162. @item rule
  20163. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  20164. Default value is 110.
  20165. @item size, s
  20166. Set the size of the output video. For the syntax of this option, check the
  20167. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20168. If @option{filename} or @option{pattern} is specified, the size is set
  20169. by default to the width of the specified initial state row, and the
  20170. height is set to @var{width} * PHI.
  20171. If @option{size} is set, it must contain the width of the specified
  20172. pattern string, and the specified pattern will be centered in the
  20173. larger row.
  20174. If a filename or a pattern string is not specified, the size value
  20175. defaults to "320x518" (used for a randomly generated initial state).
  20176. @item scroll
  20177. If set to 1, scroll the output upward when all the rows in the output
  20178. have been already filled. If set to 0, the new generated row will be
  20179. written over the top row just after the bottom row is filled.
  20180. Defaults to 1.
  20181. @item start_full, full
  20182. If set to 1, completely fill the output with generated rows before
  20183. outputting the first frame.
  20184. This is the default behavior, for disabling set the value to 0.
  20185. @item stitch
  20186. If set to 1, stitch the left and right row edges together.
  20187. This is the default behavior, for disabling set the value to 0.
  20188. @end table
  20189. @subsection Examples
  20190. @itemize
  20191. @item
  20192. Read the initial state from @file{pattern}, and specify an output of
  20193. size 200x400.
  20194. @example
  20195. cellauto=f=pattern:s=200x400
  20196. @end example
  20197. @item
  20198. Generate a random initial row with a width of 200 cells, with a fill
  20199. ratio of 2/3:
  20200. @example
  20201. cellauto=ratio=2/3:s=200x200
  20202. @end example
  20203. @item
  20204. Create a pattern generated by rule 18 starting by a single alive cell
  20205. centered on an initial row with width 100:
  20206. @example
  20207. cellauto=p=@@:s=100x400:full=0:rule=18
  20208. @end example
  20209. @item
  20210. Specify a more elaborated initial pattern:
  20211. @example
  20212. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  20213. @end example
  20214. @end itemize
  20215. @anchor{coreimagesrc}
  20216. @section coreimagesrc
  20217. Video source generated on GPU using Apple's CoreImage API on OSX.
  20218. This video source is a specialized version of the @ref{coreimage} video filter.
  20219. Use a core image generator at the beginning of the applied filterchain to
  20220. generate the content.
  20221. The coreimagesrc video source accepts the following options:
  20222. @table @option
  20223. @item list_generators
  20224. List all available generators along with all their respective options as well as
  20225. possible minimum and maximum values along with the default values.
  20226. @example
  20227. list_generators=true
  20228. @end example
  20229. @item size, s
  20230. Specify the size of the sourced video. For the syntax of this option, check the
  20231. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20232. The default value is @code{320x240}.
  20233. @item rate, r
  20234. Specify the frame rate of the sourced video, as the number of frames
  20235. generated per second. It has to be a string in the format
  20236. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20237. number or a valid video frame rate abbreviation. The default value is
  20238. "25".
  20239. @item sar
  20240. Set the sample aspect ratio of the sourced video.
  20241. @item duration, d
  20242. Set the duration of the sourced video. See
  20243. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20244. for the accepted syntax.
  20245. If not specified, or the expressed duration is negative, the video is
  20246. supposed to be generated forever.
  20247. @end table
  20248. Additionally, all options of the @ref{coreimage} video filter are accepted.
  20249. A complete filterchain can be used for further processing of the
  20250. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  20251. and examples for details.
  20252. @subsection Examples
  20253. @itemize
  20254. @item
  20255. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  20256. given as complete and escaped command-line for Apple's standard bash shell:
  20257. @example
  20258. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  20259. @end example
  20260. This example is equivalent to the QRCode example of @ref{coreimage} without the
  20261. need for a nullsrc video source.
  20262. @end itemize
  20263. @section ddagrab
  20264. Captures the Windows Desktop via Desktop Duplication API.
  20265. The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding
  20266. or processing. So an explicit @ref{hwdownload} is needed for any kind of
  20267. software processing.
  20268. It accepts the following options:
  20269. @table @option
  20270. @item output_idx
  20271. DXGI Output Index to capture.
  20272. Usually corresponds to the index Windows has given the screen minus one,
  20273. so it's starting at 0.
  20274. Defaults to output 0.
  20275. @item draw_mouse
  20276. Whether to draw the mouse cursor.
  20277. Defaults to true.
  20278. Only affects hardware cursors. If a game or application renders its own cursor,
  20279. it'll always be captured.
  20280. @item framerate
  20281. Framerate at which the desktop will be captured.
  20282. Defaults to 30 FPS.
  20283. @item video_size
  20284. Specify the size of the captured video.
  20285. Defaults to the full size of the screen.
  20286. Cropped from the bottom/right if smaller than screen size.
  20287. @item offset_x
  20288. Horizontal offset of the captured video.
  20289. @item offset_y
  20290. Vertical offset of the captured video.
  20291. @item output_fmt
  20292. Desired filter output format.
  20293. Defaults to 8 Bit BGRA.
  20294. It accepts the following values:
  20295. @table @samp
  20296. @item auto
  20297. Passes all supported output formats to DDA and returns what DDA decides to use.
  20298. @item 8bit
  20299. @item bgra
  20300. 8 Bit formats always work, and DDA will convert to them if neccesary.
  20301. @item 10bit
  20302. @item x2bgr10
  20303. Filter initialization will fail if 10 bit format is requested but unavailable.
  20304. @end table
  20305. @end table
  20306. @subsection Examples
  20307. Capture primary screen and encode using nvenc:
  20308. @example
  20309. ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4
  20310. @end example
  20311. You can also skip the lavfi device and directly use the filter.
  20312. Also demonstrates downloading the frame and encoding with libx264.
  20313. Explicit output format specification is required in this case:
  20314. @example
  20315. ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4
  20316. @end example
  20317. If you want to capture only a subsection of the desktop, this can be achieved
  20318. by specifying a smaller size and its offsets into the screen:
  20319. @example
  20320. ddagrab=video_size=800x600:offset_x=100:offset_y=100
  20321. @end example
  20322. @section gradients
  20323. Generate several gradients.
  20324. @table @option
  20325. @item size, s
  20326. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20327. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20328. @item rate, r
  20329. Set frame rate, expressed as number of frames per second. Default
  20330. value is "25".
  20331. @item c0, c1, c2, c3, c4, c5, c6, c7
  20332. Set 8 colors. Default values for colors is to pick random one.
  20333. @item x0, y0, y0, y1
  20334. Set gradient line source and destination points. If negative or out of range, random ones
  20335. are picked.
  20336. @item nb_colors, n
  20337. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  20338. @item seed
  20339. Set seed for picking gradient line points.
  20340. @item duration, d
  20341. Set the duration of the sourced video. See
  20342. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20343. for the accepted syntax.
  20344. If not specified, or the expressed duration is negative, the video is
  20345. supposed to be generated forever.
  20346. @item speed
  20347. Set speed of gradients rotation.
  20348. @item type, t
  20349. Set type of gradients, can be @code{linear} or @code{radial} or @code{circular} or @code{spiral}.
  20350. @end table
  20351. @section mandelbrot
  20352. Generate a Mandelbrot set fractal, and progressively zoom towards the
  20353. point specified with @var{start_x} and @var{start_y}.
  20354. This source accepts the following options:
  20355. @table @option
  20356. @item end_pts
  20357. Set the terminal pts value. Default value is 400.
  20358. @item end_scale
  20359. Set the terminal scale value.
  20360. Must be a floating point value. Default value is 0.3.
  20361. @item inner
  20362. Set the inner coloring mode, that is the algorithm used to draw the
  20363. Mandelbrot fractal internal region.
  20364. It shall assume one of the following values:
  20365. @table @option
  20366. @item black
  20367. Set black mode.
  20368. @item convergence
  20369. Show time until convergence.
  20370. @item mincol
  20371. Set color based on point closest to the origin of the iterations.
  20372. @item period
  20373. Set period mode.
  20374. @end table
  20375. Default value is @var{mincol}.
  20376. @item bailout
  20377. Set the bailout value. Default value is 10.0.
  20378. @item maxiter
  20379. Set the maximum of iterations performed by the rendering
  20380. algorithm. Default value is 7189.
  20381. @item outer
  20382. Set outer coloring mode.
  20383. It shall assume one of following values:
  20384. @table @option
  20385. @item iteration_count
  20386. Set iteration count mode.
  20387. @item normalized_iteration_count
  20388. set normalized iteration count mode.
  20389. @end table
  20390. Default value is @var{normalized_iteration_count}.
  20391. @item rate, r
  20392. Set frame rate, expressed as number of frames per second. Default
  20393. value is "25".
  20394. @item size, s
  20395. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20396. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20397. @item start_scale
  20398. Set the initial scale value. Default value is 3.0.
  20399. @item start_x
  20400. Set the initial x position. Must be a floating point value between
  20401. -100 and 100. Default value is -0.743643887037158704752191506114774.
  20402. @item start_y
  20403. Set the initial y position. Must be a floating point value between
  20404. -100 and 100. Default value is -0.131825904205311970493132056385139.
  20405. @end table
  20406. @section mptestsrc
  20407. Generate various test patterns, as generated by the MPlayer test filter.
  20408. The size of the generated video is fixed, and is 256x256.
  20409. This source is useful in particular for testing encoding features.
  20410. This source accepts the following options:
  20411. @table @option
  20412. @item rate, r
  20413. Specify the frame rate of the sourced video, as the number of frames
  20414. generated per second. It has to be a string in the format
  20415. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20416. number or a valid video frame rate abbreviation. The default value is
  20417. "25".
  20418. @item duration, d
  20419. Set the duration of the sourced video. See
  20420. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20421. for the accepted syntax.
  20422. If not specified, or the expressed duration is negative, the video is
  20423. supposed to be generated forever.
  20424. @item test, t
  20425. Set the number or the name of the test to perform. Supported tests are:
  20426. @table @option
  20427. @item dc_luma
  20428. @item dc_chroma
  20429. @item freq_luma
  20430. @item freq_chroma
  20431. @item amp_luma
  20432. @item amp_chroma
  20433. @item cbp
  20434. @item mv
  20435. @item ring1
  20436. @item ring2
  20437. @item all
  20438. @item max_frames, m
  20439. Set the maximum number of frames generated for each test, default value is 30.
  20440. @end table
  20441. Default value is "all", which will cycle through the list of all tests.
  20442. @end table
  20443. Some examples:
  20444. @example
  20445. mptestsrc=t=dc_luma
  20446. @end example
  20447. will generate a "dc_luma" test pattern.
  20448. @section frei0r_src
  20449. Provide a frei0r source.
  20450. To enable compilation of this filter you need to install the frei0r
  20451. header and configure FFmpeg with @code{--enable-frei0r}.
  20452. This source accepts the following parameters:
  20453. @table @option
  20454. @item size
  20455. The size of the video to generate. For the syntax of this option, check the
  20456. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20457. @item framerate
  20458. The framerate of the generated video. It may be a string of the form
  20459. @var{num}/@var{den} or a frame rate abbreviation.
  20460. @item filter_name
  20461. The name to the frei0r source to load. For more information regarding frei0r and
  20462. how to set the parameters, read the @ref{frei0r} section in the video filters
  20463. documentation.
  20464. @item filter_params
  20465. A '|'-separated list of parameters to pass to the frei0r source.
  20466. @end table
  20467. For example, to generate a frei0r partik0l source with size 200x200
  20468. and frame rate 10 which is overlaid on the overlay filter main input:
  20469. @example
  20470. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  20471. @end example
  20472. @section life
  20473. Generate a life pattern.
  20474. This source is based on a generalization of John Conway's life game.
  20475. The sourced input represents a life grid, each pixel represents a cell
  20476. which can be in one of two possible states, alive or dead. Every cell
  20477. interacts with its eight neighbours, which are the cells that are
  20478. horizontally, vertically, or diagonally adjacent.
  20479. At each interaction the grid evolves according to the adopted rule,
  20480. which specifies the number of neighbor alive cells which will make a
  20481. cell stay alive or born. The @option{rule} option allows one to specify
  20482. the rule to adopt.
  20483. This source accepts the following options:
  20484. @table @option
  20485. @item filename, f
  20486. Set the file from which to read the initial grid state. In the file,
  20487. each non-whitespace character is considered an alive cell, and newline
  20488. is used to delimit the end of each row.
  20489. If this option is not specified, the initial grid is generated
  20490. randomly.
  20491. @item rate, r
  20492. Set the video rate, that is the number of frames generated per second.
  20493. Default is 25.
  20494. @item random_fill_ratio, ratio
  20495. Set the random fill ratio for the initial random grid. It is a
  20496. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  20497. It is ignored when a file is specified.
  20498. @item random_seed, seed
  20499. Set the seed for filling the initial random grid, must be an integer
  20500. included between 0 and UINT32_MAX. If not specified, or if explicitly
  20501. set to -1, the filter will try to use a good random seed on a best
  20502. effort basis.
  20503. @item rule
  20504. Set the life rule.
  20505. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  20506. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  20507. @var{NS} specifies the number of alive neighbor cells which make a
  20508. live cell stay alive, and @var{NB} the number of alive neighbor cells
  20509. which make a dead cell to become alive (i.e. to "born").
  20510. "s" and "b" can be used in place of "S" and "B", respectively.
  20511. Alternatively a rule can be specified by an 18-bits integer. The 9
  20512. high order bits are used to encode the next cell state if it is alive
  20513. for each number of neighbor alive cells, the low order bits specify
  20514. the rule for "borning" new cells. Higher order bits encode for an
  20515. higher number of neighbor cells.
  20516. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  20517. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  20518. Default value is "S23/B3", which is the original Conway's game of life
  20519. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  20520. cells, and will born a new cell if there are three alive cells around
  20521. a dead cell.
  20522. @item size, s
  20523. Set the size of the output video. For the syntax of this option, check the
  20524. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20525. If @option{filename} is specified, the size is set by default to the
  20526. same size of the input file. If @option{size} is set, it must contain
  20527. the size specified in the input file, and the initial grid defined in
  20528. that file is centered in the larger resulting area.
  20529. If a filename is not specified, the size value defaults to "320x240"
  20530. (used for a randomly generated initial grid).
  20531. @item stitch
  20532. If set to 1, stitch the left and right grid edges together, and the
  20533. top and bottom edges also. Defaults to 1.
  20534. @item mold
  20535. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  20536. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  20537. value from 0 to 255.
  20538. @item life_color
  20539. Set the color of living (or new born) cells.
  20540. @item death_color
  20541. Set the color of dead cells. If @option{mold} is set, this is the first color
  20542. used to represent a dead cell.
  20543. @item mold_color
  20544. Set mold color, for definitely dead and moldy cells.
  20545. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  20546. ffmpeg-utils manual,ffmpeg-utils}.
  20547. @end table
  20548. @subsection Examples
  20549. @itemize
  20550. @item
  20551. Read a grid from @file{pattern}, and center it on a grid of size
  20552. 300x300 pixels:
  20553. @example
  20554. life=f=pattern:s=300x300
  20555. @end example
  20556. @item
  20557. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  20558. @example
  20559. life=ratio=2/3:s=200x200
  20560. @end example
  20561. @item
  20562. Specify a custom rule for evolving a randomly generated grid:
  20563. @example
  20564. life=rule=S14/B34
  20565. @end example
  20566. @item
  20567. Full example with slow death effect (mold) using @command{ffplay}:
  20568. @example
  20569. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  20570. @end example
  20571. @end itemize
  20572. @anchor{allrgb}
  20573. @anchor{allyuv}
  20574. @anchor{color}
  20575. @anchor{colorchart}
  20576. @anchor{colorspectrum}
  20577. @anchor{haldclutsrc}
  20578. @anchor{nullsrc}
  20579. @anchor{pal75bars}
  20580. @anchor{pal100bars}
  20581. @anchor{rgbtestsrc}
  20582. @anchor{smptebars}
  20583. @anchor{smptehdbars}
  20584. @anchor{testsrc}
  20585. @anchor{testsrc2}
  20586. @anchor{yuvtestsrc}
  20587. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  20588. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  20589. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  20590. The @code{color} source provides an uniformly colored input.
  20591. The @code{colorchart} source provides a colors checker chart.
  20592. The @code{colorspectrum} source provides a color spectrum input.
  20593. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  20594. @ref{haldclut} filter.
  20595. The @code{nullsrc} source returns unprocessed video frames. It is
  20596. mainly useful to be employed in analysis / debugging tools, or as the
  20597. source for filters which ignore the input data.
  20598. The @code{pal75bars} source generates a color bars pattern, based on
  20599. EBU PAL recommendations with 75% color levels.
  20600. The @code{pal100bars} source generates a color bars pattern, based on
  20601. EBU PAL recommendations with 100% color levels.
  20602. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  20603. detecting RGB vs BGR issues. You should see a red, green and blue
  20604. stripe from top to bottom.
  20605. The @code{smptebars} source generates a color bars pattern, based on
  20606. the SMPTE Engineering Guideline EG 1-1990.
  20607. The @code{smptehdbars} source generates a color bars pattern, based on
  20608. the SMPTE RP 219-2002.
  20609. The @code{testsrc} source generates a test video pattern, showing a
  20610. color pattern, a scrolling gradient and a timestamp. This is mainly
  20611. intended for testing purposes.
  20612. The @code{testsrc2} source is similar to testsrc, but supports more
  20613. pixel formats instead of just @code{rgb24}. This allows using it as an
  20614. input for other tests without requiring a format conversion.
  20615. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  20616. see a y, cb and cr stripe from top to bottom.
  20617. The sources accept the following parameters:
  20618. @table @option
  20619. @item level
  20620. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  20621. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  20622. pixels to be used as identity matrix for 3D lookup tables. Each component is
  20623. coded on a @code{1/(N*N)} scale.
  20624. @item color, c
  20625. Specify the color of the source, only available in the @code{color}
  20626. source. For the syntax of this option, check the
  20627. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20628. @item size, s
  20629. Specify the size of the sourced video. For the syntax of this option, check the
  20630. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20631. The default value is @code{320x240}.
  20632. This option is not available with the @code{allrgb}, @code{allyuv}, and
  20633. @code{haldclutsrc} filters.
  20634. @item rate, r
  20635. Specify the frame rate of the sourced video, as the number of frames
  20636. generated per second. It has to be a string in the format
  20637. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20638. number or a valid video frame rate abbreviation. The default value is
  20639. "25".
  20640. @item duration, d
  20641. Set the duration of the sourced video. See
  20642. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20643. for the accepted syntax.
  20644. If not specified, or the expressed duration is negative, the video is
  20645. supposed to be generated forever.
  20646. Since the frame rate is used as time base, all frames including the last one
  20647. will have their full duration. If the specified duration is not a multiple
  20648. of the frame duration, it will be rounded up.
  20649. @item sar
  20650. Set the sample aspect ratio of the sourced video.
  20651. @item alpha
  20652. Specify the alpha (opacity) of the background, only available in the
  20653. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  20654. 255 (fully opaque, the default).
  20655. @item decimals, n
  20656. Set the number of decimals to show in the timestamp, only available in the
  20657. @code{testsrc} source.
  20658. The displayed timestamp value will correspond to the original
  20659. timestamp value multiplied by the power of 10 of the specified
  20660. value. Default value is 0.
  20661. @item type
  20662. Set the type of the color spectrum, only available in the
  20663. @code{colorspectrum} source. Can be one of the following:
  20664. @table @samp
  20665. @item black
  20666. @item white
  20667. @item all
  20668. @end table
  20669. @item patch_size
  20670. Set patch size of single color patch, only available in the
  20671. @code{colorchart} source. Default is @code{64x64}.
  20672. @item preset
  20673. Set colorchecker colors preset, only available in the
  20674. @code{colorchart} source.
  20675. Available values are:
  20676. @table @samp
  20677. @item reference
  20678. @item skintones
  20679. @end table
  20680. Default value is @code{reference}.
  20681. @end table
  20682. @subsection Examples
  20683. @itemize
  20684. @item
  20685. Generate a video with a duration of 5.3 seconds, with size
  20686. 176x144 and a frame rate of 10 frames per second:
  20687. @example
  20688. testsrc=duration=5.3:size=qcif:rate=10
  20689. @end example
  20690. @item
  20691. The following graph description will generate a red source
  20692. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  20693. frames per second:
  20694. @example
  20695. color=c=red@@0.2:s=qcif:r=10
  20696. @end example
  20697. @item
  20698. If the input content is to be ignored, @code{nullsrc} can be used. The
  20699. following command generates noise in the luminance plane by employing
  20700. the @code{geq} filter:
  20701. @example
  20702. nullsrc=s=256x256, geq=random(1)*255:128:128
  20703. @end example
  20704. @end itemize
  20705. @subsection Commands
  20706. The @code{color} source supports the following commands:
  20707. @table @option
  20708. @item c, color
  20709. Set the color of the created image. Accepts the same syntax of the
  20710. corresponding @option{color} option.
  20711. @end table
  20712. @section openclsrc
  20713. Generate video using an OpenCL program.
  20714. @table @option
  20715. @item source
  20716. OpenCL program source file.
  20717. @item kernel
  20718. Kernel name in program.
  20719. @item size, s
  20720. Size of frames to generate. This must be set.
  20721. @item format
  20722. Pixel format to use for the generated frames. This must be set.
  20723. @item rate, r
  20724. Number of frames generated every second. Default value is '25'.
  20725. @end table
  20726. For details of how the program loading works, see the @ref{program_opencl}
  20727. filter.
  20728. Example programs:
  20729. @itemize
  20730. @item
  20731. Generate a colour ramp by setting pixel values from the position of the pixel
  20732. in the output image. (Note that this will work with all pixel formats, but
  20733. the generated output will not be the same.)
  20734. @verbatim
  20735. __kernel void ramp(__write_only image2d_t dst,
  20736. unsigned int index)
  20737. {
  20738. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  20739. float4 val;
  20740. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  20741. write_imagef(dst, loc, val);
  20742. }
  20743. @end verbatim
  20744. @item
  20745. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  20746. @verbatim
  20747. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  20748. unsigned int index)
  20749. {
  20750. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  20751. float4 value = 0.0f;
  20752. int x = loc.x + index;
  20753. int y = loc.y + index;
  20754. while (x > 0 || y > 0) {
  20755. if (x % 3 == 1 && y % 3 == 1) {
  20756. value = 1.0f;
  20757. break;
  20758. }
  20759. x /= 3;
  20760. y /= 3;
  20761. }
  20762. write_imagef(dst, loc, value);
  20763. }
  20764. @end verbatim
  20765. @end itemize
  20766. @section sierpinski
  20767. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  20768. This source accepts the following options:
  20769. @table @option
  20770. @item size, s
  20771. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20772. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20773. @item rate, r
  20774. Set frame rate, expressed as number of frames per second. Default
  20775. value is "25".
  20776. @item seed
  20777. Set seed which is used for random panning.
  20778. @item jump
  20779. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  20780. @item type
  20781. Set fractal type, can be default @code{carpet} or @code{triangle}.
  20782. @end table
  20783. @c man end VIDEO SOURCES
  20784. @chapter Video Sinks
  20785. @c man begin VIDEO SINKS
  20786. Below is a description of the currently available video sinks.
  20787. @section buffersink
  20788. Buffer video frames, and make them available to the end of the filter
  20789. graph.
  20790. This sink is mainly intended for programmatic use, in particular
  20791. through the interface defined in @file{libavfilter/buffersink.h}
  20792. or the options system.
  20793. It accepts a pointer to an AVBufferSinkContext structure, which
  20794. defines the incoming buffers' formats, to be passed as the opaque
  20795. parameter to @code{avfilter_init_filter} for initialization.
  20796. @section nullsink
  20797. Null video sink: do absolutely nothing with the input video. It is
  20798. mainly useful as a template and for use in analysis / debugging
  20799. tools.
  20800. @c man end VIDEO SINKS
  20801. @chapter Multimedia Filters
  20802. @c man begin MULTIMEDIA FILTERS
  20803. Below is a description of the currently available multimedia filters.
  20804. @section a3dscope
  20805. Convert input audio to 3d scope video output.
  20806. The filter accepts the following options:
  20807. @table @option
  20808. @item rate, r
  20809. Set frame rate, expressed as number of frames per second. Default
  20810. value is "25".
  20811. @item size, s
  20812. Specify the video size for the output. For the syntax of this option, check the
  20813. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20814. Default value is @code{hd720}.
  20815. @item fov
  20816. Set the camera field of view. Default is 90 degrees.
  20817. Allowed range is from 40 to 150.
  20818. @item roll
  20819. Set the camera roll.
  20820. @item pitch
  20821. Set the camera pitch.
  20822. @item yaw
  20823. Set the camera yaw.
  20824. @item xzoom
  20825. Set the camera zoom on X-axis.
  20826. @item yzoom
  20827. Set the camera zoom on Y-axis.
  20828. @item zzoom
  20829. Set the camera zoom on Z-axis.
  20830. @item xpos
  20831. Set the camera position on X-axis.
  20832. @item ypos
  20833. Set the camera position on Y-axis.
  20834. @item zpos
  20835. Set the camera position on Z-axis.
  20836. @item length
  20837. Set the length of displayed audio waves in number of frames.
  20838. @end table
  20839. @subsection Commands
  20840. Filter supports the some above options as @ref{commands}.
  20841. @section abitscope
  20842. Convert input audio to a video output, displaying the audio bit scope.
  20843. The filter accepts the following options:
  20844. @table @option
  20845. @item rate, r
  20846. Set frame rate, expressed as number of frames per second. Default
  20847. value is "25".
  20848. @item size, s
  20849. Specify the video size for the output. For the syntax of this option, check the
  20850. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20851. Default value is @code{1024x256}.
  20852. @item colors
  20853. Specify list of colors separated by space or by '|' which will be used to
  20854. draw channels. Unrecognized or missing colors will be replaced
  20855. by white color.
  20856. @item mode, m
  20857. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  20858. @end table
  20859. @section adrawgraph
  20860. Draw a graph using input audio metadata.
  20861. See @ref{drawgraph}
  20862. @section agraphmonitor
  20863. See @ref{graphmonitor}.
  20864. @section ahistogram
  20865. Convert input audio to a video output, displaying the volume histogram.
  20866. The filter accepts the following options:
  20867. @table @option
  20868. @item dmode
  20869. Specify how histogram is calculated.
  20870. It accepts the following values:
  20871. @table @samp
  20872. @item single
  20873. Use single histogram for all channels.
  20874. @item separate
  20875. Use separate histogram for each channel.
  20876. @end table
  20877. Default is @code{single}.
  20878. @item rate, r
  20879. Set frame rate, expressed as number of frames per second. Default
  20880. value is "25".
  20881. @item size, s
  20882. Specify the video size for the output. For the syntax of this option, check the
  20883. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20884. Default value is @code{hd720}.
  20885. @item scale
  20886. Set display scale.
  20887. It accepts the following values:
  20888. @table @samp
  20889. @item log
  20890. logarithmic
  20891. @item sqrt
  20892. square root
  20893. @item cbrt
  20894. cubic root
  20895. @item lin
  20896. linear
  20897. @item rlog
  20898. reverse logarithmic
  20899. @end table
  20900. Default is @code{log}.
  20901. @item ascale
  20902. Set amplitude scale.
  20903. It accepts the following values:
  20904. @table @samp
  20905. @item log
  20906. logarithmic
  20907. @item lin
  20908. linear
  20909. @end table
  20910. Default is @code{log}.
  20911. @item acount
  20912. Set how much frames to accumulate in histogram.
  20913. Default is 1. Setting this to -1 accumulates all frames.
  20914. @item rheight
  20915. Set histogram ratio of window height.
  20916. @item slide
  20917. Set sonogram sliding.
  20918. It accepts the following values:
  20919. @table @samp
  20920. @item replace
  20921. replace old rows with new ones.
  20922. @item scroll
  20923. scroll from top to bottom.
  20924. @end table
  20925. Default is @code{replace}.
  20926. @item hmode
  20927. Set histogram mode.
  20928. It accepts the following values:
  20929. @table @samp
  20930. @item abs
  20931. Use absolute values of samples.
  20932. @item sign
  20933. Use untouched values of samples.
  20934. @end table
  20935. Default is @code{abs}.
  20936. @end table
  20937. @section aphasemeter
  20938. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  20939. representing mean phase of current audio frame. A video output can also be produced and is
  20940. enabled by default. The audio is passed through as first output.
  20941. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  20942. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  20943. and @code{1} means channels are in phase.
  20944. The filter accepts the following options, all related to its video output:
  20945. @table @option
  20946. @item rate, r
  20947. Set the output frame rate. Default value is @code{25}.
  20948. @item size, s
  20949. Set the video size for the output. For the syntax of this option, check the
  20950. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20951. Default value is @code{800x400}.
  20952. @item rc
  20953. @item gc
  20954. @item bc
  20955. Specify the red, green, blue contrast. Default values are @code{2},
  20956. @code{7} and @code{1}.
  20957. Allowed range is @code{[0, 255]}.
  20958. @item mpc
  20959. Set color which will be used for drawing median phase. If color is
  20960. @code{none} which is default, no median phase value will be drawn.
  20961. @item video
  20962. Enable video output. Default is enabled.
  20963. @end table
  20964. @subsection phasing detection
  20965. The filter also detects out of phase and mono sequences in stereo streams.
  20966. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  20967. The filter accepts the following options for this detection:
  20968. @table @option
  20969. @item phasing
  20970. Enable mono and out of phase detection. Default is disabled.
  20971. @item tolerance, t
  20972. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  20973. Allowed range is @code{[0, 1]}.
  20974. @item angle, a
  20975. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  20976. Allowed range is @code{[90, 180]}.
  20977. @item duration, d
  20978. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  20979. @end table
  20980. @subsection Examples
  20981. @itemize
  20982. @item
  20983. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  20984. @example
  20985. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  20986. @end example
  20987. @end itemize
  20988. @section avectorscope
  20989. Convert input audio to a video output, representing the audio vector
  20990. scope.
  20991. The filter is used to measure the difference between channels of stereo
  20992. audio stream. A monaural signal, consisting of identical left and right
  20993. signal, results in straight vertical line. Any stereo separation is visible
  20994. as a deviation from this line, creating a Lissajous figure.
  20995. If the straight (or deviation from it) but horizontal line appears this
  20996. indicates that the left and right channels are out of phase.
  20997. The filter accepts the following options:
  20998. @table @option
  20999. @item mode, m
  21000. Set the vectorscope mode.
  21001. Available values are:
  21002. @table @samp
  21003. @item lissajous
  21004. Lissajous rotated by 45 degrees.
  21005. @item lissajous_xy
  21006. Same as above but not rotated.
  21007. @item polar
  21008. Shape resembling half of circle.
  21009. @end table
  21010. Default value is @samp{lissajous}.
  21011. @item size, s
  21012. Set the video size for the output. For the syntax of this option, check the
  21013. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21014. Default value is @code{400x400}.
  21015. @item rate, r
  21016. Set the output frame rate. Default value is @code{25}.
  21017. @item rc
  21018. @item gc
  21019. @item bc
  21020. @item ac
  21021. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  21022. @code{160}, @code{80} and @code{255}.
  21023. Allowed range is @code{[0, 255]}.
  21024. @item rf
  21025. @item gf
  21026. @item bf
  21027. @item af
  21028. Specify the red, green, blue and alpha fade. Default values are @code{15},
  21029. @code{10}, @code{5} and @code{5}.
  21030. Allowed range is @code{[0, 255]}.
  21031. @item zoom
  21032. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  21033. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  21034. @item draw
  21035. Set the vectorscope drawing mode.
  21036. Available values are:
  21037. @table @samp
  21038. @item dot
  21039. Draw dot for each sample.
  21040. @item line
  21041. Draw line between previous and current sample.
  21042. @end table
  21043. Default value is @samp{dot}.
  21044. @item scale
  21045. Specify amplitude scale of audio samples.
  21046. Available values are:
  21047. @table @samp
  21048. @item lin
  21049. Linear.
  21050. @item sqrt
  21051. Square root.
  21052. @item cbrt
  21053. Cubic root.
  21054. @item log
  21055. Logarithmic.
  21056. @end table
  21057. @item swap
  21058. Swap left channel axis with right channel axis.
  21059. @item mirror
  21060. Mirror axis.
  21061. @table @samp
  21062. @item none
  21063. No mirror.
  21064. @item x
  21065. Mirror only x axis.
  21066. @item y
  21067. Mirror only y axis.
  21068. @item xy
  21069. Mirror both axis.
  21070. @end table
  21071. @end table
  21072. @subsection Examples
  21073. @itemize
  21074. @item
  21075. Complete example using @command{ffplay}:
  21076. @example
  21077. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  21078. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  21079. @end example
  21080. @end itemize
  21081. @subsection Commands
  21082. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  21083. @section bench, abench
  21084. Benchmark part of a filtergraph.
  21085. The filter accepts the following options:
  21086. @table @option
  21087. @item action
  21088. Start or stop a timer.
  21089. Available values are:
  21090. @table @samp
  21091. @item start
  21092. Get the current time, set it as frame metadata (using the key
  21093. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  21094. @item stop
  21095. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  21096. the input frame metadata to get the time difference. Time difference, average,
  21097. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  21098. @code{min}) are then printed. The timestamps are expressed in seconds.
  21099. @end table
  21100. @end table
  21101. @subsection Examples
  21102. @itemize
  21103. @item
  21104. Benchmark @ref{selectivecolor} filter:
  21105. @example
  21106. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  21107. @end example
  21108. @end itemize
  21109. @section concat
  21110. Concatenate audio and video streams, joining them together one after the
  21111. other.
  21112. The filter works on segments of synchronized video and audio streams. All
  21113. segments must have the same number of streams of each type, and that will
  21114. also be the number of streams at output.
  21115. The filter accepts the following options:
  21116. @table @option
  21117. @item n
  21118. Set the number of segments. Default is 2.
  21119. @item v
  21120. Set the number of output video streams, that is also the number of video
  21121. streams in each segment. Default is 1.
  21122. @item a
  21123. Set the number of output audio streams, that is also the number of audio
  21124. streams in each segment. Default is 0.
  21125. @item unsafe
  21126. Activate unsafe mode: do not fail if segments have a different format.
  21127. @end table
  21128. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  21129. @var{a} audio outputs.
  21130. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  21131. segment, in the same order as the outputs, then the inputs for the second
  21132. segment, etc.
  21133. Related streams do not always have exactly the same duration, for various
  21134. reasons including codec frame size or sloppy authoring. For that reason,
  21135. related synchronized streams (e.g. a video and its audio track) should be
  21136. concatenated at once. The concat filter will use the duration of the longest
  21137. stream in each segment (except the last one), and if necessary pad shorter
  21138. audio streams with silence.
  21139. For this filter to work correctly, all segments must start at timestamp 0.
  21140. All corresponding streams must have the same parameters in all segments; the
  21141. filtering system will automatically select a common pixel format for video
  21142. streams, and a common sample format, sample rate and channel layout for
  21143. audio streams, but other settings, such as resolution, must be converted
  21144. explicitly by the user.
  21145. Different frame rates are acceptable but will result in variable frame rate
  21146. at output; be sure to configure the output file to handle it.
  21147. @subsection Examples
  21148. @itemize
  21149. @item
  21150. Concatenate an opening, an episode and an ending, all in bilingual version
  21151. (video in stream 0, audio in streams 1 and 2):
  21152. @example
  21153. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  21154. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  21155. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  21156. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  21157. @end example
  21158. @item
  21159. Concatenate two parts, handling audio and video separately, using the
  21160. (a)movie sources, and adjusting the resolution:
  21161. @example
  21162. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  21163. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  21164. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  21165. @end example
  21166. Note that a desync will happen at the stitch if the audio and video streams
  21167. do not have exactly the same duration in the first file.
  21168. @end itemize
  21169. @subsection Commands
  21170. This filter supports the following commands:
  21171. @table @option
  21172. @item next
  21173. Close the current segment and step to the next one
  21174. @end table
  21175. @anchor{ebur128}
  21176. @section ebur128
  21177. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  21178. level. By default, it logs a message at a frequency of 10Hz with the
  21179. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  21180. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  21181. The filter can only analyze streams which have
  21182. sample format is double-precision floating point. The input stream will be converted to
  21183. this specification, if needed. Users may need to insert aformat and/or aresample filters
  21184. after this filter to obtain the original parameters.
  21185. The filter also has a video output (see the @var{video} option) with a real
  21186. time graph to observe the loudness evolution. The graphic contains the logged
  21187. message mentioned above, so it is not printed anymore when this option is set,
  21188. unless the verbose logging is set. The main graphing area contains the
  21189. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  21190. the momentary loudness (400 milliseconds), but can optionally be configured
  21191. to instead display short-term loudness (see @var{gauge}).
  21192. The green area marks a +/- 1LU target range around the target loudness
  21193. (-23LUFS by default, unless modified through @var{target}).
  21194. More information about the Loudness Recommendation EBU R128 on
  21195. @url{http://tech.ebu.ch/loudness}.
  21196. The filter accepts the following options:
  21197. @table @option
  21198. @item video
  21199. Activate the video output. The audio stream is passed unchanged whether this
  21200. option is set or no. The video stream will be the first output stream if
  21201. activated. Default is @code{0}.
  21202. @item size
  21203. Set the video size. This option is for video only. For the syntax of this
  21204. option, check the
  21205. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21206. Default and minimum resolution is @code{640x480}.
  21207. @item meter
  21208. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  21209. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  21210. other integer value between this range is allowed.
  21211. @item metadata
  21212. Set metadata injection. If set to @code{1}, the audio input will be segmented
  21213. into 100ms output frames, each of them containing various loudness information
  21214. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  21215. Default is @code{0}.
  21216. @item framelog
  21217. Force the frame logging level.
  21218. Available values are:
  21219. @table @samp
  21220. @item info
  21221. information logging level
  21222. @item verbose
  21223. verbose logging level
  21224. @end table
  21225. By default, the logging level is set to @var{info}. If the @option{video} or
  21226. the @option{metadata} options are set, it switches to @var{verbose}.
  21227. @item peak
  21228. Set peak mode(s).
  21229. Available modes can be cumulated (the option is a @code{flag} type). Possible
  21230. values are:
  21231. @table @samp
  21232. @item none
  21233. Disable any peak mode (default).
  21234. @item sample
  21235. Enable sample-peak mode.
  21236. Simple peak mode looking for the higher sample value. It logs a message
  21237. for sample-peak (identified by @code{SPK}).
  21238. @item true
  21239. Enable true-peak mode.
  21240. If enabled, the peak lookup is done on an over-sampled version of the input
  21241. stream for better peak accuracy. It logs a message for true-peak.
  21242. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  21243. This mode requires a build with @code{libswresample}.
  21244. @end table
  21245. @item dualmono
  21246. Treat mono input files as "dual mono". If a mono file is intended for playback
  21247. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  21248. If set to @code{true}, this option will compensate for this effect.
  21249. Multi-channel input files are not affected by this option.
  21250. @item panlaw
  21251. Set a specific pan law to be used for the measurement of dual mono files.
  21252. This parameter is optional, and has a default value of -3.01dB.
  21253. @item target
  21254. Set a specific target level (in LUFS) used as relative zero in the visualization.
  21255. This parameter is optional and has a default value of -23LUFS as specified
  21256. by EBU R128. However, material published online may prefer a level of -16LUFS
  21257. (e.g. for use with podcasts or video platforms).
  21258. @item gauge
  21259. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  21260. @code{shortterm}. By default the momentary value will be used, but in certain
  21261. scenarios it may be more useful to observe the short term value instead (e.g.
  21262. live mixing).
  21263. @item scale
  21264. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  21265. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  21266. video output, not the summary or continuous log output.
  21267. @end table
  21268. @subsection Examples
  21269. @itemize
  21270. @item
  21271. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  21272. @example
  21273. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  21274. @end example
  21275. @item
  21276. Run an analysis with @command{ffmpeg}:
  21277. @example
  21278. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  21279. @end example
  21280. @end itemize
  21281. @section interleave, ainterleave
  21282. Temporally interleave frames from several inputs.
  21283. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  21284. These filters read frames from several inputs and send the oldest
  21285. queued frame to the output.
  21286. Input streams must have well defined, monotonically increasing frame
  21287. timestamp values.
  21288. In order to submit one frame to output, these filters need to enqueue
  21289. at least one frame for each input, so they cannot work in case one
  21290. input is not yet terminated and will not receive incoming frames.
  21291. For example consider the case when one input is a @code{select} filter
  21292. which always drops input frames. The @code{interleave} filter will keep
  21293. reading from that input, but it will never be able to send new frames
  21294. to output until the input sends an end-of-stream signal.
  21295. Also, depending on inputs synchronization, the filters will drop
  21296. frames in case one input receives more frames than the other ones, and
  21297. the queue is already filled.
  21298. These filters accept the following options:
  21299. @table @option
  21300. @item nb_inputs, n
  21301. Set the number of different inputs, it is 2 by default.
  21302. @item duration
  21303. How to determine the end-of-stream.
  21304. @table @option
  21305. @item longest
  21306. The duration of the longest input. (default)
  21307. @item shortest
  21308. The duration of the shortest input.
  21309. @item first
  21310. The duration of the first input.
  21311. @end table
  21312. @end table
  21313. @subsection Examples
  21314. @itemize
  21315. @item
  21316. Interleave frames belonging to different streams using @command{ffmpeg}:
  21317. @example
  21318. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  21319. @end example
  21320. @item
  21321. Add flickering blur effect:
  21322. @example
  21323. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  21324. @end example
  21325. @end itemize
  21326. @section latency, alatency
  21327. Measure filtering latency.
  21328. Report previous filter filtering latency, delay in number of audio samples for audio filters
  21329. or number of video frames for video filters.
  21330. On end of input stream, filter will report min and max measured latency for previous running filter
  21331. in filtergraph.
  21332. @section metadata, ametadata
  21333. Manipulate frame metadata.
  21334. This filter accepts the following options:
  21335. @table @option
  21336. @item mode
  21337. Set mode of operation of the filter.
  21338. Can be one of the following:
  21339. @table @samp
  21340. @item select
  21341. If both @code{value} and @code{key} is set, select frames
  21342. which have such metadata. If only @code{key} is set, select
  21343. every frame that has such key in metadata.
  21344. @item add
  21345. Add new metadata @code{key} and @code{value}. If key is already available
  21346. do nothing.
  21347. @item modify
  21348. Modify value of already present key.
  21349. @item delete
  21350. If @code{value} is set, delete only keys that have such value.
  21351. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  21352. the frame.
  21353. @item print
  21354. Print key and its value if metadata was found. If @code{key} is not set print all
  21355. metadata values available in frame.
  21356. @end table
  21357. @item key
  21358. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  21359. @item value
  21360. Set metadata value which will be used. This option is mandatory for
  21361. @code{modify} and @code{add} mode.
  21362. @item function
  21363. Which function to use when comparing metadata value and @code{value}.
  21364. Can be one of following:
  21365. @table @samp
  21366. @item same_str
  21367. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  21368. @item starts_with
  21369. Values are interpreted as strings, returns true if metadata value starts with
  21370. the @code{value} option string.
  21371. @item less
  21372. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  21373. @item equal
  21374. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  21375. @item greater
  21376. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  21377. @item expr
  21378. Values are interpreted as floats, returns true if expression from option @code{expr}
  21379. evaluates to true.
  21380. @item ends_with
  21381. Values are interpreted as strings, returns true if metadata value ends with
  21382. the @code{value} option string.
  21383. @end table
  21384. @item expr
  21385. Set expression which is used when @code{function} is set to @code{expr}.
  21386. The expression is evaluated through the eval API and can contain the following
  21387. constants:
  21388. @table @option
  21389. @item VALUE1, FRAMEVAL
  21390. Float representation of @code{value} from metadata key.
  21391. @item VALUE2, USERVAL
  21392. Float representation of @code{value} as supplied by user in @code{value} option.
  21393. @end table
  21394. @item file
  21395. If specified in @code{print} mode, output is written to the named file. Instead of
  21396. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  21397. for standard output. If @code{file} option is not set, output is written to the log
  21398. with AV_LOG_INFO loglevel.
  21399. @item direct
  21400. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  21401. @end table
  21402. @subsection Examples
  21403. @itemize
  21404. @item
  21405. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  21406. between 0 and 1.
  21407. @example
  21408. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  21409. @end example
  21410. @item
  21411. Print silencedetect output to file @file{metadata.txt}.
  21412. @example
  21413. silencedetect,ametadata=mode=print:file=metadata.txt
  21414. @end example
  21415. @item
  21416. Direct all metadata to a pipe with file descriptor 4.
  21417. @example
  21418. metadata=mode=print:file='pipe\:4'
  21419. @end example
  21420. @end itemize
  21421. @section perms, aperms
  21422. Set read/write permissions for the output frames.
  21423. These filters are mainly aimed at developers to test direct path in the
  21424. following filter in the filtergraph.
  21425. The filters accept the following options:
  21426. @table @option
  21427. @item mode
  21428. Select the permissions mode.
  21429. It accepts the following values:
  21430. @table @samp
  21431. @item none
  21432. Do nothing. This is the default.
  21433. @item ro
  21434. Set all the output frames read-only.
  21435. @item rw
  21436. Set all the output frames directly writable.
  21437. @item toggle
  21438. Make the frame read-only if writable, and writable if read-only.
  21439. @item random
  21440. Set each output frame read-only or writable randomly.
  21441. @end table
  21442. @item seed
  21443. Set the seed for the @var{random} mode, must be an integer included between
  21444. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  21445. @code{-1}, the filter will try to use a good random seed on a best effort
  21446. basis.
  21447. @end table
  21448. Note: in case of auto-inserted filter between the permission filter and the
  21449. following one, the permission might not be received as expected in that
  21450. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  21451. perms/aperms filter can avoid this problem.
  21452. @section realtime, arealtime
  21453. Slow down filtering to match real time approximately.
  21454. These filters will pause the filtering for a variable amount of time to
  21455. match the output rate with the input timestamps.
  21456. They are similar to the @option{re} option to @code{ffmpeg}.
  21457. They accept the following options:
  21458. @table @option
  21459. @item limit
  21460. Time limit for the pauses. Any pause longer than that will be considered
  21461. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  21462. @item speed
  21463. Speed factor for processing. The value must be a float larger than zero.
  21464. Values larger than 1.0 will result in faster than realtime processing,
  21465. smaller will slow processing down. The @var{limit} is automatically adapted
  21466. accordingly. Default is 1.0.
  21467. A processing speed faster than what is possible without these filters cannot
  21468. be achieved.
  21469. @end table
  21470. @subsection Commands
  21471. Both filters supports the all above options as @ref{commands}.
  21472. @section segment, asegment
  21473. Split single input stream into multiple streams.
  21474. This filter does opposite of concat filters.
  21475. @code{segment} works on video frames, @code{asegment} on audio samples.
  21476. This filter accepts the following options:
  21477. @table @option
  21478. @item timestamps
  21479. Timestamps of output segments separated by '|'. The first segment will run
  21480. from the beginning of the input stream. The last segment will run until
  21481. the end of the input stream
  21482. @item frames, samples
  21483. Exact frame/sample count to split the segments.
  21484. @end table
  21485. In all cases, prefixing an each segment with '+' will make it relative to the
  21486. previous segment.
  21487. @subsection Examples
  21488. @itemize
  21489. @item
  21490. Split input audio stream into three output audio streams, starting at start of input audio stream
  21491. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  21492. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  21493. @example
  21494. asegment=timestamps="60|150"
  21495. @end example
  21496. @end itemize
  21497. @anchor{select}
  21498. @section select, aselect
  21499. Select frames to pass in output.
  21500. This filter accepts the following options:
  21501. @table @option
  21502. @item expr, e
  21503. Set expression, which is evaluated for each input frame.
  21504. If the expression is evaluated to zero, the frame is discarded.
  21505. If the evaluation result is negative or NaN, the frame is sent to the
  21506. first output; otherwise it is sent to the output with index
  21507. @code{ceil(val)-1}, assuming that the input index starts from 0.
  21508. For example a value of @code{1.2} corresponds to the output with index
  21509. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  21510. @item outputs, n
  21511. Set the number of outputs. The output to which to send the selected
  21512. frame is based on the result of the evaluation. Default value is 1.
  21513. @end table
  21514. The expression can contain the following constants:
  21515. @table @option
  21516. @item n
  21517. The (sequential) number of the filtered frame, starting from 0.
  21518. @item selected_n
  21519. The (sequential) number of the selected frame, starting from 0.
  21520. @item prev_selected_n
  21521. The sequential number of the last selected frame. It's NAN if undefined.
  21522. @item TB
  21523. The timebase of the input timestamps.
  21524. @item pts
  21525. The PTS (Presentation TimeStamp) of the filtered frame,
  21526. expressed in @var{TB} units. It's NAN if undefined.
  21527. @item t
  21528. The PTS of the filtered frame,
  21529. expressed in seconds. It's NAN if undefined.
  21530. @item prev_pts
  21531. The PTS of the previously filtered frame. It's NAN if undefined.
  21532. @item prev_selected_pts
  21533. The PTS of the last previously filtered frame. It's NAN if undefined.
  21534. @item prev_selected_t
  21535. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  21536. @item start_pts
  21537. The first PTS in the stream which is not NAN. It remains NAN if not found.
  21538. @item start_t
  21539. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  21540. @item pict_type @emph{(video only)}
  21541. The type of the filtered frame. It can assume one of the following
  21542. values:
  21543. @table @option
  21544. @item I
  21545. @item P
  21546. @item B
  21547. @item S
  21548. @item SI
  21549. @item SP
  21550. @item BI
  21551. @end table
  21552. @item interlace_type @emph{(video only)}
  21553. The frame interlace type. It can assume one of the following values:
  21554. @table @option
  21555. @item PROGRESSIVE
  21556. The frame is progressive (not interlaced).
  21557. @item TOPFIRST
  21558. The frame is top-field-first.
  21559. @item BOTTOMFIRST
  21560. The frame is bottom-field-first.
  21561. @end table
  21562. @item consumed_sample_n @emph{(audio only)}
  21563. the number of selected samples before the current frame
  21564. @item samples_n @emph{(audio only)}
  21565. the number of samples in the current frame
  21566. @item sample_rate @emph{(audio only)}
  21567. the input sample rate
  21568. @item key
  21569. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  21570. @item pos
  21571. the position in the file of the filtered frame, -1 if the information
  21572. is not available (e.g. for synthetic video)
  21573. @item scene @emph{(video only)}
  21574. value between 0 and 1 to indicate a new scene; a low value reflects a low
  21575. probability for the current frame to introduce a new scene, while a higher
  21576. value means the current frame is more likely to be one (see the example below)
  21577. @item concatdec_select
  21578. The concat demuxer can select only part of a concat input file by setting an
  21579. inpoint and an outpoint, but the output packets may not be entirely contained
  21580. in the selected interval. By using this variable, it is possible to skip frames
  21581. generated by the concat demuxer which are not exactly contained in the selected
  21582. interval.
  21583. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  21584. and the @var{lavf.concat.duration} packet metadata values which are also
  21585. present in the decoded frames.
  21586. The @var{concatdec_select} variable is -1 if the frame pts is at least
  21587. start_time and either the duration metadata is missing or the frame pts is less
  21588. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  21589. missing.
  21590. That basically means that an input frame is selected if its pts is within the
  21591. interval set by the concat demuxer.
  21592. @end table
  21593. The default value of the select expression is "1".
  21594. @subsection Examples
  21595. @itemize
  21596. @item
  21597. Select all frames in input:
  21598. @example
  21599. select
  21600. @end example
  21601. The example above is the same as:
  21602. @example
  21603. select=1
  21604. @end example
  21605. @item
  21606. Skip all frames:
  21607. @example
  21608. select=0
  21609. @end example
  21610. @item
  21611. Select only I-frames:
  21612. @example
  21613. select='eq(pict_type\,I)'
  21614. @end example
  21615. @item
  21616. Select one frame every 100:
  21617. @example
  21618. select='not(mod(n\,100))'
  21619. @end example
  21620. @item
  21621. Select only frames contained in the 10-20 time interval:
  21622. @example
  21623. select=between(t\,10\,20)
  21624. @end example
  21625. @item
  21626. Select only I-frames contained in the 10-20 time interval:
  21627. @example
  21628. select=between(t\,10\,20)*eq(pict_type\,I)
  21629. @end example
  21630. @item
  21631. Select frames with a minimum distance of 10 seconds:
  21632. @example
  21633. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  21634. @end example
  21635. @item
  21636. Use aselect to select only audio frames with samples number > 100:
  21637. @example
  21638. aselect='gt(samples_n\,100)'
  21639. @end example
  21640. @item
  21641. Create a mosaic of the first scenes:
  21642. @example
  21643. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  21644. @end example
  21645. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  21646. choice.
  21647. @item
  21648. Send even and odd frames to separate outputs, and compose them:
  21649. @example
  21650. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  21651. @end example
  21652. @item
  21653. Select useful frames from an ffconcat file which is using inpoints and
  21654. outpoints but where the source files are not intra frame only.
  21655. @example
  21656. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  21657. @end example
  21658. @end itemize
  21659. @section sendcmd, asendcmd
  21660. Send commands to filters in the filtergraph.
  21661. These filters read commands to be sent to other filters in the
  21662. filtergraph.
  21663. @code{sendcmd} must be inserted between two video filters,
  21664. @code{asendcmd} must be inserted between two audio filters, but apart
  21665. from that they act the same way.
  21666. The specification of commands can be provided in the filter arguments
  21667. with the @var{commands} option, or in a file specified by the
  21668. @var{filename} option.
  21669. These filters accept the following options:
  21670. @table @option
  21671. @item commands, c
  21672. Set the commands to be read and sent to the other filters.
  21673. @item filename, f
  21674. Set the filename of the commands to be read and sent to the other
  21675. filters.
  21676. @end table
  21677. @subsection Commands syntax
  21678. A commands description consists of a sequence of interval
  21679. specifications, comprising a list of commands to be executed when a
  21680. particular event related to that interval occurs. The occurring event
  21681. is typically the current frame time entering or leaving a given time
  21682. interval.
  21683. An interval is specified by the following syntax:
  21684. @example
  21685. @var{START}[-@var{END}] @var{COMMANDS};
  21686. @end example
  21687. The time interval is specified by the @var{START} and @var{END} times.
  21688. @var{END} is optional and defaults to the maximum time.
  21689. The current frame time is considered within the specified interval if
  21690. it is included in the interval [@var{START}, @var{END}), that is when
  21691. the time is greater or equal to @var{START} and is lesser than
  21692. @var{END}.
  21693. @var{COMMANDS} consists of a sequence of one or more command
  21694. specifications, separated by ",", relating to that interval. The
  21695. syntax of a command specification is given by:
  21696. @example
  21697. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  21698. @end example
  21699. @var{FLAGS} is optional and specifies the type of events relating to
  21700. the time interval which enable sending the specified command, and must
  21701. be a non-null sequence of identifier flags separated by "+" or "|" and
  21702. enclosed between "[" and "]".
  21703. The following flags are recognized:
  21704. @table @option
  21705. @item enter
  21706. The command is sent when the current frame timestamp enters the
  21707. specified interval. In other words, the command is sent when the
  21708. previous frame timestamp was not in the given interval, and the
  21709. current is.
  21710. @item leave
  21711. The command is sent when the current frame timestamp leaves the
  21712. specified interval. In other words, the command is sent when the
  21713. previous frame timestamp was in the given interval, and the
  21714. current is not.
  21715. @item expr
  21716. The command @var{ARG} is interpreted as expression and result of
  21717. expression is passed as @var{ARG}.
  21718. The expression is evaluated through the eval API and can contain the following
  21719. constants:
  21720. @table @option
  21721. @item POS
  21722. Original position in the file of the frame, or undefined if undefined
  21723. for the current frame.
  21724. @item PTS
  21725. The presentation timestamp in input.
  21726. @item N
  21727. The count of the input frame for video or audio, starting from 0.
  21728. @item T
  21729. The time in seconds of the current frame.
  21730. @item TS
  21731. The start time in seconds of the current command interval.
  21732. @item TE
  21733. The end time in seconds of the current command interval.
  21734. @item TI
  21735. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  21736. @item W
  21737. The video frame width.
  21738. @item H
  21739. The video frame height.
  21740. @end table
  21741. @end table
  21742. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  21743. assumed.
  21744. @var{TARGET} specifies the target of the command, usually the name of
  21745. the filter class or a specific filter instance name.
  21746. @var{COMMAND} specifies the name of the command for the target filter.
  21747. @var{ARG} is optional and specifies the optional list of argument for
  21748. the given @var{COMMAND}.
  21749. Between one interval specification and another, whitespaces, or
  21750. sequences of characters starting with @code{#} until the end of line,
  21751. are ignored and can be used to annotate comments.
  21752. A simplified BNF description of the commands specification syntax
  21753. follows:
  21754. @example
  21755. @var{COMMAND_FLAG} ::= "enter" | "leave"
  21756. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  21757. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  21758. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  21759. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  21760. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  21761. @end example
  21762. @subsection Examples
  21763. @itemize
  21764. @item
  21765. Specify audio tempo change at second 4:
  21766. @example
  21767. asendcmd=c='4.0 atempo tempo 1.5',atempo
  21768. @end example
  21769. @item
  21770. Target a specific filter instance:
  21771. @example
  21772. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  21773. @end example
  21774. @item
  21775. Specify a list of drawtext and hue commands in a file.
  21776. @example
  21777. # show text in the interval 5-10
  21778. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  21779. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  21780. # desaturate the image in the interval 15-20
  21781. 15.0-20.0 [enter] hue s 0,
  21782. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  21783. [leave] hue s 1,
  21784. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  21785. # apply an exponential saturation fade-out effect, starting from time 25
  21786. 25 [enter] hue s exp(25-t)
  21787. @end example
  21788. A filtergraph allowing to read and process the above command list
  21789. stored in a file @file{test.cmd}, can be specified with:
  21790. @example
  21791. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  21792. @end example
  21793. @end itemize
  21794. @anchor{setpts}
  21795. @section setpts, asetpts
  21796. Change the PTS (presentation timestamp) of the input frames.
  21797. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  21798. This filter accepts the following options:
  21799. @table @option
  21800. @item expr
  21801. The expression which is evaluated for each frame to construct its timestamp.
  21802. @end table
  21803. The expression is evaluated through the eval API and can contain the following
  21804. constants:
  21805. @table @option
  21806. @item FRAME_RATE, FR
  21807. frame rate, only defined for constant frame-rate video
  21808. @item PTS
  21809. The presentation timestamp in input
  21810. @item N
  21811. The count of the input frame for video or the number of consumed samples,
  21812. not including the current frame for audio, starting from 0.
  21813. @item NB_CONSUMED_SAMPLES
  21814. The number of consumed samples, not including the current frame (only
  21815. audio)
  21816. @item NB_SAMPLES, S
  21817. The number of samples in the current frame (only audio)
  21818. @item SAMPLE_RATE, SR
  21819. The audio sample rate.
  21820. @item STARTPTS
  21821. The PTS of the first frame.
  21822. @item STARTT
  21823. the time in seconds of the first frame
  21824. @item INTERLACED
  21825. State whether the current frame is interlaced.
  21826. @item T
  21827. the time in seconds of the current frame
  21828. @item POS
  21829. original position in the file of the frame, or undefined if undefined
  21830. for the current frame
  21831. @item PREV_INPTS
  21832. The previous input PTS.
  21833. @item PREV_INT
  21834. previous input time in seconds
  21835. @item PREV_OUTPTS
  21836. The previous output PTS.
  21837. @item PREV_OUTT
  21838. previous output time in seconds
  21839. @item RTCTIME
  21840. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  21841. instead.
  21842. @item RTCSTART
  21843. The wallclock (RTC) time at the start of the movie in microseconds.
  21844. @item TB
  21845. The timebase of the input timestamps.
  21846. @end table
  21847. @subsection Examples
  21848. @itemize
  21849. @item
  21850. Start counting PTS from zero
  21851. @example
  21852. setpts=PTS-STARTPTS
  21853. @end example
  21854. @item
  21855. Apply fast motion effect:
  21856. @example
  21857. setpts=0.5*PTS
  21858. @end example
  21859. @item
  21860. Apply slow motion effect:
  21861. @example
  21862. setpts=2.0*PTS
  21863. @end example
  21864. @item
  21865. Set fixed rate of 25 frames per second:
  21866. @example
  21867. setpts=N/(25*TB)
  21868. @end example
  21869. @item
  21870. Set fixed rate 25 fps with some jitter:
  21871. @example
  21872. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  21873. @end example
  21874. @item
  21875. Apply an offset of 10 seconds to the input PTS:
  21876. @example
  21877. setpts=PTS+10/TB
  21878. @end example
  21879. @item
  21880. Generate timestamps from a "live source" and rebase onto the current timebase:
  21881. @example
  21882. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  21883. @end example
  21884. @item
  21885. Generate timestamps by counting samples:
  21886. @example
  21887. asetpts=N/SR/TB
  21888. @end example
  21889. @end itemize
  21890. @section setrange
  21891. Force color range for the output video frame.
  21892. The @code{setrange} filter marks the color range property for the
  21893. output frames. It does not change the input frame, but only sets the
  21894. corresponding property, which affects how the frame is treated by
  21895. following filters.
  21896. The filter accepts the following options:
  21897. @table @option
  21898. @item range
  21899. Available values are:
  21900. @table @samp
  21901. @item auto
  21902. Keep the same color range property.
  21903. @item unspecified, unknown
  21904. Set the color range as unspecified.
  21905. @item limited, tv, mpeg
  21906. Set the color range as limited.
  21907. @item full, pc, jpeg
  21908. Set the color range as full.
  21909. @end table
  21910. @end table
  21911. @section settb, asettb
  21912. Set the timebase to use for the output frames timestamps.
  21913. It is mainly useful for testing timebase configuration.
  21914. It accepts the following parameters:
  21915. @table @option
  21916. @item expr, tb
  21917. The expression which is evaluated into the output timebase.
  21918. @end table
  21919. The value for @option{tb} is an arithmetic expression representing a
  21920. rational. The expression can contain the constants "AVTB" (the default
  21921. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  21922. audio only). Default value is "intb".
  21923. @subsection Examples
  21924. @itemize
  21925. @item
  21926. Set the timebase to 1/25:
  21927. @example
  21928. settb=expr=1/25
  21929. @end example
  21930. @item
  21931. Set the timebase to 1/10:
  21932. @example
  21933. settb=expr=0.1
  21934. @end example
  21935. @item
  21936. Set the timebase to 1001/1000:
  21937. @example
  21938. settb=1+0.001
  21939. @end example
  21940. @item
  21941. Set the timebase to 2*intb:
  21942. @example
  21943. settb=2*intb
  21944. @end example
  21945. @item
  21946. Set the default timebase value:
  21947. @example
  21948. settb=AVTB
  21949. @end example
  21950. @end itemize
  21951. @section showcqt
  21952. Convert input audio to a video output representing frequency spectrum
  21953. logarithmically using Brown-Puckette constant Q transform algorithm with
  21954. direct frequency domain coefficient calculation (but the transform itself
  21955. is not really constant Q, instead the Q factor is actually variable/clamped),
  21956. with musical tone scale, from E0 to D#10.
  21957. The filter accepts the following options:
  21958. @table @option
  21959. @item size, s
  21960. Specify the video size for the output. It must be even. For the syntax of this option,
  21961. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21962. Default value is @code{1920x1080}.
  21963. @item fps, rate, r
  21964. Set the output frame rate. Default value is @code{25}.
  21965. @item bar_h
  21966. Set the bargraph height. It must be even. Default value is @code{-1} which
  21967. computes the bargraph height automatically.
  21968. @item axis_h
  21969. Set the axis height. It must be even. Default value is @code{-1} which computes
  21970. the axis height automatically.
  21971. @item sono_h
  21972. Set the sonogram height. It must be even. Default value is @code{-1} which
  21973. computes the sonogram height automatically.
  21974. @item fullhd
  21975. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  21976. instead. Default value is @code{1}.
  21977. @item sono_v, volume
  21978. Specify the sonogram volume expression. It can contain variables:
  21979. @table @option
  21980. @item bar_v
  21981. the @var{bar_v} evaluated expression
  21982. @item frequency, freq, f
  21983. the frequency where it is evaluated
  21984. @item timeclamp, tc
  21985. the value of @var{timeclamp} option
  21986. @end table
  21987. and functions:
  21988. @table @option
  21989. @item a_weighting(f)
  21990. A-weighting of equal loudness
  21991. @item b_weighting(f)
  21992. B-weighting of equal loudness
  21993. @item c_weighting(f)
  21994. C-weighting of equal loudness.
  21995. @end table
  21996. Default value is @code{16}.
  21997. @item bar_v, volume2
  21998. Specify the bargraph volume expression. It can contain variables:
  21999. @table @option
  22000. @item sono_v
  22001. the @var{sono_v} evaluated expression
  22002. @item frequency, freq, f
  22003. the frequency where it is evaluated
  22004. @item timeclamp, tc
  22005. the value of @var{timeclamp} option
  22006. @end table
  22007. and functions:
  22008. @table @option
  22009. @item a_weighting(f)
  22010. A-weighting of equal loudness
  22011. @item b_weighting(f)
  22012. B-weighting of equal loudness
  22013. @item c_weighting(f)
  22014. C-weighting of equal loudness.
  22015. @end table
  22016. Default value is @code{sono_v}.
  22017. @item sono_g, gamma
  22018. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  22019. higher gamma makes the spectrum having more range. Default value is @code{3}.
  22020. Acceptable range is @code{[1, 7]}.
  22021. @item bar_g, gamma2
  22022. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  22023. @code{[1, 7]}.
  22024. @item bar_t
  22025. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  22026. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  22027. @item timeclamp, tc
  22028. Specify the transform timeclamp. At low frequency, there is trade-off between
  22029. accuracy in time domain and frequency domain. If timeclamp is lower,
  22030. event in time domain is represented more accurately (such as fast bass drum),
  22031. otherwise event in frequency domain is represented more accurately
  22032. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  22033. @item attack
  22034. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  22035. limits future samples by applying asymmetric windowing in time domain, useful
  22036. when low latency is required. Accepted range is @code{[0, 1]}.
  22037. @item basefreq
  22038. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  22039. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  22040. @item endfreq
  22041. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  22042. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  22043. @item coeffclamp
  22044. This option is deprecated and ignored.
  22045. @item tlength
  22046. Specify the transform length in time domain. Use this option to control accuracy
  22047. trade-off between time domain and frequency domain at every frequency sample.
  22048. It can contain variables:
  22049. @table @option
  22050. @item frequency, freq, f
  22051. the frequency where it is evaluated
  22052. @item timeclamp, tc
  22053. the value of @var{timeclamp} option.
  22054. @end table
  22055. Default value is @code{384*tc/(384+tc*f)}.
  22056. @item count
  22057. Specify the transform count for every video frame. Default value is @code{6}.
  22058. Acceptable range is @code{[1, 30]}.
  22059. @item fcount
  22060. Specify the transform count for every single pixel. Default value is @code{0},
  22061. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  22062. @item fontfile
  22063. Specify font file for use with freetype to draw the axis. If not specified,
  22064. use embedded font. Note that drawing with font file or embedded font is not
  22065. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  22066. option instead.
  22067. @item font
  22068. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  22069. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  22070. escaping.
  22071. @item fontcolor
  22072. Specify font color expression. This is arithmetic expression that should return
  22073. integer value 0xRRGGBB. It can contain variables:
  22074. @table @option
  22075. @item frequency, freq, f
  22076. the frequency where it is evaluated
  22077. @item timeclamp, tc
  22078. the value of @var{timeclamp} option
  22079. @end table
  22080. and functions:
  22081. @table @option
  22082. @item midi(f)
  22083. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  22084. @item r(x), g(x), b(x)
  22085. red, green, and blue value of intensity x.
  22086. @end table
  22087. Default value is @code{st(0, (midi(f)-59.5)/12);
  22088. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  22089. r(1-ld(1)) + b(ld(1))}.
  22090. @item axisfile
  22091. Specify image file to draw the axis. This option override @var{fontfile} and
  22092. @var{fontcolor} option.
  22093. @item axis, text
  22094. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  22095. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  22096. Default value is @code{1}.
  22097. @item csp
  22098. Set colorspace. The accepted values are:
  22099. @table @samp
  22100. @item unspecified
  22101. Unspecified (default)
  22102. @item bt709
  22103. BT.709
  22104. @item fcc
  22105. FCC
  22106. @item bt470bg
  22107. BT.470BG or BT.601-6 625
  22108. @item smpte170m
  22109. SMPTE-170M or BT.601-6 525
  22110. @item smpte240m
  22111. SMPTE-240M
  22112. @item bt2020ncl
  22113. BT.2020 with non-constant luminance
  22114. @end table
  22115. @item cscheme
  22116. Set spectrogram color scheme. This is list of floating point values with format
  22117. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  22118. The default is @code{1|0.5|0|0|0.5|1}.
  22119. @end table
  22120. @subsection Examples
  22121. @itemize
  22122. @item
  22123. Playing audio while showing the spectrum:
  22124. @example
  22125. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  22126. @end example
  22127. @item
  22128. Same as above, but with frame rate 30 fps:
  22129. @example
  22130. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  22131. @end example
  22132. @item
  22133. Playing at 1280x720:
  22134. @example
  22135. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  22136. @end example
  22137. @item
  22138. Disable sonogram display:
  22139. @example
  22140. sono_h=0
  22141. @end example
  22142. @item
  22143. A1 and its harmonics: A1, A2, (near)E3, A3:
  22144. @example
  22145. 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),
  22146. asplit[a][out1]; [a] showcqt [out0]'
  22147. @end example
  22148. @item
  22149. Same as above, but with more accuracy in frequency domain:
  22150. @example
  22151. 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),
  22152. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  22153. @end example
  22154. @item
  22155. Custom volume:
  22156. @example
  22157. bar_v=10:sono_v=bar_v*a_weighting(f)
  22158. @end example
  22159. @item
  22160. Custom gamma, now spectrum is linear to the amplitude.
  22161. @example
  22162. bar_g=2:sono_g=2
  22163. @end example
  22164. @item
  22165. Custom tlength equation:
  22166. @example
  22167. 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)))'
  22168. @end example
  22169. @item
  22170. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  22171. @example
  22172. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  22173. @end example
  22174. @item
  22175. Custom font using fontconfig:
  22176. @example
  22177. font='Courier New,Monospace,mono|bold'
  22178. @end example
  22179. @item
  22180. Custom frequency range with custom axis using image file:
  22181. @example
  22182. axisfile=myaxis.png:basefreq=40:endfreq=10000
  22183. @end example
  22184. @end itemize
  22185. @section showfreqs
  22186. Convert input audio to video output representing the audio power spectrum.
  22187. Audio amplitude is on Y-axis while frequency is on X-axis.
  22188. The filter accepts the following options:
  22189. @table @option
  22190. @item size, s
  22191. Specify size of video. For the syntax of this option, check the
  22192. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22193. Default is @code{1024x512}.
  22194. @item rate, r
  22195. Set video rate. Default is @code{25}.
  22196. @item mode
  22197. Set display mode.
  22198. This set how each frequency bin will be represented.
  22199. It accepts the following values:
  22200. @table @samp
  22201. @item line
  22202. @item bar
  22203. @item dot
  22204. @end table
  22205. Default is @code{bar}.
  22206. @item ascale
  22207. Set amplitude scale.
  22208. It accepts the following values:
  22209. @table @samp
  22210. @item lin
  22211. Linear scale.
  22212. @item sqrt
  22213. Square root scale.
  22214. @item cbrt
  22215. Cubic root scale.
  22216. @item log
  22217. Logarithmic scale.
  22218. @end table
  22219. Default is @code{log}.
  22220. @item fscale
  22221. Set frequency scale.
  22222. It accepts the following values:
  22223. @table @samp
  22224. @item lin
  22225. Linear scale.
  22226. @item log
  22227. Logarithmic scale.
  22228. @item rlog
  22229. Reverse logarithmic scale.
  22230. @end table
  22231. Default is @code{lin}.
  22232. @item win_size
  22233. Set window size. Allowed range is from 16 to 65536.
  22234. Default is @code{2048}
  22235. @item win_func
  22236. Set windowing function.
  22237. It accepts the following values:
  22238. @table @samp
  22239. @item rect
  22240. @item bartlett
  22241. @item hanning
  22242. @item hamming
  22243. @item blackman
  22244. @item welch
  22245. @item flattop
  22246. @item bharris
  22247. @item bnuttall
  22248. @item bhann
  22249. @item sine
  22250. @item nuttall
  22251. @item lanczos
  22252. @item gauss
  22253. @item tukey
  22254. @item dolph
  22255. @item cauchy
  22256. @item parzen
  22257. @item poisson
  22258. @item bohman
  22259. @item kaiser
  22260. @end table
  22261. Default is @code{hanning}.
  22262. @item overlap
  22263. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  22264. which means optimal overlap for selected window function will be picked.
  22265. @item averaging
  22266. Set time averaging. Setting this to 0 will display current maximal peaks.
  22267. Default is @code{1}, which means time averaging is disabled.
  22268. @item colors
  22269. Specify list of colors separated by space or by '|' which will be used to
  22270. draw channel frequencies. Unrecognized or missing colors will be replaced
  22271. by white color.
  22272. @item cmode
  22273. Set channel display mode.
  22274. It accepts the following values:
  22275. @table @samp
  22276. @item combined
  22277. @item separate
  22278. @end table
  22279. Default is @code{combined}.
  22280. @item minamp
  22281. Set minimum amplitude used in @code{log} amplitude scaler.
  22282. @item data
  22283. Set data display mode.
  22284. It accepts the following values:
  22285. @table @samp
  22286. @item magnitude
  22287. @item phase
  22288. @item delay
  22289. @end table
  22290. Default is @code{magnitude}.
  22291. @item channels
  22292. Set channels to use when processing audio. By default all are processed.
  22293. @end table
  22294. @section showspatial
  22295. Convert stereo input audio to a video output, representing the spatial relationship
  22296. between two channels.
  22297. The filter accepts the following options:
  22298. @table @option
  22299. @item size, s
  22300. Specify the video size for the output. For the syntax of this option, check the
  22301. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22302. Default value is @code{512x512}.
  22303. @item win_size
  22304. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  22305. @item win_func
  22306. Set window function.
  22307. It accepts the following values:
  22308. @table @samp
  22309. @item rect
  22310. @item bartlett
  22311. @item hann
  22312. @item hanning
  22313. @item hamming
  22314. @item blackman
  22315. @item welch
  22316. @item flattop
  22317. @item bharris
  22318. @item bnuttall
  22319. @item bhann
  22320. @item sine
  22321. @item nuttall
  22322. @item lanczos
  22323. @item gauss
  22324. @item tukey
  22325. @item dolph
  22326. @item cauchy
  22327. @item parzen
  22328. @item poisson
  22329. @item bohman
  22330. @item kaiser
  22331. @end table
  22332. Default value is @code{hann}.
  22333. @item overlap
  22334. Set ratio of overlap window. Default value is @code{0.5}.
  22335. When value is @code{1} overlap is set to recommended size for specific
  22336. window function currently used.
  22337. @item rate, r
  22338. Set output framerate.
  22339. @end table
  22340. @anchor{showspectrum}
  22341. @section showspectrum
  22342. Convert input audio to a video output, representing the audio frequency
  22343. spectrum.
  22344. The filter accepts the following options:
  22345. @table @option
  22346. @item size, s
  22347. Specify the video size for the output. For the syntax of this option, check the
  22348. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22349. Default value is @code{640x512}.
  22350. @item slide
  22351. Specify how the spectrum should slide along the window.
  22352. It accepts the following values:
  22353. @table @samp
  22354. @item replace
  22355. the samples start again on the left when they reach the right
  22356. @item scroll
  22357. the samples scroll from right to left
  22358. @item fullframe
  22359. frames are only produced when the samples reach the right
  22360. @item rscroll
  22361. the samples scroll from left to right
  22362. @item lreplace
  22363. the samples start again on the right when they reach the left
  22364. @end table
  22365. Default value is @code{replace}.
  22366. @item mode
  22367. Specify display mode.
  22368. It accepts the following values:
  22369. @table @samp
  22370. @item combined
  22371. all channels are displayed in the same row
  22372. @item separate
  22373. all channels are displayed in separate rows
  22374. @end table
  22375. Default value is @samp{combined}.
  22376. @item color
  22377. Specify display color mode.
  22378. It accepts the following values:
  22379. @table @samp
  22380. @item channel
  22381. each channel is displayed in a separate color
  22382. @item intensity
  22383. each channel is displayed using the same color scheme
  22384. @item rainbow
  22385. each channel is displayed using the rainbow color scheme
  22386. @item moreland
  22387. each channel is displayed using the moreland color scheme
  22388. @item nebulae
  22389. each channel is displayed using the nebulae color scheme
  22390. @item fire
  22391. each channel is displayed using the fire color scheme
  22392. @item fiery
  22393. each channel is displayed using the fiery color scheme
  22394. @item fruit
  22395. each channel is displayed using the fruit color scheme
  22396. @item cool
  22397. each channel is displayed using the cool color scheme
  22398. @item magma
  22399. each channel is displayed using the magma color scheme
  22400. @item green
  22401. each channel is displayed using the green color scheme
  22402. @item viridis
  22403. each channel is displayed using the viridis color scheme
  22404. @item plasma
  22405. each channel is displayed using the plasma color scheme
  22406. @item cividis
  22407. each channel is displayed using the cividis color scheme
  22408. @item terrain
  22409. each channel is displayed using the terrain color scheme
  22410. @end table
  22411. Default value is @samp{channel}.
  22412. @item scale
  22413. Specify scale used for calculating intensity color values.
  22414. It accepts the following values:
  22415. @table @samp
  22416. @item lin
  22417. linear
  22418. @item sqrt
  22419. square root, default
  22420. @item cbrt
  22421. cubic root
  22422. @item log
  22423. logarithmic
  22424. @item 4thrt
  22425. 4th root
  22426. @item 5thrt
  22427. 5th root
  22428. @end table
  22429. Default value is @samp{sqrt}.
  22430. @item fscale
  22431. Specify frequency scale.
  22432. It accepts the following values:
  22433. @table @samp
  22434. @item lin
  22435. linear
  22436. @item log
  22437. logarithmic
  22438. @end table
  22439. Default value is @samp{lin}.
  22440. @item saturation
  22441. Set saturation modifier for displayed colors. Negative values provide
  22442. alternative color scheme. @code{0} is no saturation at all.
  22443. Saturation must be in [-10.0, 10.0] range.
  22444. Default value is @code{1}.
  22445. @item win_func
  22446. Set window function.
  22447. It accepts the following values:
  22448. @table @samp
  22449. @item rect
  22450. @item bartlett
  22451. @item hann
  22452. @item hanning
  22453. @item hamming
  22454. @item blackman
  22455. @item welch
  22456. @item flattop
  22457. @item bharris
  22458. @item bnuttall
  22459. @item bhann
  22460. @item sine
  22461. @item nuttall
  22462. @item lanczos
  22463. @item gauss
  22464. @item tukey
  22465. @item dolph
  22466. @item cauchy
  22467. @item parzen
  22468. @item poisson
  22469. @item bohman
  22470. @item kaiser
  22471. @end table
  22472. Default value is @code{hann}.
  22473. @item orientation
  22474. Set orientation of time vs frequency axis. Can be @code{vertical} or
  22475. @code{horizontal}. Default is @code{vertical}.
  22476. @item overlap
  22477. Set ratio of overlap window. Default value is @code{0}.
  22478. When value is @code{1} overlap is set to recommended size for specific
  22479. window function currently used.
  22480. @item gain
  22481. Set scale gain for calculating intensity color values.
  22482. Default value is @code{1}.
  22483. @item data
  22484. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  22485. or unwrapped phase: @code{uphase}.
  22486. @item rotation
  22487. Set color rotation, must be in [-1.0, 1.0] range.
  22488. Default value is @code{0}.
  22489. @item start
  22490. Set start frequency from which to display spectrogram. Default is @code{0}.
  22491. @item stop
  22492. Set stop frequency to which to display spectrogram. Default is @code{0}.
  22493. @item fps
  22494. Set upper frame rate limit. Default is @code{auto}, unlimited.
  22495. @item legend
  22496. Draw time and frequency axes and legends. Default is disabled.
  22497. @item drange
  22498. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  22499. Allowed range is from 10 to 200.
  22500. @item limit
  22501. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  22502. Allowed range is from -100 to 100.
  22503. @item opacity
  22504. Set opacity strength when using pixel format output with alpha component.
  22505. @end table
  22506. The usage is very similar to the showwaves filter; see the examples in that
  22507. section.
  22508. @subsection Examples
  22509. @itemize
  22510. @item
  22511. Large window with logarithmic color scaling:
  22512. @example
  22513. showspectrum=s=1280x480:scale=log
  22514. @end example
  22515. @item
  22516. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  22517. @example
  22518. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  22519. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  22520. @end example
  22521. @end itemize
  22522. @section showspectrumpic
  22523. Convert input audio to a single video frame, representing the audio frequency
  22524. spectrum.
  22525. The filter accepts the following options:
  22526. @table @option
  22527. @item size, s
  22528. Specify the video size for the output. For the syntax of this option, check the
  22529. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22530. Default value is @code{4096x2048}.
  22531. @item mode
  22532. Specify display mode.
  22533. It accepts the following values:
  22534. @table @samp
  22535. @item combined
  22536. all channels are displayed in the same row
  22537. @item separate
  22538. all channels are displayed in separate rows
  22539. @end table
  22540. Default value is @samp{combined}.
  22541. @item color
  22542. Specify display color mode.
  22543. It accepts the following values:
  22544. @table @samp
  22545. @item channel
  22546. each channel is displayed in a separate color
  22547. @item intensity
  22548. each channel is displayed using the same color scheme
  22549. @item rainbow
  22550. each channel is displayed using the rainbow color scheme
  22551. @item moreland
  22552. each channel is displayed using the moreland color scheme
  22553. @item nebulae
  22554. each channel is displayed using the nebulae color scheme
  22555. @item fire
  22556. each channel is displayed using the fire color scheme
  22557. @item fiery
  22558. each channel is displayed using the fiery color scheme
  22559. @item fruit
  22560. each channel is displayed using the fruit color scheme
  22561. @item cool
  22562. each channel is displayed using the cool color scheme
  22563. @item magma
  22564. each channel is displayed using the magma color scheme
  22565. @item green
  22566. each channel is displayed using the green color scheme
  22567. @item viridis
  22568. each channel is displayed using the viridis color scheme
  22569. @item plasma
  22570. each channel is displayed using the plasma color scheme
  22571. @item cividis
  22572. each channel is displayed using the cividis color scheme
  22573. @item terrain
  22574. each channel is displayed using the terrain color scheme
  22575. @end table
  22576. Default value is @samp{intensity}.
  22577. @item scale
  22578. Specify scale used for calculating intensity color values.
  22579. It accepts the following values:
  22580. @table @samp
  22581. @item lin
  22582. linear
  22583. @item sqrt
  22584. square root, default
  22585. @item cbrt
  22586. cubic root
  22587. @item log
  22588. logarithmic
  22589. @item 4thrt
  22590. 4th root
  22591. @item 5thrt
  22592. 5th root
  22593. @end table
  22594. Default value is @samp{log}.
  22595. @item fscale
  22596. Specify frequency scale.
  22597. It accepts the following values:
  22598. @table @samp
  22599. @item lin
  22600. linear
  22601. @item log
  22602. logarithmic
  22603. @end table
  22604. Default value is @samp{lin}.
  22605. @item saturation
  22606. Set saturation modifier for displayed colors. Negative values provide
  22607. alternative color scheme. @code{0} is no saturation at all.
  22608. Saturation must be in [-10.0, 10.0] range.
  22609. Default value is @code{1}.
  22610. @item win_func
  22611. Set window function.
  22612. It accepts the following values:
  22613. @table @samp
  22614. @item rect
  22615. @item bartlett
  22616. @item hann
  22617. @item hanning
  22618. @item hamming
  22619. @item blackman
  22620. @item welch
  22621. @item flattop
  22622. @item bharris
  22623. @item bnuttall
  22624. @item bhann
  22625. @item sine
  22626. @item nuttall
  22627. @item lanczos
  22628. @item gauss
  22629. @item tukey
  22630. @item dolph
  22631. @item cauchy
  22632. @item parzen
  22633. @item poisson
  22634. @item bohman
  22635. @item kaiser
  22636. @end table
  22637. Default value is @code{hann}.
  22638. @item orientation
  22639. Set orientation of time vs frequency axis. Can be @code{vertical} or
  22640. @code{horizontal}. Default is @code{vertical}.
  22641. @item gain
  22642. Set scale gain for calculating intensity color values.
  22643. Default value is @code{1}.
  22644. @item legend
  22645. Draw time and frequency axes and legends. Default is enabled.
  22646. @item rotation
  22647. Set color rotation, must be in [-1.0, 1.0] range.
  22648. Default value is @code{0}.
  22649. @item start
  22650. Set start frequency from which to display spectrogram. Default is @code{0}.
  22651. @item stop
  22652. Set stop frequency to which to display spectrogram. Default is @code{0}.
  22653. @item drange
  22654. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  22655. Allowed range is from 10 to 200.
  22656. @item limit
  22657. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  22658. Allowed range is from -100 to 100.
  22659. @item opacity
  22660. Set opacity strength when using pixel format output with alpha component.
  22661. @end table
  22662. @subsection Examples
  22663. @itemize
  22664. @item
  22665. Extract an audio spectrogram of a whole audio track
  22666. in a 1024x1024 picture using @command{ffmpeg}:
  22667. @example
  22668. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  22669. @end example
  22670. @end itemize
  22671. @section showvolume
  22672. Convert input audio volume to a video output.
  22673. The filter accepts the following options:
  22674. @table @option
  22675. @item rate, r
  22676. Set video rate.
  22677. @item b
  22678. Set border width, allowed range is [0, 5]. Default is 1.
  22679. @item w
  22680. Set channel width, allowed range is [80, 8192]. Default is 400.
  22681. @item h
  22682. Set channel height, allowed range is [1, 900]. Default is 20.
  22683. @item f
  22684. Set fade, allowed range is [0, 1]. Default is 0.95.
  22685. @item c
  22686. Set volume color expression.
  22687. The expression can use the following variables:
  22688. @table @option
  22689. @item VOLUME
  22690. Current max volume of channel in dB.
  22691. @item PEAK
  22692. Current peak.
  22693. @item CHANNEL
  22694. Current channel number, starting from 0.
  22695. @end table
  22696. @item t
  22697. If set, displays channel names. Default is enabled.
  22698. @item v
  22699. If set, displays volume values. Default is enabled.
  22700. @item o
  22701. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  22702. default is @code{h}.
  22703. @item s
  22704. Set step size, allowed range is [0, 5]. Default is 0, which means
  22705. step is disabled.
  22706. @item p
  22707. Set background opacity, allowed range is [0, 1]. Default is 0.
  22708. @item m
  22709. Set metering mode, can be peak: @code{p} or rms: @code{r},
  22710. default is @code{p}.
  22711. @item ds
  22712. Set display scale, can be linear: @code{lin} or log: @code{log},
  22713. default is @code{lin}.
  22714. @item dm
  22715. In second.
  22716. If set to > 0., display a line for the max level
  22717. in the previous seconds.
  22718. default is disabled: @code{0.}
  22719. @item dmc
  22720. The color of the max line. Use when @code{dm} option is set to > 0.
  22721. default is: @code{orange}
  22722. @end table
  22723. @section showwaves
  22724. Convert input audio to a video output, representing the samples waves.
  22725. The filter accepts the following options:
  22726. @table @option
  22727. @item size, s
  22728. Specify the video size for the output. For the syntax of this option, check the
  22729. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22730. Default value is @code{600x240}.
  22731. @item mode
  22732. Set display mode.
  22733. Available values are:
  22734. @table @samp
  22735. @item point
  22736. Draw a point for each sample.
  22737. @item line
  22738. Draw a vertical line for each sample.
  22739. @item p2p
  22740. Draw a point for each sample and a line between them.
  22741. @item cline
  22742. Draw a centered vertical line for each sample.
  22743. @end table
  22744. Default value is @code{point}.
  22745. @item n
  22746. Set the number of samples which are printed on the same column. A
  22747. larger value will decrease the frame rate. Must be a positive
  22748. integer. This option can be set only if the value for @var{rate}
  22749. is not explicitly specified.
  22750. @item rate, r
  22751. Set the (approximate) output frame rate. This is done by setting the
  22752. option @var{n}. Default value is "25".
  22753. @item split_channels
  22754. Set if channels should be drawn separately or overlap. Default value is 0.
  22755. @item colors
  22756. Set colors separated by '|' which are going to be used for drawing of each channel.
  22757. @item scale
  22758. Set amplitude scale.
  22759. Available values are:
  22760. @table @samp
  22761. @item lin
  22762. Linear.
  22763. @item log
  22764. Logarithmic.
  22765. @item sqrt
  22766. Square root.
  22767. @item cbrt
  22768. Cubic root.
  22769. @end table
  22770. Default is linear.
  22771. @item draw
  22772. Set the draw mode. This is mostly useful to set for high @var{n}.
  22773. Available values are:
  22774. @table @samp
  22775. @item scale
  22776. Scale pixel values for each drawn sample.
  22777. @item full
  22778. Draw every sample directly.
  22779. @end table
  22780. Default value is @code{scale}.
  22781. @end table
  22782. @subsection Examples
  22783. @itemize
  22784. @item
  22785. Output the input file audio and the corresponding video representation
  22786. at the same time:
  22787. @example
  22788. amovie=a.mp3,asplit[out0],showwaves[out1]
  22789. @end example
  22790. @item
  22791. Create a synthetic signal and show it with showwaves, forcing a
  22792. frame rate of 30 frames per second:
  22793. @example
  22794. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  22795. @end example
  22796. @end itemize
  22797. @section showwavespic
  22798. Convert input audio to a single video frame, representing the samples waves.
  22799. The filter accepts the following options:
  22800. @table @option
  22801. @item size, s
  22802. Specify the video size for the output. For the syntax of this option, check the
  22803. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22804. Default value is @code{600x240}.
  22805. @item split_channels
  22806. Set if channels should be drawn separately or overlap. Default value is 0.
  22807. @item colors
  22808. Set colors separated by '|' which are going to be used for drawing of each channel.
  22809. @item scale
  22810. Set amplitude scale.
  22811. Available values are:
  22812. @table @samp
  22813. @item lin
  22814. Linear.
  22815. @item log
  22816. Logarithmic.
  22817. @item sqrt
  22818. Square root.
  22819. @item cbrt
  22820. Cubic root.
  22821. @end table
  22822. Default is linear.
  22823. @item draw
  22824. Set the draw mode.
  22825. Available values are:
  22826. @table @samp
  22827. @item scale
  22828. Scale pixel values for each drawn sample.
  22829. @item full
  22830. Draw every sample directly.
  22831. @end table
  22832. Default value is @code{scale}.
  22833. @item filter
  22834. Set the filter mode.
  22835. Available values are:
  22836. @table @samp
  22837. @item average
  22838. Use average samples values for each drawn sample.
  22839. @item peak
  22840. Use peak samples values for each drawn sample.
  22841. @end table
  22842. Default value is @code{average}.
  22843. @end table
  22844. @subsection Examples
  22845. @itemize
  22846. @item
  22847. Extract a channel split representation of the wave form of a whole audio track
  22848. in a 1024x800 picture using @command{ffmpeg}:
  22849. @example
  22850. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  22851. @end example
  22852. @end itemize
  22853. @section sidedata, asidedata
  22854. Delete frame side data, or select frames based on it.
  22855. This filter accepts the following options:
  22856. @table @option
  22857. @item mode
  22858. Set mode of operation of the filter.
  22859. Can be one of the following:
  22860. @table @samp
  22861. @item select
  22862. Select every frame with side data of @code{type}.
  22863. @item delete
  22864. Delete side data of @code{type}. If @code{type} is not set, delete all side
  22865. data in the frame.
  22866. @end table
  22867. @item type
  22868. Set side data type used with all modes. Must be set for @code{select} mode. For
  22869. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  22870. in @file{libavutil/frame.h}. For example, to choose
  22871. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  22872. @end table
  22873. @section spectrumsynth
  22874. Synthesize audio from 2 input video spectrums, first input stream represents
  22875. magnitude across time and second represents phase across time.
  22876. The filter will transform from frequency domain as displayed in videos back
  22877. to time domain as presented in audio output.
  22878. This filter is primarily created for reversing processed @ref{showspectrum}
  22879. filter outputs, but can synthesize sound from other spectrograms too.
  22880. But in such case results are going to be poor if the phase data is not
  22881. available, because in such cases phase data need to be recreated, usually
  22882. it's just recreated from random noise.
  22883. For best results use gray only output (@code{channel} color mode in
  22884. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  22885. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  22886. @code{data} option. Inputs videos should generally use @code{fullframe}
  22887. slide mode as that saves resources needed for decoding video.
  22888. The filter accepts the following options:
  22889. @table @option
  22890. @item sample_rate
  22891. Specify sample rate of output audio, the sample rate of audio from which
  22892. spectrum was generated may differ.
  22893. @item channels
  22894. Set number of channels represented in input video spectrums.
  22895. @item scale
  22896. Set scale which was used when generating magnitude input spectrum.
  22897. Can be @code{lin} or @code{log}. Default is @code{log}.
  22898. @item slide
  22899. Set slide which was used when generating inputs spectrums.
  22900. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  22901. Default is @code{fullframe}.
  22902. @item win_func
  22903. Set window function used for resynthesis.
  22904. @item overlap
  22905. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  22906. which means optimal overlap for selected window function will be picked.
  22907. @item orientation
  22908. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  22909. Default is @code{vertical}.
  22910. @end table
  22911. @subsection Examples
  22912. @itemize
  22913. @item
  22914. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  22915. then resynthesize videos back to audio with spectrumsynth:
  22916. @example
  22917. 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
  22918. 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
  22919. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  22920. @end example
  22921. @end itemize
  22922. @section split, asplit
  22923. Split input into several identical outputs.
  22924. @code{asplit} works with audio input, @code{split} with video.
  22925. The filter accepts a single parameter which specifies the number of outputs. If
  22926. unspecified, it defaults to 2.
  22927. @subsection Examples
  22928. @itemize
  22929. @item
  22930. Create two separate outputs from the same input:
  22931. @example
  22932. [in] split [out0][out1]
  22933. @end example
  22934. @item
  22935. To create 3 or more outputs, you need to specify the number of
  22936. outputs, like in:
  22937. @example
  22938. [in] asplit=3 [out0][out1][out2]
  22939. @end example
  22940. @item
  22941. Create two separate outputs from the same input, one cropped and
  22942. one padded:
  22943. @example
  22944. [in] split [splitout1][splitout2];
  22945. [splitout1] crop=100:100:0:0 [cropout];
  22946. [splitout2] pad=200:200:100:100 [padout];
  22947. @end example
  22948. @item
  22949. Create 5 copies of the input audio with @command{ffmpeg}:
  22950. @example
  22951. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  22952. @end example
  22953. @end itemize
  22954. @section zmq, azmq
  22955. Receive commands sent through a libzmq client, and forward them to
  22956. filters in the filtergraph.
  22957. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  22958. must be inserted between two video filters, @code{azmq} between two
  22959. audio filters. Both are capable to send messages to any filter type.
  22960. To enable these filters you need to install the libzmq library and
  22961. headers and configure FFmpeg with @code{--enable-libzmq}.
  22962. For more information about libzmq see:
  22963. @url{http://www.zeromq.org/}
  22964. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  22965. receives messages sent through a network interface defined by the
  22966. @option{bind_address} (or the abbreviation "@option{b}") option.
  22967. Default value of this option is @file{tcp://localhost:5555}. You may
  22968. want to alter this value to your needs, but do not forget to escape any
  22969. ':' signs (see @ref{filtergraph escaping}).
  22970. The received message must be in the form:
  22971. @example
  22972. @var{TARGET} @var{COMMAND} [@var{ARG}]
  22973. @end example
  22974. @var{TARGET} specifies the target of the command, usually the name of
  22975. the filter class or a specific filter instance name. The default
  22976. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  22977. but you can override this by using the @samp{filter_name@@id} syntax
  22978. (see @ref{Filtergraph syntax}).
  22979. @var{COMMAND} specifies the name of the command for the target filter.
  22980. @var{ARG} is optional and specifies the optional argument list for the
  22981. given @var{COMMAND}.
  22982. Upon reception, the message is processed and the corresponding command
  22983. is injected into the filtergraph. Depending on the result, the filter
  22984. will send a reply to the client, adopting the format:
  22985. @example
  22986. @var{ERROR_CODE} @var{ERROR_REASON}
  22987. @var{MESSAGE}
  22988. @end example
  22989. @var{MESSAGE} is optional.
  22990. @subsection Examples
  22991. Look at @file{tools/zmqsend} for an example of a zmq client which can
  22992. be used to send commands processed by these filters.
  22993. Consider the following filtergraph generated by @command{ffplay}.
  22994. In this example the last overlay filter has an instance name. All other
  22995. filters will have default instance names.
  22996. @example
  22997. ffplay -dumpgraph 1 -f lavfi "
  22998. color=s=100x100:c=red [l];
  22999. color=s=100x100:c=blue [r];
  23000. nullsrc=s=200x100, zmq [bg];
  23001. [bg][l] overlay [bg+l];
  23002. [bg+l][r] overlay@@my=x=100 "
  23003. @end example
  23004. To change the color of the left side of the video, the following
  23005. command can be used:
  23006. @example
  23007. echo Parsed_color_0 c yellow | tools/zmqsend
  23008. @end example
  23009. To change the right side:
  23010. @example
  23011. echo Parsed_color_1 c pink | tools/zmqsend
  23012. @end example
  23013. To change the position of the right side:
  23014. @example
  23015. echo overlay@@my x 150 | tools/zmqsend
  23016. @end example
  23017. @c man end MULTIMEDIA FILTERS
  23018. @chapter Multimedia Sources
  23019. @c man begin MULTIMEDIA SOURCES
  23020. Below is a description of the currently available multimedia sources.
  23021. @section amovie
  23022. This is the same as @ref{movie} source, except it selects an audio
  23023. stream by default.
  23024. @section avsynctest
  23025. Generate an Audio/Video Sync Test.
  23026. Generated stream periodically shows flash video frame and emits beep in audio.
  23027. Useful to inspect A/V sync issues.
  23028. It accepts the following options:
  23029. @table @option
  23030. @item size, s
  23031. Set output video size. Default value is @code{hd720}.
  23032. @item framerate, fr
  23033. Set output video frame rate. Default value is @code{30}.
  23034. @item samplerate, sr
  23035. Set output audio sample rate. Default value is @code{44100}.
  23036. @item amplitude, a
  23037. Set output audio beep amplitude. Default value is @code{0.7}.
  23038. @item period, p
  23039. Set output audio beep period in seconds. Default value is @code{3}.
  23040. @item delay, dl
  23041. Set output video flash delay in number of frames. Default value is @code{0}.
  23042. @item cycle, c
  23043. Enable cycling of video delays, by default is disabled.
  23044. @item duration, d
  23045. Set stream output duration. By default duration is unlimited.
  23046. @item fg, bg, ag
  23047. Set foreground/background/additional color.
  23048. @end table
  23049. @anchor{movie}
  23050. @section movie
  23051. Read audio and/or video stream(s) from a movie container.
  23052. It accepts the following parameters:
  23053. @table @option
  23054. @item filename
  23055. The name of the resource to read (not necessarily a file; it can also be a
  23056. device or a stream accessed through some protocol).
  23057. @item format_name, f
  23058. Specifies the format assumed for the movie to read, and can be either
  23059. the name of a container or an input device. If not specified, the
  23060. format is guessed from @var{movie_name} or by probing.
  23061. @item seek_point, sp
  23062. Specifies the seek point in seconds. The frames will be output
  23063. starting from this seek point. The parameter is evaluated with
  23064. @code{av_strtod}, so the numerical value may be suffixed by an IS
  23065. postfix. The default value is "0".
  23066. @item streams, s
  23067. Specifies the streams to read. Several streams can be specified,
  23068. separated by "+". The source will then have as many outputs, in the
  23069. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  23070. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  23071. respectively the default (best suited) video and audio stream. Default
  23072. is "dv", or "da" if the filter is called as "amovie".
  23073. @item stream_index, si
  23074. Specifies the index of the video stream to read. If the value is -1,
  23075. the most suitable video stream will be automatically selected. The default
  23076. value is "-1". Deprecated. If the filter is called "amovie", it will select
  23077. audio instead of video.
  23078. @item loop
  23079. Specifies how many times to read the stream in sequence.
  23080. If the value is 0, the stream will be looped infinitely.
  23081. Default value is "1".
  23082. Note that when the movie is looped the source timestamps are not
  23083. changed, so it will generate non monotonically increasing timestamps.
  23084. @item discontinuity
  23085. Specifies the time difference between frames above which the point is
  23086. considered a timestamp discontinuity which is removed by adjusting the later
  23087. timestamps.
  23088. @item dec_threads
  23089. Specifies the number of threads for decoding
  23090. @item format_opts
  23091. Specify format options for the opened file. Format options can be specified
  23092. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  23093. shows how to add protocol_whitelist and protocol_blacklist options:
  23094. @example
  23095. ffplay -f lavfi
  23096. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  23097. @end example
  23098. @end table
  23099. It allows overlaying a second video on top of the main input of
  23100. a filtergraph, as shown in this graph:
  23101. @example
  23102. input -----------> deltapts0 --> overlay --> output
  23103. ^
  23104. |
  23105. movie --> scale--> deltapts1 -------+
  23106. @end example
  23107. @subsection Examples
  23108. @itemize
  23109. @item
  23110. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  23111. on top of the input labelled "in":
  23112. @example
  23113. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  23114. [in] setpts=PTS-STARTPTS [main];
  23115. [main][over] overlay=16:16 [out]
  23116. @end example
  23117. @item
  23118. Read from a video4linux2 device, and overlay it on top of the input
  23119. labelled "in":
  23120. @example
  23121. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  23122. [in] setpts=PTS-STARTPTS [main];
  23123. [main][over] overlay=16:16 [out]
  23124. @end example
  23125. @item
  23126. Read the first video stream and the audio stream with id 0x81 from
  23127. dvd.vob; the video is connected to the pad named "video" and the audio is
  23128. connected to the pad named "audio":
  23129. @example
  23130. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  23131. @end example
  23132. @end itemize
  23133. @subsection Commands
  23134. Both movie and amovie support the following commands:
  23135. @table @option
  23136. @item seek
  23137. Perform seek using "av_seek_frame".
  23138. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  23139. @itemize
  23140. @item
  23141. @var{stream_index}: If stream_index is -1, a default
  23142. stream is selected, and @var{timestamp} is automatically converted
  23143. from AV_TIME_BASE units to the stream specific time_base.
  23144. @item
  23145. @var{timestamp}: Timestamp in AVStream.time_base units
  23146. or, if no stream is specified, in AV_TIME_BASE units.
  23147. @item
  23148. @var{flags}: Flags which select direction and seeking mode.
  23149. @end itemize
  23150. @item get_duration
  23151. Get movie duration in AV_TIME_BASE units.
  23152. @end table
  23153. @c man end MULTIMEDIA SOURCES