filters.texi 804 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070
  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 knee
  695. Curve the sharp knee around the detection threshold to calculate
  696. equalization gain more softly.
  697. Default is 1. Allowed range is between 0 and 8.
  698. @item ratio
  699. Set the ratio by which the equalization gain is raised.
  700. Default is 1. Allowed range is between 1 and 20.
  701. @item makeup
  702. Set the makeup offset in dB by which the equalization gain is raised.
  703. Default is 0. Allowed range is between 0 and 30.
  704. @item range
  705. Set the max allowed cut/boost amount in dB. Default is 0.
  706. Allowed range is from 0 to 200.
  707. @item slew
  708. Set the slew factor. Default is 1. Allowed range is from 1 to 200.
  709. @item mode
  710. Set the mode of filter operation, can be one of the following:
  711. @table @samp
  712. @item listen
  713. Output only isolated bandpass signal.
  714. @item cut
  715. Cut frequencies above detection threshold.
  716. @item boost
  717. Boost frequencies bellow detection threshold.
  718. @end table
  719. Default mode is @samp{cut}.
  720. @item tftype
  721. Set the type of target filter, can be one of the following:
  722. @table @samp
  723. @item bell
  724. @item lowshelf
  725. @item highshelf
  726. @end table
  727. Default type is @samp{bell}.
  728. @end table
  729. @subsection Commands
  730. This filter supports the all above options as @ref{commands}.
  731. @section adynamicsmooth
  732. Apply dynamic smoothing to input audio stream.
  733. A description of the accepted options follows.
  734. @table @option
  735. @item sensitivity
  736. Set an amount of sensitivity to frequency fluctations. Default is 2.
  737. Allowed range is from 0 to 1e+06.
  738. @item basefreq
  739. Set a base frequency for smoothing. Default value is 22050.
  740. Allowed range is from 2 to 1e+06.
  741. @end table
  742. @subsection Commands
  743. This filter supports the all above options as @ref{commands}.
  744. @section aecho
  745. Apply echoing to the input audio.
  746. Echoes are reflected sound and can occur naturally amongst mountains
  747. (and sometimes large buildings) when talking or shouting; digital echo
  748. effects emulate this behaviour and are often used to help fill out the
  749. sound of a single instrument or vocal. The time difference between the
  750. original signal and the reflection is the @code{delay}, and the
  751. loudness of the reflected signal is the @code{decay}.
  752. Multiple echoes can have different delays and decays.
  753. A description of the accepted parameters follows.
  754. @table @option
  755. @item in_gain
  756. Set input gain of reflected signal. Default is @code{0.6}.
  757. @item out_gain
  758. Set output gain of reflected signal. Default is @code{0.3}.
  759. @item delays
  760. Set list of time intervals in milliseconds between original signal and reflections
  761. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  762. Default is @code{1000}.
  763. @item decays
  764. Set list of loudness of reflected signals separated by '|'.
  765. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  766. Default is @code{0.5}.
  767. @end table
  768. @subsection Examples
  769. @itemize
  770. @item
  771. Make it sound as if there are twice as many instruments as are actually playing:
  772. @example
  773. aecho=0.8:0.88:60:0.4
  774. @end example
  775. @item
  776. If delay is very short, then it sounds like a (metallic) robot playing music:
  777. @example
  778. aecho=0.8:0.88:6:0.4
  779. @end example
  780. @item
  781. A longer delay will sound like an open air concert in the mountains:
  782. @example
  783. aecho=0.8:0.9:1000:0.3
  784. @end example
  785. @item
  786. Same as above but with one more mountain:
  787. @example
  788. aecho=0.8:0.9:1000|1800:0.3|0.25
  789. @end example
  790. @end itemize
  791. @section aemphasis
  792. Audio emphasis filter creates or restores material directly taken from LPs or
  793. emphased CDs with different filter curves. E.g. to store music on vinyl the
  794. signal has to be altered by a filter first to even out the disadvantages of
  795. this recording medium.
  796. Once the material is played back the inverse filter has to be applied to
  797. restore the distortion of the frequency response.
  798. The filter accepts the following options:
  799. @table @option
  800. @item level_in
  801. Set input gain.
  802. @item level_out
  803. Set output gain.
  804. @item mode
  805. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  806. use @code{production} mode. Default is @code{reproduction} mode.
  807. @item type
  808. Set filter type. Selects medium. Can be one of the following:
  809. @table @option
  810. @item col
  811. select Columbia.
  812. @item emi
  813. select EMI.
  814. @item bsi
  815. select BSI (78RPM).
  816. @item riaa
  817. select RIAA.
  818. @item cd
  819. select Compact Disc (CD).
  820. @item 50fm
  821. select 50µs (FM).
  822. @item 75fm
  823. select 75µs (FM).
  824. @item 50kf
  825. select 50µs (FM-KF).
  826. @item 75kf
  827. select 75µs (FM-KF).
  828. @end table
  829. @end table
  830. @subsection Commands
  831. This filter supports the all above options as @ref{commands}.
  832. @section aeval
  833. Modify an audio signal according to the specified expressions.
  834. This filter accepts one or more expressions (one for each channel),
  835. which are evaluated and used to modify a corresponding audio signal.
  836. It accepts the following parameters:
  837. @table @option
  838. @item exprs
  839. Set the '|'-separated expressions list for each separate channel. If
  840. the number of input channels is greater than the number of
  841. expressions, the last specified expression is used for the remaining
  842. output channels.
  843. @item channel_layout, c
  844. Set output channel layout. If not specified, the channel layout is
  845. specified by the number of expressions. If set to @samp{same}, it will
  846. use by default the same input channel layout.
  847. @end table
  848. Each expression in @var{exprs} can contain the following constants and functions:
  849. @table @option
  850. @item ch
  851. channel number of the current expression
  852. @item n
  853. number of the evaluated sample, starting from 0
  854. @item s
  855. sample rate
  856. @item t
  857. time of the evaluated sample expressed in seconds
  858. @item nb_in_channels
  859. @item nb_out_channels
  860. input and output number of channels
  861. @item val(CH)
  862. the value of input channel with number @var{CH}
  863. @end table
  864. Note: this filter is slow. For faster processing you should use a
  865. dedicated filter.
  866. @subsection Examples
  867. @itemize
  868. @item
  869. Half volume:
  870. @example
  871. aeval=val(ch)/2:c=same
  872. @end example
  873. @item
  874. Invert phase of the second channel:
  875. @example
  876. aeval=val(0)|-val(1)
  877. @end example
  878. @end itemize
  879. @section aexciter
  880. An exciter is used to produce high sound that is not present in the
  881. original signal. This is done by creating harmonic distortions of the
  882. signal which are restricted in range and added to the original signal.
  883. An Exciter raises the upper end of an audio signal without simply raising
  884. the higher frequencies like an equalizer would do to create a more
  885. "crisp" or "brilliant" sound.
  886. The filter accepts the following options:
  887. @table @option
  888. @item level_in
  889. Set input level prior processing of signal.
  890. Allowed range is from 0 to 64.
  891. Default value is 1.
  892. @item level_out
  893. Set output level after processing of signal.
  894. Allowed range is from 0 to 64.
  895. Default value is 1.
  896. @item amount
  897. Set the amount of harmonics added to original signal.
  898. Allowed range is from 0 to 64.
  899. Default value is 1.
  900. @item drive
  901. Set the amount of newly created harmonics.
  902. Allowed range is from 0.1 to 10.
  903. Default value is 8.5.
  904. @item blend
  905. Set the octave of newly created harmonics.
  906. Allowed range is from -10 to 10.
  907. Default value is 0.
  908. @item freq
  909. Set the lower frequency limit of producing harmonics in Hz.
  910. Allowed range is from 2000 to 12000 Hz.
  911. Default is 7500 Hz.
  912. @item ceil
  913. Set the upper frequency limit of producing harmonics.
  914. Allowed range is from 9999 to 20000 Hz.
  915. If value is lower than 10000 Hz no limit is applied.
  916. @item listen
  917. Mute the original signal and output only added harmonics.
  918. By default is disabled.
  919. @end table
  920. @subsection Commands
  921. This filter supports the all above options as @ref{commands}.
  922. @anchor{afade}
  923. @section afade
  924. Apply fade-in/out effect to input audio.
  925. A description of the accepted parameters follows.
  926. @table @option
  927. @item type, t
  928. Specify the effect type, can be either @code{in} for fade-in, or
  929. @code{out} for a fade-out effect. Default is @code{in}.
  930. @item start_sample, ss
  931. Specify the number of the start sample for starting to apply the fade
  932. effect. Default is 0.
  933. @item nb_samples, ns
  934. Specify the number of samples for which the fade effect has to last. At
  935. the end of the fade-in effect the output audio will have the same
  936. volume as the input audio, at the end of the fade-out transition
  937. the output audio will be silence. Default is 44100.
  938. @item start_time, st
  939. Specify the start time of the fade effect. Default is 0.
  940. The value must be specified as a time duration; see
  941. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  942. for the accepted syntax.
  943. If set this option is used instead of @var{start_sample}.
  944. @item duration, d
  945. Specify the duration of the fade effect. See
  946. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  947. for the accepted syntax.
  948. At the end of the fade-in effect the output audio will have the same
  949. volume as the input audio, at the end of the fade-out transition
  950. the output audio will be silence.
  951. By default the duration is determined by @var{nb_samples}.
  952. If set this option is used instead of @var{nb_samples}.
  953. @item curve
  954. Set curve for fade transition.
  955. It accepts the following values:
  956. @table @option
  957. @item tri
  958. select triangular, linear slope (default)
  959. @item qsin
  960. select quarter of sine wave
  961. @item hsin
  962. select half of sine wave
  963. @item esin
  964. select exponential sine wave
  965. @item log
  966. select logarithmic
  967. @item ipar
  968. select inverted parabola
  969. @item qua
  970. select quadratic
  971. @item cub
  972. select cubic
  973. @item squ
  974. select square root
  975. @item cbr
  976. select cubic root
  977. @item par
  978. select parabola
  979. @item exp
  980. select exponential
  981. @item iqsin
  982. select inverted quarter of sine wave
  983. @item ihsin
  984. select inverted half of sine wave
  985. @item dese
  986. select double-exponential seat
  987. @item desi
  988. select double-exponential sigmoid
  989. @item losi
  990. select logistic sigmoid
  991. @item sinc
  992. select sine cardinal function
  993. @item isinc
  994. select inverted sine cardinal function
  995. @item nofade
  996. no fade applied
  997. @end table
  998. @end table
  999. @subsection Commands
  1000. This filter supports the all above options as @ref{commands}.
  1001. @subsection Examples
  1002. @itemize
  1003. @item
  1004. Fade in first 15 seconds of audio:
  1005. @example
  1006. afade=t=in:ss=0:d=15
  1007. @end example
  1008. @item
  1009. Fade out last 25 seconds of a 900 seconds audio:
  1010. @example
  1011. afade=t=out:st=875:d=25
  1012. @end example
  1013. @end itemize
  1014. @section afftdn
  1015. Denoise audio samples with FFT.
  1016. A description of the accepted parameters follows.
  1017. @table @option
  1018. @item noise_reduction, nr
  1019. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1020. Default value is 12 dB.
  1021. @item noise_floor, nf
  1022. Set the noise floor in dB, allowed range is -80 to -20.
  1023. Default value is -50 dB.
  1024. @item noise_type, nt
  1025. Set the noise type.
  1026. It accepts the following values:
  1027. @table @option
  1028. @item white, w
  1029. Select white noise.
  1030. @item vinyl, v
  1031. Select vinyl noise.
  1032. @item shellac, s
  1033. Select shellac noise.
  1034. @item custom, c
  1035. Select custom noise, defined in @code{bn} option.
  1036. Default value is white noise.
  1037. @end table
  1038. @item band_noise, bn
  1039. Set custom band noise profile for every one of 15 bands.
  1040. Bands are separated by ' ' or '|'.
  1041. @item residual_floor, rf
  1042. Set the residual floor in dB, allowed range is -80 to -20.
  1043. Default value is -38 dB.
  1044. @item track_noise, tn
  1045. Enable noise floor tracking. By default is disabled.
  1046. With this enabled, noise floor is automatically adjusted.
  1047. @item track_residual, tr
  1048. Enable residual tracking. By default is disabled.
  1049. @item output_mode, om
  1050. Set the output mode.
  1051. It accepts the following values:
  1052. @table @option
  1053. @item input, i
  1054. Pass input unchanged.
  1055. @item output, o
  1056. Pass noise filtered out.
  1057. @item noise, n
  1058. Pass only noise.
  1059. Default value is @var{output}.
  1060. @end table
  1061. @item adaptivity, ad
  1062. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1063. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1064. react much slower.
  1065. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1066. @item floor_offset, fo
  1067. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1068. noise floor. It is only effective when noise floor tracking is enabled.
  1069. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1070. @item noise_link, nl
  1071. Set the noise link used for multichannel audio.
  1072. It accepts the following values:
  1073. @table @option
  1074. @item none
  1075. Use unchanged channel's noise floor.
  1076. @item min
  1077. Use measured min noise floor of all channels.
  1078. @item max
  1079. Use measured max noise floor of all channels.
  1080. @item average
  1081. Use measured average noise floor of all channels.
  1082. Default value is @var{min}.
  1083. @end table
  1084. @item band_multiplier, bm
  1085. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1086. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1087. @item sample_noise, sn
  1088. Toggle capturing and measurement of noise profile from input audio.
  1089. It accepts the following values:
  1090. @table @option
  1091. @item start, begin
  1092. Start sample noise capture.
  1093. @item stop, end
  1094. Stop sample noise capture and measure new noise band profile.
  1095. Default value is @code{none}.
  1096. @end table
  1097. @item gain_smooth, gs
  1098. Set gain smooth spatial radius, used to smooth gains applied to each frequency bin.
  1099. Useful to reduce random music noise artefacts.
  1100. Higher values increases smoothing of gains.
  1101. Allowed range is from @code{0} to @code{50}.
  1102. Default value is @code{0}.
  1103. @end table
  1104. @subsection Commands
  1105. This filter supports the some above mentioned options as @ref{commands}.
  1106. @subsection Examples
  1107. @itemize
  1108. @item
  1109. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1110. @example
  1111. afftdn=nr=10:nf=-40
  1112. @end example
  1113. @item
  1114. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1115. tracking of noise floor so noise floor will gradually change during processing:
  1116. @example
  1117. afftdn=nr=10:nf=-80:tn=1
  1118. @end example
  1119. @item
  1120. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1121. of first 0.4 seconds of input audio:
  1122. @example
  1123. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1124. @end example
  1125. @end itemize
  1126. @section afftfilt
  1127. Apply arbitrary expressions to samples in frequency domain.
  1128. @table @option
  1129. @item real
  1130. Set frequency domain real expression for each separate channel separated
  1131. by '|'. Default is "re".
  1132. If the number of input channels is greater than the number of
  1133. expressions, the last specified expression is used for the remaining
  1134. output channels.
  1135. @item imag
  1136. Set frequency domain imaginary expression for each separate channel
  1137. separated by '|'. Default is "im".
  1138. Each expression in @var{real} and @var{imag} can contain the following
  1139. constants and functions:
  1140. @table @option
  1141. @item sr
  1142. sample rate
  1143. @item b
  1144. current frequency bin number
  1145. @item nb
  1146. number of available bins
  1147. @item ch
  1148. channel number of the current expression
  1149. @item chs
  1150. number of channels
  1151. @item pts
  1152. current frame pts
  1153. @item re
  1154. current real part of frequency bin of current channel
  1155. @item im
  1156. current imaginary part of frequency bin of current channel
  1157. @item real(b, ch)
  1158. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1159. @item imag(b, ch)
  1160. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1161. @end table
  1162. @item win_size
  1163. Set window size. Allowed range is from 16 to 131072.
  1164. Default is @code{4096}
  1165. @item win_func
  1166. Set window function.
  1167. It accepts the following values:
  1168. @table @samp
  1169. @item rect
  1170. @item bartlett
  1171. @item hann, hanning
  1172. @item hamming
  1173. @item blackman
  1174. @item welch
  1175. @item flattop
  1176. @item bharris
  1177. @item bnuttall
  1178. @item bhann
  1179. @item sine
  1180. @item nuttall
  1181. @item lanczos
  1182. @item gauss
  1183. @item tukey
  1184. @item dolph
  1185. @item cauchy
  1186. @item parzen
  1187. @item poisson
  1188. @item bohman
  1189. @end table
  1190. Default is @code{hann}.
  1191. @item overlap
  1192. Set window overlap. If set to 1, the recommended overlap for selected
  1193. window function will be picked. Default is @code{0.75}.
  1194. @end table
  1195. @subsection Examples
  1196. @itemize
  1197. @item
  1198. Leave almost only low frequencies in audio:
  1199. @example
  1200. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1201. @end example
  1202. @item
  1203. Apply robotize effect:
  1204. @example
  1205. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1206. @end example
  1207. @item
  1208. Apply whisper effect:
  1209. @example
  1210. 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"
  1211. @end example
  1212. @end itemize
  1213. @anchor{afir}
  1214. @section afir
  1215. Apply an arbitrary Finite Impulse Response filter.
  1216. This filter is designed for applying long FIR filters,
  1217. up to 60 seconds long.
  1218. It can be used as component for digital crossover filters,
  1219. room equalization, cross talk cancellation, wavefield synthesis,
  1220. auralization, ambiophonics, ambisonics and spatialization.
  1221. This filter uses the streams higher than first one as FIR coefficients.
  1222. If the non-first stream holds a single channel, it will be used
  1223. for all input channels in the first stream, otherwise
  1224. the number of channels in the non-first stream must be same as
  1225. the number of channels in the first stream.
  1226. It accepts the following parameters:
  1227. @table @option
  1228. @item dry
  1229. Set dry gain. This sets input gain.
  1230. @item wet
  1231. Set wet gain. This sets final output gain.
  1232. @item length
  1233. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1234. @item gtype
  1235. Enable applying gain measured from power of IR.
  1236. Set which approach to use for auto gain measurement.
  1237. @table @option
  1238. @item none
  1239. Do not apply any gain.
  1240. @item peak
  1241. select peak gain, very conservative approach. This is default value.
  1242. @item dc
  1243. select DC gain, limited application.
  1244. @item gn
  1245. select gain to noise approach, this is most popular one.
  1246. @end table
  1247. @item irgain
  1248. Set gain to be applied to IR coefficients before filtering.
  1249. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1250. @item irfmt
  1251. Set format of IR stream. Can be @code{mono} or @code{input}.
  1252. Default is @code{input}.
  1253. @item maxir
  1254. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1255. Allowed range is 0.1 to 60 seconds.
  1256. @item response
  1257. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1258. By default it is disabled.
  1259. @item channel
  1260. Set for which IR channel to display frequency response. By default is first channel
  1261. displayed. This option is used only when @var{response} is enabled.
  1262. @item size
  1263. Set video stream size. This option is used only when @var{response} is enabled.
  1264. @item rate
  1265. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1266. @item minp
  1267. Set minimal partition size used for convolution. Default is @var{8192}.
  1268. Allowed range is from @var{1} to @var{32768}.
  1269. Lower values decreases latency at cost of higher CPU usage.
  1270. @item maxp
  1271. Set maximal partition size used for convolution. Default is @var{8192}.
  1272. Allowed range is from @var{8} to @var{32768}.
  1273. Lower values may increase CPU usage.
  1274. @item nbirs
  1275. Set number of input impulse responses streams which will be switchable at runtime.
  1276. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1277. @item ir
  1278. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1279. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1280. This option can be changed at runtime via @ref{commands}.
  1281. @item precision
  1282. Set which precision to use when processing samples.
  1283. @table @option
  1284. @item auto
  1285. Auto pick internal sample format depending on other filters.
  1286. @item float
  1287. Always use single-floating point precision sample format.
  1288. @item double
  1289. Always use double-floating point precision sample format.
  1290. @end table
  1291. Default value is auto.
  1292. @end table
  1293. @subsection Examples
  1294. @itemize
  1295. @item
  1296. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1297. @example
  1298. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1299. @end example
  1300. @end itemize
  1301. @anchor{aformat}
  1302. @section aformat
  1303. Set output format constraints for the input audio. The framework will
  1304. negotiate the most appropriate format to minimize conversions.
  1305. It accepts the following parameters:
  1306. @table @option
  1307. @item sample_fmts, f
  1308. A '|'-separated list of requested sample formats.
  1309. @item sample_rates, r
  1310. A '|'-separated list of requested sample rates.
  1311. @item channel_layouts, cl
  1312. A '|'-separated list of requested channel layouts.
  1313. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1314. for the required syntax.
  1315. @end table
  1316. If a parameter is omitted, all values are allowed.
  1317. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1318. @example
  1319. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1320. @end example
  1321. @section afreqshift
  1322. Apply frequency shift to input audio samples.
  1323. The filter accepts the following options:
  1324. @table @option
  1325. @item shift
  1326. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1327. Default value is 0.0.
  1328. @item level
  1329. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1330. Default value is 1.0.
  1331. @item order
  1332. Set filter order used for filtering. Allowed range is from 1 to 16.
  1333. Default value is 8.
  1334. @end table
  1335. @subsection Commands
  1336. This filter supports the all above options as @ref{commands}.
  1337. @section afwtdn
  1338. Reduce broadband noise from input samples using Wavelets.
  1339. A description of the accepted options follows.
  1340. @table @option
  1341. @item sigma
  1342. Set the noise sigma, allowed range is from 0 to 1.
  1343. Default value is 0.
  1344. This option controls strength of denoising applied to input samples.
  1345. Most useful way to set this option is via decibels, eg. -45dB.
  1346. @item levels
  1347. Set the number of wavelet levels of decomposition.
  1348. Allowed range is from 1 to 12.
  1349. Default value is 10.
  1350. Setting this too low make denoising performance very poor.
  1351. @item wavet
  1352. Set wavelet type for decomposition of input frame.
  1353. They are sorted by number of coefficients, from lowest to highest.
  1354. More coefficients means worse filtering speed, but overall better quality.
  1355. Available wavelets are:
  1356. @table @samp
  1357. @item sym2
  1358. @item sym4
  1359. @item rbior68
  1360. @item deb10
  1361. @item sym10
  1362. @item coif5
  1363. @item bl3
  1364. @end table
  1365. @item percent
  1366. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1367. Default value is 85 percent or partial denoising.
  1368. @item profile
  1369. If enabled, first input frame will be used as noise profile.
  1370. If first frame samples contain non-noise performance will be very poor.
  1371. @item adaptive
  1372. If enabled, input frames are analyzed for presence of noise.
  1373. If noise is detected with high possibility then input frame profile will be
  1374. used for processing following frames, until new noise frame is detected.
  1375. @item samples
  1376. Set size of single frame in number of samples. Allowed range is from 512 to
  1377. 65536. Default frame size is 8192 samples.
  1378. @item softness
  1379. Set softness applied inside thresholding function. Allowed range is from 0 to
  1380. 10. Default softness is 1.
  1381. @end table
  1382. @subsection Commands
  1383. This filter supports the all above options as @ref{commands}.
  1384. @section agate
  1385. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1386. processing reduces disturbing noise between useful signals.
  1387. Gating is done by detecting the volume below a chosen level @var{threshold}
  1388. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1389. floor is set via @var{range}. Because an exact manipulation of the signal
  1390. would cause distortion of the waveform the reduction can be levelled over
  1391. time. This is done by setting @var{attack} and @var{release}.
  1392. @var{attack} determines how long the signal has to fall below the threshold
  1393. before any reduction will occur and @var{release} sets the time the signal
  1394. has to rise above the threshold to reduce the reduction again.
  1395. Shorter signals than the chosen attack time will be left untouched.
  1396. @table @option
  1397. @item level_in
  1398. Set input level before filtering.
  1399. Default is 1. Allowed range is from 0.015625 to 64.
  1400. @item mode
  1401. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1402. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1403. will be amplified, expanding dynamic range in upward direction.
  1404. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1405. @item range
  1406. Set the level of gain reduction when the signal is below the threshold.
  1407. Default is 0.06125. Allowed range is from 0 to 1.
  1408. Setting this to 0 disables reduction and then filter behaves like expander.
  1409. @item threshold
  1410. If a signal rises above this level the gain reduction is released.
  1411. Default is 0.125. Allowed range is from 0 to 1.
  1412. @item ratio
  1413. Set a ratio by which the signal is reduced.
  1414. Default is 2. Allowed range is from 1 to 9000.
  1415. @item attack
  1416. Amount of milliseconds the signal has to rise above the threshold before gain
  1417. reduction stops.
  1418. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1419. @item release
  1420. Amount of milliseconds the signal has to fall below the threshold before the
  1421. reduction is increased again. Default is 250 milliseconds.
  1422. Allowed range is from 0.01 to 9000.
  1423. @item makeup
  1424. Set amount of amplification of signal after processing.
  1425. Default is 1. Allowed range is from 1 to 64.
  1426. @item knee
  1427. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1428. Default is 2.828427125. Allowed range is from 1 to 8.
  1429. @item detection
  1430. Choose if exact signal should be taken for detection or an RMS like one.
  1431. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1432. @item link
  1433. Choose if the average level between all channels or the louder channel affects
  1434. the reduction.
  1435. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1436. @end table
  1437. @subsection Commands
  1438. This filter supports the all above options as @ref{commands}.
  1439. @section aiir
  1440. Apply an arbitrary Infinite Impulse Response filter.
  1441. It accepts the following parameters:
  1442. @table @option
  1443. @item zeros, z
  1444. Set B/numerator/zeros/reflection coefficients.
  1445. @item poles, p
  1446. Set A/denominator/poles/ladder coefficients.
  1447. @item gains, k
  1448. Set channels gains.
  1449. @item dry_gain
  1450. Set input gain.
  1451. @item wet_gain
  1452. Set output gain.
  1453. @item format, f
  1454. Set coefficients format.
  1455. @table @samp
  1456. @item ll
  1457. lattice-ladder function
  1458. @item sf
  1459. analog transfer function
  1460. @item tf
  1461. digital transfer function
  1462. @item zp
  1463. Z-plane zeros/poles, cartesian (default)
  1464. @item pr
  1465. Z-plane zeros/poles, polar radians
  1466. @item pd
  1467. Z-plane zeros/poles, polar degrees
  1468. @item sp
  1469. S-plane zeros/poles
  1470. @end table
  1471. @item process, r
  1472. Set type of processing.
  1473. @table @samp
  1474. @item d
  1475. direct processing
  1476. @item s
  1477. serial processing
  1478. @item p
  1479. parallel processing
  1480. @end table
  1481. @item precision, e
  1482. Set filtering precision.
  1483. @table @samp
  1484. @item dbl
  1485. double-precision floating-point (default)
  1486. @item flt
  1487. single-precision floating-point
  1488. @item i32
  1489. 32-bit integers
  1490. @item i16
  1491. 16-bit integers
  1492. @end table
  1493. @item normalize, n
  1494. Normalize filter coefficients, by default is enabled.
  1495. Enabling it will normalize magnitude response at DC to 0dB.
  1496. @item mix
  1497. How much to use filtered signal in output. Default is 1.
  1498. Range is between 0 and 1.
  1499. @item response
  1500. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1501. By default it is disabled.
  1502. @item channel
  1503. Set for which IR channel to display frequency response. By default is first channel
  1504. displayed. This option is used only when @var{response} is enabled.
  1505. @item size
  1506. Set video stream size. This option is used only when @var{response} is enabled.
  1507. @end table
  1508. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1509. order.
  1510. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1511. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1512. imaginary unit.
  1513. Different coefficients and gains can be provided for every channel, in such case
  1514. use '|' to separate coefficients or gains. Last provided coefficients will be
  1515. used for all remaining channels.
  1516. @subsection Examples
  1517. @itemize
  1518. @item
  1519. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1520. @example
  1521. 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
  1522. @end example
  1523. @item
  1524. Same as above but in @code{zp} format:
  1525. @example
  1526. 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
  1527. @end example
  1528. @item
  1529. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1530. @example
  1531. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1532. @end example
  1533. @end itemize
  1534. @section alimiter
  1535. The limiter prevents an input signal from rising over a desired threshold.
  1536. This limiter uses lookahead technology to prevent your signal from distorting.
  1537. It means that there is a small delay after the signal is processed. Keep in mind
  1538. that the delay it produces is the attack time you set.
  1539. The filter accepts the following options:
  1540. @table @option
  1541. @item level_in
  1542. Set input gain. Default is 1.
  1543. @item level_out
  1544. Set output gain. Default is 1.
  1545. @item limit
  1546. Don't let signals above this level pass the limiter. Default is 1.
  1547. @item attack
  1548. The limiter will reach its attenuation level in this amount of time in
  1549. milliseconds. Default is 5 milliseconds.
  1550. @item release
  1551. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1552. Default is 50 milliseconds.
  1553. @item asc
  1554. When gain reduction is always needed ASC takes care of releasing to an
  1555. average reduction level rather than reaching a reduction of 0 in the release
  1556. time.
  1557. @item asc_level
  1558. Select how much the release time is affected by ASC, 0 means nearly no changes
  1559. in release time while 1 produces higher release times.
  1560. @item level
  1561. Auto level output signal. Default is enabled.
  1562. This normalizes audio back to 0dB if enabled.
  1563. @item latency
  1564. Compensate the delay introduced by using the lookahead buffer set with attack
  1565. parameter. Also flush the valid audio data in the lookahead buffer when the
  1566. stream hits EOF.
  1567. @end table
  1568. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1569. with @ref{aresample} before applying this filter.
  1570. @section allpass
  1571. Apply a two-pole all-pass filter with central frequency (in Hz)
  1572. @var{frequency}, and filter-width @var{width}.
  1573. An all-pass filter changes the audio's frequency to phase relationship
  1574. without changing its frequency to amplitude relationship.
  1575. The filter accepts the following options:
  1576. @table @option
  1577. @item frequency, f
  1578. Set frequency in Hz.
  1579. @item width_type, t
  1580. Set method to specify band-width of filter.
  1581. @table @option
  1582. @item h
  1583. Hz
  1584. @item q
  1585. Q-Factor
  1586. @item o
  1587. octave
  1588. @item s
  1589. slope
  1590. @item k
  1591. kHz
  1592. @end table
  1593. @item width, w
  1594. Specify the band-width of a filter in width_type units.
  1595. @item mix, m
  1596. How much to use filtered signal in output. Default is 1.
  1597. Range is between 0 and 1.
  1598. @item channels, c
  1599. Specify which channels to filter, by default all available are filtered.
  1600. @item normalize, n
  1601. Normalize biquad coefficients, by default is disabled.
  1602. Enabling it will normalize magnitude response at DC to 0dB.
  1603. @item order, o
  1604. Set the filter order, can be 1 or 2. Default is 2.
  1605. @item transform, a
  1606. Set transform type of IIR filter.
  1607. @table @option
  1608. @item di
  1609. @item dii
  1610. @item tdi
  1611. @item tdii
  1612. @item latt
  1613. @item svf
  1614. @item zdf
  1615. @end table
  1616. @item precision, r
  1617. Set precison of filtering.
  1618. @table @option
  1619. @item auto
  1620. Pick automatic sample format depending on surround filters.
  1621. @item s16
  1622. Always use signed 16-bit.
  1623. @item s32
  1624. Always use signed 32-bit.
  1625. @item f32
  1626. Always use float 32-bit.
  1627. @item f64
  1628. Always use float 64-bit.
  1629. @end table
  1630. @end table
  1631. @subsection Commands
  1632. This filter supports the following commands:
  1633. @table @option
  1634. @item frequency, f
  1635. Change allpass frequency.
  1636. Syntax for the command is : "@var{frequency}"
  1637. @item width_type, t
  1638. Change allpass width_type.
  1639. Syntax for the command is : "@var{width_type}"
  1640. @item width, w
  1641. Change allpass width.
  1642. Syntax for the command is : "@var{width}"
  1643. @item mix, m
  1644. Change allpass mix.
  1645. Syntax for the command is : "@var{mix}"
  1646. @end table
  1647. @section aloop
  1648. Loop audio samples.
  1649. The filter accepts the following options:
  1650. @table @option
  1651. @item loop
  1652. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1653. Default is 0.
  1654. @item size
  1655. Set maximal number of samples. Default is 0.
  1656. @item start
  1657. Set first sample of loop. Default is 0.
  1658. @end table
  1659. @anchor{amerge}
  1660. @section amerge
  1661. Merge two or more audio streams into a single multi-channel stream.
  1662. The filter accepts the following options:
  1663. @table @option
  1664. @item inputs
  1665. Set the number of inputs. Default is 2.
  1666. @end table
  1667. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1668. the channel layout of the output will be set accordingly and the channels
  1669. will be reordered as necessary. If the channel layouts of the inputs are not
  1670. disjoint, the output will have all the channels of the first input then all
  1671. the channels of the second input, in that order, and the channel layout of
  1672. the output will be the default value corresponding to the total number of
  1673. channels.
  1674. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1675. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1676. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1677. first input, b1 is the first channel of the second input).
  1678. On the other hand, if both input are in stereo, the output channels will be
  1679. in the default order: a1, a2, b1, b2, and the channel layout will be
  1680. arbitrarily set to 4.0, which may or may not be the expected value.
  1681. All inputs must have the same sample rate, and format.
  1682. If inputs do not have the same duration, the output will stop with the
  1683. shortest.
  1684. @subsection Examples
  1685. @itemize
  1686. @item
  1687. Merge two mono files into a stereo stream:
  1688. @example
  1689. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1690. @end example
  1691. @item
  1692. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1693. @example
  1694. 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
  1695. @end example
  1696. @end itemize
  1697. @section amix
  1698. Mixes multiple audio inputs into a single output.
  1699. Note that this filter only supports float samples (the @var{amerge}
  1700. and @var{pan} audio filters support many formats). If the @var{amix}
  1701. input has integer samples then @ref{aresample} will be automatically
  1702. inserted to perform the conversion to float samples.
  1703. For example
  1704. @example
  1705. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1706. @end example
  1707. will mix 3 input audio streams to a single output with the same duration as the
  1708. first input and a dropout transition time of 3 seconds.
  1709. It accepts the following parameters:
  1710. @table @option
  1711. @item inputs
  1712. The number of inputs. If unspecified, it defaults to 2.
  1713. @item duration
  1714. How to determine the end-of-stream.
  1715. @table @option
  1716. @item longest
  1717. The duration of the longest input. (default)
  1718. @item shortest
  1719. The duration of the shortest input.
  1720. @item first
  1721. The duration of the first input.
  1722. @end table
  1723. @item dropout_transition
  1724. The transition time, in seconds, for volume renormalization when an input
  1725. stream ends. The default value is 2 seconds.
  1726. @item weights
  1727. Specify weight of each input audio stream as sequence.
  1728. Each weight is separated by space. By default all inputs have same weight.
  1729. @item normalize
  1730. Always scale inputs instead of only doing summation of samples.
  1731. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1732. by this filter if this option is disabled. By default is enabled.
  1733. @end table
  1734. @subsection Commands
  1735. This filter supports the following commands:
  1736. @table @option
  1737. @item weights
  1738. @item normalize
  1739. Syntax is same as option with same name.
  1740. @end table
  1741. @section amultiply
  1742. Multiply first audio stream with second audio stream and store result
  1743. in output audio stream. Multiplication is done by multiplying each
  1744. sample from first stream with sample at same position from second stream.
  1745. With this element-wise multiplication one can create amplitude fades and
  1746. amplitude modulations.
  1747. @section anequalizer
  1748. High-order parametric multiband equalizer for each channel.
  1749. It accepts the following parameters:
  1750. @table @option
  1751. @item params
  1752. This option string is in format:
  1753. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1754. Each equalizer band is separated by '|'.
  1755. @table @option
  1756. @item chn
  1757. Set channel number to which equalization will be applied.
  1758. If input doesn't have that channel the entry is ignored.
  1759. @item f
  1760. Set central frequency for band.
  1761. If input doesn't have that frequency the entry is ignored.
  1762. @item w
  1763. Set band width in Hertz.
  1764. @item g
  1765. Set band gain in dB.
  1766. @item t
  1767. Set filter type for band, optional, can be:
  1768. @table @samp
  1769. @item 0
  1770. Butterworth, this is default.
  1771. @item 1
  1772. Chebyshev type 1.
  1773. @item 2
  1774. Chebyshev type 2.
  1775. @end table
  1776. @end table
  1777. @item curves
  1778. With this option activated frequency response of anequalizer is displayed
  1779. in video stream.
  1780. @item size
  1781. Set video stream size. Only useful if curves option is activated.
  1782. @item mgain
  1783. Set max gain that will be displayed. Only useful if curves option is activated.
  1784. Setting this to a reasonable value makes it possible to display gain which is derived from
  1785. neighbour bands which are too close to each other and thus produce higher gain
  1786. when both are activated.
  1787. @item fscale
  1788. Set frequency scale used to draw frequency response in video output.
  1789. Can be linear or logarithmic. Default is logarithmic.
  1790. @item colors
  1791. Set color for each channel curve which is going to be displayed in video stream.
  1792. This is list of color names separated by space or by '|'.
  1793. Unrecognised or missing colors will be replaced by white color.
  1794. @end table
  1795. @subsection Examples
  1796. @itemize
  1797. @item
  1798. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1799. for first 2 channels using Chebyshev type 1 filter:
  1800. @example
  1801. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1802. @end example
  1803. @end itemize
  1804. @subsection Commands
  1805. This filter supports the following commands:
  1806. @table @option
  1807. @item change
  1808. Alter existing filter parameters.
  1809. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1810. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1811. error is returned.
  1812. @var{freq} set new frequency parameter.
  1813. @var{width} set new width parameter in Hertz.
  1814. @var{gain} set new gain parameter in dB.
  1815. Full filter invocation with asendcmd may look like this:
  1816. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1817. @end table
  1818. @section anlmdn
  1819. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1820. Each sample is adjusted by looking for other samples with similar contexts. This
  1821. context similarity is defined by comparing their surrounding patches of size
  1822. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1823. The filter accepts the following options:
  1824. @table @option
  1825. @item strength, s
  1826. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  1827. @item patch, p
  1828. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1829. Default value is 2 milliseconds.
  1830. @item research, r
  1831. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1832. Default value is 6 milliseconds.
  1833. @item output, o
  1834. Set the output mode.
  1835. It accepts the following values:
  1836. @table @option
  1837. @item i
  1838. Pass input unchanged.
  1839. @item o
  1840. Pass noise filtered out.
  1841. @item n
  1842. Pass only noise.
  1843. Default value is @var{o}.
  1844. @end table
  1845. @item smooth, m
  1846. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  1847. @end table
  1848. @subsection Commands
  1849. This filter supports the all above options as @ref{commands}.
  1850. @section anlmf, anlms
  1851. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  1852. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1853. relate to producing the least mean square of the error signal (difference between the desired,
  1854. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1855. A description of the accepted options follows.
  1856. @table @option
  1857. @item order
  1858. Set filter order.
  1859. @item mu
  1860. Set filter mu.
  1861. @item eps
  1862. Set the filter eps.
  1863. @item leakage
  1864. Set the filter leakage.
  1865. @item out_mode
  1866. It accepts the following values:
  1867. @table @option
  1868. @item i
  1869. Pass the 1st input.
  1870. @item d
  1871. Pass the 2nd input.
  1872. @item o
  1873. Pass filtered samples.
  1874. @item n
  1875. Pass difference between desired and filtered samples.
  1876. Default value is @var{o}.
  1877. @end table
  1878. @end table
  1879. @subsection Examples
  1880. @itemize
  1881. @item
  1882. One of many usages of this filter is noise reduction, input audio is filtered
  1883. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1884. @example
  1885. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1886. @end example
  1887. @end itemize
  1888. @subsection Commands
  1889. This filter supports the same commands as options, excluding option @code{order}.
  1890. @section anull
  1891. Pass the audio source unchanged to the output.
  1892. @section apad
  1893. Pad the end of an audio stream with silence.
  1894. This can be used together with @command{ffmpeg} @option{-shortest} to
  1895. extend audio streams to the same length as the video stream.
  1896. A description of the accepted options follows.
  1897. @table @option
  1898. @item packet_size
  1899. Set silence packet size. Default value is 4096.
  1900. @item pad_len
  1901. Set the number of samples of silence to add to the end. After the
  1902. value is reached, the stream is terminated. This option is mutually
  1903. exclusive with @option{whole_len}.
  1904. @item whole_len
  1905. Set the minimum total number of samples in the output audio stream. If
  1906. the value is longer than the input audio length, silence is added to
  1907. the end, until the value is reached. This option is mutually exclusive
  1908. with @option{pad_len}.
  1909. @item pad_dur
  1910. Specify the duration of samples of silence to add. See
  1911. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1912. for the accepted syntax. Used only if set to non-negative value.
  1913. @item whole_dur
  1914. Specify the minimum total duration in the output audio stream. See
  1915. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1916. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  1917. the input audio length, silence is added to the end, until the value is reached.
  1918. This option is mutually exclusive with @option{pad_dur}
  1919. @end table
  1920. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1921. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1922. the input stream indefinitely.
  1923. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  1924. @option{whole_dur} also caused the filter to add silence indefinitely.
  1925. @subsection Examples
  1926. @itemize
  1927. @item
  1928. Add 1024 samples of silence to the end of the input:
  1929. @example
  1930. apad=pad_len=1024
  1931. @end example
  1932. @item
  1933. Make sure the audio output will contain at least 10000 samples, pad
  1934. the input with silence if required:
  1935. @example
  1936. apad=whole_len=10000
  1937. @end example
  1938. @item
  1939. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1940. video stream will always result the shortest and will be converted
  1941. until the end in the output file when using the @option{shortest}
  1942. option:
  1943. @example
  1944. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1945. @end example
  1946. @end itemize
  1947. @section aphaser
  1948. Add a phasing effect to the input audio.
  1949. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1950. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1951. A description of the accepted parameters follows.
  1952. @table @option
  1953. @item in_gain
  1954. Set input gain. Default is 0.4.
  1955. @item out_gain
  1956. Set output gain. Default is 0.74
  1957. @item delay
  1958. Set delay in milliseconds. Default is 3.0.
  1959. @item decay
  1960. Set decay. Default is 0.4.
  1961. @item speed
  1962. Set modulation speed in Hz. Default is 0.5.
  1963. @item type
  1964. Set modulation type. Default is triangular.
  1965. It accepts the following values:
  1966. @table @samp
  1967. @item triangular, t
  1968. @item sinusoidal, s
  1969. @end table
  1970. @end table
  1971. @section aphaseshift
  1972. Apply phase shift to input audio samples.
  1973. The filter accepts the following options:
  1974. @table @option
  1975. @item shift
  1976. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1977. Default value is 0.0.
  1978. @item level
  1979. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1980. Default value is 1.0.
  1981. @item order
  1982. Set filter order used for filtering. Allowed range is from 1 to 16.
  1983. Default value is 8.
  1984. @end table
  1985. @subsection Commands
  1986. This filter supports the all above options as @ref{commands}.
  1987. @section apsyclip
  1988. Apply Psychoacoustic clipper to input audio stream.
  1989. The filter accepts the following options:
  1990. @table @option
  1991. @item level_in
  1992. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1993. @item level_out
  1994. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1995. @item clip
  1996. Set the clipping start value. Default value is 0dBFS or 1.
  1997. @item diff
  1998. Output only difference samples, useful to hear introduced distortions.
  1999. By default is disabled.
  2000. @item adaptive
  2001. Set strength of adaptive distortion applied. Default value is 0.5.
  2002. Allowed range is from 0 to 1.
  2003. @item iterations
  2004. Set number of iterations of psychoacoustic clipper.
  2005. Allowed range is from 1 to 20. Default value is 10.
  2006. @item level
  2007. Auto level output signal. Default is disabled.
  2008. This normalizes audio back to 0dBFS if enabled.
  2009. @end table
  2010. @subsection Commands
  2011. This filter supports the all above options as @ref{commands}.
  2012. @section apulsator
  2013. Audio pulsator is something between an autopanner and a tremolo.
  2014. But it can produce funny stereo effects as well. Pulsator changes the volume
  2015. of the left and right channel based on a LFO (low frequency oscillator) with
  2016. different waveforms and shifted phases.
  2017. This filter have the ability to define an offset between left and right
  2018. channel. An offset of 0 means that both LFO shapes match each other.
  2019. The left and right channel are altered equally - a conventional tremolo.
  2020. An offset of 50% means that the shape of the right channel is exactly shifted
  2021. in phase (or moved backwards about half of the frequency) - pulsator acts as
  2022. an autopanner. At 1 both curves match again. Every setting in between moves the
  2023. phase shift gapless between all stages and produces some "bypassing" sounds with
  2024. sine and triangle waveforms. The more you set the offset near 1 (starting from
  2025. the 0.5) the faster the signal passes from the left to the right speaker.
  2026. The filter accepts the following options:
  2027. @table @option
  2028. @item level_in
  2029. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2030. @item level_out
  2031. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2032. @item mode
  2033. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  2034. sawup or sawdown. Default is sine.
  2035. @item amount
  2036. Set modulation. Define how much of original signal is affected by the LFO.
  2037. @item offset_l
  2038. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2039. @item offset_r
  2040. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2041. @item width
  2042. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2043. @item timing
  2044. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2045. @item bpm
  2046. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2047. is set to bpm.
  2048. @item ms
  2049. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2050. is set to ms.
  2051. @item hz
  2052. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2053. if timing is set to hz.
  2054. @end table
  2055. @anchor{aresample}
  2056. @section aresample
  2057. Resample the input audio to the specified parameters, using the
  2058. libswresample library. If none are specified then the filter will
  2059. automatically convert between its input and output.
  2060. This filter is also able to stretch/squeeze the audio data to make it match
  2061. the timestamps or to inject silence / cut out audio to make it match the
  2062. timestamps, do a combination of both or do neither.
  2063. The filter accepts the syntax
  2064. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2065. expresses a sample rate and @var{resampler_options} is a list of
  2066. @var{key}=@var{value} pairs, separated by ":". See the
  2067. @ref{Resampler Options,,"Resampler Options" section in the
  2068. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2069. for the complete list of supported options.
  2070. @subsection Examples
  2071. @itemize
  2072. @item
  2073. Resample the input audio to 44100Hz:
  2074. @example
  2075. aresample=44100
  2076. @end example
  2077. @item
  2078. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2079. samples per second compensation:
  2080. @example
  2081. aresample=async=1000
  2082. @end example
  2083. @end itemize
  2084. @section areverse
  2085. Reverse an audio clip.
  2086. Warning: This filter requires memory to buffer the entire clip, so trimming
  2087. is suggested.
  2088. @subsection Examples
  2089. @itemize
  2090. @item
  2091. Take the first 5 seconds of a clip, and reverse it.
  2092. @example
  2093. atrim=end=5,areverse
  2094. @end example
  2095. @end itemize
  2096. @section arnndn
  2097. Reduce noise from speech using Recurrent Neural Networks.
  2098. This filter accepts the following options:
  2099. @table @option
  2100. @item model, m
  2101. Set train model file to load. This option is always required.
  2102. @item mix
  2103. Set how much to mix filtered samples into final output.
  2104. Allowed range is from -1 to 1. Default value is 1.
  2105. Negative values are special, they set how much to keep filtered noise
  2106. in the final filter output. Set this option to -1 to hear actual
  2107. noise removed from input signal.
  2108. @end table
  2109. @subsection Commands
  2110. This filter supports the all above options as @ref{commands}.
  2111. @section asdr
  2112. Measure Audio Signal-to-Distortion Ratio.
  2113. This filter takes two audio streams for input, and outputs first
  2114. audio stream.
  2115. Results are in dB per channel at end of either input.
  2116. @section asetnsamples
  2117. Set the number of samples per each output audio frame.
  2118. The last output packet may contain a different number of samples, as
  2119. the filter will flush all the remaining samples when the input audio
  2120. signals its end.
  2121. The filter accepts the following options:
  2122. @table @option
  2123. @item nb_out_samples, n
  2124. Set the number of frames per each output audio frame. The number is
  2125. intended as the number of samples @emph{per each channel}.
  2126. Default value is 1024.
  2127. @item pad, p
  2128. If set to 1, the filter will pad the last audio frame with zeroes, so
  2129. that the last frame will contain the same number of samples as the
  2130. previous ones. Default value is 1.
  2131. @end table
  2132. For example, to set the number of per-frame samples to 1234 and
  2133. disable padding for the last frame, use:
  2134. @example
  2135. asetnsamples=n=1234:p=0
  2136. @end example
  2137. @section asetrate
  2138. Set the sample rate without altering the PCM data.
  2139. This will result in a change of speed and pitch.
  2140. The filter accepts the following options:
  2141. @table @option
  2142. @item sample_rate, r
  2143. Set the output sample rate. Default is 44100 Hz.
  2144. @end table
  2145. @section ashowinfo
  2146. Show a line containing various information for each input audio frame.
  2147. The input audio is not modified.
  2148. The shown line contains a sequence of key/value pairs of the form
  2149. @var{key}:@var{value}.
  2150. The following values are shown in the output:
  2151. @table @option
  2152. @item n
  2153. The (sequential) number of the input frame, starting from 0.
  2154. @item pts
  2155. The presentation timestamp of the input frame, in time base units; the time base
  2156. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2157. @item pts_time
  2158. The presentation timestamp of the input frame in seconds.
  2159. @item pos
  2160. position of the frame in the input stream, -1 if this information in
  2161. unavailable and/or meaningless (for example in case of synthetic audio)
  2162. @item fmt
  2163. The sample format.
  2164. @item chlayout
  2165. The channel layout.
  2166. @item rate
  2167. The sample rate for the audio frame.
  2168. @item nb_samples
  2169. The number of samples (per channel) in the frame.
  2170. @item checksum
  2171. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2172. audio, the data is treated as if all the planes were concatenated.
  2173. @item plane_checksums
  2174. A list of Adler-32 checksums for each data plane.
  2175. @end table
  2176. @section asoftclip
  2177. Apply audio soft clipping.
  2178. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2179. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2180. This filter accepts the following options:
  2181. @table @option
  2182. @item type
  2183. Set type of soft-clipping.
  2184. It accepts the following values:
  2185. @table @option
  2186. @item hard
  2187. @item tanh
  2188. @item atan
  2189. @item cubic
  2190. @item exp
  2191. @item alg
  2192. @item quintic
  2193. @item sin
  2194. @item erf
  2195. @end table
  2196. @item threshold
  2197. Set threshold from where to start clipping. Default value is 0dB or 1.
  2198. @item output
  2199. Set gain applied to output. Default value is 0dB or 1.
  2200. @item param
  2201. Set additional parameter which controls sigmoid function.
  2202. @item oversample
  2203. Set oversampling factor.
  2204. @end table
  2205. @subsection Commands
  2206. This filter supports the all above options as @ref{commands}.
  2207. @section aspectralstats
  2208. Display frequency domain statistical information about the audio channels.
  2209. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2210. It accepts the following option:
  2211. @table @option
  2212. @item win_size
  2213. Set the window length in samples. Default value is 2048.
  2214. Allowed range is from 32 to 65536.
  2215. @item win_func
  2216. Set window function.
  2217. It accepts the following values:
  2218. @table @samp
  2219. @item rect
  2220. @item bartlett
  2221. @item hann, hanning
  2222. @item hamming
  2223. @item blackman
  2224. @item welch
  2225. @item flattop
  2226. @item bharris
  2227. @item bnuttall
  2228. @item bhann
  2229. @item sine
  2230. @item nuttall
  2231. @item lanczos
  2232. @item gauss
  2233. @item tukey
  2234. @item dolph
  2235. @item cauchy
  2236. @item parzen
  2237. @item poisson
  2238. @item bohman
  2239. @end table
  2240. Default is @code{hann}.
  2241. @item overlap
  2242. Set window overlap. Allowed range is from @code{0}
  2243. to @code{1}. Default value is @code{0.5}.
  2244. @end table
  2245. A list of each metadata key follows:
  2246. @table @option
  2247. @item mean
  2248. @item variance
  2249. @item centroid
  2250. @item spread
  2251. @item skewness
  2252. @item kurtosis
  2253. @item entropy
  2254. @item flatness
  2255. @item crest
  2256. @item flux
  2257. @item slope
  2258. @item decrease
  2259. @item rolloff
  2260. @end table
  2261. @section asr
  2262. Automatic Speech Recognition
  2263. This filter uses PocketSphinx for speech recognition. To enable
  2264. compilation of this filter, you need to configure FFmpeg with
  2265. @code{--enable-pocketsphinx}.
  2266. It accepts the following options:
  2267. @table @option
  2268. @item rate
  2269. Set sampling rate of input audio. Defaults is @code{16000}.
  2270. This need to match speech models, otherwise one will get poor results.
  2271. @item hmm
  2272. Set dictionary containing acoustic model files.
  2273. @item dict
  2274. Set pronunciation dictionary.
  2275. @item lm
  2276. Set language model file.
  2277. @item lmctl
  2278. Set language model set.
  2279. @item lmname
  2280. Set which language model to use.
  2281. @item logfn
  2282. Set output for log messages.
  2283. @end table
  2284. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2285. @anchor{astats}
  2286. @section astats
  2287. Display time domain statistical information about the audio channels.
  2288. Statistics are calculated and displayed for each audio channel and,
  2289. where applicable, an overall figure is also given.
  2290. It accepts the following option:
  2291. @table @option
  2292. @item length
  2293. Short window length in seconds, used for peak and trough RMS measurement.
  2294. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2295. @item metadata
  2296. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2297. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2298. disabled.
  2299. Available keys for each channel are:
  2300. DC_offset
  2301. Min_level
  2302. Max_level
  2303. Min_difference
  2304. Max_difference
  2305. Mean_difference
  2306. RMS_difference
  2307. Peak_level
  2308. RMS_peak
  2309. RMS_trough
  2310. Crest_factor
  2311. Flat_factor
  2312. Peak_count
  2313. Noise_floor
  2314. Noise_floor_count
  2315. Entropy
  2316. Bit_depth
  2317. Dynamic_range
  2318. Zero_crossings
  2319. Zero_crossings_rate
  2320. Number_of_NaNs
  2321. Number_of_Infs
  2322. Number_of_denormals
  2323. and for Overall:
  2324. DC_offset
  2325. Min_level
  2326. Max_level
  2327. Min_difference
  2328. Max_difference
  2329. Mean_difference
  2330. RMS_difference
  2331. Peak_level
  2332. RMS_level
  2333. RMS_peak
  2334. RMS_trough
  2335. Flat_factor
  2336. Peak_count
  2337. Noise_floor
  2338. Noise_floor_count
  2339. Entropy
  2340. Bit_depth
  2341. Number_of_samples
  2342. Number_of_NaNs
  2343. Number_of_Infs
  2344. Number_of_denormals
  2345. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  2346. this @code{lavfi.astats.Overall.Peak_count}.
  2347. For description what each key means read below.
  2348. @item reset
  2349. Set the number of frames over which cumulative stats are calculated before
  2350. being reset
  2351. Default is disabled.
  2352. @item measure_perchannel
  2353. Select the parameters which are measured per channel. The metadata keys can
  2354. be used as flags, default is @option{all} which measures everything.
  2355. @option{none} disables all per channel measurement.
  2356. @item measure_overall
  2357. Select the parameters which are measured overall. The metadata keys can
  2358. be used as flags, default is @option{all} which measures everything.
  2359. @option{none} disables all overall measurement.
  2360. @end table
  2361. A description of each shown parameter follows:
  2362. @table @option
  2363. @item DC offset
  2364. Mean amplitude displacement from zero.
  2365. @item Min level
  2366. Minimal sample level.
  2367. @item Max level
  2368. Maximal sample level.
  2369. @item Min difference
  2370. Minimal difference between two consecutive samples.
  2371. @item Max difference
  2372. Maximal difference between two consecutive samples.
  2373. @item Mean difference
  2374. Mean difference between two consecutive samples.
  2375. The average of each difference between two consecutive samples.
  2376. @item RMS difference
  2377. Root Mean Square difference between two consecutive samples.
  2378. @item Peak level dB
  2379. @item RMS level dB
  2380. Standard peak and RMS level measured in dBFS.
  2381. @item RMS peak dB
  2382. @item RMS trough dB
  2383. Peak and trough values for RMS level measured over a short window.
  2384. @item Crest factor
  2385. Standard ratio of peak to RMS level (note: not in dB).
  2386. @item Flat factor
  2387. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2388. (i.e. either @var{Min level} or @var{Max level}).
  2389. @item Peak count
  2390. Number of occasions (not the number of samples) that the signal attained either
  2391. @var{Min level} or @var{Max level}.
  2392. @item Noise floor dB
  2393. Minimum local peak measured in dBFS over a short window.
  2394. @item Noise floor count
  2395. Number of occasions (not the number of samples) that the signal attained
  2396. @var{Noise floor}.
  2397. @item Entropy
  2398. Entropy measured across whole audio. Entropy of value near 1.0 is typically measured for white noise.
  2399. @item Bit depth
  2400. Overall bit depth of audio. Number of bits used for each sample.
  2401. @item Dynamic range
  2402. Measured dynamic range of audio in dB.
  2403. @item Zero crossings
  2404. Number of points where the waveform crosses the zero level axis.
  2405. @item Zero crossings rate
  2406. Rate of Zero crossings and number of audio samples.
  2407. @end table
  2408. @section asubboost
  2409. Boost subwoofer frequencies.
  2410. The filter accepts the following options:
  2411. @table @option
  2412. @item dry
  2413. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2414. Default value is 1.0.
  2415. @item wet
  2416. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2417. Default value is 1.0.
  2418. @item boost
  2419. Set max boost factor. Allowed range is from 1 to 12. Default value is 2.
  2420. @item decay
  2421. Set delay line decay gain value. Allowed range is from 0 to 1.
  2422. Default value is 0.0.
  2423. @item feedback
  2424. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2425. Default value is 0.9.
  2426. @item cutoff
  2427. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2428. Default value is 100.
  2429. @item slope
  2430. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2431. Default value is 0.5.
  2432. @item delay
  2433. Set delay. Allowed range is from 1 to 100.
  2434. Default value is 20.
  2435. @item channels
  2436. Set the channels to process. Default value is all available.
  2437. @end table
  2438. @subsection Commands
  2439. This filter supports the all above options as @ref{commands}.
  2440. @section asubcut
  2441. Cut subwoofer frequencies.
  2442. This filter allows to set custom, steeper
  2443. roll off than highpass filter, and thus is able to more attenuate
  2444. frequency content in stop-band.
  2445. The filter accepts the following options:
  2446. @table @option
  2447. @item cutoff
  2448. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2449. Default value is 20.
  2450. @item order
  2451. Set filter order. Available values are from 3 to 20.
  2452. Default value is 10.
  2453. @item level
  2454. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2455. @end table
  2456. @subsection Commands
  2457. This filter supports the all above options as @ref{commands}.
  2458. @section asupercut
  2459. Cut super frequencies.
  2460. The filter accepts the following options:
  2461. @table @option
  2462. @item cutoff
  2463. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2464. Default value is 20000.
  2465. @item order
  2466. Set filter order. Available values are from 3 to 20.
  2467. Default value is 10.
  2468. @item level
  2469. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2470. @end table
  2471. @subsection Commands
  2472. This filter supports the all above options as @ref{commands}.
  2473. @section asuperpass
  2474. Apply high order Butterworth band-pass filter.
  2475. The filter accepts the following options:
  2476. @table @option
  2477. @item centerf
  2478. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2479. Default value is 1000.
  2480. @item order
  2481. Set filter order. Available values are from 4 to 20.
  2482. Default value is 4.
  2483. @item qfactor
  2484. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2485. @item level
  2486. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2487. @end table
  2488. @subsection Commands
  2489. This filter supports the all above options as @ref{commands}.
  2490. @section asuperstop
  2491. Apply high order Butterworth band-stop filter.
  2492. The filter accepts the following options:
  2493. @table @option
  2494. @item centerf
  2495. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2496. Default value is 1000.
  2497. @item order
  2498. Set filter order. Available values are from 4 to 20.
  2499. Default value is 4.
  2500. @item qfactor
  2501. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2502. @item level
  2503. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2504. @end table
  2505. @subsection Commands
  2506. This filter supports the all above options as @ref{commands}.
  2507. @section atempo
  2508. Adjust audio tempo.
  2509. The filter accepts exactly one parameter, the audio tempo. If not
  2510. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2511. be in the [0.5, 100.0] range.
  2512. Note that tempo greater than 2 will skip some samples rather than
  2513. blend them in. If for any reason this is a concern it is always
  2514. possible to daisy-chain several instances of atempo to achieve the
  2515. desired product tempo.
  2516. @subsection Examples
  2517. @itemize
  2518. @item
  2519. Slow down audio to 80% tempo:
  2520. @example
  2521. atempo=0.8
  2522. @end example
  2523. @item
  2524. To speed up audio to 300% tempo:
  2525. @example
  2526. atempo=3
  2527. @end example
  2528. @item
  2529. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2530. @example
  2531. atempo=sqrt(3),atempo=sqrt(3)
  2532. @end example
  2533. @end itemize
  2534. @subsection Commands
  2535. This filter supports the following commands:
  2536. @table @option
  2537. @item tempo
  2538. Change filter tempo scale factor.
  2539. Syntax for the command is : "@var{tempo}"
  2540. @end table
  2541. @section atilt
  2542. Apply spectral tilt filter to audio stream.
  2543. This filter apply any spectral roll-off slope over any specified frequency band.
  2544. The filter accepts the following options:
  2545. @table @option
  2546. @item freq
  2547. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2548. @item slope
  2549. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2550. @item width
  2551. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2552. @item order
  2553. Set order of tilt filter.
  2554. @item level
  2555. Set input volume level. Allowed range is from 0 to 4.
  2556. Defalt is 1.
  2557. @end table
  2558. @subsection Commands
  2559. This filter supports the all above options as @ref{commands}.
  2560. @section atrim
  2561. Trim the input so that the output contains one continuous subpart of the input.
  2562. It accepts the following parameters:
  2563. @table @option
  2564. @item start
  2565. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2566. sample with the timestamp @var{start} will be the first sample in the output.
  2567. @item end
  2568. Specify time of the first audio sample that will be dropped, i.e. the
  2569. audio sample immediately preceding the one with the timestamp @var{end} will be
  2570. the last sample in the output.
  2571. @item start_pts
  2572. Same as @var{start}, except this option sets the start timestamp in samples
  2573. instead of seconds.
  2574. @item end_pts
  2575. Same as @var{end}, except this option sets the end timestamp in samples instead
  2576. of seconds.
  2577. @item duration
  2578. The maximum duration of the output in seconds.
  2579. @item start_sample
  2580. The number of the first sample that should be output.
  2581. @item end_sample
  2582. The number of the first sample that should be dropped.
  2583. @end table
  2584. @option{start}, @option{end}, and @option{duration} are expressed as time
  2585. duration specifications; see
  2586. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2587. Note that the first two sets of the start/end options and the @option{duration}
  2588. option look at the frame timestamp, while the _sample options simply count the
  2589. samples that pass through the filter. So start/end_pts and start/end_sample will
  2590. give different results when the timestamps are wrong, inexact or do not start at
  2591. zero. Also note that this filter does not modify the timestamps. If you wish
  2592. to have the output timestamps start at zero, insert the asetpts filter after the
  2593. atrim filter.
  2594. If multiple start or end options are set, this filter tries to be greedy and
  2595. keep all samples that match at least one of the specified constraints. To keep
  2596. only the part that matches all the constraints at once, chain multiple atrim
  2597. filters.
  2598. The defaults are such that all the input is kept. So it is possible to set e.g.
  2599. just the end values to keep everything before the specified time.
  2600. Examples:
  2601. @itemize
  2602. @item
  2603. Drop everything except the second minute of input:
  2604. @example
  2605. ffmpeg -i INPUT -af atrim=60:120
  2606. @end example
  2607. @item
  2608. Keep only the first 1000 samples:
  2609. @example
  2610. ffmpeg -i INPUT -af atrim=end_sample=1000
  2611. @end example
  2612. @end itemize
  2613. @section axcorrelate
  2614. Calculate normalized windowed cross-correlation between two input audio streams.
  2615. Resulted samples are always between -1 and 1 inclusive.
  2616. If result is 1 it means two input samples are highly correlated in that selected segment.
  2617. Result 0 means they are not correlated at all.
  2618. If result is -1 it means two input samples are out of phase, which means they cancel each
  2619. other.
  2620. The filter accepts the following options:
  2621. @table @option
  2622. @item size
  2623. Set size of segment over which cross-correlation is calculated.
  2624. Default is 256. Allowed range is from 2 to 131072.
  2625. @item algo
  2626. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2627. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2628. are always zero and thus need much less calculations to make.
  2629. This is generally not true, but is valid for typical audio streams.
  2630. @end table
  2631. @subsection Examples
  2632. @itemize
  2633. @item
  2634. Calculate correlation between channels in stereo audio stream:
  2635. @example
  2636. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2637. @end example
  2638. @end itemize
  2639. @section bandpass
  2640. Apply a two-pole Butterworth band-pass filter with central
  2641. frequency @var{frequency}, and (3dB-point) band-width width.
  2642. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2643. instead of the default: constant 0dB peak gain.
  2644. The filter roll off at 6dB per octave (20dB per decade).
  2645. The filter accepts the following options:
  2646. @table @option
  2647. @item frequency, f
  2648. Set the filter's central frequency. Default is @code{3000}.
  2649. @item csg
  2650. Constant skirt gain if set to 1. Defaults to 0.
  2651. @item width_type, t
  2652. Set method to specify band-width of filter.
  2653. @table @option
  2654. @item h
  2655. Hz
  2656. @item q
  2657. Q-Factor
  2658. @item o
  2659. octave
  2660. @item s
  2661. slope
  2662. @item k
  2663. kHz
  2664. @end table
  2665. @item width, w
  2666. Specify the band-width of a filter in width_type units.
  2667. @item mix, m
  2668. How much to use filtered signal in output. Default is 1.
  2669. Range is between 0 and 1.
  2670. @item channels, c
  2671. Specify which channels to filter, by default all available are filtered.
  2672. @item normalize, n
  2673. Normalize biquad coefficients, by default is disabled.
  2674. Enabling it will normalize magnitude response at DC to 0dB.
  2675. @item transform, a
  2676. Set transform type of IIR filter.
  2677. @table @option
  2678. @item di
  2679. @item dii
  2680. @item tdi
  2681. @item tdii
  2682. @item latt
  2683. @item svf
  2684. @item zdf
  2685. @end table
  2686. @item precision, r
  2687. Set precison of filtering.
  2688. @table @option
  2689. @item auto
  2690. Pick automatic sample format depending on surround filters.
  2691. @item s16
  2692. Always use signed 16-bit.
  2693. @item s32
  2694. Always use signed 32-bit.
  2695. @item f32
  2696. Always use float 32-bit.
  2697. @item f64
  2698. Always use float 64-bit.
  2699. @end table
  2700. @item block_size, b
  2701. Set block size used for reverse IIR processing. If this value is set to high enough
  2702. value (higher than impulse response length truncated when reaches near zero values) filtering
  2703. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2704. Note that filter delay will be exactly this many samples when set to non-zero value.
  2705. @end table
  2706. @subsection Commands
  2707. This filter supports the following commands:
  2708. @table @option
  2709. @item frequency, f
  2710. Change bandpass frequency.
  2711. Syntax for the command is : "@var{frequency}"
  2712. @item width_type, t
  2713. Change bandpass width_type.
  2714. Syntax for the command is : "@var{width_type}"
  2715. @item width, w
  2716. Change bandpass width.
  2717. Syntax for the command is : "@var{width}"
  2718. @item mix, m
  2719. Change bandpass mix.
  2720. Syntax for the command is : "@var{mix}"
  2721. @end table
  2722. @section bandreject
  2723. Apply a two-pole Butterworth band-reject filter with central
  2724. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2725. The filter roll off at 6dB per octave (20dB per decade).
  2726. The filter accepts the following options:
  2727. @table @option
  2728. @item frequency, f
  2729. Set the filter's central frequency. Default is @code{3000}.
  2730. @item width_type, t
  2731. Set method to specify band-width of filter.
  2732. @table @option
  2733. @item h
  2734. Hz
  2735. @item q
  2736. Q-Factor
  2737. @item o
  2738. octave
  2739. @item s
  2740. slope
  2741. @item k
  2742. kHz
  2743. @end table
  2744. @item width, w
  2745. Specify the band-width of a filter in width_type units.
  2746. @item mix, m
  2747. How much to use filtered signal in output. Default is 1.
  2748. Range is between 0 and 1.
  2749. @item channels, c
  2750. Specify which channels to filter, by default all available are filtered.
  2751. @item normalize, n
  2752. Normalize biquad coefficients, by default is disabled.
  2753. Enabling it will normalize magnitude response at DC to 0dB.
  2754. @item transform, a
  2755. Set transform type of IIR filter.
  2756. @table @option
  2757. @item di
  2758. @item dii
  2759. @item tdi
  2760. @item tdii
  2761. @item latt
  2762. @item svf
  2763. @item zdf
  2764. @end table
  2765. @item precision, r
  2766. Set precison of filtering.
  2767. @table @option
  2768. @item auto
  2769. Pick automatic sample format depending on surround filters.
  2770. @item s16
  2771. Always use signed 16-bit.
  2772. @item s32
  2773. Always use signed 32-bit.
  2774. @item f32
  2775. Always use float 32-bit.
  2776. @item f64
  2777. Always use float 64-bit.
  2778. @end table
  2779. @item block_size, b
  2780. Set block size used for reverse IIR processing. If this value is set to high enough
  2781. value (higher than impulse response length truncated when reaches near zero values) filtering
  2782. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2783. Note that filter delay will be exactly this many samples when set to non-zero value.
  2784. @end table
  2785. @subsection Commands
  2786. This filter supports the following commands:
  2787. @table @option
  2788. @item frequency, f
  2789. Change bandreject frequency.
  2790. Syntax for the command is : "@var{frequency}"
  2791. @item width_type, t
  2792. Change bandreject width_type.
  2793. Syntax for the command is : "@var{width_type}"
  2794. @item width, w
  2795. Change bandreject width.
  2796. Syntax for the command is : "@var{width}"
  2797. @item mix, m
  2798. Change bandreject mix.
  2799. Syntax for the command is : "@var{mix}"
  2800. @end table
  2801. @section bass, lowshelf
  2802. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2803. shelving filter with a response similar to that of a standard
  2804. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2805. The filter accepts the following options:
  2806. @table @option
  2807. @item gain, g
  2808. Give the gain at 0 Hz. Its useful range is about -20
  2809. (for a large cut) to +20 (for a large boost).
  2810. Beware of clipping when using a positive gain.
  2811. @item frequency, f
  2812. Set the filter's central frequency and so can be used
  2813. to extend or reduce the frequency range to be boosted or cut.
  2814. The default value is @code{100} Hz.
  2815. @item width_type, t
  2816. Set method to specify band-width of filter.
  2817. @table @option
  2818. @item h
  2819. Hz
  2820. @item q
  2821. Q-Factor
  2822. @item o
  2823. octave
  2824. @item s
  2825. slope
  2826. @item k
  2827. kHz
  2828. @end table
  2829. @item width, w
  2830. Determine how steep is the filter's shelf transition.
  2831. @item poles, p
  2832. Set number of poles. Default is 2.
  2833. @item mix, m
  2834. How much to use filtered signal in output. Default is 1.
  2835. Range is between 0 and 1.
  2836. @item channels, c
  2837. Specify which channels to filter, by default all available are filtered.
  2838. @item normalize, n
  2839. Normalize biquad coefficients, by default is disabled.
  2840. Enabling it will normalize magnitude response at DC to 0dB.
  2841. @item transform, a
  2842. Set transform type of IIR filter.
  2843. @table @option
  2844. @item di
  2845. @item dii
  2846. @item tdi
  2847. @item tdii
  2848. @item latt
  2849. @item svf
  2850. @item zdf
  2851. @end table
  2852. @item precision, r
  2853. Set precison of filtering.
  2854. @table @option
  2855. @item auto
  2856. Pick automatic sample format depending on surround filters.
  2857. @item s16
  2858. Always use signed 16-bit.
  2859. @item s32
  2860. Always use signed 32-bit.
  2861. @item f32
  2862. Always use float 32-bit.
  2863. @item f64
  2864. Always use float 64-bit.
  2865. @end table
  2866. @item block_size, b
  2867. Set block size used for reverse IIR processing. If this value is set to high enough
  2868. value (higher than impulse response length truncated when reaches near zero values) filtering
  2869. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2870. Note that filter delay will be exactly this many samples when set to non-zero value.
  2871. @end table
  2872. @subsection Commands
  2873. This filter supports the following commands:
  2874. @table @option
  2875. @item frequency, f
  2876. Change bass frequency.
  2877. Syntax for the command is : "@var{frequency}"
  2878. @item width_type, t
  2879. Change bass width_type.
  2880. Syntax for the command is : "@var{width_type}"
  2881. @item width, w
  2882. Change bass width.
  2883. Syntax for the command is : "@var{width}"
  2884. @item gain, g
  2885. Change bass gain.
  2886. Syntax for the command is : "@var{gain}"
  2887. @item mix, m
  2888. Change bass mix.
  2889. Syntax for the command is : "@var{mix}"
  2890. @end table
  2891. @section biquad
  2892. Apply a biquad IIR filter with the given coefficients.
  2893. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2894. are the numerator and denominator coefficients respectively.
  2895. and @var{channels}, @var{c} specify which channels to filter, by default all
  2896. available are filtered.
  2897. @subsection Commands
  2898. This filter supports the following commands:
  2899. @table @option
  2900. @item a0
  2901. @item a1
  2902. @item a2
  2903. @item b0
  2904. @item b1
  2905. @item b2
  2906. Change biquad parameter.
  2907. Syntax for the command is : "@var{value}"
  2908. @item mix, m
  2909. How much to use filtered signal in output. Default is 1.
  2910. Range is between 0 and 1.
  2911. @item channels, c
  2912. Specify which channels to filter, by default all available are filtered.
  2913. @item normalize, n
  2914. Normalize biquad coefficients, by default is disabled.
  2915. Enabling it will normalize magnitude response at DC to 0dB.
  2916. @item transform, a
  2917. Set transform type of IIR filter.
  2918. @table @option
  2919. @item di
  2920. @item dii
  2921. @item tdi
  2922. @item tdii
  2923. @item latt
  2924. @item svf
  2925. @item zdf
  2926. @end table
  2927. @item precision, r
  2928. Set precison of filtering.
  2929. @table @option
  2930. @item auto
  2931. Pick automatic sample format depending on surround filters.
  2932. @item s16
  2933. Always use signed 16-bit.
  2934. @item s32
  2935. Always use signed 32-bit.
  2936. @item f32
  2937. Always use float 32-bit.
  2938. @item f64
  2939. Always use float 64-bit.
  2940. @end table
  2941. @item block_size, b
  2942. Set block size used for reverse IIR processing. If this value is set to high enough
  2943. value (higher than impulse response length truncated when reaches near zero values) filtering
  2944. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2945. Note that filter delay will be exactly this many samples when set to non-zero value.
  2946. @end table
  2947. @section bs2b
  2948. Bauer stereo to binaural transformation, which improves headphone listening of
  2949. stereo audio records.
  2950. To enable compilation of this filter you need to configure FFmpeg with
  2951. @code{--enable-libbs2b}.
  2952. It accepts the following parameters:
  2953. @table @option
  2954. @item profile
  2955. Pre-defined crossfeed level.
  2956. @table @option
  2957. @item default
  2958. Default level (fcut=700, feed=50).
  2959. @item cmoy
  2960. Chu Moy circuit (fcut=700, feed=60).
  2961. @item jmeier
  2962. Jan Meier circuit (fcut=650, feed=95).
  2963. @end table
  2964. @item fcut
  2965. Cut frequency (in Hz).
  2966. @item feed
  2967. Feed level (in Hz).
  2968. @end table
  2969. @section channelmap
  2970. Remap input channels to new locations.
  2971. It accepts the following parameters:
  2972. @table @option
  2973. @item map
  2974. Map channels from input to output. The argument is a '|'-separated list of
  2975. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2976. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2977. channel (e.g. FL for front left) or its index in the input channel layout.
  2978. @var{out_channel} is the name of the output channel or its index in the output
  2979. channel layout. If @var{out_channel} is not given then it is implicitly an
  2980. index, starting with zero and increasing by one for each mapping.
  2981. @item channel_layout
  2982. The channel layout of the output stream.
  2983. @end table
  2984. If no mapping is present, the filter will implicitly map input channels to
  2985. output channels, preserving indices.
  2986. @subsection Examples
  2987. @itemize
  2988. @item
  2989. For example, assuming a 5.1+downmix input MOV file,
  2990. @example
  2991. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2992. @end example
  2993. will create an output WAV file tagged as stereo from the downmix channels of
  2994. the input.
  2995. @item
  2996. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2997. @example
  2998. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2999. @end example
  3000. @end itemize
  3001. @section channelsplit
  3002. Split each channel from an input audio stream into a separate output stream.
  3003. It accepts the following parameters:
  3004. @table @option
  3005. @item channel_layout
  3006. The channel layout of the input stream. The default is "stereo".
  3007. @item channels
  3008. A channel layout describing the channels to be extracted as separate output streams
  3009. or "all" to extract each input channel as a separate stream. The default is "all".
  3010. Choosing channels not present in channel layout in the input will result in an error.
  3011. @end table
  3012. @subsection Examples
  3013. @itemize
  3014. @item
  3015. For example, assuming a stereo input MP3 file,
  3016. @example
  3017. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  3018. @end example
  3019. will create an output Matroska file with two audio streams, one containing only
  3020. the left channel and the other the right channel.
  3021. @item
  3022. Split a 5.1 WAV file into per-channel files:
  3023. @example
  3024. ffmpeg -i in.wav -filter_complex
  3025. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  3026. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  3027. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  3028. side_right.wav
  3029. @end example
  3030. @item
  3031. Extract only LFE from a 5.1 WAV file:
  3032. @example
  3033. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  3034. -map '[LFE]' lfe.wav
  3035. @end example
  3036. @end itemize
  3037. @section chorus
  3038. Add a chorus effect to the audio.
  3039. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  3040. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  3041. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  3042. The modulation depth defines the range the modulated delay is played before or after
  3043. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  3044. sound tuned around the original one, like in a chorus where some vocals are slightly
  3045. off key.
  3046. It accepts the following parameters:
  3047. @table @option
  3048. @item in_gain
  3049. Set input gain. Default is 0.4.
  3050. @item out_gain
  3051. Set output gain. Default is 0.4.
  3052. @item delays
  3053. Set delays. A typical delay is around 40ms to 60ms.
  3054. @item decays
  3055. Set decays.
  3056. @item speeds
  3057. Set speeds.
  3058. @item depths
  3059. Set depths.
  3060. @end table
  3061. @subsection Examples
  3062. @itemize
  3063. @item
  3064. A single delay:
  3065. @example
  3066. chorus=0.7:0.9:55:0.4:0.25:2
  3067. @end example
  3068. @item
  3069. Two delays:
  3070. @example
  3071. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3072. @end example
  3073. @item
  3074. Fuller sounding chorus with three delays:
  3075. @example
  3076. 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
  3077. @end example
  3078. @end itemize
  3079. @section compand
  3080. Compress or expand the audio's dynamic range.
  3081. It accepts the following parameters:
  3082. @table @option
  3083. @item attacks
  3084. @item decays
  3085. A list of times in seconds for each channel over which the instantaneous level
  3086. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3087. increase of volume and @var{decays} refers to decrease of volume. For most
  3088. situations, the attack time (response to the audio getting louder) should be
  3089. shorter than the decay time, because the human ear is more sensitive to sudden
  3090. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3091. a typical value for decay is 0.8 seconds.
  3092. If specified number of attacks & decays is lower than number of channels, the last
  3093. set attack/decay will be used for all remaining channels.
  3094. @item points
  3095. A list of points for the transfer function, specified in dB relative to the
  3096. maximum possible signal amplitude. Each key points list must be defined using
  3097. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3098. @code{x0/y0 x1/y1 x2/y2 ....}
  3099. The input values must be in strictly increasing order but the transfer function
  3100. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3101. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3102. function are @code{-70/-70|-60/-20|1/0}.
  3103. @item soft-knee
  3104. Set the curve radius in dB for all joints. It defaults to 0.01.
  3105. @item gain
  3106. Set the additional gain in dB to be applied at all points on the transfer
  3107. function. This allows for easy adjustment of the overall gain.
  3108. It defaults to 0.
  3109. @item volume
  3110. Set an initial volume, in dB, to be assumed for each channel when filtering
  3111. starts. This permits the user to supply a nominal level initially, so that, for
  3112. example, a very large gain is not applied to initial signal levels before the
  3113. companding has begun to operate. A typical value for audio which is initially
  3114. quiet is -90 dB. It defaults to 0.
  3115. @item delay
  3116. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3117. delayed before being fed to the volume adjuster. Specifying a delay
  3118. approximately equal to the attack/decay times allows the filter to effectively
  3119. operate in predictive rather than reactive mode. It defaults to 0.
  3120. @end table
  3121. @subsection Examples
  3122. @itemize
  3123. @item
  3124. Make music with both quiet and loud passages suitable for listening to in a
  3125. noisy environment:
  3126. @example
  3127. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3128. @end example
  3129. Another example for audio with whisper and explosion parts:
  3130. @example
  3131. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3132. @end example
  3133. @item
  3134. A noise gate for when the noise is at a lower level than the signal:
  3135. @example
  3136. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3137. @end example
  3138. @item
  3139. Here is another noise gate, this time for when the noise is at a higher level
  3140. than the signal (making it, in some ways, similar to squelch):
  3141. @example
  3142. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3143. @end example
  3144. @item
  3145. 2:1 compression starting at -6dB:
  3146. @example
  3147. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3148. @end example
  3149. @item
  3150. 2:1 compression starting at -9dB:
  3151. @example
  3152. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3153. @end example
  3154. @item
  3155. 2:1 compression starting at -12dB:
  3156. @example
  3157. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3158. @end example
  3159. @item
  3160. 2:1 compression starting at -18dB:
  3161. @example
  3162. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3163. @end example
  3164. @item
  3165. 3:1 compression starting at -15dB:
  3166. @example
  3167. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3168. @end example
  3169. @item
  3170. Compressor/Gate:
  3171. @example
  3172. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3173. @end example
  3174. @item
  3175. Expander:
  3176. @example
  3177. 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
  3178. @end example
  3179. @item
  3180. Hard limiter at -6dB:
  3181. @example
  3182. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3183. @end example
  3184. @item
  3185. Hard limiter at -12dB:
  3186. @example
  3187. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3188. @end example
  3189. @item
  3190. Hard noise gate at -35 dB:
  3191. @example
  3192. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3193. @end example
  3194. @item
  3195. Soft limiter:
  3196. @example
  3197. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3198. @end example
  3199. @end itemize
  3200. @section compensationdelay
  3201. Compensation Delay Line is a metric based delay to compensate differing
  3202. positions of microphones or speakers.
  3203. For example, you have recorded guitar with two microphones placed in
  3204. different locations. Because the front of sound wave has fixed speed in
  3205. normal conditions, the phasing of microphones can vary and depends on
  3206. their location and interposition. The best sound mix can be achieved when
  3207. these microphones are in phase (synchronized). Note that a distance of
  3208. ~30 cm between microphones makes one microphone capture the signal in
  3209. antiphase to the other microphone. That makes the final mix sound moody.
  3210. This filter helps to solve phasing problems by adding different delays
  3211. to each microphone track and make them synchronized.
  3212. The best result can be reached when you take one track as base and
  3213. synchronize other tracks one by one with it.
  3214. Remember that synchronization/delay tolerance depends on sample rate, too.
  3215. Higher sample rates will give more tolerance.
  3216. The filter accepts the following parameters:
  3217. @table @option
  3218. @item mm
  3219. Set millimeters distance. This is compensation distance for fine tuning.
  3220. Default is 0.
  3221. @item cm
  3222. Set cm distance. This is compensation distance for tightening distance setup.
  3223. Default is 0.
  3224. @item m
  3225. Set meters distance. This is compensation distance for hard distance setup.
  3226. Default is 0.
  3227. @item dry
  3228. Set dry amount. Amount of unprocessed (dry) signal.
  3229. Default is 0.
  3230. @item wet
  3231. Set wet amount. Amount of processed (wet) signal.
  3232. Default is 1.
  3233. @item temp
  3234. Set temperature in degrees Celsius. This is the temperature of the environment.
  3235. Default is 20.
  3236. @end table
  3237. @subsection Commands
  3238. This filter supports the all above options as @ref{commands}.
  3239. @section crossfeed
  3240. Apply headphone crossfeed filter.
  3241. Crossfeed is the process of blending the left and right channels of stereo
  3242. audio recording.
  3243. It is mainly used to reduce extreme stereo separation of low frequencies.
  3244. The intent is to produce more speaker like sound to the listener.
  3245. The filter accepts the following options:
  3246. @table @option
  3247. @item strength
  3248. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3249. This sets gain of low shelf filter for side part of stereo image.
  3250. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3251. @item range
  3252. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3253. This sets cut off frequency of low shelf filter. Default is cut off near
  3254. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3255. @item slope
  3256. Set curve slope of low shelf filter. Default is 0.5.
  3257. Allowed range is from 0.01 to 1.
  3258. @item level_in
  3259. Set input gain. Default is 0.9.
  3260. @item level_out
  3261. Set output gain. Default is 1.
  3262. @item block_size
  3263. Set block size used for reverse IIR processing. If this value is set to high enough
  3264. value (higher than impulse response length truncated when reaches near zero values) filtering
  3265. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3266. Note that filter delay will be exactly this many samples when set to non-zero value.
  3267. @end table
  3268. @subsection Commands
  3269. This filter supports the all above options as @ref{commands}.
  3270. @section crystalizer
  3271. Simple algorithm for audio noise sharpening.
  3272. This filter linearly increases differences betweeen each audio sample.
  3273. The filter accepts the following options:
  3274. @table @option
  3275. @item i
  3276. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3277. (unchanged sound) to 10.0 (maximum effect).
  3278. To inverse filtering use negative value.
  3279. @item c
  3280. Enable clipping. By default is enabled.
  3281. @end table
  3282. @subsection Commands
  3283. This filter supports the all above options as @ref{commands}.
  3284. @section dcshift
  3285. Apply a DC shift to the audio.
  3286. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3287. in the recording chain) from the audio. The effect of a DC offset is reduced
  3288. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3289. a signal has a DC offset.
  3290. @table @option
  3291. @item shift
  3292. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3293. the audio.
  3294. @item limitergain
  3295. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3296. used to prevent clipping.
  3297. @end table
  3298. @section deesser
  3299. Apply de-essing to the audio samples.
  3300. @table @option
  3301. @item i
  3302. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3303. Default is 0.
  3304. @item m
  3305. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3306. Default is 0.5.
  3307. @item f
  3308. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3309. Default is 0.5.
  3310. @item s
  3311. Set the output mode.
  3312. It accepts the following values:
  3313. @table @option
  3314. @item i
  3315. Pass input unchanged.
  3316. @item o
  3317. Pass ess filtered out.
  3318. @item e
  3319. Pass only ess.
  3320. Default value is @var{o}.
  3321. @end table
  3322. @end table
  3323. @section dialoguenhance
  3324. Enhance dialogue in stereo audio.
  3325. This filter accepts stereo input and produce surround (3.0) channels output.
  3326. The newly produced front center channel have enhanced speech dialogue originally
  3327. available in both stereo channels.
  3328. This filter outputs front left and front right channels same as available in stereo input.
  3329. The filter accepts the following options:
  3330. @table @option
  3331. @item original
  3332. Set the original center factor to keep in front center channel output.
  3333. Allowed range is from 0 to 1. Default value is 1.
  3334. @item enhance
  3335. Set the dialogue enhance factor to put in front center channel output.
  3336. Allowed range is from 0 to 3. Default value is 1.
  3337. @item voice
  3338. Set the voice detection factor.
  3339. Allowed range is from 2 to 32. Default value is 2.
  3340. @end table
  3341. @subsection Commands
  3342. This filter supports the all above options as @ref{commands}.
  3343. @section drmeter
  3344. Measure audio dynamic range.
  3345. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3346. is found in transition material. And anything less that 8 have very poor dynamics
  3347. and is very compressed.
  3348. The filter accepts the following options:
  3349. @table @option
  3350. @item length
  3351. Set window length in seconds used to split audio into segments of equal length.
  3352. Default is 3 seconds.
  3353. @end table
  3354. @section dynaudnorm
  3355. Dynamic Audio Normalizer.
  3356. This filter applies a certain amount of gain to the input audio in order
  3357. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3358. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3359. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3360. This allows for applying extra gain to the "quiet" sections of the audio
  3361. while avoiding distortions or clipping the "loud" sections. In other words:
  3362. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3363. sections, in the sense that the volume of each section is brought to the
  3364. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3365. this goal *without* applying "dynamic range compressing". It will retain 100%
  3366. of the dynamic range *within* each section of the audio file.
  3367. @table @option
  3368. @item framelen, f
  3369. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3370. Default is 500 milliseconds.
  3371. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3372. referred to as frames. This is required, because a peak magnitude has no
  3373. meaning for just a single sample value. Instead, we need to determine the
  3374. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3375. normalizer would simply use the peak magnitude of the complete file, the
  3376. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3377. frame. The length of a frame is specified in milliseconds. By default, the
  3378. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3379. been found to give good results with most files.
  3380. Note that the exact frame length, in number of samples, will be determined
  3381. automatically, based on the sampling rate of the individual input audio file.
  3382. @item gausssize, g
  3383. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3384. number. Default is 31.
  3385. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3386. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3387. is specified in frames, centered around the current frame. For the sake of
  3388. simplicity, this must be an odd number. Consequently, the default value of 31
  3389. takes into account the current frame, as well as the 15 preceding frames and
  3390. the 15 subsequent frames. Using a larger window results in a stronger
  3391. smoothing effect and thus in less gain variation, i.e. slower gain
  3392. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3393. effect and thus in more gain variation, i.e. faster gain adaptation.
  3394. In other words, the more you increase this value, the more the Dynamic Audio
  3395. Normalizer will behave like a "traditional" normalization filter. On the
  3396. contrary, the more you decrease this value, the more the Dynamic Audio
  3397. Normalizer will behave like a dynamic range compressor.
  3398. @item peak, p
  3399. Set the target peak value. This specifies the highest permissible magnitude
  3400. level for the normalized audio input. This filter will try to approach the
  3401. target peak magnitude as closely as possible, but at the same time it also
  3402. makes sure that the normalized signal will never exceed the peak magnitude.
  3403. A frame's maximum local gain factor is imposed directly by the target peak
  3404. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3405. It is not recommended to go above this value.
  3406. @item maxgain, m
  3407. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3408. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3409. factor for each input frame, i.e. the maximum gain factor that does not
  3410. result in clipping or distortion. The maximum gain factor is determined by
  3411. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3412. additionally bounds the frame's maximum gain factor by a predetermined
  3413. (global) maximum gain factor. This is done in order to avoid excessive gain
  3414. factors in "silent" or almost silent frames. By default, the maximum gain
  3415. factor is 10.0, For most inputs the default value should be sufficient and
  3416. it usually is not recommended to increase this value. Though, for input
  3417. with an extremely low overall volume level, it may be necessary to allow even
  3418. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3419. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3420. Instead, a "sigmoid" threshold function will be applied. This way, the
  3421. gain factors will smoothly approach the threshold value, but never exceed that
  3422. value.
  3423. @item targetrms, r
  3424. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3425. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3426. This means that the maximum local gain factor for each frame is defined
  3427. (only) by the frame's highest magnitude sample. This way, the samples can
  3428. be amplified as much as possible without exceeding the maximum signal
  3429. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3430. Normalizer can also take into account the frame's root mean square,
  3431. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3432. determine the power of a time-varying signal. It is therefore considered
  3433. that the RMS is a better approximation of the "perceived loudness" than
  3434. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3435. frames to a constant RMS value, a uniform "perceived loudness" can be
  3436. established. If a target RMS value has been specified, a frame's local gain
  3437. factor is defined as the factor that would result in exactly that RMS value.
  3438. Note, however, that the maximum local gain factor is still restricted by the
  3439. frame's highest magnitude sample, in order to prevent clipping.
  3440. @item coupling, n
  3441. Enable channels coupling. By default is enabled.
  3442. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3443. amount. This means the same gain factor will be applied to all channels, i.e.
  3444. the maximum possible gain factor is determined by the "loudest" channel.
  3445. However, in some recordings, it may happen that the volume of the different
  3446. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3447. In this case, this option can be used to disable the channel coupling. This way,
  3448. the gain factor will be determined independently for each channel, depending
  3449. only on the individual channel's highest magnitude sample. This allows for
  3450. harmonizing the volume of the different channels.
  3451. @item correctdc, c
  3452. Enable DC bias correction. By default is disabled.
  3453. An audio signal (in the time domain) is a sequence of sample values.
  3454. In the Dynamic Audio Normalizer these sample values are represented in the
  3455. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3456. audio signal, or "waveform", should be centered around the zero point.
  3457. That means if we calculate the mean value of all samples in a file, or in a
  3458. single frame, then the result should be 0.0 or at least very close to that
  3459. value. If, however, there is a significant deviation of the mean value from
  3460. 0.0, in either positive or negative direction, this is referred to as a
  3461. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3462. Audio Normalizer provides optional DC bias correction.
  3463. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3464. the mean value, or "DC correction" offset, of each input frame and subtract
  3465. that value from all of the frame's sample values which ensures those samples
  3466. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3467. boundaries, the DC correction offset values will be interpolated smoothly
  3468. between neighbouring frames.
  3469. @item altboundary, b
  3470. Enable alternative boundary mode. By default is disabled.
  3471. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3472. around each frame. This includes the preceding frames as well as the
  3473. subsequent frames. However, for the "boundary" frames, located at the very
  3474. beginning and at the very end of the audio file, not all neighbouring
  3475. frames are available. In particular, for the first few frames in the audio
  3476. file, the preceding frames are not known. And, similarly, for the last few
  3477. frames in the audio file, the subsequent frames are not known. Thus, the
  3478. question arises which gain factors should be assumed for the missing frames
  3479. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3480. to deal with this situation. The default boundary mode assumes a gain factor
  3481. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3482. "fade out" at the beginning and at the end of the input, respectively.
  3483. @item compress, s
  3484. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3485. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3486. compression. This means that signal peaks will not be pruned and thus the
  3487. full dynamic range will be retained within each local neighbourhood. However,
  3488. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3489. normalization algorithm with a more "traditional" compression.
  3490. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3491. (thresholding) function. If (and only if) the compression feature is enabled,
  3492. all input frames will be processed by a soft knee thresholding function prior
  3493. to the actual normalization process. Put simply, the thresholding function is
  3494. going to prune all samples whose magnitude exceeds a certain threshold value.
  3495. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3496. value. Instead, the threshold value will be adjusted for each individual
  3497. frame.
  3498. In general, smaller parameters result in stronger compression, and vice versa.
  3499. Values below 3.0 are not recommended, because audible distortion may appear.
  3500. @item threshold, t
  3501. Set the target threshold value. This specifies the lowest permissible
  3502. magnitude level for the audio input which will be normalized.
  3503. If input frame volume is above this value frame will be normalized.
  3504. Otherwise frame may not be normalized at all. The default value is set
  3505. to 0, which means all input frames will be normalized.
  3506. This option is mostly useful if digital noise is not wanted to be amplified.
  3507. @item channels, h
  3508. Specify which channels to filter, by default all available channels are filtered.
  3509. @item overlap, o
  3510. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3511. Using >0 and <1 values will make less conservative gain adjustments, like
  3512. when framelen option is set to smaller value, if framelen option value is
  3513. compensated for non-zero overlap then gain adjustments will be smoother across time
  3514. compared to zero overlap case.
  3515. @end table
  3516. @subsection Commands
  3517. This filter supports the all above options as @ref{commands}.
  3518. @section earwax
  3519. Make audio easier to listen to on headphones.
  3520. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3521. so that when listened to on headphones the stereo image is moved from
  3522. inside your head (standard for headphones) to outside and in front of
  3523. the listener (standard for speakers).
  3524. Ported from SoX.
  3525. @section equalizer
  3526. Apply a two-pole peaking equalisation (EQ) filter. With this
  3527. filter, the signal-level at and around a selected frequency can
  3528. be increased or decreased, whilst (unlike bandpass and bandreject
  3529. filters) that at all other frequencies is unchanged.
  3530. In order to produce complex equalisation curves, this filter can
  3531. be given several times, each with a different central frequency.
  3532. The filter accepts the following options:
  3533. @table @option
  3534. @item frequency, f
  3535. Set the filter's central frequency in Hz.
  3536. @item width_type, t
  3537. Set method to specify band-width of filter.
  3538. @table @option
  3539. @item h
  3540. Hz
  3541. @item q
  3542. Q-Factor
  3543. @item o
  3544. octave
  3545. @item s
  3546. slope
  3547. @item k
  3548. kHz
  3549. @end table
  3550. @item width, w
  3551. Specify the band-width of a filter in width_type units.
  3552. @item gain, g
  3553. Set the required gain or attenuation in dB.
  3554. Beware of clipping when using a positive gain.
  3555. @item mix, m
  3556. How much to use filtered signal in output. Default is 1.
  3557. Range is between 0 and 1.
  3558. @item channels, c
  3559. Specify which channels to filter, by default all available are filtered.
  3560. @item normalize, n
  3561. Normalize biquad coefficients, by default is disabled.
  3562. Enabling it will normalize magnitude response at DC to 0dB.
  3563. @item transform, a
  3564. Set transform type of IIR filter.
  3565. @table @option
  3566. @item di
  3567. @item dii
  3568. @item tdi
  3569. @item tdii
  3570. @item latt
  3571. @item svf
  3572. @item zdf
  3573. @end table
  3574. @item precision, r
  3575. Set precison of filtering.
  3576. @table @option
  3577. @item auto
  3578. Pick automatic sample format depending on surround filters.
  3579. @item s16
  3580. Always use signed 16-bit.
  3581. @item s32
  3582. Always use signed 32-bit.
  3583. @item f32
  3584. Always use float 32-bit.
  3585. @item f64
  3586. Always use float 64-bit.
  3587. @end table
  3588. @item block_size, b
  3589. Set block size used for reverse IIR processing. If this value is set to high enough
  3590. value (higher than impulse response length truncated when reaches near zero values) filtering
  3591. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3592. Note that filter delay will be exactly this many samples when set to non-zero value.
  3593. @end table
  3594. @subsection Examples
  3595. @itemize
  3596. @item
  3597. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3598. @example
  3599. equalizer=f=1000:t=h:width=200:g=-10
  3600. @end example
  3601. @item
  3602. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3603. @example
  3604. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3605. @end example
  3606. @end itemize
  3607. @subsection Commands
  3608. This filter supports the following commands:
  3609. @table @option
  3610. @item frequency, f
  3611. Change equalizer frequency.
  3612. Syntax for the command is : "@var{frequency}"
  3613. @item width_type, t
  3614. Change equalizer width_type.
  3615. Syntax for the command is : "@var{width_type}"
  3616. @item width, w
  3617. Change equalizer width.
  3618. Syntax for the command is : "@var{width}"
  3619. @item gain, g
  3620. Change equalizer gain.
  3621. Syntax for the command is : "@var{gain}"
  3622. @item mix, m
  3623. Change equalizer mix.
  3624. Syntax for the command is : "@var{mix}"
  3625. @end table
  3626. @section extrastereo
  3627. Linearly increases the difference between left and right channels which
  3628. adds some sort of "live" effect to playback.
  3629. The filter accepts the following options:
  3630. @table @option
  3631. @item m
  3632. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3633. (average of both channels), with 1.0 sound will be unchanged, with
  3634. -1.0 left and right channels will be swapped.
  3635. @item c
  3636. Enable clipping. By default is enabled.
  3637. @end table
  3638. @subsection Commands
  3639. This filter supports the all above options as @ref{commands}.
  3640. @section firequalizer
  3641. Apply FIR Equalization using arbitrary frequency response.
  3642. The filter accepts the following option:
  3643. @table @option
  3644. @item gain
  3645. Set gain curve equation (in dB). The expression can contain variables:
  3646. @table @option
  3647. @item f
  3648. the evaluated frequency
  3649. @item sr
  3650. sample rate
  3651. @item ch
  3652. channel number, set to 0 when multichannels evaluation is disabled
  3653. @item chid
  3654. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3655. multichannels evaluation is disabled
  3656. @item chs
  3657. number of channels
  3658. @item chlayout
  3659. channel_layout, see libavutil/channel_layout.h
  3660. @end table
  3661. and functions:
  3662. @table @option
  3663. @item gain_interpolate(f)
  3664. interpolate gain on frequency f based on gain_entry
  3665. @item cubic_interpolate(f)
  3666. same as gain_interpolate, but smoother
  3667. @end table
  3668. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3669. @item gain_entry
  3670. Set gain entry for gain_interpolate function. The expression can
  3671. contain functions:
  3672. @table @option
  3673. @item entry(f, g)
  3674. store gain entry at frequency f with value g
  3675. @end table
  3676. This option is also available as command.
  3677. @item delay
  3678. Set filter delay in seconds. Higher value means more accurate.
  3679. Default is @code{0.01}.
  3680. @item accuracy
  3681. Set filter accuracy in Hz. Lower value means more accurate.
  3682. Default is @code{5}.
  3683. @item wfunc
  3684. Set window function. Acceptable values are:
  3685. @table @option
  3686. @item rectangular
  3687. rectangular window, useful when gain curve is already smooth
  3688. @item hann
  3689. hann window (default)
  3690. @item hamming
  3691. hamming window
  3692. @item blackman
  3693. blackman window
  3694. @item nuttall3
  3695. 3-terms continuous 1st derivative nuttall window
  3696. @item mnuttall3
  3697. minimum 3-terms discontinuous nuttall window
  3698. @item nuttall
  3699. 4-terms continuous 1st derivative nuttall window
  3700. @item bnuttall
  3701. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3702. @item bharris
  3703. blackman-harris window
  3704. @item tukey
  3705. tukey window
  3706. @end table
  3707. @item fixed
  3708. If enabled, use fixed number of audio samples. This improves speed when
  3709. filtering with large delay. Default is disabled.
  3710. @item multi
  3711. Enable multichannels evaluation on gain. Default is disabled.
  3712. @item zero_phase
  3713. Enable zero phase mode by subtracting timestamp to compensate delay.
  3714. Default is disabled.
  3715. @item scale
  3716. Set scale used by gain. Acceptable values are:
  3717. @table @option
  3718. @item linlin
  3719. linear frequency, linear gain
  3720. @item linlog
  3721. linear frequency, logarithmic (in dB) gain (default)
  3722. @item loglin
  3723. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3724. @item loglog
  3725. logarithmic frequency, logarithmic gain
  3726. @end table
  3727. @item dumpfile
  3728. Set file for dumping, suitable for gnuplot.
  3729. @item dumpscale
  3730. Set scale for dumpfile. Acceptable values are same with scale option.
  3731. Default is linlog.
  3732. @item fft2
  3733. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3734. Default is disabled.
  3735. @item min_phase
  3736. Enable minimum phase impulse response. Default is disabled.
  3737. @end table
  3738. @subsection Examples
  3739. @itemize
  3740. @item
  3741. lowpass at 1000 Hz:
  3742. @example
  3743. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3744. @end example
  3745. @item
  3746. lowpass at 1000 Hz with gain_entry:
  3747. @example
  3748. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3749. @end example
  3750. @item
  3751. custom equalization:
  3752. @example
  3753. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3754. @end example
  3755. @item
  3756. higher delay with zero phase to compensate delay:
  3757. @example
  3758. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3759. @end example
  3760. @item
  3761. lowpass on left channel, highpass on right channel:
  3762. @example
  3763. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3764. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3765. @end example
  3766. @end itemize
  3767. @section flanger
  3768. Apply a flanging effect to the audio.
  3769. The filter accepts the following options:
  3770. @table @option
  3771. @item delay
  3772. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3773. @item depth
  3774. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3775. @item regen
  3776. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3777. Default value is 0.
  3778. @item width
  3779. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3780. Default value is 71.
  3781. @item speed
  3782. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3783. @item shape
  3784. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3785. Default value is @var{sinusoidal}.
  3786. @item phase
  3787. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3788. Default value is 25.
  3789. @item interp
  3790. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3791. Default is @var{linear}.
  3792. @end table
  3793. @section haas
  3794. Apply Haas effect to audio.
  3795. Note that this makes most sense to apply on mono signals.
  3796. With this filter applied to mono signals it give some directionality and
  3797. stretches its stereo image.
  3798. The filter accepts the following options:
  3799. @table @option
  3800. @item level_in
  3801. Set input level. By default is @var{1}, or 0dB
  3802. @item level_out
  3803. Set output level. By default is @var{1}, or 0dB.
  3804. @item side_gain
  3805. Set gain applied to side part of signal. By default is @var{1}.
  3806. @item middle_source
  3807. Set kind of middle source. Can be one of the following:
  3808. @table @samp
  3809. @item left
  3810. Pick left channel.
  3811. @item right
  3812. Pick right channel.
  3813. @item mid
  3814. Pick middle part signal of stereo image.
  3815. @item side
  3816. Pick side part signal of stereo image.
  3817. @end table
  3818. @item middle_phase
  3819. Change middle phase. By default is disabled.
  3820. @item left_delay
  3821. Set left channel delay. By default is @var{2.05} milliseconds.
  3822. @item left_balance
  3823. Set left channel balance. By default is @var{-1}.
  3824. @item left_gain
  3825. Set left channel gain. By default is @var{1}.
  3826. @item left_phase
  3827. Change left phase. By default is disabled.
  3828. @item right_delay
  3829. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3830. @item right_balance
  3831. Set right channel balance. By default is @var{1}.
  3832. @item right_gain
  3833. Set right channel gain. By default is @var{1}.
  3834. @item right_phase
  3835. Change right phase. By default is enabled.
  3836. @end table
  3837. @section hdcd
  3838. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3839. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3840. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3841. of HDCD, and detects the Transient Filter flag.
  3842. @example
  3843. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3844. @end example
  3845. When using the filter with wav, note the default encoding for wav is 16-bit,
  3846. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3847. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3848. @example
  3849. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3850. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3851. @end example
  3852. The filter accepts the following options:
  3853. @table @option
  3854. @item disable_autoconvert
  3855. Disable any automatic format conversion or resampling in the filter graph.
  3856. @item process_stereo
  3857. Process the stereo channels together. If target_gain does not match between
  3858. channels, consider it invalid and use the last valid target_gain.
  3859. @item cdt_ms
  3860. Set the code detect timer period in ms.
  3861. @item force_pe
  3862. Always extend peaks above -3dBFS even if PE isn't signaled.
  3863. @item analyze_mode
  3864. Replace audio with a solid tone and adjust the amplitude to signal some
  3865. specific aspect of the decoding process. The output file can be loaded in
  3866. an audio editor alongside the original to aid analysis.
  3867. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3868. Modes are:
  3869. @table @samp
  3870. @item 0, off
  3871. Disabled
  3872. @item 1, lle
  3873. Gain adjustment level at each sample
  3874. @item 2, pe
  3875. Samples where peak extend occurs
  3876. @item 3, cdt
  3877. Samples where the code detect timer is active
  3878. @item 4, tgm
  3879. Samples where the target gain does not match between channels
  3880. @end table
  3881. @end table
  3882. @section headphone
  3883. Apply head-related transfer functions (HRTFs) to create virtual
  3884. loudspeakers around the user for binaural listening via headphones.
  3885. The HRIRs are provided via additional streams, for each channel
  3886. one stereo input stream is needed.
  3887. The filter accepts the following options:
  3888. @table @option
  3889. @item map
  3890. Set mapping of input streams for convolution.
  3891. The argument is a '|'-separated list of channel names in order as they
  3892. are given as additional stream inputs for filter.
  3893. This also specify number of input streams. Number of input streams
  3894. must be not less than number of channels in first stream plus one.
  3895. @item gain
  3896. Set gain applied to audio. Value is in dB. Default is 0.
  3897. @item type
  3898. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3899. processing audio in time domain which is slow.
  3900. @var{freq} is processing audio in frequency domain which is fast.
  3901. Default is @var{freq}.
  3902. @item lfe
  3903. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3904. @item size
  3905. Set size of frame in number of samples which will be processed at once.
  3906. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3907. @item hrir
  3908. Set format of hrir stream.
  3909. Default value is @var{stereo}. Alternative value is @var{multich}.
  3910. If value is set to @var{stereo}, number of additional streams should
  3911. be greater or equal to number of input channels in first input stream.
  3912. Also each additional stream should have stereo number of channels.
  3913. If value is set to @var{multich}, number of additional streams should
  3914. be exactly one. Also number of input channels of additional stream
  3915. should be equal or greater than twice number of channels of first input
  3916. stream.
  3917. @end table
  3918. @subsection Examples
  3919. @itemize
  3920. @item
  3921. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3922. each amovie filter use stereo file with IR coefficients as input.
  3923. The files give coefficients for each position of virtual loudspeaker:
  3924. @example
  3925. ffmpeg -i input.wav
  3926. -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"
  3927. output.wav
  3928. @end example
  3929. @item
  3930. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3931. but now in @var{multich} @var{hrir} format.
  3932. @example
  3933. 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"
  3934. output.wav
  3935. @end example
  3936. @end itemize
  3937. @section highpass
  3938. Apply a high-pass filter with 3dB point frequency.
  3939. The filter can be either single-pole, or double-pole (the default).
  3940. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3941. The filter accepts the following options:
  3942. @table @option
  3943. @item frequency, f
  3944. Set frequency in Hz. Default is 3000.
  3945. @item poles, p
  3946. Set number of poles. Default is 2.
  3947. @item width_type, t
  3948. Set method to specify band-width of filter.
  3949. @table @option
  3950. @item h
  3951. Hz
  3952. @item q
  3953. Q-Factor
  3954. @item o
  3955. octave
  3956. @item s
  3957. slope
  3958. @item k
  3959. kHz
  3960. @end table
  3961. @item width, w
  3962. Specify the band-width of a filter in width_type units.
  3963. Applies only to double-pole filter.
  3964. The default is 0.707q and gives a Butterworth response.
  3965. @item mix, m
  3966. How much to use filtered signal in output. Default is 1.
  3967. Range is between 0 and 1.
  3968. @item channels, c
  3969. Specify which channels to filter, by default all available are filtered.
  3970. @item normalize, n
  3971. Normalize biquad coefficients, by default is disabled.
  3972. Enabling it will normalize magnitude response at DC to 0dB.
  3973. @item transform, a
  3974. Set transform type of IIR filter.
  3975. @table @option
  3976. @item di
  3977. @item dii
  3978. @item tdi
  3979. @item tdii
  3980. @item latt
  3981. @item svf
  3982. @item zdf
  3983. @end table
  3984. @item precision, r
  3985. Set precison of filtering.
  3986. @table @option
  3987. @item auto
  3988. Pick automatic sample format depending on surround filters.
  3989. @item s16
  3990. Always use signed 16-bit.
  3991. @item s32
  3992. Always use signed 32-bit.
  3993. @item f32
  3994. Always use float 32-bit.
  3995. @item f64
  3996. Always use float 64-bit.
  3997. @end table
  3998. @item block_size, b
  3999. Set block size used for reverse IIR processing. If this value is set to high enough
  4000. value (higher than impulse response length truncated when reaches near zero values) filtering
  4001. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4002. Note that filter delay will be exactly this many samples when set to non-zero value.
  4003. @end table
  4004. @subsection Commands
  4005. This filter supports the following commands:
  4006. @table @option
  4007. @item frequency, f
  4008. Change highpass frequency.
  4009. Syntax for the command is : "@var{frequency}"
  4010. @item width_type, t
  4011. Change highpass width_type.
  4012. Syntax for the command is : "@var{width_type}"
  4013. @item width, w
  4014. Change highpass width.
  4015. Syntax for the command is : "@var{width}"
  4016. @item mix, m
  4017. Change highpass mix.
  4018. Syntax for the command is : "@var{mix}"
  4019. @end table
  4020. @section join
  4021. Join multiple input streams into one multi-channel stream.
  4022. It accepts the following parameters:
  4023. @table @option
  4024. @item inputs
  4025. The number of input streams. It defaults to 2.
  4026. @item channel_layout
  4027. The desired output channel layout. It defaults to stereo.
  4028. @item map
  4029. Map channels from inputs to output. The argument is a '|'-separated list of
  4030. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  4031. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  4032. can be either the name of the input channel (e.g. FL for front left) or its
  4033. index in the specified input stream. @var{out_channel} is the name of the output
  4034. channel.
  4035. @end table
  4036. The filter will attempt to guess the mappings when they are not specified
  4037. explicitly. It does so by first trying to find an unused matching input channel
  4038. and if that fails it picks the first unused input channel.
  4039. Join 3 inputs (with properly set channel layouts):
  4040. @example
  4041. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  4042. @end example
  4043. Build a 5.1 output from 6 single-channel streams:
  4044. @example
  4045. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  4046. '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'
  4047. out
  4048. @end example
  4049. @section ladspa
  4050. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  4051. To enable compilation of this filter you need to configure FFmpeg with
  4052. @code{--enable-ladspa}.
  4053. @table @option
  4054. @item file, f
  4055. Specifies the name of LADSPA plugin library to load. If the environment
  4056. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  4057. each one of the directories specified by the colon separated list in
  4058. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  4059. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  4060. @file{/usr/lib/ladspa/}.
  4061. @item plugin, p
  4062. Specifies the plugin within the library. Some libraries contain only
  4063. one plugin, but others contain many of them. If this is not set filter
  4064. will list all available plugins within the specified library.
  4065. @item controls, c
  4066. Set the '|' separated list of controls which are zero or more floating point
  4067. values that determine the behavior of the loaded plugin (for example delay,
  4068. threshold or gain).
  4069. Controls need to be defined using the following syntax:
  4070. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  4071. @var{valuei} is the value set on the @var{i}-th control.
  4072. Alternatively they can be also defined using the following syntax:
  4073. @var{value0}|@var{value1}|@var{value2}|..., where
  4074. @var{valuei} is the value set on the @var{i}-th control.
  4075. If @option{controls} is set to @code{help}, all available controls and
  4076. their valid ranges are printed.
  4077. @item sample_rate, s
  4078. Specify the sample rate, default to 44100. Only used if plugin have
  4079. zero inputs.
  4080. @item nb_samples, n
  4081. Set the number of samples per channel per each output frame, default
  4082. is 1024. Only used if plugin have zero inputs.
  4083. @item duration, d
  4084. Set the minimum duration of the sourced audio. See
  4085. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4086. for the accepted syntax.
  4087. Note that the resulting duration may be greater than the specified duration,
  4088. as the generated audio is always cut at the end of a complete frame.
  4089. If not specified, or the expressed duration is negative, the audio is
  4090. supposed to be generated forever.
  4091. Only used if plugin have zero inputs.
  4092. @item latency, l
  4093. Enable latency compensation, by default is disabled.
  4094. Only used if plugin have inputs.
  4095. @end table
  4096. @subsection Examples
  4097. @itemize
  4098. @item
  4099. List all available plugins within amp (LADSPA example plugin) library:
  4100. @example
  4101. ladspa=file=amp
  4102. @end example
  4103. @item
  4104. List all available controls and their valid ranges for @code{vcf_notch}
  4105. plugin from @code{VCF} library:
  4106. @example
  4107. ladspa=f=vcf:p=vcf_notch:c=help
  4108. @end example
  4109. @item
  4110. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4111. plugin library:
  4112. @example
  4113. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4114. @end example
  4115. @item
  4116. Add reverberation to the audio using TAP-plugins
  4117. (Tom's Audio Processing plugins):
  4118. @example
  4119. ladspa=file=tap_reverb:tap_reverb
  4120. @end example
  4121. @item
  4122. Generate white noise, with 0.2 amplitude:
  4123. @example
  4124. ladspa=file=cmt:noise_source_white:c=c0=.2
  4125. @end example
  4126. @item
  4127. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4128. @code{C* Audio Plugin Suite} (CAPS) library:
  4129. @example
  4130. ladspa=file=caps:Click:c=c1=20'
  4131. @end example
  4132. @item
  4133. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4134. @example
  4135. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4136. @end example
  4137. @item
  4138. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4139. @code{SWH Plugins} collection:
  4140. @example
  4141. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4142. @end example
  4143. @item
  4144. Attenuate low frequencies using Multiband EQ from Steve Harris
  4145. @code{SWH Plugins} collection:
  4146. @example
  4147. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4148. @end example
  4149. @item
  4150. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4151. (CAPS) library:
  4152. @example
  4153. ladspa=caps:Narrower
  4154. @end example
  4155. @item
  4156. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4157. @example
  4158. ladspa=caps:White:.2
  4159. @end example
  4160. @item
  4161. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4162. @example
  4163. ladspa=caps:Fractal:c=c1=1
  4164. @end example
  4165. @item
  4166. Dynamic volume normalization using @code{VLevel} plugin:
  4167. @example
  4168. ladspa=vlevel-ladspa:vlevel_mono
  4169. @end example
  4170. @end itemize
  4171. @subsection Commands
  4172. This filter supports the following commands:
  4173. @table @option
  4174. @item cN
  4175. Modify the @var{N}-th control value.
  4176. If the specified value is not valid, it is ignored and prior one is kept.
  4177. @end table
  4178. @section loudnorm
  4179. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4180. Support for both single pass (livestreams, files) and double pass (files) modes.
  4181. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4182. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4183. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4184. The filter accepts the following options:
  4185. @table @option
  4186. @item I, i
  4187. Set integrated loudness target.
  4188. Range is -70.0 - -5.0. Default value is -24.0.
  4189. @item LRA, lra
  4190. Set loudness range target.
  4191. Range is 1.0 - 50.0. Default value is 7.0.
  4192. @item TP, tp
  4193. Set maximum true peak.
  4194. Range is -9.0 - +0.0. Default value is -2.0.
  4195. @item measured_I, measured_i
  4196. Measured IL of input file.
  4197. Range is -99.0 - +0.0.
  4198. @item measured_LRA, measured_lra
  4199. Measured LRA of input file.
  4200. Range is 0.0 - 99.0.
  4201. @item measured_TP, measured_tp
  4202. Measured true peak of input file.
  4203. Range is -99.0 - +99.0.
  4204. @item measured_thresh
  4205. Measured threshold of input file.
  4206. Range is -99.0 - +0.0.
  4207. @item offset
  4208. Set offset gain. Gain is applied before the true-peak limiter.
  4209. Range is -99.0 - +99.0. Default is +0.0.
  4210. @item linear
  4211. Normalize by linearly scaling the source audio.
  4212. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4213. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4214. be lower than source LRA and the change in integrated loudness shouldn't
  4215. result in a true peak which exceeds the target TP. If any of these
  4216. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4217. Options are @code{true} or @code{false}. Default is @code{true}.
  4218. @item dual_mono
  4219. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4220. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4221. If set to @code{true}, this option will compensate for this effect.
  4222. Multi-channel input files are not affected by this option.
  4223. Options are true or false. Default is false.
  4224. @item print_format
  4225. Set print format for stats. Options are summary, json, or none.
  4226. Default value is none.
  4227. @end table
  4228. @section lowpass
  4229. Apply a low-pass filter with 3dB point frequency.
  4230. The filter can be either single-pole or double-pole (the default).
  4231. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4232. The filter accepts the following options:
  4233. @table @option
  4234. @item frequency, f
  4235. Set frequency in Hz. Default is 500.
  4236. @item poles, p
  4237. Set number of poles. Default is 2.
  4238. @item width_type, t
  4239. Set method to specify band-width of filter.
  4240. @table @option
  4241. @item h
  4242. Hz
  4243. @item q
  4244. Q-Factor
  4245. @item o
  4246. octave
  4247. @item s
  4248. slope
  4249. @item k
  4250. kHz
  4251. @end table
  4252. @item width, w
  4253. Specify the band-width of a filter in width_type units.
  4254. Applies only to double-pole filter.
  4255. The default is 0.707q and gives a Butterworth response.
  4256. @item mix, m
  4257. How much to use filtered signal in output. Default is 1.
  4258. Range is between 0 and 1.
  4259. @item channels, c
  4260. Specify which channels to filter, by default all available are filtered.
  4261. @item normalize, n
  4262. Normalize biquad coefficients, by default is disabled.
  4263. Enabling it will normalize magnitude response at DC to 0dB.
  4264. @item transform, a
  4265. Set transform type of IIR filter.
  4266. @table @option
  4267. @item di
  4268. @item dii
  4269. @item tdi
  4270. @item tdii
  4271. @item latt
  4272. @item svf
  4273. @item zdf
  4274. @end table
  4275. @item precision, r
  4276. Set precison of filtering.
  4277. @table @option
  4278. @item auto
  4279. Pick automatic sample format depending on surround filters.
  4280. @item s16
  4281. Always use signed 16-bit.
  4282. @item s32
  4283. Always use signed 32-bit.
  4284. @item f32
  4285. Always use float 32-bit.
  4286. @item f64
  4287. Always use float 64-bit.
  4288. @end table
  4289. @item block_size, b
  4290. Set block size used for reverse IIR processing. If this value is set to high enough
  4291. value (higher than impulse response length truncated when reaches near zero values) filtering
  4292. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4293. Note that filter delay will be exactly this many samples when set to non-zero value.
  4294. @end table
  4295. @subsection Examples
  4296. @itemize
  4297. @item
  4298. Lowpass only LFE channel, it LFE is not present it does nothing:
  4299. @example
  4300. lowpass=c=LFE
  4301. @end example
  4302. @end itemize
  4303. @subsection Commands
  4304. This filter supports the following commands:
  4305. @table @option
  4306. @item frequency, f
  4307. Change lowpass frequency.
  4308. Syntax for the command is : "@var{frequency}"
  4309. @item width_type, t
  4310. Change lowpass width_type.
  4311. Syntax for the command is : "@var{width_type}"
  4312. @item width, w
  4313. Change lowpass width.
  4314. Syntax for the command is : "@var{width}"
  4315. @item mix, m
  4316. Change lowpass mix.
  4317. Syntax for the command is : "@var{mix}"
  4318. @end table
  4319. @section lv2
  4320. Load a LV2 (LADSPA Version 2) plugin.
  4321. To enable compilation of this filter you need to configure FFmpeg with
  4322. @code{--enable-lv2}.
  4323. @table @option
  4324. @item plugin, p
  4325. Specifies the plugin URI. You may need to escape ':'.
  4326. @item controls, c
  4327. Set the '|' separated list of controls which are zero or more floating point
  4328. values that determine the behavior of the loaded plugin (for example delay,
  4329. threshold or gain).
  4330. If @option{controls} is set to @code{help}, all available controls and
  4331. their valid ranges are printed.
  4332. @item sample_rate, s
  4333. Specify the sample rate, default to 44100. Only used if plugin have
  4334. zero inputs.
  4335. @item nb_samples, n
  4336. Set the number of samples per channel per each output frame, default
  4337. is 1024. Only used if plugin have zero inputs.
  4338. @item duration, d
  4339. Set the minimum duration of the sourced audio. See
  4340. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4341. for the accepted syntax.
  4342. Note that the resulting duration may be greater than the specified duration,
  4343. as the generated audio is always cut at the end of a complete frame.
  4344. If not specified, or the expressed duration is negative, the audio is
  4345. supposed to be generated forever.
  4346. Only used if plugin have zero inputs.
  4347. @end table
  4348. @subsection Examples
  4349. @itemize
  4350. @item
  4351. Apply bass enhancer plugin from Calf:
  4352. @example
  4353. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4354. @end example
  4355. @item
  4356. Apply vinyl plugin from Calf:
  4357. @example
  4358. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4359. @end example
  4360. @item
  4361. Apply bit crusher plugin from ArtyFX:
  4362. @example
  4363. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4364. @end example
  4365. @end itemize
  4366. @subsection Commands
  4367. This filter supports all options that are exported by plugin as commands.
  4368. @section mcompand
  4369. Multiband Compress or expand the audio's dynamic range.
  4370. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4371. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4372. response when absent compander action.
  4373. It accepts the following parameters:
  4374. @table @option
  4375. @item args
  4376. This option syntax is:
  4377. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4378. For explanation of each item refer to compand filter documentation.
  4379. @end table
  4380. @anchor{pan}
  4381. @section pan
  4382. Mix channels with specific gain levels. The filter accepts the output
  4383. channel layout followed by a set of channels definitions.
  4384. This filter is also designed to efficiently remap the channels of an audio
  4385. stream.
  4386. The filter accepts parameters of the form:
  4387. "@var{l}|@var{outdef}|@var{outdef}|..."
  4388. @table @option
  4389. @item l
  4390. output channel layout or number of channels
  4391. @item outdef
  4392. output channel specification, of the form:
  4393. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4394. @item out_name
  4395. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4396. number (c0, c1, etc.)
  4397. @item gain
  4398. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4399. @item in_name
  4400. input channel to use, see out_name for details; it is not possible to mix
  4401. named and numbered input channels
  4402. @end table
  4403. If the `=' in a channel specification is replaced by `<', then the gains for
  4404. that specification will be renormalized so that the total is 1, thus
  4405. avoiding clipping noise.
  4406. @subsection Mixing examples
  4407. For example, if you want to down-mix from stereo to mono, but with a bigger
  4408. factor for the left channel:
  4409. @example
  4410. pan=1c|c0=0.9*c0+0.1*c1
  4411. @end example
  4412. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4413. 7-channels surround:
  4414. @example
  4415. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4416. @end example
  4417. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4418. that should be preferred (see "-ac" option) unless you have very specific
  4419. needs.
  4420. @subsection Remapping examples
  4421. The channel remapping will be effective if, and only if:
  4422. @itemize
  4423. @item gain coefficients are zeroes or ones,
  4424. @item only one input per channel output,
  4425. @end itemize
  4426. If all these conditions are satisfied, the filter will notify the user ("Pure
  4427. channel mapping detected"), and use an optimized and lossless method to do the
  4428. remapping.
  4429. For example, if you have a 5.1 source and want a stereo audio stream by
  4430. dropping the extra channels:
  4431. @example
  4432. pan="stereo| c0=FL | c1=FR"
  4433. @end example
  4434. Given the same source, you can also switch front left and front right channels
  4435. and keep the input channel layout:
  4436. @example
  4437. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4438. @end example
  4439. If the input is a stereo audio stream, you can mute the front left channel (and
  4440. still keep the stereo channel layout) with:
  4441. @example
  4442. pan="stereo|c1=c1"
  4443. @end example
  4444. Still with a stereo audio stream input, you can copy the right channel in both
  4445. front left and right:
  4446. @example
  4447. pan="stereo| c0=FR | c1=FR"
  4448. @end example
  4449. @section replaygain
  4450. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4451. outputs it unchanged.
  4452. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4453. @section resample
  4454. Convert the audio sample format, sample rate and channel layout. It is
  4455. not meant to be used directly.
  4456. @section rubberband
  4457. Apply time-stretching and pitch-shifting with librubberband.
  4458. To enable compilation of this filter, you need to configure FFmpeg with
  4459. @code{--enable-librubberband}.
  4460. The filter accepts the following options:
  4461. @table @option
  4462. @item tempo
  4463. Set tempo scale factor.
  4464. @item pitch
  4465. Set pitch scale factor.
  4466. @item transients
  4467. Set transients detector.
  4468. Possible values are:
  4469. @table @var
  4470. @item crisp
  4471. @item mixed
  4472. @item smooth
  4473. @end table
  4474. @item detector
  4475. Set detector.
  4476. Possible values are:
  4477. @table @var
  4478. @item compound
  4479. @item percussive
  4480. @item soft
  4481. @end table
  4482. @item phase
  4483. Set phase.
  4484. Possible values are:
  4485. @table @var
  4486. @item laminar
  4487. @item independent
  4488. @end table
  4489. @item window
  4490. Set processing window size.
  4491. Possible values are:
  4492. @table @var
  4493. @item standard
  4494. @item short
  4495. @item long
  4496. @end table
  4497. @item smoothing
  4498. Set smoothing.
  4499. Possible values are:
  4500. @table @var
  4501. @item off
  4502. @item on
  4503. @end table
  4504. @item formant
  4505. Enable formant preservation when shift pitching.
  4506. Possible values are:
  4507. @table @var
  4508. @item shifted
  4509. @item preserved
  4510. @end table
  4511. @item pitchq
  4512. Set pitch quality.
  4513. Possible values are:
  4514. @table @var
  4515. @item quality
  4516. @item speed
  4517. @item consistency
  4518. @end table
  4519. @item channels
  4520. Set channels.
  4521. Possible values are:
  4522. @table @var
  4523. @item apart
  4524. @item together
  4525. @end table
  4526. @end table
  4527. @subsection Commands
  4528. This filter supports the following commands:
  4529. @table @option
  4530. @item tempo
  4531. Change filter tempo scale factor.
  4532. Syntax for the command is : "@var{tempo}"
  4533. @item pitch
  4534. Change filter pitch scale factor.
  4535. Syntax for the command is : "@var{pitch}"
  4536. @end table
  4537. @section sidechaincompress
  4538. This filter acts like normal compressor but has the ability to compress
  4539. detected signal using second input signal.
  4540. It needs two input streams and returns one output stream.
  4541. First input stream will be processed depending on second stream signal.
  4542. The filtered signal then can be filtered with other filters in later stages of
  4543. processing. See @ref{pan} and @ref{amerge} filter.
  4544. The filter accepts the following options:
  4545. @table @option
  4546. @item level_in
  4547. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4548. @item mode
  4549. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4550. Default is @code{downward}.
  4551. @item threshold
  4552. If a signal of second stream raises above this level it will affect the gain
  4553. reduction of first stream.
  4554. By default is 0.125. Range is between 0.00097563 and 1.
  4555. @item ratio
  4556. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4557. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4558. Default is 2. Range is between 1 and 20.
  4559. @item attack
  4560. Amount of milliseconds the signal has to rise above the threshold before gain
  4561. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4562. @item release
  4563. Amount of milliseconds the signal has to fall below the threshold before
  4564. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4565. @item makeup
  4566. Set the amount by how much signal will be amplified after processing.
  4567. Default is 1. Range is from 1 to 64.
  4568. @item knee
  4569. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4570. Default is 2.82843. Range is between 1 and 8.
  4571. @item link
  4572. Choose if the @code{average} level between all channels of side-chain stream
  4573. or the louder(@code{maximum}) channel of side-chain stream affects the
  4574. reduction. Default is @code{average}.
  4575. @item detection
  4576. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4577. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4578. @item level_sc
  4579. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4580. @item mix
  4581. How much to use compressed signal in output. Default is 1.
  4582. Range is between 0 and 1.
  4583. @end table
  4584. @subsection Commands
  4585. This filter supports the all above options as @ref{commands}.
  4586. @subsection Examples
  4587. @itemize
  4588. @item
  4589. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4590. depending on the signal of 2nd input and later compressed signal to be
  4591. merged with 2nd input:
  4592. @example
  4593. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4594. @end example
  4595. @end itemize
  4596. @section sidechaingate
  4597. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4598. filter the detected signal before sending it to the gain reduction stage.
  4599. Normally a gate uses the full range signal to detect a level above the
  4600. threshold.
  4601. For example: If you cut all lower frequencies from your sidechain signal
  4602. the gate will decrease the volume of your track only if not enough highs
  4603. appear. With this technique you are able to reduce the resonation of a
  4604. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4605. guitar.
  4606. It needs two input streams and returns one output stream.
  4607. First input stream will be processed depending on second stream signal.
  4608. The filter accepts the following options:
  4609. @table @option
  4610. @item level_in
  4611. Set input level before filtering.
  4612. Default is 1. Allowed range is from 0.015625 to 64.
  4613. @item mode
  4614. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4615. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4616. will be amplified, expanding dynamic range in upward direction.
  4617. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4618. @item range
  4619. Set the level of gain reduction when the signal is below the threshold.
  4620. Default is 0.06125. Allowed range is from 0 to 1.
  4621. Setting this to 0 disables reduction and then filter behaves like expander.
  4622. @item threshold
  4623. If a signal rises above this level the gain reduction is released.
  4624. Default is 0.125. Allowed range is from 0 to 1.
  4625. @item ratio
  4626. Set a ratio about which the signal is reduced.
  4627. Default is 2. Allowed range is from 1 to 9000.
  4628. @item attack
  4629. Amount of milliseconds the signal has to rise above the threshold before gain
  4630. reduction stops.
  4631. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4632. @item release
  4633. Amount of milliseconds the signal has to fall below the threshold before the
  4634. reduction is increased again. Default is 250 milliseconds.
  4635. Allowed range is from 0.01 to 9000.
  4636. @item makeup
  4637. Set amount of amplification of signal after processing.
  4638. Default is 1. Allowed range is from 1 to 64.
  4639. @item knee
  4640. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4641. Default is 2.828427125. Allowed range is from 1 to 8.
  4642. @item detection
  4643. Choose if exact signal should be taken for detection or an RMS like one.
  4644. Default is rms. Can be peak or rms.
  4645. @item link
  4646. Choose if the average level between all channels or the louder channel affects
  4647. the reduction.
  4648. Default is average. Can be average or maximum.
  4649. @item level_sc
  4650. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4651. @end table
  4652. @subsection Commands
  4653. This filter supports the all above options as @ref{commands}.
  4654. @section silencedetect
  4655. Detect silence in an audio stream.
  4656. This filter logs a message when it detects that the input audio volume is less
  4657. or equal to a noise tolerance value for a duration greater or equal to the
  4658. minimum detected noise duration.
  4659. The printed times and duration are expressed in seconds. The
  4660. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4661. is set on the first frame whose timestamp equals or exceeds the detection
  4662. duration and it contains the timestamp of the first frame of the silence.
  4663. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4664. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4665. keys are set on the first frame after the silence. If @option{mono} is
  4666. enabled, and each channel is evaluated separately, the @code{.X}
  4667. suffixed keys are used, and @code{X} corresponds to the channel number.
  4668. The filter accepts the following options:
  4669. @table @option
  4670. @item noise, n
  4671. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4672. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4673. @item duration, d
  4674. Set silence duration until notification (default is 2 seconds). See
  4675. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4676. for the accepted syntax.
  4677. @item mono, m
  4678. Process each channel separately, instead of combined. By default is disabled.
  4679. @end table
  4680. @subsection Examples
  4681. @itemize
  4682. @item
  4683. Detect 5 seconds of silence with -50dB noise tolerance:
  4684. @example
  4685. silencedetect=n=-50dB:d=5
  4686. @end example
  4687. @item
  4688. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4689. tolerance in @file{silence.mp3}:
  4690. @example
  4691. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4692. @end example
  4693. @end itemize
  4694. @section silenceremove
  4695. Remove silence from the beginning, middle or end of the audio.
  4696. The filter accepts the following options:
  4697. @table @option
  4698. @item start_periods
  4699. This value is used to indicate if audio should be trimmed at beginning of
  4700. the audio. A value of zero indicates no silence should be trimmed from the
  4701. beginning. When specifying a non-zero value, it trims audio up until it
  4702. finds non-silence. Normally, when trimming silence from beginning of audio
  4703. the @var{start_periods} will be @code{1} but it can be increased to higher
  4704. values to trim all audio up to specific count of non-silence periods.
  4705. Default value is @code{0}.
  4706. @item start_duration
  4707. Specify the amount of time that non-silence must be detected before it stops
  4708. trimming audio. By increasing the duration, bursts of noises can be treated
  4709. as silence and trimmed off. Default value is @code{0}.
  4710. @item start_threshold
  4711. This indicates what sample value should be treated as silence. For digital
  4712. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4713. you may wish to increase the value to account for background noise.
  4714. Can be specified in dB (in case "dB" is appended to the specified value)
  4715. or amplitude ratio. Default value is @code{0}.
  4716. @item start_silence
  4717. Specify max duration of silence at beginning that will be kept after
  4718. trimming. Default is 0, which is equal to trimming all samples detected
  4719. as silence.
  4720. @item start_mode
  4721. Specify mode of detection of silence end in start of multi-channel audio.
  4722. Can be @var{any} or @var{all}. Default is @var{any}.
  4723. With @var{any}, any sample that is detected as non-silence will cause
  4724. stopped trimming of silence.
  4725. With @var{all}, only if all channels are detected as non-silence will cause
  4726. stopped trimming of silence.
  4727. @item stop_periods
  4728. Set the count for trimming silence from the end of audio.
  4729. To remove silence from the middle of a file, specify a @var{stop_periods}
  4730. that is negative. This value is then treated as a positive value and is
  4731. used to indicate the effect should restart processing as specified by
  4732. @var{start_periods}, making it suitable for removing periods of silence
  4733. in the middle of the audio.
  4734. Default value is @code{0}.
  4735. @item stop_duration
  4736. Specify a duration of silence that must exist before audio is not copied any
  4737. more. By specifying a higher duration, silence that is wanted can be left in
  4738. the audio.
  4739. Default value is @code{0}.
  4740. @item stop_threshold
  4741. This is the same as @option{start_threshold} but for trimming silence from
  4742. the end of audio.
  4743. Can be specified in dB (in case "dB" is appended to the specified value)
  4744. or amplitude ratio. Default value is @code{0}.
  4745. @item stop_silence
  4746. Specify max duration of silence at end that will be kept after
  4747. trimming. Default is 0, which is equal to trimming all samples detected
  4748. as silence.
  4749. @item stop_mode
  4750. Specify mode of detection of silence start in end of multi-channel audio.
  4751. Can be @var{any} or @var{all}. Default is @var{any}.
  4752. With @var{any}, any sample that is detected as non-silence will cause
  4753. stopped trimming of silence.
  4754. With @var{all}, only if all channels are detected as non-silence will cause
  4755. stopped trimming of silence.
  4756. @item detection
  4757. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4758. and works better with digital silence which is exactly 0.
  4759. Default value is @code{rms}.
  4760. @item window
  4761. Set duration in number of seconds used to calculate size of window in number
  4762. of samples for detecting silence.
  4763. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4764. @end table
  4765. @subsection Examples
  4766. @itemize
  4767. @item
  4768. The following example shows how this filter can be used to start a recording
  4769. that does not contain the delay at the start which usually occurs between
  4770. pressing the record button and the start of the performance:
  4771. @example
  4772. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4773. @end example
  4774. @item
  4775. Trim all silence encountered from beginning to end where there is more than 1
  4776. second of silence in audio:
  4777. @example
  4778. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4779. @end example
  4780. @item
  4781. Trim all digital silence samples, using peak detection, from beginning to end
  4782. where there is more than 0 samples of digital silence in audio and digital
  4783. silence is detected in all channels at same positions in stream:
  4784. @example
  4785. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4786. @end example
  4787. @end itemize
  4788. @section sofalizer
  4789. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4790. loudspeakers around the user for binaural listening via headphones (audio
  4791. formats up to 9 channels supported).
  4792. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4793. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4794. Austrian Academy of Sciences.
  4795. To enable compilation of this filter you need to configure FFmpeg with
  4796. @code{--enable-libmysofa}.
  4797. The filter accepts the following options:
  4798. @table @option
  4799. @item sofa
  4800. Set the SOFA file used for rendering.
  4801. @item gain
  4802. Set gain applied to audio. Value is in dB. Default is 0.
  4803. @item rotation
  4804. Set rotation of virtual loudspeakers in deg. Default is 0.
  4805. @item elevation
  4806. Set elevation of virtual speakers in deg. Default is 0.
  4807. @item radius
  4808. Set distance in meters between loudspeakers and the listener with near-field
  4809. HRTFs. Default is 1.
  4810. @item type
  4811. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4812. processing audio in time domain which is slow.
  4813. @var{freq} is processing audio in frequency domain which is fast.
  4814. Default is @var{freq}.
  4815. @item speakers
  4816. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4817. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4818. Each virtual loudspeaker is described with short channel name following with
  4819. azimuth and elevation in degrees.
  4820. Each virtual loudspeaker description is separated by '|'.
  4821. For example to override front left and front right channel positions use:
  4822. 'speakers=FL 45 15|FR 345 15'.
  4823. Descriptions with unrecognised channel names are ignored.
  4824. @item lfegain
  4825. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4826. @item framesize
  4827. Set custom frame size in number of samples. Default is 1024.
  4828. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4829. is set to @var{freq}.
  4830. @item normalize
  4831. Should all IRs be normalized upon importing SOFA file.
  4832. By default is enabled.
  4833. @item interpolate
  4834. Should nearest IRs be interpolated with neighbor IRs if exact position
  4835. does not match. By default is disabled.
  4836. @item minphase
  4837. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4838. @item anglestep
  4839. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4840. @item radstep
  4841. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4842. @end table
  4843. @subsection Examples
  4844. @itemize
  4845. @item
  4846. Using ClubFritz6 sofa file:
  4847. @example
  4848. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4849. @end example
  4850. @item
  4851. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4852. @example
  4853. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4854. @end example
  4855. @item
  4856. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4857. and also with custom gain:
  4858. @example
  4859. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4860. @end example
  4861. @end itemize
  4862. @section speechnorm
  4863. Speech Normalizer.
  4864. This filter expands or compresses each half-cycle of audio samples
  4865. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4866. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4867. The filter accepts the following options:
  4868. @table @option
  4869. @item peak, p
  4870. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4871. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4872. @item expansion, e
  4873. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4874. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4875. would be such that local peak value reaches target peak value but never to surpass it and that
  4876. ratio between new and previous peak value does not surpass this option value.
  4877. @item compression, c
  4878. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4879. This option controls maximum local half-cycle of samples compression. This option is used
  4880. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4881. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4882. that peak's half-cycle will be compressed by current compression factor.
  4883. @item threshold, t
  4884. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4885. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4886. Any half-cycle samples with their local peak value below or same as this option value will be
  4887. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4888. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4889. @item raise, r
  4890. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4891. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4892. each new half-cycle until it reaches @option{expansion} value.
  4893. Setting this options too high may lead to distortions.
  4894. @item fall, f
  4895. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4896. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4897. each new half-cycle until it reaches @option{compression} value.
  4898. @item channels, h
  4899. Specify which channels to filter, by default all available channels are filtered.
  4900. @item invert, i
  4901. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4902. option. When enabled any half-cycle of samples with their local peak value below or same as
  4903. @option{threshold} option will be expanded otherwise it will be compressed.
  4904. @item link, l
  4905. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4906. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4907. is enabled the minimum of all possible gains for each filtered channel is used.
  4908. @end table
  4909. @subsection Commands
  4910. This filter supports the all above options as @ref{commands}.
  4911. @section stereotools
  4912. This filter has some handy utilities to manage stereo signals, for converting
  4913. M/S stereo recordings to L/R signal while having control over the parameters
  4914. or spreading the stereo image of master track.
  4915. The filter accepts the following options:
  4916. @table @option
  4917. @item level_in
  4918. Set input level before filtering for both channels. Defaults is 1.
  4919. Allowed range is from 0.015625 to 64.
  4920. @item level_out
  4921. Set output level after filtering for both channels. Defaults is 1.
  4922. Allowed range is from 0.015625 to 64.
  4923. @item balance_in
  4924. Set input balance between both channels. Default is 0.
  4925. Allowed range is from -1 to 1.
  4926. @item balance_out
  4927. Set output balance between both channels. Default is 0.
  4928. Allowed range is from -1 to 1.
  4929. @item softclip
  4930. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4931. clipping. Disabled by default.
  4932. @item mutel
  4933. Mute the left channel. Disabled by default.
  4934. @item muter
  4935. Mute the right channel. Disabled by default.
  4936. @item phasel
  4937. Change the phase of the left channel. Disabled by default.
  4938. @item phaser
  4939. Change the phase of the right channel. Disabled by default.
  4940. @item mode
  4941. Set stereo mode. Available values are:
  4942. @table @samp
  4943. @item lr>lr
  4944. Left/Right to Left/Right, this is default.
  4945. @item lr>ms
  4946. Left/Right to Mid/Side.
  4947. @item ms>lr
  4948. Mid/Side to Left/Right.
  4949. @item lr>ll
  4950. Left/Right to Left/Left.
  4951. @item lr>rr
  4952. Left/Right to Right/Right.
  4953. @item lr>l+r
  4954. Left/Right to Left + Right.
  4955. @item lr>rl
  4956. Left/Right to Right/Left.
  4957. @item ms>ll
  4958. Mid/Side to Left/Left.
  4959. @item ms>rr
  4960. Mid/Side to Right/Right.
  4961. @item ms>rl
  4962. Mid/Side to Right/Left.
  4963. @item lr>l-r
  4964. Left/Right to Left - Right.
  4965. @end table
  4966. @item slev
  4967. Set level of side signal. Default is 1.
  4968. Allowed range is from 0.015625 to 64.
  4969. @item sbal
  4970. Set balance of side signal. Default is 0.
  4971. Allowed range is from -1 to 1.
  4972. @item mlev
  4973. Set level of the middle signal. Default is 1.
  4974. Allowed range is from 0.015625 to 64.
  4975. @item mpan
  4976. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4977. @item base
  4978. Set stereo base between mono and inversed channels. Default is 0.
  4979. Allowed range is from -1 to 1.
  4980. @item delay
  4981. Set delay in milliseconds how much to delay left from right channel and
  4982. vice versa. Default is 0. Allowed range is from -20 to 20.
  4983. @item sclevel
  4984. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4985. @item phase
  4986. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4987. @item bmode_in, bmode_out
  4988. Set balance mode for balance_in/balance_out option.
  4989. Can be one of the following:
  4990. @table @samp
  4991. @item balance
  4992. Classic balance mode. Attenuate one channel at time.
  4993. Gain is raised up to 1.
  4994. @item amplitude
  4995. Similar as classic mode above but gain is raised up to 2.
  4996. @item power
  4997. Equal power distribution, from -6dB to +6dB range.
  4998. @end table
  4999. @end table
  5000. @subsection Commands
  5001. This filter supports the all above options as @ref{commands}.
  5002. @subsection Examples
  5003. @itemize
  5004. @item
  5005. Apply karaoke like effect:
  5006. @example
  5007. stereotools=mlev=0.015625
  5008. @end example
  5009. @item
  5010. Convert M/S signal to L/R:
  5011. @example
  5012. "stereotools=mode=ms>lr"
  5013. @end example
  5014. @end itemize
  5015. @section stereowiden
  5016. This filter enhance the stereo effect by suppressing signal common to both
  5017. channels and by delaying the signal of left into right and vice versa,
  5018. thereby widening the stereo effect.
  5019. The filter accepts the following options:
  5020. @table @option
  5021. @item delay
  5022. Time in milliseconds of the delay of left signal into right and vice versa.
  5023. Default is 20 milliseconds.
  5024. @item feedback
  5025. Amount of gain in delayed signal into right and vice versa. Gives a delay
  5026. effect of left signal in right output and vice versa which gives widening
  5027. effect. Default is 0.3.
  5028. @item crossfeed
  5029. Cross feed of left into right with inverted phase. This helps in suppressing
  5030. the mono. If the value is 1 it will cancel all the signal common to both
  5031. channels. Default is 0.3.
  5032. @item drymix
  5033. Set level of input signal of original channel. Default is 0.8.
  5034. @end table
  5035. @subsection Commands
  5036. This filter supports the all above options except @code{delay} as @ref{commands}.
  5037. @section superequalizer
  5038. Apply 18 band equalizer.
  5039. The filter accepts the following options:
  5040. @table @option
  5041. @item 1b
  5042. Set 65Hz band gain.
  5043. @item 2b
  5044. Set 92Hz band gain.
  5045. @item 3b
  5046. Set 131Hz band gain.
  5047. @item 4b
  5048. Set 185Hz band gain.
  5049. @item 5b
  5050. Set 262Hz band gain.
  5051. @item 6b
  5052. Set 370Hz band gain.
  5053. @item 7b
  5054. Set 523Hz band gain.
  5055. @item 8b
  5056. Set 740Hz band gain.
  5057. @item 9b
  5058. Set 1047Hz band gain.
  5059. @item 10b
  5060. Set 1480Hz band gain.
  5061. @item 11b
  5062. Set 2093Hz band gain.
  5063. @item 12b
  5064. Set 2960Hz band gain.
  5065. @item 13b
  5066. Set 4186Hz band gain.
  5067. @item 14b
  5068. Set 5920Hz band gain.
  5069. @item 15b
  5070. Set 8372Hz band gain.
  5071. @item 16b
  5072. Set 11840Hz band gain.
  5073. @item 17b
  5074. Set 16744Hz band gain.
  5075. @item 18b
  5076. Set 20000Hz band gain.
  5077. @end table
  5078. @section surround
  5079. Apply audio surround upmix filter.
  5080. This filter allows to produce multichannel output from audio stream.
  5081. The filter accepts the following options:
  5082. @table @option
  5083. @item chl_out
  5084. Set output channel layout. By default, this is @var{5.1}.
  5085. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5086. for the required syntax.
  5087. @item chl_in
  5088. Set input channel layout. By default, this is @var{stereo}.
  5089. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5090. for the required syntax.
  5091. @item level_in
  5092. Set input volume level. By default, this is @var{1}.
  5093. @item level_out
  5094. Set output volume level. By default, this is @var{1}.
  5095. @item lfe
  5096. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5097. @item lfe_low
  5098. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5099. @item lfe_high
  5100. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5101. @item lfe_mode
  5102. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5103. In @var{add} mode, LFE channel is created from input audio and added to output.
  5104. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5105. also all non-LFE output channels are subtracted with output LFE channel.
  5106. @item angle
  5107. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5108. Default is @var{90}.
  5109. @item fc_in
  5110. Set front center input volume. By default, this is @var{1}.
  5111. @item fc_out
  5112. Set front center output volume. By default, this is @var{1}.
  5113. @item fl_in
  5114. Set front left input volume. By default, this is @var{1}.
  5115. @item fl_out
  5116. Set front left output volume. By default, this is @var{1}.
  5117. @item fr_in
  5118. Set front right input volume. By default, this is @var{1}.
  5119. @item fr_out
  5120. Set front right output volume. By default, this is @var{1}.
  5121. @item sl_in
  5122. Set side left input volume. By default, this is @var{1}.
  5123. @item sl_out
  5124. Set side left output volume. By default, this is @var{1}.
  5125. @item sr_in
  5126. Set side right input volume. By default, this is @var{1}.
  5127. @item sr_out
  5128. Set side right output volume. By default, this is @var{1}.
  5129. @item bl_in
  5130. Set back left input volume. By default, this is @var{1}.
  5131. @item bl_out
  5132. Set back left output volume. By default, this is @var{1}.
  5133. @item br_in
  5134. Set back right input volume. By default, this is @var{1}.
  5135. @item br_out
  5136. Set back right output volume. By default, this is @var{1}.
  5137. @item bc_in
  5138. Set back center input volume. By default, this is @var{1}.
  5139. @item bc_out
  5140. Set back center output volume. By default, this is @var{1}.
  5141. @item lfe_in
  5142. Set LFE input volume. By default, this is @var{1}.
  5143. @item lfe_out
  5144. Set LFE output volume. By default, this is @var{1}.
  5145. @item allx
  5146. Set spread usage of stereo image across X axis for all channels.
  5147. Allowed range is from @var{-1} to @var{15}.
  5148. By default this value is negative @var{-1}, and thus unused.
  5149. @item ally
  5150. Set spread usage of stereo image across Y axis for all channels.
  5151. Allowed range is from @var{-1} to @var{15}.
  5152. By default this value is negative @var{-1}, and thus unused.
  5153. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5154. Set spread usage of stereo image across X axis for each channel.
  5155. Allowed range is from @var{0.06} to @var{15}.
  5156. By default this value is @var{0.5}.
  5157. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5158. Set spread usage of stereo image across Y axis for each channel.
  5159. Allowed range is from @var{0.06} to @var{15}.
  5160. By default this value is @var{0.5}.
  5161. @item win_size
  5162. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5163. @item win_func
  5164. Set window function.
  5165. It accepts the following values:
  5166. @table @samp
  5167. @item rect
  5168. @item bartlett
  5169. @item hann, hanning
  5170. @item hamming
  5171. @item blackman
  5172. @item welch
  5173. @item flattop
  5174. @item bharris
  5175. @item bnuttall
  5176. @item bhann
  5177. @item sine
  5178. @item nuttall
  5179. @item lanczos
  5180. @item gauss
  5181. @item tukey
  5182. @item dolph
  5183. @item cauchy
  5184. @item parzen
  5185. @item poisson
  5186. @item bohman
  5187. @end table
  5188. Default is @code{hann}.
  5189. @item overlap
  5190. Set window overlap. If set to 1, the recommended overlap for selected
  5191. window function will be picked. Default is @code{0.5}.
  5192. @end table
  5193. @section tiltshelf
  5194. Boost or cut the lower frequencies and cut or boost higher frequencies
  5195. of the audio using a two-pole shelving filter with a response similar to
  5196. that of a standard hi-fi's tone-controls.
  5197. This is also known as shelving equalisation (EQ).
  5198. The filter accepts the following options:
  5199. @table @option
  5200. @item gain, g
  5201. Give the gain at 0 Hz. Its useful range is about -20
  5202. (for a large cut) to +20 (for a large boost).
  5203. Beware of clipping when using a positive gain.
  5204. @item frequency, f
  5205. Set the filter's central frequency and so can be used
  5206. to extend or reduce the frequency range to be boosted or cut.
  5207. The default value is @code{3000} Hz.
  5208. @item width_type, t
  5209. Set method to specify band-width of filter.
  5210. @table @option
  5211. @item h
  5212. Hz
  5213. @item q
  5214. Q-Factor
  5215. @item o
  5216. octave
  5217. @item s
  5218. slope
  5219. @item k
  5220. kHz
  5221. @end table
  5222. @item width, w
  5223. Determine how steep is the filter's shelf transition.
  5224. @item poles, p
  5225. Set number of poles. Default is 2.
  5226. @item mix, m
  5227. How much to use filtered signal in output. Default is 1.
  5228. Range is between 0 and 1.
  5229. @item channels, c
  5230. Specify which channels to filter, by default all available are filtered.
  5231. @item normalize, n
  5232. Normalize biquad coefficients, by default is disabled.
  5233. Enabling it will normalize magnitude response at DC to 0dB.
  5234. @item transform, a
  5235. Set transform type of IIR filter.
  5236. @table @option
  5237. @item di
  5238. @item dii
  5239. @item tdi
  5240. @item tdii
  5241. @item latt
  5242. @item svf
  5243. @item zdf
  5244. @end table
  5245. @item precision, r
  5246. Set precison of filtering.
  5247. @table @option
  5248. @item auto
  5249. Pick automatic sample format depending on surround filters.
  5250. @item s16
  5251. Always use signed 16-bit.
  5252. @item s32
  5253. Always use signed 32-bit.
  5254. @item f32
  5255. Always use float 32-bit.
  5256. @item f64
  5257. Always use float 64-bit.
  5258. @end table
  5259. @item block_size, b
  5260. Set block size used for reverse IIR processing. If this value is set to high enough
  5261. value (higher than impulse response length truncated when reaches near zero values) filtering
  5262. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5263. Note that filter delay will be exactly this many samples when set to non-zero value.
  5264. @end table
  5265. @subsection Commands
  5266. This filter supports some options as @ref{commands}.
  5267. @section treble, highshelf
  5268. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5269. shelving filter with a response similar to that of a standard
  5270. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5271. The filter accepts the following options:
  5272. @table @option
  5273. @item gain, g
  5274. Give the gain at whichever is the lower of ~22 kHz and the
  5275. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5276. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5277. @item frequency, f
  5278. Set the filter's central frequency and so can be used
  5279. to extend or reduce the frequency range to be boosted or cut.
  5280. The default value is @code{3000} Hz.
  5281. @item width_type, t
  5282. Set method to specify band-width of filter.
  5283. @table @option
  5284. @item h
  5285. Hz
  5286. @item q
  5287. Q-Factor
  5288. @item o
  5289. octave
  5290. @item s
  5291. slope
  5292. @item k
  5293. kHz
  5294. @end table
  5295. @item width, w
  5296. Determine how steep is the filter's shelf transition.
  5297. @item poles, p
  5298. Set number of poles. Default is 2.
  5299. @item mix, m
  5300. How much to use filtered signal in output. Default is 1.
  5301. Range is between 0 and 1.
  5302. @item channels, c
  5303. Specify which channels to filter, by default all available are filtered.
  5304. @item normalize, n
  5305. Normalize biquad coefficients, by default is disabled.
  5306. Enabling it will normalize magnitude response at DC to 0dB.
  5307. @item transform, a
  5308. Set transform type of IIR filter.
  5309. @table @option
  5310. @item di
  5311. @item dii
  5312. @item tdi
  5313. @item tdii
  5314. @item latt
  5315. @item svf
  5316. @item zdf
  5317. @end table
  5318. @item precision, r
  5319. Set precison of filtering.
  5320. @table @option
  5321. @item auto
  5322. Pick automatic sample format depending on surround filters.
  5323. @item s16
  5324. Always use signed 16-bit.
  5325. @item s32
  5326. Always use signed 32-bit.
  5327. @item f32
  5328. Always use float 32-bit.
  5329. @item f64
  5330. Always use float 64-bit.
  5331. @end table
  5332. @item block_size, b
  5333. Set block size used for reverse IIR processing. If this value is set to high enough
  5334. value (higher than impulse response length truncated when reaches near zero values) filtering
  5335. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5336. Note that filter delay will be exactly this many samples when set to non-zero value.
  5337. @end table
  5338. @subsection Commands
  5339. This filter supports the following commands:
  5340. @table @option
  5341. @item frequency, f
  5342. Change treble frequency.
  5343. Syntax for the command is : "@var{frequency}"
  5344. @item width_type, t
  5345. Change treble width_type.
  5346. Syntax for the command is : "@var{width_type}"
  5347. @item width, w
  5348. Change treble width.
  5349. Syntax for the command is : "@var{width}"
  5350. @item gain, g
  5351. Change treble gain.
  5352. Syntax for the command is : "@var{gain}"
  5353. @item mix, m
  5354. Change treble mix.
  5355. Syntax for the command is : "@var{mix}"
  5356. @end table
  5357. @section tremolo
  5358. Sinusoidal amplitude modulation.
  5359. The filter accepts the following options:
  5360. @table @option
  5361. @item f
  5362. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5363. (20 Hz or lower) will result in a tremolo effect.
  5364. This filter may also be used as a ring modulator by specifying
  5365. a modulation frequency higher than 20 Hz.
  5366. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5367. @item d
  5368. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5369. Default value is 0.5.
  5370. @end table
  5371. @section vibrato
  5372. Sinusoidal phase modulation.
  5373. The filter accepts the following options:
  5374. @table @option
  5375. @item f
  5376. Modulation frequency in Hertz.
  5377. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5378. @item d
  5379. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5380. Default value is 0.5.
  5381. @end table
  5382. @section virtualbass
  5383. Apply audio Virtual Bass filter.
  5384. This filter accepts stereo input and produce stereo with LFE (2.1) channels output.
  5385. The newly produced LFE channel have enhanced virtual bass originally obtained from both stereo channels.
  5386. This filter outputs front left and front right channels unchanged as available in stereo input.
  5387. The filter accepts the following options:
  5388. @table @option
  5389. @item cutoff
  5390. Set the virtual bass cutoff frequency. Default value is 250 Hz.
  5391. Allowed range is from 100 to 500 Hz.
  5392. @item strength
  5393. Set the virtual bass strength. Allowed range is from 0.5 to 3.
  5394. Default value is 3.
  5395. @end table
  5396. @section volume
  5397. Adjust the input audio volume.
  5398. It accepts the following parameters:
  5399. @table @option
  5400. @item volume
  5401. Set audio volume expression.
  5402. Output values are clipped to the maximum value.
  5403. The output audio volume is given by the relation:
  5404. @example
  5405. @var{output_volume} = @var{volume} * @var{input_volume}
  5406. @end example
  5407. The default value for @var{volume} is "1.0".
  5408. @item precision
  5409. This parameter represents the mathematical precision.
  5410. It determines which input sample formats will be allowed, which affects the
  5411. precision of the volume scaling.
  5412. @table @option
  5413. @item fixed
  5414. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5415. @item float
  5416. 32-bit floating-point; this limits input sample format to FLT. (default)
  5417. @item double
  5418. 64-bit floating-point; this limits input sample format to DBL.
  5419. @end table
  5420. @item replaygain
  5421. Choose the behaviour on encountering ReplayGain side data in input frames.
  5422. @table @option
  5423. @item drop
  5424. Remove ReplayGain side data, ignoring its contents (the default).
  5425. @item ignore
  5426. Ignore ReplayGain side data, but leave it in the frame.
  5427. @item track
  5428. Prefer the track gain, if present.
  5429. @item album
  5430. Prefer the album gain, if present.
  5431. @end table
  5432. @item replaygain_preamp
  5433. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5434. Default value for @var{replaygain_preamp} is 0.0.
  5435. @item replaygain_noclip
  5436. Prevent clipping by limiting the gain applied.
  5437. Default value for @var{replaygain_noclip} is 1.
  5438. @item eval
  5439. Set when the volume expression is evaluated.
  5440. It accepts the following values:
  5441. @table @samp
  5442. @item once
  5443. only evaluate expression once during the filter initialization, or
  5444. when the @samp{volume} command is sent
  5445. @item frame
  5446. evaluate expression for each incoming frame
  5447. @end table
  5448. Default value is @samp{once}.
  5449. @end table
  5450. The volume expression can contain the following parameters.
  5451. @table @option
  5452. @item n
  5453. frame number (starting at zero)
  5454. @item nb_channels
  5455. number of channels
  5456. @item nb_consumed_samples
  5457. number of samples consumed by the filter
  5458. @item nb_samples
  5459. number of samples in the current frame
  5460. @item pos
  5461. original frame position in the file
  5462. @item pts
  5463. frame PTS
  5464. @item sample_rate
  5465. sample rate
  5466. @item startpts
  5467. PTS at start of stream
  5468. @item startt
  5469. time at start of stream
  5470. @item t
  5471. frame time
  5472. @item tb
  5473. timestamp timebase
  5474. @item volume
  5475. last set volume value
  5476. @end table
  5477. Note that when @option{eval} is set to @samp{once} only the
  5478. @var{sample_rate} and @var{tb} variables are available, all other
  5479. variables will evaluate to NAN.
  5480. @subsection Commands
  5481. This filter supports the following commands:
  5482. @table @option
  5483. @item volume
  5484. Modify the volume expression.
  5485. The command accepts the same syntax of the corresponding option.
  5486. If the specified expression is not valid, it is kept at its current
  5487. value.
  5488. @end table
  5489. @subsection Examples
  5490. @itemize
  5491. @item
  5492. Halve the input audio volume:
  5493. @example
  5494. volume=volume=0.5
  5495. volume=volume=1/2
  5496. volume=volume=-6.0206dB
  5497. @end example
  5498. In all the above example the named key for @option{volume} can be
  5499. omitted, for example like in:
  5500. @example
  5501. volume=0.5
  5502. @end example
  5503. @item
  5504. Increase input audio power by 6 decibels using fixed-point precision:
  5505. @example
  5506. volume=volume=6dB:precision=fixed
  5507. @end example
  5508. @item
  5509. Fade volume after time 10 with an annihilation period of 5 seconds:
  5510. @example
  5511. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5512. @end example
  5513. @end itemize
  5514. @section volumedetect
  5515. Detect the volume of the input video.
  5516. The filter has no parameters. It supports only 16-bit signed integer samples,
  5517. so the input will be converted when needed. Statistics about the volume will
  5518. be printed in the log when the input stream end is reached.
  5519. In particular it will show the mean volume (root mean square), maximum
  5520. volume (on a per-sample basis), and the beginning of a histogram of the
  5521. registered volume values (from the maximum value to a cumulated 1/1000 of
  5522. the samples).
  5523. All volumes are in decibels relative to the maximum PCM value.
  5524. @subsection Examples
  5525. Here is an excerpt of the output:
  5526. @example
  5527. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5528. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5529. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5530. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5531. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5532. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5533. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5534. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5535. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5536. @end example
  5537. It means that:
  5538. @itemize
  5539. @item
  5540. The mean square energy is approximately -27 dB, or 10^-2.7.
  5541. @item
  5542. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5543. @item
  5544. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5545. @end itemize
  5546. In other words, raising the volume by +4 dB does not cause any clipping,
  5547. raising it by +5 dB causes clipping for 6 samples, etc.
  5548. @c man end AUDIO FILTERS
  5549. @chapter Audio Sources
  5550. @c man begin AUDIO SOURCES
  5551. Below is a description of the currently available audio sources.
  5552. @section abuffer
  5553. Buffer audio frames, and make them available to the filter chain.
  5554. This source is mainly intended for a programmatic use, in particular
  5555. through the interface defined in @file{libavfilter/buffersrc.h}.
  5556. It accepts the following parameters:
  5557. @table @option
  5558. @item time_base
  5559. The timebase which will be used for timestamps of submitted frames. It must be
  5560. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5561. @item sample_rate
  5562. The sample rate of the incoming audio buffers.
  5563. @item sample_fmt
  5564. The sample format of the incoming audio buffers.
  5565. Either a sample format name or its corresponding integer representation from
  5566. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5567. @item channel_layout
  5568. The channel layout of the incoming audio buffers.
  5569. Either a channel layout name from channel_layout_map in
  5570. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5571. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5572. @item channels
  5573. The number of channels of the incoming audio buffers.
  5574. If both @var{channels} and @var{channel_layout} are specified, then they
  5575. must be consistent.
  5576. @end table
  5577. @subsection Examples
  5578. @example
  5579. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  5580. @end example
  5581. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  5582. Since the sample format with name "s16p" corresponds to the number
  5583. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  5584. equivalent to:
  5585. @example
  5586. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  5587. @end example
  5588. @section aevalsrc
  5589. Generate an audio signal specified by an expression.
  5590. This source accepts in input one or more expressions (one for each
  5591. channel), which are evaluated and used to generate a corresponding
  5592. audio signal.
  5593. This source accepts the following options:
  5594. @table @option
  5595. @item exprs
  5596. Set the '|'-separated expressions list for each separate channel. In case the
  5597. @option{channel_layout} option is not specified, the selected channel layout
  5598. depends on the number of provided expressions. Otherwise the last
  5599. specified expression is applied to the remaining output channels.
  5600. @item channel_layout, c
  5601. Set the channel layout. The number of channels in the specified layout
  5602. must be equal to the number of specified expressions.
  5603. @item duration, d
  5604. Set the minimum duration of the sourced audio. See
  5605. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5606. for the accepted syntax.
  5607. Note that the resulting duration may be greater than the specified
  5608. duration, as the generated audio is always cut at the end of a
  5609. complete frame.
  5610. If not specified, or the expressed duration is negative, the audio is
  5611. supposed to be generated forever.
  5612. @item nb_samples, n
  5613. Set the number of samples per channel per each output frame,
  5614. default to 1024.
  5615. @item sample_rate, s
  5616. Specify the sample rate, default to 44100.
  5617. @end table
  5618. Each expression in @var{exprs} can contain the following constants:
  5619. @table @option
  5620. @item n
  5621. number of the evaluated sample, starting from 0
  5622. @item t
  5623. time of the evaluated sample expressed in seconds, starting from 0
  5624. @item s
  5625. sample rate
  5626. @end table
  5627. @subsection Examples
  5628. @itemize
  5629. @item
  5630. Generate silence:
  5631. @example
  5632. aevalsrc=0
  5633. @end example
  5634. @item
  5635. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5636. 8000 Hz:
  5637. @example
  5638. aevalsrc="sin(440*2*PI*t):s=8000"
  5639. @end example
  5640. @item
  5641. Generate a two channels signal, specify the channel layout (Front
  5642. Center + Back Center) explicitly:
  5643. @example
  5644. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5645. @end example
  5646. @item
  5647. Generate white noise:
  5648. @example
  5649. aevalsrc="-2+random(0)"
  5650. @end example
  5651. @item
  5652. Generate an amplitude modulated signal:
  5653. @example
  5654. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5655. @end example
  5656. @item
  5657. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5658. @example
  5659. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5660. @end example
  5661. @end itemize
  5662. @section afirsrc
  5663. Generate a FIR coefficients using frequency sampling method.
  5664. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5665. The filter accepts the following options:
  5666. @table @option
  5667. @item taps, t
  5668. Set number of filter coefficents in output audio stream.
  5669. Default value is 1025.
  5670. @item frequency, f
  5671. Set frequency points from where magnitude and phase are set.
  5672. This must be in non decreasing order, and first element must be 0, while last element
  5673. must be 1. Elements are separated by white spaces.
  5674. @item magnitude, m
  5675. Set magnitude value for every frequency point set by @option{frequency}.
  5676. Number of values must be same as number of frequency points.
  5677. Values are separated by white spaces.
  5678. @item phase, p
  5679. Set phase value for every frequency point set by @option{frequency}.
  5680. Number of values must be same as number of frequency points.
  5681. Values are separated by white spaces.
  5682. @item sample_rate, r
  5683. Set sample rate, default is 44100.
  5684. @item nb_samples, n
  5685. Set number of samples per each frame. Default is 1024.
  5686. @item win_func, w
  5687. Set window function. Default is blackman.
  5688. @end table
  5689. @section anullsrc
  5690. The null audio source, return unprocessed audio frames. It is mainly useful
  5691. as a template and to be employed in analysis / debugging tools, or as
  5692. the source for filters which ignore the input data (for example the sox
  5693. synth filter).
  5694. This source accepts the following options:
  5695. @table @option
  5696. @item channel_layout, cl
  5697. Specifies the channel layout, and can be either an integer or a string
  5698. representing a channel layout. The default value of @var{channel_layout}
  5699. is "stereo".
  5700. Check the channel_layout_map definition in
  5701. @file{libavutil/channel_layout.c} for the mapping between strings and
  5702. channel layout values.
  5703. @item sample_rate, r
  5704. Specifies the sample rate, and defaults to 44100.
  5705. @item nb_samples, n
  5706. Set the number of samples per requested frames.
  5707. @item duration, d
  5708. Set the duration of the sourced audio. See
  5709. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5710. for the accepted syntax.
  5711. If not specified, or the expressed duration is negative, the audio is
  5712. supposed to be generated forever.
  5713. @end table
  5714. @subsection Examples
  5715. @itemize
  5716. @item
  5717. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5718. @example
  5719. anullsrc=r=48000:cl=4
  5720. @end example
  5721. @item
  5722. Do the same operation with a more obvious syntax:
  5723. @example
  5724. anullsrc=r=48000:cl=mono
  5725. @end example
  5726. @end itemize
  5727. All the parameters need to be explicitly defined.
  5728. @section flite
  5729. Synthesize a voice utterance using the libflite library.
  5730. To enable compilation of this filter you need to configure FFmpeg with
  5731. @code{--enable-libflite}.
  5732. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5733. The filter accepts the following options:
  5734. @table @option
  5735. @item list_voices
  5736. If set to 1, list the names of the available voices and exit
  5737. immediately. Default value is 0.
  5738. @item nb_samples, n
  5739. Set the maximum number of samples per frame. Default value is 512.
  5740. @item textfile
  5741. Set the filename containing the text to speak.
  5742. @item text
  5743. Set the text to speak.
  5744. @item voice, v
  5745. Set the voice to use for the speech synthesis. Default value is
  5746. @code{kal}. See also the @var{list_voices} option.
  5747. @end table
  5748. @subsection Examples
  5749. @itemize
  5750. @item
  5751. Read from file @file{speech.txt}, and synthesize the text using the
  5752. standard flite voice:
  5753. @example
  5754. flite=textfile=speech.txt
  5755. @end example
  5756. @item
  5757. Read the specified text selecting the @code{slt} voice:
  5758. @example
  5759. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5760. @end example
  5761. @item
  5762. Input text to ffmpeg:
  5763. @example
  5764. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5765. @end example
  5766. @item
  5767. Make @file{ffplay} speak the specified text, using @code{flite} and
  5768. the @code{lavfi} device:
  5769. @example
  5770. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5771. @end example
  5772. @end itemize
  5773. For more information about libflite, check:
  5774. @url{http://www.festvox.org/flite/}
  5775. @section anoisesrc
  5776. Generate a noise audio signal.
  5777. The filter accepts the following options:
  5778. @table @option
  5779. @item sample_rate, r
  5780. Specify the sample rate. Default value is 48000 Hz.
  5781. @item amplitude, a
  5782. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5783. is 1.0.
  5784. @item duration, d
  5785. Specify the duration of the generated audio stream. Not specifying this option
  5786. results in noise with an infinite length.
  5787. @item color, colour, c
  5788. Specify the color of noise. Available noise colors are white, pink, brown,
  5789. blue, violet and velvet. Default color is white.
  5790. @item seed, s
  5791. Specify a value used to seed the PRNG.
  5792. @item nb_samples, n
  5793. Set the number of samples per each output frame, default is 1024.
  5794. @end table
  5795. @subsection Examples
  5796. @itemize
  5797. @item
  5798. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5799. @example
  5800. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5801. @end example
  5802. @end itemize
  5803. @section hilbert
  5804. Generate odd-tap Hilbert transform FIR coefficients.
  5805. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5806. the signal by 90 degrees.
  5807. This is used in many matrix coding schemes and for analytic signal generation.
  5808. The process is often written as a multiplication by i (or j), the imaginary unit.
  5809. The filter accepts the following options:
  5810. @table @option
  5811. @item sample_rate, s
  5812. Set sample rate, default is 44100.
  5813. @item taps, t
  5814. Set length of FIR filter, default is 22051.
  5815. @item nb_samples, n
  5816. Set number of samples per each frame.
  5817. @item win_func, w
  5818. Set window function to be used when generating FIR coefficients.
  5819. @end table
  5820. @section sinc
  5821. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5822. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5823. The filter accepts the following options:
  5824. @table @option
  5825. @item sample_rate, r
  5826. Set sample rate, default is 44100.
  5827. @item nb_samples, n
  5828. Set number of samples per each frame. Default is 1024.
  5829. @item hp
  5830. Set high-pass frequency. Default is 0.
  5831. @item lp
  5832. Set low-pass frequency. Default is 0.
  5833. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5834. is higher than 0 then filter will create band-pass filter coefficients,
  5835. otherwise band-reject filter coefficients.
  5836. @item phase
  5837. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5838. @item beta
  5839. Set Kaiser window beta.
  5840. @item att
  5841. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5842. @item round
  5843. Enable rounding, by default is disabled.
  5844. @item hptaps
  5845. Set number of taps for high-pass filter.
  5846. @item lptaps
  5847. Set number of taps for low-pass filter.
  5848. @end table
  5849. @section sine
  5850. Generate an audio signal made of a sine wave with amplitude 1/8.
  5851. The audio signal is bit-exact.
  5852. The filter accepts the following options:
  5853. @table @option
  5854. @item frequency, f
  5855. Set the carrier frequency. Default is 440 Hz.
  5856. @item beep_factor, b
  5857. Enable a periodic beep every second with frequency @var{beep_factor} times
  5858. the carrier frequency. Default is 0, meaning the beep is disabled.
  5859. @item sample_rate, r
  5860. Specify the sample rate, default is 44100.
  5861. @item duration, d
  5862. Specify the duration of the generated audio stream.
  5863. @item samples_per_frame
  5864. Set the number of samples per output frame.
  5865. The expression can contain the following constants:
  5866. @table @option
  5867. @item n
  5868. The (sequential) number of the output audio frame, starting from 0.
  5869. @item pts
  5870. The PTS (Presentation TimeStamp) of the output audio frame,
  5871. expressed in @var{TB} units.
  5872. @item t
  5873. The PTS of the output audio frame, expressed in seconds.
  5874. @item TB
  5875. The timebase of the output audio frames.
  5876. @end table
  5877. Default is @code{1024}.
  5878. @end table
  5879. @subsection Examples
  5880. @itemize
  5881. @item
  5882. Generate a simple 440 Hz sine wave:
  5883. @example
  5884. sine
  5885. @end example
  5886. @item
  5887. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5888. @example
  5889. sine=220:4:d=5
  5890. sine=f=220:b=4:d=5
  5891. sine=frequency=220:beep_factor=4:duration=5
  5892. @end example
  5893. @item
  5894. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5895. pattern:
  5896. @example
  5897. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5898. @end example
  5899. @end itemize
  5900. @c man end AUDIO SOURCES
  5901. @chapter Audio Sinks
  5902. @c man begin AUDIO SINKS
  5903. Below is a description of the currently available audio sinks.
  5904. @section abuffersink
  5905. Buffer audio frames, and make them available to the end of filter chain.
  5906. This sink is mainly intended for programmatic use, in particular
  5907. through the interface defined in @file{libavfilter/buffersink.h}
  5908. or the options system.
  5909. It accepts a pointer to an AVABufferSinkContext structure, which
  5910. defines the incoming buffers' formats, to be passed as the opaque
  5911. parameter to @code{avfilter_init_filter} for initialization.
  5912. @section anullsink
  5913. Null audio sink; do absolutely nothing with the input audio. It is
  5914. mainly useful as a template and for use in analysis / debugging
  5915. tools.
  5916. @c man end AUDIO SINKS
  5917. @chapter Video Filters
  5918. @c man begin VIDEO FILTERS
  5919. When you configure your FFmpeg build, you can disable any of the
  5920. existing filters using @code{--disable-filters}.
  5921. The configure output will show the video filters included in your
  5922. build.
  5923. Below is a description of the currently available video filters.
  5924. @section addroi
  5925. Mark a region of interest in a video frame.
  5926. The frame data is passed through unchanged, but metadata is attached
  5927. to the frame indicating regions of interest which can affect the
  5928. behaviour of later encoding. Multiple regions can be marked by
  5929. applying the filter multiple times.
  5930. @table @option
  5931. @item x
  5932. Region distance in pixels from the left edge of the frame.
  5933. @item y
  5934. Region distance in pixels from the top edge of the frame.
  5935. @item w
  5936. Region width in pixels.
  5937. @item h
  5938. Region height in pixels.
  5939. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5940. and may contain the following variables:
  5941. @table @option
  5942. @item iw
  5943. Width of the input frame.
  5944. @item ih
  5945. Height of the input frame.
  5946. @end table
  5947. @item qoffset
  5948. Quantisation offset to apply within the region.
  5949. This must be a real value in the range -1 to +1. A value of zero
  5950. indicates no quality change. A negative value asks for better quality
  5951. (less quantisation), while a positive value asks for worse quality
  5952. (greater quantisation).
  5953. The range is calibrated so that the extreme values indicate the
  5954. largest possible offset - if the rest of the frame is encoded with the
  5955. worst possible quality, an offset of -1 indicates that this region
  5956. should be encoded with the best possible quality anyway. Intermediate
  5957. values are then interpolated in some codec-dependent way.
  5958. For example, in 10-bit H.264 the quantisation parameter varies between
  5959. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5960. this region should be encoded with a QP around one-tenth of the full
  5961. range better than the rest of the frame. So, if most of the frame
  5962. were to be encoded with a QP of around 30, this region would get a QP
  5963. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5964. An extreme value of -1 would indicate that this region should be
  5965. encoded with the best possible quality regardless of the treatment of
  5966. the rest of the frame - that is, should be encoded at a QP of -12.
  5967. @item clear
  5968. If set to true, remove any existing regions of interest marked on the
  5969. frame before adding the new one.
  5970. @end table
  5971. @subsection Examples
  5972. @itemize
  5973. @item
  5974. Mark the centre quarter of the frame as interesting.
  5975. @example
  5976. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5977. @end example
  5978. @item
  5979. Mark the 100-pixel-wide region on the left edge of the frame as very
  5980. uninteresting (to be encoded at much lower quality than the rest of
  5981. the frame).
  5982. @example
  5983. addroi=0:0:100:ih:+1/5
  5984. @end example
  5985. @end itemize
  5986. @section alphaextract
  5987. Extract the alpha component from the input as a grayscale video. This
  5988. is especially useful with the @var{alphamerge} filter.
  5989. @section alphamerge
  5990. Add or replace the alpha component of the primary input with the
  5991. grayscale value of a second input. This is intended for use with
  5992. @var{alphaextract} to allow the transmission or storage of frame
  5993. sequences that have alpha in a format that doesn't support an alpha
  5994. channel.
  5995. For example, to reconstruct full frames from a normal YUV-encoded video
  5996. and a separate video created with @var{alphaextract}, you might use:
  5997. @example
  5998. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5999. @end example
  6000. @section amplify
  6001. Amplify differences between current pixel and pixels of adjacent frames in
  6002. same pixel location.
  6003. This filter accepts the following options:
  6004. @table @option
  6005. @item radius
  6006. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  6007. For example radius of 3 will instruct filter to calculate average of 7 frames.
  6008. @item factor
  6009. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  6010. @item threshold
  6011. Set threshold for difference amplification. Any difference greater or equal to
  6012. this value will not alter source pixel. Default is 10.
  6013. Allowed range is from 0 to 65535.
  6014. @item tolerance
  6015. Set tolerance for difference amplification. Any difference lower to
  6016. this value will not alter source pixel. Default is 0.
  6017. Allowed range is from 0 to 65535.
  6018. @item low
  6019. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6020. This option controls maximum possible value that will decrease source pixel value.
  6021. @item high
  6022. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6023. This option controls maximum possible value that will increase source pixel value.
  6024. @item planes
  6025. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  6026. @end table
  6027. @subsection Commands
  6028. This filter supports the following @ref{commands} that corresponds to option of same name:
  6029. @table @option
  6030. @item factor
  6031. @item threshold
  6032. @item tolerance
  6033. @item low
  6034. @item high
  6035. @item planes
  6036. @end table
  6037. @section ass
  6038. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  6039. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  6040. Substation Alpha) subtitles files.
  6041. This filter accepts the following option in addition to the common options from
  6042. the @ref{subtitles} filter:
  6043. @table @option
  6044. @item shaping
  6045. Set the shaping engine
  6046. Available values are:
  6047. @table @samp
  6048. @item auto
  6049. The default libass shaping engine, which is the best available.
  6050. @item simple
  6051. Fast, font-agnostic shaper that can do only substitutions
  6052. @item complex
  6053. Slower shaper using OpenType for substitutions and positioning
  6054. @end table
  6055. The default is @code{auto}.
  6056. @end table
  6057. @section atadenoise
  6058. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  6059. The filter accepts the following options:
  6060. @table @option
  6061. @item 0a
  6062. Set threshold A for 1st plane. Default is 0.02.
  6063. Valid range is 0 to 0.3.
  6064. @item 0b
  6065. Set threshold B for 1st plane. Default is 0.04.
  6066. Valid range is 0 to 5.
  6067. @item 1a
  6068. Set threshold A for 2nd plane. Default is 0.02.
  6069. Valid range is 0 to 0.3.
  6070. @item 1b
  6071. Set threshold B for 2nd plane. Default is 0.04.
  6072. Valid range is 0 to 5.
  6073. @item 2a
  6074. Set threshold A for 3rd plane. Default is 0.02.
  6075. Valid range is 0 to 0.3.
  6076. @item 2b
  6077. Set threshold B for 3rd plane. Default is 0.04.
  6078. Valid range is 0 to 5.
  6079. Threshold A is designed to react on abrupt changes in the input signal and
  6080. threshold B is designed to react on continuous changes in the input signal.
  6081. @item s
  6082. Set number of frames filter will use for averaging. Default is 9. Must be odd
  6083. number in range [5, 129].
  6084. @item p
  6085. Set what planes of frame filter will use for averaging. Default is all.
  6086. @item a
  6087. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  6088. Alternatively can be set to @code{s} serial.
  6089. Parallel can be faster then serial, while other way around is never true.
  6090. Parallel will abort early on first change being greater then thresholds, while serial
  6091. will continue processing other side of frames if they are equal or below thresholds.
  6092. @item 0s
  6093. @item 1s
  6094. @item 2s
  6095. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  6096. Valid range is from 0 to 32767.
  6097. This options controls weight for each pixel in radius defined by size.
  6098. Default value means every pixel have same weight.
  6099. Setting this option to 0 effectively disables filtering.
  6100. @end table
  6101. @subsection Commands
  6102. This filter supports same @ref{commands} as options except option @code{s}.
  6103. The command accepts the same syntax of the corresponding option.
  6104. @section avgblur
  6105. Apply average blur filter.
  6106. The filter accepts the following options:
  6107. @table @option
  6108. @item sizeX
  6109. Set horizontal radius size.
  6110. @item planes
  6111. Set which planes to filter. By default all planes are filtered.
  6112. @item sizeY
  6113. Set vertical radius size, if zero it will be same as @code{sizeX}.
  6114. Default is @code{0}.
  6115. @end table
  6116. @subsection Commands
  6117. This filter supports same commands as options.
  6118. The command accepts the same syntax of the corresponding option.
  6119. If the specified expression is not valid, it is kept at its current
  6120. value.
  6121. @section bbox
  6122. Compute the bounding box for the non-black pixels in the input frame
  6123. luminance plane.
  6124. This filter computes the bounding box containing all the pixels with a
  6125. luminance value greater than the minimum allowed value.
  6126. The parameters describing the bounding box are printed on the filter
  6127. log.
  6128. The filter accepts the following option:
  6129. @table @option
  6130. @item min_val
  6131. Set the minimal luminance value. Default is @code{16}.
  6132. @end table
  6133. @subsection Commands
  6134. This filter supports the all above options as @ref{commands}.
  6135. @section bilateral
  6136. Apply bilateral filter, spatial smoothing while preserving edges.
  6137. The filter accepts the following options:
  6138. @table @option
  6139. @item sigmaS
  6140. Set sigma of gaussian function to calculate spatial weight.
  6141. Allowed range is 0 to 512. Default is 0.1.
  6142. @item sigmaR
  6143. Set sigma of gaussian function to calculate range weight.
  6144. Allowed range is 0 to 1. Default is 0.1.
  6145. @item planes
  6146. Set planes to filter. Default is first only.
  6147. @end table
  6148. @subsection Commands
  6149. This filter supports the all above options as @ref{commands}.
  6150. @section bitplanenoise
  6151. Show and measure bit plane noise.
  6152. The filter accepts the following options:
  6153. @table @option
  6154. @item bitplane
  6155. Set which plane to analyze. Default is @code{1}.
  6156. @item filter
  6157. Filter out noisy pixels from @code{bitplane} set above.
  6158. Default is disabled.
  6159. @end table
  6160. @section blackdetect
  6161. Detect video intervals that are (almost) completely black. Can be
  6162. useful to detect chapter transitions, commercials, or invalid
  6163. recordings.
  6164. The filter outputs its detection analysis to both the log as well as
  6165. frame metadata. If a black segment of at least the specified minimum
  6166. duration is found, a line with the start and end timestamps as well
  6167. as duration is printed to the log with level @code{info}. In addition,
  6168. a log line with level @code{debug} is printed per frame showing the
  6169. black amount detected for that frame.
  6170. The filter also attaches metadata to the first frame of a black
  6171. segment with key @code{lavfi.black_start} and to the first frame
  6172. after the black segment ends with key @code{lavfi.black_end}. The
  6173. value is the frame's timestamp. This metadata is added regardless
  6174. of the minimum duration specified.
  6175. The filter accepts the following options:
  6176. @table @option
  6177. @item black_min_duration, d
  6178. Set the minimum detected black duration expressed in seconds. It must
  6179. be a non-negative floating point number.
  6180. Default value is 2.0.
  6181. @item picture_black_ratio_th, pic_th
  6182. Set the threshold for considering a picture "black".
  6183. Express the minimum value for the ratio:
  6184. @example
  6185. @var{nb_black_pixels} / @var{nb_pixels}
  6186. @end example
  6187. for which a picture is considered black.
  6188. Default value is 0.98.
  6189. @item pixel_black_th, pix_th
  6190. Set the threshold for considering a pixel "black".
  6191. The threshold expresses the maximum pixel luminance value for which a
  6192. pixel is considered "black". The provided value is scaled according to
  6193. the following equation:
  6194. @example
  6195. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  6196. @end example
  6197. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  6198. the input video format, the range is [0-255] for YUV full-range
  6199. formats and [16-235] for YUV non full-range formats.
  6200. Default value is 0.10.
  6201. @end table
  6202. The following example sets the maximum pixel threshold to the minimum
  6203. value, and detects only black intervals of 2 or more seconds:
  6204. @example
  6205. blackdetect=d=2:pix_th=0.00
  6206. @end example
  6207. @section blackframe
  6208. Detect frames that are (almost) completely black. Can be useful to
  6209. detect chapter transitions or commercials. Output lines consist of
  6210. the frame number of the detected frame, the percentage of blackness,
  6211. the position in the file if known or -1 and the timestamp in seconds.
  6212. In order to display the output lines, you need to set the loglevel at
  6213. least to the AV_LOG_INFO value.
  6214. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6215. The value represents the percentage of pixels in the picture that
  6216. are below the threshold value.
  6217. It accepts the following parameters:
  6218. @table @option
  6219. @item amount
  6220. The percentage of the pixels that have to be below the threshold; it defaults to
  6221. @code{98}.
  6222. @item threshold, thresh
  6223. The threshold below which a pixel value is considered black; it defaults to
  6224. @code{32}.
  6225. @end table
  6226. @anchor{blend}
  6227. @section blend
  6228. Blend two video frames into each other.
  6229. The @code{blend} filter takes two input streams and outputs one
  6230. stream, the first input is the "top" layer and second input is
  6231. "bottom" layer. By default, the output terminates when the longest input terminates.
  6232. The @code{tblend} (time blend) filter takes two consecutive frames
  6233. from one single stream, and outputs the result obtained by blending
  6234. the new frame on top of the old frame.
  6235. A description of the accepted options follows.
  6236. @table @option
  6237. @item c0_mode
  6238. @item c1_mode
  6239. @item c2_mode
  6240. @item c3_mode
  6241. @item all_mode
  6242. Set blend mode for specific pixel component or all pixel components in case
  6243. of @var{all_mode}. Default value is @code{normal}.
  6244. Available values for component modes are:
  6245. @table @samp
  6246. @item addition
  6247. @item and
  6248. @item average
  6249. @item bleach
  6250. @item burn
  6251. @item darken
  6252. @item difference
  6253. @item divide
  6254. @item dodge
  6255. @item exclusion
  6256. @item extremity
  6257. @item freeze
  6258. @item geometric
  6259. @item glow
  6260. @item grainextract
  6261. @item grainmerge
  6262. @item hardlight
  6263. @item hardmix
  6264. @item hardoverlay
  6265. @item harmonic
  6266. @item heat
  6267. @item interpolate
  6268. @item lighten
  6269. @item linearlight
  6270. @item multiply
  6271. @item multiply128
  6272. @item negation
  6273. @item normal
  6274. @item or
  6275. @item overlay
  6276. @item phoenix
  6277. @item pinlight
  6278. @item reflect
  6279. @item screen
  6280. @item softdifference
  6281. @item softlight
  6282. @item stain
  6283. @item subtract
  6284. @item vividlight
  6285. @item xor
  6286. @end table
  6287. @item c0_opacity
  6288. @item c1_opacity
  6289. @item c2_opacity
  6290. @item c3_opacity
  6291. @item all_opacity
  6292. Set blend opacity for specific pixel component or all pixel components in case
  6293. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6294. @item c0_expr
  6295. @item c1_expr
  6296. @item c2_expr
  6297. @item c3_expr
  6298. @item all_expr
  6299. Set blend expression for specific pixel component or all pixel components in case
  6300. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6301. The expressions can use the following variables:
  6302. @table @option
  6303. @item N
  6304. The sequential number of the filtered frame, starting from @code{0}.
  6305. @item X
  6306. @item Y
  6307. the coordinates of the current sample
  6308. @item W
  6309. @item H
  6310. the width and height of currently filtered plane
  6311. @item SW
  6312. @item SH
  6313. Width and height scale for the plane being filtered. It is the
  6314. ratio between the dimensions of the current plane to the luma plane,
  6315. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6316. the luma plane and @code{0.5,0.5} for the chroma planes.
  6317. @item T
  6318. Time of the current frame, expressed in seconds.
  6319. @item TOP, A
  6320. Value of pixel component at current location for first video frame (top layer).
  6321. @item BOTTOM, B
  6322. Value of pixel component at current location for second video frame (bottom layer).
  6323. @end table
  6324. @end table
  6325. The @code{blend} filter also supports the @ref{framesync} options.
  6326. @subsection Examples
  6327. @itemize
  6328. @item
  6329. Apply transition from bottom layer to top layer in first 10 seconds:
  6330. @example
  6331. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6332. @end example
  6333. @item
  6334. Apply linear horizontal transition from top layer to bottom layer:
  6335. @example
  6336. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6337. @end example
  6338. @item
  6339. Apply 1x1 checkerboard effect:
  6340. @example
  6341. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6342. @end example
  6343. @item
  6344. Apply uncover left effect:
  6345. @example
  6346. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6347. @end example
  6348. @item
  6349. Apply uncover down effect:
  6350. @example
  6351. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6352. @end example
  6353. @item
  6354. Apply uncover up-left effect:
  6355. @example
  6356. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6357. @end example
  6358. @item
  6359. Split diagonally video and shows top and bottom layer on each side:
  6360. @example
  6361. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6362. @end example
  6363. @item
  6364. Display differences between the current and the previous frame:
  6365. @example
  6366. tblend=all_mode=grainextract
  6367. @end example
  6368. @end itemize
  6369. @subsection Commands
  6370. This filter supports same @ref{commands} as options.
  6371. @anchor{blockdetect}
  6372. @section blockdetect
  6373. Determines blockiness of frames without altering the input frames.
  6374. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference.
  6375. The filter accepts the following options:
  6376. @table @option
  6377. @item period_min
  6378. @item period_max
  6379. Set minimum and maximum values for determining pixel grids (periods).
  6380. Default values are [3,24].
  6381. @item planes
  6382. Set planes to filter. Default is first only.
  6383. @end table
  6384. @subsection Examples
  6385. @itemize
  6386. @item
  6387. Determine blockiness for the first plane and search for periods within [8,32]:
  6388. @example
  6389. blockdetect=period_min=8:period_max=32:planes=1
  6390. @end example
  6391. @end itemize
  6392. @anchor{blurdetect}
  6393. @section blurdetect
  6394. Determines blurriness of frames without altering the input frames.
  6395. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6396. Allows for a block-based abbreviation.
  6397. The filter accepts the following options:
  6398. @table @option
  6399. @item low
  6400. @item high
  6401. Set low and high threshold values used by the Canny thresholding
  6402. algorithm.
  6403. The high threshold selects the "strong" edge pixels, which are then
  6404. connected through 8-connectivity with the "weak" edge pixels selected
  6405. by the low threshold.
  6406. @var{low} and @var{high} threshold values must be chosen in the range
  6407. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6408. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6409. is @code{50/255}.
  6410. @item radius
  6411. Define the radius to search around an edge pixel for local maxima.
  6412. @item block_pct
  6413. Determine blurriness only for the most significant blocks, given in percentage.
  6414. @item block_width
  6415. 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}.
  6416. @item block_height
  6417. 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}.
  6418. @item planes
  6419. Set planes to filter. Default is first only.
  6420. @end table
  6421. @subsection Examples
  6422. @itemize
  6423. @item
  6424. Determine blur for 80% of most significant 32x32 blocks:
  6425. @example
  6426. blurdetect=block_width=32:block_height=32:block_pct=80
  6427. @end example
  6428. @end itemize
  6429. @section bm3d
  6430. Denoise frames using Block-Matching 3D algorithm.
  6431. The filter accepts the following options.
  6432. @table @option
  6433. @item sigma
  6434. Set denoising strength. Default value is 1.
  6435. Allowed range is from 0 to 999.9.
  6436. The denoising algorithm is very sensitive to sigma, so adjust it
  6437. according to the source.
  6438. @item block
  6439. Set local patch size. This sets dimensions in 2D.
  6440. @item bstep
  6441. Set sliding step for processing blocks. Default value is 4.
  6442. Allowed range is from 1 to 64.
  6443. Smaller values allows processing more reference blocks and is slower.
  6444. @item group
  6445. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6446. When set to 1, no block matching is done. Larger values allows more blocks
  6447. in single group.
  6448. Allowed range is from 1 to 256.
  6449. @item range
  6450. Set radius for search block matching. Default is 9.
  6451. Allowed range is from 1 to INT32_MAX.
  6452. @item mstep
  6453. Set step between two search locations for block matching. Default is 1.
  6454. Allowed range is from 1 to 64. Smaller is slower.
  6455. @item thmse
  6456. Set threshold of mean square error for block matching. Valid range is 0 to
  6457. INT32_MAX.
  6458. @item hdthr
  6459. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6460. Larger values results in stronger hard-thresholding filtering in frequency
  6461. domain.
  6462. @item estim
  6463. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6464. Default is @code{basic}.
  6465. @item ref
  6466. If enabled, filter will use 2nd stream for block matching.
  6467. Default is disabled for @code{basic} value of @var{estim} option,
  6468. and always enabled if value of @var{estim} is @code{final}.
  6469. @item planes
  6470. Set planes to filter. Default is all available except alpha.
  6471. @end table
  6472. @subsection Examples
  6473. @itemize
  6474. @item
  6475. Basic filtering with bm3d:
  6476. @example
  6477. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6478. @end example
  6479. @item
  6480. Same as above, but filtering only luma:
  6481. @example
  6482. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6483. @end example
  6484. @item
  6485. Same as above, but with both estimation modes:
  6486. @example
  6487. 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
  6488. @end example
  6489. @item
  6490. Same as above, but prefilter with @ref{nlmeans} filter instead:
  6491. @example
  6492. 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
  6493. @end example
  6494. @end itemize
  6495. @section boxblur
  6496. Apply a boxblur algorithm to the input video.
  6497. It accepts the following parameters:
  6498. @table @option
  6499. @item luma_radius, lr
  6500. @item luma_power, lp
  6501. @item chroma_radius, cr
  6502. @item chroma_power, cp
  6503. @item alpha_radius, ar
  6504. @item alpha_power, ap
  6505. @end table
  6506. A description of the accepted options follows.
  6507. @table @option
  6508. @item luma_radius, lr
  6509. @item chroma_radius, cr
  6510. @item alpha_radius, ar
  6511. Set an expression for the box radius in pixels used for blurring the
  6512. corresponding input plane.
  6513. The radius value must be a non-negative number, and must not be
  6514. greater than the value of the expression @code{min(w,h)/2} for the
  6515. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  6516. planes.
  6517. Default value for @option{luma_radius} is "2". If not specified,
  6518. @option{chroma_radius} and @option{alpha_radius} default to the
  6519. corresponding value set for @option{luma_radius}.
  6520. The expressions can contain the following constants:
  6521. @table @option
  6522. @item w
  6523. @item h
  6524. The input width and height in pixels.
  6525. @item cw
  6526. @item ch
  6527. The input chroma image width and height in pixels.
  6528. @item hsub
  6529. @item vsub
  6530. The horizontal and vertical chroma subsample values. For example, for the
  6531. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  6532. @end table
  6533. @item luma_power, lp
  6534. @item chroma_power, cp
  6535. @item alpha_power, ap
  6536. Specify how many times the boxblur filter is applied to the
  6537. corresponding plane.
  6538. Default value for @option{luma_power} is 2. If not specified,
  6539. @option{chroma_power} and @option{alpha_power} default to the
  6540. corresponding value set for @option{luma_power}.
  6541. A value of 0 will disable the effect.
  6542. @end table
  6543. @subsection Examples
  6544. @itemize
  6545. @item
  6546. Apply a boxblur filter with the luma, chroma, and alpha radii
  6547. set to 2:
  6548. @example
  6549. boxblur=luma_radius=2:luma_power=1
  6550. boxblur=2:1
  6551. @end example
  6552. @item
  6553. Set the luma radius to 2, and alpha and chroma radius to 0:
  6554. @example
  6555. boxblur=2:1:cr=0:ar=0
  6556. @end example
  6557. @item
  6558. Set the luma and chroma radii to a fraction of the video dimension:
  6559. @example
  6560. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  6561. @end example
  6562. @end itemize
  6563. @section bwdif
  6564. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  6565. Deinterlacing Filter").
  6566. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  6567. interpolation algorithms.
  6568. It accepts the following parameters:
  6569. @table @option
  6570. @item mode
  6571. The interlacing mode to adopt. It accepts one of the following values:
  6572. @table @option
  6573. @item 0, send_frame
  6574. Output one frame for each frame.
  6575. @item 1, send_field
  6576. Output one frame for each field.
  6577. @end table
  6578. The default value is @code{send_field}.
  6579. @item parity
  6580. The picture field parity assumed for the input interlaced video. It accepts one
  6581. of the following values:
  6582. @table @option
  6583. @item 0, tff
  6584. Assume the top field is first.
  6585. @item 1, bff
  6586. Assume the bottom field is first.
  6587. @item -1, auto
  6588. Enable automatic detection of field parity.
  6589. @end table
  6590. The default value is @code{auto}.
  6591. If the interlacing is unknown or the decoder does not export this information,
  6592. top field first will be assumed.
  6593. @item deint
  6594. Specify which frames to deinterlace. Accepts one of the following
  6595. values:
  6596. @table @option
  6597. @item 0, all
  6598. Deinterlace all frames.
  6599. @item 1, interlaced
  6600. Only deinterlace frames marked as interlaced.
  6601. @end table
  6602. The default value is @code{all}.
  6603. @end table
  6604. @section cas
  6605. Apply Contrast Adaptive Sharpen filter to video stream.
  6606. The filter accepts the following options:
  6607. @table @option
  6608. @item strength
  6609. Set the sharpening strength. Default value is 0.
  6610. @item planes
  6611. Set planes to filter. Default value is to filter all
  6612. planes except alpha plane.
  6613. @end table
  6614. @subsection Commands
  6615. This filter supports same @ref{commands} as options.
  6616. @section chromahold
  6617. Remove all color information for all colors except for certain one.
  6618. The filter accepts the following options:
  6619. @table @option
  6620. @item color
  6621. The color which will not be replaced with neutral chroma.
  6622. @item similarity
  6623. Similarity percentage with the above color.
  6624. 0.01 matches only the exact key color, while 1.0 matches everything.
  6625. @item blend
  6626. Blend percentage.
  6627. 0.0 makes pixels either fully gray, or not gray at all.
  6628. Higher values result in more preserved color.
  6629. @item yuv
  6630. Signals that the color passed is already in YUV instead of RGB.
  6631. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6632. This can be used to pass exact YUV values as hexadecimal numbers.
  6633. @end table
  6634. @subsection Commands
  6635. This filter supports same @ref{commands} as options.
  6636. The command accepts the same syntax of the corresponding option.
  6637. If the specified expression is not valid, it is kept at its current
  6638. value.
  6639. @anchor{chromakey}
  6640. @section chromakey
  6641. YUV colorspace color/chroma keying.
  6642. The filter accepts the following options:
  6643. @table @option
  6644. @item color
  6645. The color which will be replaced with transparency.
  6646. @item similarity
  6647. Similarity percentage with the key color.
  6648. 0.01 matches only the exact key color, while 1.0 matches everything.
  6649. @item blend
  6650. Blend percentage.
  6651. 0.0 makes pixels either fully transparent, or not transparent at all.
  6652. Higher values result in semi-transparent pixels, with a higher transparency
  6653. the more similar the pixels color is to the key color.
  6654. @item yuv
  6655. Signals that the color passed is already in YUV instead of RGB.
  6656. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6657. This can be used to pass exact YUV values as hexadecimal numbers.
  6658. @end table
  6659. @subsection Commands
  6660. This filter supports same @ref{commands} as options.
  6661. The command accepts the same syntax of the corresponding option.
  6662. If the specified expression is not valid, it is kept at its current
  6663. value.
  6664. @subsection Examples
  6665. @itemize
  6666. @item
  6667. Make every green pixel in the input image transparent:
  6668. @example
  6669. ffmpeg -i input.png -vf chromakey=green out.png
  6670. @end example
  6671. @item
  6672. Overlay a greenscreen-video on top of a static black background.
  6673. @example
  6674. 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
  6675. @end example
  6676. @end itemize
  6677. @section chromakey_cuda
  6678. CUDA accelerated YUV colorspace color/chroma keying.
  6679. This filter works like normal chromakey filter but operates on CUDA frames.
  6680. for more details and parameters see @ref{chromakey}.
  6681. @subsection Examples
  6682. @itemize
  6683. @item
  6684. Make all the green pixels in the input video transparent and use it as an overlay for another video:
  6685. @example
  6686. ./ffmpeg \
  6687. -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
  6688. -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
  6689. -init_hw_device cuda \
  6690. -filter_complex \
  6691. " \
  6692. [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
  6693. [1:v]scale_cuda=format=yuv420p[base]; \
  6694. [base][overlay_video]overlay_cuda" \
  6695. -an -sn -c:v h264_nvenc -cq 20 output.mp4
  6696. @end example
  6697. @item
  6698. Process two software sources, explicitly uploading the frames:
  6699. @example
  6700. ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
  6701. -f lavfi -i color=size=800x600:color=white,format=yuv420p \
  6702. -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
  6703. -filter_complex \
  6704. " \
  6705. [0]hwupload[under]; \
  6706. [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
  6707. [under][over]overlay_cuda" \
  6708. -c:v hevc_nvenc -cq 18 -preset slow output.mp4
  6709. @end example
  6710. @end itemize
  6711. @section chromanr
  6712. Reduce chrominance noise.
  6713. The filter accepts the following options:
  6714. @table @option
  6715. @item thres
  6716. Set threshold for averaging chrominance values.
  6717. Sum of absolute difference of Y, U and V pixel components of current
  6718. pixel and neighbour pixels lower than this threshold will be used in
  6719. averaging. Luma component is left unchanged and is copied to output.
  6720. Default value is 30. Allowed range is from 1 to 200.
  6721. @item sizew
  6722. Set horizontal radius of rectangle used for averaging.
  6723. Allowed range is from 1 to 100. Default value is 5.
  6724. @item sizeh
  6725. Set vertical radius of rectangle used for averaging.
  6726. Allowed range is from 1 to 100. Default value is 5.
  6727. @item stepw
  6728. Set horizontal step when averaging. Default value is 1.
  6729. Allowed range is from 1 to 50.
  6730. Mostly useful to speed-up filtering.
  6731. @item steph
  6732. Set vertical step when averaging. Default value is 1.
  6733. Allowed range is from 1 to 50.
  6734. Mostly useful to speed-up filtering.
  6735. @item threy
  6736. Set Y threshold for averaging chrominance values.
  6737. Set finer control for max allowed difference between Y components
  6738. of current pixel and neigbour pixels.
  6739. Default value is 200. Allowed range is from 1 to 200.
  6740. @item threu
  6741. Set U threshold for averaging chrominance values.
  6742. Set finer control for max allowed difference between U components
  6743. of current pixel and neigbour pixels.
  6744. Default value is 200. Allowed range is from 1 to 200.
  6745. @item threv
  6746. Set V threshold for averaging chrominance values.
  6747. Set finer control for max allowed difference between V components
  6748. of current pixel and neigbour pixels.
  6749. Default value is 200. Allowed range is from 1 to 200.
  6750. @item distance
  6751. Set distance type used in calculations.
  6752. @table @samp
  6753. @item manhattan
  6754. Absolute difference.
  6755. @item euclidean
  6756. Difference squared.
  6757. @end table
  6758. Default distance type is manhattan.
  6759. @end table
  6760. @subsection Commands
  6761. This filter supports same @ref{commands} as options.
  6762. The command accepts the same syntax of the corresponding option.
  6763. @section chromashift
  6764. Shift chroma pixels horizontally and/or vertically.
  6765. The filter accepts the following options:
  6766. @table @option
  6767. @item cbh
  6768. Set amount to shift chroma-blue horizontally.
  6769. @item cbv
  6770. Set amount to shift chroma-blue vertically.
  6771. @item crh
  6772. Set amount to shift chroma-red horizontally.
  6773. @item crv
  6774. Set amount to shift chroma-red vertically.
  6775. @item edge
  6776. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6777. @end table
  6778. @subsection Commands
  6779. This filter supports the all above options as @ref{commands}.
  6780. @section ciescope
  6781. Display CIE color diagram with pixels overlaid onto it.
  6782. The filter accepts the following options:
  6783. @table @option
  6784. @item system
  6785. Set color system.
  6786. @table @samp
  6787. @item ntsc, 470m
  6788. @item ebu, 470bg
  6789. @item smpte
  6790. @item 240m
  6791. @item apple
  6792. @item widergb
  6793. @item cie1931
  6794. @item rec709, hdtv
  6795. @item uhdtv, rec2020
  6796. @item dcip3
  6797. @end table
  6798. @item cie
  6799. Set CIE system.
  6800. @table @samp
  6801. @item xyy
  6802. @item ucs
  6803. @item luv
  6804. @end table
  6805. @item gamuts
  6806. Set what gamuts to draw.
  6807. See @code{system} option for available values.
  6808. @item size, s
  6809. Set ciescope size, by default set to 512.
  6810. @item intensity, i
  6811. Set intensity used to map input pixel values to CIE diagram.
  6812. @item contrast
  6813. Set contrast used to draw tongue colors that are out of active color system gamut.
  6814. @item corrgamma
  6815. Correct gamma displayed on scope, by default enabled.
  6816. @item showwhite
  6817. Show white point on CIE diagram, by default disabled.
  6818. @item gamma
  6819. Set input gamma. Used only with XYZ input color space.
  6820. @item fill
  6821. Fill with CIE colors. By default is enabled.
  6822. @end table
  6823. @section codecview
  6824. Visualize information exported by some codecs.
  6825. Some codecs can export information through frames using side-data or other
  6826. means. For example, some MPEG based codecs export motion vectors through the
  6827. @var{export_mvs} flag in the codec @option{flags2} option.
  6828. The filter accepts the following option:
  6829. @table @option
  6830. @item block
  6831. Display block partition structure using the luma plane.
  6832. @item mv
  6833. Set motion vectors to visualize.
  6834. Available flags for @var{mv} are:
  6835. @table @samp
  6836. @item pf
  6837. forward predicted MVs of P-frames
  6838. @item bf
  6839. forward predicted MVs of B-frames
  6840. @item bb
  6841. backward predicted MVs of B-frames
  6842. @end table
  6843. @item qp
  6844. Display quantization parameters using the chroma planes.
  6845. @item mv_type, mvt
  6846. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6847. Available flags for @var{mv_type} are:
  6848. @table @samp
  6849. @item fp
  6850. forward predicted MVs
  6851. @item bp
  6852. backward predicted MVs
  6853. @end table
  6854. @item frame_type, ft
  6855. Set frame type to visualize motion vectors of.
  6856. Available flags for @var{frame_type} are:
  6857. @table @samp
  6858. @item if
  6859. intra-coded frames (I-frames)
  6860. @item pf
  6861. predicted frames (P-frames)
  6862. @item bf
  6863. bi-directionally predicted frames (B-frames)
  6864. @end table
  6865. @end table
  6866. @subsection Examples
  6867. @itemize
  6868. @item
  6869. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6870. @example
  6871. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6872. @end example
  6873. @item
  6874. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6875. @example
  6876. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6877. @end example
  6878. @end itemize
  6879. @section colorbalance
  6880. Modify intensity of primary colors (red, green and blue) of input frames.
  6881. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6882. regions for the red-cyan, green-magenta or blue-yellow balance.
  6883. A positive adjustment value shifts the balance towards the primary color, a negative
  6884. value towards the complementary color.
  6885. The filter accepts the following options:
  6886. @table @option
  6887. @item rs
  6888. @item gs
  6889. @item bs
  6890. Adjust red, green and blue shadows (darkest pixels).
  6891. @item rm
  6892. @item gm
  6893. @item bm
  6894. Adjust red, green and blue midtones (medium pixels).
  6895. @item rh
  6896. @item gh
  6897. @item bh
  6898. Adjust red, green and blue highlights (brightest pixels).
  6899. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6900. @item pl
  6901. Preserve lightness when changing color balance. Default is disabled.
  6902. @end table
  6903. @subsection Examples
  6904. @itemize
  6905. @item
  6906. Add red color cast to shadows:
  6907. @example
  6908. colorbalance=rs=.3
  6909. @end example
  6910. @end itemize
  6911. @subsection Commands
  6912. This filter supports the all above options as @ref{commands}.
  6913. @section colorcontrast
  6914. Adjust color contrast between RGB components.
  6915. The filter accepts the following options:
  6916. @table @option
  6917. @item rc
  6918. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6919. @item gm
  6920. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6921. @item by
  6922. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6923. @item rcw
  6924. @item gmw
  6925. @item byw
  6926. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  6927. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  6928. @item pl
  6929. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  6930. @end table
  6931. @subsection Commands
  6932. This filter supports the all above options as @ref{commands}.
  6933. @section colorcorrect
  6934. Adjust color white balance selectively for blacks and whites.
  6935. This filter operates in YUV colorspace.
  6936. The filter accepts the following options:
  6937. @table @option
  6938. @item rl
  6939. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  6940. Default value is 0.
  6941. @item bl
  6942. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  6943. Default value is 0.
  6944. @item rh
  6945. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6946. Default value is 0.
  6947. @item bh
  6948. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6949. Default value is 0.
  6950. @item saturation
  6951. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  6952. Default value is 1.
  6953. @item analyze
  6954. If set to anything other than @code{manual} it will analyze every frame and use derived
  6955. parameters for filtering output frame.
  6956. Possible values are:
  6957. @table @samp
  6958. @item manual
  6959. @item average
  6960. @item minmax
  6961. @item median
  6962. @end table
  6963. Default value is @code{manual}.
  6964. @end table
  6965. @subsection Commands
  6966. This filter supports the all above options as @ref{commands}.
  6967. @section colorchannelmixer
  6968. Adjust video input frames by re-mixing color channels.
  6969. This filter modifies a color channel by adding the values associated to
  6970. the other channels of the same pixels. For example if the value to
  6971. modify is red, the output value will be:
  6972. @example
  6973. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  6974. @end example
  6975. The filter accepts the following options:
  6976. @table @option
  6977. @item rr
  6978. @item rg
  6979. @item rb
  6980. @item ra
  6981. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  6982. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  6983. @item gr
  6984. @item gg
  6985. @item gb
  6986. @item ga
  6987. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  6988. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  6989. @item br
  6990. @item bg
  6991. @item bb
  6992. @item ba
  6993. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  6994. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  6995. @item ar
  6996. @item ag
  6997. @item ab
  6998. @item aa
  6999. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  7000. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  7001. Allowed ranges for options are @code{[-2.0, 2.0]}.
  7002. @item pc
  7003. Set preserve color mode. The accepted values are:
  7004. @table @samp
  7005. @item none
  7006. Disable color preserving, this is default.
  7007. @item lum
  7008. Preserve luminance.
  7009. @item max
  7010. Preserve max value of RGB triplet.
  7011. @item avg
  7012. Preserve average value of RGB triplet.
  7013. @item sum
  7014. Preserve sum value of RGB triplet.
  7015. @item nrm
  7016. Preserve normalized value of RGB triplet.
  7017. @item pwr
  7018. Preserve power value of RGB triplet.
  7019. @end table
  7020. @item pa
  7021. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  7022. Default is @code{0.0}, thus disabled.
  7023. @end table
  7024. @subsection Examples
  7025. @itemize
  7026. @item
  7027. Convert source to grayscale:
  7028. @example
  7029. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  7030. @end example
  7031. @item
  7032. Simulate sepia tones:
  7033. @example
  7034. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  7035. @end example
  7036. @end itemize
  7037. @subsection Commands
  7038. This filter supports the all above options as @ref{commands}.
  7039. @section colorize
  7040. Overlay a solid color on the video stream.
  7041. The filter accepts the following options:
  7042. @table @option
  7043. @item hue
  7044. Set the color hue. Allowed range is from 0 to 360.
  7045. Default value is 0.
  7046. @item saturation
  7047. Set the color saturation. Allowed range is from 0 to 1.
  7048. Default value is 0.5.
  7049. @item lightness
  7050. Set the color lightness. Allowed range is from 0 to 1.
  7051. Default value is 0.5.
  7052. @item mix
  7053. Set the mix of source lightness. By default is set to 1.0.
  7054. Allowed range is from 0.0 to 1.0.
  7055. @end table
  7056. @subsection Commands
  7057. This filter supports the all above options as @ref{commands}.
  7058. @section colorkey
  7059. RGB colorspace color keying.
  7060. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  7061. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  7062. the similarity radius depends on the value of the blend option.
  7063. The filter accepts the following options:
  7064. @table @option
  7065. @item color
  7066. Set the color for which alpha will be set to 0 (full transparency).
  7067. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7068. Default is @code{black}.
  7069. @item similarity
  7070. Set the radius from the key color within which other colors also have full transparency.
  7071. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  7072. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  7073. around the exact key color, while 1.0 matches everything.
  7074. Default is @code{0.01}.
  7075. @item blend
  7076. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  7077. 0.0 makes pixels either fully transparent or fully opaque.
  7078. Higher values result in semi-transparent pixels, with greater transparency
  7079. the more similar the pixel color is to the key color.
  7080. Range is 0.0 to 1.0. Default is @code{0.0}.
  7081. @end table
  7082. @subsection Examples
  7083. @itemize
  7084. @item
  7085. Make every green pixel in the input image transparent:
  7086. @example
  7087. ffmpeg -i input.png -vf colorkey=green out.png
  7088. @end example
  7089. @item
  7090. Overlay a greenscreen-video on top of a static background image.
  7091. @example
  7092. 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
  7093. @end example
  7094. @end itemize
  7095. @subsection Commands
  7096. This filter supports same @ref{commands} as options.
  7097. The command accepts the same syntax of the corresponding option.
  7098. If the specified expression is not valid, it is kept at its current
  7099. value.
  7100. @section colorhold
  7101. Remove all color information for all RGB colors except for certain one.
  7102. The filter accepts the following options:
  7103. @table @option
  7104. @item color
  7105. The color which will not be replaced with neutral gray.
  7106. @item similarity
  7107. Similarity percentage with the above color.
  7108. 0.01 matches only the exact key color, while 1.0 matches everything.
  7109. @item blend
  7110. Blend percentage. 0.0 makes pixels fully gray.
  7111. Higher values result in more preserved color.
  7112. @end table
  7113. @subsection Commands
  7114. This filter supports same @ref{commands} as options.
  7115. The command accepts the same syntax of the corresponding option.
  7116. If the specified expression is not valid, it is kept at its current
  7117. value.
  7118. @section colorlevels
  7119. Adjust video input frames using levels.
  7120. The filter accepts the following options:
  7121. @table @option
  7122. @item rimin
  7123. @item gimin
  7124. @item bimin
  7125. @item aimin
  7126. Adjust red, green, blue and alpha input black point.
  7127. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7128. @item rimax
  7129. @item gimax
  7130. @item bimax
  7131. @item aimax
  7132. Adjust red, green, blue and alpha input white point.
  7133. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  7134. Input levels are used to lighten highlights (bright tones), darken shadows
  7135. (dark tones), change the balance of bright and dark tones.
  7136. @item romin
  7137. @item gomin
  7138. @item bomin
  7139. @item aomin
  7140. Adjust red, green, blue and alpha output black point.
  7141. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  7142. @item romax
  7143. @item gomax
  7144. @item bomax
  7145. @item aomax
  7146. Adjust red, green, blue and alpha output white point.
  7147. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  7148. Output levels allows manual selection of a constrained output level range.
  7149. @item preserve
  7150. Set preserve color mode. The accepted values are:
  7151. @table @samp
  7152. @item none
  7153. Disable color preserving, this is default.
  7154. @item lum
  7155. Preserve luminance.
  7156. @item max
  7157. Preserve max value of RGB triplet.
  7158. @item avg
  7159. Preserve average value of RGB triplet.
  7160. @item sum
  7161. Preserve sum value of RGB triplet.
  7162. @item nrm
  7163. Preserve normalized value of RGB triplet.
  7164. @item pwr
  7165. Preserve power value of RGB triplet.
  7166. @end table
  7167. @end table
  7168. @subsection Examples
  7169. @itemize
  7170. @item
  7171. Make video output darker:
  7172. @example
  7173. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  7174. @end example
  7175. @item
  7176. Increase contrast:
  7177. @example
  7178. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  7179. @end example
  7180. @item
  7181. Make video output lighter:
  7182. @example
  7183. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  7184. @end example
  7185. @item
  7186. Increase brightness:
  7187. @example
  7188. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  7189. @end example
  7190. @end itemize
  7191. @subsection Commands
  7192. This filter supports the all above options as @ref{commands}.
  7193. @section colormap
  7194. Apply custom color maps to video stream.
  7195. This filter needs three input video streams.
  7196. First stream is video stream that is going to be filtered out.
  7197. Second and third video stream specify color patches for source
  7198. color to target color mapping.
  7199. The filter accepts the following options:
  7200. @table @option
  7201. @item patch_size
  7202. Set the source and target video stream patch size in pixels.
  7203. @item nb_patches
  7204. Set the max number of used patches from source and target video stream.
  7205. Default value is number of patches available in additional video streams.
  7206. Max allowed number of patches is @code{64}.
  7207. @item type
  7208. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  7209. Defaults is @code{absolute}.
  7210. @item kernel
  7211. Set the kernel used to measure color differences between mapped colors.
  7212. The accepted values are:
  7213. @table @samp
  7214. @item euclidean
  7215. @item weuclidean
  7216. @end table
  7217. Default is @code{euclidean}.
  7218. @end table
  7219. @section colormatrix
  7220. Convert color matrix.
  7221. The filter accepts the following options:
  7222. @table @option
  7223. @item src
  7224. @item dst
  7225. Specify the source and destination color matrix. Both values must be
  7226. specified.
  7227. The accepted values are:
  7228. @table @samp
  7229. @item bt709
  7230. BT.709
  7231. @item fcc
  7232. FCC
  7233. @item bt601
  7234. BT.601
  7235. @item bt470
  7236. BT.470
  7237. @item bt470bg
  7238. BT.470BG
  7239. @item smpte170m
  7240. SMPTE-170M
  7241. @item smpte240m
  7242. SMPTE-240M
  7243. @item bt2020
  7244. BT.2020
  7245. @end table
  7246. @end table
  7247. For example to convert from BT.601 to SMPTE-240M, use the command:
  7248. @example
  7249. colormatrix=bt601:smpte240m
  7250. @end example
  7251. @section colorspace
  7252. Convert colorspace, transfer characteristics or color primaries.
  7253. Input video needs to have an even size.
  7254. The filter accepts the following options:
  7255. @table @option
  7256. @anchor{all}
  7257. @item all
  7258. Specify all color properties at once.
  7259. The accepted values are:
  7260. @table @samp
  7261. @item bt470m
  7262. BT.470M
  7263. @item bt470bg
  7264. BT.470BG
  7265. @item bt601-6-525
  7266. BT.601-6 525
  7267. @item bt601-6-625
  7268. BT.601-6 625
  7269. @item bt709
  7270. BT.709
  7271. @item smpte170m
  7272. SMPTE-170M
  7273. @item smpte240m
  7274. SMPTE-240M
  7275. @item bt2020
  7276. BT.2020
  7277. @end table
  7278. @anchor{space}
  7279. @item space
  7280. Specify output colorspace.
  7281. The accepted values are:
  7282. @table @samp
  7283. @item bt709
  7284. BT.709
  7285. @item fcc
  7286. FCC
  7287. @item bt470bg
  7288. BT.470BG or BT.601-6 625
  7289. @item smpte170m
  7290. SMPTE-170M or BT.601-6 525
  7291. @item smpte240m
  7292. SMPTE-240M
  7293. @item ycgco
  7294. YCgCo
  7295. @item bt2020ncl
  7296. BT.2020 with non-constant luminance
  7297. @end table
  7298. @anchor{trc}
  7299. @item trc
  7300. Specify output transfer characteristics.
  7301. The accepted values are:
  7302. @table @samp
  7303. @item bt709
  7304. BT.709
  7305. @item bt470m
  7306. BT.470M
  7307. @item bt470bg
  7308. BT.470BG
  7309. @item gamma22
  7310. Constant gamma of 2.2
  7311. @item gamma28
  7312. Constant gamma of 2.8
  7313. @item smpte170m
  7314. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7315. @item smpte240m
  7316. SMPTE-240M
  7317. @item srgb
  7318. SRGB
  7319. @item iec61966-2-1
  7320. iec61966-2-1
  7321. @item iec61966-2-4
  7322. iec61966-2-4
  7323. @item xvycc
  7324. xvycc
  7325. @item bt2020-10
  7326. BT.2020 for 10-bits content
  7327. @item bt2020-12
  7328. BT.2020 for 12-bits content
  7329. @end table
  7330. @anchor{primaries}
  7331. @item primaries
  7332. Specify output color primaries.
  7333. The accepted values are:
  7334. @table @samp
  7335. @item bt709
  7336. BT.709
  7337. @item bt470m
  7338. BT.470M
  7339. @item bt470bg
  7340. BT.470BG or BT.601-6 625
  7341. @item smpte170m
  7342. SMPTE-170M or BT.601-6 525
  7343. @item smpte240m
  7344. SMPTE-240M
  7345. @item film
  7346. film
  7347. @item smpte431
  7348. SMPTE-431
  7349. @item smpte432
  7350. SMPTE-432
  7351. @item bt2020
  7352. BT.2020
  7353. @item jedec-p22
  7354. JEDEC P22 phosphors
  7355. @end table
  7356. @anchor{range}
  7357. @item range
  7358. Specify output color range.
  7359. The accepted values are:
  7360. @table @samp
  7361. @item tv
  7362. TV (restricted) range
  7363. @item mpeg
  7364. MPEG (restricted) range
  7365. @item pc
  7366. PC (full) range
  7367. @item jpeg
  7368. JPEG (full) range
  7369. @end table
  7370. @item format
  7371. Specify output color format.
  7372. The accepted values are:
  7373. @table @samp
  7374. @item yuv420p
  7375. YUV 4:2:0 planar 8-bits
  7376. @item yuv420p10
  7377. YUV 4:2:0 planar 10-bits
  7378. @item yuv420p12
  7379. YUV 4:2:0 planar 12-bits
  7380. @item yuv422p
  7381. YUV 4:2:2 planar 8-bits
  7382. @item yuv422p10
  7383. YUV 4:2:2 planar 10-bits
  7384. @item yuv422p12
  7385. YUV 4:2:2 planar 12-bits
  7386. @item yuv444p
  7387. YUV 4:4:4 planar 8-bits
  7388. @item yuv444p10
  7389. YUV 4:4:4 planar 10-bits
  7390. @item yuv444p12
  7391. YUV 4:4:4 planar 12-bits
  7392. @end table
  7393. @item fast
  7394. Do a fast conversion, which skips gamma/primary correction. This will take
  7395. significantly less CPU, but will be mathematically incorrect. To get output
  7396. compatible with that produced by the colormatrix filter, use fast=1.
  7397. @item dither
  7398. Specify dithering mode.
  7399. The accepted values are:
  7400. @table @samp
  7401. @item none
  7402. No dithering
  7403. @item fsb
  7404. Floyd-Steinberg dithering
  7405. @end table
  7406. @item wpadapt
  7407. Whitepoint adaptation mode.
  7408. The accepted values are:
  7409. @table @samp
  7410. @item bradford
  7411. Bradford whitepoint adaptation
  7412. @item vonkries
  7413. von Kries whitepoint adaptation
  7414. @item identity
  7415. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7416. @end table
  7417. @item iall
  7418. Override all input properties at once. Same accepted values as @ref{all}.
  7419. @item ispace
  7420. Override input colorspace. Same accepted values as @ref{space}.
  7421. @item iprimaries
  7422. Override input color primaries. Same accepted values as @ref{primaries}.
  7423. @item itrc
  7424. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7425. @item irange
  7426. Override input color range. Same accepted values as @ref{range}.
  7427. @end table
  7428. The filter converts the transfer characteristics, color space and color
  7429. primaries to the specified user values. The output value, if not specified,
  7430. is set to a default value based on the "all" property. If that property is
  7431. also not specified, the filter will log an error. The output color range and
  7432. format default to the same value as the input color range and format. The
  7433. input transfer characteristics, color space, color primaries and color range
  7434. should be set on the input data. If any of these are missing, the filter will
  7435. log an error and no conversion will take place.
  7436. For example to convert the input to SMPTE-240M, use the command:
  7437. @example
  7438. colorspace=smpte240m
  7439. @end example
  7440. @section colortemperature
  7441. Adjust color temperature in video to simulate variations in ambient color temperature.
  7442. The filter accepts the following options:
  7443. @table @option
  7444. @item temperature
  7445. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7446. Default value is 6500 K.
  7447. @item mix
  7448. Set mixing with filtered output. Allowed range is from 0 to 1.
  7449. Default value is 1.
  7450. @item pl
  7451. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  7452. Default value is 0.
  7453. @end table
  7454. @subsection Commands
  7455. This filter supports same @ref{commands} as options.
  7456. @section convolution
  7457. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  7458. The filter accepts the following options:
  7459. @table @option
  7460. @item 0m
  7461. @item 1m
  7462. @item 2m
  7463. @item 3m
  7464. Set matrix for each plane.
  7465. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  7466. and from 1 to 49 odd number of signed integers in @var{row} mode.
  7467. @item 0rdiv
  7468. @item 1rdiv
  7469. @item 2rdiv
  7470. @item 3rdiv
  7471. Set multiplier for calculated value for each plane.
  7472. If unset or 0, it will be sum of all matrix elements.
  7473. @item 0bias
  7474. @item 1bias
  7475. @item 2bias
  7476. @item 3bias
  7477. Set bias for each plane. This value is added to the result of the multiplication.
  7478. Useful for making the overall image brighter or darker. Default is 0.0.
  7479. @item 0mode
  7480. @item 1mode
  7481. @item 2mode
  7482. @item 3mode
  7483. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  7484. Default is @var{square}.
  7485. @end table
  7486. @subsection Commands
  7487. This filter supports the all above options as @ref{commands}.
  7488. @subsection Examples
  7489. @itemize
  7490. @item
  7491. Apply sharpen:
  7492. @example
  7493. 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"
  7494. @end example
  7495. @item
  7496. Apply blur:
  7497. @example
  7498. 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"
  7499. @end example
  7500. @item
  7501. Apply edge enhance:
  7502. @example
  7503. 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"
  7504. @end example
  7505. @item
  7506. Apply edge detect:
  7507. @example
  7508. 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"
  7509. @end example
  7510. @item
  7511. Apply laplacian edge detector which includes diagonals:
  7512. @example
  7513. 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"
  7514. @end example
  7515. @item
  7516. Apply emboss:
  7517. @example
  7518. 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"
  7519. @end example
  7520. @end itemize
  7521. @section convolve
  7522. Apply 2D convolution of video stream in frequency domain using second stream
  7523. as impulse.
  7524. The filter accepts the following options:
  7525. @table @option
  7526. @item planes
  7527. Set which planes to process.
  7528. @item impulse
  7529. Set which impulse video frames will be processed, can be @var{first}
  7530. or @var{all}. Default is @var{all}.
  7531. @end table
  7532. The @code{convolve} filter also supports the @ref{framesync} options.
  7533. @section copy
  7534. Copy the input video source unchanged to the output. This is mainly useful for
  7535. testing purposes.
  7536. @anchor{coreimage}
  7537. @section coreimage
  7538. Video filtering on GPU using Apple's CoreImage API on OSX.
  7539. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  7540. processed by video hardware. However, software-based OpenGL implementations
  7541. exist which means there is no guarantee for hardware processing. It depends on
  7542. the respective OSX.
  7543. There are many filters and image generators provided by Apple that come with a
  7544. large variety of options. The filter has to be referenced by its name along
  7545. with its options.
  7546. The coreimage filter accepts the following options:
  7547. @table @option
  7548. @item list_filters
  7549. List all available filters and generators along with all their respective
  7550. options as well as possible minimum and maximum values along with the default
  7551. values.
  7552. @example
  7553. list_filters=true
  7554. @end example
  7555. @item filter
  7556. Specify all filters by their respective name and options.
  7557. Use @var{list_filters} to determine all valid filter names and options.
  7558. Numerical options are specified by a float value and are automatically clamped
  7559. to their respective value range. Vector and color options have to be specified
  7560. by a list of space separated float values. Character escaping has to be done.
  7561. A special option name @code{default} is available to use default options for a
  7562. filter.
  7563. It is required to specify either @code{default} or at least one of the filter options.
  7564. All omitted options are used with their default values.
  7565. The syntax of the filter string is as follows:
  7566. @example
  7567. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  7568. @end example
  7569. @item output_rect
  7570. Specify a rectangle where the output of the filter chain is copied into the
  7571. input image. It is given by a list of space separated float values:
  7572. @example
  7573. output_rect=x\ y\ width\ height
  7574. @end example
  7575. If not given, the output rectangle equals the dimensions of the input image.
  7576. The output rectangle is automatically cropped at the borders of the input
  7577. image. Negative values are valid for each component.
  7578. @example
  7579. output_rect=25\ 25\ 100\ 100
  7580. @end example
  7581. @end table
  7582. Several filters can be chained for successive processing without GPU-HOST
  7583. transfers allowing for fast processing of complex filter chains.
  7584. Currently, only filters with zero (generators) or exactly one (filters) input
  7585. image and one output image are supported. Also, transition filters are not yet
  7586. usable as intended.
  7587. Some filters generate output images with additional padding depending on the
  7588. respective filter kernel. The padding is automatically removed to ensure the
  7589. filter output has the same size as the input image.
  7590. For image generators, the size of the output image is determined by the
  7591. previous output image of the filter chain or the input image of the whole
  7592. filterchain, respectively. The generators do not use the pixel information of
  7593. this image to generate their output. However, the generated output is
  7594. blended onto this image, resulting in partial or complete coverage of the
  7595. output image.
  7596. The @ref{coreimagesrc} video source can be used for generating input images
  7597. which are directly fed into the filter chain. By using it, providing input
  7598. images by another video source or an input video is not required.
  7599. @subsection Examples
  7600. @itemize
  7601. @item
  7602. List all filters available:
  7603. @example
  7604. coreimage=list_filters=true
  7605. @end example
  7606. @item
  7607. Use the CIBoxBlur filter with default options to blur an image:
  7608. @example
  7609. coreimage=filter=CIBoxBlur@@default
  7610. @end example
  7611. @item
  7612. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  7613. its center at 100x100 and a radius of 50 pixels:
  7614. @example
  7615. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  7616. @end example
  7617. @item
  7618. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  7619. given as complete and escaped command-line for Apple's standard bash shell:
  7620. @example
  7621. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  7622. @end example
  7623. @end itemize
  7624. @section cover_rect
  7625. Cover a rectangular object
  7626. It accepts the following options:
  7627. @table @option
  7628. @item cover
  7629. Filepath of the optional cover image, needs to be in yuv420.
  7630. @item mode
  7631. Set covering mode.
  7632. It accepts the following values:
  7633. @table @samp
  7634. @item cover
  7635. cover it by the supplied image
  7636. @item blur
  7637. cover it by interpolating the surrounding pixels
  7638. @end table
  7639. Default value is @var{blur}.
  7640. @end table
  7641. @subsection Examples
  7642. @itemize
  7643. @item
  7644. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7645. @example
  7646. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7647. @end example
  7648. @end itemize
  7649. @section crop
  7650. Crop the input video to given dimensions.
  7651. It accepts the following parameters:
  7652. @table @option
  7653. @item w, out_w
  7654. The width of the output video. It defaults to @code{iw}.
  7655. This expression is evaluated only once during the filter
  7656. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  7657. @item h, out_h
  7658. The height of the output video. It defaults to @code{ih}.
  7659. This expression is evaluated only once during the filter
  7660. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  7661. @item x
  7662. The horizontal position, in the input video, of the left edge of the output
  7663. video. It defaults to @code{(in_w-out_w)/2}.
  7664. This expression is evaluated per-frame.
  7665. @item y
  7666. The vertical position, in the input video, of the top edge of the output video.
  7667. It defaults to @code{(in_h-out_h)/2}.
  7668. This expression is evaluated per-frame.
  7669. @item keep_aspect
  7670. If set to 1 will force the output display aspect ratio
  7671. to be the same of the input, by changing the output sample aspect
  7672. ratio. It defaults to 0.
  7673. @item exact
  7674. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  7675. width/height/x/y as specified and will not be rounded to nearest smaller value.
  7676. It defaults to 0.
  7677. @end table
  7678. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  7679. expressions containing the following constants:
  7680. @table @option
  7681. @item x
  7682. @item y
  7683. The computed values for @var{x} and @var{y}. They are evaluated for
  7684. each new frame.
  7685. @item in_w
  7686. @item in_h
  7687. The input width and height.
  7688. @item iw
  7689. @item ih
  7690. These are the same as @var{in_w} and @var{in_h}.
  7691. @item out_w
  7692. @item out_h
  7693. The output (cropped) width and height.
  7694. @item ow
  7695. @item oh
  7696. These are the same as @var{out_w} and @var{out_h}.
  7697. @item a
  7698. same as @var{iw} / @var{ih}
  7699. @item sar
  7700. input sample aspect ratio
  7701. @item dar
  7702. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7703. @item hsub
  7704. @item vsub
  7705. horizontal and vertical chroma subsample values. For example for the
  7706. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7707. @item n
  7708. The number of the input frame, starting from 0.
  7709. @item pos
  7710. the position in the file of the input frame, NAN if unknown
  7711. @item t
  7712. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  7713. @end table
  7714. The expression for @var{out_w} may depend on the value of @var{out_h},
  7715. and the expression for @var{out_h} may depend on @var{out_w}, but they
  7716. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  7717. evaluated after @var{out_w} and @var{out_h}.
  7718. The @var{x} and @var{y} parameters specify the expressions for the
  7719. position of the top-left corner of the output (non-cropped) area. They
  7720. are evaluated for each frame. If the evaluated value is not valid, it
  7721. is approximated to the nearest valid value.
  7722. The expression for @var{x} may depend on @var{y}, and the expression
  7723. for @var{y} may depend on @var{x}.
  7724. @subsection Examples
  7725. @itemize
  7726. @item
  7727. Crop area with size 100x100 at position (12,34).
  7728. @example
  7729. crop=100:100:12:34
  7730. @end example
  7731. Using named options, the example above becomes:
  7732. @example
  7733. crop=w=100:h=100:x=12:y=34
  7734. @end example
  7735. @item
  7736. Crop the central input area with size 100x100:
  7737. @example
  7738. crop=100:100
  7739. @end example
  7740. @item
  7741. Crop the central input area with size 2/3 of the input video:
  7742. @example
  7743. crop=2/3*in_w:2/3*in_h
  7744. @end example
  7745. @item
  7746. Crop the input video central square:
  7747. @example
  7748. crop=out_w=in_h
  7749. crop=in_h
  7750. @end example
  7751. @item
  7752. Delimit the rectangle with the top-left corner placed at position
  7753. 100:100 and the right-bottom corner corresponding to the right-bottom
  7754. corner of the input image.
  7755. @example
  7756. crop=in_w-100:in_h-100:100:100
  7757. @end example
  7758. @item
  7759. Crop 10 pixels from the left and right borders, and 20 pixels from
  7760. the top and bottom borders
  7761. @example
  7762. crop=in_w-2*10:in_h-2*20
  7763. @end example
  7764. @item
  7765. Keep only the bottom right quarter of the input image:
  7766. @example
  7767. crop=in_w/2:in_h/2:in_w/2:in_h/2
  7768. @end example
  7769. @item
  7770. Crop height for getting Greek harmony:
  7771. @example
  7772. crop=in_w:1/PHI*in_w
  7773. @end example
  7774. @item
  7775. Apply trembling effect:
  7776. @example
  7777. 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)
  7778. @end example
  7779. @item
  7780. Apply erratic camera effect depending on timestamp:
  7781. @example
  7782. 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)"
  7783. @end example
  7784. @item
  7785. Set x depending on the value of y:
  7786. @example
  7787. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  7788. @end example
  7789. @end itemize
  7790. @subsection Commands
  7791. This filter supports the following commands:
  7792. @table @option
  7793. @item w, out_w
  7794. @item h, out_h
  7795. @item x
  7796. @item y
  7797. Set width/height of the output video and the horizontal/vertical position
  7798. in the input video.
  7799. The command accepts the same syntax of the corresponding option.
  7800. If the specified expression is not valid, it is kept at its current
  7801. value.
  7802. @end table
  7803. @section cropdetect
  7804. Auto-detect the crop size.
  7805. It calculates the necessary cropping parameters and prints the
  7806. recommended parameters via the logging system. The detected dimensions
  7807. correspond to the non-black area of the input video.
  7808. It accepts the following parameters:
  7809. @table @option
  7810. @item limit
  7811. Set higher black value threshold, which can be optionally specified
  7812. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  7813. value greater to the set value is considered non-black. It defaults to 24.
  7814. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  7815. on the bitdepth of the pixel format.
  7816. @item round
  7817. The value which the width/height should be divisible by. It defaults to
  7818. 16. The offset is automatically adjusted to center the video. Use 2 to
  7819. get only even dimensions (needed for 4:2:2 video). 16 is best when
  7820. encoding to most video codecs.
  7821. @item skip
  7822. Set the number of initial frames for which evaluation is skipped.
  7823. Default is 2. Range is 0 to INT_MAX.
  7824. @item reset_count, reset
  7825. Set the counter that determines after how many frames cropdetect will
  7826. reset the previously detected largest video area and start over to
  7827. detect the current optimal crop area. Default value is 0.
  7828. This can be useful when channel logos distort the video area. 0
  7829. indicates 'never reset', and returns the largest area encountered during
  7830. playback.
  7831. @end table
  7832. @anchor{cue}
  7833. @section cue
  7834. Delay video filtering until a given wallclock timestamp. The filter first
  7835. passes on @option{preroll} amount of frames, then it buffers at most
  7836. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  7837. it forwards the buffered frames and also any subsequent frames coming in its
  7838. input.
  7839. The filter can be used synchronize the output of multiple ffmpeg processes for
  7840. realtime output devices like decklink. By putting the delay in the filtering
  7841. chain and pre-buffering frames the process can pass on data to output almost
  7842. immediately after the target wallclock timestamp is reached.
  7843. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  7844. some use cases.
  7845. @table @option
  7846. @item cue
  7847. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  7848. @item preroll
  7849. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  7850. @item buffer
  7851. The maximum duration of content to buffer before waiting for the cue expressed
  7852. in seconds. Default is 0.
  7853. @end table
  7854. @anchor{curves}
  7855. @section curves
  7856. Apply color adjustments using curves.
  7857. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  7858. component (red, green and blue) has its values defined by @var{N} key points
  7859. tied from each other using a smooth curve. The x-axis represents the pixel
  7860. values from the input frame, and the y-axis the new pixel values to be set for
  7861. the output frame.
  7862. By default, a component curve is defined by the two points @var{(0;0)} and
  7863. @var{(1;1)}. This creates a straight line where each original pixel value is
  7864. "adjusted" to its own value, which means no change to the image.
  7865. The filter allows you to redefine these two points and add some more. A new
  7866. curve (using a natural cubic spline interpolation) will be define to pass
  7867. smoothly through all these new coordinates. The new defined points needs to be
  7868. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  7869. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  7870. the vector spaces, the values will be clipped accordingly.
  7871. The filter accepts the following options:
  7872. @table @option
  7873. @item preset
  7874. Select one of the available color presets. This option can be used in addition
  7875. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  7876. options takes priority on the preset values.
  7877. Available presets are:
  7878. @table @samp
  7879. @item none
  7880. @item color_negative
  7881. @item cross_process
  7882. @item darker
  7883. @item increase_contrast
  7884. @item lighter
  7885. @item linear_contrast
  7886. @item medium_contrast
  7887. @item negative
  7888. @item strong_contrast
  7889. @item vintage
  7890. @end table
  7891. Default is @code{none}.
  7892. @item master, m
  7893. Set the master key points. These points will define a second pass mapping. It
  7894. is sometimes called a "luminance" or "value" mapping. It can be used with
  7895. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  7896. post-processing LUT.
  7897. @item red, r
  7898. Set the key points for the red component.
  7899. @item green, g
  7900. Set the key points for the green component.
  7901. @item blue, b
  7902. Set the key points for the blue component.
  7903. @item all
  7904. Set the key points for all components (not including master).
  7905. Can be used in addition to the other key points component
  7906. options. In this case, the unset component(s) will fallback on this
  7907. @option{all} setting.
  7908. @item psfile
  7909. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  7910. @item plot
  7911. Save Gnuplot script of the curves in specified file.
  7912. @end table
  7913. To avoid some filtergraph syntax conflicts, each key points list need to be
  7914. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  7915. @subsection Commands
  7916. This filter supports same @ref{commands} as options.
  7917. @subsection Examples
  7918. @itemize
  7919. @item
  7920. Increase slightly the middle level of blue:
  7921. @example
  7922. curves=blue='0/0 0.5/0.58 1/1'
  7923. @end example
  7924. @item
  7925. Vintage effect:
  7926. @example
  7927. 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'
  7928. @end example
  7929. Here we obtain the following coordinates for each components:
  7930. @table @var
  7931. @item red
  7932. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  7933. @item green
  7934. @code{(0;0) (0.50;0.48) (1;1)}
  7935. @item blue
  7936. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  7937. @end table
  7938. @item
  7939. The previous example can also be achieved with the associated built-in preset:
  7940. @example
  7941. curves=preset=vintage
  7942. @end example
  7943. @item
  7944. Or simply:
  7945. @example
  7946. curves=vintage
  7947. @end example
  7948. @item
  7949. Use a Photoshop preset and redefine the points of the green component:
  7950. @example
  7951. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  7952. @end example
  7953. @item
  7954. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  7955. and @command{gnuplot}:
  7956. @example
  7957. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  7958. gnuplot -p /tmp/curves.plt
  7959. @end example
  7960. @end itemize
  7961. @section datascope
  7962. Video data analysis filter.
  7963. This filter shows hexadecimal pixel values of part of video.
  7964. The filter accepts the following options:
  7965. @table @option
  7966. @item size, s
  7967. Set output video size.
  7968. @item x
  7969. Set x offset from where to pick pixels.
  7970. @item y
  7971. Set y offset from where to pick pixels.
  7972. @item mode
  7973. Set scope mode, can be one of the following:
  7974. @table @samp
  7975. @item mono
  7976. Draw hexadecimal pixel values with white color on black background.
  7977. @item color
  7978. Draw hexadecimal pixel values with input video pixel color on black
  7979. background.
  7980. @item color2
  7981. Draw hexadecimal pixel values on color background picked from input video,
  7982. the text color is picked in such way so its always visible.
  7983. @end table
  7984. @item axis
  7985. Draw rows and columns numbers on left and top of video.
  7986. @item opacity
  7987. Set background opacity.
  7988. @item format
  7989. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7990. @item components
  7991. Set pixel components to display. By default all pixel components are displayed.
  7992. @end table
  7993. @subsection Commands
  7994. This filter supports same @ref{commands} as options excluding @code{size} option.
  7995. @section dblur
  7996. Apply Directional blur filter.
  7997. The filter accepts the following options:
  7998. @table @option
  7999. @item angle
  8000. Set angle of directional blur. Default is @code{45}.
  8001. @item radius
  8002. Set radius of directional blur. Default is @code{5}.
  8003. @item planes
  8004. Set which planes to filter. By default all planes are filtered.
  8005. @end table
  8006. @subsection Commands
  8007. This filter supports same @ref{commands} as options.
  8008. The command accepts the same syntax of the corresponding option.
  8009. If the specified expression is not valid, it is kept at its current
  8010. value.
  8011. @section dctdnoiz
  8012. Denoise frames using 2D DCT (frequency domain filtering).
  8013. This filter is not designed for real time.
  8014. The filter accepts the following options:
  8015. @table @option
  8016. @item sigma, s
  8017. Set the noise sigma constant.
  8018. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  8019. coefficient (absolute value) below this threshold with be dropped.
  8020. If you need a more advanced filtering, see @option{expr}.
  8021. Default is @code{0}.
  8022. @item overlap
  8023. Set number overlapping pixels for each block. Since the filter can be slow, you
  8024. may want to reduce this value, at the cost of a less effective filter and the
  8025. risk of various artefacts.
  8026. If the overlapping value doesn't permit processing the whole input width or
  8027. height, a warning will be displayed and according borders won't be denoised.
  8028. Default value is @var{blocksize}-1, which is the best possible setting.
  8029. @item expr, e
  8030. Set the coefficient factor expression.
  8031. For each coefficient of a DCT block, this expression will be evaluated as a
  8032. multiplier value for the coefficient.
  8033. If this is option is set, the @option{sigma} option will be ignored.
  8034. The absolute value of the coefficient can be accessed through the @var{c}
  8035. variable.
  8036. @item n
  8037. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  8038. @var{blocksize}, which is the width and height of the processed blocks.
  8039. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  8040. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  8041. on the speed processing. Also, a larger block size does not necessarily means a
  8042. better de-noising.
  8043. @end table
  8044. @subsection Examples
  8045. Apply a denoise with a @option{sigma} of @code{4.5}:
  8046. @example
  8047. dctdnoiz=4.5
  8048. @end example
  8049. The same operation can be achieved using the expression system:
  8050. @example
  8051. dctdnoiz=e='gte(c, 4.5*3)'
  8052. @end example
  8053. Violent denoise using a block size of @code{16x16}:
  8054. @example
  8055. dctdnoiz=15:n=4
  8056. @end example
  8057. @section deband
  8058. Remove banding artifacts from input video.
  8059. It works by replacing banded pixels with average value of referenced pixels.
  8060. The filter accepts the following options:
  8061. @table @option
  8062. @item 1thr
  8063. @item 2thr
  8064. @item 3thr
  8065. @item 4thr
  8066. Set banding detection threshold for each plane. Default is 0.02.
  8067. Valid range is 0.00003 to 0.5.
  8068. If difference between current pixel and reference pixel is less than threshold,
  8069. it will be considered as banded.
  8070. @item range, r
  8071. Banding detection range in pixels. Default is 16. If positive, random number
  8072. in range 0 to set value will be used. If negative, exact absolute value
  8073. will be used.
  8074. The range defines square of four pixels around current pixel.
  8075. @item direction, d
  8076. Set direction in radians from which four pixel will be compared. If positive,
  8077. random direction from 0 to set direction will be picked. If negative, exact of
  8078. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  8079. will pick only pixels on same row and -PI/2 will pick only pixels on same
  8080. column.
  8081. @item blur, b
  8082. If enabled, current pixel is compared with average value of all four
  8083. surrounding pixels. The default is enabled. If disabled current pixel is
  8084. compared with all four surrounding pixels. The pixel is considered banded
  8085. if only all four differences with surrounding pixels are less than threshold.
  8086. @item coupling, c
  8087. If enabled, current pixel is changed if and only if all pixel components are banded,
  8088. e.g. banding detection threshold is triggered for all color components.
  8089. The default is disabled.
  8090. @end table
  8091. @subsection Commands
  8092. This filter supports the all above options as @ref{commands}.
  8093. @section deblock
  8094. Remove blocking artifacts from input video.
  8095. The filter accepts the following options:
  8096. @table @option
  8097. @item filter
  8098. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  8099. This controls what kind of deblocking is applied.
  8100. @item block
  8101. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  8102. @item alpha
  8103. @item beta
  8104. @item gamma
  8105. @item delta
  8106. Set blocking detection thresholds. Allowed range is 0 to 1.
  8107. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  8108. Using higher threshold gives more deblocking strength.
  8109. Setting @var{alpha} controls threshold detection at exact edge of block.
  8110. Remaining options controls threshold detection near the edge. Each one for
  8111. below/above or left/right. Setting any of those to @var{0} disables
  8112. deblocking.
  8113. @item planes
  8114. Set planes to filter. Default is to filter all available planes.
  8115. @end table
  8116. @subsection Examples
  8117. @itemize
  8118. @item
  8119. Deblock using weak filter and block size of 4 pixels.
  8120. @example
  8121. deblock=filter=weak:block=4
  8122. @end example
  8123. @item
  8124. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  8125. deblocking more edges.
  8126. @example
  8127. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  8128. @end example
  8129. @item
  8130. Similar as above, but filter only first plane.
  8131. @example
  8132. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  8133. @end example
  8134. @item
  8135. Similar as above, but filter only second and third plane.
  8136. @example
  8137. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  8138. @end example
  8139. @end itemize
  8140. @subsection Commands
  8141. This filter supports the all above options as @ref{commands}.
  8142. @anchor{decimate}
  8143. @section decimate
  8144. Drop duplicated frames at regular intervals.
  8145. The filter accepts the following options:
  8146. @table @option
  8147. @item cycle
  8148. Set the number of frames from which one will be dropped. Setting this to
  8149. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  8150. Default is @code{5}.
  8151. @item dupthresh
  8152. Set the threshold for duplicate detection. If the difference metric for a frame
  8153. is less than or equal to this value, then it is declared as duplicate. Default
  8154. is @code{1.1}
  8155. @item scthresh
  8156. Set scene change threshold. Default is @code{15}.
  8157. @item blockx
  8158. @item blocky
  8159. Set the size of the x and y-axis blocks used during metric calculations.
  8160. Larger blocks give better noise suppression, but also give worse detection of
  8161. small movements. Must be a power of two. Default is @code{32}.
  8162. @item ppsrc
  8163. Mark main input as a pre-processed input and activate clean source input
  8164. stream. This allows the input to be pre-processed with various filters to help
  8165. the metrics calculation while keeping the frame selection lossless. When set to
  8166. @code{1}, the first stream is for the pre-processed input, and the second
  8167. stream is the clean source from where the kept frames are chosen. Default is
  8168. @code{0}.
  8169. @item chroma
  8170. Set whether or not chroma is considered in the metric calculations. Default is
  8171. @code{1}.
  8172. @end table
  8173. @section deconvolve
  8174. Apply 2D deconvolution of video stream in frequency domain using second stream
  8175. as impulse.
  8176. The filter accepts the following options:
  8177. @table @option
  8178. @item planes
  8179. Set which planes to process.
  8180. @item impulse
  8181. Set which impulse video frames will be processed, can be @var{first}
  8182. or @var{all}. Default is @var{all}.
  8183. @item noise
  8184. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  8185. and height are not same and not power of 2 or if stream prior to convolving
  8186. had noise.
  8187. @end table
  8188. The @code{deconvolve} filter also supports the @ref{framesync} options.
  8189. @section dedot
  8190. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  8191. It accepts the following options:
  8192. @table @option
  8193. @item m
  8194. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  8195. @var{rainbows} for cross-color reduction.
  8196. @item lt
  8197. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  8198. @item tl
  8199. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  8200. @item tc
  8201. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  8202. @item ct
  8203. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  8204. @end table
  8205. @section deflate
  8206. Apply deflate effect to the video.
  8207. This filter replaces the pixel by the local(3x3) average by taking into account
  8208. only values lower than the pixel.
  8209. It accepts the following options:
  8210. @table @option
  8211. @item threshold0
  8212. @item threshold1
  8213. @item threshold2
  8214. @item threshold3
  8215. Limit the maximum change for each plane, default is 65535.
  8216. If 0, plane will remain unchanged.
  8217. @end table
  8218. @subsection Commands
  8219. This filter supports the all above options as @ref{commands}.
  8220. @section deflicker
  8221. Remove temporal frame luminance variations.
  8222. It accepts the following options:
  8223. @table @option
  8224. @item size, s
  8225. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  8226. @item mode, m
  8227. Set averaging mode to smooth temporal luminance variations.
  8228. Available values are:
  8229. @table @samp
  8230. @item am
  8231. Arithmetic mean
  8232. @item gm
  8233. Geometric mean
  8234. @item hm
  8235. Harmonic mean
  8236. @item qm
  8237. Quadratic mean
  8238. @item cm
  8239. Cubic mean
  8240. @item pm
  8241. Power mean
  8242. @item median
  8243. Median
  8244. @end table
  8245. @item bypass
  8246. Do not actually modify frame. Useful when one only wants metadata.
  8247. @end table
  8248. @section dejudder
  8249. Remove judder produced by partially interlaced telecined content.
  8250. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8251. source was partially telecined content then the output of @code{pullup,dejudder}
  8252. will have a variable frame rate. May change the recorded frame rate of the
  8253. container. Aside from that change, this filter will not affect constant frame
  8254. rate video.
  8255. The option available in this filter is:
  8256. @table @option
  8257. @item cycle
  8258. Specify the length of the window over which the judder repeats.
  8259. Accepts any integer greater than 1. Useful values are:
  8260. @table @samp
  8261. @item 4
  8262. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8263. @item 5
  8264. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8265. @item 20
  8266. If a mixture of the two.
  8267. @end table
  8268. The default is @samp{4}.
  8269. @end table
  8270. @section delogo
  8271. Suppress a TV station logo by a simple interpolation of the surrounding
  8272. pixels. Just set a rectangle covering the logo and watch it disappear
  8273. (and sometimes something even uglier appear - your mileage may vary).
  8274. It accepts the following parameters:
  8275. @table @option
  8276. @item x
  8277. @item y
  8278. Specify the top left corner coordinates of the logo. They must be
  8279. specified.
  8280. @item w
  8281. @item h
  8282. Specify the width and height of the logo to clear. They must be
  8283. specified.
  8284. @item show
  8285. When set to 1, a green rectangle is drawn on the screen to simplify
  8286. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8287. The default value is 0.
  8288. The rectangle is drawn on the outermost pixels which will be (partly)
  8289. replaced with interpolated values. The values of the next pixels
  8290. immediately outside this rectangle in each direction will be used to
  8291. compute the interpolated pixel values inside the rectangle.
  8292. @end table
  8293. @subsection Examples
  8294. @itemize
  8295. @item
  8296. Set a rectangle covering the area with top left corner coordinates 0,0
  8297. and size 100x77:
  8298. @example
  8299. delogo=x=0:y=0:w=100:h=77
  8300. @end example
  8301. @end itemize
  8302. @anchor{derain}
  8303. @section derain
  8304. Remove the rain in the input image/video by applying the derain methods based on
  8305. convolutional neural networks. Supported models:
  8306. @itemize
  8307. @item
  8308. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8309. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8310. @end itemize
  8311. Training as well as model generation scripts are provided in
  8312. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8313. Native model files (.model) can be generated from TensorFlow model
  8314. files (.pb) by using tools/python/convert.py
  8315. The filter accepts the following options:
  8316. @table @option
  8317. @item filter_type
  8318. Specify which filter to use. This option accepts the following values:
  8319. @table @samp
  8320. @item derain
  8321. Derain filter. To conduct derain filter, you need to use a derain model.
  8322. @item dehaze
  8323. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  8324. @end table
  8325. Default value is @samp{derain}.
  8326. @item dnn_backend
  8327. Specify which DNN backend to use for model loading and execution. This option accepts
  8328. the following values:
  8329. @table @samp
  8330. @item native
  8331. Native implementation of DNN loading and execution.
  8332. @item tensorflow
  8333. TensorFlow backend. To enable this backend you
  8334. need to install the TensorFlow for C library (see
  8335. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8336. @code{--enable-libtensorflow}
  8337. @end table
  8338. Default value is @samp{native}.
  8339. @item model
  8340. Set path to model file specifying network architecture and its parameters.
  8341. Note that different backends use different file formats. TensorFlow and native
  8342. backend can load files for only its format.
  8343. @end table
  8344. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  8345. @section deshake
  8346. Attempt to fix small changes in horizontal and/or vertical shift. This
  8347. filter helps remove camera shake from hand-holding a camera, bumping a
  8348. tripod, moving on a vehicle, etc.
  8349. The filter accepts the following options:
  8350. @table @option
  8351. @item x
  8352. @item y
  8353. @item w
  8354. @item h
  8355. Specify a rectangular area where to limit the search for motion
  8356. vectors.
  8357. If desired the search for motion vectors can be limited to a
  8358. rectangular area of the frame defined by its top left corner, width
  8359. and height. These parameters have the same meaning as the drawbox
  8360. filter which can be used to visualise the position of the bounding
  8361. box.
  8362. This is useful when simultaneous movement of subjects within the frame
  8363. might be confused for camera motion by the motion vector search.
  8364. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  8365. then the full frame is used. This allows later options to be set
  8366. without specifying the bounding box for the motion vector search.
  8367. Default - search the whole frame.
  8368. @item rx
  8369. @item ry
  8370. Specify the maximum extent of movement in x and y directions in the
  8371. range 0-64 pixels. Default 16.
  8372. @item edge
  8373. Specify how to generate pixels to fill blanks at the edge of the
  8374. frame. Available values are:
  8375. @table @samp
  8376. @item blank, 0
  8377. Fill zeroes at blank locations
  8378. @item original, 1
  8379. Original image at blank locations
  8380. @item clamp, 2
  8381. Extruded edge value at blank locations
  8382. @item mirror, 3
  8383. Mirrored edge at blank locations
  8384. @end table
  8385. Default value is @samp{mirror}.
  8386. @item blocksize
  8387. Specify the blocksize to use for motion search. Range 4-128 pixels,
  8388. default 8.
  8389. @item contrast
  8390. Specify the contrast threshold for blocks. Only blocks with more than
  8391. the specified contrast (difference between darkest and lightest
  8392. pixels) will be considered. Range 1-255, default 125.
  8393. @item search
  8394. Specify the search strategy. Available values are:
  8395. @table @samp
  8396. @item exhaustive, 0
  8397. Set exhaustive search
  8398. @item less, 1
  8399. Set less exhaustive search.
  8400. @end table
  8401. Default value is @samp{exhaustive}.
  8402. @item filename
  8403. If set then a detailed log of the motion search is written to the
  8404. specified file.
  8405. @end table
  8406. @section despill
  8407. Remove unwanted contamination of foreground colors, caused by reflected color of
  8408. greenscreen or bluescreen.
  8409. This filter accepts the following options:
  8410. @table @option
  8411. @item type
  8412. Set what type of despill to use.
  8413. @item mix
  8414. Set how spillmap will be generated.
  8415. @item expand
  8416. Set how much to get rid of still remaining spill.
  8417. @item red
  8418. Controls amount of red in spill area.
  8419. @item green
  8420. Controls amount of green in spill area.
  8421. Should be -1 for greenscreen.
  8422. @item blue
  8423. Controls amount of blue in spill area.
  8424. Should be -1 for bluescreen.
  8425. @item brightness
  8426. Controls brightness of spill area, preserving colors.
  8427. @item alpha
  8428. Modify alpha from generated spillmap.
  8429. @end table
  8430. @subsection Commands
  8431. This filter supports the all above options as @ref{commands}.
  8432. @section detelecine
  8433. Apply an exact inverse of the telecine operation. It requires a predefined
  8434. pattern specified using the pattern option which must be the same as that passed
  8435. to the telecine filter.
  8436. This filter accepts the following options:
  8437. @table @option
  8438. @item first_field
  8439. @table @samp
  8440. @item top, t
  8441. top field first
  8442. @item bottom, b
  8443. bottom field first
  8444. The default value is @code{top}.
  8445. @end table
  8446. @item pattern
  8447. A string of numbers representing the pulldown pattern you wish to apply.
  8448. The default value is @code{23}.
  8449. @item start_frame
  8450. A number representing position of the first frame with respect to the telecine
  8451. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  8452. @end table
  8453. @anchor{dilation}
  8454. @section dilation
  8455. Apply dilation effect to the video.
  8456. This filter replaces the pixel by the local(3x3) maximum.
  8457. It accepts the following options:
  8458. @table @option
  8459. @item threshold0
  8460. @item threshold1
  8461. @item threshold2
  8462. @item threshold3
  8463. Limit the maximum change for each plane, default is 65535.
  8464. If 0, plane will remain unchanged.
  8465. @item coordinates
  8466. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8467. pixels are used.
  8468. Flags to local 3x3 coordinates maps like this:
  8469. 1 2 3
  8470. 4 5
  8471. 6 7 8
  8472. @end table
  8473. @subsection Commands
  8474. This filter supports the all above options as @ref{commands}.
  8475. @section displace
  8476. Displace pixels as indicated by second and third input stream.
  8477. It takes three input streams and outputs one stream, the first input is the
  8478. source, and second and third input are displacement maps.
  8479. The second input specifies how much to displace pixels along the
  8480. x-axis, while the third input specifies how much to displace pixels
  8481. along the y-axis.
  8482. If one of displacement map streams terminates, last frame from that
  8483. displacement map will be used.
  8484. Note that once generated, displacements maps can be reused over and over again.
  8485. A description of the accepted options follows.
  8486. @table @option
  8487. @item edge
  8488. Set displace behavior for pixels that are out of range.
  8489. Available values are:
  8490. @table @samp
  8491. @item blank
  8492. Missing pixels are replaced by black pixels.
  8493. @item smear
  8494. Adjacent pixels will spread out to replace missing pixels.
  8495. @item wrap
  8496. Out of range pixels are wrapped so they point to pixels of other side.
  8497. @item mirror
  8498. Out of range pixels will be replaced with mirrored pixels.
  8499. @end table
  8500. Default is @samp{smear}.
  8501. @end table
  8502. @subsection Examples
  8503. @itemize
  8504. @item
  8505. Add ripple effect to rgb input of video size hd720:
  8506. @example
  8507. 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
  8508. @end example
  8509. @item
  8510. Add wave effect to rgb input of video size hd720:
  8511. @example
  8512. 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
  8513. @end example
  8514. @end itemize
  8515. @section dnn_classify
  8516. Do classification with deep neural networks based on bounding boxes.
  8517. The filter accepts the following options:
  8518. @table @option
  8519. @item dnn_backend
  8520. Specify which DNN backend to use for model loading and execution. This option accepts
  8521. only openvino now, tensorflow backends will be added.
  8522. @item model
  8523. Set path to model file specifying network architecture and its parameters.
  8524. Note that different backends use different file formats.
  8525. @item input
  8526. Set the input name of the dnn network.
  8527. @item output
  8528. Set the output name of the dnn network.
  8529. @item confidence
  8530. Set the confidence threshold (default: 0.5).
  8531. @item labels
  8532. Set path to label file specifying the mapping between label id and name.
  8533. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8534. The first line is the name of label id 0,
  8535. and the second line is the name of label id 1, etc.
  8536. The label id is considered as name if the label file is not provided.
  8537. @item backend_configs
  8538. Set the configs to be passed into backend
  8539. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8540. please use tools/python/tf_sess_config.py to get the configs for your system.
  8541. @end table
  8542. @section dnn_detect
  8543. Do object detection with deep neural networks.
  8544. The filter accepts the following options:
  8545. @table @option
  8546. @item dnn_backend
  8547. Specify which DNN backend to use for model loading and execution. This option accepts
  8548. only openvino now, tensorflow backends will be added.
  8549. @item model
  8550. Set path to model file specifying network architecture and its parameters.
  8551. Note that different backends use different file formats.
  8552. @item input
  8553. Set the input name of the dnn network.
  8554. @item output
  8555. Set the output name of the dnn network.
  8556. @item confidence
  8557. Set the confidence threshold (default: 0.5).
  8558. @item labels
  8559. Set path to label file specifying the mapping between label id and name.
  8560. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8561. The first line is the name of label id 0 (usually it is 'background'),
  8562. and the second line is the name of label id 1, etc.
  8563. The label id is considered as name if the label file is not provided.
  8564. @item backend_configs
  8565. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8566. Roll back to sync execution if the backend does not support async.
  8567. @end table
  8568. @anchor{dnn_processing}
  8569. @section dnn_processing
  8570. Do image processing with deep neural networks. It works together with another filter
  8571. which converts the pixel format of the Frame to what the dnn network requires.
  8572. The filter accepts the following options:
  8573. @table @option
  8574. @item dnn_backend
  8575. Specify which DNN backend to use for model loading and execution. This option accepts
  8576. the following values:
  8577. @table @samp
  8578. @item native
  8579. Native implementation of DNN loading and execution.
  8580. @item tensorflow
  8581. TensorFlow backend. To enable this backend you
  8582. need to install the TensorFlow for C library (see
  8583. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8584. @code{--enable-libtensorflow}
  8585. @item openvino
  8586. OpenVINO backend. To enable this backend you
  8587. need to build and install the OpenVINO for C library (see
  8588. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  8589. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  8590. be needed if the header files and libraries are not installed into system path)
  8591. @end table
  8592. Default value is @samp{native}.
  8593. @item model
  8594. Set path to model file specifying network architecture and its parameters.
  8595. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  8596. backend can load files for only its format.
  8597. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  8598. @item input
  8599. Set the input name of the dnn network.
  8600. @item output
  8601. Set the output name of the dnn network.
  8602. @item backend_configs
  8603. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8604. Roll back to sync execution if the backend does not support async.
  8605. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8606. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8607. @end table
  8608. @subsection Examples
  8609. @itemize
  8610. @item
  8611. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  8612. @example
  8613. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  8614. @end example
  8615. @item
  8616. Halve the pixel value of the frame with format gray32f:
  8617. @example
  8618. 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
  8619. @end example
  8620. @item
  8621. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  8622. @example
  8623. ./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
  8624. @end example
  8625. @item
  8626. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  8627. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8628. @example
  8629. ./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
  8630. @end example
  8631. @end itemize
  8632. @section drawbox
  8633. Draw a colored box on the input image.
  8634. It accepts the following parameters:
  8635. @table @option
  8636. @item x
  8637. @item y
  8638. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  8639. @item width, w
  8640. @item height, h
  8641. The expressions which specify the width and height of the box; if 0 they are interpreted as
  8642. the input width and height. It defaults to 0.
  8643. @item color, c
  8644. Specify the color of the box to write. For the general syntax of this option,
  8645. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8646. value @code{invert} is used, the box edge color is the same as the
  8647. video with inverted luma.
  8648. @item thickness, t
  8649. The expression which sets the thickness of the box edge.
  8650. A value of @code{fill} will create a filled box. Default value is @code{3}.
  8651. See below for the list of accepted constants.
  8652. @item replace
  8653. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  8654. will overwrite the video's color and alpha pixels.
  8655. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  8656. @end table
  8657. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8658. following constants:
  8659. @table @option
  8660. @item dar
  8661. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8662. @item hsub
  8663. @item vsub
  8664. horizontal and vertical chroma subsample values. For example for the
  8665. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8666. @item in_h, ih
  8667. @item in_w, iw
  8668. The input width and height.
  8669. @item sar
  8670. The input sample aspect ratio.
  8671. @item x
  8672. @item y
  8673. The x and y offset coordinates where the box is drawn.
  8674. @item w
  8675. @item h
  8676. The width and height of the drawn box.
  8677. @item box_source
  8678. Box source can be set as side_data_detection_bboxes if you want to use box data in
  8679. detection bboxes of side data.
  8680. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  8681. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  8682. not sure about the box source.
  8683. @item t
  8684. The thickness of the drawn box.
  8685. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  8686. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  8687. @end table
  8688. @subsection Examples
  8689. @itemize
  8690. @item
  8691. Draw a black box around the edge of the input image:
  8692. @example
  8693. drawbox
  8694. @end example
  8695. @item
  8696. Draw a box with color red and an opacity of 50%:
  8697. @example
  8698. drawbox=10:20:200:60:red@@0.5
  8699. @end example
  8700. The previous example can be specified as:
  8701. @example
  8702. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  8703. @end example
  8704. @item
  8705. Fill the box with pink color:
  8706. @example
  8707. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  8708. @end example
  8709. @item
  8710. Draw a 2-pixel red 2.40:1 mask:
  8711. @example
  8712. 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
  8713. @end example
  8714. @end itemize
  8715. @subsection Commands
  8716. This filter supports same commands as options.
  8717. The command accepts the same syntax of the corresponding option.
  8718. If the specified expression is not valid, it is kept at its current
  8719. value.
  8720. @anchor{drawgraph}
  8721. @section drawgraph
  8722. Draw a graph using input video metadata.
  8723. It accepts the following parameters:
  8724. @table @option
  8725. @item m1
  8726. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  8727. @item fg1
  8728. Set 1st foreground color expression.
  8729. @item m2
  8730. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  8731. @item fg2
  8732. Set 2nd foreground color expression.
  8733. @item m3
  8734. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  8735. @item fg3
  8736. Set 3rd foreground color expression.
  8737. @item m4
  8738. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  8739. @item fg4
  8740. Set 4th foreground color expression.
  8741. @item min
  8742. Set minimal value of metadata value.
  8743. @item max
  8744. Set maximal value of metadata value.
  8745. @item bg
  8746. Set graph background color. Default is white.
  8747. @item mode
  8748. Set graph mode.
  8749. Available values for mode is:
  8750. @table @samp
  8751. @item bar
  8752. @item dot
  8753. @item line
  8754. @end table
  8755. Default is @code{line}.
  8756. @item slide
  8757. Set slide mode.
  8758. Available values for slide is:
  8759. @table @samp
  8760. @item frame
  8761. Draw new frame when right border is reached.
  8762. @item replace
  8763. Replace old columns with new ones.
  8764. @item scroll
  8765. Scroll from right to left.
  8766. @item rscroll
  8767. Scroll from left to right.
  8768. @item picture
  8769. Draw single picture.
  8770. @end table
  8771. Default is @code{frame}.
  8772. @item size
  8773. Set size of graph video. For the syntax of this option, check the
  8774. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8775. The default value is @code{900x256}.
  8776. @item rate, r
  8777. Set the output frame rate. Default value is @code{25}.
  8778. The foreground color expressions can use the following variables:
  8779. @table @option
  8780. @item MIN
  8781. Minimal value of metadata value.
  8782. @item MAX
  8783. Maximal value of metadata value.
  8784. @item VAL
  8785. Current metadata key value.
  8786. @end table
  8787. The color is defined as 0xAABBGGRR.
  8788. @end table
  8789. Example using metadata from @ref{signalstats} filter:
  8790. @example
  8791. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  8792. @end example
  8793. Example using metadata from @ref{ebur128} filter:
  8794. @example
  8795. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  8796. @end example
  8797. @section drawgrid
  8798. Draw a grid on the input image.
  8799. It accepts the following parameters:
  8800. @table @option
  8801. @item x
  8802. @item y
  8803. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  8804. @item width, w
  8805. @item height, h
  8806. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  8807. input width and height, respectively, minus @code{thickness}, so image gets
  8808. framed. Default to 0.
  8809. @item color, c
  8810. Specify the color of the grid. For the general syntax of this option,
  8811. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8812. value @code{invert} is used, the grid color is the same as the
  8813. video with inverted luma.
  8814. @item thickness, t
  8815. The expression which sets the thickness of the grid line. Default value is @code{1}.
  8816. See below for the list of accepted constants.
  8817. @item replace
  8818. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  8819. will overwrite the video's color and alpha pixels.
  8820. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  8821. @end table
  8822. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8823. following constants:
  8824. @table @option
  8825. @item dar
  8826. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8827. @item hsub
  8828. @item vsub
  8829. horizontal and vertical chroma subsample values. For example for the
  8830. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8831. @item in_h, ih
  8832. @item in_w, iw
  8833. The input grid cell width and height.
  8834. @item sar
  8835. The input sample aspect ratio.
  8836. @item x
  8837. @item y
  8838. The x and y coordinates of some point of grid intersection (meant to configure offset).
  8839. @item w
  8840. @item h
  8841. The width and height of the drawn cell.
  8842. @item t
  8843. The thickness of the drawn cell.
  8844. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  8845. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  8846. @end table
  8847. @subsection Examples
  8848. @itemize
  8849. @item
  8850. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  8851. @example
  8852. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  8853. @end example
  8854. @item
  8855. Draw a white 3x3 grid with an opacity of 50%:
  8856. @example
  8857. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  8858. @end example
  8859. @end itemize
  8860. @subsection Commands
  8861. This filter supports same commands as options.
  8862. The command accepts the same syntax of the corresponding option.
  8863. If the specified expression is not valid, it is kept at its current
  8864. value.
  8865. @anchor{drawtext}
  8866. @section drawtext
  8867. Draw a text string or text from a specified file on top of a video, using the
  8868. libfreetype library.
  8869. To enable compilation of this filter, you need to configure FFmpeg with
  8870. @code{--enable-libfreetype}.
  8871. To enable default font fallback and the @var{font} option you need to
  8872. configure FFmpeg with @code{--enable-libfontconfig}.
  8873. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  8874. @code{--enable-libfribidi}.
  8875. @subsection Syntax
  8876. It accepts the following parameters:
  8877. @table @option
  8878. @item box
  8879. Used to draw a box around text using the background color.
  8880. The value must be either 1 (enable) or 0 (disable).
  8881. The default value of @var{box} is 0.
  8882. @item boxborderw
  8883. Set the width of the border to be drawn around the box using @var{boxcolor}.
  8884. The default value of @var{boxborderw} is 0.
  8885. @item boxcolor
  8886. The color to be used for drawing box around text. For the syntax of this
  8887. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8888. The default value of @var{boxcolor} is "white".
  8889. @item line_spacing
  8890. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  8891. The default value of @var{line_spacing} is 0.
  8892. @item borderw
  8893. Set the width of the border to be drawn around the text using @var{bordercolor}.
  8894. The default value of @var{borderw} is 0.
  8895. @item bordercolor
  8896. Set the color to be used for drawing border around text. For the syntax of this
  8897. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8898. The default value of @var{bordercolor} is "black".
  8899. @item expansion
  8900. Select how the @var{text} is expanded. Can be either @code{none},
  8901. @code{strftime} (deprecated) or
  8902. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  8903. below for details.
  8904. @item basetime
  8905. Set a start time for the count. Value is in microseconds. Only applied
  8906. in the deprecated strftime expansion mode. To emulate in normal expansion
  8907. mode use the @code{pts} function, supplying the start time (in seconds)
  8908. as the second argument.
  8909. @item fix_bounds
  8910. If true, check and fix text coords to avoid clipping.
  8911. @item fontcolor
  8912. The color to be used for drawing fonts. For the syntax of this option, check
  8913. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8914. The default value of @var{fontcolor} is "black".
  8915. @item fontcolor_expr
  8916. String which is expanded the same way as @var{text} to obtain dynamic
  8917. @var{fontcolor} value. By default this option has empty value and is not
  8918. processed. When this option is set, it overrides @var{fontcolor} option.
  8919. @item font
  8920. The font family to be used for drawing text. By default Sans.
  8921. @item fontfile
  8922. The font file to be used for drawing text. The path must be included.
  8923. This parameter is mandatory if the fontconfig support is disabled.
  8924. @item alpha
  8925. Draw the text applying alpha blending. The value can
  8926. be a number between 0.0 and 1.0.
  8927. The expression accepts the same variables @var{x, y} as well.
  8928. The default value is 1.
  8929. Please see @var{fontcolor_expr}.
  8930. @item fontsize
  8931. The font size to be used for drawing text.
  8932. The default value of @var{fontsize} is 16.
  8933. @item text_shaping
  8934. If set to 1, attempt to shape the text (for example, reverse the order of
  8935. right-to-left text and join Arabic characters) before drawing it.
  8936. Otherwise, just draw the text exactly as given.
  8937. By default 1 (if supported).
  8938. @item ft_load_flags
  8939. The flags to be used for loading the fonts.
  8940. The flags map the corresponding flags supported by libfreetype, and are
  8941. a combination of the following values:
  8942. @table @var
  8943. @item default
  8944. @item no_scale
  8945. @item no_hinting
  8946. @item render
  8947. @item no_bitmap
  8948. @item vertical_layout
  8949. @item force_autohint
  8950. @item crop_bitmap
  8951. @item pedantic
  8952. @item ignore_global_advance_width
  8953. @item no_recurse
  8954. @item ignore_transform
  8955. @item monochrome
  8956. @item linear_design
  8957. @item no_autohint
  8958. @end table
  8959. Default value is "default".
  8960. For more information consult the documentation for the FT_LOAD_*
  8961. libfreetype flags.
  8962. @item shadowcolor
  8963. The color to be used for drawing a shadow behind the drawn text. For the
  8964. syntax of this option, check the @ref{color syntax,,"Color" section in the
  8965. ffmpeg-utils manual,ffmpeg-utils}.
  8966. The default value of @var{shadowcolor} is "black".
  8967. @item shadowx
  8968. @item shadowy
  8969. The x and y offsets for the text shadow position with respect to the
  8970. position of the text. They can be either positive or negative
  8971. values. The default value for both is "0".
  8972. @item start_number
  8973. The starting frame number for the n/frame_num variable. The default value
  8974. is "0".
  8975. @item tabsize
  8976. The size in number of spaces to use for rendering the tab.
  8977. Default value is 4.
  8978. @item timecode
  8979. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  8980. format. It can be used with or without text parameter. @var{timecode_rate}
  8981. option must be specified.
  8982. @item timecode_rate, rate, r
  8983. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  8984. integer. Minimum value is "1".
  8985. Drop-frame timecode is supported for frame rates 30 & 60.
  8986. @item tc24hmax
  8987. If set to 1, the output of the timecode option will wrap around at 24 hours.
  8988. Default is 0 (disabled).
  8989. @item text
  8990. The text string to be drawn. The text must be a sequence of UTF-8
  8991. encoded characters.
  8992. This parameter is mandatory if no file is specified with the parameter
  8993. @var{textfile}.
  8994. @item textfile
  8995. A text file containing text to be drawn. The text must be a sequence
  8996. of UTF-8 encoded characters.
  8997. This parameter is mandatory if no text string is specified with the
  8998. parameter @var{text}.
  8999. If both @var{text} and @var{textfile} are specified, an error is thrown.
  9000. @item text_source
  9001. Text source should be set as side_data_detection_bboxes if you want to use text data in
  9002. detection bboxes of side data.
  9003. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  9004. text data in detection bboxes of side data. So please do not use this parameter
  9005. if you are not sure about the text source.
  9006. @item reload
  9007. The @var{textfile} will be reloaded at specified frame interval.
  9008. Be sure to update @var{textfile} atomically, or it may be read partially,
  9009. or even fail.
  9010. Range is 0 to INT_MAX. Default is 0.
  9011. @item x
  9012. @item y
  9013. The expressions which specify the offsets where text will be drawn
  9014. within the video frame. They are relative to the top/left border of the
  9015. output image.
  9016. The default value of @var{x} and @var{y} is "0".
  9017. See below for the list of accepted constants and functions.
  9018. @end table
  9019. The parameters for @var{x} and @var{y} are expressions containing the
  9020. following constants and functions:
  9021. @table @option
  9022. @item dar
  9023. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9024. @item hsub
  9025. @item vsub
  9026. horizontal and vertical chroma subsample values. For example for the
  9027. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9028. @item line_h, lh
  9029. the height of each text line
  9030. @item main_h, h, H
  9031. the input height
  9032. @item main_w, w, W
  9033. the input width
  9034. @item max_glyph_a, ascent
  9035. the maximum distance from the baseline to the highest/upper grid
  9036. coordinate used to place a glyph outline point, for all the rendered
  9037. glyphs.
  9038. It is a positive value, due to the grid's orientation with the Y axis
  9039. upwards.
  9040. @item max_glyph_d, descent
  9041. the maximum distance from the baseline to the lowest grid coordinate
  9042. used to place a glyph outline point, for all the rendered glyphs.
  9043. This is a negative value, due to the grid's orientation, with the Y axis
  9044. upwards.
  9045. @item max_glyph_h
  9046. maximum glyph height, that is the maximum height for all the glyphs
  9047. contained in the rendered text, it is equivalent to @var{ascent} -
  9048. @var{descent}.
  9049. @item max_glyph_w
  9050. maximum glyph width, that is the maximum width for all the glyphs
  9051. contained in the rendered text
  9052. @item n
  9053. the number of input frame, starting from 0
  9054. @item rand(min, max)
  9055. return a random number included between @var{min} and @var{max}
  9056. @item sar
  9057. The input sample aspect ratio.
  9058. @item t
  9059. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9060. @item text_h, th
  9061. the height of the rendered text
  9062. @item text_w, tw
  9063. the width of the rendered text
  9064. @item x
  9065. @item y
  9066. the x and y offset coordinates where the text is drawn.
  9067. These parameters allow the @var{x} and @var{y} expressions to refer
  9068. to each other, so you can for example specify @code{y=x/dar}.
  9069. @item pict_type
  9070. A one character description of the current frame's picture type.
  9071. @item pkt_pos
  9072. The current packet's position in the input file or stream
  9073. (in bytes, from the start of the input). A value of -1 indicates
  9074. this info is not available.
  9075. @item pkt_duration
  9076. The current packet's duration, in seconds.
  9077. @item pkt_size
  9078. The current packet's size (in bytes).
  9079. @end table
  9080. @anchor{drawtext_expansion}
  9081. @subsection Text expansion
  9082. If @option{expansion} is set to @code{strftime},
  9083. the filter recognizes strftime() sequences in the provided text and
  9084. expands them accordingly. Check the documentation of strftime(). This
  9085. feature is deprecated.
  9086. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  9087. If @option{expansion} is set to @code{normal} (which is the default),
  9088. the following expansion mechanism is used.
  9089. The backslash character @samp{\}, followed by any character, always expands to
  9090. the second character.
  9091. Sequences of the form @code{%@{...@}} are expanded. The text between the
  9092. braces is a function name, possibly followed by arguments separated by ':'.
  9093. If the arguments contain special characters or delimiters (':' or '@}'),
  9094. they should be escaped.
  9095. Note that they probably must also be escaped as the value for the
  9096. @option{text} option in the filter argument string and as the filter
  9097. argument in the filtergraph description, and possibly also for the shell,
  9098. that makes up to four levels of escaping; using a text file avoids these
  9099. problems.
  9100. The following functions are available:
  9101. @table @command
  9102. @item expr, e
  9103. The expression evaluation result.
  9104. It must take one argument specifying the expression to be evaluated,
  9105. which accepts the same constants and functions as the @var{x} and
  9106. @var{y} values. Note that not all constants should be used, for
  9107. example the text size is not known when evaluating the expression, so
  9108. the constants @var{text_w} and @var{text_h} will have an undefined
  9109. value.
  9110. @item expr_int_format, eif
  9111. Evaluate the expression's value and output as formatted integer.
  9112. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  9113. The second argument specifies the output format. Allowed values are @samp{x},
  9114. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  9115. @code{printf} function.
  9116. The third parameter is optional and sets the number of positions taken by the output.
  9117. It can be used to add padding with zeros from the left.
  9118. @item gmtime
  9119. The time at which the filter is running, expressed in UTC.
  9120. It can accept an argument: a strftime() format string.
  9121. The format string is extended to support the variable @var{%[1-6]N}
  9122. which prints fractions of the second with optionally specified number of digits.
  9123. @item localtime
  9124. The time at which the filter is running, expressed in the local time zone.
  9125. It can accept an argument: a strftime() format string.
  9126. The format string is extended to support the variable @var{%[1-6]N}
  9127. which prints fractions of the second with optionally specified number of digits.
  9128. @item metadata
  9129. Frame metadata. Takes one or two arguments.
  9130. The first argument is mandatory and specifies the metadata key.
  9131. The second argument is optional and specifies a default value, used when the
  9132. metadata key is not found or empty.
  9133. Available metadata can be identified by inspecting entries
  9134. starting with TAG included within each frame section
  9135. printed by running @code{ffprobe -show_frames}.
  9136. String metadata generated in filters leading to
  9137. the drawtext filter are also available.
  9138. @item n, frame_num
  9139. The frame number, starting from 0.
  9140. @item pict_type
  9141. A one character description of the current picture type.
  9142. @item pts
  9143. The timestamp of the current frame.
  9144. It can take up to three arguments.
  9145. The first argument is the format of the timestamp; it defaults to @code{flt}
  9146. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  9147. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  9148. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  9149. @code{localtime} stands for the timestamp of the frame formatted as
  9150. local time zone time.
  9151. The second argument is an offset added to the timestamp.
  9152. If the format is set to @code{hms}, a third argument @code{24HH} may be
  9153. supplied to present the hour part of the formatted timestamp in 24h format
  9154. (00-23).
  9155. If the format is set to @code{localtime} or @code{gmtime},
  9156. a third argument may be supplied: a strftime() format string.
  9157. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  9158. @end table
  9159. @subsection Commands
  9160. This filter supports altering parameters via commands:
  9161. @table @option
  9162. @item reinit
  9163. Alter existing filter parameters.
  9164. Syntax for the argument is the same as for filter invocation, e.g.
  9165. @example
  9166. fontsize=56:fontcolor=green:text='Hello World'
  9167. @end example
  9168. Full filter invocation with sendcmd would look like this:
  9169. @example
  9170. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  9171. @end example
  9172. @end table
  9173. If the entire argument can't be parsed or applied as valid values then the filter will
  9174. continue with its existing parameters.
  9175. @subsection Examples
  9176. @itemize
  9177. @item
  9178. Draw "Test Text" with font FreeSerif, using the default values for the
  9179. optional parameters.
  9180. @example
  9181. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  9182. @end example
  9183. @item
  9184. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  9185. and y=50 (counting from the top-left corner of the screen), text is
  9186. yellow with a red box around it. Both the text and the box have an
  9187. opacity of 20%.
  9188. @example
  9189. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  9190. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  9191. @end example
  9192. Note that the double quotes are not necessary if spaces are not used
  9193. within the parameter list.
  9194. @item
  9195. Show the text at the center of the video frame:
  9196. @example
  9197. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  9198. @end example
  9199. @item
  9200. Show the text at a random position, switching to a new position every 30 seconds:
  9201. @example
  9202. 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)"
  9203. @end example
  9204. @item
  9205. Show a text line sliding from right to left in the last row of the video
  9206. frame. The file @file{LONG_LINE} is assumed to contain a single line
  9207. with no newlines.
  9208. @example
  9209. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  9210. @end example
  9211. @item
  9212. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  9213. @example
  9214. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  9215. @end example
  9216. @item
  9217. Draw a single green letter "g", at the center of the input video.
  9218. The glyph baseline is placed at half screen height.
  9219. @example
  9220. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  9221. @end example
  9222. @item
  9223. Show text for 1 second every 3 seconds:
  9224. @example
  9225. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  9226. @end example
  9227. @item
  9228. Use fontconfig to set the font. Note that the colons need to be escaped.
  9229. @example
  9230. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  9231. @end example
  9232. @item
  9233. Draw "Test Text" with font size dependent on height of the video.
  9234. @example
  9235. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  9236. @end example
  9237. @item
  9238. Print the date of a real-time encoding (see strftime(3)):
  9239. @example
  9240. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  9241. @end example
  9242. @item
  9243. Show text fading in and out (appearing/disappearing):
  9244. @example
  9245. #!/bin/sh
  9246. DS=1.0 # display start
  9247. DE=10.0 # display end
  9248. FID=1.5 # fade in duration
  9249. FOD=5 # fade out duration
  9250. 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 @}"
  9251. @end example
  9252. @item
  9253. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9254. and the @option{fontsize} value are included in the @option{y} offset.
  9255. @example
  9256. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9257. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9258. @end example
  9259. @item
  9260. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9261. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9262. must have option @option{-export_path_metadata 1} for the special metadata fields
  9263. to be available for filters.
  9264. @example
  9265. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  9266. @end example
  9267. @end itemize
  9268. For more information about libfreetype, check:
  9269. @url{http://www.freetype.org/}.
  9270. For more information about fontconfig, check:
  9271. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  9272. For more information about libfribidi, check:
  9273. @url{http://fribidi.org/}.
  9274. @section edgedetect
  9275. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  9276. The filter accepts the following options:
  9277. @table @option
  9278. @item low
  9279. @item high
  9280. Set low and high threshold values used by the Canny thresholding
  9281. algorithm.
  9282. The high threshold selects the "strong" edge pixels, which are then
  9283. connected through 8-connectivity with the "weak" edge pixels selected
  9284. by the low threshold.
  9285. @var{low} and @var{high} threshold values must be chosen in the range
  9286. [0,1], and @var{low} should be lesser or equal to @var{high}.
  9287. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  9288. is @code{50/255}.
  9289. @item mode
  9290. Define the drawing mode.
  9291. @table @samp
  9292. @item wires
  9293. Draw white/gray wires on black background.
  9294. @item colormix
  9295. Mix the colors to create a paint/cartoon effect.
  9296. @item canny
  9297. Apply Canny edge detector on all selected planes.
  9298. @end table
  9299. Default value is @var{wires}.
  9300. @item planes
  9301. Select planes for filtering. By default all available planes are filtered.
  9302. @end table
  9303. @subsection Examples
  9304. @itemize
  9305. @item
  9306. Standard edge detection with custom values for the hysteresis thresholding:
  9307. @example
  9308. edgedetect=low=0.1:high=0.4
  9309. @end example
  9310. @item
  9311. Painting effect without thresholding:
  9312. @example
  9313. edgedetect=mode=colormix:high=0
  9314. @end example
  9315. @end itemize
  9316. @section elbg
  9317. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  9318. For each input image, the filter will compute the optimal mapping from
  9319. the input to the output given the codebook length, that is the number
  9320. of distinct output colors.
  9321. This filter accepts the following options.
  9322. @table @option
  9323. @item codebook_length, l
  9324. Set codebook length. The value must be a positive integer, and
  9325. represents the number of distinct output colors. Default value is 256.
  9326. @item nb_steps, n
  9327. Set the maximum number of iterations to apply for computing the optimal
  9328. mapping. The higher the value the better the result and the higher the
  9329. computation time. Default value is 1.
  9330. @item seed, s
  9331. Set a random seed, must be an integer included between 0 and
  9332. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  9333. will try to use a good random seed on a best effort basis.
  9334. @item pal8
  9335. Set pal8 output pixel format. This option does not work with codebook
  9336. length greater than 256. Default is disabled.
  9337. @item use_alpha
  9338. Include alpha values in the quantization calculation. Allows creating
  9339. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  9340. @end table
  9341. @section entropy
  9342. Measure graylevel entropy in histogram of color channels of video frames.
  9343. It accepts the following parameters:
  9344. @table @option
  9345. @item mode
  9346. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  9347. @var{diff} mode measures entropy of histogram delta values, absolute differences
  9348. between neighbour histogram values.
  9349. @end table
  9350. @section epx
  9351. Apply the EPX magnification filter which is designed for pixel art.
  9352. It accepts the following option:
  9353. @table @option
  9354. @item n
  9355. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  9356. @code{3xEPX}.
  9357. Default is @code{3}.
  9358. @end table
  9359. @section eq
  9360. Set brightness, contrast, saturation and approximate gamma adjustment.
  9361. The filter accepts the following options:
  9362. @table @option
  9363. @item contrast
  9364. Set the contrast expression. The value must be a float value in range
  9365. @code{-1000.0} to @code{1000.0}. The default value is "1".
  9366. @item brightness
  9367. Set the brightness expression. The value must be a float value in
  9368. range @code{-1.0} to @code{1.0}. The default value is "0".
  9369. @item saturation
  9370. Set the saturation expression. The value must be a float in
  9371. range @code{0.0} to @code{3.0}. The default value is "1".
  9372. @item gamma
  9373. Set the gamma expression. The value must be a float in range
  9374. @code{0.1} to @code{10.0}. The default value is "1".
  9375. @item gamma_r
  9376. Set the gamma expression for red. The value must be a float in
  9377. range @code{0.1} to @code{10.0}. The default value is "1".
  9378. @item gamma_g
  9379. Set the gamma expression for green. The value must be a float in range
  9380. @code{0.1} to @code{10.0}. The default value is "1".
  9381. @item gamma_b
  9382. Set the gamma expression for blue. The value must be a float in range
  9383. @code{0.1} to @code{10.0}. The default value is "1".
  9384. @item gamma_weight
  9385. Set the gamma weight expression. It can be used to reduce the effect
  9386. of a high gamma value on bright image areas, e.g. keep them from
  9387. getting overamplified and just plain white. The value must be a float
  9388. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  9389. gamma correction all the way down while @code{1.0} leaves it at its
  9390. full strength. Default is "1".
  9391. @item eval
  9392. Set when the expressions for brightness, contrast, saturation and
  9393. gamma expressions are evaluated.
  9394. It accepts the following values:
  9395. @table @samp
  9396. @item init
  9397. only evaluate expressions once during the filter initialization or
  9398. when a command is processed
  9399. @item frame
  9400. evaluate expressions for each incoming frame
  9401. @end table
  9402. Default value is @samp{init}.
  9403. @end table
  9404. The expressions accept the following parameters:
  9405. @table @option
  9406. @item n
  9407. frame count of the input frame starting from 0
  9408. @item pos
  9409. byte position of the corresponding packet in the input file, NAN if
  9410. unspecified
  9411. @item r
  9412. frame rate of the input video, NAN if the input frame rate is unknown
  9413. @item t
  9414. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9415. @end table
  9416. @subsection Commands
  9417. The filter supports the following commands:
  9418. @table @option
  9419. @item contrast
  9420. Set the contrast expression.
  9421. @item brightness
  9422. Set the brightness expression.
  9423. @item saturation
  9424. Set the saturation expression.
  9425. @item gamma
  9426. Set the gamma expression.
  9427. @item gamma_r
  9428. Set the gamma_r expression.
  9429. @item gamma_g
  9430. Set gamma_g expression.
  9431. @item gamma_b
  9432. Set gamma_b expression.
  9433. @item gamma_weight
  9434. Set gamma_weight expression.
  9435. The command accepts the same syntax of the corresponding option.
  9436. If the specified expression is not valid, it is kept at its current
  9437. value.
  9438. @end table
  9439. @anchor{erosion}
  9440. @section erosion
  9441. Apply erosion effect to the video.
  9442. This filter replaces the pixel by the local(3x3) minimum.
  9443. It accepts the following options:
  9444. @table @option
  9445. @item threshold0
  9446. @item threshold1
  9447. @item threshold2
  9448. @item threshold3
  9449. Limit the maximum change for each plane, default is 65535.
  9450. If 0, plane will remain unchanged.
  9451. @item coordinates
  9452. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9453. pixels are used.
  9454. Flags to local 3x3 coordinates maps like this:
  9455. 1 2 3
  9456. 4 5
  9457. 6 7 8
  9458. @end table
  9459. @subsection Commands
  9460. This filter supports the all above options as @ref{commands}.
  9461. @section estdif
  9462. Deinterlace the input video ("estdif" stands for "Edge Slope
  9463. Tracing Deinterlacing Filter").
  9464. Spatial only filter that uses edge slope tracing algorithm
  9465. to interpolate missing lines.
  9466. It accepts the following parameters:
  9467. @table @option
  9468. @item mode
  9469. The interlacing mode to adopt. It accepts one of the following values:
  9470. @table @option
  9471. @item frame
  9472. Output one frame for each frame.
  9473. @item field
  9474. Output one frame for each field.
  9475. @end table
  9476. The default value is @code{field}.
  9477. @item parity
  9478. The picture field parity assumed for the input interlaced video. It accepts one
  9479. of the following values:
  9480. @table @option
  9481. @item tff
  9482. Assume the top field is first.
  9483. @item bff
  9484. Assume the bottom field is first.
  9485. @item auto
  9486. Enable automatic detection of field parity.
  9487. @end table
  9488. The default value is @code{auto}.
  9489. If the interlacing is unknown or the decoder does not export this information,
  9490. top field first will be assumed.
  9491. @item deint
  9492. Specify which frames to deinterlace. Accepts one of the following
  9493. values:
  9494. @table @option
  9495. @item all
  9496. Deinterlace all frames.
  9497. @item interlaced
  9498. Only deinterlace frames marked as interlaced.
  9499. @end table
  9500. The default value is @code{all}.
  9501. @item rslope
  9502. Specify the search radius for edge slope tracing. Default value is 1.
  9503. Allowed range is from 1 to 15.
  9504. @item redge
  9505. Specify the search radius for best edge matching. Default value is 2.
  9506. Allowed range is from 0 to 15.
  9507. @item ecost
  9508. Specify the edge cost for edge matching. Default value is 1.0.
  9509. Allowed range is from 0 to 9.
  9510. @item mcost
  9511. Specify the middle cost for edge matching. Default value is 0.5.
  9512. Allowed range is from 0 to 1.
  9513. @item dcost
  9514. Specify the distance cost for edge matching. Default value is 0.5.
  9515. Allowed range is from 0 to 1.
  9516. @item interp
  9517. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  9518. of the following values:
  9519. @table @option
  9520. @item 2p
  9521. Two-point interpolation.
  9522. @item 4p
  9523. Four-point interpolation.
  9524. @item 6p
  9525. Six-point interpolation.
  9526. @end table
  9527. @end table
  9528. @subsection Commands
  9529. This filter supports same @ref{commands} as options.
  9530. @section exposure
  9531. Adjust exposure of the video stream.
  9532. The filter accepts the following options:
  9533. @table @option
  9534. @item exposure
  9535. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  9536. Default value is 0 EV.
  9537. @item black
  9538. Set the black level correction. Allowed range is from -1.0 to 1.0.
  9539. Default value is 0.
  9540. @end table
  9541. @subsection Commands
  9542. This filter supports same @ref{commands} as options.
  9543. @section extractplanes
  9544. Extract color channel components from input video stream into
  9545. separate grayscale video streams.
  9546. The filter accepts the following option:
  9547. @table @option
  9548. @item planes
  9549. Set plane(s) to extract.
  9550. Available values for planes are:
  9551. @table @samp
  9552. @item y
  9553. @item u
  9554. @item v
  9555. @item a
  9556. @item r
  9557. @item g
  9558. @item b
  9559. @end table
  9560. Choosing planes not available in the input will result in an error.
  9561. That means you cannot select @code{r}, @code{g}, @code{b} planes
  9562. with @code{y}, @code{u}, @code{v} planes at same time.
  9563. @end table
  9564. @subsection Examples
  9565. @itemize
  9566. @item
  9567. Extract luma, u and v color channel component from input video frame
  9568. into 3 grayscale outputs:
  9569. @example
  9570. 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
  9571. @end example
  9572. @end itemize
  9573. @section fade
  9574. Apply a fade-in/out effect to the input video.
  9575. It accepts the following parameters:
  9576. @table @option
  9577. @item type, t
  9578. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  9579. effect.
  9580. Default is @code{in}.
  9581. @item start_frame, s
  9582. Specify the number of the frame to start applying the fade
  9583. effect at. Default is 0.
  9584. @item nb_frames, n
  9585. The number of frames that the fade effect lasts. At the end of the
  9586. fade-in effect, the output video will have the same intensity as the input video.
  9587. At the end of the fade-out transition, the output video will be filled with the
  9588. selected @option{color}.
  9589. Default is 25.
  9590. @item alpha
  9591. If set to 1, fade only alpha channel, if one exists on the input.
  9592. Default value is 0.
  9593. @item start_time, st
  9594. Specify the timestamp (in seconds) of the frame to start to apply the fade
  9595. effect. If both start_frame and start_time are specified, the fade will start at
  9596. whichever comes last. Default is 0.
  9597. @item duration, d
  9598. The number of seconds for which the fade effect has to last. At the end of the
  9599. fade-in effect the output video will have the same intensity as the input video,
  9600. at the end of the fade-out transition the output video will be filled with the
  9601. selected @option{color}.
  9602. If both duration and nb_frames are specified, duration is used. Default is 0
  9603. (nb_frames is used by default).
  9604. @item color, c
  9605. Specify the color of the fade. Default is "black".
  9606. @end table
  9607. @subsection Examples
  9608. @itemize
  9609. @item
  9610. Fade in the first 30 frames of video:
  9611. @example
  9612. fade=in:0:30
  9613. @end example
  9614. The command above is equivalent to:
  9615. @example
  9616. fade=t=in:s=0:n=30
  9617. @end example
  9618. @item
  9619. Fade out the last 45 frames of a 200-frame video:
  9620. @example
  9621. fade=out:155:45
  9622. fade=type=out:start_frame=155:nb_frames=45
  9623. @end example
  9624. @item
  9625. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  9626. @example
  9627. fade=in:0:25, fade=out:975:25
  9628. @end example
  9629. @item
  9630. Make the first 5 frames yellow, then fade in from frame 5-24:
  9631. @example
  9632. fade=in:5:20:color=yellow
  9633. @end example
  9634. @item
  9635. Fade in alpha over first 25 frames of video:
  9636. @example
  9637. fade=in:0:25:alpha=1
  9638. @end example
  9639. @item
  9640. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  9641. @example
  9642. fade=t=in:st=5.5:d=0.5
  9643. @end example
  9644. @end itemize
  9645. @section feedback
  9646. Apply feedback video filter.
  9647. This filter pass cropped input frames to 2nd output.
  9648. From there it can be filtered with other video filters.
  9649. After filter receives frame from 2nd input, that frame
  9650. is combined on top of original frame from 1st input and passed
  9651. to 1st output.
  9652. The typical usage is filter only part of frame.
  9653. The filter accepts the following options:
  9654. @table @option
  9655. @item x
  9656. @item y
  9657. Set the top left crop position.
  9658. @item w
  9659. @item h
  9660. Set the crop size.
  9661. @end table
  9662. @subsection Examples
  9663. @itemize
  9664. @item
  9665. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  9666. @example
  9667. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  9668. @end example
  9669. @item
  9670. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  9671. @example
  9672. [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]
  9673. @end example
  9674. @end itemize
  9675. @section fftdnoiz
  9676. Denoise frames using 3D FFT (frequency domain filtering).
  9677. The filter accepts the following options:
  9678. @table @option
  9679. @item sigma
  9680. Set the noise sigma constant. This sets denoising strength.
  9681. Default value is 1. Allowed range is from 0 to 30.
  9682. Using very high sigma with low overlap may give blocking artifacts.
  9683. @item amount
  9684. Set amount of denoising. By default all detected noise is reduced.
  9685. Default value is 1. Allowed range is from 0 to 1.
  9686. @item block
  9687. Set size of block in pixels, Default is 32, can be 8 to 256.
  9688. @item overlap
  9689. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  9690. @item method
  9691. Set denoising method. Default is @code{wiener}, can also be @code{hard}.
  9692. @item prev
  9693. Set number of previous frames to use for denoising. By default is set to 0.
  9694. @item next
  9695. Set number of next frames to to use for denoising. By default is set to 0.
  9696. @item planes
  9697. Set planes which will be filtered, by default are all available filtered
  9698. except alpha.
  9699. @end table
  9700. @section fftfilt
  9701. Apply arbitrary expressions to samples in frequency domain
  9702. @table @option
  9703. @item dc_Y
  9704. Adjust the dc value (gain) of the luma plane of the image. The filter
  9705. accepts an integer value in range @code{0} to @code{1000}. The default
  9706. value is set to @code{0}.
  9707. @item dc_U
  9708. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  9709. filter accepts an integer value in range @code{0} to @code{1000}. The
  9710. default value is set to @code{0}.
  9711. @item dc_V
  9712. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  9713. filter accepts an integer value in range @code{0} to @code{1000}. The
  9714. default value is set to @code{0}.
  9715. @item weight_Y
  9716. Set the frequency domain weight expression for the luma plane.
  9717. @item weight_U
  9718. Set the frequency domain weight expression for the 1st chroma plane.
  9719. @item weight_V
  9720. Set the frequency domain weight expression for the 2nd chroma plane.
  9721. @item eval
  9722. Set when the expressions are evaluated.
  9723. It accepts the following values:
  9724. @table @samp
  9725. @item init
  9726. Only evaluate expressions once during the filter initialization.
  9727. @item frame
  9728. Evaluate expressions for each incoming frame.
  9729. @end table
  9730. Default value is @samp{init}.
  9731. The filter accepts the following variables:
  9732. @item X
  9733. @item Y
  9734. The coordinates of the current sample.
  9735. @item W
  9736. @item H
  9737. The width and height of the image.
  9738. @item N
  9739. The number of input frame, starting from 0.
  9740. @item WS
  9741. @item HS
  9742. The size of FFT array for horizontal and vertical processing.
  9743. @end table
  9744. @subsection Examples
  9745. @itemize
  9746. @item
  9747. High-pass:
  9748. @example
  9749. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  9750. @end example
  9751. @item
  9752. Low-pass:
  9753. @example
  9754. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  9755. @end example
  9756. @item
  9757. Sharpen:
  9758. @example
  9759. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  9760. @end example
  9761. @item
  9762. Blur:
  9763. @example
  9764. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  9765. @end example
  9766. @end itemize
  9767. @section field
  9768. Extract a single field from an interlaced image using stride
  9769. arithmetic to avoid wasting CPU time. The output frames are marked as
  9770. non-interlaced.
  9771. The filter accepts the following options:
  9772. @table @option
  9773. @item type
  9774. Specify whether to extract the top (if the value is @code{0} or
  9775. @code{top}) or the bottom field (if the value is @code{1} or
  9776. @code{bottom}).
  9777. @end table
  9778. @section fieldhint
  9779. Create new frames by copying the top and bottom fields from surrounding frames
  9780. supplied as numbers by the hint file.
  9781. @table @option
  9782. @item hint
  9783. Set file containing hints: absolute/relative frame numbers.
  9784. There must be one line for each frame in a clip. Each line must contain two
  9785. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  9786. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  9787. is current frame number for @code{absolute} mode or out of [-1, 1] range
  9788. for @code{relative} mode. First number tells from which frame to pick up top
  9789. field and second number tells from which frame to pick up bottom field.
  9790. If optionally followed by @code{+} output frame will be marked as interlaced,
  9791. else if followed by @code{-} output frame will be marked as progressive, else
  9792. it will be marked same as input frame.
  9793. If optionally followed by @code{t} output frame will use only top field, or in
  9794. case of @code{b} it will use only bottom field.
  9795. If line starts with @code{#} or @code{;} that line is skipped.
  9796. @item mode
  9797. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  9798. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  9799. are more frames to process than @code{hint} file is seek back to start.
  9800. @end table
  9801. Example of first several lines of @code{hint} file for @code{relative} mode:
  9802. @example
  9803. 0,0 - # first frame
  9804. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  9805. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  9806. 1,0 -
  9807. 0,0 -
  9808. 0,0 -
  9809. 1,0 -
  9810. 1,0 -
  9811. 1,0 -
  9812. 0,0 -
  9813. 0,0 -
  9814. 1,0 -
  9815. 1,0 -
  9816. 1,0 -
  9817. 0,0 -
  9818. @end example
  9819. @section fieldmatch
  9820. Field matching filter for inverse telecine. It is meant to reconstruct the
  9821. progressive frames from a telecined stream. The filter does not drop duplicated
  9822. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  9823. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  9824. The separation of the field matching and the decimation is notably motivated by
  9825. the possibility of inserting a de-interlacing filter fallback between the two.
  9826. If the source has mixed telecined and real interlaced content,
  9827. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  9828. But these remaining combed frames will be marked as interlaced, and thus can be
  9829. de-interlaced by a later filter such as @ref{yadif} before decimation.
  9830. In addition to the various configuration options, @code{fieldmatch} can take an
  9831. optional second stream, activated through the @option{ppsrc} option. If
  9832. enabled, the frames reconstruction will be based on the fields and frames from
  9833. this second stream. This allows the first input to be pre-processed in order to
  9834. help the various algorithms of the filter, while keeping the output lossless
  9835. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  9836. or brightness/contrast adjustments can help.
  9837. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  9838. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  9839. which @code{fieldmatch} is based on. While the semantic and usage are very
  9840. close, some behaviour and options names can differ.
  9841. The @ref{decimate} filter currently only works for constant frame rate input.
  9842. If your input has mixed telecined (30fps) and progressive content with a lower
  9843. framerate like 24fps use the following filterchain to produce the necessary cfr
  9844. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  9845. The filter accepts the following options:
  9846. @table @option
  9847. @item order
  9848. Specify the assumed field order of the input stream. Available values are:
  9849. @table @samp
  9850. @item auto
  9851. Auto detect parity (use FFmpeg's internal parity value).
  9852. @item bff
  9853. Assume bottom field first.
  9854. @item tff
  9855. Assume top field first.
  9856. @end table
  9857. Note that it is sometimes recommended not to trust the parity announced by the
  9858. stream.
  9859. Default value is @var{auto}.
  9860. @item mode
  9861. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  9862. sense that it won't risk creating jerkiness due to duplicate frames when
  9863. possible, but if there are bad edits or blended fields it will end up
  9864. outputting combed frames when a good match might actually exist. On the other
  9865. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  9866. but will almost always find a good frame if there is one. The other values are
  9867. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  9868. jerkiness and creating duplicate frames versus finding good matches in sections
  9869. with bad edits, orphaned fields, blended fields, etc.
  9870. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  9871. Available values are:
  9872. @table @samp
  9873. @item pc
  9874. 2-way matching (p/c)
  9875. @item pc_n
  9876. 2-way matching, and trying 3rd match if still combed (p/c + n)
  9877. @item pc_u
  9878. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  9879. @item pc_n_ub
  9880. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  9881. still combed (p/c + n + u/b)
  9882. @item pcn
  9883. 3-way matching (p/c/n)
  9884. @item pcn_ub
  9885. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  9886. detected as combed (p/c/n + u/b)
  9887. @end table
  9888. The parenthesis at the end indicate the matches that would be used for that
  9889. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  9890. @var{top}).
  9891. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  9892. the slowest.
  9893. Default value is @var{pc_n}.
  9894. @item ppsrc
  9895. Mark the main input stream as a pre-processed input, and enable the secondary
  9896. input stream as the clean source to pick the fields from. See the filter
  9897. introduction for more details. It is similar to the @option{clip2} feature from
  9898. VFM/TFM.
  9899. Default value is @code{0} (disabled).
  9900. @item field
  9901. Set the field to match from. It is recommended to set this to the same value as
  9902. @option{order} unless you experience matching failures with that setting. In
  9903. certain circumstances changing the field that is used to match from can have a
  9904. large impact on matching performance. Available values are:
  9905. @table @samp
  9906. @item auto
  9907. Automatic (same value as @option{order}).
  9908. @item bottom
  9909. Match from the bottom field.
  9910. @item top
  9911. Match from the top field.
  9912. @end table
  9913. Default value is @var{auto}.
  9914. @item mchroma
  9915. Set whether or not chroma is included during the match comparisons. In most
  9916. cases it is recommended to leave this enabled. You should set this to @code{0}
  9917. only if your clip has bad chroma problems such as heavy rainbowing or other
  9918. artifacts. Setting this to @code{0} could also be used to speed things up at
  9919. the cost of some accuracy.
  9920. Default value is @code{1}.
  9921. @item y0
  9922. @item y1
  9923. These define an exclusion band which excludes the lines between @option{y0} and
  9924. @option{y1} from being included in the field matching decision. An exclusion
  9925. band can be used to ignore subtitles, a logo, or other things that may
  9926. interfere with the matching. @option{y0} sets the starting scan line and
  9927. @option{y1} sets the ending line; all lines in between @option{y0} and
  9928. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  9929. @option{y0} and @option{y1} to the same value will disable the feature.
  9930. @option{y0} and @option{y1} defaults to @code{0}.
  9931. @item scthresh
  9932. Set the scene change detection threshold as a percentage of maximum change on
  9933. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  9934. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  9935. @option{scthresh} is @code{[0.0, 100.0]}.
  9936. Default value is @code{12.0}.
  9937. @item combmatch
  9938. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  9939. account the combed scores of matches when deciding what match to use as the
  9940. final match. Available values are:
  9941. @table @samp
  9942. @item none
  9943. No final matching based on combed scores.
  9944. @item sc
  9945. Combed scores are only used when a scene change is detected.
  9946. @item full
  9947. Use combed scores all the time.
  9948. @end table
  9949. Default is @var{sc}.
  9950. @item combdbg
  9951. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  9952. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  9953. Available values are:
  9954. @table @samp
  9955. @item none
  9956. No forced calculation.
  9957. @item pcn
  9958. Force p/c/n calculations.
  9959. @item pcnub
  9960. Force p/c/n/u/b calculations.
  9961. @end table
  9962. Default value is @var{none}.
  9963. @item cthresh
  9964. This is the area combing threshold used for combed frame detection. This
  9965. essentially controls how "strong" or "visible" combing must be to be detected.
  9966. Larger values mean combing must be more visible and smaller values mean combing
  9967. can be less visible or strong and still be detected. Valid settings are from
  9968. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  9969. be detected as combed). This is basically a pixel difference value. A good
  9970. range is @code{[8, 12]}.
  9971. Default value is @code{9}.
  9972. @item chroma
  9973. Sets whether or not chroma is considered in the combed frame decision. Only
  9974. disable this if your source has chroma problems (rainbowing, etc.) that are
  9975. causing problems for the combed frame detection with chroma enabled. Actually,
  9976. using @option{chroma}=@var{0} is usually more reliable, except for the case
  9977. where there is chroma only combing in the source.
  9978. Default value is @code{0}.
  9979. @item blockx
  9980. @item blocky
  9981. Respectively set the x-axis and y-axis size of the window used during combed
  9982. frame detection. This has to do with the size of the area in which
  9983. @option{combpel} pixels are required to be detected as combed for a frame to be
  9984. declared combed. See the @option{combpel} parameter description for more info.
  9985. Possible values are any number that is a power of 2 starting at 4 and going up
  9986. to 512.
  9987. Default value is @code{16}.
  9988. @item combpel
  9989. The number of combed pixels inside any of the @option{blocky} by
  9990. @option{blockx} size blocks on the frame for the frame to be detected as
  9991. combed. While @option{cthresh} controls how "visible" the combing must be, this
  9992. setting controls "how much" combing there must be in any localized area (a
  9993. window defined by the @option{blockx} and @option{blocky} settings) on the
  9994. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  9995. which point no frames will ever be detected as combed). This setting is known
  9996. as @option{MI} in TFM/VFM vocabulary.
  9997. Default value is @code{80}.
  9998. @end table
  9999. @anchor{p/c/n/u/b meaning}
  10000. @subsection p/c/n/u/b meaning
  10001. @subsubsection p/c/n
  10002. We assume the following telecined stream:
  10003. @example
  10004. Top fields: 1 2 2 3 4
  10005. Bottom fields: 1 2 3 4 4
  10006. @end example
  10007. The numbers correspond to the progressive frame the fields relate to. Here, the
  10008. first two frames are progressive, the 3rd and 4th are combed, and so on.
  10009. When @code{fieldmatch} is configured to run a matching from bottom
  10010. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  10011. @example
  10012. Input stream:
  10013. T 1 2 2 3 4
  10014. B 1 2 3 4 4 <-- matching reference
  10015. Matches: c c n n c
  10016. Output stream:
  10017. T 1 2 3 4 4
  10018. B 1 2 3 4 4
  10019. @end example
  10020. As a result of the field matching, we can see that some frames get duplicated.
  10021. To perform a complete inverse telecine, you need to rely on a decimation filter
  10022. after this operation. See for instance the @ref{decimate} filter.
  10023. The same operation now matching from top fields (@option{field}=@var{top})
  10024. looks like this:
  10025. @example
  10026. Input stream:
  10027. T 1 2 2 3 4 <-- matching reference
  10028. B 1 2 3 4 4
  10029. Matches: c c p p c
  10030. Output stream:
  10031. T 1 2 2 3 4
  10032. B 1 2 2 3 4
  10033. @end example
  10034. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  10035. basically, they refer to the frame and field of the opposite parity:
  10036. @itemize
  10037. @item @var{p} matches the field of the opposite parity in the previous frame
  10038. @item @var{c} matches the field of the opposite parity in the current frame
  10039. @item @var{n} matches the field of the opposite parity in the next frame
  10040. @end itemize
  10041. @subsubsection u/b
  10042. The @var{u} and @var{b} matching are a bit special in the sense that they match
  10043. from the opposite parity flag. In the following examples, we assume that we are
  10044. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  10045. 'x' is placed above and below each matched fields.
  10046. With bottom matching (@option{field}=@var{bottom}):
  10047. @example
  10048. Match: c p n b u
  10049. x x x x x
  10050. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10051. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10052. x x x x x
  10053. Output frames:
  10054. 2 1 2 2 2
  10055. 2 2 2 1 3
  10056. @end example
  10057. With top matching (@option{field}=@var{top}):
  10058. @example
  10059. Match: c p n b u
  10060. x x x x x
  10061. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10062. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10063. x x x x x
  10064. Output frames:
  10065. 2 2 2 1 2
  10066. 2 1 3 2 2
  10067. @end example
  10068. @subsection Examples
  10069. Simple IVTC of a top field first telecined stream:
  10070. @example
  10071. fieldmatch=order=tff:combmatch=none, decimate
  10072. @end example
  10073. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  10074. @example
  10075. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  10076. @end example
  10077. @section fieldorder
  10078. Transform the field order of the input video.
  10079. It accepts the following parameters:
  10080. @table @option
  10081. @item order
  10082. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  10083. for bottom field first.
  10084. @end table
  10085. The default value is @samp{tff}.
  10086. The transformation is done by shifting the picture content up or down
  10087. by one line, and filling the remaining line with appropriate picture content.
  10088. This method is consistent with most broadcast field order converters.
  10089. If the input video is not flagged as being interlaced, or it is already
  10090. flagged as being of the required output field order, then this filter does
  10091. not alter the incoming video.
  10092. It is very useful when converting to or from PAL DV material,
  10093. which is bottom field first.
  10094. For example:
  10095. @example
  10096. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  10097. @end example
  10098. @section fifo, afifo
  10099. Buffer input images and send them when they are requested.
  10100. It is mainly useful when auto-inserted by the libavfilter
  10101. framework.
  10102. It does not take parameters.
  10103. @section fillborders
  10104. Fill borders of the input video, without changing video stream dimensions.
  10105. Sometimes video can have garbage at the four edges and you may not want to
  10106. crop video input to keep size multiple of some number.
  10107. This filter accepts the following options:
  10108. @table @option
  10109. @item left
  10110. Number of pixels to fill from left border.
  10111. @item right
  10112. Number of pixels to fill from right border.
  10113. @item top
  10114. Number of pixels to fill from top border.
  10115. @item bottom
  10116. Number of pixels to fill from bottom border.
  10117. @item mode
  10118. Set fill mode.
  10119. It accepts the following values:
  10120. @table @samp
  10121. @item smear
  10122. fill pixels using outermost pixels
  10123. @item mirror
  10124. fill pixels using mirroring (half sample symmetric)
  10125. @item fixed
  10126. fill pixels with constant value
  10127. @item reflect
  10128. fill pixels using reflecting (whole sample symmetric)
  10129. @item wrap
  10130. fill pixels using wrapping
  10131. @item fade
  10132. fade pixels to constant value
  10133. @item margins
  10134. fill pixels at top and bottom with weighted averages pixels near borders
  10135. @end table
  10136. Default is @var{smear}.
  10137. @item color
  10138. Set color for pixels in fixed or fade mode. Default is @var{black}.
  10139. @end table
  10140. @subsection Commands
  10141. This filter supports same @ref{commands} as options.
  10142. The command accepts the same syntax of the corresponding option.
  10143. If the specified expression is not valid, it is kept at its current
  10144. value.
  10145. @section find_rect
  10146. Find a rectangular object
  10147. It accepts the following options:
  10148. @table @option
  10149. @item object
  10150. Filepath of the object image, needs to be in gray8.
  10151. @item threshold
  10152. Detection threshold, default is 0.5.
  10153. @item mipmaps
  10154. Number of mipmaps, default is 3.
  10155. @item xmin, ymin, xmax, ymax
  10156. Specifies the rectangle in which to search.
  10157. @item discard
  10158. Discard frames where object is not detected. Default is disabled.
  10159. @end table
  10160. @subsection Examples
  10161. @itemize
  10162. @item
  10163. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  10164. @example
  10165. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  10166. @end example
  10167. @end itemize
  10168. @section floodfill
  10169. Flood area with values of same pixel components with another values.
  10170. It accepts the following options:
  10171. @table @option
  10172. @item x
  10173. Set pixel x coordinate.
  10174. @item y
  10175. Set pixel y coordinate.
  10176. @item s0
  10177. Set source #0 component value.
  10178. @item s1
  10179. Set source #1 component value.
  10180. @item s2
  10181. Set source #2 component value.
  10182. @item s3
  10183. Set source #3 component value.
  10184. @item d0
  10185. Set destination #0 component value.
  10186. @item d1
  10187. Set destination #1 component value.
  10188. @item d2
  10189. Set destination #2 component value.
  10190. @item d3
  10191. Set destination #3 component value.
  10192. @end table
  10193. @anchor{format}
  10194. @section format
  10195. Convert the input video to one of the specified pixel formats.
  10196. Libavfilter will try to pick one that is suitable as input to
  10197. the next filter.
  10198. It accepts the following parameters:
  10199. @table @option
  10200. @item pix_fmts
  10201. A '|'-separated list of pixel format names, such as
  10202. "pix_fmts=yuv420p|monow|rgb24".
  10203. @end table
  10204. @subsection Examples
  10205. @itemize
  10206. @item
  10207. Convert the input video to the @var{yuv420p} format
  10208. @example
  10209. format=pix_fmts=yuv420p
  10210. @end example
  10211. Convert the input video to any of the formats in the list
  10212. @example
  10213. format=pix_fmts=yuv420p|yuv444p|yuv410p
  10214. @end example
  10215. @end itemize
  10216. @anchor{fps}
  10217. @section fps
  10218. Convert the video to specified constant frame rate by duplicating or dropping
  10219. frames as necessary.
  10220. It accepts the following parameters:
  10221. @table @option
  10222. @item fps
  10223. The desired output frame rate. It accepts expressions containing the following
  10224. constants:
  10225. @table @samp
  10226. @item source_fps
  10227. The input's frame rate
  10228. @item ntsc
  10229. NTSC frame rate of @code{30000/1001}
  10230. @item pal
  10231. PAL frame rate of @code{25.0}
  10232. @item film
  10233. Film frame rate of @code{24.0}
  10234. @item ntsc_film
  10235. NTSC-film frame rate of @code{24000/1001}
  10236. @end table
  10237. The default is @code{25}.
  10238. @item start_time
  10239. Assume the first PTS should be the given value, in seconds. This allows for
  10240. padding/trimming at the start of stream. By default, no assumption is made
  10241. about the first frame's expected PTS, so no padding or trimming is done.
  10242. For example, this could be set to 0 to pad the beginning with duplicates of
  10243. the first frame if a video stream starts after the audio stream or to trim any
  10244. frames with a negative PTS.
  10245. @item round
  10246. Timestamp (PTS) rounding method.
  10247. Possible values are:
  10248. @table @option
  10249. @item zero
  10250. round towards 0
  10251. @item inf
  10252. round away from 0
  10253. @item down
  10254. round towards -infinity
  10255. @item up
  10256. round towards +infinity
  10257. @item near
  10258. round to nearest
  10259. @end table
  10260. The default is @code{near}.
  10261. @item eof_action
  10262. Action performed when reading the last frame.
  10263. Possible values are:
  10264. @table @option
  10265. @item round
  10266. Use same timestamp rounding method as used for other frames.
  10267. @item pass
  10268. Pass through last frame if input duration has not been reached yet.
  10269. @end table
  10270. The default is @code{round}.
  10271. @end table
  10272. Alternatively, the options can be specified as a flat string:
  10273. @var{fps}[:@var{start_time}[:@var{round}]].
  10274. See also the @ref{setpts} filter.
  10275. @subsection Examples
  10276. @itemize
  10277. @item
  10278. A typical usage in order to set the fps to 25:
  10279. @example
  10280. fps=fps=25
  10281. @end example
  10282. @item
  10283. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  10284. @example
  10285. fps=fps=film:round=near
  10286. @end example
  10287. @end itemize
  10288. @section framepack
  10289. Pack two different video streams into a stereoscopic video, setting proper
  10290. metadata on supported codecs. The two views should have the same size and
  10291. framerate and processing will stop when the shorter video ends. Please note
  10292. that you may conveniently adjust view properties with the @ref{scale} and
  10293. @ref{fps} filters.
  10294. It accepts the following parameters:
  10295. @table @option
  10296. @item format
  10297. The desired packing format. Supported values are:
  10298. @table @option
  10299. @item sbs
  10300. The views are next to each other (default).
  10301. @item tab
  10302. The views are on top of each other.
  10303. @item lines
  10304. The views are packed by line.
  10305. @item columns
  10306. The views are packed by column.
  10307. @item frameseq
  10308. The views are temporally interleaved.
  10309. @end table
  10310. @end table
  10311. Some examples:
  10312. @example
  10313. # Convert left and right views into a frame-sequential video
  10314. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  10315. # Convert views into a side-by-side video with the same output resolution as the input
  10316. 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
  10317. @end example
  10318. @section framerate
  10319. Change the frame rate by interpolating new video output frames from the source
  10320. frames.
  10321. This filter is not designed to function correctly with interlaced media. If
  10322. you wish to change the frame rate of interlaced media then you are required
  10323. to deinterlace before this filter and re-interlace after this filter.
  10324. A description of the accepted options follows.
  10325. @table @option
  10326. @item fps
  10327. Specify the output frames per second. This option can also be specified
  10328. as a value alone. The default is @code{50}.
  10329. @item interp_start
  10330. Specify the start of a range where the output frame will be created as a
  10331. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10332. the default is @code{15}.
  10333. @item interp_end
  10334. Specify the end of a range where the output frame will be created as a
  10335. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10336. the default is @code{240}.
  10337. @item scene
  10338. Specify the level at which a scene change is detected as a value between
  10339. 0 and 100 to indicate a new scene; a low value reflects a low
  10340. probability for the current frame to introduce a new scene, while a higher
  10341. value means the current frame is more likely to be one.
  10342. The default is @code{8.2}.
  10343. @item flags
  10344. Specify flags influencing the filter process.
  10345. Available value for @var{flags} is:
  10346. @table @option
  10347. @item scene_change_detect, scd
  10348. Enable scene change detection using the value of the option @var{scene}.
  10349. This flag is enabled by default.
  10350. @end table
  10351. @end table
  10352. @section framestep
  10353. Select one frame every N-th frame.
  10354. This filter accepts the following option:
  10355. @table @option
  10356. @item step
  10357. Select frame after every @code{step} frames.
  10358. Allowed values are positive integers higher than 0. Default value is @code{1}.
  10359. @end table
  10360. @section freezedetect
  10361. Detect frozen video.
  10362. This filter logs a message and sets frame metadata when it detects that the
  10363. input video has no significant change in content during a specified duration.
  10364. Video freeze detection calculates the mean average absolute difference of all
  10365. the components of video frames and compares it to a noise floor.
  10366. The printed times and duration are expressed in seconds. The
  10367. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  10368. whose timestamp equals or exceeds the detection duration and it contains the
  10369. timestamp of the first frame of the freeze. The
  10370. @code{lavfi.freezedetect.freeze_duration} and
  10371. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  10372. after the freeze.
  10373. The filter accepts the following options:
  10374. @table @option
  10375. @item noise, n
  10376. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  10377. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  10378. 0.001.
  10379. @item duration, d
  10380. Set freeze duration until notification (default is 2 seconds).
  10381. @end table
  10382. @section freezeframes
  10383. Freeze video frames.
  10384. This filter freezes video frames using frame from 2nd input.
  10385. The filter accepts the following options:
  10386. @table @option
  10387. @item first
  10388. Set number of first frame from which to start freeze.
  10389. @item last
  10390. Set number of last frame from which to end freeze.
  10391. @item replace
  10392. Set number of frame from 2nd input which will be used instead of replaced frames.
  10393. @end table
  10394. @anchor{frei0r}
  10395. @section frei0r
  10396. Apply a frei0r effect to the input video.
  10397. To enable the compilation of this filter, you need to install the frei0r
  10398. header and configure FFmpeg with @code{--enable-frei0r}.
  10399. It accepts the following parameters:
  10400. @table @option
  10401. @item filter_name
  10402. The name of the frei0r effect to load. If the environment variable
  10403. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  10404. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  10405. Otherwise, the standard frei0r paths are searched, in this order:
  10406. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  10407. @file{/usr/lib/frei0r-1/}.
  10408. @item filter_params
  10409. A '|'-separated list of parameters to pass to the frei0r effect.
  10410. @end table
  10411. A frei0r effect parameter can be a boolean (its value is either
  10412. "y" or "n"), a double, a color (specified as
  10413. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  10414. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  10415. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  10416. a position (specified as @var{X}/@var{Y}, where
  10417. @var{X} and @var{Y} are floating point numbers) and/or a string.
  10418. The number and types of parameters depend on the loaded effect. If an
  10419. effect parameter is not specified, the default value is set.
  10420. @subsection Examples
  10421. @itemize
  10422. @item
  10423. Apply the distort0r effect, setting the first two double parameters:
  10424. @example
  10425. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  10426. @end example
  10427. @item
  10428. Apply the colordistance effect, taking a color as the first parameter:
  10429. @example
  10430. frei0r=colordistance:0.2/0.3/0.4
  10431. frei0r=colordistance:violet
  10432. frei0r=colordistance:0x112233
  10433. @end example
  10434. @item
  10435. Apply the perspective effect, specifying the top left and top right image
  10436. positions:
  10437. @example
  10438. frei0r=perspective:0.2/0.2|0.8/0.2
  10439. @end example
  10440. @end itemize
  10441. For more information, see
  10442. @url{http://frei0r.dyne.org}
  10443. @subsection Commands
  10444. This filter supports the @option{filter_params} option as @ref{commands}.
  10445. @section fspp
  10446. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  10447. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  10448. processing filter, one of them is performed once per block, not per pixel.
  10449. This allows for much higher speed.
  10450. The filter accepts the following options:
  10451. @table @option
  10452. @item quality
  10453. Set quality. This option defines the number of levels for averaging. It accepts
  10454. an integer in the range 4-5. Default value is @code{4}.
  10455. @item qp
  10456. Force a constant quantization parameter. It accepts an integer in range 0-63.
  10457. If not set, the filter will use the QP from the video stream (if available).
  10458. @item strength
  10459. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  10460. more details but also more artifacts, while higher values make the image smoother
  10461. but also blurrier. Default value is @code{0} − PSNR optimal.
  10462. @item use_bframe_qp
  10463. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10464. option may cause flicker since the B-Frames have often larger QP. Default is
  10465. @code{0} (not enabled).
  10466. @end table
  10467. @section gblur
  10468. Apply Gaussian blur filter.
  10469. The filter accepts the following options:
  10470. @table @option
  10471. @item sigma
  10472. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  10473. @item steps
  10474. Set number of steps for Gaussian approximation. Default is @code{1}.
  10475. @item planes
  10476. Set which planes to filter. By default all planes are filtered.
  10477. @item sigmaV
  10478. Set vertical sigma, if negative it will be same as @code{sigma}.
  10479. Default is @code{-1}.
  10480. @end table
  10481. @subsection Commands
  10482. This filter supports same commands as options.
  10483. The command accepts the same syntax of the corresponding option.
  10484. If the specified expression is not valid, it is kept at its current
  10485. value.
  10486. @section geq
  10487. Apply generic equation to each pixel.
  10488. The filter accepts the following options:
  10489. @table @option
  10490. @item lum_expr, lum
  10491. Set the luminance expression.
  10492. @item cb_expr, cb
  10493. Set the chrominance blue expression.
  10494. @item cr_expr, cr
  10495. Set the chrominance red expression.
  10496. @item alpha_expr, a
  10497. Set the alpha expression.
  10498. @item red_expr, r
  10499. Set the red expression.
  10500. @item green_expr, g
  10501. Set the green expression.
  10502. @item blue_expr, b
  10503. Set the blue expression.
  10504. @end table
  10505. The colorspace is selected according to the specified options. If one
  10506. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  10507. options is specified, the filter will automatically select a YCbCr
  10508. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  10509. @option{blue_expr} options is specified, it will select an RGB
  10510. colorspace.
  10511. If one of the chrominance expression is not defined, it falls back on the other
  10512. one. If no alpha expression is specified it will evaluate to opaque value.
  10513. If none of chrominance expressions are specified, they will evaluate
  10514. to the luminance expression.
  10515. The expressions can use the following variables and functions:
  10516. @table @option
  10517. @item N
  10518. The sequential number of the filtered frame, starting from @code{0}.
  10519. @item X
  10520. @item Y
  10521. The coordinates of the current sample.
  10522. @item W
  10523. @item H
  10524. The width and height of the image.
  10525. @item SW
  10526. @item SH
  10527. Width and height scale depending on the currently filtered plane. It is the
  10528. ratio between the corresponding luma plane number of pixels and the current
  10529. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  10530. @code{0.5,0.5} for chroma planes.
  10531. @item T
  10532. Time of the current frame, expressed in seconds.
  10533. @item p(x, y)
  10534. Return the value of the pixel at location (@var{x},@var{y}) of the current
  10535. plane.
  10536. @item lum(x, y)
  10537. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  10538. plane.
  10539. @item cb(x, y)
  10540. Return the value of the pixel at location (@var{x},@var{y}) of the
  10541. blue-difference chroma plane. Return 0 if there is no such plane.
  10542. @item cr(x, y)
  10543. Return the value of the pixel at location (@var{x},@var{y}) of the
  10544. red-difference chroma plane. Return 0 if there is no such plane.
  10545. @item r(x, y)
  10546. @item g(x, y)
  10547. @item b(x, y)
  10548. Return the value of the pixel at location (@var{x},@var{y}) of the
  10549. red/green/blue component. Return 0 if there is no such component.
  10550. @item alpha(x, y)
  10551. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  10552. plane. Return 0 if there is no such plane.
  10553. @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)
  10554. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  10555. sums of samples within a rectangle. See the functions without the sum postfix.
  10556. @item interpolation
  10557. Set one of interpolation methods:
  10558. @table @option
  10559. @item nearest, n
  10560. @item bilinear, b
  10561. @end table
  10562. Default is bilinear.
  10563. @end table
  10564. For functions, if @var{x} and @var{y} are outside the area, the value will be
  10565. automatically clipped to the closer edge.
  10566. Please note that this filter can use multiple threads in which case each slice
  10567. will have its own expression state. If you want to use only a single expression
  10568. state because your expressions depend on previous state then you should limit
  10569. the number of filter threads to 1.
  10570. @subsection Examples
  10571. @itemize
  10572. @item
  10573. Flip the image horizontally:
  10574. @example
  10575. geq=p(W-X\,Y)
  10576. @end example
  10577. @item
  10578. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  10579. wavelength of 100 pixels:
  10580. @example
  10581. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  10582. @end example
  10583. @item
  10584. Generate a fancy enigmatic moving light:
  10585. @example
  10586. 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
  10587. @end example
  10588. @item
  10589. Generate a quick emboss effect:
  10590. @example
  10591. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  10592. @end example
  10593. @item
  10594. Modify RGB components depending on pixel position:
  10595. @example
  10596. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  10597. @end example
  10598. @item
  10599. Create a radial gradient that is the same size as the input (also see
  10600. the @ref{vignette} filter):
  10601. @example
  10602. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  10603. @end example
  10604. @end itemize
  10605. @section gradfun
  10606. Fix the banding artifacts that are sometimes introduced into nearly flat
  10607. regions by truncation to 8-bit color depth.
  10608. Interpolate the gradients that should go where the bands are, and
  10609. dither them.
  10610. It is designed for playback only. Do not use it prior to
  10611. lossy compression, because compression tends to lose the dither and
  10612. bring back the bands.
  10613. It accepts the following parameters:
  10614. @table @option
  10615. @item strength
  10616. The maximum amount by which the filter will change any one pixel. This is also
  10617. the threshold for detecting nearly flat regions. Acceptable values range from
  10618. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  10619. valid range.
  10620. @item radius
  10621. The neighborhood to fit the gradient to. A larger radius makes for smoother
  10622. gradients, but also prevents the filter from modifying the pixels near detailed
  10623. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  10624. values will be clipped to the valid range.
  10625. @end table
  10626. Alternatively, the options can be specified as a flat string:
  10627. @var{strength}[:@var{radius}]
  10628. @subsection Examples
  10629. @itemize
  10630. @item
  10631. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  10632. @example
  10633. gradfun=3.5:8
  10634. @end example
  10635. @item
  10636. Specify radius, omitting the strength (which will fall-back to the default
  10637. value):
  10638. @example
  10639. gradfun=radius=8
  10640. @end example
  10641. @end itemize
  10642. @anchor{graphmonitor}
  10643. @section graphmonitor
  10644. Show various filtergraph stats.
  10645. With this filter one can debug complete filtergraph.
  10646. Especially issues with links filling with queued frames.
  10647. The filter accepts the following options:
  10648. @table @option
  10649. @item size, s
  10650. Set video output size. Default is @var{hd720}.
  10651. @item opacity, o
  10652. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  10653. @item mode, m
  10654. Set output mode, can be @var{fulll} or @var{compact}.
  10655. In @var{compact} mode only filters with some queued frames have displayed stats.
  10656. @item flags, f
  10657. Set flags which enable which stats are shown in video.
  10658. Available values for flags are:
  10659. @table @samp
  10660. @item queue
  10661. Display number of queued frames in each link.
  10662. @item frame_count_in
  10663. Display number of frames taken from filter.
  10664. @item frame_count_out
  10665. Display number of frames given out from filter.
  10666. @item frame_count_delta
  10667. Display delta number of frames between above two values.
  10668. @item pts
  10669. Display current filtered frame pts.
  10670. @item pts_delta
  10671. Display pts delta between current and previous frame.
  10672. @item time
  10673. Display current filtered frame time.
  10674. @item time_delta
  10675. Display time delta between current and previous frame.
  10676. @item timebase
  10677. Display time base for filter link.
  10678. @item format
  10679. Display used format for filter link.
  10680. @item size
  10681. Display video size or number of audio channels in case of audio used by filter link.
  10682. @item rate
  10683. Display video frame rate or sample rate in case of audio used by filter link.
  10684. @item eof
  10685. Display link output status.
  10686. @item sample_count_in
  10687. Display number of samples taken from filter.
  10688. @item sample_count_out
  10689. Display number of samples given out from filter.
  10690. @item sample_count_delta
  10691. Display delta number of samples between above two values.
  10692. @end table
  10693. @item rate, r
  10694. Set upper limit for video rate of output stream, Default value is @var{25}.
  10695. This guarantee that output video frame rate will not be higher than this value.
  10696. @end table
  10697. @section grayworld
  10698. A color constancy filter that applies color correction based on the grayworld assumption
  10699. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  10700. The algorithm uses linear light, so input
  10701. data should be linearized beforehand (and possibly correctly tagged).
  10702. @example
  10703. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  10704. @end example
  10705. @section greyedge
  10706. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  10707. and corrects the scene colors accordingly.
  10708. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  10709. The filter accepts the following options:
  10710. @table @option
  10711. @item difford
  10712. The order of differentiation to be applied on the scene. Must be chosen in the range
  10713. [0,2] and default value is 1.
  10714. @item minknorm
  10715. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  10716. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  10717. max value instead of calculating Minkowski distance.
  10718. @item sigma
  10719. The standard deviation of Gaussian blur to be applied on the scene. Must be
  10720. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  10721. can't be equal to 0 if @var{difford} is greater than 0.
  10722. @end table
  10723. @subsection Examples
  10724. @itemize
  10725. @item
  10726. Grey Edge:
  10727. @example
  10728. greyedge=difford=1:minknorm=5:sigma=2
  10729. @end example
  10730. @item
  10731. Max Edge:
  10732. @example
  10733. greyedge=difford=1:minknorm=0:sigma=2
  10734. @end example
  10735. @end itemize
  10736. @section guided
  10737. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  10738. The filter accepts the following options:
  10739. @table @option
  10740. @item radius
  10741. Set the box radius in pixels.
  10742. Allowed range is 1 to 20. Default is 3.
  10743. @item eps
  10744. Set regularization parameter (with square).
  10745. Allowed range is 0 to 1. Default is 0.01.
  10746. @item mode
  10747. Set filter mode. Can be @code{basic} or @code{fast}.
  10748. Default is @code{basic}.
  10749. @item sub
  10750. Set subsampling ratio for @code{fast} mode.
  10751. Range is 2 to 64. Default is 4.
  10752. No subsampling occurs in @code{basic} mode.
  10753. @item guidance
  10754. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  10755. If @code{off}, single input is required.
  10756. If @code{on}, two inputs of the same resolution and pixel format are required.
  10757. The second input serves as the guidance.
  10758. @item planes
  10759. Set planes to filter. Default is first only.
  10760. @end table
  10761. @subsection Commands
  10762. This filter supports the all above options as @ref{commands}.
  10763. @subsection Examples
  10764. @itemize
  10765. @item
  10766. Edge-preserving smoothing with guided filter:
  10767. @example
  10768. ffmpeg -i in.png -vf guided out.png
  10769. @end example
  10770. @item
  10771. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  10772. For the generation of guidance image, refer to paper "Guided Image Filtering".
  10773. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  10774. @example
  10775. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  10776. @end example
  10777. @end itemize
  10778. @anchor{haldclut}
  10779. @section haldclut
  10780. Apply a Hald CLUT to a video stream.
  10781. First input is the video stream to process, and second one is the Hald CLUT.
  10782. The Hald CLUT input can be a simple picture or a complete video stream.
  10783. The filter accepts the following options:
  10784. @table @option
  10785. @item clut
  10786. Set which CLUT video frames will be processed from second input stream,
  10787. can be @var{first} or @var{all}. Default is @var{all}.
  10788. @item shortest
  10789. Force termination when the shortest input terminates. Default is @code{0}.
  10790. @item repeatlast
  10791. Continue applying the last CLUT after the end of the stream. A value of
  10792. @code{0} disable the filter after the last frame of the CLUT is reached.
  10793. Default is @code{1}.
  10794. @end table
  10795. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  10796. filters share the same internals).
  10797. This filter also supports the @ref{framesync} options.
  10798. More information about the Hald CLUT can be found on Eskil Steenberg's website
  10799. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  10800. @subsection Commands
  10801. This filter supports the @code{interp} option as @ref{commands}.
  10802. @subsection Workflow examples
  10803. @subsubsection Hald CLUT video stream
  10804. Generate an identity Hald CLUT stream altered with various effects:
  10805. @example
  10806. 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
  10807. @end example
  10808. Note: make sure you use a lossless codec.
  10809. Then use it with @code{haldclut} to apply it on some random stream:
  10810. @example
  10811. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  10812. @end example
  10813. The Hald CLUT will be applied to the 10 first seconds (duration of
  10814. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  10815. to the remaining frames of the @code{mandelbrot} stream.
  10816. @subsubsection Hald CLUT with preview
  10817. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  10818. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  10819. biggest possible square starting at the top left of the picture. The remaining
  10820. padding pixels (bottom or right) will be ignored. This area can be used to add
  10821. a preview of the Hald CLUT.
  10822. Typically, the following generated Hald CLUT will be supported by the
  10823. @code{haldclut} filter:
  10824. @example
  10825. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  10826. pad=iw+320 [padded_clut];
  10827. smptebars=s=320x256, split [a][b];
  10828. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  10829. [main][b] overlay=W-320" -frames:v 1 clut.png
  10830. @end example
  10831. It contains the original and a preview of the effect of the CLUT: SMPTE color
  10832. bars are displayed on the right-top, and below the same color bars processed by
  10833. the color changes.
  10834. Then, the effect of this Hald CLUT can be visualized with:
  10835. @example
  10836. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  10837. @end example
  10838. @section hflip
  10839. Flip the input video horizontally.
  10840. For example, to horizontally flip the input video with @command{ffmpeg}:
  10841. @example
  10842. ffmpeg -i in.avi -vf "hflip" out.avi
  10843. @end example
  10844. @section histeq
  10845. This filter applies a global color histogram equalization on a
  10846. per-frame basis.
  10847. It can be used to correct video that has a compressed range of pixel
  10848. intensities. The filter redistributes the pixel intensities to
  10849. equalize their distribution across the intensity range. It may be
  10850. viewed as an "automatically adjusting contrast filter". This filter is
  10851. useful only for correcting degraded or poorly captured source
  10852. video.
  10853. The filter accepts the following options:
  10854. @table @option
  10855. @item strength
  10856. Determine the amount of equalization to be applied. As the strength
  10857. is reduced, the distribution of pixel intensities more-and-more
  10858. approaches that of the input frame. The value must be a float number
  10859. in the range [0,1] and defaults to 0.200.
  10860. @item intensity
  10861. Set the maximum intensity that can generated and scale the output
  10862. values appropriately. The strength should be set as desired and then
  10863. the intensity can be limited if needed to avoid washing-out. The value
  10864. must be a float number in the range [0,1] and defaults to 0.210.
  10865. @item antibanding
  10866. Set the antibanding level. If enabled the filter will randomly vary
  10867. the luminance of output pixels by a small amount to avoid banding of
  10868. the histogram. Possible values are @code{none}, @code{weak} or
  10869. @code{strong}. It defaults to @code{none}.
  10870. @end table
  10871. @anchor{histogram}
  10872. @section histogram
  10873. Compute and draw a color distribution histogram for the input video.
  10874. The computed histogram is a representation of the color component
  10875. distribution in an image.
  10876. Standard histogram displays the color components distribution in an image.
  10877. Displays color graph for each color component. Shows distribution of
  10878. the Y, U, V, A or R, G, B components, depending on input format, in the
  10879. current frame. Below each graph a color component scale meter is shown.
  10880. The filter accepts the following options:
  10881. @table @option
  10882. @item level_height
  10883. Set height of level. Default value is @code{200}.
  10884. Allowed range is [50, 2048].
  10885. @item scale_height
  10886. Set height of color scale. Default value is @code{12}.
  10887. Allowed range is [0, 40].
  10888. @item display_mode
  10889. Set display mode.
  10890. It accepts the following values:
  10891. @table @samp
  10892. @item stack
  10893. Per color component graphs are placed below each other.
  10894. @item parade
  10895. Per color component graphs are placed side by side.
  10896. @item overlay
  10897. Presents information identical to that in the @code{parade}, except
  10898. that the graphs representing color components are superimposed directly
  10899. over one another.
  10900. @end table
  10901. Default is @code{stack}.
  10902. @item levels_mode
  10903. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  10904. Default is @code{linear}.
  10905. @item components
  10906. Set what color components to display.
  10907. Default is @code{7}.
  10908. @item fgopacity
  10909. Set foreground opacity. Default is @code{0.7}.
  10910. @item bgopacity
  10911. Set background opacity. Default is @code{0.5}.
  10912. @item colors_mode
  10913. Set colors mode.
  10914. It accepts the following values:
  10915. @table @samp
  10916. @item whiteonblack
  10917. @item blackonwhite
  10918. @item whiteongray
  10919. @item blackongray
  10920. @item coloronblack
  10921. @item coloronwhite
  10922. @item colorongray
  10923. @item blackoncolor
  10924. @item whiteoncolor
  10925. @item grayoncolor
  10926. @end table
  10927. Default is @code{whiteonblack}.
  10928. @end table
  10929. @subsection Examples
  10930. @itemize
  10931. @item
  10932. Calculate and draw histogram:
  10933. @example
  10934. ffplay -i input -vf histogram
  10935. @end example
  10936. @end itemize
  10937. @anchor{hqdn3d}
  10938. @section hqdn3d
  10939. This is a high precision/quality 3d denoise filter. It aims to reduce
  10940. image noise, producing smooth images and making still images really
  10941. still. It should enhance compressibility.
  10942. It accepts the following optional parameters:
  10943. @table @option
  10944. @item luma_spatial
  10945. A non-negative floating point number which specifies spatial luma strength.
  10946. It defaults to 4.0.
  10947. @item chroma_spatial
  10948. A non-negative floating point number which specifies spatial chroma strength.
  10949. It defaults to 3.0*@var{luma_spatial}/4.0.
  10950. @item luma_tmp
  10951. A floating point number which specifies luma temporal strength. It defaults to
  10952. 6.0*@var{luma_spatial}/4.0.
  10953. @item chroma_tmp
  10954. A floating point number which specifies chroma temporal strength. It defaults to
  10955. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  10956. @end table
  10957. @subsection Commands
  10958. This filter supports same @ref{commands} as options.
  10959. The command accepts the same syntax of the corresponding option.
  10960. If the specified expression is not valid, it is kept at its current
  10961. value.
  10962. @anchor{hwdownload}
  10963. @section hwdownload
  10964. Download hardware frames to system memory.
  10965. The input must be in hardware frames, and the output a non-hardware format.
  10966. Not all formats will be supported on the output - it may be necessary to insert
  10967. an additional @option{format} filter immediately following in the graph to get
  10968. the output in a supported format.
  10969. @section hwmap
  10970. Map hardware frames to system memory or to another device.
  10971. This filter has several different modes of operation; which one is used depends
  10972. on the input and output formats:
  10973. @itemize
  10974. @item
  10975. Hardware frame input, normal frame output
  10976. Map the input frames to system memory and pass them to the output. If the
  10977. original hardware frame is later required (for example, after overlaying
  10978. something else on part of it), the @option{hwmap} filter can be used again
  10979. in the next mode to retrieve it.
  10980. @item
  10981. Normal frame input, hardware frame output
  10982. If the input is actually a software-mapped hardware frame, then unmap it -
  10983. that is, return the original hardware frame.
  10984. Otherwise, a device must be provided. Create new hardware surfaces on that
  10985. device for the output, then map them back to the software format at the input
  10986. and give those frames to the preceding filter. This will then act like the
  10987. @option{hwupload} filter, but may be able to avoid an additional copy when
  10988. the input is already in a compatible format.
  10989. @item
  10990. Hardware frame input and output
  10991. A device must be supplied for the output, either directly or with the
  10992. @option{derive_device} option. The input and output devices must be of
  10993. different types and compatible - the exact meaning of this is
  10994. system-dependent, but typically it means that they must refer to the same
  10995. underlying hardware context (for example, refer to the same graphics card).
  10996. If the input frames were originally created on the output device, then unmap
  10997. to retrieve the original frames.
  10998. Otherwise, map the frames to the output device - create new hardware frames
  10999. on the output corresponding to the frames on the input.
  11000. @end itemize
  11001. The following additional parameters are accepted:
  11002. @table @option
  11003. @item mode
  11004. Set the frame mapping mode. Some combination of:
  11005. @table @var
  11006. @item read
  11007. The mapped frame should be readable.
  11008. @item write
  11009. The mapped frame should be writeable.
  11010. @item overwrite
  11011. The mapping will always overwrite the entire frame.
  11012. This may improve performance in some cases, as the original contents of the
  11013. frame need not be loaded.
  11014. @item direct
  11015. The mapping must not involve any copying.
  11016. Indirect mappings to copies of frames are created in some cases where either
  11017. direct mapping is not possible or it would have unexpected properties.
  11018. Setting this flag ensures that the mapping is direct and will fail if that is
  11019. not possible.
  11020. @end table
  11021. Defaults to @var{read+write} if not specified.
  11022. @item derive_device @var{type}
  11023. Rather than using the device supplied at initialisation, instead derive a new
  11024. device of type @var{type} from the device the input frames exist on.
  11025. @item reverse
  11026. In a hardware to hardware mapping, map in reverse - create frames in the sink
  11027. and map them back to the source. This may be necessary in some cases where
  11028. a mapping in one direction is required but only the opposite direction is
  11029. supported by the devices being used.
  11030. This option is dangerous - it may break the preceding filter in undefined
  11031. ways if there are any additional constraints on that filter's output.
  11032. Do not use it without fully understanding the implications of its use.
  11033. @end table
  11034. @anchor{hwupload}
  11035. @section hwupload
  11036. Upload system memory frames to hardware surfaces.
  11037. The device to upload to must be supplied when the filter is initialised. If
  11038. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  11039. option or with the @option{derive_device} option. The input and output devices
  11040. must be of different types and compatible - the exact meaning of this is
  11041. system-dependent, but typically it means that they must refer to the same
  11042. underlying hardware context (for example, refer to the same graphics card).
  11043. The following additional parameters are accepted:
  11044. @table @option
  11045. @item derive_device @var{type}
  11046. Rather than using the device supplied at initialisation, instead derive a new
  11047. device of type @var{type} from the device the input frames exist on.
  11048. @end table
  11049. @anchor{hwupload_cuda}
  11050. @section hwupload_cuda
  11051. Upload system memory frames to a CUDA device.
  11052. It accepts the following optional parameters:
  11053. @table @option
  11054. @item device
  11055. The number of the CUDA device to use
  11056. @end table
  11057. @section hqx
  11058. Apply a high-quality magnification filter designed for pixel art. This filter
  11059. was originally created by Maxim Stepin.
  11060. It accepts the following option:
  11061. @table @option
  11062. @item n
  11063. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  11064. @code{hq3x} and @code{4} for @code{hq4x}.
  11065. Default is @code{3}.
  11066. @end table
  11067. @section hstack
  11068. Stack input videos horizontally.
  11069. All streams must be of same pixel format and of same height.
  11070. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11071. to create same output.
  11072. The filter accepts the following option:
  11073. @table @option
  11074. @item inputs
  11075. Set number of input streams. Default is 2.
  11076. @item shortest
  11077. If set to 1, force the output to terminate when the shortest input
  11078. terminates. Default value is 0.
  11079. @end table
  11080. @section hsvhold
  11081. Turns a certain HSV range into gray values.
  11082. This filter measures color difference between set HSV color in options
  11083. and ones measured in video stream. Depending on options, output
  11084. colors can be changed to be gray or not.
  11085. The filter accepts the following options:
  11086. @table @option
  11087. @item hue
  11088. Set the hue value which will be used in color difference calculation.
  11089. Allowed range is from -360 to 360. Default value is 0.
  11090. @item sat
  11091. Set the saturation value which will be used in color difference calculation.
  11092. Allowed range is from -1 to 1. Default value is 0.
  11093. @item val
  11094. Set the value which will be used in color difference calculation.
  11095. Allowed range is from -1 to 1. Default value is 0.
  11096. @item similarity
  11097. Set similarity percentage with the key color.
  11098. Allowed range is from 0 to 1. Default value is 0.01.
  11099. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11100. @item blend
  11101. Blend percentage.
  11102. Allowed range is from 0 to 1. Default value is 0.
  11103. 0.0 makes pixels either fully gray, or not gray at all.
  11104. Higher values result in more gray pixels, with a higher gray pixel
  11105. the more similar the pixels color is to the key color.
  11106. @end table
  11107. @section hsvkey
  11108. Turns a certain HSV range into transparency.
  11109. This filter measures color difference between set HSV color in options
  11110. and ones measured in video stream. Depending on options, output
  11111. colors can be changed to transparent by adding alpha channel.
  11112. The filter accepts the following options:
  11113. @table @option
  11114. @item hue
  11115. Set the hue value which will be used in color difference calculation.
  11116. Allowed range is from -360 to 360. Default value is 0.
  11117. @item sat
  11118. Set the saturation value which will be used in color difference calculation.
  11119. Allowed range is from -1 to 1. Default value is 0.
  11120. @item val
  11121. Set the value which will be used in color difference calculation.
  11122. Allowed range is from -1 to 1. Default value is 0.
  11123. @item similarity
  11124. Set similarity percentage with the key color.
  11125. Allowed range is from 0 to 1. Default value is 0.01.
  11126. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11127. @item blend
  11128. Blend percentage.
  11129. Allowed range is from 0 to 1. Default value is 0.
  11130. 0.0 makes pixels either fully transparent, or not transparent at all.
  11131. Higher values result in semi-transparent pixels, with a higher transparency
  11132. the more similar the pixels color is to the key color.
  11133. @end table
  11134. @section hue
  11135. Modify the hue and/or the saturation of the input.
  11136. It accepts the following parameters:
  11137. @table @option
  11138. @item h
  11139. Specify the hue angle as a number of degrees. It accepts an expression,
  11140. and defaults to "0".
  11141. @item s
  11142. Specify the saturation in the [-10,10] range. It accepts an expression and
  11143. defaults to "1".
  11144. @item H
  11145. Specify the hue angle as a number of radians. It accepts an
  11146. expression, and defaults to "0".
  11147. @item b
  11148. Specify the brightness in the [-10,10] range. It accepts an expression and
  11149. defaults to "0".
  11150. @end table
  11151. @option{h} and @option{H} are mutually exclusive, and can't be
  11152. specified at the same time.
  11153. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  11154. expressions containing the following constants:
  11155. @table @option
  11156. @item n
  11157. frame count of the input frame starting from 0
  11158. @item pts
  11159. presentation timestamp of the input frame expressed in time base units
  11160. @item r
  11161. frame rate of the input video, NAN if the input frame rate is unknown
  11162. @item t
  11163. timestamp expressed in seconds, NAN if the input timestamp is unknown
  11164. @item tb
  11165. time base of the input video
  11166. @end table
  11167. @subsection Examples
  11168. @itemize
  11169. @item
  11170. Set the hue to 90 degrees and the saturation to 1.0:
  11171. @example
  11172. hue=h=90:s=1
  11173. @end example
  11174. @item
  11175. Same command but expressing the hue in radians:
  11176. @example
  11177. hue=H=PI/2:s=1
  11178. @end example
  11179. @item
  11180. Rotate hue and make the saturation swing between 0
  11181. and 2 over a period of 1 second:
  11182. @example
  11183. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  11184. @end example
  11185. @item
  11186. Apply a 3 seconds saturation fade-in effect starting at 0:
  11187. @example
  11188. hue="s=min(t/3\,1)"
  11189. @end example
  11190. The general fade-in expression can be written as:
  11191. @example
  11192. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  11193. @end example
  11194. @item
  11195. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  11196. @example
  11197. hue="s=max(0\, min(1\, (8-t)/3))"
  11198. @end example
  11199. The general fade-out expression can be written as:
  11200. @example
  11201. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  11202. @end example
  11203. @end itemize
  11204. @subsection Commands
  11205. This filter supports the following commands:
  11206. @table @option
  11207. @item b
  11208. @item s
  11209. @item h
  11210. @item H
  11211. Modify the hue and/or the saturation and/or brightness of the input video.
  11212. The command accepts the same syntax of the corresponding option.
  11213. If the specified expression is not valid, it is kept at its current
  11214. value.
  11215. @end table
  11216. @section huesaturation
  11217. Apply hue-saturation-intensity adjustments to input video stream.
  11218. This filter operates in RGB colorspace.
  11219. This filter accepts the following options:
  11220. @table @option
  11221. @item hue
  11222. Set the hue shift in degrees to apply. Default is 0.
  11223. Allowed range is from -180 to 180.
  11224. @item saturation
  11225. Set the saturation shift. Default is 0.
  11226. Allowed range is from -1 to 1.
  11227. @item intensity
  11228. Set the intensity shift. Default is 0.
  11229. Allowed range is from -1 to 1.
  11230. @item colors
  11231. Set which primary and complementary colors are going to be adjusted.
  11232. This options is set by providing one or multiple values.
  11233. This can select multiple colors at once. By default all colors are selected.
  11234. @table @samp
  11235. @item r
  11236. Adjust reds.
  11237. @item y
  11238. Adjust yellows.
  11239. @item g
  11240. Adjust greens.
  11241. @item c
  11242. Adjust cyans.
  11243. @item b
  11244. Adjust blues.
  11245. @item m
  11246. Adjust magentas.
  11247. @item a
  11248. Adjust all colors.
  11249. @end table
  11250. @item strength
  11251. Set strength of filtering. Allowed range is from 0 to 100.
  11252. Default value is 1.
  11253. @item rw, gw, bw
  11254. Set weight for each RGB component. Allowed range is from 0 to 1.
  11255. By default is set to 0.333, 0.334, 0.333.
  11256. Those options are used in saturation and lightess processing.
  11257. @item lightness
  11258. Set preserving lightness, by default is disabled.
  11259. Adjusting hues can change lightness from original RGB triplet,
  11260. with this option enabled lightness is kept at same value.
  11261. @end table
  11262. @section hysteresis
  11263. Grow first stream into second stream by connecting components.
  11264. This makes it possible to build more robust edge masks.
  11265. This filter accepts the following options:
  11266. @table @option
  11267. @item planes
  11268. Set which planes will be processed as bitmap, unprocessed planes will be
  11269. copied from first stream.
  11270. By default value 0xf, all planes will be processed.
  11271. @item threshold
  11272. Set threshold which is used in filtering. If pixel component value is higher than
  11273. this value filter algorithm for connecting components is activated.
  11274. By default value is 0.
  11275. @end table
  11276. The @code{hysteresis} filter also supports the @ref{framesync} options.
  11277. @section iccdetect
  11278. Detect the colorspace from an embedded ICC profile (if present), and update
  11279. the frame's tags accordingly.
  11280. This filter accepts the following options:
  11281. @table @option
  11282. @item force
  11283. If true, the frame's existing colorspace tags will always be overridden by
  11284. values detected from an ICC profile. Otherwise, they will only be assigned if
  11285. they contain @code{unknown}. Enabled by default.
  11286. @end table
  11287. @section iccgen
  11288. Generate ICC profiles and attach them to frames.
  11289. This filter accepts the following options:
  11290. @table @option
  11291. @item color_primaries
  11292. @item color_trc
  11293. Configure the colorspace that the ICC profile will be generated for. The
  11294. default value of @code{auto} infers the value from the input frame's metadata,
  11295. defaulting to BT.709/sRGB as appropriate.
  11296. See the @ref{setparams} filter for a list of possible values, but note that
  11297. @code{unknown} are not valid values for this filter.
  11298. @item force
  11299. If true, an ICC profile will be generated even if it would overwrite an
  11300. already existing ICC profile. Disabled by default.
  11301. @end table
  11302. @section identity
  11303. Obtain the identity score between two input videos.
  11304. This filter takes two input videos.
  11305. Both input videos must have the same resolution and pixel format for
  11306. this filter to work correctly. Also it assumes that both inputs
  11307. have the same number of frames, which are compared one by one.
  11308. The obtained per component, average, min and max identity score is printed through
  11309. the logging system.
  11310. The filter stores the calculated identity scores of each frame in frame metadata.
  11311. In the below example the input file @file{main.mpg} being processed is compared
  11312. with the reference file @file{ref.mpg}.
  11313. @example
  11314. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  11315. @end example
  11316. @section idet
  11317. Detect video interlacing type.
  11318. This filter tries to detect if the input frames are interlaced, progressive,
  11319. top or bottom field first. It will also try to detect fields that are
  11320. repeated between adjacent frames (a sign of telecine).
  11321. Single frame detection considers only immediately adjacent frames when classifying each frame.
  11322. Multiple frame detection incorporates the classification history of previous frames.
  11323. The filter will log these metadata values:
  11324. @table @option
  11325. @item single.current_frame
  11326. Detected type of current frame using single-frame detection. One of:
  11327. ``tff'' (top field first), ``bff'' (bottom field first),
  11328. ``progressive'', or ``undetermined''
  11329. @item single.tff
  11330. Cumulative number of frames detected as top field first using single-frame detection.
  11331. @item multiple.tff
  11332. Cumulative number of frames detected as top field first using multiple-frame detection.
  11333. @item single.bff
  11334. Cumulative number of frames detected as bottom field first using single-frame detection.
  11335. @item multiple.current_frame
  11336. Detected type of current frame using multiple-frame detection. One of:
  11337. ``tff'' (top field first), ``bff'' (bottom field first),
  11338. ``progressive'', or ``undetermined''
  11339. @item multiple.bff
  11340. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  11341. @item single.progressive
  11342. Cumulative number of frames detected as progressive using single-frame detection.
  11343. @item multiple.progressive
  11344. Cumulative number of frames detected as progressive using multiple-frame detection.
  11345. @item single.undetermined
  11346. Cumulative number of frames that could not be classified using single-frame detection.
  11347. @item multiple.undetermined
  11348. Cumulative number of frames that could not be classified using multiple-frame detection.
  11349. @item repeated.current_frame
  11350. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  11351. @item repeated.neither
  11352. Cumulative number of frames with no repeated field.
  11353. @item repeated.top
  11354. Cumulative number of frames with the top field repeated from the previous frame's top field.
  11355. @item repeated.bottom
  11356. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  11357. @end table
  11358. The filter accepts the following options:
  11359. @table @option
  11360. @item intl_thres
  11361. Set interlacing threshold.
  11362. @item prog_thres
  11363. Set progressive threshold.
  11364. @item rep_thres
  11365. Threshold for repeated field detection.
  11366. @item half_life
  11367. Number of frames after which a given frame's contribution to the
  11368. statistics is halved (i.e., it contributes only 0.5 to its
  11369. classification). The default of 0 means that all frames seen are given
  11370. full weight of 1.0 forever.
  11371. @item analyze_interlaced_flag
  11372. When this is not 0 then idet will use the specified number of frames to determine
  11373. if the interlaced flag is accurate, it will not count undetermined frames.
  11374. If the flag is found to be accurate it will be used without any further
  11375. computations, if it is found to be inaccurate it will be cleared without any
  11376. further computations. This allows inserting the idet filter as a low computational
  11377. method to clean up the interlaced flag
  11378. @end table
  11379. @section il
  11380. Deinterleave or interleave fields.
  11381. This filter allows one to process interlaced images fields without
  11382. deinterlacing them. Deinterleaving splits the input frame into 2
  11383. fields (so called half pictures). Odd lines are moved to the top
  11384. half of the output image, even lines to the bottom half.
  11385. You can process (filter) them independently and then re-interleave them.
  11386. The filter accepts the following options:
  11387. @table @option
  11388. @item luma_mode, l
  11389. @item chroma_mode, c
  11390. @item alpha_mode, a
  11391. Available values for @var{luma_mode}, @var{chroma_mode} and
  11392. @var{alpha_mode} are:
  11393. @table @samp
  11394. @item none
  11395. Do nothing.
  11396. @item deinterleave, d
  11397. Deinterleave fields, placing one above the other.
  11398. @item interleave, i
  11399. Interleave fields. Reverse the effect of deinterleaving.
  11400. @end table
  11401. Default value is @code{none}.
  11402. @item luma_swap, ls
  11403. @item chroma_swap, cs
  11404. @item alpha_swap, as
  11405. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  11406. @end table
  11407. @subsection Commands
  11408. This filter supports the all above options as @ref{commands}.
  11409. @section inflate
  11410. Apply inflate effect to the video.
  11411. This filter replaces the pixel by the local(3x3) average by taking into account
  11412. only values higher than the pixel.
  11413. It accepts the following options:
  11414. @table @option
  11415. @item threshold0
  11416. @item threshold1
  11417. @item threshold2
  11418. @item threshold3
  11419. Limit the maximum change for each plane, default is 65535.
  11420. If 0, plane will remain unchanged.
  11421. @end table
  11422. @subsection Commands
  11423. This filter supports the all above options as @ref{commands}.
  11424. @section interlace
  11425. Simple interlacing filter from progressive contents. This interleaves upper (or
  11426. lower) lines from odd frames with lower (or upper) lines from even frames,
  11427. halving the frame rate and preserving image height.
  11428. @example
  11429. Original Original New Frame
  11430. Frame 'j' Frame 'j+1' (tff)
  11431. ========== =========== ==================
  11432. Line 0 --------------------> Frame 'j' Line 0
  11433. Line 1 Line 1 ----> Frame 'j+1' Line 1
  11434. Line 2 ---------------------> Frame 'j' Line 2
  11435. Line 3 Line 3 ----> Frame 'j+1' Line 3
  11436. ... ... ...
  11437. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  11438. @end example
  11439. It accepts the following optional parameters:
  11440. @table @option
  11441. @item scan
  11442. This determines whether the interlaced frame is taken from the even
  11443. (tff - default) or odd (bff) lines of the progressive frame.
  11444. @item lowpass
  11445. Vertical lowpass filter to avoid twitter interlacing and
  11446. reduce moire patterns.
  11447. @table @samp
  11448. @item 0, off
  11449. Disable vertical lowpass filter
  11450. @item 1, linear
  11451. Enable linear filter (default)
  11452. @item 2, complex
  11453. Enable complex filter. This will slightly less reduce twitter and moire
  11454. but better retain detail and subjective sharpness impression.
  11455. @end table
  11456. @end table
  11457. @section kerndeint
  11458. Deinterlace input video by applying Donald Graft's adaptive kernel
  11459. deinterling. Work on interlaced parts of a video to produce
  11460. progressive frames.
  11461. The description of the accepted parameters follows.
  11462. @table @option
  11463. @item thresh
  11464. Set the threshold which affects the filter's tolerance when
  11465. determining if a pixel line must be processed. It must be an integer
  11466. in the range [0,255] and defaults to 10. A value of 0 will result in
  11467. applying the process on every pixels.
  11468. @item map
  11469. Paint pixels exceeding the threshold value to white if set to 1.
  11470. Default is 0.
  11471. @item order
  11472. Set the fields order. Swap fields if set to 1, leave fields alone if
  11473. 0. Default is 0.
  11474. @item sharp
  11475. Enable additional sharpening if set to 1. Default is 0.
  11476. @item twoway
  11477. Enable twoway sharpening if set to 1. Default is 0.
  11478. @end table
  11479. @subsection Examples
  11480. @itemize
  11481. @item
  11482. Apply default values:
  11483. @example
  11484. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  11485. @end example
  11486. @item
  11487. Enable additional sharpening:
  11488. @example
  11489. kerndeint=sharp=1
  11490. @end example
  11491. @item
  11492. Paint processed pixels in white:
  11493. @example
  11494. kerndeint=map=1
  11495. @end example
  11496. @end itemize
  11497. @section kirsch
  11498. Apply kirsch operator to input video stream.
  11499. The filter accepts the following option:
  11500. @table @option
  11501. @item planes
  11502. Set which planes will be processed, unprocessed planes will be copied.
  11503. By default value 0xf, all planes will be processed.
  11504. @item scale
  11505. Set value which will be multiplied with filtered result.
  11506. @item delta
  11507. Set value which will be added to filtered result.
  11508. @end table
  11509. @subsection Commands
  11510. This filter supports the all above options as @ref{commands}.
  11511. @section lagfun
  11512. Slowly update darker pixels.
  11513. This filter makes short flashes of light appear longer.
  11514. This filter accepts the following options:
  11515. @table @option
  11516. @item decay
  11517. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  11518. @item planes
  11519. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  11520. @end table
  11521. @subsection Commands
  11522. This filter supports the all above options as @ref{commands}.
  11523. @section lenscorrection
  11524. Correct radial lens distortion
  11525. This filter can be used to correct for radial distortion as can result from the use
  11526. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  11527. one can use tools available for example as part of opencv or simply trial-and-error.
  11528. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  11529. and extract the k1 and k2 coefficients from the resulting matrix.
  11530. Note that effectively the same filter is available in the open-source tools Krita and
  11531. Digikam from the KDE project.
  11532. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  11533. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  11534. brightness distribution, so you may want to use both filters together in certain
  11535. cases, though you will have to take care of ordering, i.e. whether vignetting should
  11536. be applied before or after lens correction.
  11537. @subsection Options
  11538. The filter accepts the following options:
  11539. @table @option
  11540. @item cx
  11541. Relative x-coordinate of the focal point of the image, and thereby the center of the
  11542. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11543. width. Default is 0.5.
  11544. @item cy
  11545. Relative y-coordinate of the focal point of the image, and thereby the center of the
  11546. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11547. height. Default is 0.5.
  11548. @item k1
  11549. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  11550. no correction. Default is 0.
  11551. @item k2
  11552. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  11553. 0 means no correction. Default is 0.
  11554. @item i
  11555. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  11556. Default is @code{nearest}.
  11557. @item fc
  11558. Specify the color of the unmapped pixels. For the syntax of this option,
  11559. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11560. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  11561. @end table
  11562. The formula that generates the correction is:
  11563. @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)
  11564. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  11565. distances from the focal point in the source and target images, respectively.
  11566. @subsection Commands
  11567. This filter supports the all above options as @ref{commands}.
  11568. @section lensfun
  11569. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  11570. The @code{lensfun} filter requires the camera make, camera model, and lens model
  11571. to apply the lens correction. The filter will load the lensfun database and
  11572. query it to find the corresponding camera and lens entries in the database. As
  11573. long as these entries can be found with the given options, the filter can
  11574. perform corrections on frames. Note that incomplete strings will result in the
  11575. filter choosing the best match with the given options, and the filter will
  11576. output the chosen camera and lens models (logged with level "info"). You must
  11577. provide the make, camera model, and lens model as they are required.
  11578. To obtain a list of available makes and models, leave out one or both of @code{make} and
  11579. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  11580. The first column is the make and the second column is the model.
  11581. To obtain a list of available lenses, set any values for make and model and leave out the
  11582. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  11583. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  11584. The filter accepts the following options:
  11585. @table @option
  11586. @item make
  11587. The make of the camera (for example, "Canon"). This option is required.
  11588. @item model
  11589. The model of the camera (for example, "Canon EOS 100D"). This option is
  11590. required.
  11591. @item lens_model
  11592. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  11593. option is required.
  11594. @item db_path
  11595. The full path to the lens database folder. If not set, the filter will attempt to
  11596. load the database from the install path when the library was built. Default is unset.
  11597. @item mode
  11598. The type of correction to apply. The following values are valid options:
  11599. @table @samp
  11600. @item vignetting
  11601. Enables fixing lens vignetting.
  11602. @item geometry
  11603. Enables fixing lens geometry. This is the default.
  11604. @item subpixel
  11605. Enables fixing chromatic aberrations.
  11606. @item vig_geo
  11607. Enables fixing lens vignetting and lens geometry.
  11608. @item vig_subpixel
  11609. Enables fixing lens vignetting and chromatic aberrations.
  11610. @item distortion
  11611. Enables fixing both lens geometry and chromatic aberrations.
  11612. @item all
  11613. Enables all possible corrections.
  11614. @end table
  11615. @item focal_length
  11616. The focal length of the image/video (zoom; expected constant for video). For
  11617. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  11618. range should be chosen when using that lens. Default 18.
  11619. @item aperture
  11620. The aperture of the image/video (expected constant for video). Note that
  11621. aperture is only used for vignetting correction. Default 3.5.
  11622. @item focus_distance
  11623. The focus distance of the image/video (expected constant for video). Note that
  11624. focus distance is only used for vignetting and only slightly affects the
  11625. vignetting correction process. If unknown, leave it at the default value (which
  11626. is 1000).
  11627. @item scale
  11628. The scale factor which is applied after transformation. After correction the
  11629. video is no longer necessarily rectangular. This parameter controls how much of
  11630. the resulting image is visible. The value 0 means that a value will be chosen
  11631. automatically such that there is little or no unmapped area in the output
  11632. image. 1.0 means that no additional scaling is done. Lower values may result
  11633. in more of the corrected image being visible, while higher values may avoid
  11634. unmapped areas in the output.
  11635. @item target_geometry
  11636. The target geometry of the output image/video. The following values are valid
  11637. options:
  11638. @table @samp
  11639. @item rectilinear (default)
  11640. @item fisheye
  11641. @item panoramic
  11642. @item equirectangular
  11643. @item fisheye_orthographic
  11644. @item fisheye_stereographic
  11645. @item fisheye_equisolid
  11646. @item fisheye_thoby
  11647. @end table
  11648. @item reverse
  11649. Apply the reverse of image correction (instead of correcting distortion, apply
  11650. it).
  11651. @item interpolation
  11652. The type of interpolation used when correcting distortion. The following values
  11653. are valid options:
  11654. @table @samp
  11655. @item nearest
  11656. @item linear (default)
  11657. @item lanczos
  11658. @end table
  11659. @end table
  11660. @subsection Examples
  11661. @itemize
  11662. @item
  11663. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  11664. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  11665. aperture of "8.0".
  11666. @example
  11667. 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
  11668. @end example
  11669. @item
  11670. Apply the same as before, but only for the first 5 seconds of video.
  11671. @example
  11672. 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
  11673. @end example
  11674. @end itemize
  11675. @section libplacebo
  11676. Flexible GPU-accelerated processing filter based on libplacebo
  11677. (@url{https://code.videolan.org/videolan/libplacebo}). Note that this filter
  11678. currently only accepts Vulkan input frames.
  11679. @subsection Options
  11680. The options for this filter are divided into the following sections:
  11681. @subsubsection Output mode
  11682. These options control the overall output mode. By default, libplacebo will try
  11683. to preserve the source colorimetry and size as best as it can, but it will
  11684. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  11685. in source frames.
  11686. @table @option
  11687. @item w
  11688. @item h
  11689. Set the output video dimension expression. Default value is the input dimension.
  11690. Allows for the same expressions as the @ref{scale} filter.
  11691. @item format
  11692. Set the output format override. If unset (the default), frames will be output
  11693. in the same format as the respective input frames. Otherwise, format conversion
  11694. will be performed.
  11695. @item force_original_aspect_ratio
  11696. @item force_divisible_by
  11697. Work the same as the identical @ref{scale} filter options.
  11698. @item normalize_sar
  11699. If enabled (the default), output frames will always have a pixel aspect ratio
  11700. of 1:1. If disabled, any aspect ratio mismatches, including those from e.g.
  11701. anamorphic video sources, are forwarded to the output pixel aspect ratio.
  11702. @item pad_crop_ratio
  11703. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  11704. cropping when the input aspect ratio does not match the output aspect ratio and
  11705. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  11706. content with black borders, while a value of @code{1.0} always crops off parts
  11707. of the content. Intermediate values are possible, leading to a mix of the two
  11708. approaches.
  11709. @item colorspace
  11710. @item color_primaries
  11711. @item color_trc
  11712. @item range
  11713. Configure the colorspace that output frames will be delivered in. The default
  11714. value of @code{auto} outputs frames in the same format as the input frames,
  11715. leading to no change. For any other value, conversion will be performed.
  11716. See the @ref{setparams} filter for a list of possible values.
  11717. @item apply_filmgrain
  11718. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  11719. it from the output. Enabled by default.
  11720. @item apply_dolbyvision
  11721. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  11722. the output. Enabled by default. Note that Dolby Vision will always output
  11723. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  11724. picked as the values of @code{auto} for the respective frame output options.
  11725. @end table
  11726. @subsubsection Scaling
  11727. The options in this section control how libplacebo performs upscaling and (if
  11728. necessary) downscaling. Note that libplacebo will always internally operate on
  11729. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  11730. necessarily be upsampled and downsampled as part of the rendering process. That
  11731. means scaling might be in effect even if the source and destination resolution
  11732. are the same.
  11733. @table @option
  11734. @item upscaler
  11735. @item downscaler
  11736. Configure the filter kernel used for upscaling and downscaling. The respective
  11737. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  11738. values, pass @code{help} to these options. The most important values are:
  11739. @table @samp
  11740. @item none
  11741. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  11742. fast but poor quality, especially when downscaling.
  11743. @item bilinear
  11744. Bilinear interpolation. Can generally be done for free on GPUs, except when
  11745. doing so would lead to aliasing. Fast and low quality.
  11746. @item nearest
  11747. Nearest-neighbour interpolation. Sharp but highly aliasing.
  11748. @item oversample
  11749. Algorithm that looks visually similar to nearest-neighbour interpolation but
  11750. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  11751. minimal distortion of the artistic appearance.
  11752. @item lanczos
  11753. Standard sinc-sinc interpolation kernel.
  11754. @item spline36
  11755. Cubic spline approximation of lanczos. No difference in performance, but has
  11756. very slightly less ringing.
  11757. @item ewa_lanczos
  11758. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  11759. This is also popularly referred to as just "Jinc scaling". Slow but very high
  11760. quality.
  11761. @item gaussian
  11762. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  11763. very blurry.
  11764. @item mitchell
  11765. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  11766. little ringing.
  11767. @end table
  11768. @item lut_entries
  11769. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  11770. default of @code{0} will pick libplacebo's internal default, typically
  11771. @code{64}.
  11772. @item antiringing
  11773. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  11774. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  11775. aliasing if set too high. Disabled by default.
  11776. @item sigmoid
  11777. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  11778. Enabled by default.
  11779. @end table
  11780. @subsubsection Debanding
  11781. Libplacebo comes with a built-in debanding filter that is good at counteracting
  11782. many common sources of banding and blocking. Turning this on is highly
  11783. recommended whenever quality is desired.
  11784. @table @option
  11785. @item deband
  11786. Enable (fast) debanding algorithm. Disabled by default.
  11787. @item deband_iterations
  11788. Number of deband iterations of the debanding algorithm. Each iteration is
  11789. performed with progressively increased radius (and diminished threshold).
  11790. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  11791. @item deband_threshold
  11792. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  11793. Defaults to @code{4.0}.
  11794. @item deband_radius
  11795. Debanding filter radius. A higher radius is better for slow gradients, while
  11796. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  11797. @item deband_grain
  11798. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  11799. @code{6.0}.
  11800. @end table
  11801. @subsubsection Color adjustment
  11802. A collection of subjective color controls. Not very rigorous, so the exact
  11803. effect will vary somewhat depending on the input primaries and colorspace.
  11804. @table @option
  11805. @item brightness
  11806. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  11807. @item contrast
  11808. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11809. @item saturation
  11810. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11811. @item hue
  11812. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  11813. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  11814. coefficients for RGB inputs.
  11815. @item gamma
  11816. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11817. @item cones
  11818. Cone model to use for color blindness simulation. Accepts any combination of
  11819. @code{l}, @code{m} and @code{s}. Here are some examples:
  11820. @table @samp
  11821. @item m
  11822. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  11823. @item l
  11824. Protanomaly / protanopia (affecting 1%-2% of the population)
  11825. @item l+m
  11826. Monochromacy (very rare)
  11827. @item l+m+s
  11828. Achromatopsy (complete loss of daytime vision, extremely rare)
  11829. @end table
  11830. @item cone-strength
  11831. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  11832. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  11833. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  11834. above @code{1.0} result in exaggerating the differences between cones, which
  11835. may help compensate for reduced color vision.
  11836. @end table
  11837. @subsubsection Peak detection
  11838. To help deal with sources that only have static HDR10 metadata (or no tagging
  11839. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  11840. analyze source frames and adapt the tone mapping function in realtime. If this
  11841. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  11842. recommended to turn this feature off.
  11843. @table @option
  11844. @item peak_detect
  11845. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  11846. dynamic detection from the input. Note that the detected values do not get
  11847. written back to the output frames, they merely guide the internal tone mapping
  11848. process. Enabled by default.
  11849. @item smoothing_period
  11850. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  11851. values result in peak detection becoming less responsive to changes in the
  11852. input. Defaults to @code{100.0}.
  11853. @item minimum_peak
  11854. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  11855. and @code{100.0}. Defaults to @code{1.0}.
  11856. @item scene_threshold_low
  11857. @item scene_threshold_high
  11858. Lower and upper thresholds for scene change detection. Expressed in a
  11859. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  11860. and @code{10.0}, respectively. Setting either to a negative value disables
  11861. this functionality.
  11862. @item overshoot
  11863. Peak smoothing overshoot margin, between @code{0.0} and @code{1.0}. Provides a
  11864. safety margin to prevent clipping as a result of peak smoothing. Defaults to
  11865. @code{0.05}, corresponding to a margin of 5%.
  11866. @end table
  11867. @subsubsection Tone mapping
  11868. The options in this section control how libplacebo performs tone-mapping and
  11869. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  11870. In general, libplacebo relies on accurate source tagging and mastering display
  11871. gamut information to produce the best results.
  11872. @table @option
  11873. @item intent
  11874. Rendering intent to use when adapting between different primary color gamuts
  11875. (after tone-mapping).
  11876. @table @samp
  11877. @item perceptual
  11878. Perceptual gamut mapping. Currently equivalent to relative colorimetric.
  11879. @item relative
  11880. Relative colorimetric. This is the default.
  11881. @item absolute
  11882. Absolute colorimetric.
  11883. @item saturation
  11884. Saturation mapping. Forcibly stretches the source gamut to the target gamut.
  11885. @end table
  11886. @item gamut_mode
  11887. How to handle out-of-gamut colors that can occur as a result of colorimetric
  11888. gamut mapping.
  11889. @table @samp
  11890. @item clip
  11891. Do nothing, simply clip out-of-range colors to the RGB volume. This is the
  11892. default.
  11893. @item warn
  11894. Highlight out-of-gamut pixels (by coloring them pink).
  11895. @item darken
  11896. Linearly reduces content brightness to preserves saturated details, followed by
  11897. clipping the remaining out-of-gamut colors. As the name implies, this makes
  11898. everything darker, but provides a good balance between preserving details and
  11899. colors.
  11900. @item desaturate
  11901. Hard-desaturates out-of-gamut colors towards white, while preserving the
  11902. luminance. Has a tendency to shift colors.
  11903. @end table
  11904. @item tonemapping
  11905. Tone-mapping algorithm to use. Available values are:
  11906. @table @samp
  11907. @item auto
  11908. Automatic selection based on internal heuristics. This is the default.
  11909. @item clip
  11910. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  11911. accuracy for in-range colors but completely destroys out-of-range information.
  11912. Does not perform any black point adaptation. Not configurable.
  11913. @item bt.2390
  11914. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  11915. segment. The knee point offset is configurable. Note that this parameter
  11916. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  11917. spec.
  11918. @item bt.2446a
  11919. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  11920. sources. Can be used for both forward and inverse tone mapping. Not
  11921. configurable.
  11922. @item spline
  11923. Simple spline consisting of two polynomials, joined by a single pivot point.
  11924. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  11925. Can be used for both forward and inverse tone mapping.
  11926. @item reinhard
  11927. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  11928. local contrast coefficient at the display peak. Essentially, a parameter of
  11929. @code{0.5} implies that the reference white will be about half as bright as
  11930. when clipping. Defaults to @code{0.5}, which results in the simplest
  11931. formulation of this function.
  11932. @item mobius
  11933. Generalization of the reinhard tone mapping algorithm to support an additional
  11934. linear slope near black. The tone mapping parameter indicates the trade-off
  11935. between the linear section and the non-linear section. Essentially, for a given
  11936. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  11937. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  11938. this curve behave like @code{clip}, while values near @code{0.0} make this
  11939. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  11940. provides a good balance between colorimetric accuracy and preserving
  11941. out-of-gamut details.
  11942. @item hable
  11943. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  11944. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  11945. Popularized by its use in video games with HDR rendering. Preserves both dark
  11946. and bright details very well, but comes with the drawback of changing the
  11947. average brightness quite significantly. This is sort of similar to
  11948. @code{reinhard} with parameter @code{0.24}.
  11949. @item gamma
  11950. Fits a gamma (power) function to transfer between the source and target color
  11951. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  11952. linear sections. This preserves details at all scales fairly accurately, but
  11953. can result in an image with a muted or dull appearance. The parameter is used
  11954. as the cutoff point, defaulting to @code{0.5}.
  11955. @item linear
  11956. Linearly stretches the input range to the output range, in PQ space. This will
  11957. preserve all details accurately, but results in a significantly different
  11958. average brightness. Can be used for inverse tone-mapping in addition to regular
  11959. tone-mapping. The parameter can be used as an additional linear gain
  11960. coefficient (defaulting to @code{1.0}).
  11961. @end table
  11962. @item tonemapping_param
  11963. For tunable tone mapping functions, this parameter can be used to fine-tune the
  11964. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  11965. value of @code{0.0} is replaced by the curve's preferred default setting.
  11966. @item tonemapping_mode
  11967. This option determines how the tone mapping function specified by
  11968. @code{tonemapping} is applied to the colors in a scene. Possible values are:
  11969. @table @samp
  11970. @item auto
  11971. Automatic selection based on internal heuristics. This is the default.
  11972. @item rgb
  11973. Apply the function per-channel in the RGB colorspace.
  11974. Per-channel tone-mapping in RGB. Guarantees no clipping and heavily desaturates
  11975. the output, but distorts the colors quite significantly. Very similar to the
  11976. "Hollywood" look and feel.
  11977. @item max
  11978. Tone-mapping is performed on the brightest component found in the signal. Good
  11979. at preserving details in highlights, but has a tendency to crush blacks.
  11980. @item hybrid
  11981. Tone-map per-channel for highlights and linearly (luma-based) for
  11982. midtones/shadows, based on a fixed gamma @code{2.4} coefficient curve.
  11983. @item luma
  11984. Tone-map linearly on the luma component (CIE Y), and adjust (desaturate) the
  11985. chromaticities to compensate using a simple constant factor. This is
  11986. essentially the mode used in ITU-R BT.2446 method A.
  11987. @end table
  11988. @item inverse_tonemapping
  11989. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  11990. output color volumes. Disabled by default.
  11991. @item tonemapping_crosstalk
  11992. Extra tone-mapping crosstalk factor, between @code{0.0} and @code{0.3}. This
  11993. can help reduce issues tone-mapping certain bright spectral colors. Defaults to
  11994. @code{0.04}.
  11995. @item tonemapping_lut_size
  11996. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  11997. @code{256}. Note that this figure is squared when combined with
  11998. @code{peak_detect}.
  11999. @end table
  12000. @subsubsection Dithering
  12001. By default, libplacebo will dither whenever necessary, which includes rendering
  12002. to any integer format below 16-bit precision. It's recommended to always leave
  12003. this on, since not doing so may result in visible banding in the output, even
  12004. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12005. use @code{ordered_fixed} instead of disabling dithering.
  12006. @table @option
  12007. @item dithering
  12008. Dithering method to use. Accepts the following values:
  12009. @table @samp
  12010. @item none
  12011. Disables dithering completely. May result in visible banding.
  12012. @item blue
  12013. Dither with pseudo-blue noise. This is the default.
  12014. @item ordered
  12015. Tunable ordered dither pattern.
  12016. @item ordered_fixed
  12017. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12018. @item white
  12019. Dither with white noise. Texture-less.
  12020. @end table
  12021. @item dither_lut_size
  12022. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12023. @code{6}, corresponding to a LUT size of @code{64x64}.
  12024. @item dither_temporal
  12025. Enables temporal dithering. Disabled by default.
  12026. @end table
  12027. @subsubsection Custom shaders
  12028. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12029. syntax. A collection of such shaders can be found here:
  12030. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12031. A full description of the mpv shader format is beyond the scope of this
  12032. section, but a summary can be found here:
  12033. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12034. @table @option
  12035. @item custom_shader_path
  12036. Specifies a path to a custom shader file to load at runtime.
  12037. @item custom_shader_bin
  12038. Specifies a complete custom shader as a raw string.
  12039. @end table
  12040. @subsubsection Debugging / performance
  12041. All of the options in this section default off. They may be of assistance when
  12042. attempting to squeeze the maximum performance at the cost of quality.
  12043. @table @option
  12044. @item skip_aa
  12045. Disable anti-aliasing when downscaling.
  12046. @item polar_cutoff
  12047. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  12048. @code{0.0} and @code{1.0}.
  12049. @item disable_linear
  12050. Disable linear light scaling.
  12051. @item disable_builtin
  12052. Disable built-in GPU sampling (forces LUT).
  12053. @item force_icc_lut
  12054. Force the use of a full ICC 3DLUT for gamut mapping.
  12055. @item disable_fbos
  12056. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12057. offering the maximum possible speed.
  12058. @end table
  12059. @subsection Commands
  12060. This filter supports almost all of the above options as @ref{commands}.
  12061. @subsection Examples
  12062. @itemize
  12063. @item
  12064. Complete example for how to initialize the Vulkan device, upload frames to the
  12065. GPU, perform filter conversion to yuv420p, and download frames back to the CPU
  12066. for output. Note that in specific cases you can get around the need to perform
  12067. format conversion by specifying the correct @code{format} filter option
  12068. corresponding to the input frames.
  12069. @example
  12070. ffmpeg -i $INPUT -init_hw_device vulkan -vf hwupload,libplacebo=format=yuv420p,hwdownload,format=yuv420p $OUTPUT
  12071. @end example
  12072. @item
  12073. Tone-map input to standard gamut BT.709 output:
  12074. @example
  12075. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12076. @end example
  12077. @item
  12078. Rescale input to fit into standard 1080p, with high quality scaling:
  12079. @example
  12080. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12081. @end example
  12082. @item
  12083. Convert input to standard sRGB JPEG:
  12084. @example
  12085. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12086. @end example
  12087. @item
  12088. Use higher quality debanding settings:
  12089. @example
  12090. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  12091. @end example
  12092. @item
  12093. Run this filter on the CPU, on systems with Mesa installed (and with the most
  12094. expensive options disabled):
  12095. @example
  12096. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  12097. @end example
  12098. @item
  12099. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  12100. doing it with this filter. Note that this is only a gain if the frames are
  12101. either already on the GPU, or if you're using libplacebo for other purposes,
  12102. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  12103. @example
  12104. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  12105. @end example
  12106. @end itemize
  12107. @section libvmaf
  12108. Calulate the VMAF (Video Multi-Method Assessment Fusion) score for a
  12109. reference/distorted pair of input videos.
  12110. The first input is the distorted video, and the second input is the reference video.
  12111. The obtained VMAF score is printed through the logging system.
  12112. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12113. After installing the library it can be enabled using:
  12114. @code{./configure --enable-libvmaf}.
  12115. The filter has following options:
  12116. @table @option
  12117. @item model
  12118. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  12119. Default value: @code{"version=vmaf_v0.6.1"}
  12120. @item model_path
  12121. Deprecated, use model='path=...'.
  12122. @item enable_transform
  12123. Deprecated, use model='enable_transform=true'.
  12124. @item phone_model
  12125. Deprecated, use model='enable_transform=true'.
  12126. @item enable_conf_interval
  12127. Deprecated, use model='enable_conf_interval=true'.
  12128. @item feature
  12129. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  12130. @item psnr
  12131. Deprecated, use feature='name=psnr'.
  12132. @item ssim
  12133. Deprecated, use feature='name=ssim'.
  12134. @item ms_ssim
  12135. Deprecated, use feature='name=ms_ssim'.
  12136. @item log_path
  12137. Set the file path to be used to store log files.
  12138. @item log_fmt
  12139. Set the format of the log file (xml, json, csv, or sub).
  12140. @item n_threads
  12141. Set number of threads to be used when initializing libvmaf.
  12142. Default value: @code{0}, no threads.
  12143. @item n_subsample
  12144. Set frame subsampling interval to be used.
  12145. @end table
  12146. This filter also supports the @ref{framesync} options.
  12147. @subsection Examples
  12148. @itemize
  12149. @item
  12150. In the examples below, a distorted video @file{distorted.mpg} is
  12151. compared with a reference file @file{reference.mpg}.
  12152. @item
  12153. Basic usage:
  12154. @example
  12155. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  12156. @end example
  12157. @item
  12158. Example with multiple models:
  12159. @example
  12160. 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 -
  12161. @end example
  12162. @item
  12163. Example with multiple addtional features:
  12164. @example
  12165. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  12166. @end example
  12167. @item
  12168. Example with options and different containers:
  12169. @example
  12170. 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 -
  12171. @end example
  12172. @end itemize
  12173. @section limitdiff
  12174. Apply limited difference filter using second and optionally third video stream.
  12175. The filter accepts the following options:
  12176. @table @option
  12177. @item threshold
  12178. Set the threshold to use when allowing certain differences between video streams.
  12179. Any absolute difference value lower or exact than this threshold will pick pixel components from
  12180. first video stream.
  12181. @item elasticity
  12182. Set the elasticity of soft thresholding when processing video streams.
  12183. This value multiplied with first one sets second threshold.
  12184. Any absolute difference value greater or exact than second threshold will pick pixel components
  12185. from second video stream. For values between those two threshold
  12186. linear interpolation between first and second video stream will be used.
  12187. @item reference
  12188. Enable the reference (third) video stream processing. By default is disabled.
  12189. If set, this video stream will be used for calculating absolute difference with first video
  12190. stream.
  12191. @item planes
  12192. Specify which planes will be processed. Defaults to all available.
  12193. @end table
  12194. @subsection Commands
  12195. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  12196. @section limiter
  12197. Limits the pixel components values to the specified range [min, max].
  12198. The filter accepts the following options:
  12199. @table @option
  12200. @item min
  12201. Lower bound. Defaults to the lowest allowed value for the input.
  12202. @item max
  12203. Upper bound. Defaults to the highest allowed value for the input.
  12204. @item planes
  12205. Specify which planes will be processed. Defaults to all available.
  12206. @end table
  12207. @subsection Commands
  12208. This filter supports the all above options as @ref{commands}.
  12209. @section loop
  12210. Loop video frames.
  12211. The filter accepts the following options:
  12212. @table @option
  12213. @item loop
  12214. Set the number of loops. Setting this value to -1 will result in infinite loops.
  12215. Default is 0.
  12216. @item size
  12217. Set maximal size in number of frames. Default is 0.
  12218. @item start
  12219. Set first frame of loop. Default is 0.
  12220. @end table
  12221. @subsection Examples
  12222. @itemize
  12223. @item
  12224. Loop single first frame infinitely:
  12225. @example
  12226. loop=loop=-1:size=1:start=0
  12227. @end example
  12228. @item
  12229. Loop single first frame 10 times:
  12230. @example
  12231. loop=loop=10:size=1:start=0
  12232. @end example
  12233. @item
  12234. Loop 10 first frames 5 times:
  12235. @example
  12236. loop=loop=5:size=10:start=0
  12237. @end example
  12238. @end itemize
  12239. @section lut1d
  12240. Apply a 1D LUT to an input video.
  12241. The filter accepts the following options:
  12242. @table @option
  12243. @item file
  12244. Set the 1D LUT file name.
  12245. Currently supported formats:
  12246. @table @samp
  12247. @item cube
  12248. Iridas
  12249. @item csp
  12250. cineSpace
  12251. @end table
  12252. @item interp
  12253. Select interpolation mode.
  12254. Available values are:
  12255. @table @samp
  12256. @item nearest
  12257. Use values from the nearest defined point.
  12258. @item linear
  12259. Interpolate values using the linear interpolation.
  12260. @item cosine
  12261. Interpolate values using the cosine interpolation.
  12262. @item cubic
  12263. Interpolate values using the cubic interpolation.
  12264. @item spline
  12265. Interpolate values using the spline interpolation.
  12266. @end table
  12267. @end table
  12268. @subsection Commands
  12269. This filter supports the all above options as @ref{commands}.
  12270. @anchor{lut3d}
  12271. @section lut3d
  12272. Apply a 3D LUT to an input video.
  12273. The filter accepts the following options:
  12274. @table @option
  12275. @item file
  12276. Set the 3D LUT file name.
  12277. Currently supported formats:
  12278. @table @samp
  12279. @item 3dl
  12280. AfterEffects
  12281. @item cube
  12282. Iridas
  12283. @item dat
  12284. DaVinci
  12285. @item m3d
  12286. Pandora
  12287. @item csp
  12288. cineSpace
  12289. @end table
  12290. @item interp
  12291. Select interpolation mode.
  12292. Available values are:
  12293. @table @samp
  12294. @item nearest
  12295. Use values from the nearest defined point.
  12296. @item trilinear
  12297. Interpolate values using the 8 points defining a cube.
  12298. @item tetrahedral
  12299. Interpolate values using a tetrahedron.
  12300. @item pyramid
  12301. Interpolate values using a pyramid.
  12302. @item prism
  12303. Interpolate values using a prism.
  12304. @end table
  12305. @end table
  12306. @subsection Commands
  12307. This filter supports the @code{interp} option as @ref{commands}.
  12308. @section lumakey
  12309. Turn certain luma values into transparency.
  12310. The filter accepts the following options:
  12311. @table @option
  12312. @item threshold
  12313. Set the luma which will be used as base for transparency.
  12314. Default value is @code{0}.
  12315. @item tolerance
  12316. Set the range of luma values to be keyed out.
  12317. Default value is @code{0.01}.
  12318. @item softness
  12319. Set the range of softness. Default value is @code{0}.
  12320. Use this to control gradual transition from zero to full transparency.
  12321. @end table
  12322. @subsection Commands
  12323. This filter supports same @ref{commands} as options.
  12324. The command accepts the same syntax of the corresponding option.
  12325. If the specified expression is not valid, it is kept at its current
  12326. value.
  12327. @section lut, lutrgb, lutyuv
  12328. Compute a look-up table for binding each pixel component input value
  12329. to an output value, and apply it to the input video.
  12330. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  12331. to an RGB input video.
  12332. These filters accept the following parameters:
  12333. @table @option
  12334. @item c0
  12335. set first pixel component expression
  12336. @item c1
  12337. set second pixel component expression
  12338. @item c2
  12339. set third pixel component expression
  12340. @item c3
  12341. set fourth pixel component expression, corresponds to the alpha component
  12342. @item r
  12343. set red component expression
  12344. @item g
  12345. set green component expression
  12346. @item b
  12347. set blue component expression
  12348. @item a
  12349. alpha component expression
  12350. @item y
  12351. set Y/luminance component expression
  12352. @item u
  12353. set U/Cb component expression
  12354. @item v
  12355. set V/Cr component expression
  12356. @end table
  12357. Each of them specifies the expression to use for computing the lookup table for
  12358. the corresponding pixel component values.
  12359. The exact component associated to each of the @var{c*} options depends on the
  12360. format in input.
  12361. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  12362. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  12363. The expressions can contain the following constants and functions:
  12364. @table @option
  12365. @item w
  12366. @item h
  12367. The input width and height.
  12368. @item val
  12369. The input value for the pixel component.
  12370. @item clipval
  12371. The input value, clipped to the @var{minval}-@var{maxval} range.
  12372. @item maxval
  12373. The maximum value for the pixel component.
  12374. @item minval
  12375. The minimum value for the pixel component.
  12376. @item negval
  12377. The negated value for the pixel component value, clipped to the
  12378. @var{minval}-@var{maxval} range; it corresponds to the expression
  12379. "maxval-clipval+minval".
  12380. @item clip(val)
  12381. The computed value in @var{val}, clipped to the
  12382. @var{minval}-@var{maxval} range.
  12383. @item gammaval(gamma)
  12384. The computed gamma correction value of the pixel component value,
  12385. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  12386. expression
  12387. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  12388. @end table
  12389. All expressions default to "clipval".
  12390. @subsection Commands
  12391. This filter supports same @ref{commands} as options.
  12392. @subsection Examples
  12393. @itemize
  12394. @item
  12395. Negate input video:
  12396. @example
  12397. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  12398. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  12399. @end example
  12400. The above is the same as:
  12401. @example
  12402. lutrgb="r=negval:g=negval:b=negval"
  12403. lutyuv="y=negval:u=negval:v=negval"
  12404. @end example
  12405. @item
  12406. Negate luminance:
  12407. @example
  12408. lutyuv=y=negval
  12409. @end example
  12410. @item
  12411. Remove chroma components, turning the video into a graytone image:
  12412. @example
  12413. lutyuv="u=128:v=128"
  12414. @end example
  12415. @item
  12416. Apply a luma burning effect:
  12417. @example
  12418. lutyuv="y=2*val"
  12419. @end example
  12420. @item
  12421. Remove green and blue components:
  12422. @example
  12423. lutrgb="g=0:b=0"
  12424. @end example
  12425. @item
  12426. Set a constant alpha channel value on input:
  12427. @example
  12428. format=rgba,lutrgb=a="maxval-minval/2"
  12429. @end example
  12430. @item
  12431. Correct luminance gamma by a factor of 0.5:
  12432. @example
  12433. lutyuv=y=gammaval(0.5)
  12434. @end example
  12435. @item
  12436. Discard least significant bits of luma:
  12437. @example
  12438. lutyuv=y='bitand(val, 128+64+32)'
  12439. @end example
  12440. @item
  12441. Technicolor like effect:
  12442. @example
  12443. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  12444. @end example
  12445. @end itemize
  12446. @section lut2, tlut2
  12447. The @code{lut2} filter takes two input streams and outputs one
  12448. stream.
  12449. The @code{tlut2} (time lut2) filter takes two consecutive frames
  12450. from one single stream.
  12451. This filter accepts the following parameters:
  12452. @table @option
  12453. @item c0
  12454. set first pixel component expression
  12455. @item c1
  12456. set second pixel component expression
  12457. @item c2
  12458. set third pixel component expression
  12459. @item c3
  12460. set fourth pixel component expression, corresponds to the alpha component
  12461. @item d
  12462. set output bit depth, only available for @code{lut2} filter. By default is 0,
  12463. which means bit depth is automatically picked from first input format.
  12464. @end table
  12465. The @code{lut2} filter also supports the @ref{framesync} options.
  12466. Each of them specifies the expression to use for computing the lookup table for
  12467. the corresponding pixel component values.
  12468. The exact component associated to each of the @var{c*} options depends on the
  12469. format in inputs.
  12470. The expressions can contain the following constants:
  12471. @table @option
  12472. @item w
  12473. @item h
  12474. The input width and height.
  12475. @item x
  12476. The first input value for the pixel component.
  12477. @item y
  12478. The second input value for the pixel component.
  12479. @item bdx
  12480. The first input video bit depth.
  12481. @item bdy
  12482. The second input video bit depth.
  12483. @end table
  12484. All expressions default to "x".
  12485. @subsection Commands
  12486. This filter supports the all above options as @ref{commands} except option @code{d}.
  12487. @subsection Examples
  12488. @itemize
  12489. @item
  12490. Highlight differences between two RGB video streams:
  12491. @example
  12492. 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)'
  12493. @end example
  12494. @item
  12495. Highlight differences between two YUV video streams:
  12496. @example
  12497. 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)'
  12498. @end example
  12499. @item
  12500. Show max difference between two video streams:
  12501. @example
  12502. 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)))'
  12503. @end example
  12504. @end itemize
  12505. @section maskedclamp
  12506. Clamp the first input stream with the second input and third input stream.
  12507. Returns the value of first stream to be between second input
  12508. stream - @code{undershoot} and third input stream + @code{overshoot}.
  12509. This filter accepts the following options:
  12510. @table @option
  12511. @item undershoot
  12512. Default value is @code{0}.
  12513. @item overshoot
  12514. Default value is @code{0}.
  12515. @item planes
  12516. Set which planes will be processed as bitmap, unprocessed planes will be
  12517. copied from first stream.
  12518. By default value 0xf, all planes will be processed.
  12519. @end table
  12520. @subsection Commands
  12521. This filter supports the all above options as @ref{commands}.
  12522. @section maskedmax
  12523. Merge the second and third input stream into output stream using absolute differences
  12524. between second input stream and first input stream and absolute difference between
  12525. third input stream and first input stream. The picked value will be from second input
  12526. stream if second absolute difference is greater than first one or from third input stream
  12527. otherwise.
  12528. This filter accepts the following options:
  12529. @table @option
  12530. @item planes
  12531. Set which planes will be processed as bitmap, unprocessed planes will be
  12532. copied from first stream.
  12533. By default value 0xf, all planes will be processed.
  12534. @end table
  12535. @subsection Commands
  12536. This filter supports the all above options as @ref{commands}.
  12537. @section maskedmerge
  12538. Merge the first input stream with the second input stream using per pixel
  12539. weights in the third input stream.
  12540. A value of 0 in the third stream pixel component means that pixel component
  12541. from first stream is returned unchanged, while maximum value (eg. 255 for
  12542. 8-bit videos) means that pixel component from second stream is returned
  12543. unchanged. Intermediate values define the amount of merging between both
  12544. input stream's pixel components.
  12545. This filter accepts the following options:
  12546. @table @option
  12547. @item planes
  12548. Set which planes will be processed as bitmap, unprocessed planes will be
  12549. copied from first stream.
  12550. By default value 0xf, all planes will be processed.
  12551. @end table
  12552. @subsection Commands
  12553. This filter supports the all above options as @ref{commands}.
  12554. @section maskedmin
  12555. Merge the second and third input stream into output stream using absolute differences
  12556. between second input stream and first input stream and absolute difference between
  12557. third input stream and first input stream. The picked value will be from second input
  12558. stream if second absolute difference is less than first one or from third input stream
  12559. otherwise.
  12560. This filter accepts the following options:
  12561. @table @option
  12562. @item planes
  12563. Set which planes will be processed as bitmap, unprocessed planes will be
  12564. copied from first stream.
  12565. By default value 0xf, all planes will be processed.
  12566. @end table
  12567. @subsection Commands
  12568. This filter supports the all above options as @ref{commands}.
  12569. @section maskedthreshold
  12570. Pick pixels comparing absolute difference of two video streams with fixed
  12571. threshold.
  12572. If absolute difference between pixel component of first and second video
  12573. stream is equal or lower than user supplied threshold than pixel component
  12574. from first video stream is picked, otherwise pixel component from second
  12575. video stream is picked.
  12576. This filter accepts the following options:
  12577. @table @option
  12578. @item threshold
  12579. Set threshold used when picking pixels from absolute difference from two input
  12580. video streams.
  12581. @item planes
  12582. Set which planes will be processed as bitmap, unprocessed planes will be
  12583. copied from second stream.
  12584. By default value 0xf, all planes will be processed.
  12585. @end table
  12586. @subsection Commands
  12587. This filter supports the all above options as @ref{commands}.
  12588. @section maskfun
  12589. Create mask from input video.
  12590. For example it is useful to create motion masks after @code{tblend} filter.
  12591. This filter accepts the following options:
  12592. @table @option
  12593. @item low
  12594. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  12595. @item high
  12596. Set high threshold. Any pixel component higher than this value will be set to max value
  12597. allowed for current pixel format.
  12598. @item planes
  12599. Set planes to filter, by default all available planes are filtered.
  12600. @item fill
  12601. Fill all frame pixels with this value.
  12602. @item sum
  12603. Set max average pixel value for frame. If sum of all pixel components is higher that this
  12604. average, output frame will be completely filled with value set by @var{fill} option.
  12605. Typically useful for scene changes when used in combination with @code{tblend} filter.
  12606. @end table
  12607. @subsection Commands
  12608. This filter supports the all above options as @ref{commands}.
  12609. @section mcdeint
  12610. Apply motion-compensation deinterlacing.
  12611. It needs one field per frame as input and must thus be used together
  12612. with yadif=1/3 or equivalent.
  12613. This filter is only available in ffmpeg version 4.4 or earlier.
  12614. This filter accepts the following options:
  12615. @table @option
  12616. @item mode
  12617. Set the deinterlacing mode.
  12618. It accepts one of the following values:
  12619. @table @samp
  12620. @item fast
  12621. @item medium
  12622. @item slow
  12623. use iterative motion estimation
  12624. @item extra_slow
  12625. like @samp{slow}, but use multiple reference frames.
  12626. @end table
  12627. Default value is @samp{fast}.
  12628. @item parity
  12629. Set the picture field parity assumed for the input video. It must be
  12630. one of the following values:
  12631. @table @samp
  12632. @item 0, tff
  12633. assume top field first
  12634. @item 1, bff
  12635. assume bottom field first
  12636. @end table
  12637. Default value is @samp{bff}.
  12638. @item qp
  12639. Set per-block quantization parameter (QP) used by the internal
  12640. encoder.
  12641. Higher values should result in a smoother motion vector field but less
  12642. optimal individual vectors. Default value is 1.
  12643. @end table
  12644. @section median
  12645. Pick median pixel from certain rectangle defined by radius.
  12646. This filter accepts the following options:
  12647. @table @option
  12648. @item radius
  12649. Set horizontal radius size. Default value is @code{1}.
  12650. Allowed range is integer from 1 to 127.
  12651. @item planes
  12652. Set which planes to process. Default is @code{15}, which is all available planes.
  12653. @item radiusV
  12654. Set vertical radius size. Default value is @code{0}.
  12655. Allowed range is integer from 0 to 127.
  12656. If it is 0, value will be picked from horizontal @code{radius} option.
  12657. @item percentile
  12658. Set median percentile. Default value is @code{0.5}.
  12659. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  12660. minimum values, and @code{1} maximum values.
  12661. @end table
  12662. @subsection Commands
  12663. This filter supports same @ref{commands} as options.
  12664. The command accepts the same syntax of the corresponding option.
  12665. If the specified expression is not valid, it is kept at its current
  12666. value.
  12667. @section mergeplanes
  12668. Merge color channel components from several video streams.
  12669. The filter accepts up to 4 input streams, and merge selected input
  12670. planes to the output video.
  12671. This filter accepts the following options:
  12672. @table @option
  12673. @item mapping
  12674. Set input to output plane mapping. Default is @code{0}.
  12675. The mappings is specified as a bitmap. It should be specified as a
  12676. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  12677. mapping for the first plane of the output stream. 'A' sets the number of
  12678. the input stream to use (from 0 to 3), and 'a' the plane number of the
  12679. corresponding input to use (from 0 to 3). The rest of the mappings is
  12680. similar, 'Bb' describes the mapping for the output stream second
  12681. plane, 'Cc' describes the mapping for the output stream third plane and
  12682. 'Dd' describes the mapping for the output stream fourth plane.
  12683. @item format
  12684. Set output pixel format. Default is @code{yuva444p}.
  12685. @item map0s
  12686. @item map1s
  12687. @item map2s
  12688. @item map3s
  12689. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  12690. @item map0p
  12691. @item map1p
  12692. @item map2p
  12693. @item map3p
  12694. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  12695. @end table
  12696. @subsection Examples
  12697. @itemize
  12698. @item
  12699. Merge three gray video streams of same width and height into single video stream:
  12700. @example
  12701. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  12702. @end example
  12703. @item
  12704. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  12705. @example
  12706. [a0][a1]mergeplanes=0x00010210:yuva444p
  12707. @end example
  12708. @item
  12709. Swap Y and A plane in yuva444p stream:
  12710. @example
  12711. format=yuva444p,mergeplanes=0x03010200:yuva444p
  12712. @end example
  12713. @item
  12714. Swap U and V plane in yuv420p stream:
  12715. @example
  12716. format=yuv420p,mergeplanes=0x000201:yuv420p
  12717. @end example
  12718. @item
  12719. Cast a rgb24 clip to yuv444p:
  12720. @example
  12721. format=rgb24,mergeplanes=0x000102:yuv444p
  12722. @end example
  12723. @end itemize
  12724. @section mestimate
  12725. Estimate and export motion vectors using block matching algorithms.
  12726. Motion vectors are stored in frame side data to be used by other filters.
  12727. This filter accepts the following options:
  12728. @table @option
  12729. @item method
  12730. Specify the motion estimation method. Accepts one of the following values:
  12731. @table @samp
  12732. @item esa
  12733. Exhaustive search algorithm.
  12734. @item tss
  12735. Three step search algorithm.
  12736. @item tdls
  12737. Two dimensional logarithmic search algorithm.
  12738. @item ntss
  12739. New three step search algorithm.
  12740. @item fss
  12741. Four step search algorithm.
  12742. @item ds
  12743. Diamond search algorithm.
  12744. @item hexbs
  12745. Hexagon-based search algorithm.
  12746. @item epzs
  12747. Enhanced predictive zonal search algorithm.
  12748. @item umh
  12749. Uneven multi-hexagon search algorithm.
  12750. @end table
  12751. Default value is @samp{esa}.
  12752. @item mb_size
  12753. Macroblock size. Default @code{16}.
  12754. @item search_param
  12755. Search parameter. Default @code{7}.
  12756. @end table
  12757. @section midequalizer
  12758. Apply Midway Image Equalization effect using two video streams.
  12759. Midway Image Equalization adjusts a pair of images to have the same
  12760. histogram, while maintaining their dynamics as much as possible. It's
  12761. useful for e.g. matching exposures from a pair of stereo cameras.
  12762. This filter has two inputs and one output, which must be of same pixel format, but
  12763. may be of different sizes. The output of filter is first input adjusted with
  12764. midway histogram of both inputs.
  12765. This filter accepts the following option:
  12766. @table @option
  12767. @item planes
  12768. Set which planes to process. Default is @code{15}, which is all available planes.
  12769. @end table
  12770. @section minterpolate
  12771. Convert the video to specified frame rate using motion interpolation.
  12772. This filter accepts the following options:
  12773. @table @option
  12774. @item fps
  12775. 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}.
  12776. @item mi_mode
  12777. Motion interpolation mode. Following values are accepted:
  12778. @table @samp
  12779. @item dup
  12780. Duplicate previous or next frame for interpolating new ones.
  12781. @item blend
  12782. Blend source frames. Interpolated frame is mean of previous and next frames.
  12783. @item mci
  12784. Motion compensated interpolation. Following options are effective when this mode is selected:
  12785. @table @samp
  12786. @item mc_mode
  12787. Motion compensation mode. Following values are accepted:
  12788. @table @samp
  12789. @item obmc
  12790. Overlapped block motion compensation.
  12791. @item aobmc
  12792. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  12793. @end table
  12794. Default mode is @samp{obmc}.
  12795. @item me_mode
  12796. Motion estimation mode. Following values are accepted:
  12797. @table @samp
  12798. @item bidir
  12799. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  12800. @item bilat
  12801. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  12802. @end table
  12803. Default mode is @samp{bilat}.
  12804. @item me
  12805. The algorithm to be used for motion estimation. Following values are accepted:
  12806. @table @samp
  12807. @item esa
  12808. Exhaustive search algorithm.
  12809. @item tss
  12810. Three step search algorithm.
  12811. @item tdls
  12812. Two dimensional logarithmic search algorithm.
  12813. @item ntss
  12814. New three step search algorithm.
  12815. @item fss
  12816. Four step search algorithm.
  12817. @item ds
  12818. Diamond search algorithm.
  12819. @item hexbs
  12820. Hexagon-based search algorithm.
  12821. @item epzs
  12822. Enhanced predictive zonal search algorithm.
  12823. @item umh
  12824. Uneven multi-hexagon search algorithm.
  12825. @end table
  12826. Default algorithm is @samp{epzs}.
  12827. @item mb_size
  12828. Macroblock size. Default @code{16}.
  12829. @item search_param
  12830. Motion estimation search parameter. Default @code{32}.
  12831. @item vsbmc
  12832. 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).
  12833. @end table
  12834. @end table
  12835. @item scd
  12836. 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:
  12837. @table @samp
  12838. @item none
  12839. Disable scene change detection.
  12840. @item fdiff
  12841. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  12842. @end table
  12843. Default method is @samp{fdiff}.
  12844. @item scd_threshold
  12845. Scene change detection threshold. Default is @code{10.}.
  12846. @end table
  12847. @section mix
  12848. Mix several video input streams into one video stream.
  12849. A description of the accepted options follows.
  12850. @table @option
  12851. @item inputs
  12852. The number of inputs. If unspecified, it defaults to 2.
  12853. @item weights
  12854. Specify weight of each input video stream as sequence.
  12855. Each weight is separated by space. If number of weights
  12856. is smaller than number of @var{frames} last specified
  12857. weight will be used for all remaining unset weights.
  12858. @item scale
  12859. Specify scale, if it is set it will be multiplied with sum
  12860. of each weight multiplied with pixel values to give final destination
  12861. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12862. @item planes
  12863. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  12864. @item duration
  12865. Specify how end of stream is determined.
  12866. @table @samp
  12867. @item longest
  12868. The duration of the longest input. (default)
  12869. @item shortest
  12870. The duration of the shortest input.
  12871. @item first
  12872. The duration of the first input.
  12873. @end table
  12874. @end table
  12875. @subsection Commands
  12876. This filter supports the following commands:
  12877. @table @option
  12878. @item weights
  12879. @item scale
  12880. @item planes
  12881. Syntax is same as option with same name.
  12882. @end table
  12883. @section monochrome
  12884. Convert video to gray using custom color filter.
  12885. A description of the accepted options follows.
  12886. @table @option
  12887. @item cb
  12888. Set the chroma blue spot. Allowed range is from -1 to 1.
  12889. Default value is 0.
  12890. @item cr
  12891. Set the chroma red spot. Allowed range is from -1 to 1.
  12892. Default value is 0.
  12893. @item size
  12894. Set the color filter size. Allowed range is from .1 to 10.
  12895. Default value is 1.
  12896. @item high
  12897. Set the highlights strength. Allowed range is from 0 to 1.
  12898. Default value is 0.
  12899. @end table
  12900. @subsection Commands
  12901. This filter supports the all above options as @ref{commands}.
  12902. @section morpho
  12903. This filter allows to apply main morphological grayscale transforms,
  12904. erode and dilate with arbitrary structures set in second input stream.
  12905. Unlike naive implementation and much slower performance in @ref{erosion}
  12906. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  12907. should be used instead.
  12908. A description of accepted options follows,
  12909. @table @option
  12910. @item mode
  12911. Set morphological transform to apply, can be:
  12912. @table @samp
  12913. @item erode
  12914. @item dilate
  12915. @item open
  12916. @item close
  12917. @item gradient
  12918. @item tophat
  12919. @item blackhat
  12920. @end table
  12921. Default is @code{erode}.
  12922. @item planes
  12923. Set planes to filter, by default all planes except alpha are filtered.
  12924. @item structure
  12925. Set which structure video frames will be processed from second input stream,
  12926. can be @var{first} or @var{all}. Default is @var{all}.
  12927. @end table
  12928. The @code{morpho} filter also supports the @ref{framesync} options.
  12929. @subsection Commands
  12930. This filter supports same @ref{commands} as options.
  12931. @section mpdecimate
  12932. Drop frames that do not differ greatly from the previous frame in
  12933. order to reduce frame rate.
  12934. The main use of this filter is for very-low-bitrate encoding
  12935. (e.g. streaming over dialup modem), but it could in theory be used for
  12936. fixing movies that were inverse-telecined incorrectly.
  12937. A description of the accepted options follows.
  12938. @table @option
  12939. @item max
  12940. Set the maximum number of consecutive frames which can be dropped (if
  12941. positive), or the minimum interval between dropped frames (if
  12942. negative). If the value is 0, the frame is dropped disregarding the
  12943. number of previous sequentially dropped frames.
  12944. Default value is 0.
  12945. @item hi
  12946. @item lo
  12947. @item frac
  12948. Set the dropping threshold values.
  12949. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  12950. represent actual pixel value differences, so a threshold of 64
  12951. corresponds to 1 unit of difference for each pixel, or the same spread
  12952. out differently over the block.
  12953. A frame is a candidate for dropping if no 8x8 blocks differ by more
  12954. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  12955. meaning the whole image) differ by more than a threshold of @option{lo}.
  12956. Default value for @option{hi} is 64*12, default value for @option{lo} is
  12957. 64*5, and default value for @option{frac} is 0.33.
  12958. @end table
  12959. @section msad
  12960. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  12961. This filter takes two input videos.
  12962. Both input videos must have the same resolution and pixel format for
  12963. this filter to work correctly. Also it assumes that both inputs
  12964. have the same number of frames, which are compared one by one.
  12965. The obtained per component, average, min and max MSAD is printed through
  12966. the logging system.
  12967. The filter stores the calculated MSAD of each frame in frame metadata.
  12968. In the below example the input file @file{main.mpg} being processed is compared
  12969. with the reference file @file{ref.mpg}.
  12970. @example
  12971. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  12972. @end example
  12973. @section multiply
  12974. Multiply first video stream pixels values with second video stream pixels values.
  12975. The filter accepts the following options:
  12976. @table @option
  12977. @item scale
  12978. Set the scale applied to second video stream. By default is @code{1}.
  12979. Allowed range is from @code{0} to @code{9}.
  12980. @item offset
  12981. Set the offset applied to second video stream. By default is @code{0.5}.
  12982. Allowed range is from @code{-1} to @code{1}.
  12983. @item planes
  12984. Specify planes from input video stream that will be processed.
  12985. By default all planes are processed.
  12986. @end table
  12987. @subsection Commands
  12988. This filter supports same @ref{commands} as options.
  12989. @section negate
  12990. Negate (invert) the input video.
  12991. It accepts the following option:
  12992. @table @option
  12993. @item components
  12994. Set components to negate.
  12995. Available values for components are:
  12996. @table @samp
  12997. @item y
  12998. @item u
  12999. @item v
  13000. @item a
  13001. @item r
  13002. @item g
  13003. @item b
  13004. @end table
  13005. @item negate_alpha
  13006. With value 1, it negates the alpha component, if present. Default value is 0.
  13007. @end table
  13008. @subsection Commands
  13009. This filter supports same @ref{commands} as options.
  13010. @anchor{nlmeans}
  13011. @section nlmeans
  13012. Denoise frames using Non-Local Means algorithm.
  13013. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13014. context similarity is defined by comparing their surrounding patches of size
  13015. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13016. around the pixel.
  13017. Note that the research area defines centers for patches, which means some
  13018. patches will be made of pixels outside that research area.
  13019. The filter accepts the following options.
  13020. @table @option
  13021. @item s
  13022. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13023. @item p
  13024. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13025. @item pc
  13026. Same as @option{p} but for chroma planes.
  13027. The default value is @var{0} and means automatic.
  13028. @item r
  13029. Set research size. Default is 15. Must be odd number in range [0, 99].
  13030. @item rc
  13031. Same as @option{r} but for chroma planes.
  13032. The default value is @var{0} and means automatic.
  13033. @end table
  13034. @section nnedi
  13035. Deinterlace video using neural network edge directed interpolation.
  13036. This filter accepts the following options:
  13037. @table @option
  13038. @item weights
  13039. Mandatory option, without binary file filter can not work.
  13040. Currently file can be found here:
  13041. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13042. @item deint
  13043. Set which frames to deinterlace, by default it is @code{all}.
  13044. Can be @code{all} or @code{interlaced}.
  13045. @item field
  13046. Set mode of operation.
  13047. Can be one of the following:
  13048. @table @samp
  13049. @item af
  13050. Use frame flags, both fields.
  13051. @item a
  13052. Use frame flags, single field.
  13053. @item t
  13054. Use top field only.
  13055. @item b
  13056. Use bottom field only.
  13057. @item tf
  13058. Use both fields, top first.
  13059. @item bf
  13060. Use both fields, bottom first.
  13061. @end table
  13062. @item planes
  13063. Set which planes to process, by default filter process all frames.
  13064. @item nsize
  13065. Set size of local neighborhood around each pixel, used by the predictor neural
  13066. network.
  13067. Can be one of the following:
  13068. @table @samp
  13069. @item s8x6
  13070. @item s16x6
  13071. @item s32x6
  13072. @item s48x6
  13073. @item s8x4
  13074. @item s16x4
  13075. @item s32x4
  13076. @end table
  13077. @item nns
  13078. Set the number of neurons in predictor neural network.
  13079. Can be one of the following:
  13080. @table @samp
  13081. @item n16
  13082. @item n32
  13083. @item n64
  13084. @item n128
  13085. @item n256
  13086. @end table
  13087. @item qual
  13088. Controls the number of different neural network predictions that are blended
  13089. together to compute the final output value. Can be @code{fast}, default or
  13090. @code{slow}.
  13091. @item etype
  13092. Set which set of weights to use in the predictor.
  13093. Can be one of the following:
  13094. @table @samp
  13095. @item a, abs
  13096. weights trained to minimize absolute error
  13097. @item s, mse
  13098. weights trained to minimize squared error
  13099. @end table
  13100. @item pscrn
  13101. Controls whether or not the prescreener neural network is used to decide
  13102. which pixels should be processed by the predictor neural network and which
  13103. can be handled by simple cubic interpolation.
  13104. The prescreener is trained to know whether cubic interpolation will be
  13105. sufficient for a pixel or whether it should be predicted by the predictor nn.
  13106. The computational complexity of the prescreener nn is much less than that of
  13107. the predictor nn. Since most pixels can be handled by cubic interpolation,
  13108. using the prescreener generally results in much faster processing.
  13109. The prescreener is pretty accurate, so the difference between using it and not
  13110. using it is almost always unnoticeable.
  13111. Can be one of the following:
  13112. @table @samp
  13113. @item none
  13114. @item original
  13115. @item new
  13116. @item new2
  13117. @item new3
  13118. @end table
  13119. Default is @code{new}.
  13120. @end table
  13121. @subsection Commands
  13122. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  13123. @section noformat
  13124. Force libavfilter not to use any of the specified pixel formats for the
  13125. input to the next filter.
  13126. It accepts the following parameters:
  13127. @table @option
  13128. @item pix_fmts
  13129. A '|'-separated list of pixel format names, such as
  13130. pix_fmts=yuv420p|monow|rgb24".
  13131. @end table
  13132. @subsection Examples
  13133. @itemize
  13134. @item
  13135. Force libavfilter to use a format different from @var{yuv420p} for the
  13136. input to the vflip filter:
  13137. @example
  13138. noformat=pix_fmts=yuv420p,vflip
  13139. @end example
  13140. @item
  13141. Convert the input video to any of the formats not contained in the list:
  13142. @example
  13143. noformat=yuv420p|yuv444p|yuv410p
  13144. @end example
  13145. @end itemize
  13146. @section noise
  13147. Add noise on video input frame.
  13148. The filter accepts the following options:
  13149. @table @option
  13150. @item all_seed
  13151. @item c0_seed
  13152. @item c1_seed
  13153. @item c2_seed
  13154. @item c3_seed
  13155. Set noise seed for specific pixel component or all pixel components in case
  13156. of @var{all_seed}. Default value is @code{123457}.
  13157. @item all_strength, alls
  13158. @item c0_strength, c0s
  13159. @item c1_strength, c1s
  13160. @item c2_strength, c2s
  13161. @item c3_strength, c3s
  13162. Set noise strength for specific pixel component or all pixel components in case
  13163. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  13164. @item all_flags, allf
  13165. @item c0_flags, c0f
  13166. @item c1_flags, c1f
  13167. @item c2_flags, c2f
  13168. @item c3_flags, c3f
  13169. Set pixel component flags or set flags for all components if @var{all_flags}.
  13170. Available values for component flags are:
  13171. @table @samp
  13172. @item a
  13173. averaged temporal noise (smoother)
  13174. @item p
  13175. mix random noise with a (semi)regular pattern
  13176. @item t
  13177. temporal noise (noise pattern changes between frames)
  13178. @item u
  13179. uniform noise (gaussian otherwise)
  13180. @end table
  13181. @end table
  13182. @subsection Examples
  13183. Add temporal and uniform noise to input video:
  13184. @example
  13185. noise=alls=20:allf=t+u
  13186. @end example
  13187. @section normalize
  13188. Normalize RGB video (aka histogram stretching, contrast stretching).
  13189. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  13190. For each channel of each frame, the filter computes the input range and maps
  13191. it linearly to the user-specified output range. The output range defaults
  13192. to the full dynamic range from pure black to pure white.
  13193. Temporal smoothing can be used on the input range to reduce flickering (rapid
  13194. changes in brightness) caused when small dark or bright objects enter or leave
  13195. the scene. This is similar to the auto-exposure (automatic gain control) on a
  13196. video camera, and, like a video camera, it may cause a period of over- or
  13197. under-exposure of the video.
  13198. The R,G,B channels can be normalized independently, which may cause some
  13199. color shifting, or linked together as a single channel, which prevents
  13200. color shifting. Linked normalization preserves hue. Independent normalization
  13201. does not, so it can be used to remove some color casts. Independent and linked
  13202. normalization can be combined in any ratio.
  13203. The normalize filter accepts the following options:
  13204. @table @option
  13205. @item blackpt
  13206. @item whitept
  13207. Colors which define the output range. The minimum input value is mapped to
  13208. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  13209. The defaults are black and white respectively. Specifying white for
  13210. @var{blackpt} and black for @var{whitept} will give color-inverted,
  13211. normalized video. Shades of grey can be used to reduce the dynamic range
  13212. (contrast). Specifying saturated colors here can create some interesting
  13213. effects.
  13214. @item smoothing
  13215. The number of previous frames to use for temporal smoothing. The input range
  13216. of each channel is smoothed using a rolling average over the current frame
  13217. and the @var{smoothing} previous frames. The default is 0 (no temporal
  13218. smoothing).
  13219. @item independence
  13220. Controls the ratio of independent (color shifting) channel normalization to
  13221. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  13222. independent. Defaults to 1.0 (fully independent).
  13223. @item strength
  13224. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  13225. expensive no-op. Defaults to 1.0 (full strength).
  13226. @end table
  13227. @subsection Commands
  13228. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  13229. The command accepts the same syntax of the corresponding option.
  13230. If the specified expression is not valid, it is kept at its current
  13231. value.
  13232. @subsection Examples
  13233. Stretch video contrast to use the full dynamic range, with no temporal
  13234. smoothing; may flicker depending on the source content:
  13235. @example
  13236. normalize=blackpt=black:whitept=white:smoothing=0
  13237. @end example
  13238. As above, but with 50 frames of temporal smoothing; flicker should be
  13239. reduced, depending on the source content:
  13240. @example
  13241. normalize=blackpt=black:whitept=white:smoothing=50
  13242. @end example
  13243. As above, but with hue-preserving linked channel normalization:
  13244. @example
  13245. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  13246. @end example
  13247. As above, but with half strength:
  13248. @example
  13249. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  13250. @end example
  13251. Map the darkest input color to red, the brightest input color to cyan:
  13252. @example
  13253. normalize=blackpt=red:whitept=cyan
  13254. @end example
  13255. @section null
  13256. Pass the video source unchanged to the output.
  13257. @section ocr
  13258. Optical Character Recognition
  13259. This filter uses Tesseract for optical character recognition. To enable
  13260. compilation of this filter, you need to configure FFmpeg with
  13261. @code{--enable-libtesseract}.
  13262. It accepts the following options:
  13263. @table @option
  13264. @item datapath
  13265. Set datapath to tesseract data. Default is to use whatever was
  13266. set at installation.
  13267. @item language
  13268. Set language, default is "eng".
  13269. @item whitelist
  13270. Set character whitelist.
  13271. @item blacklist
  13272. Set character blacklist.
  13273. @end table
  13274. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  13275. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  13276. @section ocv
  13277. Apply a video transform using libopencv.
  13278. To enable this filter, install the libopencv library and headers and
  13279. configure FFmpeg with @code{--enable-libopencv}.
  13280. It accepts the following parameters:
  13281. @table @option
  13282. @item filter_name
  13283. The name of the libopencv filter to apply.
  13284. @item filter_params
  13285. The parameters to pass to the libopencv filter. If not specified, the default
  13286. values are assumed.
  13287. @end table
  13288. Refer to the official libopencv documentation for more precise
  13289. information:
  13290. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  13291. Several libopencv filters are supported; see the following subsections.
  13292. @anchor{dilate}
  13293. @subsection dilate
  13294. Dilate an image by using a specific structuring element.
  13295. It corresponds to the libopencv function @code{cvDilate}.
  13296. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  13297. @var{struct_el} represents a structuring element, and has the syntax:
  13298. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  13299. @var{cols} and @var{rows} represent the number of columns and rows of
  13300. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  13301. point, and @var{shape} the shape for the structuring element. @var{shape}
  13302. must be "rect", "cross", "ellipse", or "custom".
  13303. If the value for @var{shape} is "custom", it must be followed by a
  13304. string of the form "=@var{filename}". The file with name
  13305. @var{filename} is assumed to represent a binary image, with each
  13306. printable character corresponding to a bright pixel. When a custom
  13307. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  13308. or columns and rows of the read file are assumed instead.
  13309. The default value for @var{struct_el} is "3x3+0x0/rect".
  13310. @var{nb_iterations} specifies the number of times the transform is
  13311. applied to the image, and defaults to 1.
  13312. Some examples:
  13313. @example
  13314. # Use the default values
  13315. ocv=dilate
  13316. # Dilate using a structuring element with a 5x5 cross, iterating two times
  13317. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  13318. # Read the shape from the file diamond.shape, iterating two times.
  13319. # The file diamond.shape may contain a pattern of characters like this
  13320. # *
  13321. # ***
  13322. # *****
  13323. # ***
  13324. # *
  13325. # The specified columns and rows are ignored
  13326. # but the anchor point coordinates are not
  13327. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  13328. @end example
  13329. @subsection erode
  13330. Erode an image by using a specific structuring element.
  13331. It corresponds to the libopencv function @code{cvErode}.
  13332. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  13333. with the same syntax and semantics as the @ref{dilate} filter.
  13334. @subsection smooth
  13335. Smooth the input video.
  13336. The filter takes the following parameters:
  13337. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  13338. @var{type} is the type of smooth filter to apply, and must be one of
  13339. the following values: "blur", "blur_no_scale", "median", "gaussian",
  13340. or "bilateral". The default value is "gaussian".
  13341. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  13342. depends on the smooth type. @var{param1} and
  13343. @var{param2} accept integer positive values or 0. @var{param3} and
  13344. @var{param4} accept floating point values.
  13345. The default value for @var{param1} is 3. The default value for the
  13346. other parameters is 0.
  13347. These parameters correspond to the parameters assigned to the
  13348. libopencv function @code{cvSmooth}.
  13349. @section oscilloscope
  13350. 2D Video Oscilloscope.
  13351. Useful to measure spatial impulse, step responses, chroma delays, etc.
  13352. It accepts the following parameters:
  13353. @table @option
  13354. @item x
  13355. Set scope center x position.
  13356. @item y
  13357. Set scope center y position.
  13358. @item s
  13359. Set scope size, relative to frame diagonal.
  13360. @item t
  13361. Set scope tilt/rotation.
  13362. @item o
  13363. Set trace opacity.
  13364. @item tx
  13365. Set trace center x position.
  13366. @item ty
  13367. Set trace center y position.
  13368. @item tw
  13369. Set trace width, relative to width of frame.
  13370. @item th
  13371. Set trace height, relative to height of frame.
  13372. @item c
  13373. Set which components to trace. By default it traces first three components.
  13374. @item g
  13375. Draw trace grid. By default is enabled.
  13376. @item st
  13377. Draw some statistics. By default is enabled.
  13378. @item sc
  13379. Draw scope. By default is enabled.
  13380. @end table
  13381. @subsection Commands
  13382. This filter supports same @ref{commands} as options.
  13383. The command accepts the same syntax of the corresponding option.
  13384. If the specified expression is not valid, it is kept at its current
  13385. value.
  13386. @subsection Examples
  13387. @itemize
  13388. @item
  13389. Inspect full first row of video frame.
  13390. @example
  13391. oscilloscope=x=0.5:y=0:s=1
  13392. @end example
  13393. @item
  13394. Inspect full last row of video frame.
  13395. @example
  13396. oscilloscope=x=0.5:y=1:s=1
  13397. @end example
  13398. @item
  13399. Inspect full 5th line of video frame of height 1080.
  13400. @example
  13401. oscilloscope=x=0.5:y=5/1080:s=1
  13402. @end example
  13403. @item
  13404. Inspect full last column of video frame.
  13405. @example
  13406. oscilloscope=x=1:y=0.5:s=1:t=1
  13407. @end example
  13408. @end itemize
  13409. @anchor{overlay}
  13410. @section overlay
  13411. Overlay one video on top of another.
  13412. It takes two inputs and has one output. The first input is the "main"
  13413. video on which the second input is overlaid.
  13414. It accepts the following parameters:
  13415. A description of the accepted options follows.
  13416. @table @option
  13417. @item x
  13418. @item y
  13419. Set the expression for the x and y coordinates of the overlaid video
  13420. on the main video. Default value is "0" for both expressions. In case
  13421. the expression is invalid, it is set to a huge value (meaning that the
  13422. overlay will not be displayed within the output visible area).
  13423. @item eof_action
  13424. See @ref{framesync}.
  13425. @item eval
  13426. Set when the expressions for @option{x}, and @option{y} are evaluated.
  13427. It accepts the following values:
  13428. @table @samp
  13429. @item init
  13430. only evaluate expressions once during the filter initialization or
  13431. when a command is processed
  13432. @item frame
  13433. evaluate expressions for each incoming frame
  13434. @end table
  13435. Default value is @samp{frame}.
  13436. @item shortest
  13437. See @ref{framesync}.
  13438. @item format
  13439. Set the format for the output video.
  13440. It accepts the following values:
  13441. @table @samp
  13442. @item yuv420
  13443. force YUV420 output
  13444. @item yuv420p10
  13445. force YUV420p10 output
  13446. @item yuv422
  13447. force YUV422 output
  13448. @item yuv422p10
  13449. force YUV422p10 output
  13450. @item yuv444
  13451. force YUV444 output
  13452. @item rgb
  13453. force packed RGB output
  13454. @item gbrp
  13455. force planar RGB output
  13456. @item auto
  13457. automatically pick format
  13458. @end table
  13459. Default value is @samp{yuv420}.
  13460. @item repeatlast
  13461. See @ref{framesync}.
  13462. @item alpha
  13463. Set format of alpha of the overlaid video, it can be @var{straight} or
  13464. @var{premultiplied}. Default is @var{straight}.
  13465. @end table
  13466. The @option{x}, and @option{y} expressions can contain the following
  13467. parameters.
  13468. @table @option
  13469. @item main_w, W
  13470. @item main_h, H
  13471. The main input width and height.
  13472. @item overlay_w, w
  13473. @item overlay_h, h
  13474. The overlay input width and height.
  13475. @item x
  13476. @item y
  13477. The computed values for @var{x} and @var{y}. They are evaluated for
  13478. each new frame.
  13479. @item hsub
  13480. @item vsub
  13481. horizontal and vertical chroma subsample values of the output
  13482. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  13483. @var{vsub} is 1.
  13484. @item n
  13485. the number of input frame, starting from 0
  13486. @item pos
  13487. the position in the file of the input frame, NAN if unknown
  13488. @item t
  13489. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  13490. @end table
  13491. This filter also supports the @ref{framesync} options.
  13492. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  13493. when evaluation is done @emph{per frame}, and will evaluate to NAN
  13494. when @option{eval} is set to @samp{init}.
  13495. Be aware that frames are taken from each input video in timestamp
  13496. order, hence, if their initial timestamps differ, it is a good idea
  13497. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  13498. have them begin in the same zero timestamp, as the example for
  13499. the @var{movie} filter does.
  13500. You can chain together more overlays but you should test the
  13501. efficiency of such approach.
  13502. @subsection Commands
  13503. This filter supports the following commands:
  13504. @table @option
  13505. @item x
  13506. @item y
  13507. Modify the x and y of the overlay input.
  13508. The command accepts the same syntax of the corresponding option.
  13509. If the specified expression is not valid, it is kept at its current
  13510. value.
  13511. @end table
  13512. @subsection Examples
  13513. @itemize
  13514. @item
  13515. Draw the overlay at 10 pixels from the bottom right corner of the main
  13516. video:
  13517. @example
  13518. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  13519. @end example
  13520. Using named options the example above becomes:
  13521. @example
  13522. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  13523. @end example
  13524. @item
  13525. Insert a transparent PNG logo in the bottom left corner of the input,
  13526. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  13527. @example
  13528. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  13529. @end example
  13530. @item
  13531. Insert 2 different transparent PNG logos (second logo on bottom
  13532. right corner) using the @command{ffmpeg} tool:
  13533. @example
  13534. 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
  13535. @end example
  13536. @item
  13537. Add a transparent color layer on top of the main video; @code{WxH}
  13538. must specify the size of the main input to the overlay filter:
  13539. @example
  13540. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  13541. @end example
  13542. @item
  13543. Play an original video and a filtered version (here with the deshake
  13544. filter) side by side using the @command{ffplay} tool:
  13545. @example
  13546. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  13547. @end example
  13548. The above command is the same as:
  13549. @example
  13550. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  13551. @end example
  13552. @item
  13553. Make a sliding overlay appearing from the left to the right top part of the
  13554. screen starting since time 2:
  13555. @example
  13556. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  13557. @end example
  13558. @item
  13559. Compose output by putting two input videos side to side:
  13560. @example
  13561. ffmpeg -i left.avi -i right.avi -filter_complex "
  13562. nullsrc=size=200x100 [background];
  13563. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  13564. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  13565. [background][left] overlay=shortest=1 [background+left];
  13566. [background+left][right] overlay=shortest=1:x=100 [left+right]
  13567. "
  13568. @end example
  13569. @item
  13570. Mask 10-20 seconds of a video by applying the delogo filter to a section
  13571. @example
  13572. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  13573. -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]'
  13574. masked.avi
  13575. @end example
  13576. @item
  13577. Chain several overlays in cascade:
  13578. @example
  13579. nullsrc=s=200x200 [bg];
  13580. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  13581. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  13582. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  13583. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  13584. [in3] null, [mid2] overlay=100:100 [out0]
  13585. @end example
  13586. @end itemize
  13587. @anchor{overlay_cuda}
  13588. @section overlay_cuda
  13589. Overlay one video on top of another.
  13590. This is the CUDA variant of the @ref{overlay} filter.
  13591. It only accepts CUDA frames. The underlying input pixel formats have to match.
  13592. It takes two inputs and has one output. The first input is the "main"
  13593. video on which the second input is overlaid.
  13594. It accepts the following parameters:
  13595. @table @option
  13596. @item x
  13597. @item y
  13598. Set expressions for the x and y coordinates of the overlaid video
  13599. on the main video.
  13600. They can contain the following parameters:
  13601. @table @option
  13602. @item main_w, W
  13603. @item main_h, H
  13604. The main input width and height.
  13605. @item overlay_w, w
  13606. @item overlay_h, h
  13607. The overlay input width and height.
  13608. @item x
  13609. @item y
  13610. The computed values for @var{x} and @var{y}. They are evaluated for
  13611. each new frame.
  13612. @item n
  13613. The ordinal index of the main input frame, starting from 0.
  13614. @item pos
  13615. The byte offset position in the file of the main input frame, NAN if unknown.
  13616. @item t
  13617. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  13618. @end table
  13619. Default value is "0" for both expressions.
  13620. @item eval
  13621. Set when the expressions for @option{x} and @option{y} are evaluated.
  13622. It accepts the following values:
  13623. @table @option
  13624. @item init
  13625. Evaluate expressions once during filter initialization or
  13626. when a command is processed.
  13627. @item frame
  13628. Evaluate expressions for each incoming frame
  13629. @end table
  13630. Default value is @option{frame}.
  13631. @item eof_action
  13632. See @ref{framesync}.
  13633. @item shortest
  13634. See @ref{framesync}.
  13635. @item repeatlast
  13636. See @ref{framesync}.
  13637. @end table
  13638. This filter also supports the @ref{framesync} options.
  13639. @section owdenoise
  13640. Apply Overcomplete Wavelet denoiser.
  13641. The filter accepts the following options:
  13642. @table @option
  13643. @item depth
  13644. Set depth.
  13645. Larger depth values will denoise lower frequency components more, but
  13646. slow down filtering.
  13647. Must be an int in the range 8-16, default is @code{8}.
  13648. @item luma_strength, ls
  13649. Set luma strength.
  13650. Must be a double value in the range 0-1000, default is @code{1.0}.
  13651. @item chroma_strength, cs
  13652. Set chroma strength.
  13653. Must be a double value in the range 0-1000, default is @code{1.0}.
  13654. @end table
  13655. @anchor{pad}
  13656. @section pad
  13657. Add paddings to the input image, and place the original input at the
  13658. provided @var{x}, @var{y} coordinates.
  13659. It accepts the following parameters:
  13660. @table @option
  13661. @item width, w
  13662. @item height, h
  13663. Specify an expression for the size of the output image with the
  13664. paddings added. If the value for @var{width} or @var{height} is 0, the
  13665. corresponding input size is used for the output.
  13666. The @var{width} expression can reference the value set by the
  13667. @var{height} expression, and vice versa.
  13668. The default value of @var{width} and @var{height} is 0.
  13669. @item x
  13670. @item y
  13671. Specify the offsets to place the input image at within the padded area,
  13672. with respect to the top/left border of the output image.
  13673. The @var{x} expression can reference the value set by the @var{y}
  13674. expression, and vice versa.
  13675. The default value of @var{x} and @var{y} is 0.
  13676. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  13677. so the input image is centered on the padded area.
  13678. @item color
  13679. Specify the color of the padded area. For the syntax of this option,
  13680. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13681. manual,ffmpeg-utils}.
  13682. The default value of @var{color} is "black".
  13683. @item eval
  13684. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  13685. It accepts the following values:
  13686. @table @samp
  13687. @item init
  13688. Only evaluate expressions once during the filter initialization or when
  13689. a command is processed.
  13690. @item frame
  13691. Evaluate expressions for each incoming frame.
  13692. @end table
  13693. Default value is @samp{init}.
  13694. @item aspect
  13695. Pad to aspect instead to a resolution.
  13696. @end table
  13697. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  13698. options are expressions containing the following constants:
  13699. @table @option
  13700. @item in_w
  13701. @item in_h
  13702. The input video width and height.
  13703. @item iw
  13704. @item ih
  13705. These are the same as @var{in_w} and @var{in_h}.
  13706. @item out_w
  13707. @item out_h
  13708. The output width and height (the size of the padded area), as
  13709. specified by the @var{width} and @var{height} expressions.
  13710. @item ow
  13711. @item oh
  13712. These are the same as @var{out_w} and @var{out_h}.
  13713. @item x
  13714. @item y
  13715. The x and y offsets as specified by the @var{x} and @var{y}
  13716. expressions, or NAN if not yet specified.
  13717. @item a
  13718. same as @var{iw} / @var{ih}
  13719. @item sar
  13720. input sample aspect ratio
  13721. @item dar
  13722. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  13723. @item hsub
  13724. @item vsub
  13725. The horizontal and vertical chroma subsample values. For example for the
  13726. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13727. @end table
  13728. @subsection Examples
  13729. @itemize
  13730. @item
  13731. Add paddings with the color "violet" to the input video. The output video
  13732. size is 640x480, and the top-left corner of the input video is placed at
  13733. column 0, row 40
  13734. @example
  13735. pad=640:480:0:40:violet
  13736. @end example
  13737. The example above is equivalent to the following command:
  13738. @example
  13739. pad=width=640:height=480:x=0:y=40:color=violet
  13740. @end example
  13741. @item
  13742. Pad the input to get an output with dimensions increased by 3/2,
  13743. and put the input video at the center of the padded area:
  13744. @example
  13745. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  13746. @end example
  13747. @item
  13748. Pad the input to get a squared output with size equal to the maximum
  13749. value between the input width and height, and put the input video at
  13750. the center of the padded area:
  13751. @example
  13752. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  13753. @end example
  13754. @item
  13755. Pad the input to get a final w/h ratio of 16:9:
  13756. @example
  13757. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  13758. @end example
  13759. @item
  13760. In case of anamorphic video, in order to set the output display aspect
  13761. correctly, it is necessary to use @var{sar} in the expression,
  13762. according to the relation:
  13763. @example
  13764. (ih * X / ih) * sar = output_dar
  13765. X = output_dar / sar
  13766. @end example
  13767. Thus the previous example needs to be modified to:
  13768. @example
  13769. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  13770. @end example
  13771. @item
  13772. Double the output size and put the input video in the bottom-right
  13773. corner of the output padded area:
  13774. @example
  13775. pad="2*iw:2*ih:ow-iw:oh-ih"
  13776. @end example
  13777. @end itemize
  13778. @anchor{palettegen}
  13779. @section palettegen
  13780. Generate one palette for a whole video stream.
  13781. It accepts the following options:
  13782. @table @option
  13783. @item max_colors
  13784. Set the maximum number of colors to quantize in the palette.
  13785. Note: the palette will still contain 256 colors; the unused palette entries
  13786. will be black.
  13787. @item reserve_transparent
  13788. Create a palette of 255 colors maximum and reserve the last one for
  13789. transparency. Reserving the transparency color is useful for GIF optimization.
  13790. If not set, the maximum of colors in the palette will be 256. You probably want
  13791. to disable this option for a standalone image.
  13792. Set by default.
  13793. @item transparency_color
  13794. Set the color that will be used as background for transparency.
  13795. @item stats_mode
  13796. Set statistics mode.
  13797. It accepts the following values:
  13798. @table @samp
  13799. @item full
  13800. Compute full frame histograms.
  13801. @item diff
  13802. Compute histograms only for the part that differs from previous frame. This
  13803. might be relevant to give more importance to the moving part of your input if
  13804. the background is static.
  13805. @item single
  13806. Compute new histogram for each frame.
  13807. @end table
  13808. Default value is @var{full}.
  13809. @item use_alpha
  13810. Create a palette of colors with alpha components.
  13811. Setting this, will automatically disable 'reserve_transparent'.
  13812. @end table
  13813. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  13814. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  13815. color quantization of the palette. This information is also visible at
  13816. @var{info} logging level.
  13817. @subsection Examples
  13818. @itemize
  13819. @item
  13820. Generate a representative palette of a given video using @command{ffmpeg}:
  13821. @example
  13822. ffmpeg -i input.mkv -vf palettegen palette.png
  13823. @end example
  13824. @end itemize
  13825. @section paletteuse
  13826. Use a palette to downsample an input video stream.
  13827. The filter takes two inputs: one video stream and a palette. The palette must
  13828. be a 256 pixels image.
  13829. It accepts the following options:
  13830. @table @option
  13831. @item dither
  13832. Select dithering mode. Available algorithms are:
  13833. @table @samp
  13834. @item bayer
  13835. Ordered 8x8 bayer dithering (deterministic)
  13836. @item heckbert
  13837. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  13838. Note: this dithering is sometimes considered "wrong" and is included as a
  13839. reference.
  13840. @item floyd_steinberg
  13841. Floyd and Steingberg dithering (error diffusion)
  13842. @item sierra2
  13843. Frankie Sierra dithering v2 (error diffusion)
  13844. @item sierra2_4a
  13845. Frankie Sierra dithering v2 "Lite" (error diffusion)
  13846. @end table
  13847. Default is @var{sierra2_4a}.
  13848. @item bayer_scale
  13849. When @var{bayer} dithering is selected, this option defines the scale of the
  13850. pattern (how much the crosshatch pattern is visible). A low value means more
  13851. visible pattern for less banding, and higher value means less visible pattern
  13852. at the cost of more banding.
  13853. The option must be an integer value in the range [0,5]. Default is @var{2}.
  13854. @item diff_mode
  13855. If set, define the zone to process
  13856. @table @samp
  13857. @item rectangle
  13858. Only the changing rectangle will be reprocessed. This is similar to GIF
  13859. cropping/offsetting compression mechanism. This option can be useful for speed
  13860. if only a part of the image is changing, and has use cases such as limiting the
  13861. scope of the error diffusal @option{dither} to the rectangle that bounds the
  13862. moving scene (it leads to more deterministic output if the scene doesn't change
  13863. much, and as a result less moving noise and better GIF compression).
  13864. @end table
  13865. Default is @var{none}.
  13866. @item new
  13867. Take new palette for each output frame.
  13868. @item alpha_threshold
  13869. Sets the alpha threshold for transparency. Alpha values above this threshold
  13870. will be treated as completely opaque, and values below this threshold will be
  13871. treated as completely transparent.
  13872. The option must be an integer value in the range [0,255]. Default is @var{128}.
  13873. @item use_alpha
  13874. Apply the palette by taking alpha values into account. Only useful with
  13875. palettes that are containing multiple colors with alpha components.
  13876. Setting this will automatically disable 'alpha_treshold'.
  13877. @end table
  13878. @subsection Examples
  13879. @itemize
  13880. @item
  13881. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  13882. using @command{ffmpeg}:
  13883. @example
  13884. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  13885. @end example
  13886. @end itemize
  13887. @section perspective
  13888. Correct perspective of video not recorded perpendicular to the screen.
  13889. A description of the accepted parameters follows.
  13890. @table @option
  13891. @item x0
  13892. @item y0
  13893. @item x1
  13894. @item y1
  13895. @item x2
  13896. @item y2
  13897. @item x3
  13898. @item y3
  13899. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  13900. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  13901. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  13902. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  13903. then the corners of the source will be sent to the specified coordinates.
  13904. The expressions can use the following variables:
  13905. @table @option
  13906. @item W
  13907. @item H
  13908. the width and height of video frame.
  13909. @item in
  13910. Input frame count.
  13911. @item on
  13912. Output frame count.
  13913. @end table
  13914. @item interpolation
  13915. Set interpolation for perspective correction.
  13916. It accepts the following values:
  13917. @table @samp
  13918. @item linear
  13919. @item cubic
  13920. @end table
  13921. Default value is @samp{linear}.
  13922. @item sense
  13923. Set interpretation of coordinate options.
  13924. It accepts the following values:
  13925. @table @samp
  13926. @item 0, source
  13927. Send point in the source specified by the given coordinates to
  13928. the corners of the destination.
  13929. @item 1, destination
  13930. Send the corners of the source to the point in the destination specified
  13931. by the given coordinates.
  13932. Default value is @samp{source}.
  13933. @end table
  13934. @item eval
  13935. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  13936. It accepts the following values:
  13937. @table @samp
  13938. @item init
  13939. only evaluate expressions once during the filter initialization or
  13940. when a command is processed
  13941. @item frame
  13942. evaluate expressions for each incoming frame
  13943. @end table
  13944. Default value is @samp{init}.
  13945. @end table
  13946. @section phase
  13947. Delay interlaced video by one field time so that the field order changes.
  13948. The intended use is to fix PAL movies that have been captured with the
  13949. opposite field order to the film-to-video transfer.
  13950. A description of the accepted parameters follows.
  13951. @table @option
  13952. @item mode
  13953. Set phase mode.
  13954. It accepts the following values:
  13955. @table @samp
  13956. @item t
  13957. Capture field order top-first, transfer bottom-first.
  13958. Filter will delay the bottom field.
  13959. @item b
  13960. Capture field order bottom-first, transfer top-first.
  13961. Filter will delay the top field.
  13962. @item p
  13963. Capture and transfer with the same field order. This mode only exists
  13964. for the documentation of the other options to refer to, but if you
  13965. actually select it, the filter will faithfully do nothing.
  13966. @item a
  13967. Capture field order determined automatically by field flags, transfer
  13968. opposite.
  13969. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  13970. basis using field flags. If no field information is available,
  13971. then this works just like @samp{u}.
  13972. @item u
  13973. Capture unknown or varying, transfer opposite.
  13974. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  13975. analyzing the images and selecting the alternative that produces best
  13976. match between the fields.
  13977. @item T
  13978. Capture top-first, transfer unknown or varying.
  13979. Filter selects among @samp{t} and @samp{p} using image analysis.
  13980. @item B
  13981. Capture bottom-first, transfer unknown or varying.
  13982. Filter selects among @samp{b} and @samp{p} using image analysis.
  13983. @item A
  13984. Capture determined by field flags, transfer unknown or varying.
  13985. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  13986. image analysis. If no field information is available, then this works just
  13987. like @samp{U}. This is the default mode.
  13988. @item U
  13989. Both capture and transfer unknown or varying.
  13990. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  13991. @end table
  13992. @end table
  13993. @subsection Commands
  13994. This filter supports the all above options as @ref{commands}.
  13995. @section photosensitivity
  13996. Reduce various flashes in video, so to help users with epilepsy.
  13997. It accepts the following options:
  13998. @table @option
  13999. @item frames, f
  14000. Set how many frames to use when filtering. Default is 30.
  14001. @item threshold, t
  14002. Set detection threshold factor. Default is 1.
  14003. Lower is stricter.
  14004. @item skip
  14005. Set how many pixels to skip when sampling frames. Default is 1.
  14006. Allowed range is from 1 to 1024.
  14007. @item bypass
  14008. Leave frames unchanged. Default is disabled.
  14009. @end table
  14010. @section pixdesctest
  14011. Pixel format descriptor test filter, mainly useful for internal
  14012. testing. The output video should be equal to the input video.
  14013. For example:
  14014. @example
  14015. format=monow, pixdesctest
  14016. @end example
  14017. can be used to test the monowhite pixel format descriptor definition.
  14018. @section pixelize
  14019. Apply pixelization to video stream.
  14020. The filter accepts the following options:
  14021. @table @option
  14022. @item width, w
  14023. @item height, h
  14024. Set block dimensions that will be used for pixelization.
  14025. Default value is @code{16}.
  14026. @item mode, m
  14027. Set the mode of pixelization used.
  14028. Possible values are:
  14029. @table @samp
  14030. @item avg
  14031. @item min
  14032. @item max
  14033. @end table
  14034. Default value is @code{avg}.
  14035. @item planes, p
  14036. Set what planes to filter. Default is to filter all planes.
  14037. @end table
  14038. @subsection Commands
  14039. This filter supports all options as @ref{commands}.
  14040. @section pixscope
  14041. Display sample values of color channels. Mainly useful for checking color
  14042. and levels. Minimum supported resolution is 640x480.
  14043. The filters accept the following options:
  14044. @table @option
  14045. @item x
  14046. Set scope X position, relative offset on X axis.
  14047. @item y
  14048. Set scope Y position, relative offset on Y axis.
  14049. @item w
  14050. Set scope width.
  14051. @item h
  14052. Set scope height.
  14053. @item o
  14054. Set window opacity. This window also holds statistics about pixel area.
  14055. @item wx
  14056. Set window X position, relative offset on X axis.
  14057. @item wy
  14058. Set window Y position, relative offset on Y axis.
  14059. @end table
  14060. @subsection Commands
  14061. This filter supports same @ref{commands} as options.
  14062. @section pp
  14063. Enable the specified chain of postprocessing subfilters using libpostproc. This
  14064. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  14065. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  14066. Each subfilter and some options have a short and a long name that can be used
  14067. interchangeably, i.e. dr/dering are the same.
  14068. The filters accept the following options:
  14069. @table @option
  14070. @item subfilters
  14071. Set postprocessing subfilters string.
  14072. @end table
  14073. All subfilters share common options to determine their scope:
  14074. @table @option
  14075. @item a/autoq
  14076. Honor the quality commands for this subfilter.
  14077. @item c/chrom
  14078. Do chrominance filtering, too (default).
  14079. @item y/nochrom
  14080. Do luminance filtering only (no chrominance).
  14081. @item n/noluma
  14082. Do chrominance filtering only (no luminance).
  14083. @end table
  14084. These options can be appended after the subfilter name, separated by a '|'.
  14085. Available subfilters are:
  14086. @table @option
  14087. @item hb/hdeblock[|difference[|flatness]]
  14088. Horizontal deblocking filter
  14089. @table @option
  14090. @item difference
  14091. Difference factor where higher values mean more deblocking (default: @code{32}).
  14092. @item flatness
  14093. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14094. @end table
  14095. @item vb/vdeblock[|difference[|flatness]]
  14096. Vertical deblocking filter
  14097. @table @option
  14098. @item difference
  14099. Difference factor where higher values mean more deblocking (default: @code{32}).
  14100. @item flatness
  14101. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14102. @end table
  14103. @item ha/hadeblock[|difference[|flatness]]
  14104. Accurate horizontal deblocking filter
  14105. @table @option
  14106. @item difference
  14107. Difference factor where higher values mean more deblocking (default: @code{32}).
  14108. @item flatness
  14109. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14110. @end table
  14111. @item va/vadeblock[|difference[|flatness]]
  14112. Accurate vertical deblocking filter
  14113. @table @option
  14114. @item difference
  14115. Difference factor where higher values mean more deblocking (default: @code{32}).
  14116. @item flatness
  14117. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14118. @end table
  14119. @end table
  14120. The horizontal and vertical deblocking filters share the difference and
  14121. flatness values so you cannot set different horizontal and vertical
  14122. thresholds.
  14123. @table @option
  14124. @item h1/x1hdeblock
  14125. Experimental horizontal deblocking filter
  14126. @item v1/x1vdeblock
  14127. Experimental vertical deblocking filter
  14128. @item dr/dering
  14129. Deringing filter
  14130. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  14131. @table @option
  14132. @item threshold1
  14133. larger -> stronger filtering
  14134. @item threshold2
  14135. larger -> stronger filtering
  14136. @item threshold3
  14137. larger -> stronger filtering
  14138. @end table
  14139. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  14140. @table @option
  14141. @item f/fullyrange
  14142. Stretch luminance to @code{0-255}.
  14143. @end table
  14144. @item lb/linblenddeint
  14145. Linear blend deinterlacing filter that deinterlaces the given block by
  14146. filtering all lines with a @code{(1 2 1)} filter.
  14147. @item li/linipoldeint
  14148. Linear interpolating deinterlacing filter that deinterlaces the given block by
  14149. linearly interpolating every second line.
  14150. @item ci/cubicipoldeint
  14151. Cubic interpolating deinterlacing filter deinterlaces the given block by
  14152. cubically interpolating every second line.
  14153. @item md/mediandeint
  14154. Median deinterlacing filter that deinterlaces the given block by applying a
  14155. median filter to every second line.
  14156. @item fd/ffmpegdeint
  14157. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  14158. second line with a @code{(-1 4 2 4 -1)} filter.
  14159. @item l5/lowpass5
  14160. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  14161. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  14162. @item fq/forceQuant[|quantizer]
  14163. Overrides the quantizer table from the input with the constant quantizer you
  14164. specify.
  14165. @table @option
  14166. @item quantizer
  14167. Quantizer to use
  14168. @end table
  14169. @item de/default
  14170. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  14171. @item fa/fast
  14172. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  14173. @item ac
  14174. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  14175. @end table
  14176. @subsection Examples
  14177. @itemize
  14178. @item
  14179. Apply horizontal and vertical deblocking, deringing and automatic
  14180. brightness/contrast:
  14181. @example
  14182. pp=hb/vb/dr/al
  14183. @end example
  14184. @item
  14185. Apply default filters without brightness/contrast correction:
  14186. @example
  14187. pp=de/-al
  14188. @end example
  14189. @item
  14190. Apply default filters and temporal denoiser:
  14191. @example
  14192. pp=default/tmpnoise|1|2|3
  14193. @end example
  14194. @item
  14195. Apply deblocking on luminance only, and switch vertical deblocking on or off
  14196. automatically depending on available CPU time:
  14197. @example
  14198. pp=hb|y/vb|a
  14199. @end example
  14200. @end itemize
  14201. @section pp7
  14202. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  14203. similar to spp = 6 with 7 point DCT, where only the center sample is
  14204. used after IDCT.
  14205. The filter accepts the following options:
  14206. @table @option
  14207. @item qp
  14208. Force a constant quantization parameter. It accepts an integer in range
  14209. 0 to 63. If not set, the filter will use the QP from the video stream
  14210. (if available).
  14211. @item mode
  14212. Set thresholding mode. Available modes are:
  14213. @table @samp
  14214. @item hard
  14215. Set hard thresholding.
  14216. @item soft
  14217. Set soft thresholding (better de-ringing effect, but likely blurrier).
  14218. @item medium
  14219. Set medium thresholding (good results, default).
  14220. @end table
  14221. @end table
  14222. @section premultiply
  14223. Apply alpha premultiply effect to input video stream using first plane
  14224. of second stream as alpha.
  14225. Both streams must have same dimensions and same pixel format.
  14226. The filter accepts the following option:
  14227. @table @option
  14228. @item planes
  14229. Set which planes will be processed, unprocessed planes will be copied.
  14230. By default value 0xf, all planes will be processed.
  14231. @item inplace
  14232. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14233. @end table
  14234. @section prewitt
  14235. Apply prewitt operator to input video stream.
  14236. The filter accepts the following option:
  14237. @table @option
  14238. @item planes
  14239. Set which planes will be processed, unprocessed planes will be copied.
  14240. By default value 0xf, all planes will be processed.
  14241. @item scale
  14242. Set value which will be multiplied with filtered result.
  14243. @item delta
  14244. Set value which will be added to filtered result.
  14245. @end table
  14246. @subsection Commands
  14247. This filter supports the all above options as @ref{commands}.
  14248. @section pseudocolor
  14249. Alter frame colors in video with pseudocolors.
  14250. This filter accepts the following options:
  14251. @table @option
  14252. @item c0
  14253. set pixel first component expression
  14254. @item c1
  14255. set pixel second component expression
  14256. @item c2
  14257. set pixel third component expression
  14258. @item c3
  14259. set pixel fourth component expression, corresponds to the alpha component
  14260. @item index, i
  14261. set component to use as base for altering colors
  14262. @item preset, p
  14263. Pick one of built-in LUTs. By default is set to none.
  14264. Available LUTs:
  14265. @table @samp
  14266. @item magma
  14267. @item inferno
  14268. @item plasma
  14269. @item viridis
  14270. @item turbo
  14271. @item cividis
  14272. @item range1
  14273. @item range2
  14274. @item shadows
  14275. @item highlights
  14276. @item solar
  14277. @item nominal
  14278. @item preferred
  14279. @item total
  14280. @end table
  14281. @item opacity
  14282. Set opacity of output colors. Allowed range is from 0 to 1.
  14283. Default value is set to 1.
  14284. @end table
  14285. Each of the expression options specifies the expression to use for computing
  14286. the lookup table for the corresponding pixel component values.
  14287. The expressions can contain the following constants and functions:
  14288. @table @option
  14289. @item w
  14290. @item h
  14291. The input width and height.
  14292. @item val
  14293. The input value for the pixel component.
  14294. @item ymin, umin, vmin, amin
  14295. The minimum allowed component value.
  14296. @item ymax, umax, vmax, amax
  14297. The maximum allowed component value.
  14298. @end table
  14299. All expressions default to "val".
  14300. @subsection Commands
  14301. This filter supports the all above options as @ref{commands}.
  14302. @subsection Examples
  14303. @itemize
  14304. @item
  14305. Change too high luma values to gradient:
  14306. @example
  14307. 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'"
  14308. @end example
  14309. @end itemize
  14310. @section psnr
  14311. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  14312. Ratio) between two input videos.
  14313. This filter takes in input two input videos, the first input is
  14314. considered the "main" source and is passed unchanged to the
  14315. output. The second input is used as a "reference" video for computing
  14316. the PSNR.
  14317. Both video inputs must have the same resolution and pixel format for
  14318. this filter to work correctly. Also it assumes that both inputs
  14319. have the same number of frames, which are compared one by one.
  14320. The obtained average PSNR is printed through the logging system.
  14321. The filter stores the accumulated MSE (mean squared error) of each
  14322. frame, and at the end of the processing it is averaged across all frames
  14323. equally, and the following formula is applied to obtain the PSNR:
  14324. @example
  14325. PSNR = 10*log10(MAX^2/MSE)
  14326. @end example
  14327. Where MAX is the average of the maximum values of each component of the
  14328. image.
  14329. The description of the accepted parameters follows.
  14330. @table @option
  14331. @item stats_file, f
  14332. If specified the filter will use the named file to save the PSNR of
  14333. each individual frame. When filename equals "-" the data is sent to
  14334. standard output.
  14335. @item stats_version
  14336. Specifies which version of the stats file format to use. Details of
  14337. each format are written below.
  14338. Default value is 1.
  14339. @item stats_add_max
  14340. Determines whether the max value is output to the stats log.
  14341. Default value is 0.
  14342. Requires stats_version >= 2. If this is set and stats_version < 2,
  14343. the filter will return an error.
  14344. @end table
  14345. This filter also supports the @ref{framesync} options.
  14346. The file printed if @var{stats_file} is selected, contains a sequence of
  14347. key/value pairs of the form @var{key}:@var{value} for each compared
  14348. couple of frames.
  14349. If a @var{stats_version} greater than 1 is specified, a header line precedes
  14350. the list of per-frame-pair stats, with key value pairs following the frame
  14351. format with the following parameters:
  14352. @table @option
  14353. @item psnr_log_version
  14354. The version of the log file format. Will match @var{stats_version}.
  14355. @item fields
  14356. A comma separated list of the per-frame-pair parameters included in
  14357. the log.
  14358. @end table
  14359. A description of each shown per-frame-pair parameter follows:
  14360. @table @option
  14361. @item n
  14362. sequential number of the input frame, starting from 1
  14363. @item mse_avg
  14364. Mean Square Error pixel-by-pixel average difference of the compared
  14365. frames, averaged over all the image components.
  14366. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  14367. Mean Square Error pixel-by-pixel average difference of the compared
  14368. frames for the component specified by the suffix.
  14369. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  14370. Peak Signal to Noise ratio of the compared frames for the component
  14371. specified by the suffix.
  14372. @item max_avg, max_y, max_u, max_v
  14373. Maximum allowed value for each channel, and average over all
  14374. channels.
  14375. @end table
  14376. @subsection Examples
  14377. @itemize
  14378. @item
  14379. For example:
  14380. @example
  14381. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14382. [main][ref] psnr="stats_file=stats.log" [out]
  14383. @end example
  14384. On this example the input file being processed is compared with the
  14385. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  14386. is stored in @file{stats.log}.
  14387. @item
  14388. Another example with different containers:
  14389. @example
  14390. 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 -
  14391. @end example
  14392. @end itemize
  14393. @anchor{pullup}
  14394. @section pullup
  14395. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  14396. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  14397. content.
  14398. The pullup filter is designed to take advantage of future context in making
  14399. its decisions. This filter is stateless in the sense that it does not lock
  14400. onto a pattern to follow, but it instead looks forward to the following
  14401. fields in order to identify matches and rebuild progressive frames.
  14402. To produce content with an even framerate, insert the fps filter after
  14403. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  14404. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  14405. The filter accepts the following options:
  14406. @table @option
  14407. @item jl
  14408. @item jr
  14409. @item jt
  14410. @item jb
  14411. These options set the amount of "junk" to ignore at the left, right, top, and
  14412. bottom of the image, respectively. Left and right are in units of 8 pixels,
  14413. while top and bottom are in units of 2 lines.
  14414. The default is 8 pixels on each side.
  14415. @item sb
  14416. Set the strict breaks. Setting this option to 1 will reduce the chances of
  14417. filter generating an occasional mismatched frame, but it may also cause an
  14418. excessive number of frames to be dropped during high motion sequences.
  14419. Conversely, setting it to -1 will make filter match fields more easily.
  14420. This may help processing of video where there is slight blurring between
  14421. the fields, but may also cause there to be interlaced frames in the output.
  14422. Default value is @code{0}.
  14423. @item mp
  14424. Set the metric plane to use. It accepts the following values:
  14425. @table @samp
  14426. @item l
  14427. Use luma plane.
  14428. @item u
  14429. Use chroma blue plane.
  14430. @item v
  14431. Use chroma red plane.
  14432. @end table
  14433. This option may be set to use chroma plane instead of the default luma plane
  14434. for doing filter's computations. This may improve accuracy on very clean
  14435. source material, but more likely will decrease accuracy, especially if there
  14436. is chroma noise (rainbow effect) or any grayscale video.
  14437. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  14438. load and make pullup usable in realtime on slow machines.
  14439. @end table
  14440. For best results (without duplicated frames in the output file) it is
  14441. necessary to change the output frame rate. For example, to inverse
  14442. telecine NTSC input:
  14443. @example
  14444. ffmpeg -i input -vf pullup -r 24000/1001 ...
  14445. @end example
  14446. @section qp
  14447. Change video quantization parameters (QP).
  14448. The filter accepts the following option:
  14449. @table @option
  14450. @item qp
  14451. Set expression for quantization parameter.
  14452. @end table
  14453. The expression is evaluated through the eval API and can contain, among others,
  14454. the following constants:
  14455. @table @var
  14456. @item known
  14457. 1 if index is not 129, 0 otherwise.
  14458. @item qp
  14459. Sequential index starting from -129 to 128.
  14460. @end table
  14461. @subsection Examples
  14462. @itemize
  14463. @item
  14464. Some equation like:
  14465. @example
  14466. qp=2+2*sin(PI*qp)
  14467. @end example
  14468. @end itemize
  14469. @section random
  14470. Flush video frames from internal cache of frames into a random order.
  14471. No frame is discarded.
  14472. Inspired by @ref{frei0r} nervous filter.
  14473. @table @option
  14474. @item frames
  14475. Set size in number of frames of internal cache, in range from @code{2} to
  14476. @code{512}. Default is @code{30}.
  14477. @item seed
  14478. Set seed for random number generator, must be an integer included between
  14479. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14480. less than @code{0}, the filter will try to use a good random seed on a
  14481. best effort basis.
  14482. @end table
  14483. @section readeia608
  14484. Read closed captioning (EIA-608) information from the top lines of a video frame.
  14485. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  14486. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  14487. with EIA-608 data (starting from 0). A description of each metadata value follows:
  14488. @table @option
  14489. @item lavfi.readeia608.X.cc
  14490. The two bytes stored as EIA-608 data (printed in hexadecimal).
  14491. @item lavfi.readeia608.X.line
  14492. The number of the line on which the EIA-608 data was identified and read.
  14493. @end table
  14494. This filter accepts the following options:
  14495. @table @option
  14496. @item scan_min
  14497. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  14498. @item scan_max
  14499. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  14500. @item spw
  14501. Set the ratio of width reserved for sync code detection.
  14502. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  14503. @item chp
  14504. Enable checking the parity bit. In the event of a parity error, the filter will output
  14505. @code{0x00} for that character. Default is false.
  14506. @item lp
  14507. Lowpass lines prior to further processing. Default is enabled.
  14508. @end table
  14509. @subsection Commands
  14510. This filter supports the all above options as @ref{commands}.
  14511. @subsection Examples
  14512. @itemize
  14513. @item
  14514. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  14515. @example
  14516. 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
  14517. @end example
  14518. @end itemize
  14519. @section readvitc
  14520. Read vertical interval timecode (VITC) information from the top lines of a
  14521. video frame.
  14522. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  14523. timecode value, if a valid timecode has been detected. Further metadata key
  14524. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  14525. timecode data has been found or not.
  14526. This filter accepts the following options:
  14527. @table @option
  14528. @item scan_max
  14529. Set the maximum number of lines to scan for VITC data. If the value is set to
  14530. @code{-1} the full video frame is scanned. Default is @code{45}.
  14531. @item thr_b
  14532. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  14533. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  14534. @item thr_w
  14535. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  14536. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  14537. @end table
  14538. @subsection Examples
  14539. @itemize
  14540. @item
  14541. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  14542. draw @code{--:--:--:--} as a placeholder:
  14543. @example
  14544. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  14545. @end example
  14546. @end itemize
  14547. @section remap
  14548. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  14549. Destination pixel at position (X, Y) will be picked from source (x, y) position
  14550. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  14551. value for pixel will be used for destination pixel.
  14552. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  14553. will have Xmap/Ymap video stream dimensions.
  14554. Xmap and Ymap input video streams are 16bit depth, single channel.
  14555. @table @option
  14556. @item format
  14557. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  14558. Default is @code{color}.
  14559. @item fill
  14560. Specify the color of the unmapped pixels. For the syntax of this option,
  14561. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14562. manual,ffmpeg-utils}. Default color is @code{black}.
  14563. @end table
  14564. @section removegrain
  14565. The removegrain filter is a spatial denoiser for progressive video.
  14566. @table @option
  14567. @item m0
  14568. Set mode for the first plane.
  14569. @item m1
  14570. Set mode for the second plane.
  14571. @item m2
  14572. Set mode for the third plane.
  14573. @item m3
  14574. Set mode for the fourth plane.
  14575. @end table
  14576. Range of mode is from 0 to 24. Description of each mode follows:
  14577. @table @var
  14578. @item 0
  14579. Leave input plane unchanged. Default.
  14580. @item 1
  14581. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  14582. @item 2
  14583. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  14584. @item 3
  14585. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  14586. @item 4
  14587. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  14588. This is equivalent to a median filter.
  14589. @item 5
  14590. Line-sensitive clipping giving the minimal change.
  14591. @item 6
  14592. Line-sensitive clipping, intermediate.
  14593. @item 7
  14594. Line-sensitive clipping, intermediate.
  14595. @item 8
  14596. Line-sensitive clipping, intermediate.
  14597. @item 9
  14598. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  14599. @item 10
  14600. Replaces the target pixel with the closest neighbour.
  14601. @item 11
  14602. [1 2 1] horizontal and vertical kernel blur.
  14603. @item 12
  14604. Same as mode 11.
  14605. @item 13
  14606. Bob mode, interpolates top field from the line where the neighbours
  14607. pixels are the closest.
  14608. @item 14
  14609. Bob mode, interpolates bottom field from the line where the neighbours
  14610. pixels are the closest.
  14611. @item 15
  14612. Bob mode, interpolates top field. Same as 13 but with a more complicated
  14613. interpolation formula.
  14614. @item 16
  14615. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  14616. interpolation formula.
  14617. @item 17
  14618. Clips the pixel with the minimum and maximum of respectively the maximum and
  14619. minimum of each pair of opposite neighbour pixels.
  14620. @item 18
  14621. Line-sensitive clipping using opposite neighbours whose greatest distance from
  14622. the current pixel is minimal.
  14623. @item 19
  14624. Replaces the pixel with the average of its 8 neighbours.
  14625. @item 20
  14626. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  14627. @item 21
  14628. Clips pixels using the averages of opposite neighbour.
  14629. @item 22
  14630. Same as mode 21 but simpler and faster.
  14631. @item 23
  14632. Small edge and halo removal, but reputed useless.
  14633. @item 24
  14634. Similar as 23.
  14635. @end table
  14636. @section removelogo
  14637. Suppress a TV station logo, using an image file to determine which
  14638. pixels comprise the logo. It works by filling in the pixels that
  14639. comprise the logo with neighboring pixels.
  14640. The filter accepts the following options:
  14641. @table @option
  14642. @item filename, f
  14643. Set the filter bitmap file, which can be any image format supported by
  14644. libavformat. The width and height of the image file must match those of the
  14645. video stream being processed.
  14646. @end table
  14647. Pixels in the provided bitmap image with a value of zero are not
  14648. considered part of the logo, non-zero pixels are considered part of
  14649. the logo. If you use white (255) for the logo and black (0) for the
  14650. rest, you will be safe. For making the filter bitmap, it is
  14651. recommended to take a screen capture of a black frame with the logo
  14652. visible, and then using a threshold filter followed by the erode
  14653. filter once or twice.
  14654. If needed, little splotches can be fixed manually. Remember that if
  14655. logo pixels are not covered, the filter quality will be much
  14656. reduced. Marking too many pixels as part of the logo does not hurt as
  14657. much, but it will increase the amount of blurring needed to cover over
  14658. the image and will destroy more information than necessary, and extra
  14659. pixels will slow things down on a large logo.
  14660. @section repeatfields
  14661. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  14662. fields based on its value.
  14663. @section reverse
  14664. Reverse a video clip.
  14665. Warning: This filter requires memory to buffer the entire clip, so trimming
  14666. is suggested.
  14667. @subsection Examples
  14668. @itemize
  14669. @item
  14670. Take the first 5 seconds of a clip, and reverse it.
  14671. @example
  14672. trim=end=5,reverse
  14673. @end example
  14674. @end itemize
  14675. @section rgbashift
  14676. Shift R/G/B/A pixels horizontally and/or vertically.
  14677. The filter accepts the following options:
  14678. @table @option
  14679. @item rh
  14680. Set amount to shift red horizontally.
  14681. @item rv
  14682. Set amount to shift red vertically.
  14683. @item gh
  14684. Set amount to shift green horizontally.
  14685. @item gv
  14686. Set amount to shift green vertically.
  14687. @item bh
  14688. Set amount to shift blue horizontally.
  14689. @item bv
  14690. Set amount to shift blue vertically.
  14691. @item ah
  14692. Set amount to shift alpha horizontally.
  14693. @item av
  14694. Set amount to shift alpha vertically.
  14695. @item edge
  14696. Set edge mode, can be @var{smear}, default, or @var{warp}.
  14697. @end table
  14698. @subsection Commands
  14699. This filter supports the all above options as @ref{commands}.
  14700. @section roberts
  14701. Apply roberts cross operator to input video stream.
  14702. The filter accepts the following option:
  14703. @table @option
  14704. @item planes
  14705. Set which planes will be processed, unprocessed planes will be copied.
  14706. By default value 0xf, all planes will be processed.
  14707. @item scale
  14708. Set value which will be multiplied with filtered result.
  14709. @item delta
  14710. Set value which will be added to filtered result.
  14711. @end table
  14712. @subsection Commands
  14713. This filter supports the all above options as @ref{commands}.
  14714. @section rotate
  14715. Rotate video by an arbitrary angle expressed in radians.
  14716. The filter accepts the following options:
  14717. A description of the optional parameters follows.
  14718. @table @option
  14719. @item angle, a
  14720. Set an expression for the angle by which to rotate the input video
  14721. clockwise, expressed as a number of radians. A negative value will
  14722. result in a counter-clockwise rotation. By default it is set to "0".
  14723. This expression is evaluated for each frame.
  14724. @item out_w, ow
  14725. Set the output width expression, default value is "iw".
  14726. This expression is evaluated just once during configuration.
  14727. @item out_h, oh
  14728. Set the output height expression, default value is "ih".
  14729. This expression is evaluated just once during configuration.
  14730. @item bilinear
  14731. Enable bilinear interpolation if set to 1, a value of 0 disables
  14732. it. Default value is 1.
  14733. @item fillcolor, c
  14734. Set the color used to fill the output area not covered by the rotated
  14735. image. For the general syntax of this option, check the
  14736. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14737. If the special value "none" is selected then no
  14738. background is printed (useful for example if the background is never shown).
  14739. Default value is "black".
  14740. @end table
  14741. The expressions for the angle and the output size can contain the
  14742. following constants and functions:
  14743. @table @option
  14744. @item n
  14745. sequential number of the input frame, starting from 0. It is always NAN
  14746. before the first frame is filtered.
  14747. @item t
  14748. time in seconds of the input frame, it is set to 0 when the filter is
  14749. configured. It is always NAN before the first frame is filtered.
  14750. @item hsub
  14751. @item vsub
  14752. horizontal and vertical chroma subsample values. For example for the
  14753. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14754. @item in_w, iw
  14755. @item in_h, ih
  14756. the input video width and height
  14757. @item out_w, ow
  14758. @item out_h, oh
  14759. the output width and height, that is the size of the padded area as
  14760. specified by the @var{width} and @var{height} expressions
  14761. @item rotw(a)
  14762. @item roth(a)
  14763. the minimal width/height required for completely containing the input
  14764. video rotated by @var{a} radians.
  14765. These are only available when computing the @option{out_w} and
  14766. @option{out_h} expressions.
  14767. @end table
  14768. @subsection Examples
  14769. @itemize
  14770. @item
  14771. Rotate the input by PI/6 radians clockwise:
  14772. @example
  14773. rotate=PI/6
  14774. @end example
  14775. @item
  14776. Rotate the input by PI/6 radians counter-clockwise:
  14777. @example
  14778. rotate=-PI/6
  14779. @end example
  14780. @item
  14781. Rotate the input by 45 degrees clockwise:
  14782. @example
  14783. rotate=45*PI/180
  14784. @end example
  14785. @item
  14786. Apply a constant rotation with period T, starting from an angle of PI/3:
  14787. @example
  14788. rotate=PI/3+2*PI*t/T
  14789. @end example
  14790. @item
  14791. Make the input video rotation oscillating with a period of T
  14792. seconds and an amplitude of A radians:
  14793. @example
  14794. rotate=A*sin(2*PI/T*t)
  14795. @end example
  14796. @item
  14797. Rotate the video, output size is chosen so that the whole rotating
  14798. input video is always completely contained in the output:
  14799. @example
  14800. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  14801. @end example
  14802. @item
  14803. Rotate the video, reduce the output size so that no background is ever
  14804. shown:
  14805. @example
  14806. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  14807. @end example
  14808. @end itemize
  14809. @subsection Commands
  14810. The filter supports the following commands:
  14811. @table @option
  14812. @item a, angle
  14813. Set the angle expression.
  14814. The command accepts the same syntax of the corresponding option.
  14815. If the specified expression is not valid, it is kept at its current
  14816. value.
  14817. @end table
  14818. @section sab
  14819. Apply Shape Adaptive Blur.
  14820. The filter accepts the following options:
  14821. @table @option
  14822. @item luma_radius, lr
  14823. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  14824. value is 1.0. A greater value will result in a more blurred image, and
  14825. in slower processing.
  14826. @item luma_pre_filter_radius, lpfr
  14827. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  14828. value is 1.0.
  14829. @item luma_strength, ls
  14830. Set luma maximum difference between pixels to still be considered, must
  14831. be a value in the 0.1-100.0 range, default value is 1.0.
  14832. @item chroma_radius, cr
  14833. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  14834. greater value will result in a more blurred image, and in slower
  14835. processing.
  14836. @item chroma_pre_filter_radius, cpfr
  14837. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  14838. @item chroma_strength, cs
  14839. Set chroma maximum difference between pixels to still be considered,
  14840. must be a value in the -0.9-100.0 range.
  14841. @end table
  14842. Each chroma option value, if not explicitly specified, is set to the
  14843. corresponding luma option value.
  14844. @anchor{scale}
  14845. @section scale
  14846. Scale (resize) the input video, using the libswscale library.
  14847. The scale filter forces the output display aspect ratio to be the same
  14848. of the input, by changing the output sample aspect ratio.
  14849. If the input image format is different from the format requested by
  14850. the next filter, the scale filter will convert the input to the
  14851. requested format.
  14852. @subsection Options
  14853. The filter accepts the following options, or any of the options
  14854. supported by the libswscale scaler.
  14855. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  14856. the complete list of scaler options.
  14857. @table @option
  14858. @item width, w
  14859. @item height, h
  14860. Set the output video dimension expression. Default value is the input
  14861. dimension.
  14862. If the @var{width} or @var{w} value is 0, the input width is used for
  14863. the output. If the @var{height} or @var{h} value is 0, the input height
  14864. is used for the output.
  14865. If one and only one of the values is -n with n >= 1, the scale filter
  14866. will use a value that maintains the aspect ratio of the input image,
  14867. calculated from the other specified dimension. After that it will,
  14868. however, make sure that the calculated dimension is divisible by n and
  14869. adjust the value if necessary.
  14870. If both values are -n with n >= 1, the behavior will be identical to
  14871. both values being set to 0 as previously detailed.
  14872. See below for the list of accepted constants for use in the dimension
  14873. expression.
  14874. @item eval
  14875. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  14876. @table @samp
  14877. @item init
  14878. Only evaluate expressions once during the filter initialization or when a command is processed.
  14879. @item frame
  14880. Evaluate expressions for each incoming frame.
  14881. @end table
  14882. Default value is @samp{init}.
  14883. @item interl
  14884. Set the interlacing mode. It accepts the following values:
  14885. @table @samp
  14886. @item 1
  14887. Force interlaced aware scaling.
  14888. @item 0
  14889. Do not apply interlaced scaling.
  14890. @item -1
  14891. Select interlaced aware scaling depending on whether the source frames
  14892. are flagged as interlaced or not.
  14893. @end table
  14894. Default value is @samp{0}.
  14895. @item flags
  14896. Set libswscale scaling flags. See
  14897. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  14898. complete list of values. If not explicitly specified the filter applies
  14899. the default flags.
  14900. @item param0, param1
  14901. Set libswscale input parameters for scaling algorithms that need them. See
  14902. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  14903. complete documentation. If not explicitly specified the filter applies
  14904. empty parameters.
  14905. @item size, s
  14906. Set the video size. For the syntax of this option, check the
  14907. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14908. @item in_color_matrix
  14909. @item out_color_matrix
  14910. Set in/output YCbCr color space type.
  14911. This allows the autodetected value to be overridden as well as allows forcing
  14912. a specific value used for the output and encoder.
  14913. If not specified, the color space type depends on the pixel format.
  14914. Possible values:
  14915. @table @samp
  14916. @item auto
  14917. Choose automatically.
  14918. @item bt709
  14919. Format conforming to International Telecommunication Union (ITU)
  14920. Recommendation BT.709.
  14921. @item fcc
  14922. Set color space conforming to the United States Federal Communications
  14923. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  14924. @item bt601
  14925. @item bt470
  14926. @item smpte170m
  14927. Set color space conforming to:
  14928. @itemize
  14929. @item
  14930. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  14931. @item
  14932. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  14933. @item
  14934. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  14935. @end itemize
  14936. @item smpte240m
  14937. Set color space conforming to SMPTE ST 240:1999.
  14938. @item bt2020
  14939. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  14940. @end table
  14941. @item in_range
  14942. @item out_range
  14943. Set in/output YCbCr sample range.
  14944. This allows the autodetected value to be overridden as well as allows forcing
  14945. a specific value used for the output and encoder. If not specified, the
  14946. range depends on the pixel format. Possible values:
  14947. @table @samp
  14948. @item auto/unknown
  14949. Choose automatically.
  14950. @item jpeg/full/pc
  14951. Set full range (0-255 in case of 8-bit luma).
  14952. @item mpeg/limited/tv
  14953. Set "MPEG" range (16-235 in case of 8-bit luma).
  14954. @end table
  14955. @item force_original_aspect_ratio
  14956. Enable decreasing or increasing output video width or height if necessary to
  14957. keep the original aspect ratio. Possible values:
  14958. @table @samp
  14959. @item disable
  14960. Scale the video as specified and disable this feature.
  14961. @item decrease
  14962. The output video dimensions will automatically be decreased if needed.
  14963. @item increase
  14964. The output video dimensions will automatically be increased if needed.
  14965. @end table
  14966. One useful instance of this option is that when you know a specific device's
  14967. maximum allowed resolution, you can use this to limit the output video to
  14968. that, while retaining the aspect ratio. For example, device A allows
  14969. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  14970. decrease) and specifying 1280x720 to the command line makes the output
  14971. 1280x533.
  14972. Please note that this is a different thing than specifying -1 for @option{w}
  14973. or @option{h}, you still need to specify the output resolution for this option
  14974. to work.
  14975. @item force_divisible_by
  14976. Ensures that both the output dimensions, width and height, are divisible by the
  14977. given integer when used together with @option{force_original_aspect_ratio}. This
  14978. works similar to using @code{-n} in the @option{w} and @option{h} options.
  14979. This option respects the value set for @option{force_original_aspect_ratio},
  14980. increasing or decreasing the resolution accordingly. The video's aspect ratio
  14981. may be slightly modified.
  14982. This option can be handy if you need to have a video fit within or exceed
  14983. a defined resolution using @option{force_original_aspect_ratio} but also have
  14984. encoder restrictions on width or height divisibility.
  14985. @end table
  14986. The values of the @option{w} and @option{h} options are expressions
  14987. containing the following constants:
  14988. @table @var
  14989. @item in_w
  14990. @item in_h
  14991. The input width and height
  14992. @item iw
  14993. @item ih
  14994. These are the same as @var{in_w} and @var{in_h}.
  14995. @item out_w
  14996. @item out_h
  14997. The output (scaled) width and height
  14998. @item ow
  14999. @item oh
  15000. These are the same as @var{out_w} and @var{out_h}
  15001. @item a
  15002. The same as @var{iw} / @var{ih}
  15003. @item sar
  15004. input sample aspect ratio
  15005. @item dar
  15006. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15007. @item hsub
  15008. @item vsub
  15009. horizontal and vertical input chroma subsample values. For example for the
  15010. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15011. @item ohsub
  15012. @item ovsub
  15013. horizontal and vertical output chroma subsample values. For example for the
  15014. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15015. @item n
  15016. The (sequential) number of the input frame, starting from 0.
  15017. Only available with @code{eval=frame}.
  15018. @item t
  15019. The presentation timestamp of the input frame, expressed as a number of
  15020. seconds. Only available with @code{eval=frame}.
  15021. @item pos
  15022. The position (byte offset) of the frame in the input stream, or NaN if
  15023. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15024. Only available with @code{eval=frame}.
  15025. @end table
  15026. @subsection Examples
  15027. @itemize
  15028. @item
  15029. Scale the input video to a size of 200x100
  15030. @example
  15031. scale=w=200:h=100
  15032. @end example
  15033. This is equivalent to:
  15034. @example
  15035. scale=200:100
  15036. @end example
  15037. or:
  15038. @example
  15039. scale=200x100
  15040. @end example
  15041. @item
  15042. Specify a size abbreviation for the output size:
  15043. @example
  15044. scale=qcif
  15045. @end example
  15046. which can also be written as:
  15047. @example
  15048. scale=size=qcif
  15049. @end example
  15050. @item
  15051. Scale the input to 2x:
  15052. @example
  15053. scale=w=2*iw:h=2*ih
  15054. @end example
  15055. @item
  15056. The above is the same as:
  15057. @example
  15058. scale=2*in_w:2*in_h
  15059. @end example
  15060. @item
  15061. Scale the input to 2x with forced interlaced scaling:
  15062. @example
  15063. scale=2*iw:2*ih:interl=1
  15064. @end example
  15065. @item
  15066. Scale the input to half size:
  15067. @example
  15068. scale=w=iw/2:h=ih/2
  15069. @end example
  15070. @item
  15071. Increase the width, and set the height to the same size:
  15072. @example
  15073. scale=3/2*iw:ow
  15074. @end example
  15075. @item
  15076. Seek Greek harmony:
  15077. @example
  15078. scale=iw:1/PHI*iw
  15079. scale=ih*PHI:ih
  15080. @end example
  15081. @item
  15082. Increase the height, and set the width to 3/2 of the height:
  15083. @example
  15084. scale=w=3/2*oh:h=3/5*ih
  15085. @end example
  15086. @item
  15087. Increase the size, making the size a multiple of the chroma
  15088. subsample values:
  15089. @example
  15090. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  15091. @end example
  15092. @item
  15093. Increase the width to a maximum of 500 pixels,
  15094. keeping the same aspect ratio as the input:
  15095. @example
  15096. scale=w='min(500\, iw*3/2):h=-1'
  15097. @end example
  15098. @item
  15099. Make pixels square by combining scale and setsar:
  15100. @example
  15101. scale='trunc(ih*dar):ih',setsar=1/1
  15102. @end example
  15103. @item
  15104. Make pixels square by combining scale and setsar,
  15105. making sure the resulting resolution is even (required by some codecs):
  15106. @example
  15107. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  15108. @end example
  15109. @end itemize
  15110. @subsection Commands
  15111. This filter supports the following commands:
  15112. @table @option
  15113. @item width, w
  15114. @item height, h
  15115. Set the output video dimension expression.
  15116. The command accepts the same syntax of the corresponding option.
  15117. If the specified expression is not valid, it is kept at its current
  15118. value.
  15119. @end table
  15120. @section scale_cuda
  15121. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  15122. Setting the output width and height works in the same way as for the @ref{scale} filter.
  15123. The filter accepts the following options:
  15124. @table @option
  15125. @item w
  15126. @item h
  15127. Set the output video dimension expression. Default value is the input dimension.
  15128. Allows for the same expressions as the @ref{scale} filter.
  15129. @item interp_algo
  15130. Sets the algorithm used for scaling:
  15131. @table @var
  15132. @item nearest
  15133. Nearest neighbour
  15134. Used by default if input parameters match the desired output.
  15135. @item bilinear
  15136. Bilinear
  15137. @item bicubic
  15138. Bicubic
  15139. This is the default.
  15140. @item lanczos
  15141. Lanczos
  15142. @end table
  15143. @item format
  15144. Controls the output pixel format. By default, or if none is specified, the input
  15145. pixel format is used.
  15146. The filter does not support converting between YUV and RGB pixel formats.
  15147. @item passthrough
  15148. If set to 0, every frame is processed, even if no conversion is neccesary.
  15149. This mode can be useful to use the filter as a buffer for a downstream
  15150. frame-consumer that exhausts the limited decoder frame pool.
  15151. If set to 1, frames are passed through as-is if they match the desired output
  15152. parameters. This is the default behaviour.
  15153. @item param
  15154. Algorithm-Specific parameter.
  15155. Affects the curves of the bicubic algorithm.
  15156. @item force_original_aspect_ratio
  15157. @item force_divisible_by
  15158. Work the same as the identical @ref{scale} filter options.
  15159. @end table
  15160. @subsection Examples
  15161. @itemize
  15162. @item
  15163. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  15164. @example
  15165. scale_cuda=-2:720:format=yuv420p
  15166. @end example
  15167. @item
  15168. Upscale to 4K using nearest neighbour algorithm.
  15169. @example
  15170. scale_cuda=4096:2160:interp_algo=nearest
  15171. @end example
  15172. @item
  15173. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  15174. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  15175. decoders frame pool.
  15176. @example
  15177. scale_cuda=passthrough=0
  15178. @end example
  15179. @end itemize
  15180. @anchor{scale_npp}
  15181. @section scale_npp
  15182. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  15183. format conversion on CUDA video frames. Setting the output width and height
  15184. works in the same way as for the @var{scale} filter.
  15185. The following additional options are accepted:
  15186. @table @option
  15187. @item format
  15188. The pixel format of the output CUDA frames. If set to the string "same" (the
  15189. default), the input format will be kept. Note that automatic format negotiation
  15190. and conversion is not yet supported for hardware frames
  15191. @item interp_algo
  15192. The interpolation algorithm used for resizing. One of the following:
  15193. @table @option
  15194. @item nn
  15195. Nearest neighbour.
  15196. @item linear
  15197. @item cubic
  15198. @item cubic2p_bspline
  15199. 2-parameter cubic (B=1, C=0)
  15200. @item cubic2p_catmullrom
  15201. 2-parameter cubic (B=0, C=1/2)
  15202. @item cubic2p_b05c03
  15203. 2-parameter cubic (B=1/2, C=3/10)
  15204. @item super
  15205. Supersampling
  15206. @item lanczos
  15207. @end table
  15208. @item force_original_aspect_ratio
  15209. Enable decreasing or increasing output video width or height if necessary to
  15210. keep the original aspect ratio. Possible values:
  15211. @table @samp
  15212. @item disable
  15213. Scale the video as specified and disable this feature.
  15214. @item decrease
  15215. The output video dimensions will automatically be decreased if needed.
  15216. @item increase
  15217. The output video dimensions will automatically be increased if needed.
  15218. @end table
  15219. One useful instance of this option is that when you know a specific device's
  15220. maximum allowed resolution, you can use this to limit the output video to
  15221. that, while retaining the aspect ratio. For example, device A allows
  15222. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15223. decrease) and specifying 1280x720 to the command line makes the output
  15224. 1280x533.
  15225. Please note that this is a different thing than specifying -1 for @option{w}
  15226. or @option{h}, you still need to specify the output resolution for this option
  15227. to work.
  15228. @item force_divisible_by
  15229. Ensures that both the output dimensions, width and height, are divisible by the
  15230. given integer when used together with @option{force_original_aspect_ratio}. This
  15231. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15232. This option respects the value set for @option{force_original_aspect_ratio},
  15233. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15234. may be slightly modified.
  15235. This option can be handy if you need to have a video fit within or exceed
  15236. a defined resolution using @option{force_original_aspect_ratio} but also have
  15237. encoder restrictions on width or height divisibility.
  15238. @item eval
  15239. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15240. @table @samp
  15241. @item init
  15242. Only evaluate expressions once during the filter initialization or when a command is processed.
  15243. @item frame
  15244. Evaluate expressions for each incoming frame.
  15245. @end table
  15246. @end table
  15247. The values of the @option{w} and @option{h} options are expressions
  15248. containing the following constants:
  15249. @table @var
  15250. @item in_w
  15251. @item in_h
  15252. The input width and height
  15253. @item iw
  15254. @item ih
  15255. These are the same as @var{in_w} and @var{in_h}.
  15256. @item out_w
  15257. @item out_h
  15258. The output (scaled) width and height
  15259. @item ow
  15260. @item oh
  15261. These are the same as @var{out_w} and @var{out_h}
  15262. @item a
  15263. The same as @var{iw} / @var{ih}
  15264. @item sar
  15265. input sample aspect ratio
  15266. @item dar
  15267. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15268. @item n
  15269. The (sequential) number of the input frame, starting from 0.
  15270. Only available with @code{eval=frame}.
  15271. @item t
  15272. The presentation timestamp of the input frame, expressed as a number of
  15273. seconds. Only available with @code{eval=frame}.
  15274. @item pos
  15275. The position (byte offset) of the frame in the input stream, or NaN if
  15276. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15277. Only available with @code{eval=frame}.
  15278. @end table
  15279. @section scale2ref
  15280. Scale (resize) the input video, based on a reference video.
  15281. See the scale filter for available options, scale2ref supports the same but
  15282. uses the reference video instead of the main input as basis. scale2ref also
  15283. supports the following additional constants for the @option{w} and
  15284. @option{h} options:
  15285. @table @var
  15286. @item main_w
  15287. @item main_h
  15288. The main input video's width and height
  15289. @item main_a
  15290. The same as @var{main_w} / @var{main_h}
  15291. @item main_sar
  15292. The main input video's sample aspect ratio
  15293. @item main_dar, mdar
  15294. The main input video's display aspect ratio. Calculated from
  15295. @code{(main_w / main_h) * main_sar}.
  15296. @item main_hsub
  15297. @item main_vsub
  15298. The main input video's horizontal and vertical chroma subsample values.
  15299. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  15300. is 1.
  15301. @item main_n
  15302. The (sequential) number of the main input frame, starting from 0.
  15303. Only available with @code{eval=frame}.
  15304. @item main_t
  15305. The presentation timestamp of the main input frame, expressed as a number of
  15306. seconds. Only available with @code{eval=frame}.
  15307. @item main_pos
  15308. The position (byte offset) of the frame in the main input stream, or NaN if
  15309. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15310. Only available with @code{eval=frame}.
  15311. @end table
  15312. @subsection Examples
  15313. @itemize
  15314. @item
  15315. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15316. @example
  15317. 'scale2ref[b][a];[a][b]overlay'
  15318. @end example
  15319. @item
  15320. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15321. @example
  15322. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  15323. @end example
  15324. @end itemize
  15325. @subsection Commands
  15326. This filter supports the following commands:
  15327. @table @option
  15328. @item width, w
  15329. @item height, h
  15330. Set the output video dimension expression.
  15331. The command accepts the same syntax of the corresponding option.
  15332. If the specified expression is not valid, it is kept at its current
  15333. value.
  15334. @end table
  15335. @section scale2ref_npp
  15336. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  15337. video, based on a reference video.
  15338. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  15339. but uses the reference video instead of the main input as basis. scale2ref_npp
  15340. also supports the following additional constants for the @option{w} and
  15341. @option{h} options:
  15342. @table @var
  15343. @item main_w
  15344. @item main_h
  15345. The main input video's width and height
  15346. @item main_a
  15347. The same as @var{main_w} / @var{main_h}
  15348. @item main_sar
  15349. The main input video's sample aspect ratio
  15350. @item main_dar, mdar
  15351. The main input video's display aspect ratio. Calculated from
  15352. @code{(main_w / main_h) * main_sar}.
  15353. @item main_n
  15354. The (sequential) number of the main input frame, starting from 0.
  15355. Only available with @code{eval=frame}.
  15356. @item main_t
  15357. The presentation timestamp of the main input frame, expressed as a number of
  15358. seconds. Only available with @code{eval=frame}.
  15359. @item main_pos
  15360. The position (byte offset) of the frame in the main input stream, or NaN if
  15361. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15362. Only available with @code{eval=frame}.
  15363. @end table
  15364. @subsection Examples
  15365. @itemize
  15366. @item
  15367. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15368. @example
  15369. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  15370. @end example
  15371. @item
  15372. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15373. @example
  15374. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  15375. @end example
  15376. @end itemize
  15377. @section scharr
  15378. Apply scharr operator to input video stream.
  15379. The filter accepts the following option:
  15380. @table @option
  15381. @item planes
  15382. Set which planes will be processed, unprocessed planes will be copied.
  15383. By default value 0xf, all planes will be processed.
  15384. @item scale
  15385. Set value which will be multiplied with filtered result.
  15386. @item delta
  15387. Set value which will be added to filtered result.
  15388. @end table
  15389. @subsection Commands
  15390. This filter supports the all above options as @ref{commands}.
  15391. @section scroll
  15392. Scroll input video horizontally and/or vertically by constant speed.
  15393. The filter accepts the following options:
  15394. @table @option
  15395. @item horizontal, h
  15396. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15397. Negative values changes scrolling direction.
  15398. @item vertical, v
  15399. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15400. Negative values changes scrolling direction.
  15401. @item hpos
  15402. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  15403. @item vpos
  15404. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  15405. @end table
  15406. @subsection Commands
  15407. This filter supports the following @ref{commands}:
  15408. @table @option
  15409. @item horizontal, h
  15410. Set the horizontal scrolling speed.
  15411. @item vertical, v
  15412. Set the vertical scrolling speed.
  15413. @end table
  15414. @anchor{scdet}
  15415. @section scdet
  15416. Detect video scene change.
  15417. This filter sets frame metadata with mafd between frame, the scene score, and
  15418. forward the frame to the next filter, so they can use these metadata to detect
  15419. scene change or others.
  15420. In addition, this filter logs a message and sets frame metadata when it detects
  15421. a scene change by @option{threshold}.
  15422. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  15423. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  15424. to detect scene change.
  15425. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  15426. detect scene change with @option{threshold}.
  15427. The filter accepts the following options:
  15428. @table @option
  15429. @item threshold, t
  15430. Set the scene change detection threshold as a percentage of maximum change. Good
  15431. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  15432. @code{[0., 100.]}.
  15433. Default value is @code{10.}.
  15434. @item sc_pass, s
  15435. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  15436. You can enable it if you want to get snapshot of scene change frames only.
  15437. @end table
  15438. @anchor{selectivecolor}
  15439. @section selectivecolor
  15440. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  15441. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  15442. by the "purity" of the color (that is, how saturated it already is).
  15443. This filter is similar to the Adobe Photoshop Selective Color tool.
  15444. The filter accepts the following options:
  15445. @table @option
  15446. @item correction_method
  15447. Select color correction method.
  15448. Available values are:
  15449. @table @samp
  15450. @item absolute
  15451. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  15452. component value).
  15453. @item relative
  15454. Specified adjustments are relative to the original component value.
  15455. @end table
  15456. Default is @code{absolute}.
  15457. @item reds
  15458. Adjustments for red pixels (pixels where the red component is the maximum)
  15459. @item yellows
  15460. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  15461. @item greens
  15462. Adjustments for green pixels (pixels where the green component is the maximum)
  15463. @item cyans
  15464. Adjustments for cyan pixels (pixels where the red component is the minimum)
  15465. @item blues
  15466. Adjustments for blue pixels (pixels where the blue component is the maximum)
  15467. @item magentas
  15468. Adjustments for magenta pixels (pixels where the green component is the minimum)
  15469. @item whites
  15470. Adjustments for white pixels (pixels where all components are greater than 128)
  15471. @item neutrals
  15472. Adjustments for all pixels except pure black and pure white
  15473. @item blacks
  15474. Adjustments for black pixels (pixels where all components are lesser than 128)
  15475. @item psfile
  15476. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  15477. @end table
  15478. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  15479. 4 space separated floating point adjustment values in the [-1,1] range,
  15480. respectively to adjust the amount of cyan, magenta, yellow and black for the
  15481. pixels of its range.
  15482. @subsection Examples
  15483. @itemize
  15484. @item
  15485. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  15486. increase magenta by 27% in blue areas:
  15487. @example
  15488. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  15489. @end example
  15490. @item
  15491. Use a Photoshop selective color preset:
  15492. @example
  15493. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  15494. @end example
  15495. @end itemize
  15496. @anchor{separatefields}
  15497. @section separatefields
  15498. The @code{separatefields} takes a frame-based video input and splits
  15499. each frame into its components fields, producing a new half height clip
  15500. with twice the frame rate and twice the frame count.
  15501. This filter use field-dominance information in frame to decide which
  15502. of each pair of fields to place first in the output.
  15503. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  15504. @section setdar, setsar
  15505. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  15506. output video.
  15507. This is done by changing the specified Sample (aka Pixel) Aspect
  15508. Ratio, according to the following equation:
  15509. @example
  15510. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  15511. @end example
  15512. Keep in mind that the @code{setdar} filter does not modify the pixel
  15513. dimensions of the video frame. Also, the display aspect ratio set by
  15514. this filter may be changed by later filters in the filterchain,
  15515. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  15516. applied.
  15517. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  15518. the filter output video.
  15519. Note that as a consequence of the application of this filter, the
  15520. output display aspect ratio will change according to the equation
  15521. above.
  15522. Keep in mind that the sample aspect ratio set by the @code{setsar}
  15523. filter may be changed by later filters in the filterchain, e.g. if
  15524. another "setsar" or a "setdar" filter is applied.
  15525. It accepts the following parameters:
  15526. @table @option
  15527. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  15528. Set the aspect ratio used by the filter.
  15529. The parameter can be a floating point number string, an expression, or
  15530. a string of the form @var{num}:@var{den}, where @var{num} and
  15531. @var{den} are the numerator and denominator of the aspect ratio. If
  15532. the parameter is not specified, it is assumed the value "0".
  15533. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  15534. should be escaped.
  15535. @item max
  15536. Set the maximum integer value to use for expressing numerator and
  15537. denominator when reducing the expressed aspect ratio to a rational.
  15538. Default value is @code{100}.
  15539. @end table
  15540. The parameter @var{sar} is an expression containing
  15541. the following constants:
  15542. @table @option
  15543. @item E, PI, PHI
  15544. These are approximated values for the mathematical constants e
  15545. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  15546. @item w, h
  15547. The input width and height.
  15548. @item a
  15549. These are the same as @var{w} / @var{h}.
  15550. @item sar
  15551. The input sample aspect ratio.
  15552. @item dar
  15553. The input display aspect ratio. It is the same as
  15554. (@var{w} / @var{h}) * @var{sar}.
  15555. @item hsub, vsub
  15556. Horizontal and vertical chroma subsample values. For example, for the
  15557. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15558. @end table
  15559. @subsection Examples
  15560. @itemize
  15561. @item
  15562. To change the display aspect ratio to 16:9, specify one of the following:
  15563. @example
  15564. setdar=dar=1.77777
  15565. setdar=dar=16/9
  15566. @end example
  15567. @item
  15568. To change the sample aspect ratio to 10:11, specify:
  15569. @example
  15570. setsar=sar=10/11
  15571. @end example
  15572. @item
  15573. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  15574. 1000 in the aspect ratio reduction, use the command:
  15575. @example
  15576. setdar=ratio=16/9:max=1000
  15577. @end example
  15578. @end itemize
  15579. @anchor{setfield}
  15580. @section setfield
  15581. Force field for the output video frame.
  15582. The @code{setfield} filter marks the interlace type field for the
  15583. output frames. It does not change the input frame, but only sets the
  15584. corresponding property, which affects how the frame is treated by
  15585. following filters (e.g. @code{fieldorder} or @code{yadif}).
  15586. The filter accepts the following options:
  15587. @table @option
  15588. @item mode
  15589. Available values are:
  15590. @table @samp
  15591. @item auto
  15592. Keep the same field property.
  15593. @item bff
  15594. Mark the frame as bottom-field-first.
  15595. @item tff
  15596. Mark the frame as top-field-first.
  15597. @item prog
  15598. Mark the frame as progressive.
  15599. @end table
  15600. @end table
  15601. @anchor{setparams}
  15602. @section setparams
  15603. Force frame parameter for the output video frame.
  15604. The @code{setparams} filter marks interlace and color range for the
  15605. output frames. It does not change the input frame, but only sets the
  15606. corresponding property, which affects how the frame is treated by
  15607. filters/encoders.
  15608. @table @option
  15609. @item field_mode
  15610. Available values are:
  15611. @table @samp
  15612. @item auto
  15613. Keep the same field property (default).
  15614. @item bff
  15615. Mark the frame as bottom-field-first.
  15616. @item tff
  15617. Mark the frame as top-field-first.
  15618. @item prog
  15619. Mark the frame as progressive.
  15620. @end table
  15621. @item range
  15622. Available values are:
  15623. @table @samp
  15624. @item auto
  15625. Keep the same color range property (default).
  15626. @item unspecified, unknown
  15627. Mark the frame as unspecified color range.
  15628. @item limited, tv, mpeg
  15629. Mark the frame as limited range.
  15630. @item full, pc, jpeg
  15631. Mark the frame as full range.
  15632. @end table
  15633. @item color_primaries
  15634. Set the color primaries.
  15635. Available values are:
  15636. @table @samp
  15637. @item auto
  15638. Keep the same color primaries property (default).
  15639. @item bt709
  15640. @item unknown
  15641. @item bt470m
  15642. @item bt470bg
  15643. @item smpte170m
  15644. @item smpte240m
  15645. @item film
  15646. @item bt2020
  15647. @item smpte428
  15648. @item smpte431
  15649. @item smpte432
  15650. @item jedec-p22
  15651. @end table
  15652. @item color_trc
  15653. Set the color transfer.
  15654. Available values are:
  15655. @table @samp
  15656. @item auto
  15657. Keep the same color trc property (default).
  15658. @item bt709
  15659. @item unknown
  15660. @item bt470m
  15661. @item bt470bg
  15662. @item smpte170m
  15663. @item smpte240m
  15664. @item linear
  15665. @item log100
  15666. @item log316
  15667. @item iec61966-2-4
  15668. @item bt1361e
  15669. @item iec61966-2-1
  15670. @item bt2020-10
  15671. @item bt2020-12
  15672. @item smpte2084
  15673. @item smpte428
  15674. @item arib-std-b67
  15675. @end table
  15676. @item colorspace
  15677. Set the colorspace.
  15678. Available values are:
  15679. @table @samp
  15680. @item auto
  15681. Keep the same colorspace property (default).
  15682. @item gbr
  15683. @item bt709
  15684. @item unknown
  15685. @item fcc
  15686. @item bt470bg
  15687. @item smpte170m
  15688. @item smpte240m
  15689. @item ycgco
  15690. @item bt2020nc
  15691. @item bt2020c
  15692. @item smpte2085
  15693. @item chroma-derived-nc
  15694. @item chroma-derived-c
  15695. @item ictcp
  15696. @end table
  15697. @end table
  15698. @section sharpen_npp
  15699. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  15700. border control.
  15701. The following additional options are accepted:
  15702. @table @option
  15703. @item border_type
  15704. Type of sampling to be used ad frame borders. One of the following:
  15705. @table @option
  15706. @item replicate
  15707. Replicate pixel values.
  15708. @end table
  15709. @end table
  15710. @section shear
  15711. Apply shear transform to input video.
  15712. This filter supports the following options:
  15713. @table @option
  15714. @item shx
  15715. Shear factor in X-direction. Default value is 0.
  15716. Allowed range is from -2 to 2.
  15717. @item shy
  15718. Shear factor in Y-direction. Default value is 0.
  15719. Allowed range is from -2 to 2.
  15720. @item fillcolor, c
  15721. Set the color used to fill the output area not covered by the transformed
  15722. video. For the general syntax of this option, check the
  15723. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15724. If the special value "none" is selected then no
  15725. background is printed (useful for example if the background is never shown).
  15726. Default value is "black".
  15727. @item interp
  15728. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  15729. @end table
  15730. @subsection Commands
  15731. This filter supports the all above options as @ref{commands}.
  15732. @section showinfo
  15733. Show a line containing various information for each input video frame.
  15734. The input video is not modified.
  15735. This filter supports the following options:
  15736. @table @option
  15737. @item checksum
  15738. Calculate checksums of each plane. By default enabled.
  15739. @end table
  15740. The shown line contains a sequence of key/value pairs of the form
  15741. @var{key}:@var{value}.
  15742. The following values are shown in the output:
  15743. @table @option
  15744. @item n
  15745. The (sequential) number of the input frame, starting from 0.
  15746. @item pts
  15747. The Presentation TimeStamp of the input frame, expressed as a number of
  15748. time base units. The time base unit depends on the filter input pad.
  15749. @item pts_time
  15750. The Presentation TimeStamp of the input frame, expressed as a number of
  15751. seconds.
  15752. @item pos
  15753. The position of the frame in the input stream, or -1 if this information is
  15754. unavailable and/or meaningless (for example in case of synthetic video).
  15755. @item fmt
  15756. The pixel format name.
  15757. @item sar
  15758. The sample aspect ratio of the input frame, expressed in the form
  15759. @var{num}/@var{den}.
  15760. @item s
  15761. The size of the input frame. For the syntax of this option, check the
  15762. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15763. @item i
  15764. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  15765. for bottom field first).
  15766. @item iskey
  15767. This is 1 if the frame is a key frame, 0 otherwise.
  15768. @item type
  15769. The picture type of the input frame ("I" for an I-frame, "P" for a
  15770. P-frame, "B" for a B-frame, or "?" for an unknown type).
  15771. Also refer to the documentation of the @code{AVPictureType} enum and of
  15772. the @code{av_get_picture_type_char} function defined in
  15773. @file{libavutil/avutil.h}.
  15774. @item checksum
  15775. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  15776. @item plane_checksum
  15777. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  15778. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  15779. @item mean
  15780. The mean value of pixels in each plane of the input frame, expressed in the form
  15781. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  15782. @item stdev
  15783. The standard deviation of pixel values in each plane of the input frame, expressed
  15784. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  15785. @end table
  15786. @section showpalette
  15787. Displays the 256 colors palette of each frame. This filter is only relevant for
  15788. @var{pal8} pixel format frames.
  15789. It accepts the following option:
  15790. @table @option
  15791. @item s
  15792. Set the size of the box used to represent one palette color entry. Default is
  15793. @code{30} (for a @code{30x30} pixel box).
  15794. @end table
  15795. @section shuffleframes
  15796. Reorder and/or duplicate and/or drop video frames.
  15797. It accepts the following parameters:
  15798. @table @option
  15799. @item mapping
  15800. Set the destination indexes of input frames.
  15801. This is space or '|' separated list of indexes that maps input frames to output
  15802. frames. Number of indexes also sets maximal value that each index may have.
  15803. '-1' index have special meaning and that is to drop frame.
  15804. @end table
  15805. The first frame has the index 0. The default is to keep the input unchanged.
  15806. @subsection Examples
  15807. @itemize
  15808. @item
  15809. Swap second and third frame of every three frames of the input:
  15810. @example
  15811. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  15812. @end example
  15813. @item
  15814. Swap 10th and 1st frame of every ten frames of the input:
  15815. @example
  15816. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  15817. @end example
  15818. @end itemize
  15819. @section shufflepixels
  15820. Reorder pixels in video frames.
  15821. This filter accepts the following options:
  15822. @table @option
  15823. @item direction, d
  15824. Set shuffle direction. Can be forward or inverse direction.
  15825. Default direction is forward.
  15826. @item mode, m
  15827. Set shuffle mode. Can be horizontal, vertical or block mode.
  15828. @item width, w
  15829. @item height, h
  15830. Set shuffle block_size. In case of horizontal shuffle mode only width
  15831. part of size is used, and in case of vertical shuffle mode only height
  15832. part of size is used.
  15833. @item seed, s
  15834. Set random seed used with shuffling pixels. Mainly useful to set to be able
  15835. to reverse filtering process to get original input.
  15836. For example, to reverse forward shuffle you need to use same parameters
  15837. and exact same seed and to set direction to inverse.
  15838. @end table
  15839. @section shuffleplanes
  15840. Reorder and/or duplicate video planes.
  15841. It accepts the following parameters:
  15842. @table @option
  15843. @item map0
  15844. The index of the input plane to be used as the first output plane.
  15845. @item map1
  15846. The index of the input plane to be used as the second output plane.
  15847. @item map2
  15848. The index of the input plane to be used as the third output plane.
  15849. @item map3
  15850. The index of the input plane to be used as the fourth output plane.
  15851. @end table
  15852. The first plane has the index 0. The default is to keep the input unchanged.
  15853. @subsection Examples
  15854. @itemize
  15855. @item
  15856. Swap the second and third planes of the input:
  15857. @example
  15858. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  15859. @end example
  15860. @end itemize
  15861. @anchor{signalstats}
  15862. @section signalstats
  15863. Evaluate various visual metrics that assist in determining issues associated
  15864. with the digitization of analog video media.
  15865. By default the filter will log these metadata values:
  15866. @table @option
  15867. @item YMIN
  15868. Display the minimal Y value contained within the input frame. Expressed in
  15869. range of [0-255].
  15870. @item YLOW
  15871. Display the Y value at the 10% percentile within the input frame. Expressed in
  15872. range of [0-255].
  15873. @item YAVG
  15874. Display the average Y value within the input frame. Expressed in range of
  15875. [0-255].
  15876. @item YHIGH
  15877. Display the Y value at the 90% percentile within the input frame. Expressed in
  15878. range of [0-255].
  15879. @item YMAX
  15880. Display the maximum Y value contained within the input frame. Expressed in
  15881. range of [0-255].
  15882. @item UMIN
  15883. Display the minimal U value contained within the input frame. Expressed in
  15884. range of [0-255].
  15885. @item ULOW
  15886. Display the U value at the 10% percentile within the input frame. Expressed in
  15887. range of [0-255].
  15888. @item UAVG
  15889. Display the average U value within the input frame. Expressed in range of
  15890. [0-255].
  15891. @item UHIGH
  15892. Display the U value at the 90% percentile within the input frame. Expressed in
  15893. range of [0-255].
  15894. @item UMAX
  15895. Display the maximum U value contained within the input frame. Expressed in
  15896. range of [0-255].
  15897. @item VMIN
  15898. Display the minimal V value contained within the input frame. Expressed in
  15899. range of [0-255].
  15900. @item VLOW
  15901. Display the V value at the 10% percentile within the input frame. Expressed in
  15902. range of [0-255].
  15903. @item VAVG
  15904. Display the average V value within the input frame. Expressed in range of
  15905. [0-255].
  15906. @item VHIGH
  15907. Display the V value at the 90% percentile within the input frame. Expressed in
  15908. range of [0-255].
  15909. @item VMAX
  15910. Display the maximum V value contained within the input frame. Expressed in
  15911. range of [0-255].
  15912. @item SATMIN
  15913. Display the minimal saturation value contained within the input frame.
  15914. Expressed in range of [0-~181.02].
  15915. @item SATLOW
  15916. Display the saturation value at the 10% percentile within the input frame.
  15917. Expressed in range of [0-~181.02].
  15918. @item SATAVG
  15919. Display the average saturation value within the input frame. Expressed in range
  15920. of [0-~181.02].
  15921. @item SATHIGH
  15922. Display the saturation value at the 90% percentile within the input frame.
  15923. Expressed in range of [0-~181.02].
  15924. @item SATMAX
  15925. Display the maximum saturation value contained within the input frame.
  15926. Expressed in range of [0-~181.02].
  15927. @item HUEMED
  15928. Display the median value for hue within the input frame. Expressed in range of
  15929. [0-360].
  15930. @item HUEAVG
  15931. Display the average value for hue within the input frame. Expressed in range of
  15932. [0-360].
  15933. @item YDIF
  15934. Display the average of sample value difference between all values of the Y
  15935. plane in the current frame and corresponding values of the previous input frame.
  15936. Expressed in range of [0-255].
  15937. @item UDIF
  15938. Display the average of sample value difference between all values of the U
  15939. plane in the current frame and corresponding values of the previous input frame.
  15940. Expressed in range of [0-255].
  15941. @item VDIF
  15942. Display the average of sample value difference between all values of the V
  15943. plane in the current frame and corresponding values of the previous input frame.
  15944. Expressed in range of [0-255].
  15945. @item YBITDEPTH
  15946. Display bit depth of Y plane in current frame.
  15947. Expressed in range of [0-16].
  15948. @item UBITDEPTH
  15949. Display bit depth of U plane in current frame.
  15950. Expressed in range of [0-16].
  15951. @item VBITDEPTH
  15952. Display bit depth of V plane in current frame.
  15953. Expressed in range of [0-16].
  15954. @end table
  15955. The filter accepts the following options:
  15956. @table @option
  15957. @item stat
  15958. @item out
  15959. @option{stat} specify an additional form of image analysis.
  15960. @option{out} output video with the specified type of pixel highlighted.
  15961. Both options accept the following values:
  15962. @table @samp
  15963. @item tout
  15964. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  15965. unlike the neighboring pixels of the same field. Examples of temporal outliers
  15966. include the results of video dropouts, head clogs, or tape tracking issues.
  15967. @item vrep
  15968. Identify @var{vertical line repetition}. Vertical line repetition includes
  15969. similar rows of pixels within a frame. In born-digital video vertical line
  15970. repetition is common, but this pattern is uncommon in video digitized from an
  15971. analog source. When it occurs in video that results from the digitization of an
  15972. analog source it can indicate concealment from a dropout compensator.
  15973. @item brng
  15974. Identify pixels that fall outside of legal broadcast range.
  15975. @end table
  15976. @item color, c
  15977. Set the highlight color for the @option{out} option. The default color is
  15978. yellow.
  15979. @end table
  15980. @subsection Examples
  15981. @itemize
  15982. @item
  15983. Output data of various video metrics:
  15984. @example
  15985. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  15986. @end example
  15987. @item
  15988. Output specific data about the minimum and maximum values of the Y plane per frame:
  15989. @example
  15990. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  15991. @end example
  15992. @item
  15993. Playback video while highlighting pixels that are outside of broadcast range in red.
  15994. @example
  15995. ffplay example.mov -vf signalstats="out=brng:color=red"
  15996. @end example
  15997. @item
  15998. Playback video with signalstats metadata drawn over the frame.
  15999. @example
  16000. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  16001. @end example
  16002. The contents of signalstat_drawtext.txt used in the command are:
  16003. @example
  16004. time %@{pts:hms@}
  16005. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  16006. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  16007. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  16008. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  16009. @end example
  16010. @end itemize
  16011. @anchor{signature}
  16012. @section signature
  16013. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  16014. input. In this case the matching between the inputs can be calculated additionally.
  16015. The filter always passes through the first input. The signature of each stream can
  16016. be written into a file.
  16017. It accepts the following options:
  16018. @table @option
  16019. @item detectmode
  16020. Enable or disable the matching process.
  16021. Available values are:
  16022. @table @samp
  16023. @item off
  16024. Disable the calculation of a matching (default).
  16025. @item full
  16026. Calculate the matching for the whole video and output whether the whole video
  16027. matches or only parts.
  16028. @item fast
  16029. Calculate only until a matching is found or the video ends. Should be faster in
  16030. some cases.
  16031. @end table
  16032. @item nb_inputs
  16033. Set the number of inputs. The option value must be a non negative integer.
  16034. Default value is 1.
  16035. @item filename
  16036. Set the path to which the output is written. If there is more than one input,
  16037. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  16038. integer), that will be replaced with the input number. If no filename is
  16039. specified, no output will be written. This is the default.
  16040. @item format
  16041. Choose the output format.
  16042. Available values are:
  16043. @table @samp
  16044. @item binary
  16045. Use the specified binary representation (default).
  16046. @item xml
  16047. Use the specified xml representation.
  16048. @end table
  16049. @item th_d
  16050. Set threshold to detect one word as similar. The option value must be an integer
  16051. greater than zero. The default value is 9000.
  16052. @item th_dc
  16053. Set threshold to detect all words as similar. The option value must be an integer
  16054. greater than zero. The default value is 60000.
  16055. @item th_xh
  16056. Set threshold to detect frames as similar. The option value must be an integer
  16057. greater than zero. The default value is 116.
  16058. @item th_di
  16059. Set the minimum length of a sequence in frames to recognize it as matching
  16060. sequence. The option value must be a non negative integer value.
  16061. The default value is 0.
  16062. @item th_it
  16063. Set the minimum relation, that matching frames to all frames must have.
  16064. The option value must be a double value between 0 and 1. The default value is 0.5.
  16065. @end table
  16066. @subsection Examples
  16067. @itemize
  16068. @item
  16069. To calculate the signature of an input video and store it in signature.bin:
  16070. @example
  16071. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  16072. @end example
  16073. @item
  16074. To detect whether two videos match and store the signatures in XML format in
  16075. signature0.xml and signature1.xml:
  16076. @example
  16077. 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 -
  16078. @end example
  16079. @end itemize
  16080. @anchor{siti}
  16081. @section siti
  16082. Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as defined
  16083. in ITU-T P.910: Subjective video quality assessment methods for multimedia
  16084. applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
  16085. It accepts the following option:
  16086. @table @option
  16087. @item print_summary
  16088. If set to 1, Summary statistics will be printed to the console. Default 0.
  16089. @end table
  16090. @subsection Examples
  16091. @itemize
  16092. @item
  16093. To calculate SI/TI metrics and print summary:
  16094. @example
  16095. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  16096. @end example
  16097. @end itemize
  16098. @anchor{smartblur}
  16099. @section smartblur
  16100. Blur the input video without impacting the outlines.
  16101. It accepts the following options:
  16102. @table @option
  16103. @item luma_radius, lr
  16104. Set the luma radius. The option value must be a float number in
  16105. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16106. used to blur the image (slower if larger). Default value is 1.0.
  16107. @item luma_strength, ls
  16108. Set the luma strength. The option value must be a float number
  16109. in the range [-1.0,1.0] that configures the blurring. A value included
  16110. in [0.0,1.0] will blur the image whereas a value included in
  16111. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  16112. @item luma_threshold, lt
  16113. Set the luma threshold used as a coefficient to determine
  16114. whether a pixel should be blurred or not. The option value must be an
  16115. integer in the range [-30,30]. A value of 0 will filter all the image,
  16116. a value included in [0,30] will filter flat areas and a value included
  16117. in [-30,0] will filter edges. Default value is 0.
  16118. @item chroma_radius, cr
  16119. Set the chroma radius. The option value must be a float number in
  16120. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16121. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  16122. @item chroma_strength, cs
  16123. Set the chroma strength. The option value must be a float number
  16124. in the range [-1.0,1.0] that configures the blurring. A value included
  16125. in [0.0,1.0] will blur the image whereas a value included in
  16126. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  16127. @item chroma_threshold, ct
  16128. Set the chroma threshold used as a coefficient to determine
  16129. whether a pixel should be blurred or not. The option value must be an
  16130. integer in the range [-30,30]. A value of 0 will filter all the image,
  16131. a value included in [0,30] will filter flat areas and a value included
  16132. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  16133. @end table
  16134. If a chroma option is not explicitly set, the corresponding luma value
  16135. is set.
  16136. @section sobel
  16137. Apply sobel operator to input video stream.
  16138. The filter accepts the following option:
  16139. @table @option
  16140. @item planes
  16141. Set which planes will be processed, unprocessed planes will be copied.
  16142. By default value 0xf, all planes will be processed.
  16143. @item scale
  16144. Set value which will be multiplied with filtered result.
  16145. @item delta
  16146. Set value which will be added to filtered result.
  16147. @end table
  16148. @subsection Commands
  16149. This filter supports the all above options as @ref{commands}.
  16150. @anchor{spp}
  16151. @section spp
  16152. Apply a simple postprocessing filter that compresses and decompresses the image
  16153. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  16154. and average the results.
  16155. The filter accepts the following options:
  16156. @table @option
  16157. @item quality
  16158. Set quality. This option defines the number of levels for averaging. It accepts
  16159. an integer in the range 0-6. If set to @code{0}, the filter will have no
  16160. effect. A value of @code{6} means the higher quality. For each increment of
  16161. that value the speed drops by a factor of approximately 2. Default value is
  16162. @code{3}.
  16163. @item qp
  16164. Force a constant quantization parameter. If not set, the filter will use the QP
  16165. from the video stream (if available).
  16166. @item mode
  16167. Set thresholding mode. Available modes are:
  16168. @table @samp
  16169. @item hard
  16170. Set hard thresholding (default).
  16171. @item soft
  16172. Set soft thresholding (better de-ringing effect, but likely blurrier).
  16173. @end table
  16174. @item use_bframe_qp
  16175. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  16176. option may cause flicker since the B-Frames have often larger QP. Default is
  16177. @code{0} (not enabled).
  16178. @end table
  16179. @subsection Commands
  16180. This filter supports the following commands:
  16181. @table @option
  16182. @item quality, level
  16183. Set quality level. The value @code{max} can be used to set the maximum level,
  16184. currently @code{6}.
  16185. @end table
  16186. @anchor{sr}
  16187. @section sr
  16188. Scale the input by applying one of the super-resolution methods based on
  16189. convolutional neural networks. Supported models:
  16190. @itemize
  16191. @item
  16192. Super-Resolution Convolutional Neural Network model (SRCNN).
  16193. See @url{https://arxiv.org/abs/1501.00092}.
  16194. @item
  16195. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  16196. See @url{https://arxiv.org/abs/1609.05158}.
  16197. @end itemize
  16198. Training scripts as well as scripts for model file (.pb) saving can be found at
  16199. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  16200. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  16201. Native model files (.model) can be generated from TensorFlow model
  16202. files (.pb) by using tools/python/convert.py
  16203. The filter accepts the following options:
  16204. @table @option
  16205. @item dnn_backend
  16206. Specify which DNN backend to use for model loading and execution. This option accepts
  16207. the following values:
  16208. @table @samp
  16209. @item native
  16210. Native implementation of DNN loading and execution.
  16211. @item tensorflow
  16212. TensorFlow backend. To enable this backend you
  16213. need to install the TensorFlow for C library (see
  16214. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  16215. @code{--enable-libtensorflow}
  16216. @end table
  16217. Default value is @samp{native}.
  16218. @item model
  16219. Set path to model file specifying network architecture and its parameters.
  16220. Note that different backends use different file formats. TensorFlow backend
  16221. can load files for both formats, while native backend can load files for only
  16222. its format.
  16223. @item scale_factor
  16224. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  16225. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  16226. input upscaled using bicubic upscaling with proper scale factor.
  16227. @end table
  16228. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  16229. @section ssim
  16230. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  16231. This filter takes in input two input videos, the first input is
  16232. considered the "main" source and is passed unchanged to the
  16233. output. The second input is used as a "reference" video for computing
  16234. the SSIM.
  16235. Both video inputs must have the same resolution and pixel format for
  16236. this filter to work correctly. Also it assumes that both inputs
  16237. have the same number of frames, which are compared one by one.
  16238. The filter stores the calculated SSIM of each frame.
  16239. The description of the accepted parameters follows.
  16240. @table @option
  16241. @item stats_file, f
  16242. If specified the filter will use the named file to save the SSIM of
  16243. each individual frame. When filename equals "-" the data is sent to
  16244. standard output.
  16245. @end table
  16246. The file printed if @var{stats_file} is selected, contains a sequence of
  16247. key/value pairs of the form @var{key}:@var{value} for each compared
  16248. couple of frames.
  16249. A description of each shown parameter follows:
  16250. @table @option
  16251. @item n
  16252. sequential number of the input frame, starting from 1
  16253. @item Y, U, V, R, G, B
  16254. SSIM of the compared frames for the component specified by the suffix.
  16255. @item All
  16256. SSIM of the compared frames for the whole frame.
  16257. @item dB
  16258. Same as above but in dB representation.
  16259. @end table
  16260. This filter also supports the @ref{framesync} options.
  16261. @subsection Examples
  16262. @itemize
  16263. @item
  16264. For example:
  16265. @example
  16266. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  16267. [main][ref] ssim="stats_file=stats.log" [out]
  16268. @end example
  16269. On this example the input file being processed is compared with the
  16270. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  16271. is stored in @file{stats.log}.
  16272. @item
  16273. Another example with both psnr and ssim at same time:
  16274. @example
  16275. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  16276. @end example
  16277. @item
  16278. Another example with different containers:
  16279. @example
  16280. 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 -
  16281. @end example
  16282. @end itemize
  16283. @section stereo3d
  16284. Convert between different stereoscopic image formats.
  16285. The filters accept the following options:
  16286. @table @option
  16287. @item in
  16288. Set stereoscopic image format of input.
  16289. Available values for input image formats are:
  16290. @table @samp
  16291. @item sbsl
  16292. side by side parallel (left eye left, right eye right)
  16293. @item sbsr
  16294. side by side crosseye (right eye left, left eye right)
  16295. @item sbs2l
  16296. side by side parallel with half width resolution
  16297. (left eye left, right eye right)
  16298. @item sbs2r
  16299. side by side crosseye with half width resolution
  16300. (right eye left, left eye right)
  16301. @item abl
  16302. @item tbl
  16303. above-below (left eye above, right eye below)
  16304. @item abr
  16305. @item tbr
  16306. above-below (right eye above, left eye below)
  16307. @item ab2l
  16308. @item tb2l
  16309. above-below with half height resolution
  16310. (left eye above, right eye below)
  16311. @item ab2r
  16312. @item tb2r
  16313. above-below with half height resolution
  16314. (right eye above, left eye below)
  16315. @item al
  16316. alternating frames (left eye first, right eye second)
  16317. @item ar
  16318. alternating frames (right eye first, left eye second)
  16319. @item irl
  16320. interleaved rows (left eye has top row, right eye starts on next row)
  16321. @item irr
  16322. interleaved rows (right eye has top row, left eye starts on next row)
  16323. @item icl
  16324. interleaved columns, left eye first
  16325. @item icr
  16326. interleaved columns, right eye first
  16327. Default value is @samp{sbsl}.
  16328. @end table
  16329. @item out
  16330. Set stereoscopic image format of output.
  16331. @table @samp
  16332. @item sbsl
  16333. side by side parallel (left eye left, right eye right)
  16334. @item sbsr
  16335. side by side crosseye (right eye left, left eye right)
  16336. @item sbs2l
  16337. side by side parallel with half width resolution
  16338. (left eye left, right eye right)
  16339. @item sbs2r
  16340. side by side crosseye with half width resolution
  16341. (right eye left, left eye right)
  16342. @item abl
  16343. @item tbl
  16344. above-below (left eye above, right eye below)
  16345. @item abr
  16346. @item tbr
  16347. above-below (right eye above, left eye below)
  16348. @item ab2l
  16349. @item tb2l
  16350. above-below with half height resolution
  16351. (left eye above, right eye below)
  16352. @item ab2r
  16353. @item tb2r
  16354. above-below with half height resolution
  16355. (right eye above, left eye below)
  16356. @item al
  16357. alternating frames (left eye first, right eye second)
  16358. @item ar
  16359. alternating frames (right eye first, left eye second)
  16360. @item irl
  16361. interleaved rows (left eye has top row, right eye starts on next row)
  16362. @item irr
  16363. interleaved rows (right eye has top row, left eye starts on next row)
  16364. @item arbg
  16365. anaglyph red/blue gray
  16366. (red filter on left eye, blue filter on right eye)
  16367. @item argg
  16368. anaglyph red/green gray
  16369. (red filter on left eye, green filter on right eye)
  16370. @item arcg
  16371. anaglyph red/cyan gray
  16372. (red filter on left eye, cyan filter on right eye)
  16373. @item arch
  16374. anaglyph red/cyan half colored
  16375. (red filter on left eye, cyan filter on right eye)
  16376. @item arcc
  16377. anaglyph red/cyan color
  16378. (red filter on left eye, cyan filter on right eye)
  16379. @item arcd
  16380. anaglyph red/cyan color optimized with the least squares projection of dubois
  16381. (red filter on left eye, cyan filter on right eye)
  16382. @item agmg
  16383. anaglyph green/magenta gray
  16384. (green filter on left eye, magenta filter on right eye)
  16385. @item agmh
  16386. anaglyph green/magenta half colored
  16387. (green filter on left eye, magenta filter on right eye)
  16388. @item agmc
  16389. anaglyph green/magenta colored
  16390. (green filter on left eye, magenta filter on right eye)
  16391. @item agmd
  16392. anaglyph green/magenta color optimized with the least squares projection of dubois
  16393. (green filter on left eye, magenta filter on right eye)
  16394. @item aybg
  16395. anaglyph yellow/blue gray
  16396. (yellow filter on left eye, blue filter on right eye)
  16397. @item aybh
  16398. anaglyph yellow/blue half colored
  16399. (yellow filter on left eye, blue filter on right eye)
  16400. @item aybc
  16401. anaglyph yellow/blue colored
  16402. (yellow filter on left eye, blue filter on right eye)
  16403. @item aybd
  16404. anaglyph yellow/blue color optimized with the least squares projection of dubois
  16405. (yellow filter on left eye, blue filter on right eye)
  16406. @item ml
  16407. mono output (left eye only)
  16408. @item mr
  16409. mono output (right eye only)
  16410. @item chl
  16411. checkerboard, left eye first
  16412. @item chr
  16413. checkerboard, right eye first
  16414. @item icl
  16415. interleaved columns, left eye first
  16416. @item icr
  16417. interleaved columns, right eye first
  16418. @item hdmi
  16419. HDMI frame pack
  16420. @end table
  16421. Default value is @samp{arcd}.
  16422. @end table
  16423. @subsection Examples
  16424. @itemize
  16425. @item
  16426. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  16427. @example
  16428. stereo3d=sbsl:aybd
  16429. @end example
  16430. @item
  16431. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  16432. @example
  16433. stereo3d=abl:sbsr
  16434. @end example
  16435. @end itemize
  16436. @section streamselect, astreamselect
  16437. Select video or audio streams.
  16438. The filter accepts the following options:
  16439. @table @option
  16440. @item inputs
  16441. Set number of inputs. Default is 2.
  16442. @item map
  16443. Set input indexes to remap to outputs.
  16444. @end table
  16445. @subsection Commands
  16446. The @code{streamselect} and @code{astreamselect} filter supports the following
  16447. commands:
  16448. @table @option
  16449. @item map
  16450. Set input indexes to remap to outputs.
  16451. @end table
  16452. @subsection Examples
  16453. @itemize
  16454. @item
  16455. Select first 5 seconds 1st stream and rest of time 2nd stream:
  16456. @example
  16457. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  16458. @end example
  16459. @item
  16460. Same as above, but for audio:
  16461. @example
  16462. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  16463. @end example
  16464. @end itemize
  16465. @anchor{subtitles}
  16466. @section subtitles
  16467. Draw subtitles on top of input video using the libass library.
  16468. To enable compilation of this filter you need to configure FFmpeg with
  16469. @code{--enable-libass}. This filter also requires a build with libavcodec and
  16470. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  16471. Alpha) subtitles format.
  16472. The filter accepts the following options:
  16473. @table @option
  16474. @item filename, f
  16475. Set the filename of the subtitle file to read. It must be specified.
  16476. @item original_size
  16477. Specify the size of the original video, the video for which the ASS file
  16478. was composed. For the syntax of this option, check the
  16479. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16480. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  16481. correctly scale the fonts if the aspect ratio has been changed.
  16482. @item fontsdir
  16483. Set a directory path containing fonts that can be used by the filter.
  16484. These fonts will be used in addition to whatever the font provider uses.
  16485. @item alpha
  16486. Process alpha channel, by default alpha channel is untouched.
  16487. @item charenc
  16488. Set subtitles input character encoding. @code{subtitles} filter only. Only
  16489. useful if not UTF-8.
  16490. @item stream_index, si
  16491. Set subtitles stream index. @code{subtitles} filter only.
  16492. @item force_style
  16493. Override default style or script info parameters of the subtitles. It accepts a
  16494. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  16495. @end table
  16496. If the first key is not specified, it is assumed that the first value
  16497. specifies the @option{filename}.
  16498. For example, to render the file @file{sub.srt} on top of the input
  16499. video, use the command:
  16500. @example
  16501. subtitles=sub.srt
  16502. @end example
  16503. which is equivalent to:
  16504. @example
  16505. subtitles=filename=sub.srt
  16506. @end example
  16507. To render the default subtitles stream from file @file{video.mkv}, use:
  16508. @example
  16509. subtitles=video.mkv
  16510. @end example
  16511. To render the second subtitles stream from that file, use:
  16512. @example
  16513. subtitles=video.mkv:si=1
  16514. @end example
  16515. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  16516. @code{DejaVu Serif}, use:
  16517. @example
  16518. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  16519. @end example
  16520. @section super2xsai
  16521. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  16522. Interpolate) pixel art scaling algorithm.
  16523. Useful for enlarging pixel art images without reducing sharpness.
  16524. @section swaprect
  16525. Swap two rectangular objects in video.
  16526. This filter accepts the following options:
  16527. @table @option
  16528. @item w
  16529. Set object width.
  16530. @item h
  16531. Set object height.
  16532. @item x1
  16533. Set 1st rect x coordinate.
  16534. @item y1
  16535. Set 1st rect y coordinate.
  16536. @item x2
  16537. Set 2nd rect x coordinate.
  16538. @item y2
  16539. Set 2nd rect y coordinate.
  16540. All expressions are evaluated once for each frame.
  16541. @end table
  16542. The all options are expressions containing the following constants:
  16543. @table @option
  16544. @item w
  16545. @item h
  16546. The input width and height.
  16547. @item a
  16548. same as @var{w} / @var{h}
  16549. @item sar
  16550. input sample aspect ratio
  16551. @item dar
  16552. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  16553. @item n
  16554. The number of the input frame, starting from 0.
  16555. @item t
  16556. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16557. @item pos
  16558. the position in the file of the input frame, NAN if unknown
  16559. @end table
  16560. @subsection Commands
  16561. This filter supports the all above options as @ref{commands}.
  16562. @section swapuv
  16563. Swap U & V plane.
  16564. @section tblend
  16565. Blend successive video frames.
  16566. See @ref{blend}
  16567. @section telecine
  16568. Apply telecine process to the video.
  16569. This filter accepts the following options:
  16570. @table @option
  16571. @item first_field
  16572. @table @samp
  16573. @item top, t
  16574. top field first
  16575. @item bottom, b
  16576. bottom field first
  16577. The default value is @code{top}.
  16578. @end table
  16579. @item pattern
  16580. A string of numbers representing the pulldown pattern you wish to apply.
  16581. The default value is @code{23}.
  16582. @end table
  16583. @example
  16584. Some typical patterns:
  16585. NTSC output (30i):
  16586. 27.5p: 32222
  16587. 24p: 23 (classic)
  16588. 24p: 2332 (preferred)
  16589. 20p: 33
  16590. 18p: 334
  16591. 16p: 3444
  16592. PAL output (25i):
  16593. 27.5p: 12222
  16594. 24p: 222222222223 ("Euro pulldown")
  16595. 16.67p: 33
  16596. 16p: 33333334
  16597. @end example
  16598. @section thistogram
  16599. Compute and draw a color distribution histogram for the input video across time.
  16600. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  16601. at certain time, this filter shows also past histograms of number of frames defined
  16602. by @code{width} option.
  16603. The computed histogram is a representation of the color component
  16604. distribution in an image.
  16605. The filter accepts the following options:
  16606. @table @option
  16607. @item width, w
  16608. Set width of single color component output. Default value is @code{0}.
  16609. Value of @code{0} means width will be picked from input video.
  16610. This also set number of passed histograms to keep.
  16611. Allowed range is [0, 8192].
  16612. @item display_mode, d
  16613. Set display mode.
  16614. It accepts the following values:
  16615. @table @samp
  16616. @item stack
  16617. Per color component graphs are placed below each other.
  16618. @item parade
  16619. Per color component graphs are placed side by side.
  16620. @item overlay
  16621. Presents information identical to that in the @code{parade}, except
  16622. that the graphs representing color components are superimposed directly
  16623. over one another.
  16624. @end table
  16625. Default is @code{stack}.
  16626. @item levels_mode, m
  16627. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  16628. Default is @code{linear}.
  16629. @item components, c
  16630. Set what color components to display.
  16631. Default is @code{7}.
  16632. @item bgopacity, b
  16633. Set background opacity. Default is @code{0.9}.
  16634. @item envelope, e
  16635. Show envelope. Default is disabled.
  16636. @item ecolor, ec
  16637. Set envelope color. Default is @code{gold}.
  16638. @item slide
  16639. Set slide mode.
  16640. Available values for slide is:
  16641. @table @samp
  16642. @item frame
  16643. Draw new frame when right border is reached.
  16644. @item replace
  16645. Replace old columns with new ones.
  16646. @item scroll
  16647. Scroll from right to left.
  16648. @item rscroll
  16649. Scroll from left to right.
  16650. @item picture
  16651. Draw single picture.
  16652. @end table
  16653. Default is @code{replace}.
  16654. @end table
  16655. @section threshold
  16656. Apply threshold effect to video stream.
  16657. This filter needs four video streams to perform thresholding.
  16658. First stream is stream we are filtering.
  16659. Second stream is holding threshold values, third stream is holding min values,
  16660. and last, fourth stream is holding max values.
  16661. The filter accepts the following option:
  16662. @table @option
  16663. @item planes
  16664. Set which planes will be processed, unprocessed planes will be copied.
  16665. By default value 0xf, all planes will be processed.
  16666. @end table
  16667. For example if first stream pixel's component value is less then threshold value
  16668. of pixel component from 2nd threshold stream, third stream value will picked,
  16669. otherwise fourth stream pixel component value will be picked.
  16670. Using color source filter one can perform various types of thresholding:
  16671. @subsection Commands
  16672. This filter supports the all options as @ref{commands}.
  16673. @subsection Examples
  16674. @itemize
  16675. @item
  16676. Binary threshold, using gray color as threshold:
  16677. @example
  16678. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  16679. @end example
  16680. @item
  16681. Inverted binary threshold, using gray color as threshold:
  16682. @example
  16683. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  16684. @end example
  16685. @item
  16686. Truncate binary threshold, using gray color as threshold:
  16687. @example
  16688. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  16689. @end example
  16690. @item
  16691. Threshold to zero, using gray color as threshold:
  16692. @example
  16693. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  16694. @end example
  16695. @item
  16696. Inverted threshold to zero, using gray color as threshold:
  16697. @example
  16698. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  16699. @end example
  16700. @end itemize
  16701. @section thumbnail
  16702. Select the most representative frame in a given sequence of consecutive frames.
  16703. The filter accepts the following options:
  16704. @table @option
  16705. @item n
  16706. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  16707. will pick one of them, and then handle the next batch of @var{n} frames until
  16708. the end. Default is @code{100}.
  16709. @end table
  16710. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  16711. value will result in a higher memory usage, so a high value is not recommended.
  16712. @subsection Examples
  16713. @itemize
  16714. @item
  16715. Extract one picture each 50 frames:
  16716. @example
  16717. thumbnail=50
  16718. @end example
  16719. @item
  16720. Complete example of a thumbnail creation with @command{ffmpeg}:
  16721. @example
  16722. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  16723. @end example
  16724. @end itemize
  16725. @anchor{tile}
  16726. @section tile
  16727. Tile several successive frames together.
  16728. The @ref{untile} filter can do the reverse.
  16729. The filter accepts the following options:
  16730. @table @option
  16731. @item layout
  16732. Set the grid size in the form @code{COLUMNSxROWS}. Range is upto UINT_MAX cells.
  16733. Default is @code{6x5}.
  16734. @item nb_frames
  16735. Set the maximum number of frames to render in the given area. It must be less
  16736. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  16737. the area will be used.
  16738. @item margin
  16739. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  16740. @item padding
  16741. Set the inner border thickness (i.e. the number of pixels between frames). For
  16742. more advanced padding options (such as having different values for the edges),
  16743. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  16744. @item color
  16745. Specify the color of the unused area. For the syntax of this option, check the
  16746. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16747. The default value of @var{color} is "black".
  16748. @item overlap
  16749. Set the number of frames to overlap when tiling several successive frames together.
  16750. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  16751. @item init_padding
  16752. Set the number of frames to initially be empty before displaying first output frame.
  16753. This controls how soon will one get first output frame.
  16754. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  16755. @end table
  16756. @subsection Examples
  16757. @itemize
  16758. @item
  16759. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  16760. @example
  16761. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  16762. @end example
  16763. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  16764. duplicating each output frame to accommodate the originally detected frame
  16765. rate.
  16766. @item
  16767. Display @code{5} pictures in an area of @code{3x2} frames,
  16768. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  16769. mixed flat and named options:
  16770. @example
  16771. tile=3x2:nb_frames=5:padding=7:margin=2
  16772. @end example
  16773. @end itemize
  16774. @section tinterlace
  16775. Perform various types of temporal field interlacing.
  16776. Frames are counted starting from 1, so the first input frame is
  16777. considered odd.
  16778. The filter accepts the following options:
  16779. @table @option
  16780. @item mode
  16781. Specify the mode of the interlacing. This option can also be specified
  16782. as a value alone. See below for a list of values for this option.
  16783. Available values are:
  16784. @table @samp
  16785. @item merge, 0
  16786. Move odd frames into the upper field, even into the lower field,
  16787. generating a double height frame at half frame rate.
  16788. @example
  16789. ------> time
  16790. Input:
  16791. Frame 1 Frame 2 Frame 3 Frame 4
  16792. 11111 22222 33333 44444
  16793. 11111 22222 33333 44444
  16794. 11111 22222 33333 44444
  16795. 11111 22222 33333 44444
  16796. Output:
  16797. 11111 33333
  16798. 22222 44444
  16799. 11111 33333
  16800. 22222 44444
  16801. 11111 33333
  16802. 22222 44444
  16803. 11111 33333
  16804. 22222 44444
  16805. @end example
  16806. @item drop_even, 1
  16807. Only output odd frames, even frames are dropped, generating a frame with
  16808. unchanged height at half frame rate.
  16809. @example
  16810. ------> time
  16811. Input:
  16812. Frame 1 Frame 2 Frame 3 Frame 4
  16813. 11111 22222 33333 44444
  16814. 11111 22222 33333 44444
  16815. 11111 22222 33333 44444
  16816. 11111 22222 33333 44444
  16817. Output:
  16818. 11111 33333
  16819. 11111 33333
  16820. 11111 33333
  16821. 11111 33333
  16822. @end example
  16823. @item drop_odd, 2
  16824. Only output even frames, odd frames are dropped, generating a frame with
  16825. unchanged height at half frame rate.
  16826. @example
  16827. ------> time
  16828. Input:
  16829. Frame 1 Frame 2 Frame 3 Frame 4
  16830. 11111 22222 33333 44444
  16831. 11111 22222 33333 44444
  16832. 11111 22222 33333 44444
  16833. 11111 22222 33333 44444
  16834. Output:
  16835. 22222 44444
  16836. 22222 44444
  16837. 22222 44444
  16838. 22222 44444
  16839. @end example
  16840. @item pad, 3
  16841. Expand each frame to full height, but pad alternate lines with black,
  16842. generating a frame with double height at the same input frame rate.
  16843. @example
  16844. ------> time
  16845. Input:
  16846. Frame 1 Frame 2 Frame 3 Frame 4
  16847. 11111 22222 33333 44444
  16848. 11111 22222 33333 44444
  16849. 11111 22222 33333 44444
  16850. 11111 22222 33333 44444
  16851. Output:
  16852. 11111 ..... 33333 .....
  16853. ..... 22222 ..... 44444
  16854. 11111 ..... 33333 .....
  16855. ..... 22222 ..... 44444
  16856. 11111 ..... 33333 .....
  16857. ..... 22222 ..... 44444
  16858. 11111 ..... 33333 .....
  16859. ..... 22222 ..... 44444
  16860. @end example
  16861. @item interleave_top, 4
  16862. Interleave the upper field from odd frames with the lower field from
  16863. even frames, generating a frame with unchanged height at half frame rate.
  16864. @example
  16865. ------> time
  16866. Input:
  16867. Frame 1 Frame 2 Frame 3 Frame 4
  16868. 11111<- 22222 33333<- 44444
  16869. 11111 22222<- 33333 44444<-
  16870. 11111<- 22222 33333<- 44444
  16871. 11111 22222<- 33333 44444<-
  16872. Output:
  16873. 11111 33333
  16874. 22222 44444
  16875. 11111 33333
  16876. 22222 44444
  16877. @end example
  16878. @item interleave_bottom, 5
  16879. Interleave the lower field from odd frames with the upper field from
  16880. even frames, generating a frame with unchanged height at half frame rate.
  16881. @example
  16882. ------> time
  16883. Input:
  16884. Frame 1 Frame 2 Frame 3 Frame 4
  16885. 11111 22222<- 33333 44444<-
  16886. 11111<- 22222 33333<- 44444
  16887. 11111 22222<- 33333 44444<-
  16888. 11111<- 22222 33333<- 44444
  16889. Output:
  16890. 22222 44444
  16891. 11111 33333
  16892. 22222 44444
  16893. 11111 33333
  16894. @end example
  16895. @item interlacex2, 6
  16896. Double frame rate with unchanged height. Frames are inserted each
  16897. containing the second temporal field from the previous input frame and
  16898. the first temporal field from the next input frame. This mode relies on
  16899. the top_field_first flag. Useful for interlaced video displays with no
  16900. field synchronisation.
  16901. @example
  16902. ------> time
  16903. Input:
  16904. Frame 1 Frame 2 Frame 3 Frame 4
  16905. 11111 22222 33333 44444
  16906. 11111 22222 33333 44444
  16907. 11111 22222 33333 44444
  16908. 11111 22222 33333 44444
  16909. Output:
  16910. 11111 22222 22222 33333 33333 44444 44444
  16911. 11111 11111 22222 22222 33333 33333 44444
  16912. 11111 22222 22222 33333 33333 44444 44444
  16913. 11111 11111 22222 22222 33333 33333 44444
  16914. @end example
  16915. @item mergex2, 7
  16916. Move odd frames into the upper field, even into the lower field,
  16917. generating a double height frame at same frame rate.
  16918. @example
  16919. ------> time
  16920. Input:
  16921. Frame 1 Frame 2 Frame 3 Frame 4
  16922. 11111 22222 33333 44444
  16923. 11111 22222 33333 44444
  16924. 11111 22222 33333 44444
  16925. 11111 22222 33333 44444
  16926. Output:
  16927. 11111 33333 33333 55555
  16928. 22222 22222 44444 44444
  16929. 11111 33333 33333 55555
  16930. 22222 22222 44444 44444
  16931. 11111 33333 33333 55555
  16932. 22222 22222 44444 44444
  16933. 11111 33333 33333 55555
  16934. 22222 22222 44444 44444
  16935. @end example
  16936. @end table
  16937. Numeric values are deprecated but are accepted for backward
  16938. compatibility reasons.
  16939. Default mode is @code{merge}.
  16940. @item flags
  16941. Specify flags influencing the filter process.
  16942. Available value for @var{flags} is:
  16943. @table @option
  16944. @item low_pass_filter, vlpf
  16945. Enable linear vertical low-pass filtering in the filter.
  16946. Vertical low-pass filtering is required when creating an interlaced
  16947. destination from a progressive source which contains high-frequency
  16948. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  16949. patterning.
  16950. @item complex_filter, cvlpf
  16951. Enable complex vertical low-pass filtering.
  16952. This will slightly less reduce interlace 'twitter' and Moire
  16953. patterning but better retain detail and subjective sharpness impression.
  16954. @item bypass_il
  16955. Bypass already interlaced frames, only adjust the frame rate.
  16956. @end table
  16957. Vertical low-pass filtering and bypassing already interlaced frames can only be
  16958. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  16959. @end table
  16960. @section tmedian
  16961. Pick median pixels from several successive input video frames.
  16962. The filter accepts the following options:
  16963. @table @option
  16964. @item radius
  16965. Set radius of median filter.
  16966. Default is 1. Allowed range is from 1 to 127.
  16967. @item planes
  16968. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  16969. @item percentile
  16970. Set median percentile. Default value is @code{0.5}.
  16971. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  16972. minimum values, and @code{1} maximum values.
  16973. @end table
  16974. @subsection Commands
  16975. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  16976. @section tmidequalizer
  16977. Apply Temporal Midway Video Equalization effect.
  16978. Midway Video Equalization adjusts a sequence of video frames to have the same
  16979. histograms, while maintaining their dynamics as much as possible. It's
  16980. useful for e.g. matching exposures from a video frames sequence.
  16981. This filter accepts the following option:
  16982. @table @option
  16983. @item radius
  16984. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  16985. @item sigma
  16986. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  16987. Setting this option to 0 effectively does nothing.
  16988. @item planes
  16989. Set which planes to process. Default is @code{15}, which is all available planes.
  16990. @end table
  16991. @section tmix
  16992. Mix successive video frames.
  16993. A description of the accepted options follows.
  16994. @table @option
  16995. @item frames
  16996. The number of successive frames to mix. If unspecified, it defaults to 3.
  16997. @item weights
  16998. Specify weight of each input video frame.
  16999. Each weight is separated by space. If number of weights is smaller than
  17000. number of @var{frames} last specified weight will be used for all remaining
  17001. unset weights.
  17002. @item scale
  17003. Specify scale, if it is set it will be multiplied with sum
  17004. of each weight multiplied with pixel values to give final destination
  17005. pixel value. By default @var{scale} is auto scaled to sum of weights.
  17006. @item planes
  17007. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  17008. @end table
  17009. @subsection Examples
  17010. @itemize
  17011. @item
  17012. Average 7 successive frames:
  17013. @example
  17014. tmix=frames=7:weights="1 1 1 1 1 1 1"
  17015. @end example
  17016. @item
  17017. Apply simple temporal convolution:
  17018. @example
  17019. tmix=frames=3:weights="-1 3 -1"
  17020. @end example
  17021. @item
  17022. Similar as above but only showing temporal differences:
  17023. @example
  17024. tmix=frames=3:weights="-1 2 -1":scale=1
  17025. @end example
  17026. @end itemize
  17027. @subsection Commands
  17028. This filter supports the following commands:
  17029. @table @option
  17030. @item weights
  17031. @item scale
  17032. @item planes
  17033. Syntax is same as option with same name.
  17034. @end table
  17035. @anchor{tonemap}
  17036. @section tonemap
  17037. Tone map colors from different dynamic ranges.
  17038. This filter expects data in single precision floating point, as it needs to
  17039. operate on (and can output) out-of-range values. Another filter, such as
  17040. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  17041. The tonemapping algorithms implemented only work on linear light, so input
  17042. data should be linearized beforehand (and possibly correctly tagged).
  17043. @example
  17044. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  17045. @end example
  17046. @subsection Options
  17047. The filter accepts the following options.
  17048. @table @option
  17049. @item tonemap
  17050. Set the tone map algorithm to use.
  17051. Possible values are:
  17052. @table @var
  17053. @item none
  17054. Do not apply any tone map, only desaturate overbright pixels.
  17055. @item clip
  17056. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  17057. in-range values, while distorting out-of-range values.
  17058. @item linear
  17059. Stretch the entire reference gamut to a linear multiple of the display.
  17060. @item gamma
  17061. Fit a logarithmic transfer between the tone curves.
  17062. @item reinhard
  17063. Preserve overall image brightness with a simple curve, using nonlinear
  17064. contrast, which results in flattening details and degrading color accuracy.
  17065. @item hable
  17066. Preserve both dark and bright details better than @var{reinhard}, at the cost
  17067. of slightly darkening everything. Use it when detail preservation is more
  17068. important than color and brightness accuracy.
  17069. @item mobius
  17070. Smoothly map out-of-range values, while retaining contrast and colors for
  17071. in-range material as much as possible. Use it when color accuracy is more
  17072. important than detail preservation.
  17073. @end table
  17074. Default is none.
  17075. @item param
  17076. Tune the tone mapping algorithm.
  17077. This affects the following algorithms:
  17078. @table @var
  17079. @item none
  17080. Ignored.
  17081. @item linear
  17082. Specifies the scale factor to use while stretching.
  17083. Default to 1.0.
  17084. @item gamma
  17085. Specifies the exponent of the function.
  17086. Default to 1.8.
  17087. @item clip
  17088. Specify an extra linear coefficient to multiply into the signal before clipping.
  17089. Default to 1.0.
  17090. @item reinhard
  17091. Specify the local contrast coefficient at the display peak.
  17092. Default to 0.5, which means that in-gamut values will be about half as bright
  17093. as when clipping.
  17094. @item hable
  17095. Ignored.
  17096. @item mobius
  17097. Specify the transition point from linear to mobius transform. Every value
  17098. below this point is guaranteed to be mapped 1:1. The higher the value, the
  17099. more accurate the result will be, at the cost of losing bright details.
  17100. Default to 0.3, which due to the steep initial slope still preserves in-range
  17101. colors fairly accurately.
  17102. @end table
  17103. @item desat
  17104. Apply desaturation for highlights that exceed this level of brightness. The
  17105. higher the parameter, the more color information will be preserved. This
  17106. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17107. (smoothly) turning into white instead. This makes images feel more natural,
  17108. at the cost of reducing information about out-of-range colors.
  17109. The default of 2.0 is somewhat conservative and will mostly just apply to
  17110. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  17111. This option works only if the input frame has a supported color tag.
  17112. @item peak
  17113. Override signal/nominal/reference peak with this value. Useful when the
  17114. embedded peak information in display metadata is not reliable or when tone
  17115. mapping from a lower range to a higher range.
  17116. @end table
  17117. @section tpad
  17118. Temporarily pad video frames.
  17119. The filter accepts the following options:
  17120. @table @option
  17121. @item start
  17122. Specify number of delay frames before input video stream. Default is 0.
  17123. @item stop
  17124. Specify number of padding frames after input video stream.
  17125. Set to -1 to pad indefinitely. Default is 0.
  17126. @item start_mode
  17127. Set kind of frames added to beginning of stream.
  17128. Can be either @var{add} or @var{clone}.
  17129. With @var{add} frames of solid-color are added.
  17130. With @var{clone} frames are clones of first frame.
  17131. Default is @var{add}.
  17132. @item stop_mode
  17133. Set kind of frames added to end of stream.
  17134. Can be either @var{add} or @var{clone}.
  17135. With @var{add} frames of solid-color are added.
  17136. With @var{clone} frames are clones of last frame.
  17137. Default is @var{add}.
  17138. @item start_duration, stop_duration
  17139. Specify the duration of the start/stop delay. See
  17140. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17141. for the accepted syntax.
  17142. These options override @var{start} and @var{stop}. Default is 0.
  17143. @item color
  17144. Specify the color of the padded area. For the syntax of this option,
  17145. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17146. manual,ffmpeg-utils}.
  17147. The default value of @var{color} is "black".
  17148. @end table
  17149. @anchor{transpose}
  17150. @section transpose
  17151. Transpose rows with columns in the input video and optionally flip it.
  17152. It accepts the following parameters:
  17153. @table @option
  17154. @item dir
  17155. Specify the transposition direction.
  17156. Can assume the following values:
  17157. @table @samp
  17158. @item 0, 4, cclock_flip
  17159. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  17160. @example
  17161. L.R L.l
  17162. . . -> . .
  17163. l.r R.r
  17164. @end example
  17165. @item 1, 5, clock
  17166. Rotate by 90 degrees clockwise, that is:
  17167. @example
  17168. L.R l.L
  17169. . . -> . .
  17170. l.r r.R
  17171. @end example
  17172. @item 2, 6, cclock
  17173. Rotate by 90 degrees counterclockwise, that is:
  17174. @example
  17175. L.R R.r
  17176. . . -> . .
  17177. l.r L.l
  17178. @end example
  17179. @item 3, 7, clock_flip
  17180. Rotate by 90 degrees clockwise and vertically flip, that is:
  17181. @example
  17182. L.R r.R
  17183. . . -> . .
  17184. l.r l.L
  17185. @end example
  17186. @end table
  17187. For values between 4-7, the transposition is only done if the input
  17188. video geometry is portrait and not landscape. These values are
  17189. deprecated, the @code{passthrough} option should be used instead.
  17190. Numerical values are deprecated, and should be dropped in favor of
  17191. symbolic constants.
  17192. @item passthrough
  17193. Do not apply the transposition if the input geometry matches the one
  17194. specified by the specified value. It accepts the following values:
  17195. @table @samp
  17196. @item none
  17197. Always apply transposition.
  17198. @item portrait
  17199. Preserve portrait geometry (when @var{height} >= @var{width}).
  17200. @item landscape
  17201. Preserve landscape geometry (when @var{width} >= @var{height}).
  17202. @end table
  17203. Default value is @code{none}.
  17204. @end table
  17205. For example to rotate by 90 degrees clockwise and preserve portrait
  17206. layout:
  17207. @example
  17208. transpose=dir=1:passthrough=portrait
  17209. @end example
  17210. The command above can also be specified as:
  17211. @example
  17212. transpose=1:portrait
  17213. @end example
  17214. @section transpose_npp
  17215. Transpose rows with columns in the input video and optionally flip it.
  17216. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  17217. It accepts the following parameters:
  17218. @table @option
  17219. @item dir
  17220. Specify the transposition direction.
  17221. Can assume the following values:
  17222. @table @samp
  17223. @item cclock_flip
  17224. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  17225. @item clock
  17226. Rotate by 90 degrees clockwise.
  17227. @item cclock
  17228. Rotate by 90 degrees counterclockwise.
  17229. @item clock_flip
  17230. Rotate by 90 degrees clockwise and vertically flip.
  17231. @end table
  17232. @item passthrough
  17233. Do not apply the transposition if the input geometry matches the one
  17234. specified by the specified value. It accepts the following values:
  17235. @table @samp
  17236. @item none
  17237. Always apply transposition. (default)
  17238. @item portrait
  17239. Preserve portrait geometry (when @var{height} >= @var{width}).
  17240. @item landscape
  17241. Preserve landscape geometry (when @var{width} >= @var{height}).
  17242. @end table
  17243. @end table
  17244. @section trim
  17245. Trim the input so that the output contains one continuous subpart of the input.
  17246. It accepts the following parameters:
  17247. @table @option
  17248. @item start
  17249. Specify the time of the start of the kept section, i.e. the frame with the
  17250. timestamp @var{start} will be the first frame in the output.
  17251. @item end
  17252. Specify the time of the first frame that will be dropped, i.e. the frame
  17253. immediately preceding the one with the timestamp @var{end} will be the last
  17254. frame in the output.
  17255. @item start_pts
  17256. This is the same as @var{start}, except this option sets the start timestamp
  17257. in timebase units instead of seconds.
  17258. @item end_pts
  17259. This is the same as @var{end}, except this option sets the end timestamp
  17260. in timebase units instead of seconds.
  17261. @item duration
  17262. The maximum duration of the output in seconds.
  17263. @item start_frame
  17264. The number of the first frame that should be passed to the output.
  17265. @item end_frame
  17266. The number of the first frame that should be dropped.
  17267. @end table
  17268. @option{start}, @option{end}, and @option{duration} are expressed as time
  17269. duration specifications; see
  17270. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17271. for the accepted syntax.
  17272. Note that the first two sets of the start/end options and the @option{duration}
  17273. option look at the frame timestamp, while the _frame variants simply count the
  17274. frames that pass through the filter. Also note that this filter does not modify
  17275. the timestamps. If you wish for the output timestamps to start at zero, insert a
  17276. setpts filter after the trim filter.
  17277. If multiple start or end options are set, this filter tries to be greedy and
  17278. keep all the frames that match at least one of the specified constraints. To keep
  17279. only the part that matches all the constraints at once, chain multiple trim
  17280. filters.
  17281. The defaults are such that all the input is kept. So it is possible to set e.g.
  17282. just the end values to keep everything before the specified time.
  17283. Examples:
  17284. @itemize
  17285. @item
  17286. Drop everything except the second minute of input:
  17287. @example
  17288. ffmpeg -i INPUT -vf trim=60:120
  17289. @end example
  17290. @item
  17291. Keep only the first second:
  17292. @example
  17293. ffmpeg -i INPUT -vf trim=duration=1
  17294. @end example
  17295. @end itemize
  17296. @section unpremultiply
  17297. Apply alpha unpremultiply effect to input video stream using first plane
  17298. of second stream as alpha.
  17299. Both streams must have same dimensions and same pixel format.
  17300. The filter accepts the following option:
  17301. @table @option
  17302. @item planes
  17303. Set which planes will be processed, unprocessed planes will be copied.
  17304. By default value 0xf, all planes will be processed.
  17305. If the format has 1 or 2 components, then luma is bit 0.
  17306. If the format has 3 or 4 components:
  17307. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  17308. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  17309. If present, the alpha channel is always the last bit.
  17310. @item inplace
  17311. Do not require 2nd input for processing, instead use alpha plane from input stream.
  17312. @end table
  17313. @anchor{unsharp}
  17314. @section unsharp
  17315. Sharpen or blur the input video.
  17316. It accepts the following parameters:
  17317. @table @option
  17318. @item luma_msize_x, lx
  17319. Set the luma matrix horizontal size. It must be an odd integer between
  17320. 3 and 23. The default value is 5.
  17321. @item luma_msize_y, ly
  17322. Set the luma matrix vertical size. It must be an odd integer between 3
  17323. and 23. The default value is 5.
  17324. @item luma_amount, la
  17325. Set the luma effect strength. It must be a floating point number, reasonable
  17326. values lay between -1.5 and 1.5.
  17327. Negative values will blur the input video, while positive values will
  17328. sharpen it, a value of zero will disable the effect.
  17329. Default value is 1.0.
  17330. @item chroma_msize_x, cx
  17331. Set the chroma matrix horizontal size. It must be an odd integer
  17332. between 3 and 23. The default value is 5.
  17333. @item chroma_msize_y, cy
  17334. Set the chroma matrix vertical size. It must be an odd integer
  17335. between 3 and 23. The default value is 5.
  17336. @item chroma_amount, ca
  17337. Set the chroma effect strength. It must be a floating point number, reasonable
  17338. values lay between -1.5 and 1.5.
  17339. Negative values will blur the input video, while positive values will
  17340. sharpen it, a value of zero will disable the effect.
  17341. Default value is 0.0.
  17342. @item alpha_msize_x, ax
  17343. Set the alpha matrix horizontal size. It must be an odd integer
  17344. between 3 and 23. The default value is 5.
  17345. @item alpha_msize_y, ay
  17346. Set the alpha matrix vertical size. It must be an odd integer
  17347. between 3 and 23. The default value is 5.
  17348. @item alpha_amount, aa
  17349. Set the alpha effect strength. It must be a floating point number, reasonable
  17350. values lay between -1.5 and 1.5.
  17351. Negative values will blur the input video, while positive values will
  17352. sharpen it, a value of zero will disable the effect.
  17353. Default value is 0.0.
  17354. @end table
  17355. All parameters are optional and default to the equivalent of the
  17356. string '5:5:1.0:5:5:0.0'.
  17357. @subsection Examples
  17358. @itemize
  17359. @item
  17360. Apply strong luma sharpen effect:
  17361. @example
  17362. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  17363. @end example
  17364. @item
  17365. Apply a strong blur of both luma and chroma parameters:
  17366. @example
  17367. unsharp=7:7:-2:7:7:-2
  17368. @end example
  17369. @end itemize
  17370. @anchor{untile}
  17371. @section untile
  17372. Decompose a video made of tiled images into the individual images.
  17373. The frame rate of the output video is the frame rate of the input video
  17374. multiplied by the number of tiles.
  17375. This filter does the reverse of @ref{tile}.
  17376. The filter accepts the following options:
  17377. @table @option
  17378. @item layout
  17379. Set the grid size (i.e. the number of lines and columns). For the syntax of
  17380. this option, check the
  17381. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17382. @end table
  17383. @subsection Examples
  17384. @itemize
  17385. @item
  17386. Produce a 1-second video from a still image file made of 25 frames stacked
  17387. vertically, like an analogic film reel:
  17388. @example
  17389. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  17390. @end example
  17391. @end itemize
  17392. @section uspp
  17393. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  17394. the image at several (or - in the case of @option{quality} level @code{8} - all)
  17395. shifts and average the results.
  17396. The way this differs from the behavior of spp is that uspp actually encodes &
  17397. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  17398. DCT similar to MJPEG.
  17399. This filter is only available in ffmpeg version 4.4 or earlier.
  17400. The filter accepts the following options:
  17401. @table @option
  17402. @item quality
  17403. Set quality. This option defines the number of levels for averaging. It accepts
  17404. an integer in the range 0-8. If set to @code{0}, the filter will have no
  17405. effect. A value of @code{8} means the higher quality. For each increment of
  17406. that value the speed drops by a factor of approximately 2. Default value is
  17407. @code{3}.
  17408. @item qp
  17409. Force a constant quantization parameter. If not set, the filter will use the QP
  17410. from the video stream (if available).
  17411. @end table
  17412. @section v360
  17413. Convert 360 videos between various formats.
  17414. The filter accepts the following options:
  17415. @table @option
  17416. @item input
  17417. @item output
  17418. Set format of the input/output video.
  17419. Available formats:
  17420. @table @samp
  17421. @item e
  17422. @item equirect
  17423. Equirectangular projection.
  17424. @item c3x2
  17425. @item c6x1
  17426. @item c1x6
  17427. Cubemap with 3x2/6x1/1x6 layout.
  17428. Format specific options:
  17429. @table @option
  17430. @item in_pad
  17431. @item out_pad
  17432. Set padding proportion for the input/output cubemap. Values in decimals.
  17433. Example values:
  17434. @table @samp
  17435. @item 0
  17436. No padding.
  17437. @item 0.01
  17438. 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)
  17439. @end table
  17440. Default value is @b{@samp{0}}.
  17441. Maximum value is @b{@samp{0.1}}.
  17442. @item fin_pad
  17443. @item fout_pad
  17444. Set fixed padding for the input/output cubemap. Values in pixels.
  17445. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  17446. @item in_forder
  17447. @item out_forder
  17448. Set order of faces for the input/output cubemap. Choose one direction for each position.
  17449. Designation of directions:
  17450. @table @samp
  17451. @item r
  17452. right
  17453. @item l
  17454. left
  17455. @item u
  17456. up
  17457. @item d
  17458. down
  17459. @item f
  17460. forward
  17461. @item b
  17462. back
  17463. @end table
  17464. Default value is @b{@samp{rludfb}}.
  17465. @item in_frot
  17466. @item out_frot
  17467. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  17468. Designation of angles:
  17469. @table @samp
  17470. @item 0
  17471. 0 degrees clockwise
  17472. @item 1
  17473. 90 degrees clockwise
  17474. @item 2
  17475. 180 degrees clockwise
  17476. @item 3
  17477. 270 degrees clockwise
  17478. @end table
  17479. Default value is @b{@samp{000000}}.
  17480. @end table
  17481. @item eac
  17482. Equi-Angular Cubemap.
  17483. @item flat
  17484. @item gnomonic
  17485. @item rectilinear
  17486. Regular video.
  17487. Format specific options:
  17488. @table @option
  17489. @item h_fov
  17490. @item v_fov
  17491. @item d_fov
  17492. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17493. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17494. @item ih_fov
  17495. @item iv_fov
  17496. @item id_fov
  17497. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17498. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17499. @end table
  17500. @item dfisheye
  17501. Dual fisheye.
  17502. Format specific options:
  17503. @table @option
  17504. @item h_fov
  17505. @item v_fov
  17506. @item d_fov
  17507. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17508. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17509. @item ih_fov
  17510. @item iv_fov
  17511. @item id_fov
  17512. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17513. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17514. @end table
  17515. @item barrel
  17516. @item fb
  17517. @item barrelsplit
  17518. Facebook's 360 formats.
  17519. @item sg
  17520. Stereographic format.
  17521. Format specific options:
  17522. @table @option
  17523. @item h_fov
  17524. @item v_fov
  17525. @item d_fov
  17526. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17527. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17528. @item ih_fov
  17529. @item iv_fov
  17530. @item id_fov
  17531. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17532. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17533. @end table
  17534. @item mercator
  17535. Mercator format.
  17536. @item ball
  17537. Ball format, gives significant distortion toward the back.
  17538. @item hammer
  17539. Hammer-Aitoff map projection format.
  17540. @item sinusoidal
  17541. Sinusoidal map projection format.
  17542. @item fisheye
  17543. Fisheye projection.
  17544. Format specific options:
  17545. @table @option
  17546. @item h_fov
  17547. @item v_fov
  17548. @item d_fov
  17549. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17550. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17551. @item ih_fov
  17552. @item iv_fov
  17553. @item id_fov
  17554. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17555. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17556. @end table
  17557. @item pannini
  17558. Pannini projection.
  17559. Format specific options:
  17560. @table @option
  17561. @item h_fov
  17562. Set output pannini parameter.
  17563. @item ih_fov
  17564. Set input pannini parameter.
  17565. @end table
  17566. @item cylindrical
  17567. Cylindrical projection.
  17568. Format specific options:
  17569. @table @option
  17570. @item h_fov
  17571. @item v_fov
  17572. @item d_fov
  17573. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17574. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17575. @item ih_fov
  17576. @item iv_fov
  17577. @item id_fov
  17578. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17579. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17580. @end table
  17581. @item perspective
  17582. Perspective projection. @i{(output only)}
  17583. Format specific options:
  17584. @table @option
  17585. @item v_fov
  17586. Set perspective parameter.
  17587. @end table
  17588. @item tetrahedron
  17589. Tetrahedron projection.
  17590. @item tsp
  17591. Truncated square pyramid projection.
  17592. @item he
  17593. @item hequirect
  17594. Half equirectangular projection.
  17595. @item equisolid
  17596. Equisolid format.
  17597. Format specific options:
  17598. @table @option
  17599. @item h_fov
  17600. @item v_fov
  17601. @item d_fov
  17602. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17603. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17604. @item ih_fov
  17605. @item iv_fov
  17606. @item id_fov
  17607. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17608. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17609. @end table
  17610. @item og
  17611. Orthographic format.
  17612. Format specific options:
  17613. @table @option
  17614. @item h_fov
  17615. @item v_fov
  17616. @item d_fov
  17617. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17618. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17619. @item ih_fov
  17620. @item iv_fov
  17621. @item id_fov
  17622. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17623. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17624. @end table
  17625. @item octahedron
  17626. Octahedron projection.
  17627. @item cylindricalea
  17628. Cylindrical Equal Area projection.
  17629. @end table
  17630. @item interp
  17631. Set interpolation method.@*
  17632. @i{Note: more complex interpolation methods require much more memory to run.}
  17633. Available methods:
  17634. @table @samp
  17635. @item near
  17636. @item nearest
  17637. Nearest neighbour.
  17638. @item line
  17639. @item linear
  17640. Bilinear interpolation.
  17641. @item lagrange9
  17642. Lagrange9 interpolation.
  17643. @item cube
  17644. @item cubic
  17645. Bicubic interpolation.
  17646. @item lanc
  17647. @item lanczos
  17648. Lanczos interpolation.
  17649. @item sp16
  17650. @item spline16
  17651. Spline16 interpolation.
  17652. @item gauss
  17653. @item gaussian
  17654. Gaussian interpolation.
  17655. @item mitchell
  17656. Mitchell interpolation.
  17657. @end table
  17658. Default value is @b{@samp{line}}.
  17659. @item w
  17660. @item h
  17661. Set the output video resolution.
  17662. Default resolution depends on formats.
  17663. @item in_stereo
  17664. @item out_stereo
  17665. Set the input/output stereo format.
  17666. @table @samp
  17667. @item 2d
  17668. 2D mono
  17669. @item sbs
  17670. Side by side
  17671. @item tb
  17672. Top bottom
  17673. @end table
  17674. Default value is @b{@samp{2d}} for input and output format.
  17675. @item yaw
  17676. @item pitch
  17677. @item roll
  17678. Set rotation for the output video. Values in degrees.
  17679. @item rorder
  17680. Set rotation order for the output video. Choose one item for each position.
  17681. @table @samp
  17682. @item y, Y
  17683. yaw
  17684. @item p, P
  17685. pitch
  17686. @item r, R
  17687. roll
  17688. @end table
  17689. Default value is @b{@samp{ypr}}.
  17690. @item h_flip
  17691. @item v_flip
  17692. @item d_flip
  17693. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  17694. @item ih_flip
  17695. @item iv_flip
  17696. Set if input video is flipped horizontally/vertically. Boolean values.
  17697. @item in_trans
  17698. Set if input video is transposed. Boolean value, by default disabled.
  17699. @item out_trans
  17700. Set if output video needs to be transposed. Boolean value, by default disabled.
  17701. @item h_offset
  17702. @item v_offset
  17703. Set output horizontal/vertical off-axis offset. Default is set to 0.
  17704. Allowed range is from -1 to 1.
  17705. @item alpha_mask
  17706. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  17707. @item reset_rot
  17708. Reset rotation of output video. Boolean value, by default disabled.
  17709. @end table
  17710. @subsection Examples
  17711. @itemize
  17712. @item
  17713. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  17714. @example
  17715. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  17716. @end example
  17717. @item
  17718. Extract back view of Equi-Angular Cubemap:
  17719. @example
  17720. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  17721. @end example
  17722. @item
  17723. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  17724. @example
  17725. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  17726. @end example
  17727. @end itemize
  17728. @subsection Commands
  17729. This filter supports subset of above options as @ref{commands}.
  17730. @section vaguedenoiser
  17731. Apply a wavelet based denoiser.
  17732. It transforms each frame from the video input into the wavelet domain,
  17733. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  17734. the obtained coefficients. It does an inverse wavelet transform after.
  17735. Due to wavelet properties, it should give a nice smoothed result, and
  17736. reduced noise, without blurring picture features.
  17737. This filter accepts the following options:
  17738. @table @option
  17739. @item threshold
  17740. The filtering strength. The higher, the more filtered the video will be.
  17741. Hard thresholding can use a higher threshold than soft thresholding
  17742. before the video looks overfiltered. Default value is 2.
  17743. @item method
  17744. The filtering method the filter will use.
  17745. It accepts the following values:
  17746. @table @samp
  17747. @item hard
  17748. All values under the threshold will be zeroed.
  17749. @item soft
  17750. All values under the threshold will be zeroed. All values above will be
  17751. reduced by the threshold.
  17752. @item garrote
  17753. Scales or nullifies coefficients - intermediary between (more) soft and
  17754. (less) hard thresholding.
  17755. @end table
  17756. Default is garrote.
  17757. @item nsteps
  17758. Number of times, the wavelet will decompose the picture. Picture can't
  17759. be decomposed beyond a particular point (typically, 8 for a 640x480
  17760. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  17761. @item percent
  17762. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  17763. @item planes
  17764. A list of the planes to process. By default all planes are processed.
  17765. @item type
  17766. The threshold type the filter will use.
  17767. It accepts the following values:
  17768. @table @samp
  17769. @item universal
  17770. Threshold used is same for all decompositions.
  17771. @item bayes
  17772. Threshold used depends also on each decomposition coefficients.
  17773. @end table
  17774. Default is universal.
  17775. @end table
  17776. @section varblur
  17777. Apply variable blur filter by using 2nd video stream to set blur radius.
  17778. The 2nd stream must have the same dimensions.
  17779. This filter accepts the following options:
  17780. @table @option
  17781. @item min_r
  17782. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  17783. @item max_r
  17784. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  17785. @item planes
  17786. Set which planes to process. By default, all are used.
  17787. @end table
  17788. The @code{varblur} filter also supports the @ref{framesync} options.
  17789. @subsection Commands
  17790. This filter supports all the above options as @ref{commands}.
  17791. @section vectorscope
  17792. Display 2 color component values in the two dimensional graph (which is called
  17793. a vectorscope).
  17794. This filter accepts the following options:
  17795. @table @option
  17796. @item mode, m
  17797. Set vectorscope mode.
  17798. It accepts the following values:
  17799. @table @samp
  17800. @item gray
  17801. @item tint
  17802. Gray values are displayed on graph, higher brightness means more pixels have
  17803. same component color value on location in graph. This is the default mode.
  17804. @item color
  17805. Gray values are displayed on graph. Surrounding pixels values which are not
  17806. present in video frame are drawn in gradient of 2 color components which are
  17807. set by option @code{x} and @code{y}. The 3rd color component is static.
  17808. @item color2
  17809. Actual color components values present in video frame are displayed on graph.
  17810. @item color3
  17811. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  17812. on graph increases value of another color component, which is luminance by
  17813. default values of @code{x} and @code{y}.
  17814. @item color4
  17815. Actual colors present in video frame are displayed on graph. If two different
  17816. colors map to same position on graph then color with higher value of component
  17817. not present in graph is picked.
  17818. @item color5
  17819. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  17820. component picked from radial gradient.
  17821. @end table
  17822. @item x
  17823. Set which color component will be represented on X-axis. Default is @code{1}.
  17824. @item y
  17825. Set which color component will be represented on Y-axis. Default is @code{2}.
  17826. @item intensity, i
  17827. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  17828. of color component which represents frequency of (X, Y) location in graph.
  17829. @item envelope, e
  17830. @table @samp
  17831. @item none
  17832. No envelope, this is default.
  17833. @item instant
  17834. Instant envelope, even darkest single pixel will be clearly highlighted.
  17835. @item peak
  17836. Hold maximum and minimum values presented in graph over time. This way you
  17837. can still spot out of range values without constantly looking at vectorscope.
  17838. @item peak+instant
  17839. Peak and instant envelope combined together.
  17840. @end table
  17841. @item graticule, g
  17842. Set what kind of graticule to draw.
  17843. @table @samp
  17844. @item none
  17845. @item green
  17846. @item color
  17847. @item invert
  17848. @end table
  17849. @item opacity, o
  17850. Set graticule opacity.
  17851. @item flags, f
  17852. Set graticule flags.
  17853. @table @samp
  17854. @item white
  17855. Draw graticule for white point.
  17856. @item black
  17857. Draw graticule for black point.
  17858. @item name
  17859. Draw color points short names.
  17860. @end table
  17861. @item bgopacity, b
  17862. Set background opacity.
  17863. @item lthreshold, l
  17864. Set low threshold for color component not represented on X or Y axis.
  17865. Values lower than this value will be ignored. Default is 0.
  17866. Note this value is multiplied with actual max possible value one pixel component
  17867. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  17868. is 0.1 * 255 = 25.
  17869. @item hthreshold, h
  17870. Set high threshold for color component not represented on X or Y axis.
  17871. Values higher than this value will be ignored. Default is 1.
  17872. Note this value is multiplied with actual max possible value one pixel component
  17873. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  17874. is 0.9 * 255 = 230.
  17875. @item colorspace, c
  17876. Set what kind of colorspace to use when drawing graticule.
  17877. @table @samp
  17878. @item auto
  17879. @item 601
  17880. @item 709
  17881. @end table
  17882. Default is auto.
  17883. @item tint0, t0
  17884. @item tint1, t1
  17885. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  17886. This means no tint, and output will remain gray.
  17887. @end table
  17888. @anchor{vidstabdetect}
  17889. @section vidstabdetect
  17890. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  17891. @ref{vidstabtransform} for pass 2.
  17892. This filter generates a file with relative translation and rotation
  17893. transform information about subsequent frames, which is then used by
  17894. the @ref{vidstabtransform} filter.
  17895. To enable compilation of this filter you need to configure FFmpeg with
  17896. @code{--enable-libvidstab}.
  17897. This filter accepts the following options:
  17898. @table @option
  17899. @item result
  17900. Set the path to the file used to write the transforms information.
  17901. Default value is @file{transforms.trf}.
  17902. @item shakiness
  17903. Set how shaky the video is and how quick the camera is. It accepts an
  17904. integer in the range 1-10, a value of 1 means little shakiness, a
  17905. value of 10 means strong shakiness. Default value is 5.
  17906. @item accuracy
  17907. Set the accuracy of the detection process. It must be a value in the
  17908. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  17909. accuracy. Default value is 15.
  17910. @item stepsize
  17911. Set stepsize of the search process. The region around minimum is
  17912. scanned with 1 pixel resolution. Default value is 6.
  17913. @item mincontrast
  17914. Set minimum contrast. Below this value a local measurement field is
  17915. discarded. Must be a floating point value in the range 0-1. Default
  17916. value is 0.3.
  17917. @item tripod
  17918. Set reference frame number for tripod mode.
  17919. If enabled, the motion of the frames is compared to a reference frame
  17920. in the filtered stream, identified by the specified number. The idea
  17921. is to compensate all movements in a more-or-less static scene and keep
  17922. the camera view absolutely still.
  17923. If set to 0, it is disabled. The frames are counted starting from 1.
  17924. @item show
  17925. Show fields and transforms in the resulting frames. It accepts an
  17926. integer in the range 0-2. Default value is 0, which disables any
  17927. visualization.
  17928. @end table
  17929. @subsection Examples
  17930. @itemize
  17931. @item
  17932. Use default values:
  17933. @example
  17934. vidstabdetect
  17935. @end example
  17936. @item
  17937. Analyze strongly shaky movie and put the results in file
  17938. @file{mytransforms.trf}:
  17939. @example
  17940. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  17941. @end example
  17942. @item
  17943. Visualize the result of internal transformations in the resulting
  17944. video:
  17945. @example
  17946. vidstabdetect=show=1
  17947. @end example
  17948. @item
  17949. Analyze a video with medium shakiness using @command{ffmpeg}:
  17950. @example
  17951. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  17952. @end example
  17953. @end itemize
  17954. @anchor{vidstabtransform}
  17955. @section vidstabtransform
  17956. Video stabilization/deshaking: pass 2 of 2,
  17957. see @ref{vidstabdetect} for pass 1.
  17958. Read a file with transform information for each frame and
  17959. apply/compensate them. Together with the @ref{vidstabdetect}
  17960. filter this can be used to deshake videos. See also
  17961. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  17962. the @ref{unsharp} filter, see below.
  17963. To enable compilation of this filter you need to configure FFmpeg with
  17964. @code{--enable-libvidstab}.
  17965. @subsection Options
  17966. @table @option
  17967. @item input
  17968. Set path to the file used to read the transforms. Default value is
  17969. @file{transforms.trf}.
  17970. @item smoothing
  17971. Set the number of frames (value*2 + 1) used for lowpass filtering the
  17972. camera movements. Default value is 10.
  17973. For example a number of 10 means that 21 frames are used (10 in the
  17974. past and 10 in the future) to smoothen the motion in the video. A
  17975. larger value leads to a smoother video, but limits the acceleration of
  17976. the camera (pan/tilt movements). 0 is a special case where a static
  17977. camera is simulated.
  17978. @item optalgo
  17979. Set the camera path optimization algorithm.
  17980. Accepted values are:
  17981. @table @samp
  17982. @item gauss
  17983. gaussian kernel low-pass filter on camera motion (default)
  17984. @item avg
  17985. averaging on transformations
  17986. @end table
  17987. @item maxshift
  17988. Set maximal number of pixels to translate frames. Default value is -1,
  17989. meaning no limit.
  17990. @item maxangle
  17991. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  17992. value is -1, meaning no limit.
  17993. @item crop
  17994. Specify how to deal with borders that may be visible due to movement
  17995. compensation.
  17996. Available values are:
  17997. @table @samp
  17998. @item keep
  17999. keep image information from previous frame (default)
  18000. @item black
  18001. fill the border black
  18002. @end table
  18003. @item invert
  18004. Invert transforms if set to 1. Default value is 0.
  18005. @item relative
  18006. Consider transforms as relative to previous frame if set to 1,
  18007. absolute if set to 0. Default value is 0.
  18008. @item zoom
  18009. Set percentage to zoom. A positive value will result in a zoom-in
  18010. effect, a negative value in a zoom-out effect. Default value is 0 (no
  18011. zoom).
  18012. @item optzoom
  18013. Set optimal zooming to avoid borders.
  18014. Accepted values are:
  18015. @table @samp
  18016. @item 0
  18017. disabled
  18018. @item 1
  18019. optimal static zoom value is determined (only very strong movements
  18020. will lead to visible borders) (default)
  18021. @item 2
  18022. optimal adaptive zoom value is determined (no borders will be
  18023. visible), see @option{zoomspeed}
  18024. @end table
  18025. Note that the value given at zoom is added to the one calculated here.
  18026. @item zoomspeed
  18027. Set percent to zoom maximally each frame (enabled when
  18028. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  18029. 0.25.
  18030. @item interpol
  18031. Specify type of interpolation.
  18032. Available values are:
  18033. @table @samp
  18034. @item no
  18035. no interpolation
  18036. @item linear
  18037. linear only horizontal
  18038. @item bilinear
  18039. linear in both directions (default)
  18040. @item bicubic
  18041. cubic in both directions (slow)
  18042. @end table
  18043. @item tripod
  18044. Enable virtual tripod mode if set to 1, which is equivalent to
  18045. @code{relative=0:smoothing=0}. Default value is 0.
  18046. Use also @code{tripod} option of @ref{vidstabdetect}.
  18047. @item debug
  18048. Increase log verbosity if set to 1. Also the detected global motions
  18049. are written to the temporary file @file{global_motions.trf}. Default
  18050. value is 0.
  18051. @end table
  18052. @subsection Examples
  18053. @itemize
  18054. @item
  18055. Use @command{ffmpeg} for a typical stabilization with default values:
  18056. @example
  18057. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  18058. @end example
  18059. Note the use of the @ref{unsharp} filter which is always recommended.
  18060. @item
  18061. Zoom in a bit more and load transform data from a given file:
  18062. @example
  18063. vidstabtransform=zoom=5:input="mytransforms.trf"
  18064. @end example
  18065. @item
  18066. Smoothen the video even more:
  18067. @example
  18068. vidstabtransform=smoothing=30
  18069. @end example
  18070. @end itemize
  18071. @section vflip
  18072. Flip the input video vertically.
  18073. For example, to vertically flip a video with @command{ffmpeg}:
  18074. @example
  18075. ffmpeg -i in.avi -vf "vflip" out.avi
  18076. @end example
  18077. @section vfrdet
  18078. Detect variable frame rate video.
  18079. This filter tries to detect if the input is variable or constant frame rate.
  18080. At end it will output number of frames detected as having variable delta pts,
  18081. and ones with constant delta pts.
  18082. If there was frames with variable delta, than it will also show min, max and
  18083. average delta encountered.
  18084. @section vibrance
  18085. Boost or alter saturation.
  18086. The filter accepts the following options:
  18087. @table @option
  18088. @item intensity
  18089. Set strength of boost if positive value or strength of alter if negative value.
  18090. Default is 0. Allowed range is from -2 to 2.
  18091. @item rbal
  18092. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  18093. @item gbal
  18094. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  18095. @item bbal
  18096. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  18097. @item rlum
  18098. Set the red luma coefficient.
  18099. @item glum
  18100. Set the green luma coefficient.
  18101. @item blum
  18102. Set the blue luma coefficient.
  18103. @item alternate
  18104. If @code{intensity} is negative and this is set to 1, colors will change,
  18105. otherwise colors will be less saturated, more towards gray.
  18106. @end table
  18107. @subsection Commands
  18108. This filter supports the all above options as @ref{commands}.
  18109. @section vif
  18110. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  18111. This filter takes two input videos.
  18112. Both input videos must have the same resolution and pixel format for
  18113. this filter to work correctly. Also it assumes that both inputs
  18114. have the same number of frames, which are compared one by one.
  18115. The obtained average VIF score is printed through the logging system.
  18116. The filter stores the calculated VIF score of each frame.
  18117. In the below example the input file @file{main.mpg} being processed is compared
  18118. with the reference file @file{ref.mpg}.
  18119. @example
  18120. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  18121. @end example
  18122. @anchor{vignette}
  18123. @section vignette
  18124. Make or reverse a natural vignetting effect.
  18125. The filter accepts the following options:
  18126. @table @option
  18127. @item angle, a
  18128. Set lens angle expression as a number of radians.
  18129. The value is clipped in the @code{[0,PI/2]} range.
  18130. Default value: @code{"PI/5"}
  18131. @item x0
  18132. @item y0
  18133. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  18134. by default.
  18135. @item mode
  18136. Set forward/backward mode.
  18137. Available modes are:
  18138. @table @samp
  18139. @item forward
  18140. The larger the distance from the central point, the darker the image becomes.
  18141. @item backward
  18142. The larger the distance from the central point, the brighter the image becomes.
  18143. This can be used to reverse a vignette effect, though there is no automatic
  18144. detection to extract the lens @option{angle} and other settings (yet). It can
  18145. also be used to create a burning effect.
  18146. @end table
  18147. Default value is @samp{forward}.
  18148. @item eval
  18149. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  18150. It accepts the following values:
  18151. @table @samp
  18152. @item init
  18153. Evaluate expressions only once during the filter initialization.
  18154. @item frame
  18155. Evaluate expressions for each incoming frame. This is way slower than the
  18156. @samp{init} mode since it requires all the scalers to be re-computed, but it
  18157. allows advanced dynamic expressions.
  18158. @end table
  18159. Default value is @samp{init}.
  18160. @item dither
  18161. Set dithering to reduce the circular banding effects. Default is @code{1}
  18162. (enabled).
  18163. @item aspect
  18164. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  18165. Setting this value to the SAR of the input will make a rectangular vignetting
  18166. following the dimensions of the video.
  18167. Default is @code{1/1}.
  18168. @end table
  18169. @subsection Expressions
  18170. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  18171. following parameters.
  18172. @table @option
  18173. @item w
  18174. @item h
  18175. input width and height
  18176. @item n
  18177. the number of input frame, starting from 0
  18178. @item pts
  18179. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  18180. @var{TB} units, NAN if undefined
  18181. @item r
  18182. frame rate of the input video, NAN if the input frame rate is unknown
  18183. @item t
  18184. the PTS (Presentation TimeStamp) of the filtered video frame,
  18185. expressed in seconds, NAN if undefined
  18186. @item tb
  18187. time base of the input video
  18188. @end table
  18189. @subsection Examples
  18190. @itemize
  18191. @item
  18192. Apply simple strong vignetting effect:
  18193. @example
  18194. vignette=PI/4
  18195. @end example
  18196. @item
  18197. Make a flickering vignetting:
  18198. @example
  18199. vignette='PI/4+random(1)*PI/50':eval=frame
  18200. @end example
  18201. @end itemize
  18202. @section vmafmotion
  18203. Obtain the average VMAF motion score of a video.
  18204. It is one of the component metrics of VMAF.
  18205. The obtained average motion score is printed through the logging system.
  18206. The filter accepts the following options:
  18207. @table @option
  18208. @item stats_file
  18209. If specified, the filter will use the named file to save the motion score of
  18210. each frame with respect to the previous frame.
  18211. When filename equals "-" the data is sent to standard output.
  18212. @end table
  18213. Example:
  18214. @example
  18215. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  18216. @end example
  18217. @section vstack
  18218. Stack input videos vertically.
  18219. All streams must be of same pixel format and of same width.
  18220. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  18221. to create same output.
  18222. The filter accepts the following options:
  18223. @table @option
  18224. @item inputs
  18225. Set number of input streams. Default is 2.
  18226. @item shortest
  18227. If set to 1, force the output to terminate when the shortest input
  18228. terminates. Default value is 0.
  18229. @end table
  18230. @section w3fdif
  18231. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  18232. Deinterlacing Filter").
  18233. Based on the process described by Martin Weston for BBC R&D, and
  18234. implemented based on the de-interlace algorithm written by Jim
  18235. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  18236. uses filter coefficients calculated by BBC R&D.
  18237. This filter uses field-dominance information in frame to decide which
  18238. of each pair of fields to place first in the output.
  18239. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  18240. There are two sets of filter coefficients, so called "simple"
  18241. and "complex". Which set of filter coefficients is used can
  18242. be set by passing an optional parameter:
  18243. @table @option
  18244. @item filter
  18245. Set the interlacing filter coefficients. Accepts one of the following values:
  18246. @table @samp
  18247. @item simple
  18248. Simple filter coefficient set.
  18249. @item complex
  18250. More-complex filter coefficient set.
  18251. @end table
  18252. Default value is @samp{complex}.
  18253. @item mode
  18254. The interlacing mode to adopt. It accepts one of the following values:
  18255. @table @option
  18256. @item frame
  18257. Output one frame for each frame.
  18258. @item field
  18259. Output one frame for each field.
  18260. @end table
  18261. The default value is @code{field}.
  18262. @item parity
  18263. The picture field parity assumed for the input interlaced video. It accepts one
  18264. of the following values:
  18265. @table @option
  18266. @item tff
  18267. Assume the top field is first.
  18268. @item bff
  18269. Assume the bottom field is first.
  18270. @item auto
  18271. Enable automatic detection of field parity.
  18272. @end table
  18273. The default value is @code{auto}.
  18274. If the interlacing is unknown or the decoder does not export this information,
  18275. top field first will be assumed.
  18276. @item deint
  18277. Specify which frames to deinterlace. Accepts one of the following values:
  18278. @table @samp
  18279. @item all
  18280. Deinterlace all frames,
  18281. @item interlaced
  18282. Only deinterlace frames marked as interlaced.
  18283. @end table
  18284. Default value is @samp{all}.
  18285. @end table
  18286. @subsection Commands
  18287. This filter supports same @ref{commands} as options.
  18288. @section waveform
  18289. Video waveform monitor.
  18290. The waveform monitor plots color component intensity. By default luminance
  18291. only. Each column of the waveform corresponds to a column of pixels in the
  18292. source video.
  18293. It accepts the following options:
  18294. @table @option
  18295. @item mode, m
  18296. Can be either @code{row}, or @code{column}. Default is @code{column}.
  18297. In row mode, the graph on the left side represents color component value 0 and
  18298. the right side represents value = 255. In column mode, the top side represents
  18299. color component value = 0 and bottom side represents value = 255.
  18300. @item intensity, i
  18301. Set intensity. Smaller values are useful to find out how many values of the same
  18302. luminance are distributed across input rows/columns.
  18303. Default value is @code{0.04}. Allowed range is [0, 1].
  18304. @item mirror, r
  18305. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  18306. In mirrored mode, higher values will be represented on the left
  18307. side for @code{row} mode and at the top for @code{column} mode. Default is
  18308. @code{1} (mirrored).
  18309. @item display, d
  18310. Set display mode.
  18311. It accepts the following values:
  18312. @table @samp
  18313. @item overlay
  18314. Presents information identical to that in the @code{parade}, except
  18315. that the graphs representing color components are superimposed directly
  18316. over one another.
  18317. This display mode makes it easier to spot relative differences or similarities
  18318. in overlapping areas of the color components that are supposed to be identical,
  18319. such as neutral whites, grays, or blacks.
  18320. @item stack
  18321. Display separate graph for the color components side by side in
  18322. @code{row} mode or one below the other in @code{column} mode.
  18323. @item parade
  18324. Display separate graph for the color components side by side in
  18325. @code{column} mode or one below the other in @code{row} mode.
  18326. Using this display mode makes it easy to spot color casts in the highlights
  18327. and shadows of an image, by comparing the contours of the top and the bottom
  18328. graphs of each waveform. Since whites, grays, and blacks are characterized
  18329. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  18330. should display three waveforms of roughly equal width/height. If not, the
  18331. correction is easy to perform by making level adjustments the three waveforms.
  18332. @end table
  18333. Default is @code{stack}.
  18334. @item components, c
  18335. Set which color components to display. Default is 1, which means only luminance
  18336. or red color component if input is in RGB colorspace. If is set for example to
  18337. 7 it will display all 3 (if) available color components.
  18338. @item envelope, e
  18339. @table @samp
  18340. @item none
  18341. No envelope, this is default.
  18342. @item instant
  18343. Instant envelope, minimum and maximum values presented in graph will be easily
  18344. visible even with small @code{step} value.
  18345. @item peak
  18346. Hold minimum and maximum values presented in graph across time. This way you
  18347. can still spot out of range values without constantly looking at waveforms.
  18348. @item peak+instant
  18349. Peak and instant envelope combined together.
  18350. @end table
  18351. @item filter, f
  18352. @table @samp
  18353. @item lowpass
  18354. No filtering, this is default.
  18355. @item flat
  18356. Luma and chroma combined together.
  18357. @item aflat
  18358. Similar as above, but shows difference between blue and red chroma.
  18359. @item xflat
  18360. Similar as above, but use different colors.
  18361. @item yflat
  18362. Similar as above, but again with different colors.
  18363. @item chroma
  18364. Displays only chroma.
  18365. @item color
  18366. Displays actual color value on waveform.
  18367. @item acolor
  18368. Similar as above, but with luma showing frequency of chroma values.
  18369. @end table
  18370. @item graticule, g
  18371. Set which graticule to display.
  18372. @table @samp
  18373. @item none
  18374. Do not display graticule.
  18375. @item green
  18376. Display green graticule showing legal broadcast ranges.
  18377. @item orange
  18378. Display orange graticule showing legal broadcast ranges.
  18379. @item invert
  18380. Display invert graticule showing legal broadcast ranges.
  18381. @end table
  18382. @item opacity, o
  18383. Set graticule opacity.
  18384. @item flags, fl
  18385. Set graticule flags.
  18386. @table @samp
  18387. @item numbers
  18388. Draw numbers above lines. By default enabled.
  18389. @item dots
  18390. Draw dots instead of lines.
  18391. @end table
  18392. @item scale, s
  18393. Set scale used for displaying graticule.
  18394. @table @samp
  18395. @item digital
  18396. @item millivolts
  18397. @item ire
  18398. @end table
  18399. Default is digital.
  18400. @item bgopacity, b
  18401. Set background opacity.
  18402. @item tint0, t0
  18403. @item tint1, t1
  18404. Set tint for output.
  18405. Only used with lowpass filter and when display is not overlay and input
  18406. pixel formats are not RGB.
  18407. @item fitmode, fm
  18408. Set sample aspect ratio of video output frames.
  18409. Can be used to configure waveform so it is not
  18410. streched too much in one of directions.
  18411. @table @samp
  18412. @item none
  18413. Set sample aspect ration to 1/1.
  18414. @item size
  18415. Set sample aspect ratio to match input size of video
  18416. @end table
  18417. Default is @samp{none}.
  18418. @end table
  18419. @section weave, doubleweave
  18420. The @code{weave} takes a field-based video input and join
  18421. each two sequential fields into single frame, producing a new double
  18422. height clip with half the frame rate and half the frame count.
  18423. The @code{doubleweave} works same as @code{weave} but without
  18424. halving frame rate and frame count.
  18425. It accepts the following option:
  18426. @table @option
  18427. @item first_field
  18428. Set first field. Available values are:
  18429. @table @samp
  18430. @item top, t
  18431. Set the frame as top-field-first.
  18432. @item bottom, b
  18433. Set the frame as bottom-field-first.
  18434. @end table
  18435. @end table
  18436. @subsection Examples
  18437. @itemize
  18438. @item
  18439. Interlace video using @ref{select} and @ref{separatefields} filter:
  18440. @example
  18441. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  18442. @end example
  18443. @end itemize
  18444. @section xbr
  18445. Apply the xBR high-quality magnification filter which is designed for pixel
  18446. art. It follows a set of edge-detection rules, see
  18447. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  18448. It accepts the following option:
  18449. @table @option
  18450. @item n
  18451. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  18452. @code{3xBR} and @code{4} for @code{4xBR}.
  18453. Default is @code{3}.
  18454. @end table
  18455. @section xcorrelate
  18456. Apply normalized cross-correlation between first and second input video stream.
  18457. Second input video stream dimensions must be lower than first input video stream.
  18458. The filter accepts the following options:
  18459. @table @option
  18460. @item planes
  18461. Set which planes to process.
  18462. @item secondary
  18463. Set which secondary video frames will be processed from second input video stream,
  18464. can be @var{first} or @var{all}. Default is @var{all}.
  18465. @end table
  18466. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  18467. @section xfade
  18468. Apply cross fade from one input video stream to another input video stream.
  18469. The cross fade is applied for specified duration.
  18470. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  18471. frame rate and timebase.
  18472. The filter accepts the following options:
  18473. @table @option
  18474. @item transition
  18475. Set one of available transition effects:
  18476. @table @samp
  18477. @item custom
  18478. @item fade
  18479. @item wipeleft
  18480. @item wiperight
  18481. @item wipeup
  18482. @item wipedown
  18483. @item slideleft
  18484. @item slideright
  18485. @item slideup
  18486. @item slidedown
  18487. @item circlecrop
  18488. @item rectcrop
  18489. @item distance
  18490. @item fadeblack
  18491. @item fadewhite
  18492. @item radial
  18493. @item smoothleft
  18494. @item smoothright
  18495. @item smoothup
  18496. @item smoothdown
  18497. @item circleopen
  18498. @item circleclose
  18499. @item vertopen
  18500. @item vertclose
  18501. @item horzopen
  18502. @item horzclose
  18503. @item dissolve
  18504. @item pixelize
  18505. @item diagtl
  18506. @item diagtr
  18507. @item diagbl
  18508. @item diagbr
  18509. @item hlslice
  18510. @item hrslice
  18511. @item vuslice
  18512. @item vdslice
  18513. @item hblur
  18514. @item fadegrays
  18515. @item wipetl
  18516. @item wipetr
  18517. @item wipebl
  18518. @item wipebr
  18519. @item squeezeh
  18520. @item squeezev
  18521. @item zoomin
  18522. @item fadefast
  18523. @item fadeslow
  18524. @end table
  18525. Default transition effect is fade.
  18526. @item duration
  18527. Set cross fade duration in seconds.
  18528. Range is 0 to 60 seconds.
  18529. Default duration is 1 second.
  18530. @item offset
  18531. Set cross fade start relative to first input stream in seconds.
  18532. Default offset is 0.
  18533. @item expr
  18534. Set expression for custom transition effect.
  18535. The expressions can use the following variables and functions:
  18536. @table @option
  18537. @item X
  18538. @item Y
  18539. The coordinates of the current sample.
  18540. @item W
  18541. @item H
  18542. The width and height of the image.
  18543. @item P
  18544. Progress of transition effect.
  18545. @item PLANE
  18546. Currently processed plane.
  18547. @item A
  18548. Return value of first input at current location and plane.
  18549. @item B
  18550. Return value of second input at current location and plane.
  18551. @item a0(x, y)
  18552. @item a1(x, y)
  18553. @item a2(x, y)
  18554. @item a3(x, y)
  18555. Return the value of the pixel at location (@var{x},@var{y}) of the
  18556. first/second/third/fourth component of first input.
  18557. @item b0(x, y)
  18558. @item b1(x, y)
  18559. @item b2(x, y)
  18560. @item b3(x, y)
  18561. Return the value of the pixel at location (@var{x},@var{y}) of the
  18562. first/second/third/fourth component of second input.
  18563. @end table
  18564. @end table
  18565. @subsection Examples
  18566. @itemize
  18567. @item
  18568. Cross fade from one input video to another input video, with fade transition and duration of transition
  18569. of 2 seconds starting at offset of 5 seconds:
  18570. @example
  18571. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  18572. @end example
  18573. @end itemize
  18574. @section xmedian
  18575. Pick median pixels from several input videos.
  18576. The filter accepts the following options:
  18577. @table @option
  18578. @item inputs
  18579. Set number of inputs.
  18580. Default is 3. Allowed range is from 3 to 255.
  18581. If number of inputs is even number, than result will be mean value between two median values.
  18582. @item planes
  18583. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  18584. @item percentile
  18585. Set median percentile. Default value is @code{0.5}.
  18586. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  18587. minimum values, and @code{1} maximum values.
  18588. @end table
  18589. @subsection Commands
  18590. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  18591. @section xstack
  18592. Stack video inputs into custom layout.
  18593. All streams must be of same pixel format.
  18594. The filter accepts the following options:
  18595. @table @option
  18596. @item inputs
  18597. Set number of input streams. Default is 2.
  18598. @item layout
  18599. Specify layout of inputs.
  18600. This option requires the desired layout configuration to be explicitly set by the user.
  18601. This sets position of each video input in output. Each input
  18602. is separated by '|'.
  18603. The first number represents the column, and the second number represents the row.
  18604. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  18605. where X is video input from which to take width or height.
  18606. Multiple values can be used when separated by '+'. In such
  18607. case values are summed together.
  18608. Note that if inputs are of different sizes gaps may appear, as not all of
  18609. the output video frame will be filled. Similarly, videos can overlap each
  18610. other if their position doesn't leave enough space for the full frame of
  18611. adjoining videos.
  18612. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  18613. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  18614. the user. Either @code{grid} or @code{layout} can be specified at a time.
  18615. Specifying both will result in an error.
  18616. @item grid
  18617. Specify a fixed size grid of inputs.
  18618. This option is used to create a fixed size grid of the input streams. Set the
  18619. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  18620. input streams and they will be arranged as a grid with @code{ROWS} rows and
  18621. @code{COLUMNS} columns. When using this option, each input stream within a row
  18622. must have the same height and all the rows must have the same width.
  18623. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  18624. set to @code{ROWS * COLUMNS}.
  18625. For 2 inputs, a default grid of @code{2x1} (equivalent to
  18626. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  18627. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  18628. Specifying both will result in an error.
  18629. @item shortest
  18630. If set to 1, force the output to terminate when the shortest input
  18631. terminates. Default value is 0.
  18632. @item fill
  18633. If set to valid color, all unused pixels will be filled with that color.
  18634. By default fill is set to none, so it is disabled.
  18635. @end table
  18636. @subsection Examples
  18637. @itemize
  18638. @item
  18639. Display 4 inputs into 2x2 grid.
  18640. Layout:
  18641. @example
  18642. input1(0, 0) | input3(w0, 0)
  18643. input2(0, h0) | input4(w0, h0)
  18644. @end example
  18645. @example
  18646. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  18647. @end example
  18648. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18649. @item
  18650. Display 4 inputs into 1x4 grid.
  18651. Layout:
  18652. @example
  18653. input1(0, 0)
  18654. input2(0, h0)
  18655. input3(0, h0+h1)
  18656. input4(0, h0+h1+h2)
  18657. @end example
  18658. @example
  18659. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  18660. @end example
  18661. Note that if inputs are of different widths, unused space will appear.
  18662. @item
  18663. Display 9 inputs into 3x3 grid.
  18664. Layout:
  18665. @example
  18666. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  18667. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  18668. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  18669. @end example
  18670. @example
  18671. 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
  18672. @end example
  18673. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18674. @item
  18675. Display 16 inputs into 4x4 grid.
  18676. Layout:
  18677. @example
  18678. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  18679. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  18680. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  18681. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  18682. @end example
  18683. @example
  18684. 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|
  18685. 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
  18686. @end example
  18687. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18688. @end itemize
  18689. @anchor{yadif}
  18690. @section yadif
  18691. Deinterlace the input video ("yadif" means "yet another deinterlacing
  18692. filter").
  18693. It accepts the following parameters:
  18694. @table @option
  18695. @item mode
  18696. The interlacing mode to adopt. It accepts one of the following values:
  18697. @table @option
  18698. @item 0, send_frame
  18699. Output one frame for each frame.
  18700. @item 1, send_field
  18701. Output one frame for each field.
  18702. @item 2, send_frame_nospatial
  18703. Like @code{send_frame}, but it skips the spatial interlacing check.
  18704. @item 3, send_field_nospatial
  18705. Like @code{send_field}, but it skips the spatial interlacing check.
  18706. @end table
  18707. The default value is @code{send_frame}.
  18708. @item parity
  18709. The picture field parity assumed for the input interlaced video. It accepts one
  18710. of the following values:
  18711. @table @option
  18712. @item 0, tff
  18713. Assume the top field is first.
  18714. @item 1, bff
  18715. Assume the bottom field is first.
  18716. @item -1, auto
  18717. Enable automatic detection of field parity.
  18718. @end table
  18719. The default value is @code{auto}.
  18720. If the interlacing is unknown or the decoder does not export this information,
  18721. top field first will be assumed.
  18722. @item deint
  18723. Specify which frames to deinterlace. Accepts one of the following
  18724. values:
  18725. @table @option
  18726. @item 0, all
  18727. Deinterlace all frames.
  18728. @item 1, interlaced
  18729. Only deinterlace frames marked as interlaced.
  18730. @end table
  18731. The default value is @code{all}.
  18732. @end table
  18733. @section yadif_cuda
  18734. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  18735. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  18736. and/or nvenc.
  18737. It accepts the following parameters:
  18738. @table @option
  18739. @item mode
  18740. The interlacing mode to adopt. It accepts one of the following values:
  18741. @table @option
  18742. @item 0, send_frame
  18743. Output one frame for each frame.
  18744. @item 1, send_field
  18745. Output one frame for each field.
  18746. @item 2, send_frame_nospatial
  18747. Like @code{send_frame}, but it skips the spatial interlacing check.
  18748. @item 3, send_field_nospatial
  18749. Like @code{send_field}, but it skips the spatial interlacing check.
  18750. @end table
  18751. The default value is @code{send_frame}.
  18752. @item parity
  18753. The picture field parity assumed for the input interlaced video. It accepts one
  18754. of the following values:
  18755. @table @option
  18756. @item 0, tff
  18757. Assume the top field is first.
  18758. @item 1, bff
  18759. Assume the bottom field is first.
  18760. @item -1, auto
  18761. Enable automatic detection of field parity.
  18762. @end table
  18763. The default value is @code{auto}.
  18764. If the interlacing is unknown or the decoder does not export this information,
  18765. top field first will be assumed.
  18766. @item deint
  18767. Specify which frames to deinterlace. Accepts one of the following
  18768. values:
  18769. @table @option
  18770. @item 0, all
  18771. Deinterlace all frames.
  18772. @item 1, interlaced
  18773. Only deinterlace frames marked as interlaced.
  18774. @end table
  18775. The default value is @code{all}.
  18776. @end table
  18777. @section yaepblur
  18778. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  18779. The algorithm is described in
  18780. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  18781. It accepts the following parameters:
  18782. @table @option
  18783. @item radius, r
  18784. Set the window radius. Default value is 3.
  18785. @item planes, p
  18786. Set which planes to filter. Default is only the first plane.
  18787. @item sigma, s
  18788. Set blur strength. Default value is 128.
  18789. @end table
  18790. @subsection Commands
  18791. This filter supports same @ref{commands} as options.
  18792. @section zoompan
  18793. Apply Zoom & Pan effect.
  18794. This filter accepts the following options:
  18795. @table @option
  18796. @item zoom, z
  18797. Set the zoom expression. Range is 1-10. Default is 1.
  18798. @item x
  18799. @item y
  18800. Set the x and y expression. Default is 0.
  18801. @item d
  18802. Set the duration expression in number of frames.
  18803. This sets for how many number of frames effect will last for
  18804. single input image. Default is 90.
  18805. @item s
  18806. Set the output image size, default is 'hd720'.
  18807. @item fps
  18808. Set the output frame rate, default is '25'.
  18809. @end table
  18810. Each expression can contain the following constants:
  18811. @table @option
  18812. @item in_w, iw
  18813. Input width.
  18814. @item in_h, ih
  18815. Input height.
  18816. @item out_w, ow
  18817. Output width.
  18818. @item out_h, oh
  18819. Output height.
  18820. @item in
  18821. Input frame count.
  18822. @item on
  18823. Output frame count.
  18824. @item in_time, it
  18825. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  18826. @item out_time, time, ot
  18827. The output timestamp expressed in seconds.
  18828. @item x
  18829. @item y
  18830. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  18831. for current input frame.
  18832. @item px
  18833. @item py
  18834. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  18835. not yet such frame (first input frame).
  18836. @item zoom
  18837. Last calculated zoom from 'z' expression for current input frame.
  18838. @item pzoom
  18839. Last calculated zoom of last output frame of previous input frame.
  18840. @item duration
  18841. Number of output frames for current input frame. Calculated from 'd' expression
  18842. for each input frame.
  18843. @item pduration
  18844. number of output frames created for previous input frame
  18845. @item a
  18846. Rational number: input width / input height
  18847. @item sar
  18848. sample aspect ratio
  18849. @item dar
  18850. display aspect ratio
  18851. @end table
  18852. @subsection Examples
  18853. @itemize
  18854. @item
  18855. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  18856. @example
  18857. 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
  18858. @end example
  18859. @item
  18860. Zoom in up to 1.5x and pan always at center of picture:
  18861. @example
  18862. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  18863. @end example
  18864. @item
  18865. Same as above but without pausing:
  18866. @example
  18867. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  18868. @end example
  18869. @item
  18870. Zoom in 2x into center of picture only for the first second of the input video:
  18871. @example
  18872. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  18873. @end example
  18874. @end itemize
  18875. @anchor{zscale}
  18876. @section zscale
  18877. Scale (resize) the input video, using the z.lib library:
  18878. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  18879. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  18880. The zscale filter forces the output display aspect ratio to be the same
  18881. as the input, by changing the output sample aspect ratio.
  18882. If the input image format is different from the format requested by
  18883. the next filter, the zscale filter will convert the input to the
  18884. requested format.
  18885. @subsection Options
  18886. The filter accepts the following options.
  18887. @table @option
  18888. @item width, w
  18889. @item height, h
  18890. Set the output video dimension expression. Default value is the input
  18891. dimension.
  18892. If the @var{width} or @var{w} value is 0, the input width is used for
  18893. the output. If the @var{height} or @var{h} value is 0, the input height
  18894. is used for the output.
  18895. If one and only one of the values is -n with n >= 1, the zscale filter
  18896. will use a value that maintains the aspect ratio of the input image,
  18897. calculated from the other specified dimension. After that it will,
  18898. however, make sure that the calculated dimension is divisible by n and
  18899. adjust the value if necessary.
  18900. If both values are -n with n >= 1, the behavior will be identical to
  18901. both values being set to 0 as previously detailed.
  18902. See below for the list of accepted constants for use in the dimension
  18903. expression.
  18904. @item size, s
  18905. Set the video size. For the syntax of this option, check the
  18906. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18907. @item dither, d
  18908. Set the dither type.
  18909. Possible values are:
  18910. @table @var
  18911. @item none
  18912. @item ordered
  18913. @item random
  18914. @item error_diffusion
  18915. @end table
  18916. Default is none.
  18917. @item filter, f
  18918. Set the resize filter type.
  18919. Possible values are:
  18920. @table @var
  18921. @item point
  18922. @item bilinear
  18923. @item bicubic
  18924. @item spline16
  18925. @item spline36
  18926. @item lanczos
  18927. @end table
  18928. Default is bilinear.
  18929. @item range, r
  18930. Set the color range.
  18931. Possible values are:
  18932. @table @var
  18933. @item input
  18934. @item limited
  18935. @item full
  18936. @end table
  18937. Default is same as input.
  18938. @item primaries, p
  18939. Set the color primaries.
  18940. Possible values are:
  18941. @table @var
  18942. @item input
  18943. @item 709
  18944. @item unspecified
  18945. @item 170m
  18946. @item 240m
  18947. @item 2020
  18948. @end table
  18949. Default is same as input.
  18950. @item transfer, t
  18951. Set the transfer characteristics.
  18952. Possible values are:
  18953. @table @var
  18954. @item input
  18955. @item 709
  18956. @item unspecified
  18957. @item 601
  18958. @item linear
  18959. @item 2020_10
  18960. @item 2020_12
  18961. @item smpte2084
  18962. @item iec61966-2-1
  18963. @item arib-std-b67
  18964. @end table
  18965. Default is same as input.
  18966. @item matrix, m
  18967. Set the colorspace matrix.
  18968. Possible value are:
  18969. @table @var
  18970. @item input
  18971. @item 709
  18972. @item unspecified
  18973. @item 470bg
  18974. @item 170m
  18975. @item 2020_ncl
  18976. @item 2020_cl
  18977. @end table
  18978. Default is same as input.
  18979. @item rangein, rin
  18980. Set the input color range.
  18981. Possible values are:
  18982. @table @var
  18983. @item input
  18984. @item limited
  18985. @item full
  18986. @end table
  18987. Default is same as input.
  18988. @item primariesin, pin
  18989. Set the input color primaries.
  18990. Possible values are:
  18991. @table @var
  18992. @item input
  18993. @item 709
  18994. @item unspecified
  18995. @item 170m
  18996. @item 240m
  18997. @item 2020
  18998. @end table
  18999. Default is same as input.
  19000. @item transferin, tin
  19001. Set the input transfer characteristics.
  19002. Possible values are:
  19003. @table @var
  19004. @item input
  19005. @item 709
  19006. @item unspecified
  19007. @item 601
  19008. @item linear
  19009. @item 2020_10
  19010. @item 2020_12
  19011. @end table
  19012. Default is same as input.
  19013. @item matrixin, min
  19014. Set the input colorspace matrix.
  19015. Possible value are:
  19016. @table @var
  19017. @item input
  19018. @item 709
  19019. @item unspecified
  19020. @item 470bg
  19021. @item 170m
  19022. @item 2020_ncl
  19023. @item 2020_cl
  19024. @end table
  19025. @item chromal, c
  19026. Set the output chroma location.
  19027. Possible values are:
  19028. @table @var
  19029. @item input
  19030. @item left
  19031. @item center
  19032. @item topleft
  19033. @item top
  19034. @item bottomleft
  19035. @item bottom
  19036. @end table
  19037. @item chromalin, cin
  19038. Set the input chroma location.
  19039. Possible values are:
  19040. @table @var
  19041. @item input
  19042. @item left
  19043. @item center
  19044. @item topleft
  19045. @item top
  19046. @item bottomleft
  19047. @item bottom
  19048. @end table
  19049. @item npl
  19050. Set the nominal peak luminance.
  19051. @item param_a
  19052. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  19053. filter taps for lanczos.
  19054. @item param_b
  19055. Parameter B for scaling filters. Parameter "c" for bicubic.
  19056. @end table
  19057. The values of the @option{w} and @option{h} options are expressions
  19058. containing the following constants:
  19059. @table @var
  19060. @item in_w
  19061. @item in_h
  19062. The input width and height
  19063. @item iw
  19064. @item ih
  19065. These are the same as @var{in_w} and @var{in_h}.
  19066. @item out_w
  19067. @item out_h
  19068. The output (scaled) width and height
  19069. @item ow
  19070. @item oh
  19071. These are the same as @var{out_w} and @var{out_h}
  19072. @item a
  19073. The same as @var{iw} / @var{ih}
  19074. @item sar
  19075. input sample aspect ratio
  19076. @item dar
  19077. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  19078. @item hsub
  19079. @item vsub
  19080. horizontal and vertical input chroma subsample values. For example for the
  19081. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19082. @item ohsub
  19083. @item ovsub
  19084. horizontal and vertical output chroma subsample values. For example for the
  19085. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19086. @end table
  19087. @subsection Commands
  19088. This filter supports the following commands:
  19089. @table @option
  19090. @item width, w
  19091. @item height, h
  19092. Set the output video dimension expression.
  19093. The command accepts the same syntax of the corresponding option.
  19094. If the specified expression is not valid, it is kept at its current
  19095. value.
  19096. @end table
  19097. @c man end VIDEO FILTERS
  19098. @chapter OpenCL Video Filters
  19099. @c man begin OPENCL VIDEO FILTERS
  19100. Below is a description of the currently available OpenCL video filters.
  19101. To enable compilation of these filters you need to configure FFmpeg with
  19102. @code{--enable-opencl}.
  19103. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  19104. @table @option
  19105. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  19106. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  19107. given device parameters.
  19108. @item -filter_hw_device @var{name}
  19109. Pass the hardware device called @var{name} to all filters in any filter graph.
  19110. @end table
  19111. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  19112. @itemize
  19113. @item
  19114. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  19115. @example
  19116. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  19117. @end example
  19118. @end itemize
  19119. 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.
  19120. @section avgblur_opencl
  19121. Apply average blur filter.
  19122. The filter accepts the following options:
  19123. @table @option
  19124. @item sizeX
  19125. Set horizontal radius size.
  19126. Range is @code{[1, 1024]} and default value is @code{1}.
  19127. @item planes
  19128. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19129. @item sizeY
  19130. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  19131. @end table
  19132. @subsection Example
  19133. @itemize
  19134. @item
  19135. 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.
  19136. @example
  19137. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  19138. @end example
  19139. @end itemize
  19140. @section boxblur_opencl
  19141. Apply a boxblur algorithm to the input video.
  19142. It accepts the following parameters:
  19143. @table @option
  19144. @item luma_radius, lr
  19145. @item luma_power, lp
  19146. @item chroma_radius, cr
  19147. @item chroma_power, cp
  19148. @item alpha_radius, ar
  19149. @item alpha_power, ap
  19150. @end table
  19151. A description of the accepted options follows.
  19152. @table @option
  19153. @item luma_radius, lr
  19154. @item chroma_radius, cr
  19155. @item alpha_radius, ar
  19156. Set an expression for the box radius in pixels used for blurring the
  19157. corresponding input plane.
  19158. The radius value must be a non-negative number, and must not be
  19159. greater than the value of the expression @code{min(w,h)/2} for the
  19160. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  19161. planes.
  19162. Default value for @option{luma_radius} is "2". If not specified,
  19163. @option{chroma_radius} and @option{alpha_radius} default to the
  19164. corresponding value set for @option{luma_radius}.
  19165. The expressions can contain the following constants:
  19166. @table @option
  19167. @item w
  19168. @item h
  19169. The input width and height in pixels.
  19170. @item cw
  19171. @item ch
  19172. The input chroma image width and height in pixels.
  19173. @item hsub
  19174. @item vsub
  19175. The horizontal and vertical chroma subsample values. For example, for the
  19176. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  19177. @end table
  19178. @item luma_power, lp
  19179. @item chroma_power, cp
  19180. @item alpha_power, ap
  19181. Specify how many times the boxblur filter is applied to the
  19182. corresponding plane.
  19183. Default value for @option{luma_power} is 2. If not specified,
  19184. @option{chroma_power} and @option{alpha_power} default to the
  19185. corresponding value set for @option{luma_power}.
  19186. A value of 0 will disable the effect.
  19187. @end table
  19188. @subsection Examples
  19189. 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.
  19190. @itemize
  19191. @item
  19192. Apply a boxblur filter with the luma, chroma, and alpha radius
  19193. 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.
  19194. @example
  19195. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  19196. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  19197. @end example
  19198. @item
  19199. 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.
  19200. For the luma plane, a 2x2 box radius will be run once.
  19201. For the chroma plane, a 4x4 box radius will be run 5 times.
  19202. For the alpha plane, a 3x3 box radius will be run 7 times.
  19203. @example
  19204. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  19205. @end example
  19206. @end itemize
  19207. @section colorkey_opencl
  19208. RGB colorspace color keying.
  19209. The filter accepts the following options:
  19210. @table @option
  19211. @item color
  19212. The color which will be replaced with transparency.
  19213. @item similarity
  19214. Similarity percentage with the key color.
  19215. 0.01 matches only the exact key color, while 1.0 matches everything.
  19216. @item blend
  19217. Blend percentage.
  19218. 0.0 makes pixels either fully transparent, or not transparent at all.
  19219. Higher values result in semi-transparent pixels, with a higher transparency
  19220. the more similar the pixels color is to the key color.
  19221. @end table
  19222. @subsection Examples
  19223. @itemize
  19224. @item
  19225. Make every semi-green pixel in the input transparent with some slight blending:
  19226. @example
  19227. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  19228. @end example
  19229. @end itemize
  19230. @section convolution_opencl
  19231. Apply convolution of 3x3, 5x5, 7x7 matrix.
  19232. The filter accepts the following options:
  19233. @table @option
  19234. @item 0m
  19235. @item 1m
  19236. @item 2m
  19237. @item 3m
  19238. Set matrix for each plane.
  19239. Matrix is sequence of 9, 25 or 49 signed numbers.
  19240. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  19241. @item 0rdiv
  19242. @item 1rdiv
  19243. @item 2rdiv
  19244. @item 3rdiv
  19245. Set multiplier for calculated value for each plane.
  19246. If unset or 0, it will be sum of all matrix elements.
  19247. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  19248. @item 0bias
  19249. @item 1bias
  19250. @item 2bias
  19251. @item 3bias
  19252. Set bias for each plane. This value is added to the result of the multiplication.
  19253. Useful for making the overall image brighter or darker.
  19254. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  19255. @end table
  19256. @subsection Examples
  19257. @itemize
  19258. @item
  19259. Apply sharpen:
  19260. @example
  19261. -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
  19262. @end example
  19263. @item
  19264. Apply blur:
  19265. @example
  19266. -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
  19267. @end example
  19268. @item
  19269. Apply edge enhance:
  19270. @example
  19271. -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
  19272. @end example
  19273. @item
  19274. Apply edge detect:
  19275. @example
  19276. -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
  19277. @end example
  19278. @item
  19279. Apply laplacian edge detector which includes diagonals:
  19280. @example
  19281. -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
  19282. @end example
  19283. @item
  19284. Apply emboss:
  19285. @example
  19286. -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
  19287. @end example
  19288. @end itemize
  19289. @section erosion_opencl
  19290. Apply erosion effect to the video.
  19291. This filter replaces the pixel by the local(3x3) minimum.
  19292. It accepts the following options:
  19293. @table @option
  19294. @item threshold0
  19295. @item threshold1
  19296. @item threshold2
  19297. @item threshold3
  19298. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19299. If @code{0}, plane will remain unchanged.
  19300. @item coordinates
  19301. Flag which specifies the pixel to refer to.
  19302. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19303. Flags to local 3x3 coordinates region centered on @code{x}:
  19304. 1 2 3
  19305. 4 x 5
  19306. 6 7 8
  19307. @end table
  19308. @subsection Example
  19309. @itemize
  19310. @item
  19311. 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.
  19312. @example
  19313. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19314. @end example
  19315. @end itemize
  19316. @section deshake_opencl
  19317. Feature-point based video stabilization filter.
  19318. The filter accepts the following options:
  19319. @table @option
  19320. @item tripod
  19321. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  19322. @item debug
  19323. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  19324. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  19325. Viewing point matches in the output video is only supported for RGB input.
  19326. Defaults to @code{0}.
  19327. @item adaptive_crop
  19328. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  19329. Defaults to @code{1}.
  19330. @item refine_features
  19331. Whether or not feature points should be refined at a sub-pixel level.
  19332. This can be turned off for a slight performance gain at the cost of precision.
  19333. Defaults to @code{1}.
  19334. @item smooth_strength
  19335. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  19336. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  19337. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  19338. Defaults to @code{0.0}.
  19339. @item smooth_window_multiplier
  19340. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  19341. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  19342. Acceptable values range from @code{0.1} to @code{10.0}.
  19343. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  19344. potentially improving smoothness, but also increase latency and memory usage.
  19345. Defaults to @code{2.0}.
  19346. @end table
  19347. @subsection Examples
  19348. @itemize
  19349. @item
  19350. Stabilize a video with a fixed, medium smoothing strength:
  19351. @example
  19352. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  19353. @end example
  19354. @item
  19355. Stabilize a video with debugging (both in console and in rendered video):
  19356. @example
  19357. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  19358. @end example
  19359. @end itemize
  19360. @section dilation_opencl
  19361. Apply dilation effect to the video.
  19362. This filter replaces the pixel by the local(3x3) maximum.
  19363. It accepts the following options:
  19364. @table @option
  19365. @item threshold0
  19366. @item threshold1
  19367. @item threshold2
  19368. @item threshold3
  19369. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19370. If @code{0}, plane will remain unchanged.
  19371. @item coordinates
  19372. Flag which specifies the pixel to refer to.
  19373. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19374. Flags to local 3x3 coordinates region centered on @code{x}:
  19375. 1 2 3
  19376. 4 x 5
  19377. 6 7 8
  19378. @end table
  19379. @subsection Example
  19380. @itemize
  19381. @item
  19382. 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.
  19383. @example
  19384. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19385. @end example
  19386. @end itemize
  19387. @section nlmeans_opencl
  19388. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  19389. @section overlay_opencl
  19390. Overlay one video on top of another.
  19391. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  19392. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  19393. The filter accepts the following options:
  19394. @table @option
  19395. @item x
  19396. Set the x coordinate of the overlaid video on the main video.
  19397. Default value is @code{0}.
  19398. @item y
  19399. Set the y coordinate of the overlaid video on the main video.
  19400. Default value is @code{0}.
  19401. @end table
  19402. @subsection Examples
  19403. @itemize
  19404. @item
  19405. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  19406. @example
  19407. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19408. @end example
  19409. @item
  19410. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  19411. @example
  19412. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19413. @end example
  19414. @end itemize
  19415. @section pad_opencl
  19416. Add paddings to the input image, and place the original input at the
  19417. provided @var{x}, @var{y} coordinates.
  19418. It accepts the following options:
  19419. @table @option
  19420. @item width, w
  19421. @item height, h
  19422. Specify an expression for the size of the output image with the
  19423. paddings added. If the value for @var{width} or @var{height} is 0, the
  19424. corresponding input size is used for the output.
  19425. The @var{width} expression can reference the value set by the
  19426. @var{height} expression, and vice versa.
  19427. The default value of @var{width} and @var{height} is 0.
  19428. @item x
  19429. @item y
  19430. Specify the offsets to place the input image at within the padded area,
  19431. with respect to the top/left border of the output image.
  19432. The @var{x} expression can reference the value set by the @var{y}
  19433. expression, and vice versa.
  19434. The default value of @var{x} and @var{y} is 0.
  19435. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  19436. so the input image is centered on the padded area.
  19437. @item color
  19438. Specify the color of the padded area. For the syntax of this option,
  19439. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  19440. manual,ffmpeg-utils}.
  19441. @item aspect
  19442. Pad to an aspect instead to a resolution.
  19443. @end table
  19444. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  19445. options are expressions containing the following constants:
  19446. @table @option
  19447. @item in_w
  19448. @item in_h
  19449. The input video width and height.
  19450. @item iw
  19451. @item ih
  19452. These are the same as @var{in_w} and @var{in_h}.
  19453. @item out_w
  19454. @item out_h
  19455. The output width and height (the size of the padded area), as
  19456. specified by the @var{width} and @var{height} expressions.
  19457. @item ow
  19458. @item oh
  19459. These are the same as @var{out_w} and @var{out_h}.
  19460. @item x
  19461. @item y
  19462. The x and y offsets as specified by the @var{x} and @var{y}
  19463. expressions, or NAN if not yet specified.
  19464. @item a
  19465. same as @var{iw} / @var{ih}
  19466. @item sar
  19467. input sample aspect ratio
  19468. @item dar
  19469. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  19470. @end table
  19471. @section prewitt_opencl
  19472. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  19473. The filter accepts the following option:
  19474. @table @option
  19475. @item planes
  19476. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19477. @item scale
  19478. Set value which will be multiplied with filtered result.
  19479. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19480. @item delta
  19481. Set value which will be added to filtered result.
  19482. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19483. @end table
  19484. @subsection Example
  19485. @itemize
  19486. @item
  19487. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  19488. @example
  19489. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19490. @end example
  19491. @end itemize
  19492. @anchor{program_opencl}
  19493. @section program_opencl
  19494. Filter video using an OpenCL program.
  19495. @table @option
  19496. @item source
  19497. OpenCL program source file.
  19498. @item kernel
  19499. Kernel name in program.
  19500. @item inputs
  19501. Number of inputs to the filter. Defaults to 1.
  19502. @item size, s
  19503. Size of output frames. Defaults to the same as the first input.
  19504. @end table
  19505. The @code{program_opencl} filter also supports the @ref{framesync} options.
  19506. The program source file must contain a kernel function with the given name,
  19507. which will be run once for each plane of the output. Each run on a plane
  19508. gets enqueued as a separate 2D global NDRange with one work-item for each
  19509. pixel to be generated. The global ID offset for each work-item is therefore
  19510. the coordinates of a pixel in the destination image.
  19511. The kernel function needs to take the following arguments:
  19512. @itemize
  19513. @item
  19514. Destination image, @var{__write_only image2d_t}.
  19515. This image will become the output; the kernel should write all of it.
  19516. @item
  19517. Frame index, @var{unsigned int}.
  19518. This is a counter starting from zero and increasing by one for each frame.
  19519. @item
  19520. Source images, @var{__read_only image2d_t}.
  19521. These are the most recent images on each input. The kernel may read from
  19522. them to generate the output, but they can't be written to.
  19523. @end itemize
  19524. Example programs:
  19525. @itemize
  19526. @item
  19527. Copy the input to the output (output must be the same size as the input).
  19528. @verbatim
  19529. __kernel void copy(__write_only image2d_t destination,
  19530. unsigned int index,
  19531. __read_only image2d_t source)
  19532. {
  19533. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  19534. int2 location = (int2)(get_global_id(0), get_global_id(1));
  19535. float4 value = read_imagef(source, sampler, location);
  19536. write_imagef(destination, location, value);
  19537. }
  19538. @end verbatim
  19539. @item
  19540. Apply a simple transformation, rotating the input by an amount increasing
  19541. with the index counter. Pixel values are linearly interpolated by the
  19542. sampler, and the output need not have the same dimensions as the input.
  19543. @verbatim
  19544. __kernel void rotate_image(__write_only image2d_t dst,
  19545. unsigned int index,
  19546. __read_only image2d_t src)
  19547. {
  19548. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19549. CLK_FILTER_LINEAR);
  19550. float angle = (float)index / 100.0f;
  19551. float2 dst_dim = convert_float2(get_image_dim(dst));
  19552. float2 src_dim = convert_float2(get_image_dim(src));
  19553. float2 dst_cen = dst_dim / 2.0f;
  19554. float2 src_cen = src_dim / 2.0f;
  19555. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19556. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  19557. float2 src_pos = {
  19558. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  19559. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  19560. };
  19561. src_pos = src_pos * src_dim / dst_dim;
  19562. float2 src_loc = src_pos + src_cen;
  19563. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  19564. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  19565. write_imagef(dst, dst_loc, 0.5f);
  19566. else
  19567. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  19568. }
  19569. @end verbatim
  19570. @item
  19571. Blend two inputs together, with the amount of each input used varying
  19572. with the index counter.
  19573. @verbatim
  19574. __kernel void blend_images(__write_only image2d_t dst,
  19575. unsigned int index,
  19576. __read_only image2d_t src1,
  19577. __read_only image2d_t src2)
  19578. {
  19579. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19580. CLK_FILTER_LINEAR);
  19581. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  19582. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19583. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  19584. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  19585. float4 val1 = read_imagef(src1, sampler, src1_loc);
  19586. float4 val2 = read_imagef(src2, sampler, src2_loc);
  19587. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  19588. }
  19589. @end verbatim
  19590. @end itemize
  19591. @section remap_opencl
  19592. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  19593. Destination pixel at position (X, Y) will be picked from source (x, y) position
  19594. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  19595. value for pixel will be used for destination pixel.
  19596. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  19597. will have Xmap/Ymap video stream dimensions.
  19598. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  19599. @table @option
  19600. @item interp
  19601. Specify interpolation used for remapping of pixels.
  19602. Allowed values are @code{near} and @code{linear}.
  19603. Default value is @code{linear}.
  19604. @item fill
  19605. Specify the color of the unmapped pixels. For the syntax of this option,
  19606. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  19607. manual,ffmpeg-utils}. Default color is @code{black}.
  19608. @end table
  19609. @section roberts_opencl
  19610. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  19611. The filter accepts the following option:
  19612. @table @option
  19613. @item planes
  19614. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19615. @item scale
  19616. Set value which will be multiplied with filtered result.
  19617. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19618. @item delta
  19619. Set value which will be added to filtered result.
  19620. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19621. @end table
  19622. @subsection Example
  19623. @itemize
  19624. @item
  19625. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  19626. @example
  19627. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19628. @end example
  19629. @end itemize
  19630. @section sobel_opencl
  19631. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  19632. The filter accepts the following option:
  19633. @table @option
  19634. @item planes
  19635. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19636. @item scale
  19637. Set value which will be multiplied with filtered result.
  19638. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19639. @item delta
  19640. Set value which will be added to filtered result.
  19641. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19642. @end table
  19643. @subsection Example
  19644. @itemize
  19645. @item
  19646. Apply sobel operator with scale set to 2 and delta set to 10
  19647. @example
  19648. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19649. @end example
  19650. @end itemize
  19651. @section tonemap_opencl
  19652. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  19653. It accepts the following parameters:
  19654. @table @option
  19655. @item tonemap
  19656. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  19657. @item param
  19658. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  19659. @item desat
  19660. Apply desaturation for highlights that exceed this level of brightness. The
  19661. higher the parameter, the more color information will be preserved. This
  19662. setting helps prevent unnaturally blown-out colors for super-highlights, by
  19663. (smoothly) turning into white instead. This makes images feel more natural,
  19664. at the cost of reducing information about out-of-range colors.
  19665. The default value is 0.5, and the algorithm here is a little different from
  19666. the cpu version tonemap currently. A setting of 0.0 disables this option.
  19667. @item threshold
  19668. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  19669. is used to detect whether the scene has changed or not. If the distance between
  19670. the current frame average brightness and the current running average exceeds
  19671. a threshold value, we would re-calculate scene average and peak brightness.
  19672. The default value is 0.2.
  19673. @item format
  19674. Specify the output pixel format.
  19675. Currently supported formats are:
  19676. @table @var
  19677. @item p010
  19678. @item nv12
  19679. @end table
  19680. @item range, r
  19681. Set the output color range.
  19682. Possible values are:
  19683. @table @var
  19684. @item tv/mpeg
  19685. @item pc/jpeg
  19686. @end table
  19687. Default is same as input.
  19688. @item primaries, p
  19689. Set the output color primaries.
  19690. Possible values are:
  19691. @table @var
  19692. @item bt709
  19693. @item bt2020
  19694. @end table
  19695. Default is same as input.
  19696. @item transfer, t
  19697. Set the output transfer characteristics.
  19698. Possible values are:
  19699. @table @var
  19700. @item bt709
  19701. @item bt2020
  19702. @end table
  19703. Default is bt709.
  19704. @item matrix, m
  19705. Set the output colorspace matrix.
  19706. Possible value are:
  19707. @table @var
  19708. @item bt709
  19709. @item bt2020
  19710. @end table
  19711. Default is same as input.
  19712. @end table
  19713. @subsection Example
  19714. @itemize
  19715. @item
  19716. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  19717. @example
  19718. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  19719. @end example
  19720. @end itemize
  19721. @section unsharp_opencl
  19722. Sharpen or blur the input video.
  19723. It accepts the following parameters:
  19724. @table @option
  19725. @item luma_msize_x, lx
  19726. Set the luma matrix horizontal size.
  19727. Range is @code{[1, 23]} and default value is @code{5}.
  19728. @item luma_msize_y, ly
  19729. Set the luma matrix vertical size.
  19730. Range is @code{[1, 23]} and default value is @code{5}.
  19731. @item luma_amount, la
  19732. Set the luma effect strength.
  19733. Range is @code{[-10, 10]} and default value is @code{1.0}.
  19734. Negative values will blur the input video, while positive values will
  19735. sharpen it, a value of zero will disable the effect.
  19736. @item chroma_msize_x, cx
  19737. Set the chroma matrix horizontal size.
  19738. Range is @code{[1, 23]} and default value is @code{5}.
  19739. @item chroma_msize_y, cy
  19740. Set the chroma matrix vertical size.
  19741. Range is @code{[1, 23]} and default value is @code{5}.
  19742. @item chroma_amount, ca
  19743. Set the chroma effect strength.
  19744. Range is @code{[-10, 10]} and default value is @code{0.0}.
  19745. Negative values will blur the input video, while positive values will
  19746. sharpen it, a value of zero will disable the effect.
  19747. @end table
  19748. All parameters are optional and default to the equivalent of the
  19749. string '5:5:1.0:5:5:0.0'.
  19750. @subsection Examples
  19751. @itemize
  19752. @item
  19753. Apply strong luma sharpen effect:
  19754. @example
  19755. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  19756. @end example
  19757. @item
  19758. Apply a strong blur of both luma and chroma parameters:
  19759. @example
  19760. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  19761. @end example
  19762. @end itemize
  19763. @section xfade_opencl
  19764. Cross fade two videos with custom transition effect by using OpenCL.
  19765. It accepts the following options:
  19766. @table @option
  19767. @item transition
  19768. Set one of possible transition effects.
  19769. @table @option
  19770. @item custom
  19771. Select custom transition effect, the actual transition description
  19772. will be picked from source and kernel options.
  19773. @item fade
  19774. @item wipeleft
  19775. @item wiperight
  19776. @item wipeup
  19777. @item wipedown
  19778. @item slideleft
  19779. @item slideright
  19780. @item slideup
  19781. @item slidedown
  19782. Default transition is fade.
  19783. @end table
  19784. @item source
  19785. OpenCL program source file for custom transition.
  19786. @item kernel
  19787. Set name of kernel to use for custom transition from program source file.
  19788. @item duration
  19789. Set duration of video transition.
  19790. @item offset
  19791. Set time of start of transition relative to first video.
  19792. @end table
  19793. The program source file must contain a kernel function with the given name,
  19794. which will be run once for each plane of the output. Each run on a plane
  19795. gets enqueued as a separate 2D global NDRange with one work-item for each
  19796. pixel to be generated. The global ID offset for each work-item is therefore
  19797. the coordinates of a pixel in the destination image.
  19798. The kernel function needs to take the following arguments:
  19799. @itemize
  19800. @item
  19801. Destination image, @var{__write_only image2d_t}.
  19802. This image will become the output; the kernel should write all of it.
  19803. @item
  19804. First Source image, @var{__read_only image2d_t}.
  19805. Second Source image, @var{__read_only image2d_t}.
  19806. These are the most recent images on each input. The kernel may read from
  19807. them to generate the output, but they can't be written to.
  19808. @item
  19809. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  19810. @end itemize
  19811. Example programs:
  19812. @itemize
  19813. @item
  19814. Apply dots curtain transition effect:
  19815. @verbatim
  19816. __kernel void blend_images(__write_only image2d_t dst,
  19817. __read_only image2d_t src1,
  19818. __read_only image2d_t src2,
  19819. float progress)
  19820. {
  19821. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19822. CLK_FILTER_LINEAR);
  19823. int2 p = (int2)(get_global_id(0), get_global_id(1));
  19824. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  19825. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  19826. rp = rp / dim;
  19827. float2 dots = (float2)(20.0, 20.0);
  19828. float2 center = (float2)(0,0);
  19829. float2 unused;
  19830. float4 val1 = read_imagef(src1, sampler, p);
  19831. float4 val2 = read_imagef(src2, sampler, p);
  19832. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  19833. write_imagef(dst, p, next ? val1 : val2);
  19834. }
  19835. @end verbatim
  19836. @end itemize
  19837. @c man end OPENCL VIDEO FILTERS
  19838. @chapter VAAPI Video Filters
  19839. @c man begin VAAPI VIDEO FILTERS
  19840. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  19841. To enable compilation of these filters you need to configure FFmpeg with
  19842. @code{--enable-vaapi}.
  19843. 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}
  19844. @section overlay_vaapi
  19845. Overlay one video on the top of another.
  19846. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  19847. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  19848. The filter accepts the following options:
  19849. @table @option
  19850. @item x
  19851. Set the x coordinate of the overlaid video on the main video.
  19852. Default value is @code{0}.
  19853. @item y
  19854. Set the y coordinate of the overlaid video on the main video.
  19855. Default value is @code{0}.
  19856. @item w
  19857. Set the width of the overlaid video on the main video.
  19858. Default value is the width of input overlay video.
  19859. @item h
  19860. Set the height of the overlaid video on the main video.
  19861. Default value is the height of input overlay video.
  19862. @item alpha
  19863. Set blocking detection thresholds. Allowed range is 0.0 to 1.0, it
  19864. requires an input video with alpha channel.
  19865. Default value is @code{0.0}.
  19866. @end table
  19867. @subsection Examples
  19868. @itemize
  19869. @item
  19870. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  19871. @example
  19872. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  19873. @end example
  19874. @item
  19875. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  19876. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  19877. @example
  19878. -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
  19879. @end example
  19880. @end itemize
  19881. @section tonemap_vaapi
  19882. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  19883. It maps the dynamic range of HDR10 content to the SDR content.
  19884. It currently only accepts HDR10 as input.
  19885. It accepts the following parameters:
  19886. @table @option
  19887. @item format
  19888. Specify the output pixel format.
  19889. Currently supported formats are:
  19890. @table @var
  19891. @item p010
  19892. @item nv12
  19893. @end table
  19894. Default is nv12.
  19895. @item primaries, p
  19896. Set the output color primaries.
  19897. Default is same as input.
  19898. @item transfer, t
  19899. Set the output transfer characteristics.
  19900. Default is bt709.
  19901. @item matrix, m
  19902. Set the output colorspace matrix.
  19903. Default is same as input.
  19904. @end table
  19905. @subsection Example
  19906. @itemize
  19907. @item
  19908. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  19909. @example
  19910. tonemap_vaapi=format=p010:t=bt2020-10
  19911. @end example
  19912. @end itemize
  19913. @c man end VAAPI VIDEO FILTERS
  19914. @chapter Video Sources
  19915. @c man begin VIDEO SOURCES
  19916. Below is a description of the currently available video sources.
  19917. @section buffer
  19918. Buffer video frames, and make them available to the filter chain.
  19919. This source is mainly intended for a programmatic use, in particular
  19920. through the interface defined in @file{libavfilter/buffersrc.h}.
  19921. It accepts the following parameters:
  19922. @table @option
  19923. @item video_size
  19924. Specify the size (width and height) of the buffered video frames. For the
  19925. syntax of this option, check the
  19926. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19927. @item width
  19928. The input video width.
  19929. @item height
  19930. The input video height.
  19931. @item pix_fmt
  19932. A string representing the pixel format of the buffered video frames.
  19933. It may be a number corresponding to a pixel format, or a pixel format
  19934. name.
  19935. @item time_base
  19936. Specify the timebase assumed by the timestamps of the buffered frames.
  19937. @item frame_rate
  19938. Specify the frame rate expected for the video stream.
  19939. @item pixel_aspect, sar
  19940. The sample (pixel) aspect ratio of the input video.
  19941. @item sws_param
  19942. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  19943. to the filtergraph description to specify swscale flags for automatically
  19944. inserted scalers. See @ref{Filtergraph syntax}.
  19945. @item hw_frames_ctx
  19946. When using a hardware pixel format, this should be a reference to an
  19947. AVHWFramesContext describing input frames.
  19948. @end table
  19949. For example:
  19950. @example
  19951. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  19952. @end example
  19953. will instruct the source to accept video frames with size 320x240 and
  19954. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  19955. square pixels (1:1 sample aspect ratio).
  19956. Since the pixel format with name "yuv410p" corresponds to the number 6
  19957. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  19958. this example corresponds to:
  19959. @example
  19960. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  19961. @end example
  19962. Alternatively, the options can be specified as a flat string, but this
  19963. syntax is deprecated:
  19964. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  19965. @section cellauto
  19966. Create a pattern generated by an elementary cellular automaton.
  19967. The initial state of the cellular automaton can be defined through the
  19968. @option{filename} and @option{pattern} options. If such options are
  19969. not specified an initial state is created randomly.
  19970. At each new frame a new row in the video is filled with the result of
  19971. the cellular automaton next generation. The behavior when the whole
  19972. frame is filled is defined by the @option{scroll} option.
  19973. This source accepts the following options:
  19974. @table @option
  19975. @item filename, f
  19976. Read the initial cellular automaton state, i.e. the starting row, from
  19977. the specified file.
  19978. In the file, each non-whitespace character is considered an alive
  19979. cell, a newline will terminate the row, and further characters in the
  19980. file will be ignored.
  19981. @item pattern, p
  19982. Read the initial cellular automaton state, i.e. the starting row, from
  19983. the specified string.
  19984. Each non-whitespace character in the string is considered an alive
  19985. cell, a newline will terminate the row, and further characters in the
  19986. string will be ignored.
  19987. @item rate, r
  19988. Set the video rate, that is the number of frames generated per second.
  19989. Default is 25.
  19990. @item random_fill_ratio, ratio
  19991. Set the random fill ratio for the initial cellular automaton row. It
  19992. is a floating point number value ranging from 0 to 1, defaults to
  19993. 1/PHI.
  19994. This option is ignored when a file or a pattern is specified.
  19995. @item random_seed, seed
  19996. Set the seed for filling randomly the initial row, must be an integer
  19997. included between 0 and UINT32_MAX. If not specified, or if explicitly
  19998. set to -1, the filter will try to use a good random seed on a best
  19999. effort basis.
  20000. @item rule
  20001. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  20002. Default value is 110.
  20003. @item size, s
  20004. Set the size of the output video. For the syntax of this option, check the
  20005. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20006. If @option{filename} or @option{pattern} is specified, the size is set
  20007. by default to the width of the specified initial state row, and the
  20008. height is set to @var{width} * PHI.
  20009. If @option{size} is set, it must contain the width of the specified
  20010. pattern string, and the specified pattern will be centered in the
  20011. larger row.
  20012. If a filename or a pattern string is not specified, the size value
  20013. defaults to "320x518" (used for a randomly generated initial state).
  20014. @item scroll
  20015. If set to 1, scroll the output upward when all the rows in the output
  20016. have been already filled. If set to 0, the new generated row will be
  20017. written over the top row just after the bottom row is filled.
  20018. Defaults to 1.
  20019. @item start_full, full
  20020. If set to 1, completely fill the output with generated rows before
  20021. outputting the first frame.
  20022. This is the default behavior, for disabling set the value to 0.
  20023. @item stitch
  20024. If set to 1, stitch the left and right row edges together.
  20025. This is the default behavior, for disabling set the value to 0.
  20026. @end table
  20027. @subsection Examples
  20028. @itemize
  20029. @item
  20030. Read the initial state from @file{pattern}, and specify an output of
  20031. size 200x400.
  20032. @example
  20033. cellauto=f=pattern:s=200x400
  20034. @end example
  20035. @item
  20036. Generate a random initial row with a width of 200 cells, with a fill
  20037. ratio of 2/3:
  20038. @example
  20039. cellauto=ratio=2/3:s=200x200
  20040. @end example
  20041. @item
  20042. Create a pattern generated by rule 18 starting by a single alive cell
  20043. centered on an initial row with width 100:
  20044. @example
  20045. cellauto=p=@@:s=100x400:full=0:rule=18
  20046. @end example
  20047. @item
  20048. Specify a more elaborated initial pattern:
  20049. @example
  20050. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  20051. @end example
  20052. @end itemize
  20053. @anchor{coreimagesrc}
  20054. @section coreimagesrc
  20055. Video source generated on GPU using Apple's CoreImage API on OSX.
  20056. This video source is a specialized version of the @ref{coreimage} video filter.
  20057. Use a core image generator at the beginning of the applied filterchain to
  20058. generate the content.
  20059. The coreimagesrc video source accepts the following options:
  20060. @table @option
  20061. @item list_generators
  20062. List all available generators along with all their respective options as well as
  20063. possible minimum and maximum values along with the default values.
  20064. @example
  20065. list_generators=true
  20066. @end example
  20067. @item size, s
  20068. Specify the size of the sourced video. For the syntax of this option, check the
  20069. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20070. The default value is @code{320x240}.
  20071. @item rate, r
  20072. Specify the frame rate of the sourced video, as the number of frames
  20073. generated per second. It has to be a string in the format
  20074. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20075. number or a valid video frame rate abbreviation. The default value is
  20076. "25".
  20077. @item sar
  20078. Set the sample aspect ratio of the sourced video.
  20079. @item duration, d
  20080. Set the duration of the sourced video. See
  20081. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20082. for the accepted syntax.
  20083. If not specified, or the expressed duration is negative, the video is
  20084. supposed to be generated forever.
  20085. @end table
  20086. Additionally, all options of the @ref{coreimage} video filter are accepted.
  20087. A complete filterchain can be used for further processing of the
  20088. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  20089. and examples for details.
  20090. @subsection Examples
  20091. @itemize
  20092. @item
  20093. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  20094. given as complete and escaped command-line for Apple's standard bash shell:
  20095. @example
  20096. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  20097. @end example
  20098. This example is equivalent to the QRCode example of @ref{coreimage} without the
  20099. need for a nullsrc video source.
  20100. @end itemize
  20101. @section gradients
  20102. Generate several gradients.
  20103. @table @option
  20104. @item size, s
  20105. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20106. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20107. @item rate, r
  20108. Set frame rate, expressed as number of frames per second. Default
  20109. value is "25".
  20110. @item c0, c1, c2, c3, c4, c5, c6, c7
  20111. Set 8 colors. Default values for colors is to pick random one.
  20112. @item x0, y0, y0, y1
  20113. Set gradient line source and destination points. If negative or out of range, random ones
  20114. are picked.
  20115. @item nb_colors, n
  20116. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  20117. @item seed
  20118. Set seed for picking gradient line points.
  20119. @item duration, d
  20120. Set the duration of the sourced video. See
  20121. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20122. for the accepted syntax.
  20123. If not specified, or the expressed duration is negative, the video is
  20124. supposed to be generated forever.
  20125. @item speed
  20126. Set speed of gradients rotation.
  20127. @item type, t
  20128. Set type of gradients, can be @code{linear} or @code{radial} or @code{circular} or @code{spiral}.
  20129. @end table
  20130. @section mandelbrot
  20131. Generate a Mandelbrot set fractal, and progressively zoom towards the
  20132. point specified with @var{start_x} and @var{start_y}.
  20133. This source accepts the following options:
  20134. @table @option
  20135. @item end_pts
  20136. Set the terminal pts value. Default value is 400.
  20137. @item end_scale
  20138. Set the terminal scale value.
  20139. Must be a floating point value. Default value is 0.3.
  20140. @item inner
  20141. Set the inner coloring mode, that is the algorithm used to draw the
  20142. Mandelbrot fractal internal region.
  20143. It shall assume one of the following values:
  20144. @table @option
  20145. @item black
  20146. Set black mode.
  20147. @item convergence
  20148. Show time until convergence.
  20149. @item mincol
  20150. Set color based on point closest to the origin of the iterations.
  20151. @item period
  20152. Set period mode.
  20153. @end table
  20154. Default value is @var{mincol}.
  20155. @item bailout
  20156. Set the bailout value. Default value is 10.0.
  20157. @item maxiter
  20158. Set the maximum of iterations performed by the rendering
  20159. algorithm. Default value is 7189.
  20160. @item outer
  20161. Set outer coloring mode.
  20162. It shall assume one of following values:
  20163. @table @option
  20164. @item iteration_count
  20165. Set iteration count mode.
  20166. @item normalized_iteration_count
  20167. set normalized iteration count mode.
  20168. @end table
  20169. Default value is @var{normalized_iteration_count}.
  20170. @item rate, r
  20171. Set frame rate, expressed as number of frames per second. Default
  20172. value is "25".
  20173. @item size, s
  20174. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20175. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20176. @item start_scale
  20177. Set the initial scale value. Default value is 3.0.
  20178. @item start_x
  20179. Set the initial x position. Must be a floating point value between
  20180. -100 and 100. Default value is -0.743643887037158704752191506114774.
  20181. @item start_y
  20182. Set the initial y position. Must be a floating point value between
  20183. -100 and 100. Default value is -0.131825904205311970493132056385139.
  20184. @end table
  20185. @section mptestsrc
  20186. Generate various test patterns, as generated by the MPlayer test filter.
  20187. The size of the generated video is fixed, and is 256x256.
  20188. This source is useful in particular for testing encoding features.
  20189. This source accepts the following options:
  20190. @table @option
  20191. @item rate, r
  20192. Specify the frame rate of the sourced video, as the number of frames
  20193. generated per second. It has to be a string in the format
  20194. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20195. number or a valid video frame rate abbreviation. The default value is
  20196. "25".
  20197. @item duration, d
  20198. Set the duration of the sourced video. See
  20199. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20200. for the accepted syntax.
  20201. If not specified, or the expressed duration is negative, the video is
  20202. supposed to be generated forever.
  20203. @item test, t
  20204. Set the number or the name of the test to perform. Supported tests are:
  20205. @table @option
  20206. @item dc_luma
  20207. @item dc_chroma
  20208. @item freq_luma
  20209. @item freq_chroma
  20210. @item amp_luma
  20211. @item amp_chroma
  20212. @item cbp
  20213. @item mv
  20214. @item ring1
  20215. @item ring2
  20216. @item all
  20217. @item max_frames, m
  20218. Set the maximum number of frames generated for each test, default value is 30.
  20219. @end table
  20220. Default value is "all", which will cycle through the list of all tests.
  20221. @end table
  20222. Some examples:
  20223. @example
  20224. mptestsrc=t=dc_luma
  20225. @end example
  20226. will generate a "dc_luma" test pattern.
  20227. @section frei0r_src
  20228. Provide a frei0r source.
  20229. To enable compilation of this filter you need to install the frei0r
  20230. header and configure FFmpeg with @code{--enable-frei0r}.
  20231. This source accepts the following parameters:
  20232. @table @option
  20233. @item size
  20234. The size of the video to generate. For the syntax of this option, check the
  20235. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20236. @item framerate
  20237. The framerate of the generated video. It may be a string of the form
  20238. @var{num}/@var{den} or a frame rate abbreviation.
  20239. @item filter_name
  20240. The name to the frei0r source to load. For more information regarding frei0r and
  20241. how to set the parameters, read the @ref{frei0r} section in the video filters
  20242. documentation.
  20243. @item filter_params
  20244. A '|'-separated list of parameters to pass to the frei0r source.
  20245. @end table
  20246. For example, to generate a frei0r partik0l source with size 200x200
  20247. and frame rate 10 which is overlaid on the overlay filter main input:
  20248. @example
  20249. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  20250. @end example
  20251. @section life
  20252. Generate a life pattern.
  20253. This source is based on a generalization of John Conway's life game.
  20254. The sourced input represents a life grid, each pixel represents a cell
  20255. which can be in one of two possible states, alive or dead. Every cell
  20256. interacts with its eight neighbours, which are the cells that are
  20257. horizontally, vertically, or diagonally adjacent.
  20258. At each interaction the grid evolves according to the adopted rule,
  20259. which specifies the number of neighbor alive cells which will make a
  20260. cell stay alive or born. The @option{rule} option allows one to specify
  20261. the rule to adopt.
  20262. This source accepts the following options:
  20263. @table @option
  20264. @item filename, f
  20265. Set the file from which to read the initial grid state. In the file,
  20266. each non-whitespace character is considered an alive cell, and newline
  20267. is used to delimit the end of each row.
  20268. If this option is not specified, the initial grid is generated
  20269. randomly.
  20270. @item rate, r
  20271. Set the video rate, that is the number of frames generated per second.
  20272. Default is 25.
  20273. @item random_fill_ratio, ratio
  20274. Set the random fill ratio for the initial random grid. It is a
  20275. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  20276. It is ignored when a file is specified.
  20277. @item random_seed, seed
  20278. Set the seed for filling the initial random grid, must be an integer
  20279. included between 0 and UINT32_MAX. If not specified, or if explicitly
  20280. set to -1, the filter will try to use a good random seed on a best
  20281. effort basis.
  20282. @item rule
  20283. Set the life rule.
  20284. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  20285. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  20286. @var{NS} specifies the number of alive neighbor cells which make a
  20287. live cell stay alive, and @var{NB} the number of alive neighbor cells
  20288. which make a dead cell to become alive (i.e. to "born").
  20289. "s" and "b" can be used in place of "S" and "B", respectively.
  20290. Alternatively a rule can be specified by an 18-bits integer. The 9
  20291. high order bits are used to encode the next cell state if it is alive
  20292. for each number of neighbor alive cells, the low order bits specify
  20293. the rule for "borning" new cells. Higher order bits encode for an
  20294. higher number of neighbor cells.
  20295. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  20296. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  20297. Default value is "S23/B3", which is the original Conway's game of life
  20298. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  20299. cells, and will born a new cell if there are three alive cells around
  20300. a dead cell.
  20301. @item size, s
  20302. Set the size of the output video. For the syntax of this option, check the
  20303. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20304. If @option{filename} is specified, the size is set by default to the
  20305. same size of the input file. If @option{size} is set, it must contain
  20306. the size specified in the input file, and the initial grid defined in
  20307. that file is centered in the larger resulting area.
  20308. If a filename is not specified, the size value defaults to "320x240"
  20309. (used for a randomly generated initial grid).
  20310. @item stitch
  20311. If set to 1, stitch the left and right grid edges together, and the
  20312. top and bottom edges also. Defaults to 1.
  20313. @item mold
  20314. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  20315. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  20316. value from 0 to 255.
  20317. @item life_color
  20318. Set the color of living (or new born) cells.
  20319. @item death_color
  20320. Set the color of dead cells. If @option{mold} is set, this is the first color
  20321. used to represent a dead cell.
  20322. @item mold_color
  20323. Set mold color, for definitely dead and moldy cells.
  20324. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  20325. ffmpeg-utils manual,ffmpeg-utils}.
  20326. @end table
  20327. @subsection Examples
  20328. @itemize
  20329. @item
  20330. Read a grid from @file{pattern}, and center it on a grid of size
  20331. 300x300 pixels:
  20332. @example
  20333. life=f=pattern:s=300x300
  20334. @end example
  20335. @item
  20336. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  20337. @example
  20338. life=ratio=2/3:s=200x200
  20339. @end example
  20340. @item
  20341. Specify a custom rule for evolving a randomly generated grid:
  20342. @example
  20343. life=rule=S14/B34
  20344. @end example
  20345. @item
  20346. Full example with slow death effect (mold) using @command{ffplay}:
  20347. @example
  20348. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  20349. @end example
  20350. @end itemize
  20351. @anchor{allrgb}
  20352. @anchor{allyuv}
  20353. @anchor{color}
  20354. @anchor{colorchart}
  20355. @anchor{colorspectrum}
  20356. @anchor{haldclutsrc}
  20357. @anchor{nullsrc}
  20358. @anchor{pal75bars}
  20359. @anchor{pal100bars}
  20360. @anchor{rgbtestsrc}
  20361. @anchor{smptebars}
  20362. @anchor{smptehdbars}
  20363. @anchor{testsrc}
  20364. @anchor{testsrc2}
  20365. @anchor{yuvtestsrc}
  20366. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  20367. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  20368. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  20369. The @code{color} source provides an uniformly colored input.
  20370. The @code{colorchart} source provides a colors checker chart.
  20371. The @code{colorspectrum} source provides a color spectrum input.
  20372. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  20373. @ref{haldclut} filter.
  20374. The @code{nullsrc} source returns unprocessed video frames. It is
  20375. mainly useful to be employed in analysis / debugging tools, or as the
  20376. source for filters which ignore the input data.
  20377. The @code{pal75bars} source generates a color bars pattern, based on
  20378. EBU PAL recommendations with 75% color levels.
  20379. The @code{pal100bars} source generates a color bars pattern, based on
  20380. EBU PAL recommendations with 100% color levels.
  20381. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  20382. detecting RGB vs BGR issues. You should see a red, green and blue
  20383. stripe from top to bottom.
  20384. The @code{smptebars} source generates a color bars pattern, based on
  20385. the SMPTE Engineering Guideline EG 1-1990.
  20386. The @code{smptehdbars} source generates a color bars pattern, based on
  20387. the SMPTE RP 219-2002.
  20388. The @code{testsrc} source generates a test video pattern, showing a
  20389. color pattern, a scrolling gradient and a timestamp. This is mainly
  20390. intended for testing purposes.
  20391. The @code{testsrc2} source is similar to testsrc, but supports more
  20392. pixel formats instead of just @code{rgb24}. This allows using it as an
  20393. input for other tests without requiring a format conversion.
  20394. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  20395. see a y, cb and cr stripe from top to bottom.
  20396. The sources accept the following parameters:
  20397. @table @option
  20398. @item level
  20399. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  20400. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  20401. pixels to be used as identity matrix for 3D lookup tables. Each component is
  20402. coded on a @code{1/(N*N)} scale.
  20403. @item color, c
  20404. Specify the color of the source, only available in the @code{color}
  20405. source. For the syntax of this option, check the
  20406. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20407. @item size, s
  20408. Specify the size of the sourced video. For the syntax of this option, check the
  20409. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20410. The default value is @code{320x240}.
  20411. This option is not available with the @code{allrgb}, @code{allyuv}, and
  20412. @code{haldclutsrc} filters.
  20413. @item rate, r
  20414. Specify the frame rate of the sourced video, as the number of frames
  20415. generated per second. It has to be a string in the format
  20416. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20417. number or a valid video frame rate abbreviation. The default value is
  20418. "25".
  20419. @item duration, d
  20420. Set the duration of the sourced video. See
  20421. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20422. for the accepted syntax.
  20423. If not specified, or the expressed duration is negative, the video is
  20424. supposed to be generated forever.
  20425. Since the frame rate is used as time base, all frames including the last one
  20426. will have their full duration. If the specified duration is not a multiple
  20427. of the frame duration, it will be rounded up.
  20428. @item sar
  20429. Set the sample aspect ratio of the sourced video.
  20430. @item alpha
  20431. Specify the alpha (opacity) of the background, only available in the
  20432. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  20433. 255 (fully opaque, the default).
  20434. @item decimals, n
  20435. Set the number of decimals to show in the timestamp, only available in the
  20436. @code{testsrc} source.
  20437. The displayed timestamp value will correspond to the original
  20438. timestamp value multiplied by the power of 10 of the specified
  20439. value. Default value is 0.
  20440. @item type
  20441. Set the type of the color spectrum, only available in the
  20442. @code{colorspectrum} source. Can be one of the following:
  20443. @table @samp
  20444. @item black
  20445. @item white
  20446. @item all
  20447. @end table
  20448. @item patch_size
  20449. Set patch size of single color patch, only available in the
  20450. @code{colorchart} source. Default is @code{64x64}.
  20451. @item preset
  20452. Set colorchecker colors preset, only available in the
  20453. @code{colorchart} source.
  20454. Available values are:
  20455. @table @samp
  20456. @item reference
  20457. @item skintones
  20458. @end table
  20459. Default value is @code{reference}.
  20460. @end table
  20461. @subsection Examples
  20462. @itemize
  20463. @item
  20464. Generate a video with a duration of 5.3 seconds, with size
  20465. 176x144 and a frame rate of 10 frames per second:
  20466. @example
  20467. testsrc=duration=5.3:size=qcif:rate=10
  20468. @end example
  20469. @item
  20470. The following graph description will generate a red source
  20471. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  20472. frames per second:
  20473. @example
  20474. color=c=red@@0.2:s=qcif:r=10
  20475. @end example
  20476. @item
  20477. If the input content is to be ignored, @code{nullsrc} can be used. The
  20478. following command generates noise in the luminance plane by employing
  20479. the @code{geq} filter:
  20480. @example
  20481. nullsrc=s=256x256, geq=random(1)*255:128:128
  20482. @end example
  20483. @end itemize
  20484. @subsection Commands
  20485. The @code{color} source supports the following commands:
  20486. @table @option
  20487. @item c, color
  20488. Set the color of the created image. Accepts the same syntax of the
  20489. corresponding @option{color} option.
  20490. @end table
  20491. @section openclsrc
  20492. Generate video using an OpenCL program.
  20493. @table @option
  20494. @item source
  20495. OpenCL program source file.
  20496. @item kernel
  20497. Kernel name in program.
  20498. @item size, s
  20499. Size of frames to generate. This must be set.
  20500. @item format
  20501. Pixel format to use for the generated frames. This must be set.
  20502. @item rate, r
  20503. Number of frames generated every second. Default value is '25'.
  20504. @end table
  20505. For details of how the program loading works, see the @ref{program_opencl}
  20506. filter.
  20507. Example programs:
  20508. @itemize
  20509. @item
  20510. Generate a colour ramp by setting pixel values from the position of the pixel
  20511. in the output image. (Note that this will work with all pixel formats, but
  20512. the generated output will not be the same.)
  20513. @verbatim
  20514. __kernel void ramp(__write_only image2d_t dst,
  20515. unsigned int index)
  20516. {
  20517. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  20518. float4 val;
  20519. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  20520. write_imagef(dst, loc, val);
  20521. }
  20522. @end verbatim
  20523. @item
  20524. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  20525. @verbatim
  20526. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  20527. unsigned int index)
  20528. {
  20529. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  20530. float4 value = 0.0f;
  20531. int x = loc.x + index;
  20532. int y = loc.y + index;
  20533. while (x > 0 || y > 0) {
  20534. if (x % 3 == 1 && y % 3 == 1) {
  20535. value = 1.0f;
  20536. break;
  20537. }
  20538. x /= 3;
  20539. y /= 3;
  20540. }
  20541. write_imagef(dst, loc, value);
  20542. }
  20543. @end verbatim
  20544. @end itemize
  20545. @section sierpinski
  20546. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  20547. This source accepts the following options:
  20548. @table @option
  20549. @item size, s
  20550. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20551. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20552. @item rate, r
  20553. Set frame rate, expressed as number of frames per second. Default
  20554. value is "25".
  20555. @item seed
  20556. Set seed which is used for random panning.
  20557. @item jump
  20558. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  20559. @item type
  20560. Set fractal type, can be default @code{carpet} or @code{triangle}.
  20561. @end table
  20562. @c man end VIDEO SOURCES
  20563. @chapter Video Sinks
  20564. @c man begin VIDEO SINKS
  20565. Below is a description of the currently available video sinks.
  20566. @section buffersink
  20567. Buffer video frames, and make them available to the end of the filter
  20568. graph.
  20569. This sink is mainly intended for programmatic use, in particular
  20570. through the interface defined in @file{libavfilter/buffersink.h}
  20571. or the options system.
  20572. It accepts a pointer to an AVBufferSinkContext structure, which
  20573. defines the incoming buffers' formats, to be passed as the opaque
  20574. parameter to @code{avfilter_init_filter} for initialization.
  20575. @section nullsink
  20576. Null video sink: do absolutely nothing with the input video. It is
  20577. mainly useful as a template and for use in analysis / debugging
  20578. tools.
  20579. @c man end VIDEO SINKS
  20580. @chapter Multimedia Filters
  20581. @c man begin MULTIMEDIA FILTERS
  20582. Below is a description of the currently available multimedia filters.
  20583. @section abitscope
  20584. Convert input audio to a video output, displaying the audio bit scope.
  20585. The filter accepts the following options:
  20586. @table @option
  20587. @item rate, r
  20588. Set frame rate, expressed as number of frames per second. Default
  20589. value is "25".
  20590. @item size, s
  20591. Specify the video size for the output. For the syntax of this option, check the
  20592. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20593. Default value is @code{1024x256}.
  20594. @item colors
  20595. Specify list of colors separated by space or by '|' which will be used to
  20596. draw channels. Unrecognized or missing colors will be replaced
  20597. by white color.
  20598. @item mode, m
  20599. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  20600. @end table
  20601. @section adrawgraph
  20602. Draw a graph using input audio metadata.
  20603. See @ref{drawgraph}
  20604. @section agraphmonitor
  20605. See @ref{graphmonitor}.
  20606. @section ahistogram
  20607. Convert input audio to a video output, displaying the volume histogram.
  20608. The filter accepts the following options:
  20609. @table @option
  20610. @item dmode
  20611. Specify how histogram is calculated.
  20612. It accepts the following values:
  20613. @table @samp
  20614. @item single
  20615. Use single histogram for all channels.
  20616. @item separate
  20617. Use separate histogram for each channel.
  20618. @end table
  20619. Default is @code{single}.
  20620. @item rate, r
  20621. Set frame rate, expressed as number of frames per second. Default
  20622. value is "25".
  20623. @item size, s
  20624. Specify the video size for the output. For the syntax of this option, check the
  20625. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20626. Default value is @code{hd720}.
  20627. @item scale
  20628. Set display scale.
  20629. It accepts the following values:
  20630. @table @samp
  20631. @item log
  20632. logarithmic
  20633. @item sqrt
  20634. square root
  20635. @item cbrt
  20636. cubic root
  20637. @item lin
  20638. linear
  20639. @item rlog
  20640. reverse logarithmic
  20641. @end table
  20642. Default is @code{log}.
  20643. @item ascale
  20644. Set amplitude scale.
  20645. It accepts the following values:
  20646. @table @samp
  20647. @item log
  20648. logarithmic
  20649. @item lin
  20650. linear
  20651. @end table
  20652. Default is @code{log}.
  20653. @item acount
  20654. Set how much frames to accumulate in histogram.
  20655. Default is 1. Setting this to -1 accumulates all frames.
  20656. @item rheight
  20657. Set histogram ratio of window height.
  20658. @item slide
  20659. Set sonogram sliding.
  20660. It accepts the following values:
  20661. @table @samp
  20662. @item replace
  20663. replace old rows with new ones.
  20664. @item scroll
  20665. scroll from top to bottom.
  20666. @end table
  20667. Default is @code{replace}.
  20668. @item hmode
  20669. Set histogram mode.
  20670. It accepts the following values:
  20671. @table @samp
  20672. @item abs
  20673. Use absolute values of samples.
  20674. @item sign
  20675. Use untouched values of samples.
  20676. @end table
  20677. Default is @code{abs}.
  20678. @end table
  20679. @section aphasemeter
  20680. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  20681. representing mean phase of current audio frame. A video output can also be produced and is
  20682. enabled by default. The audio is passed through as first output.
  20683. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  20684. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  20685. and @code{1} means channels are in phase.
  20686. The filter accepts the following options, all related to its video output:
  20687. @table @option
  20688. @item rate, r
  20689. Set the output frame rate. Default value is @code{25}.
  20690. @item size, s
  20691. Set the video size for the output. For the syntax of this option, check the
  20692. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20693. Default value is @code{800x400}.
  20694. @item rc
  20695. @item gc
  20696. @item bc
  20697. Specify the red, green, blue contrast. Default values are @code{2},
  20698. @code{7} and @code{1}.
  20699. Allowed range is @code{[0, 255]}.
  20700. @item mpc
  20701. Set color which will be used for drawing median phase. If color is
  20702. @code{none} which is default, no median phase value will be drawn.
  20703. @item video
  20704. Enable video output. Default is enabled.
  20705. @end table
  20706. @subsection phasing detection
  20707. The filter also detects out of phase and mono sequences in stereo streams.
  20708. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  20709. The filter accepts the following options for this detection:
  20710. @table @option
  20711. @item phasing
  20712. Enable mono and out of phase detection. Default is disabled.
  20713. @item tolerance, t
  20714. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  20715. Allowed range is @code{[0, 1]}.
  20716. @item angle, a
  20717. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  20718. Allowed range is @code{[90, 180]}.
  20719. @item duration, d
  20720. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  20721. @end table
  20722. @subsection Examples
  20723. @itemize
  20724. @item
  20725. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  20726. @example
  20727. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  20728. @end example
  20729. @end itemize
  20730. @section avectorscope
  20731. Convert input audio to a video output, representing the audio vector
  20732. scope.
  20733. The filter is used to measure the difference between channels of stereo
  20734. audio stream. A monaural signal, consisting of identical left and right
  20735. signal, results in straight vertical line. Any stereo separation is visible
  20736. as a deviation from this line, creating a Lissajous figure.
  20737. If the straight (or deviation from it) but horizontal line appears this
  20738. indicates that the left and right channels are out of phase.
  20739. The filter accepts the following options:
  20740. @table @option
  20741. @item mode, m
  20742. Set the vectorscope mode.
  20743. Available values are:
  20744. @table @samp
  20745. @item lissajous
  20746. Lissajous rotated by 45 degrees.
  20747. @item lissajous_xy
  20748. Same as above but not rotated.
  20749. @item polar
  20750. Shape resembling half of circle.
  20751. @end table
  20752. Default value is @samp{lissajous}.
  20753. @item size, s
  20754. Set the video size for the output. For the syntax of this option, check the
  20755. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20756. Default value is @code{400x400}.
  20757. @item rate, r
  20758. Set the output frame rate. Default value is @code{25}.
  20759. @item rc
  20760. @item gc
  20761. @item bc
  20762. @item ac
  20763. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  20764. @code{160}, @code{80} and @code{255}.
  20765. Allowed range is @code{[0, 255]}.
  20766. @item rf
  20767. @item gf
  20768. @item bf
  20769. @item af
  20770. Specify the red, green, blue and alpha fade. Default values are @code{15},
  20771. @code{10}, @code{5} and @code{5}.
  20772. Allowed range is @code{[0, 255]}.
  20773. @item zoom
  20774. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  20775. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  20776. @item draw
  20777. Set the vectorscope drawing mode.
  20778. Available values are:
  20779. @table @samp
  20780. @item dot
  20781. Draw dot for each sample.
  20782. @item line
  20783. Draw line between previous and current sample.
  20784. @end table
  20785. Default value is @samp{dot}.
  20786. @item scale
  20787. Specify amplitude scale of audio samples.
  20788. Available values are:
  20789. @table @samp
  20790. @item lin
  20791. Linear.
  20792. @item sqrt
  20793. Square root.
  20794. @item cbrt
  20795. Cubic root.
  20796. @item log
  20797. Logarithmic.
  20798. @end table
  20799. @item swap
  20800. Swap left channel axis with right channel axis.
  20801. @item mirror
  20802. Mirror axis.
  20803. @table @samp
  20804. @item none
  20805. No mirror.
  20806. @item x
  20807. Mirror only x axis.
  20808. @item y
  20809. Mirror only y axis.
  20810. @item xy
  20811. Mirror both axis.
  20812. @end table
  20813. @end table
  20814. @subsection Examples
  20815. @itemize
  20816. @item
  20817. Complete example using @command{ffplay}:
  20818. @example
  20819. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  20820. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  20821. @end example
  20822. @end itemize
  20823. @subsection Commands
  20824. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  20825. @section bench, abench
  20826. Benchmark part of a filtergraph.
  20827. The filter accepts the following options:
  20828. @table @option
  20829. @item action
  20830. Start or stop a timer.
  20831. Available values are:
  20832. @table @samp
  20833. @item start
  20834. Get the current time, set it as frame metadata (using the key
  20835. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  20836. @item stop
  20837. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  20838. the input frame metadata to get the time difference. Time difference, average,
  20839. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  20840. @code{min}) are then printed. The timestamps are expressed in seconds.
  20841. @end table
  20842. @end table
  20843. @subsection Examples
  20844. @itemize
  20845. @item
  20846. Benchmark @ref{selectivecolor} filter:
  20847. @example
  20848. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  20849. @end example
  20850. @end itemize
  20851. @section concat
  20852. Concatenate audio and video streams, joining them together one after the
  20853. other.
  20854. The filter works on segments of synchronized video and audio streams. All
  20855. segments must have the same number of streams of each type, and that will
  20856. also be the number of streams at output.
  20857. The filter accepts the following options:
  20858. @table @option
  20859. @item n
  20860. Set the number of segments. Default is 2.
  20861. @item v
  20862. Set the number of output video streams, that is also the number of video
  20863. streams in each segment. Default is 1.
  20864. @item a
  20865. Set the number of output audio streams, that is also the number of audio
  20866. streams in each segment. Default is 0.
  20867. @item unsafe
  20868. Activate unsafe mode: do not fail if segments have a different format.
  20869. @end table
  20870. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  20871. @var{a} audio outputs.
  20872. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  20873. segment, in the same order as the outputs, then the inputs for the second
  20874. segment, etc.
  20875. Related streams do not always have exactly the same duration, for various
  20876. reasons including codec frame size or sloppy authoring. For that reason,
  20877. related synchronized streams (e.g. a video and its audio track) should be
  20878. concatenated at once. The concat filter will use the duration of the longest
  20879. stream in each segment (except the last one), and if necessary pad shorter
  20880. audio streams with silence.
  20881. For this filter to work correctly, all segments must start at timestamp 0.
  20882. All corresponding streams must have the same parameters in all segments; the
  20883. filtering system will automatically select a common pixel format for video
  20884. streams, and a common sample format, sample rate and channel layout for
  20885. audio streams, but other settings, such as resolution, must be converted
  20886. explicitly by the user.
  20887. Different frame rates are acceptable but will result in variable frame rate
  20888. at output; be sure to configure the output file to handle it.
  20889. @subsection Examples
  20890. @itemize
  20891. @item
  20892. Concatenate an opening, an episode and an ending, all in bilingual version
  20893. (video in stream 0, audio in streams 1 and 2):
  20894. @example
  20895. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  20896. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  20897. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  20898. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  20899. @end example
  20900. @item
  20901. Concatenate two parts, handling audio and video separately, using the
  20902. (a)movie sources, and adjusting the resolution:
  20903. @example
  20904. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  20905. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  20906. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  20907. @end example
  20908. Note that a desync will happen at the stitch if the audio and video streams
  20909. do not have exactly the same duration in the first file.
  20910. @end itemize
  20911. @subsection Commands
  20912. This filter supports the following commands:
  20913. @table @option
  20914. @item next
  20915. Close the current segment and step to the next one
  20916. @end table
  20917. @anchor{ebur128}
  20918. @section ebur128
  20919. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  20920. level. By default, it logs a message at a frequency of 10Hz with the
  20921. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  20922. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  20923. The filter can only analyze streams which have
  20924. sample format is double-precision floating point. The input stream will be converted to
  20925. this specification, if needed. Users may need to insert aformat and/or aresample filters
  20926. after this filter to obtain the original parameters.
  20927. The filter also has a video output (see the @var{video} option) with a real
  20928. time graph to observe the loudness evolution. The graphic contains the logged
  20929. message mentioned above, so it is not printed anymore when this option is set,
  20930. unless the verbose logging is set. The main graphing area contains the
  20931. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  20932. the momentary loudness (400 milliseconds), but can optionally be configured
  20933. to instead display short-term loudness (see @var{gauge}).
  20934. The green area marks a +/- 1LU target range around the target loudness
  20935. (-23LUFS by default, unless modified through @var{target}).
  20936. More information about the Loudness Recommendation EBU R128 on
  20937. @url{http://tech.ebu.ch/loudness}.
  20938. The filter accepts the following options:
  20939. @table @option
  20940. @item video
  20941. Activate the video output. The audio stream is passed unchanged whether this
  20942. option is set or no. The video stream will be the first output stream if
  20943. activated. Default is @code{0}.
  20944. @item size
  20945. Set the video size. This option is for video only. For the syntax of this
  20946. option, check the
  20947. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20948. Default and minimum resolution is @code{640x480}.
  20949. @item meter
  20950. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  20951. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  20952. other integer value between this range is allowed.
  20953. @item metadata
  20954. Set metadata injection. If set to @code{1}, the audio input will be segmented
  20955. into 100ms output frames, each of them containing various loudness information
  20956. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  20957. Default is @code{0}.
  20958. @item framelog
  20959. Force the frame logging level.
  20960. Available values are:
  20961. @table @samp
  20962. @item info
  20963. information logging level
  20964. @item verbose
  20965. verbose logging level
  20966. @end table
  20967. By default, the logging level is set to @var{info}. If the @option{video} or
  20968. the @option{metadata} options are set, it switches to @var{verbose}.
  20969. @item peak
  20970. Set peak mode(s).
  20971. Available modes can be cumulated (the option is a @code{flag} type). Possible
  20972. values are:
  20973. @table @samp
  20974. @item none
  20975. Disable any peak mode (default).
  20976. @item sample
  20977. Enable sample-peak mode.
  20978. Simple peak mode looking for the higher sample value. It logs a message
  20979. for sample-peak (identified by @code{SPK}).
  20980. @item true
  20981. Enable true-peak mode.
  20982. If enabled, the peak lookup is done on an over-sampled version of the input
  20983. stream for better peak accuracy. It logs a message for true-peak.
  20984. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  20985. This mode requires a build with @code{libswresample}.
  20986. @end table
  20987. @item dualmono
  20988. Treat mono input files as "dual mono". If a mono file is intended for playback
  20989. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  20990. If set to @code{true}, this option will compensate for this effect.
  20991. Multi-channel input files are not affected by this option.
  20992. @item panlaw
  20993. Set a specific pan law to be used for the measurement of dual mono files.
  20994. This parameter is optional, and has a default value of -3.01dB.
  20995. @item target
  20996. Set a specific target level (in LUFS) used as relative zero in the visualization.
  20997. This parameter is optional and has a default value of -23LUFS as specified
  20998. by EBU R128. However, material published online may prefer a level of -16LUFS
  20999. (e.g. for use with podcasts or video platforms).
  21000. @item gauge
  21001. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  21002. @code{shortterm}. By default the momentary value will be used, but in certain
  21003. scenarios it may be more useful to observe the short term value instead (e.g.
  21004. live mixing).
  21005. @item scale
  21006. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  21007. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  21008. video output, not the summary or continuous log output.
  21009. @end table
  21010. @subsection Examples
  21011. @itemize
  21012. @item
  21013. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  21014. @example
  21015. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  21016. @end example
  21017. @item
  21018. Run an analysis with @command{ffmpeg}:
  21019. @example
  21020. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  21021. @end example
  21022. @end itemize
  21023. @section interleave, ainterleave
  21024. Temporally interleave frames from several inputs.
  21025. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  21026. These filters read frames from several inputs and send the oldest
  21027. queued frame to the output.
  21028. Input streams must have well defined, monotonically increasing frame
  21029. timestamp values.
  21030. In order to submit one frame to output, these filters need to enqueue
  21031. at least one frame for each input, so they cannot work in case one
  21032. input is not yet terminated and will not receive incoming frames.
  21033. For example consider the case when one input is a @code{select} filter
  21034. which always drops input frames. The @code{interleave} filter will keep
  21035. reading from that input, but it will never be able to send new frames
  21036. to output until the input sends an end-of-stream signal.
  21037. Also, depending on inputs synchronization, the filters will drop
  21038. frames in case one input receives more frames than the other ones, and
  21039. the queue is already filled.
  21040. These filters accept the following options:
  21041. @table @option
  21042. @item nb_inputs, n
  21043. Set the number of different inputs, it is 2 by default.
  21044. @item duration
  21045. How to determine the end-of-stream.
  21046. @table @option
  21047. @item longest
  21048. The duration of the longest input. (default)
  21049. @item shortest
  21050. The duration of the shortest input.
  21051. @item first
  21052. The duration of the first input.
  21053. @end table
  21054. @end table
  21055. @subsection Examples
  21056. @itemize
  21057. @item
  21058. Interleave frames belonging to different streams using @command{ffmpeg}:
  21059. @example
  21060. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  21061. @end example
  21062. @item
  21063. Add flickering blur effect:
  21064. @example
  21065. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  21066. @end example
  21067. @end itemize
  21068. @section latency, alatency
  21069. Measure filtering latency.
  21070. Report previous filter filtering latency, delay in number of audio samples for audio filters
  21071. or number of video frames for video filters.
  21072. On end of input stream, filter will report min and max measured latency for previous running filter
  21073. in filtergraph.
  21074. @section metadata, ametadata
  21075. Manipulate frame metadata.
  21076. This filter accepts the following options:
  21077. @table @option
  21078. @item mode
  21079. Set mode of operation of the filter.
  21080. Can be one of the following:
  21081. @table @samp
  21082. @item select
  21083. If both @code{value} and @code{key} is set, select frames
  21084. which have such metadata. If only @code{key} is set, select
  21085. every frame that has such key in metadata.
  21086. @item add
  21087. Add new metadata @code{key} and @code{value}. If key is already available
  21088. do nothing.
  21089. @item modify
  21090. Modify value of already present key.
  21091. @item delete
  21092. If @code{value} is set, delete only keys that have such value.
  21093. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  21094. the frame.
  21095. @item print
  21096. Print key and its value if metadata was found. If @code{key} is not set print all
  21097. metadata values available in frame.
  21098. @end table
  21099. @item key
  21100. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  21101. @item value
  21102. Set metadata value which will be used. This option is mandatory for
  21103. @code{modify} and @code{add} mode.
  21104. @item function
  21105. Which function to use when comparing metadata value and @code{value}.
  21106. Can be one of following:
  21107. @table @samp
  21108. @item same_str
  21109. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  21110. @item starts_with
  21111. Values are interpreted as strings, returns true if metadata value starts with
  21112. the @code{value} option string.
  21113. @item less
  21114. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  21115. @item equal
  21116. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  21117. @item greater
  21118. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  21119. @item expr
  21120. Values are interpreted as floats, returns true if expression from option @code{expr}
  21121. evaluates to true.
  21122. @item ends_with
  21123. Values are interpreted as strings, returns true if metadata value ends with
  21124. the @code{value} option string.
  21125. @end table
  21126. @item expr
  21127. Set expression which is used when @code{function} is set to @code{expr}.
  21128. The expression is evaluated through the eval API and can contain the following
  21129. constants:
  21130. @table @option
  21131. @item VALUE1, FRAMEVAL
  21132. Float representation of @code{value} from metadata key.
  21133. @item VALUE2, USERVAL
  21134. Float representation of @code{value} as supplied by user in @code{value} option.
  21135. @end table
  21136. @item file
  21137. If specified in @code{print} mode, output is written to the named file. Instead of
  21138. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  21139. for standard output. If @code{file} option is not set, output is written to the log
  21140. with AV_LOG_INFO loglevel.
  21141. @item direct
  21142. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  21143. @end table
  21144. @subsection Examples
  21145. @itemize
  21146. @item
  21147. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  21148. between 0 and 1.
  21149. @example
  21150. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  21151. @end example
  21152. @item
  21153. Print silencedetect output to file @file{metadata.txt}.
  21154. @example
  21155. silencedetect,ametadata=mode=print:file=metadata.txt
  21156. @end example
  21157. @item
  21158. Direct all metadata to a pipe with file descriptor 4.
  21159. @example
  21160. metadata=mode=print:file='pipe\:4'
  21161. @end example
  21162. @end itemize
  21163. @section perms, aperms
  21164. Set read/write permissions for the output frames.
  21165. These filters are mainly aimed at developers to test direct path in the
  21166. following filter in the filtergraph.
  21167. The filters accept the following options:
  21168. @table @option
  21169. @item mode
  21170. Select the permissions mode.
  21171. It accepts the following values:
  21172. @table @samp
  21173. @item none
  21174. Do nothing. This is the default.
  21175. @item ro
  21176. Set all the output frames read-only.
  21177. @item rw
  21178. Set all the output frames directly writable.
  21179. @item toggle
  21180. Make the frame read-only if writable, and writable if read-only.
  21181. @item random
  21182. Set each output frame read-only or writable randomly.
  21183. @end table
  21184. @item seed
  21185. Set the seed for the @var{random} mode, must be an integer included between
  21186. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  21187. @code{-1}, the filter will try to use a good random seed on a best effort
  21188. basis.
  21189. @end table
  21190. Note: in case of auto-inserted filter between the permission filter and the
  21191. following one, the permission might not be received as expected in that
  21192. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  21193. perms/aperms filter can avoid this problem.
  21194. @section realtime, arealtime
  21195. Slow down filtering to match real time approximately.
  21196. These filters will pause the filtering for a variable amount of time to
  21197. match the output rate with the input timestamps.
  21198. They are similar to the @option{re} option to @code{ffmpeg}.
  21199. They accept the following options:
  21200. @table @option
  21201. @item limit
  21202. Time limit for the pauses. Any pause longer than that will be considered
  21203. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  21204. @item speed
  21205. Speed factor for processing. The value must be a float larger than zero.
  21206. Values larger than 1.0 will result in faster than realtime processing,
  21207. smaller will slow processing down. The @var{limit} is automatically adapted
  21208. accordingly. Default is 1.0.
  21209. A processing speed faster than what is possible without these filters cannot
  21210. be achieved.
  21211. @end table
  21212. @subsection Commands
  21213. Both filters supports the all above options as @ref{commands}.
  21214. @section segment, asegment
  21215. Split single input stream into multiple streams.
  21216. This filter does opposite of concat filters.
  21217. @code{segment} works on video frames, @code{asegment} on audio samples.
  21218. This filter accepts the following options:
  21219. @table @option
  21220. @item timestamps
  21221. Timestamps of output segments separated by '|'. The first segment will run
  21222. from the beginning of the input stream. The last segment will run until
  21223. the end of the input stream
  21224. @item frames, samples
  21225. Exact frame/sample count to split the segments.
  21226. @end table
  21227. In all cases, prefixing an each segment with '+' will make it relative to the
  21228. previous segment.
  21229. @subsection Examples
  21230. @itemize
  21231. @item
  21232. Split input audio stream into three output audio streams, starting at start of input audio stream
  21233. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  21234. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  21235. @example
  21236. asegment=timestamps="60|150"
  21237. @end example
  21238. @end itemize
  21239. @anchor{select}
  21240. @section select, aselect
  21241. Select frames to pass in output.
  21242. This filter accepts the following options:
  21243. @table @option
  21244. @item expr, e
  21245. Set expression, which is evaluated for each input frame.
  21246. If the expression is evaluated to zero, the frame is discarded.
  21247. If the evaluation result is negative or NaN, the frame is sent to the
  21248. first output; otherwise it is sent to the output with index
  21249. @code{ceil(val)-1}, assuming that the input index starts from 0.
  21250. For example a value of @code{1.2} corresponds to the output with index
  21251. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  21252. @item outputs, n
  21253. Set the number of outputs. The output to which to send the selected
  21254. frame is based on the result of the evaluation. Default value is 1.
  21255. @end table
  21256. The expression can contain the following constants:
  21257. @table @option
  21258. @item n
  21259. The (sequential) number of the filtered frame, starting from 0.
  21260. @item selected_n
  21261. The (sequential) number of the selected frame, starting from 0.
  21262. @item prev_selected_n
  21263. The sequential number of the last selected frame. It's NAN if undefined.
  21264. @item TB
  21265. The timebase of the input timestamps.
  21266. @item pts
  21267. The PTS (Presentation TimeStamp) of the filtered frame,
  21268. expressed in @var{TB} units. It's NAN if undefined.
  21269. @item t
  21270. The PTS of the filtered frame,
  21271. expressed in seconds. It's NAN if undefined.
  21272. @item prev_pts
  21273. The PTS of the previously filtered frame. It's NAN if undefined.
  21274. @item prev_selected_pts
  21275. The PTS of the last previously filtered frame. It's NAN if undefined.
  21276. @item prev_selected_t
  21277. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  21278. @item start_pts
  21279. The first PTS in the stream which is not NAN. It remains NAN if not found.
  21280. @item start_t
  21281. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  21282. @item pict_type @emph{(video only)}
  21283. The type of the filtered frame. It can assume one of the following
  21284. values:
  21285. @table @option
  21286. @item I
  21287. @item P
  21288. @item B
  21289. @item S
  21290. @item SI
  21291. @item SP
  21292. @item BI
  21293. @end table
  21294. @item interlace_type @emph{(video only)}
  21295. The frame interlace type. It can assume one of the following values:
  21296. @table @option
  21297. @item PROGRESSIVE
  21298. The frame is progressive (not interlaced).
  21299. @item TOPFIRST
  21300. The frame is top-field-first.
  21301. @item BOTTOMFIRST
  21302. The frame is bottom-field-first.
  21303. @end table
  21304. @item consumed_sample_n @emph{(audio only)}
  21305. the number of selected samples before the current frame
  21306. @item samples_n @emph{(audio only)}
  21307. the number of samples in the current frame
  21308. @item sample_rate @emph{(audio only)}
  21309. the input sample rate
  21310. @item key
  21311. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  21312. @item pos
  21313. the position in the file of the filtered frame, -1 if the information
  21314. is not available (e.g. for synthetic video)
  21315. @item scene @emph{(video only)}
  21316. value between 0 and 1 to indicate a new scene; a low value reflects a low
  21317. probability for the current frame to introduce a new scene, while a higher
  21318. value means the current frame is more likely to be one (see the example below)
  21319. @item concatdec_select
  21320. The concat demuxer can select only part of a concat input file by setting an
  21321. inpoint and an outpoint, but the output packets may not be entirely contained
  21322. in the selected interval. By using this variable, it is possible to skip frames
  21323. generated by the concat demuxer which are not exactly contained in the selected
  21324. interval.
  21325. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  21326. and the @var{lavf.concat.duration} packet metadata values which are also
  21327. present in the decoded frames.
  21328. The @var{concatdec_select} variable is -1 if the frame pts is at least
  21329. start_time and either the duration metadata is missing or the frame pts is less
  21330. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  21331. missing.
  21332. That basically means that an input frame is selected if its pts is within the
  21333. interval set by the concat demuxer.
  21334. @end table
  21335. The default value of the select expression is "1".
  21336. @subsection Examples
  21337. @itemize
  21338. @item
  21339. Select all frames in input:
  21340. @example
  21341. select
  21342. @end example
  21343. The example above is the same as:
  21344. @example
  21345. select=1
  21346. @end example
  21347. @item
  21348. Skip all frames:
  21349. @example
  21350. select=0
  21351. @end example
  21352. @item
  21353. Select only I-frames:
  21354. @example
  21355. select='eq(pict_type\,I)'
  21356. @end example
  21357. @item
  21358. Select one frame every 100:
  21359. @example
  21360. select='not(mod(n\,100))'
  21361. @end example
  21362. @item
  21363. Select only frames contained in the 10-20 time interval:
  21364. @example
  21365. select=between(t\,10\,20)
  21366. @end example
  21367. @item
  21368. Select only I-frames contained in the 10-20 time interval:
  21369. @example
  21370. select=between(t\,10\,20)*eq(pict_type\,I)
  21371. @end example
  21372. @item
  21373. Select frames with a minimum distance of 10 seconds:
  21374. @example
  21375. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  21376. @end example
  21377. @item
  21378. Use aselect to select only audio frames with samples number > 100:
  21379. @example
  21380. aselect='gt(samples_n\,100)'
  21381. @end example
  21382. @item
  21383. Create a mosaic of the first scenes:
  21384. @example
  21385. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  21386. @end example
  21387. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  21388. choice.
  21389. @item
  21390. Send even and odd frames to separate outputs, and compose them:
  21391. @example
  21392. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  21393. @end example
  21394. @item
  21395. Select useful frames from an ffconcat file which is using inpoints and
  21396. outpoints but where the source files are not intra frame only.
  21397. @example
  21398. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  21399. @end example
  21400. @end itemize
  21401. @section sendcmd, asendcmd
  21402. Send commands to filters in the filtergraph.
  21403. These filters read commands to be sent to other filters in the
  21404. filtergraph.
  21405. @code{sendcmd} must be inserted between two video filters,
  21406. @code{asendcmd} must be inserted between two audio filters, but apart
  21407. from that they act the same way.
  21408. The specification of commands can be provided in the filter arguments
  21409. with the @var{commands} option, or in a file specified by the
  21410. @var{filename} option.
  21411. These filters accept the following options:
  21412. @table @option
  21413. @item commands, c
  21414. Set the commands to be read and sent to the other filters.
  21415. @item filename, f
  21416. Set the filename of the commands to be read and sent to the other
  21417. filters.
  21418. @end table
  21419. @subsection Commands syntax
  21420. A commands description consists of a sequence of interval
  21421. specifications, comprising a list of commands to be executed when a
  21422. particular event related to that interval occurs. The occurring event
  21423. is typically the current frame time entering or leaving a given time
  21424. interval.
  21425. An interval is specified by the following syntax:
  21426. @example
  21427. @var{START}[-@var{END}] @var{COMMANDS};
  21428. @end example
  21429. The time interval is specified by the @var{START} and @var{END} times.
  21430. @var{END} is optional and defaults to the maximum time.
  21431. The current frame time is considered within the specified interval if
  21432. it is included in the interval [@var{START}, @var{END}), that is when
  21433. the time is greater or equal to @var{START} and is lesser than
  21434. @var{END}.
  21435. @var{COMMANDS} consists of a sequence of one or more command
  21436. specifications, separated by ",", relating to that interval. The
  21437. syntax of a command specification is given by:
  21438. @example
  21439. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  21440. @end example
  21441. @var{FLAGS} is optional and specifies the type of events relating to
  21442. the time interval which enable sending the specified command, and must
  21443. be a non-null sequence of identifier flags separated by "+" or "|" and
  21444. enclosed between "[" and "]".
  21445. The following flags are recognized:
  21446. @table @option
  21447. @item enter
  21448. The command is sent when the current frame timestamp enters the
  21449. specified interval. In other words, the command is sent when the
  21450. previous frame timestamp was not in the given interval, and the
  21451. current is.
  21452. @item leave
  21453. The command is sent when the current frame timestamp leaves the
  21454. specified interval. In other words, the command is sent when the
  21455. previous frame timestamp was in the given interval, and the
  21456. current is not.
  21457. @item expr
  21458. The command @var{ARG} is interpreted as expression and result of
  21459. expression is passed as @var{ARG}.
  21460. The expression is evaluated through the eval API and can contain the following
  21461. constants:
  21462. @table @option
  21463. @item POS
  21464. Original position in the file of the frame, or undefined if undefined
  21465. for the current frame.
  21466. @item PTS
  21467. The presentation timestamp in input.
  21468. @item N
  21469. The count of the input frame for video or audio, starting from 0.
  21470. @item T
  21471. The time in seconds of the current frame.
  21472. @item TS
  21473. The start time in seconds of the current command interval.
  21474. @item TE
  21475. The end time in seconds of the current command interval.
  21476. @item TI
  21477. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  21478. @item W
  21479. The video frame width.
  21480. @item H
  21481. The video frame height.
  21482. @end table
  21483. @end table
  21484. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  21485. assumed.
  21486. @var{TARGET} specifies the target of the command, usually the name of
  21487. the filter class or a specific filter instance name.
  21488. @var{COMMAND} specifies the name of the command for the target filter.
  21489. @var{ARG} is optional and specifies the optional list of argument for
  21490. the given @var{COMMAND}.
  21491. Between one interval specification and another, whitespaces, or
  21492. sequences of characters starting with @code{#} until the end of line,
  21493. are ignored and can be used to annotate comments.
  21494. A simplified BNF description of the commands specification syntax
  21495. follows:
  21496. @example
  21497. @var{COMMAND_FLAG} ::= "enter" | "leave"
  21498. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  21499. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  21500. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  21501. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  21502. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  21503. @end example
  21504. @subsection Examples
  21505. @itemize
  21506. @item
  21507. Specify audio tempo change at second 4:
  21508. @example
  21509. asendcmd=c='4.0 atempo tempo 1.5',atempo
  21510. @end example
  21511. @item
  21512. Target a specific filter instance:
  21513. @example
  21514. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  21515. @end example
  21516. @item
  21517. Specify a list of drawtext and hue commands in a file.
  21518. @example
  21519. # show text in the interval 5-10
  21520. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  21521. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  21522. # desaturate the image in the interval 15-20
  21523. 15.0-20.0 [enter] hue s 0,
  21524. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  21525. [leave] hue s 1,
  21526. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  21527. # apply an exponential saturation fade-out effect, starting from time 25
  21528. 25 [enter] hue s exp(25-t)
  21529. @end example
  21530. A filtergraph allowing to read and process the above command list
  21531. stored in a file @file{test.cmd}, can be specified with:
  21532. @example
  21533. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  21534. @end example
  21535. @end itemize
  21536. @anchor{setpts}
  21537. @section setpts, asetpts
  21538. Change the PTS (presentation timestamp) of the input frames.
  21539. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  21540. This filter accepts the following options:
  21541. @table @option
  21542. @item expr
  21543. The expression which is evaluated for each frame to construct its timestamp.
  21544. @end table
  21545. The expression is evaluated through the eval API and can contain the following
  21546. constants:
  21547. @table @option
  21548. @item FRAME_RATE, FR
  21549. frame rate, only defined for constant frame-rate video
  21550. @item PTS
  21551. The presentation timestamp in input
  21552. @item N
  21553. The count of the input frame for video or the number of consumed samples,
  21554. not including the current frame for audio, starting from 0.
  21555. @item NB_CONSUMED_SAMPLES
  21556. The number of consumed samples, not including the current frame (only
  21557. audio)
  21558. @item NB_SAMPLES, S
  21559. The number of samples in the current frame (only audio)
  21560. @item SAMPLE_RATE, SR
  21561. The audio sample rate.
  21562. @item STARTPTS
  21563. The PTS of the first frame.
  21564. @item STARTT
  21565. the time in seconds of the first frame
  21566. @item INTERLACED
  21567. State whether the current frame is interlaced.
  21568. @item T
  21569. the time in seconds of the current frame
  21570. @item POS
  21571. original position in the file of the frame, or undefined if undefined
  21572. for the current frame
  21573. @item PREV_INPTS
  21574. The previous input PTS.
  21575. @item PREV_INT
  21576. previous input time in seconds
  21577. @item PREV_OUTPTS
  21578. The previous output PTS.
  21579. @item PREV_OUTT
  21580. previous output time in seconds
  21581. @item RTCTIME
  21582. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  21583. instead.
  21584. @item RTCSTART
  21585. The wallclock (RTC) time at the start of the movie in microseconds.
  21586. @item TB
  21587. The timebase of the input timestamps.
  21588. @end table
  21589. @subsection Examples
  21590. @itemize
  21591. @item
  21592. Start counting PTS from zero
  21593. @example
  21594. setpts=PTS-STARTPTS
  21595. @end example
  21596. @item
  21597. Apply fast motion effect:
  21598. @example
  21599. setpts=0.5*PTS
  21600. @end example
  21601. @item
  21602. Apply slow motion effect:
  21603. @example
  21604. setpts=2.0*PTS
  21605. @end example
  21606. @item
  21607. Set fixed rate of 25 frames per second:
  21608. @example
  21609. setpts=N/(25*TB)
  21610. @end example
  21611. @item
  21612. Set fixed rate 25 fps with some jitter:
  21613. @example
  21614. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  21615. @end example
  21616. @item
  21617. Apply an offset of 10 seconds to the input PTS:
  21618. @example
  21619. setpts=PTS+10/TB
  21620. @end example
  21621. @item
  21622. Generate timestamps from a "live source" and rebase onto the current timebase:
  21623. @example
  21624. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  21625. @end example
  21626. @item
  21627. Generate timestamps by counting samples:
  21628. @example
  21629. asetpts=N/SR/TB
  21630. @end example
  21631. @end itemize
  21632. @section setrange
  21633. Force color range for the output video frame.
  21634. The @code{setrange} filter marks the color range property for the
  21635. output frames. It does not change the input frame, but only sets the
  21636. corresponding property, which affects how the frame is treated by
  21637. following filters.
  21638. The filter accepts the following options:
  21639. @table @option
  21640. @item range
  21641. Available values are:
  21642. @table @samp
  21643. @item auto
  21644. Keep the same color range property.
  21645. @item unspecified, unknown
  21646. Set the color range as unspecified.
  21647. @item limited, tv, mpeg
  21648. Set the color range as limited.
  21649. @item full, pc, jpeg
  21650. Set the color range as full.
  21651. @end table
  21652. @end table
  21653. @section settb, asettb
  21654. Set the timebase to use for the output frames timestamps.
  21655. It is mainly useful for testing timebase configuration.
  21656. It accepts the following parameters:
  21657. @table @option
  21658. @item expr, tb
  21659. The expression which is evaluated into the output timebase.
  21660. @end table
  21661. The value for @option{tb} is an arithmetic expression representing a
  21662. rational. The expression can contain the constants "AVTB" (the default
  21663. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  21664. audio only). Default value is "intb".
  21665. @subsection Examples
  21666. @itemize
  21667. @item
  21668. Set the timebase to 1/25:
  21669. @example
  21670. settb=expr=1/25
  21671. @end example
  21672. @item
  21673. Set the timebase to 1/10:
  21674. @example
  21675. settb=expr=0.1
  21676. @end example
  21677. @item
  21678. Set the timebase to 1001/1000:
  21679. @example
  21680. settb=1+0.001
  21681. @end example
  21682. @item
  21683. Set the timebase to 2*intb:
  21684. @example
  21685. settb=2*intb
  21686. @end example
  21687. @item
  21688. Set the default timebase value:
  21689. @example
  21690. settb=AVTB
  21691. @end example
  21692. @end itemize
  21693. @section showcqt
  21694. Convert input audio to a video output representing frequency spectrum
  21695. logarithmically using Brown-Puckette constant Q transform algorithm with
  21696. direct frequency domain coefficient calculation (but the transform itself
  21697. is not really constant Q, instead the Q factor is actually variable/clamped),
  21698. with musical tone scale, from E0 to D#10.
  21699. The filter accepts the following options:
  21700. @table @option
  21701. @item size, s
  21702. Specify the video size for the output. It must be even. For the syntax of this option,
  21703. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21704. Default value is @code{1920x1080}.
  21705. @item fps, rate, r
  21706. Set the output frame rate. Default value is @code{25}.
  21707. @item bar_h
  21708. Set the bargraph height. It must be even. Default value is @code{-1} which
  21709. computes the bargraph height automatically.
  21710. @item axis_h
  21711. Set the axis height. It must be even. Default value is @code{-1} which computes
  21712. the axis height automatically.
  21713. @item sono_h
  21714. Set the sonogram height. It must be even. Default value is @code{-1} which
  21715. computes the sonogram height automatically.
  21716. @item fullhd
  21717. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  21718. instead. Default value is @code{1}.
  21719. @item sono_v, volume
  21720. Specify the sonogram volume expression. It can contain variables:
  21721. @table @option
  21722. @item bar_v
  21723. the @var{bar_v} evaluated expression
  21724. @item frequency, freq, f
  21725. the frequency where it is evaluated
  21726. @item timeclamp, tc
  21727. the value of @var{timeclamp} option
  21728. @end table
  21729. and functions:
  21730. @table @option
  21731. @item a_weighting(f)
  21732. A-weighting of equal loudness
  21733. @item b_weighting(f)
  21734. B-weighting of equal loudness
  21735. @item c_weighting(f)
  21736. C-weighting of equal loudness.
  21737. @end table
  21738. Default value is @code{16}.
  21739. @item bar_v, volume2
  21740. Specify the bargraph volume expression. It can contain variables:
  21741. @table @option
  21742. @item sono_v
  21743. the @var{sono_v} evaluated expression
  21744. @item frequency, freq, f
  21745. the frequency where it is evaluated
  21746. @item timeclamp, tc
  21747. the value of @var{timeclamp} option
  21748. @end table
  21749. and functions:
  21750. @table @option
  21751. @item a_weighting(f)
  21752. A-weighting of equal loudness
  21753. @item b_weighting(f)
  21754. B-weighting of equal loudness
  21755. @item c_weighting(f)
  21756. C-weighting of equal loudness.
  21757. @end table
  21758. Default value is @code{sono_v}.
  21759. @item sono_g, gamma
  21760. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  21761. higher gamma makes the spectrum having more range. Default value is @code{3}.
  21762. Acceptable range is @code{[1, 7]}.
  21763. @item bar_g, gamma2
  21764. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  21765. @code{[1, 7]}.
  21766. @item bar_t
  21767. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  21768. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  21769. @item timeclamp, tc
  21770. Specify the transform timeclamp. At low frequency, there is trade-off between
  21771. accuracy in time domain and frequency domain. If timeclamp is lower,
  21772. event in time domain is represented more accurately (such as fast bass drum),
  21773. otherwise event in frequency domain is represented more accurately
  21774. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  21775. @item attack
  21776. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  21777. limits future samples by applying asymmetric windowing in time domain, useful
  21778. when low latency is required. Accepted range is @code{[0, 1]}.
  21779. @item basefreq
  21780. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  21781. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  21782. @item endfreq
  21783. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  21784. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  21785. @item coeffclamp
  21786. This option is deprecated and ignored.
  21787. @item tlength
  21788. Specify the transform length in time domain. Use this option to control accuracy
  21789. trade-off between time domain and frequency domain at every frequency sample.
  21790. It can contain variables:
  21791. @table @option
  21792. @item frequency, freq, f
  21793. the frequency where it is evaluated
  21794. @item timeclamp, tc
  21795. the value of @var{timeclamp} option.
  21796. @end table
  21797. Default value is @code{384*tc/(384+tc*f)}.
  21798. @item count
  21799. Specify the transform count for every video frame. Default value is @code{6}.
  21800. Acceptable range is @code{[1, 30]}.
  21801. @item fcount
  21802. Specify the transform count for every single pixel. Default value is @code{0},
  21803. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  21804. @item fontfile
  21805. Specify font file for use with freetype to draw the axis. If not specified,
  21806. use embedded font. Note that drawing with font file or embedded font is not
  21807. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  21808. option instead.
  21809. @item font
  21810. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  21811. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  21812. escaping.
  21813. @item fontcolor
  21814. Specify font color expression. This is arithmetic expression that should return
  21815. integer value 0xRRGGBB. It can contain variables:
  21816. @table @option
  21817. @item frequency, freq, f
  21818. the frequency where it is evaluated
  21819. @item timeclamp, tc
  21820. the value of @var{timeclamp} option
  21821. @end table
  21822. and functions:
  21823. @table @option
  21824. @item midi(f)
  21825. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  21826. @item r(x), g(x), b(x)
  21827. red, green, and blue value of intensity x.
  21828. @end table
  21829. Default value is @code{st(0, (midi(f)-59.5)/12);
  21830. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  21831. r(1-ld(1)) + b(ld(1))}.
  21832. @item axisfile
  21833. Specify image file to draw the axis. This option override @var{fontfile} and
  21834. @var{fontcolor} option.
  21835. @item axis, text
  21836. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  21837. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  21838. Default value is @code{1}.
  21839. @item csp
  21840. Set colorspace. The accepted values are:
  21841. @table @samp
  21842. @item unspecified
  21843. Unspecified (default)
  21844. @item bt709
  21845. BT.709
  21846. @item fcc
  21847. FCC
  21848. @item bt470bg
  21849. BT.470BG or BT.601-6 625
  21850. @item smpte170m
  21851. SMPTE-170M or BT.601-6 525
  21852. @item smpte240m
  21853. SMPTE-240M
  21854. @item bt2020ncl
  21855. BT.2020 with non-constant luminance
  21856. @end table
  21857. @item cscheme
  21858. Set spectrogram color scheme. This is list of floating point values with format
  21859. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  21860. The default is @code{1|0.5|0|0|0.5|1}.
  21861. @end table
  21862. @subsection Examples
  21863. @itemize
  21864. @item
  21865. Playing audio while showing the spectrum:
  21866. @example
  21867. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  21868. @end example
  21869. @item
  21870. Same as above, but with frame rate 30 fps:
  21871. @example
  21872. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  21873. @end example
  21874. @item
  21875. Playing at 1280x720:
  21876. @example
  21877. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  21878. @end example
  21879. @item
  21880. Disable sonogram display:
  21881. @example
  21882. sono_h=0
  21883. @end example
  21884. @item
  21885. A1 and its harmonics: A1, A2, (near)E3, A3:
  21886. @example
  21887. 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),
  21888. asplit[a][out1]; [a] showcqt [out0]'
  21889. @end example
  21890. @item
  21891. Same as above, but with more accuracy in frequency domain:
  21892. @example
  21893. 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),
  21894. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  21895. @end example
  21896. @item
  21897. Custom volume:
  21898. @example
  21899. bar_v=10:sono_v=bar_v*a_weighting(f)
  21900. @end example
  21901. @item
  21902. Custom gamma, now spectrum is linear to the amplitude.
  21903. @example
  21904. bar_g=2:sono_g=2
  21905. @end example
  21906. @item
  21907. Custom tlength equation:
  21908. @example
  21909. 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)))'
  21910. @end example
  21911. @item
  21912. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  21913. @example
  21914. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  21915. @end example
  21916. @item
  21917. Custom font using fontconfig:
  21918. @example
  21919. font='Courier New,Monospace,mono|bold'
  21920. @end example
  21921. @item
  21922. Custom frequency range with custom axis using image file:
  21923. @example
  21924. axisfile=myaxis.png:basefreq=40:endfreq=10000
  21925. @end example
  21926. @end itemize
  21927. @section showfreqs
  21928. Convert input audio to video output representing the audio power spectrum.
  21929. Audio amplitude is on Y-axis while frequency is on X-axis.
  21930. The filter accepts the following options:
  21931. @table @option
  21932. @item size, s
  21933. Specify size of video. For the syntax of this option, check the
  21934. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21935. Default is @code{1024x512}.
  21936. @item rate, r
  21937. Set video rate. Default is @code{25}.
  21938. @item mode
  21939. Set display mode.
  21940. This set how each frequency bin will be represented.
  21941. It accepts the following values:
  21942. @table @samp
  21943. @item line
  21944. @item bar
  21945. @item dot
  21946. @end table
  21947. Default is @code{bar}.
  21948. @item ascale
  21949. Set amplitude scale.
  21950. It accepts the following values:
  21951. @table @samp
  21952. @item lin
  21953. Linear scale.
  21954. @item sqrt
  21955. Square root scale.
  21956. @item cbrt
  21957. Cubic root scale.
  21958. @item log
  21959. Logarithmic scale.
  21960. @end table
  21961. Default is @code{log}.
  21962. @item fscale
  21963. Set frequency scale.
  21964. It accepts the following values:
  21965. @table @samp
  21966. @item lin
  21967. Linear scale.
  21968. @item log
  21969. Logarithmic scale.
  21970. @item rlog
  21971. Reverse logarithmic scale.
  21972. @end table
  21973. Default is @code{lin}.
  21974. @item win_size
  21975. Set window size. Allowed range is from 16 to 65536.
  21976. Default is @code{2048}
  21977. @item win_func
  21978. Set windowing function.
  21979. It accepts the following values:
  21980. @table @samp
  21981. @item rect
  21982. @item bartlett
  21983. @item hanning
  21984. @item hamming
  21985. @item blackman
  21986. @item welch
  21987. @item flattop
  21988. @item bharris
  21989. @item bnuttall
  21990. @item bhann
  21991. @item sine
  21992. @item nuttall
  21993. @item lanczos
  21994. @item gauss
  21995. @item tukey
  21996. @item dolph
  21997. @item cauchy
  21998. @item parzen
  21999. @item poisson
  22000. @item bohman
  22001. @end table
  22002. Default is @code{hanning}.
  22003. @item overlap
  22004. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  22005. which means optimal overlap for selected window function will be picked.
  22006. @item averaging
  22007. Set time averaging. Setting this to 0 will display current maximal peaks.
  22008. Default is @code{1}, which means time averaging is disabled.
  22009. @item colors
  22010. Specify list of colors separated by space or by '|' which will be used to
  22011. draw channel frequencies. Unrecognized or missing colors will be replaced
  22012. by white color.
  22013. @item cmode
  22014. Set channel display mode.
  22015. It accepts the following values:
  22016. @table @samp
  22017. @item combined
  22018. @item separate
  22019. @end table
  22020. Default is @code{combined}.
  22021. @item minamp
  22022. Set minimum amplitude used in @code{log} amplitude scaler.
  22023. @item data
  22024. Set data display mode.
  22025. It accepts the following values:
  22026. @table @samp
  22027. @item magnitude
  22028. @item phase
  22029. @item delay
  22030. @end table
  22031. Default is @code{magnitude}.
  22032. @item channels
  22033. Set channels to use when processing audio. By default all are processed.
  22034. @end table
  22035. @section showspatial
  22036. Convert stereo input audio to a video output, representing the spatial relationship
  22037. between two channels.
  22038. The filter accepts the following options:
  22039. @table @option
  22040. @item size, s
  22041. Specify the video size for the output. For the syntax of this option, check the
  22042. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22043. Default value is @code{512x512}.
  22044. @item win_size
  22045. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  22046. @item win_func
  22047. Set window function.
  22048. It accepts the following values:
  22049. @table @samp
  22050. @item rect
  22051. @item bartlett
  22052. @item hann
  22053. @item hanning
  22054. @item hamming
  22055. @item blackman
  22056. @item welch
  22057. @item flattop
  22058. @item bharris
  22059. @item bnuttall
  22060. @item bhann
  22061. @item sine
  22062. @item nuttall
  22063. @item lanczos
  22064. @item gauss
  22065. @item tukey
  22066. @item dolph
  22067. @item cauchy
  22068. @item parzen
  22069. @item poisson
  22070. @item bohman
  22071. @end table
  22072. Default value is @code{hann}.
  22073. @item overlap
  22074. Set ratio of overlap window. Default value is @code{0.5}.
  22075. When value is @code{1} overlap is set to recommended size for specific
  22076. window function currently used.
  22077. @end table
  22078. @anchor{showspectrum}
  22079. @section showspectrum
  22080. Convert input audio to a video output, representing the audio frequency
  22081. spectrum.
  22082. The filter accepts the following options:
  22083. @table @option
  22084. @item size, s
  22085. Specify the video size for the output. For the syntax of this option, check the
  22086. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22087. Default value is @code{640x512}.
  22088. @item slide
  22089. Specify how the spectrum should slide along the window.
  22090. It accepts the following values:
  22091. @table @samp
  22092. @item replace
  22093. the samples start again on the left when they reach the right
  22094. @item scroll
  22095. the samples scroll from right to left
  22096. @item fullframe
  22097. frames are only produced when the samples reach the right
  22098. @item rscroll
  22099. the samples scroll from left to right
  22100. @item lreplace
  22101. the samples start again on the right when they reach the left
  22102. @end table
  22103. Default value is @code{replace}.
  22104. @item mode
  22105. Specify display mode.
  22106. It accepts the following values:
  22107. @table @samp
  22108. @item combined
  22109. all channels are displayed in the same row
  22110. @item separate
  22111. all channels are displayed in separate rows
  22112. @end table
  22113. Default value is @samp{combined}.
  22114. @item color
  22115. Specify display color mode.
  22116. It accepts the following values:
  22117. @table @samp
  22118. @item channel
  22119. each channel is displayed in a separate color
  22120. @item intensity
  22121. each channel is displayed using the same color scheme
  22122. @item rainbow
  22123. each channel is displayed using the rainbow color scheme
  22124. @item moreland
  22125. each channel is displayed using the moreland color scheme
  22126. @item nebulae
  22127. each channel is displayed using the nebulae color scheme
  22128. @item fire
  22129. each channel is displayed using the fire color scheme
  22130. @item fiery
  22131. each channel is displayed using the fiery color scheme
  22132. @item fruit
  22133. each channel is displayed using the fruit color scheme
  22134. @item cool
  22135. each channel is displayed using the cool color scheme
  22136. @item magma
  22137. each channel is displayed using the magma color scheme
  22138. @item green
  22139. each channel is displayed using the green color scheme
  22140. @item viridis
  22141. each channel is displayed using the viridis color scheme
  22142. @item plasma
  22143. each channel is displayed using the plasma color scheme
  22144. @item cividis
  22145. each channel is displayed using the cividis color scheme
  22146. @item terrain
  22147. each channel is displayed using the terrain color scheme
  22148. @end table
  22149. Default value is @samp{channel}.
  22150. @item scale
  22151. Specify scale used for calculating intensity color values.
  22152. It accepts the following values:
  22153. @table @samp
  22154. @item lin
  22155. linear
  22156. @item sqrt
  22157. square root, default
  22158. @item cbrt
  22159. cubic root
  22160. @item log
  22161. logarithmic
  22162. @item 4thrt
  22163. 4th root
  22164. @item 5thrt
  22165. 5th root
  22166. @end table
  22167. Default value is @samp{sqrt}.
  22168. @item fscale
  22169. Specify frequency scale.
  22170. It accepts the following values:
  22171. @table @samp
  22172. @item lin
  22173. linear
  22174. @item log
  22175. logarithmic
  22176. @end table
  22177. Default value is @samp{lin}.
  22178. @item saturation
  22179. Set saturation modifier for displayed colors. Negative values provide
  22180. alternative color scheme. @code{0} is no saturation at all.
  22181. Saturation must be in [-10.0, 10.0] range.
  22182. Default value is @code{1}.
  22183. @item win_func
  22184. Set window function.
  22185. It accepts the following values:
  22186. @table @samp
  22187. @item rect
  22188. @item bartlett
  22189. @item hann
  22190. @item hanning
  22191. @item hamming
  22192. @item blackman
  22193. @item welch
  22194. @item flattop
  22195. @item bharris
  22196. @item bnuttall
  22197. @item bhann
  22198. @item sine
  22199. @item nuttall
  22200. @item lanczos
  22201. @item gauss
  22202. @item tukey
  22203. @item dolph
  22204. @item cauchy
  22205. @item parzen
  22206. @item poisson
  22207. @item bohman
  22208. @end table
  22209. Default value is @code{hann}.
  22210. @item orientation
  22211. Set orientation of time vs frequency axis. Can be @code{vertical} or
  22212. @code{horizontal}. Default is @code{vertical}.
  22213. @item overlap
  22214. Set ratio of overlap window. Default value is @code{0}.
  22215. When value is @code{1} overlap is set to recommended size for specific
  22216. window function currently used.
  22217. @item gain
  22218. Set scale gain for calculating intensity color values.
  22219. Default value is @code{1}.
  22220. @item data
  22221. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  22222. or unwrapped phase: @code{uphase}.
  22223. @item rotation
  22224. Set color rotation, must be in [-1.0, 1.0] range.
  22225. Default value is @code{0}.
  22226. @item start
  22227. Set start frequency from which to display spectrogram. Default is @code{0}.
  22228. @item stop
  22229. Set stop frequency to which to display spectrogram. Default is @code{0}.
  22230. @item fps
  22231. Set upper frame rate limit. Default is @code{auto}, unlimited.
  22232. @item legend
  22233. Draw time and frequency axes and legends. Default is disabled.
  22234. @item drange
  22235. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  22236. Allowed range is from 10 to 200.
  22237. @item limit
  22238. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  22239. Allowed range is from -100 to 100.
  22240. @item opacity
  22241. Set opacity strength when using pixel format output with alpha component.
  22242. @end table
  22243. The usage is very similar to the showwaves filter; see the examples in that
  22244. section.
  22245. @subsection Examples
  22246. @itemize
  22247. @item
  22248. Large window with logarithmic color scaling:
  22249. @example
  22250. showspectrum=s=1280x480:scale=log
  22251. @end example
  22252. @item
  22253. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  22254. @example
  22255. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  22256. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  22257. @end example
  22258. @end itemize
  22259. @section showspectrumpic
  22260. Convert input audio to a single video frame, representing the audio frequency
  22261. spectrum.
  22262. The filter accepts the following options:
  22263. @table @option
  22264. @item size, s
  22265. Specify the video size for the output. For the syntax of this option, check the
  22266. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22267. Default value is @code{4096x2048}.
  22268. @item mode
  22269. Specify display mode.
  22270. It accepts the following values:
  22271. @table @samp
  22272. @item combined
  22273. all channels are displayed in the same row
  22274. @item separate
  22275. all channels are displayed in separate rows
  22276. @end table
  22277. Default value is @samp{combined}.
  22278. @item color
  22279. Specify display color mode.
  22280. It accepts the following values:
  22281. @table @samp
  22282. @item channel
  22283. each channel is displayed in a separate color
  22284. @item intensity
  22285. each channel is displayed using the same color scheme
  22286. @item rainbow
  22287. each channel is displayed using the rainbow color scheme
  22288. @item moreland
  22289. each channel is displayed using the moreland color scheme
  22290. @item nebulae
  22291. each channel is displayed using the nebulae color scheme
  22292. @item fire
  22293. each channel is displayed using the fire color scheme
  22294. @item fiery
  22295. each channel is displayed using the fiery color scheme
  22296. @item fruit
  22297. each channel is displayed using the fruit color scheme
  22298. @item cool
  22299. each channel is displayed using the cool color scheme
  22300. @item magma
  22301. each channel is displayed using the magma color scheme
  22302. @item green
  22303. each channel is displayed using the green color scheme
  22304. @item viridis
  22305. each channel is displayed using the viridis color scheme
  22306. @item plasma
  22307. each channel is displayed using the plasma color scheme
  22308. @item cividis
  22309. each channel is displayed using the cividis color scheme
  22310. @item terrain
  22311. each channel is displayed using the terrain color scheme
  22312. @end table
  22313. Default value is @samp{intensity}.
  22314. @item scale
  22315. Specify scale used for calculating intensity color values.
  22316. It accepts the following values:
  22317. @table @samp
  22318. @item lin
  22319. linear
  22320. @item sqrt
  22321. square root, default
  22322. @item cbrt
  22323. cubic root
  22324. @item log
  22325. logarithmic
  22326. @item 4thrt
  22327. 4th root
  22328. @item 5thrt
  22329. 5th root
  22330. @end table
  22331. Default value is @samp{log}.
  22332. @item fscale
  22333. Specify frequency scale.
  22334. It accepts the following values:
  22335. @table @samp
  22336. @item lin
  22337. linear
  22338. @item log
  22339. logarithmic
  22340. @end table
  22341. Default value is @samp{lin}.
  22342. @item saturation
  22343. Set saturation modifier for displayed colors. Negative values provide
  22344. alternative color scheme. @code{0} is no saturation at all.
  22345. Saturation must be in [-10.0, 10.0] range.
  22346. Default value is @code{1}.
  22347. @item win_func
  22348. Set window function.
  22349. It accepts the following values:
  22350. @table @samp
  22351. @item rect
  22352. @item bartlett
  22353. @item hann
  22354. @item hanning
  22355. @item hamming
  22356. @item blackman
  22357. @item welch
  22358. @item flattop
  22359. @item bharris
  22360. @item bnuttall
  22361. @item bhann
  22362. @item sine
  22363. @item nuttall
  22364. @item lanczos
  22365. @item gauss
  22366. @item tukey
  22367. @item dolph
  22368. @item cauchy
  22369. @item parzen
  22370. @item poisson
  22371. @item bohman
  22372. @end table
  22373. Default value is @code{hann}.
  22374. @item orientation
  22375. Set orientation of time vs frequency axis. Can be @code{vertical} or
  22376. @code{horizontal}. Default is @code{vertical}.
  22377. @item gain
  22378. Set scale gain for calculating intensity color values.
  22379. Default value is @code{1}.
  22380. @item legend
  22381. Draw time and frequency axes and legends. Default is enabled.
  22382. @item rotation
  22383. Set color rotation, must be in [-1.0, 1.0] range.
  22384. Default value is @code{0}.
  22385. @item start
  22386. Set start frequency from which to display spectrogram. Default is @code{0}.
  22387. @item stop
  22388. Set stop frequency to which to display spectrogram. Default is @code{0}.
  22389. @item drange
  22390. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  22391. Allowed range is from 10 to 200.
  22392. @item limit
  22393. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  22394. Allowed range is from -100 to 100.
  22395. @item opacity
  22396. Set opacity strength when using pixel format output with alpha component.
  22397. @end table
  22398. @subsection Examples
  22399. @itemize
  22400. @item
  22401. Extract an audio spectrogram of a whole audio track
  22402. in a 1024x1024 picture using @command{ffmpeg}:
  22403. @example
  22404. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  22405. @end example
  22406. @end itemize
  22407. @section showvolume
  22408. Convert input audio volume to a video output.
  22409. The filter accepts the following options:
  22410. @table @option
  22411. @item rate, r
  22412. Set video rate.
  22413. @item b
  22414. Set border width, allowed range is [0, 5]. Default is 1.
  22415. @item w
  22416. Set channel width, allowed range is [80, 8192]. Default is 400.
  22417. @item h
  22418. Set channel height, allowed range is [1, 900]. Default is 20.
  22419. @item f
  22420. Set fade, allowed range is [0, 1]. Default is 0.95.
  22421. @item c
  22422. Set volume color expression.
  22423. The expression can use the following variables:
  22424. @table @option
  22425. @item VOLUME
  22426. Current max volume of channel in dB.
  22427. @item PEAK
  22428. Current peak.
  22429. @item CHANNEL
  22430. Current channel number, starting from 0.
  22431. @end table
  22432. @item t
  22433. If set, displays channel names. Default is enabled.
  22434. @item v
  22435. If set, displays volume values. Default is enabled.
  22436. @item o
  22437. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  22438. default is @code{h}.
  22439. @item s
  22440. Set step size, allowed range is [0, 5]. Default is 0, which means
  22441. step is disabled.
  22442. @item p
  22443. Set background opacity, allowed range is [0, 1]. Default is 0.
  22444. @item m
  22445. Set metering mode, can be peak: @code{p} or rms: @code{r},
  22446. default is @code{p}.
  22447. @item ds
  22448. Set display scale, can be linear: @code{lin} or log: @code{log},
  22449. default is @code{lin}.
  22450. @item dm
  22451. In second.
  22452. If set to > 0., display a line for the max level
  22453. in the previous seconds.
  22454. default is disabled: @code{0.}
  22455. @item dmc
  22456. The color of the max line. Use when @code{dm} option is set to > 0.
  22457. default is: @code{orange}
  22458. @end table
  22459. @section showwaves
  22460. Convert input audio to a video output, representing the samples waves.
  22461. The filter accepts the following options:
  22462. @table @option
  22463. @item size, s
  22464. Specify the video size for the output. For the syntax of this option, check the
  22465. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22466. Default value is @code{600x240}.
  22467. @item mode
  22468. Set display mode.
  22469. Available values are:
  22470. @table @samp
  22471. @item point
  22472. Draw a point for each sample.
  22473. @item line
  22474. Draw a vertical line for each sample.
  22475. @item p2p
  22476. Draw a point for each sample and a line between them.
  22477. @item cline
  22478. Draw a centered vertical line for each sample.
  22479. @end table
  22480. Default value is @code{point}.
  22481. @item n
  22482. Set the number of samples which are printed on the same column. A
  22483. larger value will decrease the frame rate. Must be a positive
  22484. integer. This option can be set only if the value for @var{rate}
  22485. is not explicitly specified.
  22486. @item rate, r
  22487. Set the (approximate) output frame rate. This is done by setting the
  22488. option @var{n}. Default value is "25".
  22489. @item split_channels
  22490. Set if channels should be drawn separately or overlap. Default value is 0.
  22491. @item colors
  22492. Set colors separated by '|' which are going to be used for drawing of each channel.
  22493. @item scale
  22494. Set amplitude scale.
  22495. Available values are:
  22496. @table @samp
  22497. @item lin
  22498. Linear.
  22499. @item log
  22500. Logarithmic.
  22501. @item sqrt
  22502. Square root.
  22503. @item cbrt
  22504. Cubic root.
  22505. @end table
  22506. Default is linear.
  22507. @item draw
  22508. Set the draw mode. This is mostly useful to set for high @var{n}.
  22509. Available values are:
  22510. @table @samp
  22511. @item scale
  22512. Scale pixel values for each drawn sample.
  22513. @item full
  22514. Draw every sample directly.
  22515. @end table
  22516. Default value is @code{scale}.
  22517. @end table
  22518. @subsection Examples
  22519. @itemize
  22520. @item
  22521. Output the input file audio and the corresponding video representation
  22522. at the same time:
  22523. @example
  22524. amovie=a.mp3,asplit[out0],showwaves[out1]
  22525. @end example
  22526. @item
  22527. Create a synthetic signal and show it with showwaves, forcing a
  22528. frame rate of 30 frames per second:
  22529. @example
  22530. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  22531. @end example
  22532. @end itemize
  22533. @section showwavespic
  22534. Convert input audio to a single video frame, representing the samples waves.
  22535. The filter accepts the following options:
  22536. @table @option
  22537. @item size, s
  22538. Specify the video size for the output. For the syntax of this option, check the
  22539. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22540. Default value is @code{600x240}.
  22541. @item split_channels
  22542. Set if channels should be drawn separately or overlap. Default value is 0.
  22543. @item colors
  22544. Set colors separated by '|' which are going to be used for drawing of each channel.
  22545. @item scale
  22546. Set amplitude scale.
  22547. Available values are:
  22548. @table @samp
  22549. @item lin
  22550. Linear.
  22551. @item log
  22552. Logarithmic.
  22553. @item sqrt
  22554. Square root.
  22555. @item cbrt
  22556. Cubic root.
  22557. @end table
  22558. Default is linear.
  22559. @item draw
  22560. Set the draw mode.
  22561. Available values are:
  22562. @table @samp
  22563. @item scale
  22564. Scale pixel values for each drawn sample.
  22565. @item full
  22566. Draw every sample directly.
  22567. @end table
  22568. Default value is @code{scale}.
  22569. @item filter
  22570. Set the filter mode.
  22571. Available values are:
  22572. @table @samp
  22573. @item average
  22574. Use average samples values for each drawn sample.
  22575. @item peak
  22576. Use peak samples values for each drawn sample.
  22577. @end table
  22578. Default value is @code{average}.
  22579. @end table
  22580. @subsection Examples
  22581. @itemize
  22582. @item
  22583. Extract a channel split representation of the wave form of a whole audio track
  22584. in a 1024x800 picture using @command{ffmpeg}:
  22585. @example
  22586. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  22587. @end example
  22588. @end itemize
  22589. @section sidedata, asidedata
  22590. Delete frame side data, or select frames based on it.
  22591. This filter accepts the following options:
  22592. @table @option
  22593. @item mode
  22594. Set mode of operation of the filter.
  22595. Can be one of the following:
  22596. @table @samp
  22597. @item select
  22598. Select every frame with side data of @code{type}.
  22599. @item delete
  22600. Delete side data of @code{type}. If @code{type} is not set, delete all side
  22601. data in the frame.
  22602. @end table
  22603. @item type
  22604. Set side data type used with all modes. Must be set for @code{select} mode. For
  22605. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  22606. in @file{libavutil/frame.h}. For example, to choose
  22607. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  22608. @end table
  22609. @section spectrumsynth
  22610. Synthesize audio from 2 input video spectrums, first input stream represents
  22611. magnitude across time and second represents phase across time.
  22612. The filter will transform from frequency domain as displayed in videos back
  22613. to time domain as presented in audio output.
  22614. This filter is primarily created for reversing processed @ref{showspectrum}
  22615. filter outputs, but can synthesize sound from other spectrograms too.
  22616. But in such case results are going to be poor if the phase data is not
  22617. available, because in such cases phase data need to be recreated, usually
  22618. it's just recreated from random noise.
  22619. For best results use gray only output (@code{channel} color mode in
  22620. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  22621. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  22622. @code{data} option. Inputs videos should generally use @code{fullframe}
  22623. slide mode as that saves resources needed for decoding video.
  22624. The filter accepts the following options:
  22625. @table @option
  22626. @item sample_rate
  22627. Specify sample rate of output audio, the sample rate of audio from which
  22628. spectrum was generated may differ.
  22629. @item channels
  22630. Set number of channels represented in input video spectrums.
  22631. @item scale
  22632. Set scale which was used when generating magnitude input spectrum.
  22633. Can be @code{lin} or @code{log}. Default is @code{log}.
  22634. @item slide
  22635. Set slide which was used when generating inputs spectrums.
  22636. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  22637. Default is @code{fullframe}.
  22638. @item win_func
  22639. Set window function used for resynthesis.
  22640. @item overlap
  22641. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  22642. which means optimal overlap for selected window function will be picked.
  22643. @item orientation
  22644. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  22645. Default is @code{vertical}.
  22646. @end table
  22647. @subsection Examples
  22648. @itemize
  22649. @item
  22650. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  22651. then resynthesize videos back to audio with spectrumsynth:
  22652. @example
  22653. 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
  22654. 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
  22655. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  22656. @end example
  22657. @end itemize
  22658. @section split, asplit
  22659. Split input into several identical outputs.
  22660. @code{asplit} works with audio input, @code{split} with video.
  22661. The filter accepts a single parameter which specifies the number of outputs. If
  22662. unspecified, it defaults to 2.
  22663. @subsection Examples
  22664. @itemize
  22665. @item
  22666. Create two separate outputs from the same input:
  22667. @example
  22668. [in] split [out0][out1]
  22669. @end example
  22670. @item
  22671. To create 3 or more outputs, you need to specify the number of
  22672. outputs, like in:
  22673. @example
  22674. [in] asplit=3 [out0][out1][out2]
  22675. @end example
  22676. @item
  22677. Create two separate outputs from the same input, one cropped and
  22678. one padded:
  22679. @example
  22680. [in] split [splitout1][splitout2];
  22681. [splitout1] crop=100:100:0:0 [cropout];
  22682. [splitout2] pad=200:200:100:100 [padout];
  22683. @end example
  22684. @item
  22685. Create 5 copies of the input audio with @command{ffmpeg}:
  22686. @example
  22687. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  22688. @end example
  22689. @end itemize
  22690. @section zmq, azmq
  22691. Receive commands sent through a libzmq client, and forward them to
  22692. filters in the filtergraph.
  22693. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  22694. must be inserted between two video filters, @code{azmq} between two
  22695. audio filters. Both are capable to send messages to any filter type.
  22696. To enable these filters you need to install the libzmq library and
  22697. headers and configure FFmpeg with @code{--enable-libzmq}.
  22698. For more information about libzmq see:
  22699. @url{http://www.zeromq.org/}
  22700. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  22701. receives messages sent through a network interface defined by the
  22702. @option{bind_address} (or the abbreviation "@option{b}") option.
  22703. Default value of this option is @file{tcp://localhost:5555}. You may
  22704. want to alter this value to your needs, but do not forget to escape any
  22705. ':' signs (see @ref{filtergraph escaping}).
  22706. The received message must be in the form:
  22707. @example
  22708. @var{TARGET} @var{COMMAND} [@var{ARG}]
  22709. @end example
  22710. @var{TARGET} specifies the target of the command, usually the name of
  22711. the filter class or a specific filter instance name. The default
  22712. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  22713. but you can override this by using the @samp{filter_name@@id} syntax
  22714. (see @ref{Filtergraph syntax}).
  22715. @var{COMMAND} specifies the name of the command for the target filter.
  22716. @var{ARG} is optional and specifies the optional argument list for the
  22717. given @var{COMMAND}.
  22718. Upon reception, the message is processed and the corresponding command
  22719. is injected into the filtergraph. Depending on the result, the filter
  22720. will send a reply to the client, adopting the format:
  22721. @example
  22722. @var{ERROR_CODE} @var{ERROR_REASON}
  22723. @var{MESSAGE}
  22724. @end example
  22725. @var{MESSAGE} is optional.
  22726. @subsection Examples
  22727. Look at @file{tools/zmqsend} for an example of a zmq client which can
  22728. be used to send commands processed by these filters.
  22729. Consider the following filtergraph generated by @command{ffplay}.
  22730. In this example the last overlay filter has an instance name. All other
  22731. filters will have default instance names.
  22732. @example
  22733. ffplay -dumpgraph 1 -f lavfi "
  22734. color=s=100x100:c=red [l];
  22735. color=s=100x100:c=blue [r];
  22736. nullsrc=s=200x100, zmq [bg];
  22737. [bg][l] overlay [bg+l];
  22738. [bg+l][r] overlay@@my=x=100 "
  22739. @end example
  22740. To change the color of the left side of the video, the following
  22741. command can be used:
  22742. @example
  22743. echo Parsed_color_0 c yellow | tools/zmqsend
  22744. @end example
  22745. To change the right side:
  22746. @example
  22747. echo Parsed_color_1 c pink | tools/zmqsend
  22748. @end example
  22749. To change the position of the right side:
  22750. @example
  22751. echo overlay@@my x 150 | tools/zmqsend
  22752. @end example
  22753. @c man end MULTIMEDIA FILTERS
  22754. @chapter Multimedia Sources
  22755. @c man begin MULTIMEDIA SOURCES
  22756. Below is a description of the currently available multimedia sources.
  22757. @section amovie
  22758. This is the same as @ref{movie} source, except it selects an audio
  22759. stream by default.
  22760. @section avsynctest
  22761. Generate an Audio/Video Sync Test.
  22762. Generated stream periodically shows flash video frame and emits beep in audio.
  22763. Useful to inspect A/V sync issues.
  22764. It accepts the following options:
  22765. @table @option
  22766. @item size, s
  22767. Set output video size. Default value is @code{hd720}.
  22768. @item framerate, fr
  22769. Set output video frame rate. Default value is @code{30}.
  22770. @item samplerate, sr
  22771. Set output audio sample rate. Default value is @code{44100}.
  22772. @item amplitude, a
  22773. Set output audio beep amplitude. Default value is @code{0.7}.
  22774. @item period, p
  22775. Set output audio beep period in seconds. Default value is @code{3}.
  22776. @item delay, dl
  22777. Set output video flash delay in number of frames. Default value is @code{0}.
  22778. @item cycle, c
  22779. Enable cycling of video delays, by default is disabled.
  22780. @item duration, d
  22781. Set stream output duration. By default duration is unlimited.
  22782. @item fg, bg, ag
  22783. Set foreground/background/additional color.
  22784. @end table
  22785. @anchor{movie}
  22786. @section movie
  22787. Read audio and/or video stream(s) from a movie container.
  22788. It accepts the following parameters:
  22789. @table @option
  22790. @item filename
  22791. The name of the resource to read (not necessarily a file; it can also be a
  22792. device or a stream accessed through some protocol).
  22793. @item format_name, f
  22794. Specifies the format assumed for the movie to read, and can be either
  22795. the name of a container or an input device. If not specified, the
  22796. format is guessed from @var{movie_name} or by probing.
  22797. @item seek_point, sp
  22798. Specifies the seek point in seconds. The frames will be output
  22799. starting from this seek point. The parameter is evaluated with
  22800. @code{av_strtod}, so the numerical value may be suffixed by an IS
  22801. postfix. The default value is "0".
  22802. @item streams, s
  22803. Specifies the streams to read. Several streams can be specified,
  22804. separated by "+". The source will then have as many outputs, in the
  22805. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  22806. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  22807. respectively the default (best suited) video and audio stream. Default
  22808. is "dv", or "da" if the filter is called as "amovie".
  22809. @item stream_index, si
  22810. Specifies the index of the video stream to read. If the value is -1,
  22811. the most suitable video stream will be automatically selected. The default
  22812. value is "-1". Deprecated. If the filter is called "amovie", it will select
  22813. audio instead of video.
  22814. @item loop
  22815. Specifies how many times to read the stream in sequence.
  22816. If the value is 0, the stream will be looped infinitely.
  22817. Default value is "1".
  22818. Note that when the movie is looped the source timestamps are not
  22819. changed, so it will generate non monotonically increasing timestamps.
  22820. @item discontinuity
  22821. Specifies the time difference between frames above which the point is
  22822. considered a timestamp discontinuity which is removed by adjusting the later
  22823. timestamps.
  22824. @item dec_threads
  22825. Specifies the number of threads for decoding
  22826. @item format_opts
  22827. Specify format options for the opened file. Format options can be specified
  22828. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  22829. shows how to add protocol_whitelist and protocol_blacklist options:
  22830. @example
  22831. ffplay -f lavfi
  22832. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  22833. @end example
  22834. @end table
  22835. It allows overlaying a second video on top of the main input of
  22836. a filtergraph, as shown in this graph:
  22837. @example
  22838. input -----------> deltapts0 --> overlay --> output
  22839. ^
  22840. |
  22841. movie --> scale--> deltapts1 -------+
  22842. @end example
  22843. @subsection Examples
  22844. @itemize
  22845. @item
  22846. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  22847. on top of the input labelled "in":
  22848. @example
  22849. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  22850. [in] setpts=PTS-STARTPTS [main];
  22851. [main][over] overlay=16:16 [out]
  22852. @end example
  22853. @item
  22854. Read from a video4linux2 device, and overlay it on top of the input
  22855. labelled "in":
  22856. @example
  22857. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  22858. [in] setpts=PTS-STARTPTS [main];
  22859. [main][over] overlay=16:16 [out]
  22860. @end example
  22861. @item
  22862. Read the first video stream and the audio stream with id 0x81 from
  22863. dvd.vob; the video is connected to the pad named "video" and the audio is
  22864. connected to the pad named "audio":
  22865. @example
  22866. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  22867. @end example
  22868. @end itemize
  22869. @subsection Commands
  22870. Both movie and amovie support the following commands:
  22871. @table @option
  22872. @item seek
  22873. Perform seek using "av_seek_frame".
  22874. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  22875. @itemize
  22876. @item
  22877. @var{stream_index}: If stream_index is -1, a default
  22878. stream is selected, and @var{timestamp} is automatically converted
  22879. from AV_TIME_BASE units to the stream specific time_base.
  22880. @item
  22881. @var{timestamp}: Timestamp in AVStream.time_base units
  22882. or, if no stream is specified, in AV_TIME_BASE units.
  22883. @item
  22884. @var{flags}: Flags which select direction and seeking mode.
  22885. @end itemize
  22886. @item get_duration
  22887. Get movie duration in AV_TIME_BASE units.
  22888. @end table
  22889. @c man end MULTIMEDIA SOURCES