filters.texi 901 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. A special syntax implemented in the @command{ffmpeg} CLI tool allows loading
  138. option values from files. This is done be prepending a slash '/' to the option
  139. name, then the supplied value is interpreted as a path from which the actual
  140. value is loaded. E.g.
  141. @example
  142. ffmpeg -i <INPUT> -vf drawtext=/text=/tmp/some_text <OUTPUT>
  143. @end example
  144. will load the text to be drawn from @file{/tmp/some_text}. API users wishing to
  145. implement a similar feature should use the @code{avfilter_graph_segment_*()}
  146. functions together with custom IO code.
  147. The name and arguments of the filter are optionally preceded and
  148. followed by a list of link labels.
  149. A link label allows one to name a link and associate it to a filter output
  150. or input pad. The preceding labels @var{in_link_1}
  151. ... @var{in_link_N}, are associated to the filter input pads,
  152. the following labels @var{out_link_1} ... @var{out_link_M}, are
  153. associated to the output pads.
  154. When two link labels with the same name are found in the
  155. filtergraph, a link between the corresponding input and output pad is
  156. created.
  157. If an output pad is not labelled, it is linked by default to the first
  158. unlabelled input pad of the next filter in the filterchain.
  159. For example in the filterchain
  160. @example
  161. nullsrc, split[L1], [L2]overlay, nullsink
  162. @end example
  163. the split filter instance has two output pads, and the overlay filter
  164. instance two input pads. The first output pad of split is labelled
  165. "L1", the first input pad of overlay is labelled "L2", and the second
  166. output pad of split is linked to the second input pad of overlay,
  167. which are both unlabelled.
  168. In a filter description, if the input label of the first filter is not
  169. specified, "in" is assumed; if the output label of the last filter is not
  170. specified, "out" is assumed.
  171. In a complete filterchain all the unlabelled filter input and output
  172. pads must be connected. A filtergraph is considered valid if all the
  173. filter input and output pads of all the filterchains are connected.
  174. Leading and trailing whitespaces (space, tabs, or line feeds) separating tokens
  175. in the filtergraph specification are ignored. This means that the filtergraph
  176. can be expressed using empty lines and spaces to improve redability.
  177. For example, the filtergraph:
  178. @example
  179. testsrc,split[L1],hflip[L2];[L1][L2] hstack
  180. @end example
  181. can be represented as:
  182. @example
  183. testsrc,
  184. split [L1], hflip [L2];
  185. [L1][L2] hstack
  186. @end example
  187. Libavfilter will automatically insert @ref{scale} filters where format
  188. conversion is required. It is possible to specify swscale flags
  189. for those automatically inserted scalers by prepending
  190. @code{sws_flags=@var{flags};}
  191. to the filtergraph description.
  192. Here is a BNF description of the filtergraph syntax:
  193. @example
  194. @var{NAME} ::= sequence of alphanumeric characters and '_'
  195. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  196. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  197. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  198. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  199. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  200. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  201. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  202. @end example
  203. @anchor{filtergraph escaping}
  204. @section Notes on filtergraph escaping
  205. Filtergraph description composition entails several levels of
  206. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  207. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  208. information about the employed escaping procedure.
  209. A first level escaping affects the content of each filter option
  210. value, which may contain the special character @code{:} used to
  211. separate values, or one of the escaping characters @code{\'}.
  212. A second level escaping affects the whole filter description, which
  213. may contain the escaping characters @code{\'} or the special
  214. characters @code{[],;} used by the filtergraph description.
  215. Finally, when you specify a filtergraph on a shell commandline, you
  216. need to perform a third level escaping for the shell special
  217. characters contained within it.
  218. For example, consider the following string to be embedded in
  219. the @ref{drawtext} filter description @option{text} value:
  220. @example
  221. this is a 'string': may contain one, or more, special characters
  222. @end example
  223. This string contains the @code{'} special escaping character, and the
  224. @code{:} special character, so it needs to be escaped in this way:
  225. @example
  226. text=this is a \'string\'\: may contain one, or more, special characters
  227. @end example
  228. A second level of escaping is required when embedding the filter
  229. description in a filtergraph description, in order to escape all the
  230. filtergraph special characters. Thus the example above becomes:
  231. @example
  232. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  233. @end example
  234. (note that in addition to the @code{\'} escaping special characters,
  235. also @code{,} needs to be escaped).
  236. Finally an additional level of escaping is needed when writing the
  237. filtergraph description in a shell command, which depends on the
  238. escaping rules of the adopted shell. For example, assuming that
  239. @code{\} is special and needs to be escaped with another @code{\}, the
  240. previous string will finally result in:
  241. @example
  242. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  243. @end example
  244. In order to avoid cumbersome escaping when using a commandline tool accepting a
  245. filter specification as input, it is advisable to avoid direct inclusion of the
  246. filter or options specification in the shell.
  247. For example, in case of the @ref{drawtext,,drawtext filter}, you might prefer to
  248. use the @option{textfile} option in place of @option{text} to specify the text
  249. to render.
  250. @chapter Timeline editing
  251. Some filters support a generic @option{enable} option. For the filters
  252. supporting timeline editing, this option can be set to an expression which is
  253. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  254. the filter will be enabled, otherwise the frame will be sent unchanged to the
  255. next filter in the filtergraph.
  256. The expression accepts the following values:
  257. @table @samp
  258. @item t
  259. timestamp expressed in seconds, NAN if the input timestamp is unknown
  260. @item n
  261. sequential number of the input frame, starting from 0
  262. @item pos
  263. the position in the file of the input frame, NAN if unknown; deprecated, do
  264. not use
  265. @item w
  266. @item h
  267. width and height of the input frame if video
  268. @end table
  269. Additionally, these filters support an @option{enable} command that can be used
  270. to re-define the expression.
  271. Like any other filtering option, the @option{enable} option follows the same
  272. rules.
  273. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  274. minutes, and a @ref{curves} filter starting at 3 seconds:
  275. @example
  276. smartblur = enable='between(t,10,3*60)',
  277. curves = enable='gte(t,3)' : preset=cross_process
  278. @end example
  279. See @code{ffmpeg -filters} to view which filters have timeline support.
  280. @c man end FILTERGRAPH DESCRIPTION
  281. @anchor{commands}
  282. @chapter Changing options at runtime with a command
  283. Some options can be changed during the operation of the filter using
  284. a command. These options are marked 'T' on the output of
  285. @command{ffmpeg} @option{-h filter=<name of filter>}.
  286. The name of the command is the name of the option and the argument is
  287. the new value.
  288. @anchor{framesync}
  289. @chapter Options for filters with several inputs (framesync)
  290. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  291. Some filters with several inputs support a common set of options.
  292. These options can only be set by name, not with the short notation.
  293. @table @option
  294. @item eof_action
  295. The action to take when EOF is encountered on the secondary input; it accepts
  296. one of the following values:
  297. @table @option
  298. @item repeat
  299. Repeat the last frame (the default).
  300. @item endall
  301. End both streams.
  302. @item pass
  303. Pass the main input through.
  304. @end table
  305. @item shortest
  306. If set to 1, force the output to terminate when the shortest input
  307. terminates. Default value is 0.
  308. @item repeatlast
  309. If set to 1, force the filter to extend the last frame of secondary streams
  310. until the end of the primary stream. A value of 0 disables this behavior.
  311. Default value is 1.
  312. @item ts_sync_mode
  313. How strictly to sync streams based on secondary input timestamps; it accepts
  314. one of the following values:
  315. @table @option
  316. @item default
  317. Frame from secondary input with the nearest lower or equal timestamp to the
  318. primary input frame.
  319. @item nearest
  320. Frame from secondary input with the absolute nearest timestamp to the primary
  321. input frame.
  322. @end table
  323. @end table
  324. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  325. @chapter Audio Filters
  326. @c man begin AUDIO FILTERS
  327. When you configure your FFmpeg build, you can disable any of the
  328. existing filters using @code{--disable-filters}.
  329. The configure output will show the audio filters included in your
  330. build.
  331. Below is a description of the currently available audio filters.
  332. @section aap
  333. Apply Affine Projection algorithm to the first audio stream using the second audio stream.
  334. This adaptive filter is used to estimate unknown audio based on multiple input audio samples.
  335. Affine projection algorithm can make trade-offs between computation complexity with convergence speed.
  336. A description of the accepted options follows.
  337. @table @option
  338. @item order
  339. Set the filter order.
  340. @item projection
  341. Set the projection order.
  342. @item mu
  343. Set the filter mu.
  344. @item delta
  345. Set the coefficient to initialize internal covariance matrix.
  346. @item out_mode
  347. Set the filter output samples. It accepts the following values:
  348. @table @option
  349. @item i
  350. Pass the 1st input.
  351. @item d
  352. Pass the 2nd input.
  353. @item o
  354. Pass difference between desired, 2nd input and error signal estimate.
  355. @item n
  356. Pass difference between input, 1st input and error signal estimate.
  357. @item e
  358. Pass error signal estimated samples.
  359. Default value is @var{o}.
  360. @end table
  361. @item precision
  362. Set which precision to use when processing samples.
  363. @table @option
  364. @item auto
  365. Auto pick internal sample format depending on other filters.
  366. @item float
  367. Always use single-floating point precision sample format.
  368. @item double
  369. Always use double-floating point precision sample format.
  370. @end table
  371. @end table
  372. @section acompressor
  373. A compressor is mainly used to reduce the dynamic range of a signal.
  374. Especially modern music is mostly compressed at a high ratio to
  375. improve the overall loudness. It's done to get the highest attention
  376. of a listener, "fatten" the sound and bring more "power" to the track.
  377. If a signal is compressed too much it may sound dull or "dead"
  378. afterwards or it may start to "pump" (which could be a powerful effect
  379. but can also destroy a track completely).
  380. The right compression is the key to reach a professional sound and is
  381. the high art of mixing and mastering. Because of its complex settings
  382. it may take a long time to get the right feeling for this kind of effect.
  383. Compression is done by detecting the volume above a chosen level
  384. @code{threshold} and dividing it by the factor set with @code{ratio}.
  385. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  386. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  387. the signal would cause distortion of the waveform the reduction can be
  388. levelled over the time. This is done by setting "Attack" and "Release".
  389. @code{attack} determines how long the signal has to rise above the threshold
  390. before any reduction will occur and @code{release} sets the time the signal
  391. has to fall below the threshold to reduce the reduction again. Shorter signals
  392. than the chosen attack time will be left untouched.
  393. The overall reduction of the signal can be made up afterwards with the
  394. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  395. raising the makeup to this level results in a signal twice as loud than the
  396. source. To gain a softer entry in the compression the @code{knee} flattens the
  397. hard edge at the threshold in the range of the chosen decibels.
  398. The filter accepts the following options:
  399. @table @option
  400. @item level_in
  401. Set input gain. Default is 1. Range is between 0.015625 and 64.
  402. @item mode
  403. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  404. Default is @code{downward}.
  405. @item threshold
  406. If a signal of stream rises above this level it will affect the gain
  407. reduction.
  408. By default it is 0.125. Range is between 0.00097563 and 1.
  409. @item ratio
  410. Set a ratio by which the signal is reduced. 1:2 means that if the level
  411. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  412. Default is 2. Range is between 1 and 20.
  413. @item attack
  414. Amount of milliseconds the signal has to rise above the threshold before gain
  415. reduction starts. Default is 20. Range is between 0.01 and 2000.
  416. @item release
  417. Amount of milliseconds the signal has to fall below the threshold before
  418. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  419. @item makeup
  420. Set the amount by how much signal will be amplified after processing.
  421. Default is 1. Range is from 1 to 64.
  422. @item knee
  423. Curve the sharp knee around the threshold to enter gain reduction more softly.
  424. Default is 2.82843. Range is between 1 and 8.
  425. @item link
  426. Choose if the @code{average} level between all channels of input stream
  427. or the louder(@code{maximum}) channel of input stream affects the
  428. reduction. Default is @code{average}.
  429. @item detection
  430. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  431. of @code{rms}. Default is @code{rms} which is mostly smoother.
  432. @item mix
  433. How much to use compressed signal in output. Default is 1.
  434. Range is between 0 and 1.
  435. @end table
  436. @subsection Commands
  437. This filter supports the all above options as @ref{commands}.
  438. @section acontrast
  439. Simple audio dynamic range compression/expansion filter.
  440. The filter accepts the following options:
  441. @table @option
  442. @item contrast
  443. Set contrast. Default is 33. Allowed range is between 0 and 100.
  444. @end table
  445. @section acopy
  446. Copy the input audio source unchanged to the output. This is mainly useful for
  447. testing purposes.
  448. @section acrossfade
  449. Apply cross fade from one input audio stream to another input audio stream.
  450. The cross fade is applied for specified duration near the end of first stream.
  451. The filter accepts the following options:
  452. @table @option
  453. @item nb_samples, ns
  454. Specify the number of samples for which the cross fade effect has to last.
  455. At the end of the cross fade effect the first input audio will be completely
  456. silent. Default is 44100.
  457. @item duration, d
  458. Specify the duration of the cross fade effect. See
  459. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  460. for the accepted syntax.
  461. By default the duration is determined by @var{nb_samples}.
  462. If set this option is used instead of @var{nb_samples}.
  463. @item overlap, o
  464. Should first stream end overlap with second stream start. Default is enabled.
  465. @item curve1
  466. Set curve for cross fade transition for first stream.
  467. @item curve2
  468. Set curve for cross fade transition for second stream.
  469. For description of available curve types see @ref{afade} filter description.
  470. @end table
  471. @subsection Examples
  472. @itemize
  473. @item
  474. Cross fade from one input to another:
  475. @example
  476. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  477. @end example
  478. @item
  479. Cross fade from one input to another but without overlapping:
  480. @example
  481. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  482. @end example
  483. @end itemize
  484. @section acrossover
  485. Split audio stream into several bands.
  486. This filter splits audio stream into two or more frequency ranges.
  487. Summing all streams back will give flat output.
  488. The filter accepts the following options:
  489. @table @option
  490. @item split
  491. Set split frequencies. Those must be positive and increasing.
  492. @item order
  493. Set filter order for each band split. This controls filter roll-off or steepness
  494. of filter transfer function.
  495. Available values are:
  496. @table @samp
  497. @item 2nd
  498. 12 dB per octave.
  499. @item 4th
  500. 24 dB per octave.
  501. @item 6th
  502. 36 dB per octave.
  503. @item 8th
  504. 48 dB per octave.
  505. @item 10th
  506. 60 dB per octave.
  507. @item 12th
  508. 72 dB per octave.
  509. @item 14th
  510. 84 dB per octave.
  511. @item 16th
  512. 96 dB per octave.
  513. @item 18th
  514. 108 dB per octave.
  515. @item 20th
  516. 120 dB per octave.
  517. @end table
  518. Default is @var{4th}.
  519. @item level
  520. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  521. @item gains
  522. Set output gain for each band. Default value is 1 for all bands.
  523. @item precision
  524. Set which precision to use when processing samples.
  525. @table @option
  526. @item auto
  527. Auto pick internal sample format depending on other filters.
  528. @item float
  529. Always use single-floating point precision sample format.
  530. @item double
  531. Always use double-floating point precision sample format.
  532. @end table
  533. Default value is @code{auto}.
  534. @end table
  535. @subsection Examples
  536. @itemize
  537. @item
  538. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  539. each band will be in separate stream:
  540. @example
  541. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  542. @end example
  543. @item
  544. Same as above, but with higher filter order:
  545. @example
  546. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  547. @end example
  548. @item
  549. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  550. @example
  551. 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
  552. @end example
  553. @end itemize
  554. @section acrusher
  555. Reduce audio bit resolution.
  556. This filter is bit crusher with enhanced functionality. A bit crusher
  557. is used to audibly reduce number of bits an audio signal is sampled
  558. with. This doesn't change the bit depth at all, it just produces the
  559. effect. Material reduced in bit depth sounds more harsh and "digital".
  560. This filter is able to even round to continuous values instead of discrete
  561. bit depths.
  562. Additionally it has a D/C offset which results in different crushing of
  563. the lower and the upper half of the signal.
  564. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  565. Another feature of this filter is the logarithmic mode.
  566. This setting switches from linear distances between bits to logarithmic ones.
  567. The result is a much more "natural" sounding crusher which doesn't gate low
  568. signals for example. The human ear has a logarithmic perception,
  569. so this kind of crushing is much more pleasant.
  570. Logarithmic crushing is also able to get anti-aliased.
  571. The filter accepts the following options:
  572. @table @option
  573. @item level_in
  574. Set level in.
  575. @item level_out
  576. Set level out.
  577. @item bits
  578. Set bit reduction.
  579. @item mix
  580. Set mixing amount.
  581. @item mode
  582. Can be linear: @code{lin} or logarithmic: @code{log}.
  583. @item dc
  584. Set DC.
  585. @item aa
  586. Set anti-aliasing.
  587. @item samples
  588. Set sample reduction.
  589. @item lfo
  590. Enable LFO. By default disabled.
  591. @item lforange
  592. Set LFO range.
  593. @item lforate
  594. Set LFO rate.
  595. @end table
  596. @subsection Commands
  597. This filter supports the all above options as @ref{commands}.
  598. @section acue
  599. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  600. filter.
  601. @section adeclick
  602. Remove impulsive noise from input audio.
  603. Samples detected as impulsive noise are replaced by interpolated samples using
  604. autoregressive modelling.
  605. @table @option
  606. @item window, w
  607. Set window size, in milliseconds. Allowed range is from @code{10} to
  608. @code{100}. Default value is @code{55} milliseconds.
  609. This sets size of window which will be processed at once.
  610. @item overlap, o
  611. Set window overlap, in percentage of window size. Allowed range is from
  612. @code{50} to @code{95}. Default value is @code{75} percent.
  613. Setting this to a very high value increases impulsive noise removal but makes
  614. whole process much slower.
  615. @item arorder, a
  616. Set autoregression order, in percentage of window size. Allowed range is from
  617. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  618. controls quality of interpolated samples using neighbour good samples.
  619. @item threshold, t
  620. Set threshold value. Allowed range is from @code{1} to @code{100}.
  621. Default value is @code{2}.
  622. This controls the strength of impulsive noise which is going to be removed.
  623. The lower value, the more samples will be detected as impulsive noise.
  624. @item burst, b
  625. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  626. @code{10}. Default value is @code{2}.
  627. If any two samples detected as noise are spaced less than this value then any
  628. sample between those two samples will be also detected as noise.
  629. @item method, m
  630. Set overlap method.
  631. It accepts the following values:
  632. @table @option
  633. @item add, a
  634. Select overlap-add method. Even not interpolated samples are slightly
  635. changed with this method.
  636. @item save, s
  637. Select overlap-save method. Not interpolated samples remain unchanged.
  638. @end table
  639. Default value is @code{a}.
  640. @end table
  641. @section adeclip
  642. Remove clipped samples from input audio.
  643. Samples detected as clipped are replaced by interpolated samples using
  644. autoregressive modelling.
  645. @table @option
  646. @item window, w
  647. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  648. Default value is @code{55} milliseconds.
  649. This sets size of window which will be processed at once.
  650. @item overlap, o
  651. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  652. to @code{95}. Default value is @code{75} percent.
  653. @item arorder, a
  654. Set autoregression order, in percentage of window size. Allowed range is from
  655. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  656. quality of interpolated samples using neighbour good samples.
  657. @item threshold, t
  658. Set threshold value. Allowed range is from @code{1} to @code{100}.
  659. Default value is @code{10}. Higher values make clip detection less aggressive.
  660. @item hsize, n
  661. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  662. Default value is @code{1000}. Higher values make clip detection less aggressive.
  663. @item method, m
  664. Set overlap method.
  665. It accepts the following values:
  666. @table @option
  667. @item add, a
  668. Select overlap-add method. Even not interpolated samples are slightly changed
  669. with this method.
  670. @item save, s
  671. Select overlap-save method. Not interpolated samples remain unchanged.
  672. @end table
  673. Default value is @code{a}.
  674. @end table
  675. @section adecorrelate
  676. Apply decorrelation to input audio stream.
  677. The filter accepts the following options:
  678. @table @option
  679. @item stages
  680. Set decorrelation stages of filtering. Allowed
  681. range is from 1 to 16. Default value is 6.
  682. @item seed
  683. Set random seed used for setting delay in samples across channels.
  684. @end table
  685. @section adelay
  686. Delay one or more audio channels.
  687. Samples in delayed channel are filled with silence.
  688. The filter accepts the following option:
  689. @table @option
  690. @item delays
  691. Set list of delays in milliseconds for each channel separated by '|'.
  692. Unused delays will be silently ignored. If number of given delays is
  693. smaller than number of channels all remaining channels will not be delayed.
  694. If you want to delay exact number of samples, append 'S' to number.
  695. If you want instead to delay in seconds, append 's' to number.
  696. @item all
  697. Use last set delay for all remaining channels. By default is disabled.
  698. This option if enabled changes how option @code{delays} is interpreted.
  699. @end table
  700. @subsection Examples
  701. @itemize
  702. @item
  703. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  704. the second channel (and any other channels that may be present) unchanged.
  705. @example
  706. adelay=1500|0|500
  707. @end example
  708. @item
  709. Delay second channel by 500 samples, the third channel by 700 samples and leave
  710. the first channel (and any other channels that may be present) unchanged.
  711. @example
  712. adelay=0|500S|700S
  713. @end example
  714. @item
  715. Delay all channels by same number of samples:
  716. @example
  717. adelay=delays=64S:all=1
  718. @end example
  719. @end itemize
  720. @section adenorm
  721. Remedy denormals in audio by adding extremely low-level noise.
  722. This filter shall be placed before any filter that can produce denormals.
  723. A description of the accepted parameters follows.
  724. @table @option
  725. @item level
  726. Set level of added noise in dB. Default is @code{-351}.
  727. Allowed range is from -451 to -90.
  728. @item type
  729. Set type of added noise.
  730. @table @option
  731. @item dc
  732. Add DC signal.
  733. @item ac
  734. Add AC signal.
  735. @item square
  736. Add square signal.
  737. @item pulse
  738. Add pulse signal.
  739. @end table
  740. Default is @code{dc}.
  741. @end table
  742. @subsection Commands
  743. This filter supports the all above options as @ref{commands}.
  744. @section aderivative, aintegral
  745. Compute derivative/integral of audio stream.
  746. Applying both filters one after another produces original audio.
  747. @section adrc
  748. Apply spectral dynamic range controller filter to input audio stream.
  749. A description of the accepted options follows.
  750. @table @option
  751. @item transfer
  752. Set the transfer expression.
  753. The expression can contain the following constants:
  754. @table @option
  755. @item ch
  756. current channel number
  757. @item sn
  758. current sample number
  759. @item nb_channels
  760. number of channels
  761. @item t
  762. timestamp expressed in seconds
  763. @item sr
  764. sample rate
  765. @item p
  766. current frequency power value, in dB
  767. @item f
  768. current frequency in Hz
  769. @end table
  770. Default value is @code{p}.
  771. @item attack
  772. Set the attack in milliseconds. Default is @code{50} milliseconds.
  773. Allowed range is from 1 to 1000 milliseconds.
  774. @item release
  775. Set the release in milliseconds. Default is @code{100} milliseconds.
  776. Allowed range is from 5 to 2000 milliseconds.
  777. @item channels
  778. Set which channels to filter, by default @code{all} channels in audio stream are filtered.
  779. @end table
  780. @subsection Commands
  781. This filter supports the all above options as @ref{commands}.
  782. @subsection Examples
  783. @itemize
  784. @item
  785. Apply spectral compression to all frequencies with threshold of -50 dB and 1:6 ratio:
  786. @example
  787. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/6,p)':attack=50:release=100
  788. @end example
  789. @item
  790. Similar to above but with 1:2 ratio and filtering only front center channel:
  791. @example
  792. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/2,p)':attack=50:release=100:channels=FC
  793. @end example
  794. @item
  795. Apply spectral noise gate to all frequencies with threshold of -85 dB and with short attack time and short release time:
  796. @example
  797. adrc=transfer='if(lte(p,-85),p-800,p)':attack=1:release=5
  798. @end example
  799. @item
  800. Apply spectral expansion to all frequencies with threshold of -10 dB and 1:2 ratio:
  801. @example
  802. adrc=transfer='if(lt(p,-10),-10+(p-(-10))*2,p)':attack=50:release=100
  803. @end example
  804. @item
  805. Apply limiter to max -60 dB to all frequencies, with attack of 2 ms and release of 10 ms:
  806. @example
  807. adrc=transfer='min(p,-60)':attack=2:release=10
  808. @end example
  809. @end itemize
  810. @section adynamicequalizer
  811. Apply dynamic equalization to input audio stream.
  812. A description of the accepted options follows.
  813. @table @option
  814. @item threshold
  815. Set the detection threshold used to trigger equalization.
  816. Threshold detection is using detection filter.
  817. Default value is 0. Allowed range is from 0 to 100.
  818. @item dfrequency
  819. Set the detection frequency in Hz used for detection filter used to trigger equalization.
  820. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  821. @item dqfactor
  822. Set the detection resonance factor for detection filter used to trigger equalization.
  823. Default value is 1. Allowed range is from 0.001 to 1000.
  824. @item tfrequency
  825. Set the target frequency of equalization filter.
  826. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  827. @item tqfactor
  828. Set the target resonance factor for target equalization filter.
  829. Default value is 1. Allowed range is from 0.001 to 1000.
  830. @item attack
  831. Set the amount of milliseconds the signal from detection has to rise above
  832. the detection threshold before equalization starts.
  833. Default is 20. Allowed range is between 1 and 2000.
  834. @item release
  835. Set the amount of milliseconds the signal from detection has to fall below the
  836. detection threshold before equalization ends.
  837. Default is 200. Allowed range is between 1 and 2000.
  838. @item ratio
  839. Set the ratio by which the equalization gain is raised.
  840. Default is 1. Allowed range is between 0 and 30.
  841. @item makeup
  842. Set the makeup offset by which the equalization gain is raised.
  843. Default is 0. Allowed range is between 0 and 100.
  844. @item range
  845. Set the max allowed cut/boost amount. Default is 50.
  846. Allowed range is from 1 to 200.
  847. @item mode
  848. Set the mode of filter operation, can be one of the following:
  849. @table @samp
  850. @item listen
  851. Output only isolated detection signal.
  852. @item cutbelow
  853. Cut frequencies below detection threshold.
  854. @item cutabove
  855. Cut frequencies above detection threshold.
  856. @item boostbelow
  857. Boost frequencies below detection threshold.
  858. @item boostabove
  859. Boost frequencies above detection threshold.
  860. @end table
  861. Default mode is @samp{cutbelow}.
  862. @item dftype
  863. Set the type of detection filter, can be one of the following:
  864. @table @samp
  865. @item bandpass
  866. @item lowpass
  867. @item highpass
  868. @item peak
  869. @end table
  870. Default type is @samp{bandpass}.
  871. @item tftype
  872. Set the type of target filter, can be one of the following:
  873. @table @samp
  874. @item bell
  875. @item lowshelf
  876. @item highshelf
  877. @end table
  878. Default type is @samp{bell}.
  879. @item auto
  880. Automatically gather threshold from detection filter. By default
  881. is @samp{disabled}.
  882. This option is useful to detect threshold in certain time frame of
  883. input audio stream, in such case option value is changed at runtime.
  884. Available values are:
  885. @table @samp
  886. @item disabled
  887. Disable using automatically gathered threshold value.
  888. @item off
  889. Stop picking threshold value.
  890. @item on
  891. Start picking threshold value.
  892. @item adaptive
  893. Adaptively pick threshold value, by calculating sliding window entropy.
  894. @end table
  895. @item precision
  896. Set which precision to use when processing samples.
  897. @table @option
  898. @item auto
  899. Auto pick internal sample format depending on other filters.
  900. @item float
  901. Always use single-floating point precision sample format.
  902. @item double
  903. Always use double-floating point precision sample format.
  904. @end table
  905. @end table
  906. @subsection Commands
  907. This filter supports the all above options as @ref{commands}.
  908. @section adynamicsmooth
  909. Apply dynamic smoothing to input audio stream.
  910. A description of the accepted options follows.
  911. @table @option
  912. @item sensitivity
  913. Set an amount of sensitivity to frequency fluctations. Default is 2.
  914. Allowed range is from 0 to 1e+06.
  915. @item basefreq
  916. Set a base frequency for smoothing. Default value is 22050.
  917. Allowed range is from 2 to 1e+06.
  918. @end table
  919. @subsection Commands
  920. This filter supports the all above options as @ref{commands}.
  921. @section aecho
  922. Apply echoing to the input audio.
  923. Echoes are reflected sound and can occur naturally amongst mountains
  924. (and sometimes large buildings) when talking or shouting; digital echo
  925. effects emulate this behaviour and are often used to help fill out the
  926. sound of a single instrument or vocal. The time difference between the
  927. original signal and the reflection is the @code{delay}, and the
  928. loudness of the reflected signal is the @code{decay}.
  929. Multiple echoes can have different delays and decays.
  930. A description of the accepted parameters follows.
  931. @table @option
  932. @item in_gain
  933. Set input gain of reflected signal. Default is @code{0.6}.
  934. @item out_gain
  935. Set output gain of reflected signal. Default is @code{0.3}.
  936. @item delays
  937. Set list of time intervals in milliseconds between original signal and reflections
  938. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  939. Default is @code{1000}.
  940. @item decays
  941. Set list of loudness of reflected signals separated by '|'.
  942. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  943. Default is @code{0.5}.
  944. @end table
  945. @subsection Examples
  946. @itemize
  947. @item
  948. Make it sound as if there are twice as many instruments as are actually playing:
  949. @example
  950. aecho=0.8:0.88:60:0.4
  951. @end example
  952. @item
  953. If delay is very short, then it sounds like a (metallic) robot playing music:
  954. @example
  955. aecho=0.8:0.88:6:0.4
  956. @end example
  957. @item
  958. A longer delay will sound like an open air concert in the mountains:
  959. @example
  960. aecho=0.8:0.9:1000:0.3
  961. @end example
  962. @item
  963. Same as above but with one more mountain:
  964. @example
  965. aecho=0.8:0.9:1000|1800:0.3|0.25
  966. @end example
  967. @end itemize
  968. @section aemphasis
  969. Audio emphasis filter creates or restores material directly taken from LPs or
  970. emphased CDs with different filter curves. E.g. to store music on vinyl the
  971. signal has to be altered by a filter first to even out the disadvantages of
  972. this recording medium.
  973. Once the material is played back the inverse filter has to be applied to
  974. restore the distortion of the frequency response.
  975. The filter accepts the following options:
  976. @table @option
  977. @item level_in
  978. Set input gain.
  979. @item level_out
  980. Set output gain.
  981. @item mode
  982. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  983. use @code{production} mode. Default is @code{reproduction} mode.
  984. @item type
  985. Set filter type. Selects medium. Can be one of the following:
  986. @table @option
  987. @item col
  988. select Columbia.
  989. @item emi
  990. select EMI.
  991. @item bsi
  992. select BSI (78RPM).
  993. @item riaa
  994. select RIAA.
  995. @item cd
  996. select Compact Disc (CD).
  997. @item 50fm
  998. select 50µs (FM).
  999. @item 75fm
  1000. select 75µs (FM).
  1001. @item 50kf
  1002. select 50µs (FM-KF).
  1003. @item 75kf
  1004. select 75µs (FM-KF).
  1005. @end table
  1006. @end table
  1007. @subsection Commands
  1008. This filter supports the all above options as @ref{commands}.
  1009. @section aeval
  1010. Modify an audio signal according to the specified expressions.
  1011. This filter accepts one or more expressions (one for each channel),
  1012. which are evaluated and used to modify a corresponding audio signal.
  1013. It accepts the following parameters:
  1014. @table @option
  1015. @item exprs
  1016. Set the '|'-separated expressions list for each separate channel. If
  1017. the number of input channels is greater than the number of
  1018. expressions, the last specified expression is used for the remaining
  1019. output channels.
  1020. @item channel_layout, c
  1021. Set output channel layout. If not specified, the channel layout is
  1022. specified by the number of expressions. If set to @samp{same}, it will
  1023. use by default the same input channel layout.
  1024. @end table
  1025. Each expression in @var{exprs} can contain the following constants and functions:
  1026. @table @option
  1027. @item ch
  1028. channel number of the current expression
  1029. @item n
  1030. number of the evaluated sample, starting from 0
  1031. @item s
  1032. sample rate
  1033. @item t
  1034. time of the evaluated sample expressed in seconds
  1035. @item nb_in_channels
  1036. @item nb_out_channels
  1037. input and output number of channels
  1038. @item val(CH)
  1039. the value of input channel with number @var{CH}
  1040. @end table
  1041. Note: this filter is slow. For faster processing you should use a
  1042. dedicated filter.
  1043. @subsection Examples
  1044. @itemize
  1045. @item
  1046. Half volume:
  1047. @example
  1048. aeval=val(ch)/2:c=same
  1049. @end example
  1050. @item
  1051. Invert phase of the second channel:
  1052. @example
  1053. aeval=val(0)|-val(1)
  1054. @end example
  1055. @end itemize
  1056. @section aexciter
  1057. An exciter is used to produce high sound that is not present in the
  1058. original signal. This is done by creating harmonic distortions of the
  1059. signal which are restricted in range and added to the original signal.
  1060. An Exciter raises the upper end of an audio signal without simply raising
  1061. the higher frequencies like an equalizer would do to create a more
  1062. "crisp" or "brilliant" sound.
  1063. The filter accepts the following options:
  1064. @table @option
  1065. @item level_in
  1066. Set input level prior processing of signal.
  1067. Allowed range is from 0 to 64.
  1068. Default value is 1.
  1069. @item level_out
  1070. Set output level after processing of signal.
  1071. Allowed range is from 0 to 64.
  1072. Default value is 1.
  1073. @item amount
  1074. Set the amount of harmonics added to original signal.
  1075. Allowed range is from 0 to 64.
  1076. Default value is 1.
  1077. @item drive
  1078. Set the amount of newly created harmonics.
  1079. Allowed range is from 0.1 to 10.
  1080. Default value is 8.5.
  1081. @item blend
  1082. Set the octave of newly created harmonics.
  1083. Allowed range is from -10 to 10.
  1084. Default value is 0.
  1085. @item freq
  1086. Set the lower frequency limit of producing harmonics in Hz.
  1087. Allowed range is from 2000 to 12000 Hz.
  1088. Default is 7500 Hz.
  1089. @item ceil
  1090. Set the upper frequency limit of producing harmonics.
  1091. Allowed range is from 9999 to 20000 Hz.
  1092. If value is lower than 10000 Hz no limit is applied.
  1093. @item listen
  1094. Mute the original signal and output only added harmonics.
  1095. By default is disabled.
  1096. @end table
  1097. @subsection Commands
  1098. This filter supports the all above options as @ref{commands}.
  1099. @anchor{afade}
  1100. @section afade
  1101. Apply fade-in/out effect to input audio.
  1102. A description of the accepted parameters follows.
  1103. @table @option
  1104. @item type, t
  1105. Specify the effect type, can be either @code{in} for fade-in, or
  1106. @code{out} for a fade-out effect. Default is @code{in}.
  1107. @item start_sample, ss
  1108. Specify the number of the start sample for starting to apply the fade
  1109. effect. Default is 0.
  1110. @item nb_samples, ns
  1111. Specify the number of samples for which the fade effect has to last. At
  1112. the end of the fade-in effect the output audio will have the same
  1113. volume as the input audio, at the end of the fade-out transition
  1114. the output audio will be silence. Default is 44100.
  1115. @item start_time, st
  1116. Specify the start time of the fade effect. Default is 0.
  1117. The value must be specified as a time duration; see
  1118. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1119. for the accepted syntax.
  1120. If set this option is used instead of @var{start_sample}.
  1121. @item duration, d
  1122. Specify the duration of the fade effect. See
  1123. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1124. for the accepted syntax.
  1125. At the end of the fade-in effect the output audio will have the same
  1126. volume as the input audio, at the end of the fade-out transition
  1127. the output audio will be silence.
  1128. By default the duration is determined by @var{nb_samples}.
  1129. If set this option is used instead of @var{nb_samples}.
  1130. @item curve
  1131. Set curve for fade transition.
  1132. It accepts the following values:
  1133. @table @option
  1134. @item tri
  1135. select triangular, linear slope (default)
  1136. @item qsin
  1137. select quarter of sine wave
  1138. @item hsin
  1139. select half of sine wave
  1140. @item esin
  1141. select exponential sine wave
  1142. @item log
  1143. select logarithmic
  1144. @item ipar
  1145. select inverted parabola
  1146. @item qua
  1147. select quadratic
  1148. @item cub
  1149. select cubic
  1150. @item squ
  1151. select square root
  1152. @item cbr
  1153. select cubic root
  1154. @item par
  1155. select parabola
  1156. @item exp
  1157. select exponential
  1158. @item iqsin
  1159. select inverted quarter of sine wave
  1160. @item ihsin
  1161. select inverted half of sine wave
  1162. @item dese
  1163. select double-exponential seat
  1164. @item desi
  1165. select double-exponential sigmoid
  1166. @item losi
  1167. select logistic sigmoid
  1168. @item sinc
  1169. select sine cardinal function
  1170. @item isinc
  1171. select inverted sine cardinal function
  1172. @item quat
  1173. select quartic
  1174. @item quatr
  1175. select quartic root
  1176. @item qsin2
  1177. select squared quarter of sine wave
  1178. @item hsin2
  1179. select squared half of sine wave
  1180. @item nofade
  1181. no fade applied
  1182. @end table
  1183. @item silence
  1184. Set the initial gain for fade-in or final gain for fade-out.
  1185. Default value is @code{0.0}.
  1186. @item unity
  1187. Set the initial gain for fade-out or final gain for fade-in.
  1188. Default value is @code{1.0}.
  1189. @end table
  1190. @subsection Commands
  1191. This filter supports the all above options as @ref{commands}.
  1192. @subsection Examples
  1193. @itemize
  1194. @item
  1195. Fade in first 15 seconds of audio:
  1196. @example
  1197. afade=t=in:ss=0:d=15
  1198. @end example
  1199. @item
  1200. Fade out last 25 seconds of a 900 seconds audio:
  1201. @example
  1202. afade=t=out:st=875:d=25
  1203. @end example
  1204. @end itemize
  1205. @section afftdn
  1206. Denoise audio samples with FFT.
  1207. A description of the accepted parameters follows.
  1208. @table @option
  1209. @item noise_reduction, nr
  1210. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1211. Default value is 12 dB.
  1212. @item noise_floor, nf
  1213. Set the noise floor in dB, allowed range is -80 to -20.
  1214. Default value is -50 dB.
  1215. @item noise_type, nt
  1216. Set the noise type.
  1217. It accepts the following values:
  1218. @table @option
  1219. @item white, w
  1220. Select white noise.
  1221. @item vinyl, v
  1222. Select vinyl noise.
  1223. @item shellac, s
  1224. Select shellac noise.
  1225. @item custom, c
  1226. Select custom noise, defined in @code{bn} option.
  1227. Default value is white noise.
  1228. @end table
  1229. @item band_noise, bn
  1230. Set custom band noise profile for every one of 15 bands.
  1231. Bands are separated by ' ' or '|'.
  1232. @item residual_floor, rf
  1233. Set the residual floor in dB, allowed range is -80 to -20.
  1234. Default value is -38 dB.
  1235. @item track_noise, tn
  1236. Enable noise floor tracking. By default is disabled.
  1237. With this enabled, noise floor is automatically adjusted.
  1238. @item track_residual, tr
  1239. Enable residual tracking. By default is disabled.
  1240. @item output_mode, om
  1241. Set the output mode.
  1242. It accepts the following values:
  1243. @table @option
  1244. @item input, i
  1245. Pass input unchanged.
  1246. @item output, o
  1247. Pass noise filtered out.
  1248. @item noise, n
  1249. Pass only noise.
  1250. Default value is @var{output}.
  1251. @end table
  1252. @item adaptivity, ad
  1253. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1254. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1255. react much slower.
  1256. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1257. @item floor_offset, fo
  1258. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1259. noise floor. It is only effective when noise floor tracking is enabled.
  1260. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1261. @item noise_link, nl
  1262. Set the noise link used for multichannel audio.
  1263. It accepts the following values:
  1264. @table @option
  1265. @item none
  1266. Use unchanged channel's noise floor.
  1267. @item min
  1268. Use measured min noise floor of all channels.
  1269. @item max
  1270. Use measured max noise floor of all channels.
  1271. @item average
  1272. Use measured average noise floor of all channels.
  1273. Default value is @var{min}.
  1274. @end table
  1275. @item band_multiplier, bm
  1276. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1277. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1278. @item sample_noise, sn
  1279. Toggle capturing and measurement of noise profile from input audio.
  1280. It accepts the following values:
  1281. @table @option
  1282. @item start, begin
  1283. Start sample noise capture.
  1284. @item stop, end
  1285. Stop sample noise capture and measure new noise band profile.
  1286. Default value is @code{none}.
  1287. @end table
  1288. @item gain_smooth, gs
  1289. Set gain smooth spatial radius, used to smooth gains applied to each frequency bin.
  1290. Useful to reduce random music noise artefacts.
  1291. Higher values increases smoothing of gains.
  1292. Allowed range is from @code{0} to @code{50}.
  1293. Default value is @code{0}.
  1294. @end table
  1295. @subsection Commands
  1296. This filter supports the some above mentioned options as @ref{commands}.
  1297. @subsection Examples
  1298. @itemize
  1299. @item
  1300. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1301. @example
  1302. afftdn=nr=10:nf=-40
  1303. @end example
  1304. @item
  1305. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1306. tracking of noise floor so noise floor will gradually change during processing:
  1307. @example
  1308. afftdn=nr=10:nf=-80:tn=1
  1309. @end example
  1310. @item
  1311. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1312. of first 0.4 seconds of input audio:
  1313. @example
  1314. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1315. @end example
  1316. @end itemize
  1317. @section afftfilt
  1318. Apply arbitrary expressions to samples in frequency domain.
  1319. @table @option
  1320. @item real
  1321. Set frequency domain real expression for each separate channel separated
  1322. by '|'. Default is "re".
  1323. If the number of input channels is greater than the number of
  1324. expressions, the last specified expression is used for the remaining
  1325. output channels.
  1326. @item imag
  1327. Set frequency domain imaginary expression for each separate channel
  1328. separated by '|'. Default is "im".
  1329. Each expression in @var{real} and @var{imag} can contain the following
  1330. constants and functions:
  1331. @table @option
  1332. @item sr
  1333. sample rate
  1334. @item b
  1335. current frequency bin number
  1336. @item nb
  1337. number of available bins
  1338. @item ch
  1339. channel number of the current expression
  1340. @item chs
  1341. number of channels
  1342. @item pts
  1343. current frame pts
  1344. @item re
  1345. current real part of frequency bin of current channel
  1346. @item im
  1347. current imaginary part of frequency bin of current channel
  1348. @item real(b, ch)
  1349. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1350. @item imag(b, ch)
  1351. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1352. @end table
  1353. @item win_size
  1354. Set window size. Allowed range is from 16 to 131072.
  1355. Default is @code{4096}
  1356. @item win_func
  1357. Set window function.
  1358. It accepts the following values:
  1359. @table @samp
  1360. @item rect
  1361. @item bartlett
  1362. @item hann, hanning
  1363. @item hamming
  1364. @item blackman
  1365. @item welch
  1366. @item flattop
  1367. @item bharris
  1368. @item bnuttall
  1369. @item bhann
  1370. @item sine
  1371. @item nuttall
  1372. @item lanczos
  1373. @item gauss
  1374. @item tukey
  1375. @item dolph
  1376. @item cauchy
  1377. @item parzen
  1378. @item poisson
  1379. @item bohman
  1380. @item kaiser
  1381. @end table
  1382. Default is @code{hann}.
  1383. @item overlap
  1384. Set window overlap. If set to 1, the recommended overlap for selected
  1385. window function will be picked. Default is @code{0.75}.
  1386. @end table
  1387. @subsection Examples
  1388. @itemize
  1389. @item
  1390. Leave almost only low frequencies in audio:
  1391. @example
  1392. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1393. @end example
  1394. @item
  1395. Apply robotize effect:
  1396. @example
  1397. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1398. @end example
  1399. @item
  1400. Apply whisper effect:
  1401. @example
  1402. 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"
  1403. @end example
  1404. @item
  1405. Apply phase shift:
  1406. @example
  1407. afftfilt="real=re*cos(1)-im*sin(1):imag=re*sin(1)+im*cos(1)"
  1408. @end example
  1409. @end itemize
  1410. @anchor{afir}
  1411. @section afir
  1412. Apply an arbitrary Finite Impulse Response filter.
  1413. This filter is designed for applying long FIR filters,
  1414. up to 60 seconds long.
  1415. It can be used as component for digital crossover filters,
  1416. room equalization, cross talk cancellation, wavefield synthesis,
  1417. auralization, ambiophonics, ambisonics and spatialization.
  1418. This filter uses the streams higher than first one as FIR coefficients.
  1419. If the non-first stream holds a single channel, it will be used
  1420. for all input channels in the first stream, otherwise
  1421. the number of channels in the non-first stream must be same as
  1422. the number of channels in the first stream.
  1423. It accepts the following parameters:
  1424. @table @option
  1425. @item dry
  1426. Set dry gain. This sets input gain.
  1427. @item wet
  1428. Set wet gain. This sets final output gain.
  1429. @item length
  1430. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1431. @item gtype
  1432. This option is deprecated, and does nothing.
  1433. @item irnorm
  1434. Set norm to be applied to IR coefficients before filtering.
  1435. Allowed range is from @var{-1} to @var{2}.
  1436. IR coefficients are normalized with calculated vector norm set by this option.
  1437. For negative values, no norm is calculated, and IR coefficients are not modified at all.
  1438. Default is @var{1}.
  1439. @item irlink
  1440. For multichannel IR if this option is set to @var{true}, all IR channels will be
  1441. normalized with maximal measured gain of all IR channels coefficients as set by @code{irnorm} option.
  1442. When disabled, all IR coefficients in each IR channel will be normalized independently.
  1443. Default is @var{true}.
  1444. @item irgain
  1445. Set gain to be applied to IR coefficients before filtering.
  1446. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{irnorm} option.
  1447. @item irfmt
  1448. Set format of IR stream. Can be @code{mono} or @code{input}.
  1449. Default is @code{input}.
  1450. @item maxir
  1451. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1452. Allowed range is 0.1 to 60 seconds.
  1453. @item response
  1454. This option is deprecated, and does nothing.
  1455. @item channel
  1456. This option is deprecated, and does nothing.
  1457. @item size
  1458. This option is deprecated, and does nothing.
  1459. @item rate
  1460. This option is deprecated, and does nothing.
  1461. @item minp
  1462. Set minimal partition size used for convolution. Default is @var{8192}.
  1463. Allowed range is from @var{1} to @var{65536}.
  1464. Lower values decreases latency at cost of higher CPU usage.
  1465. @item maxp
  1466. Set maximal partition size used for convolution. Default is @var{8192}.
  1467. Allowed range is from @var{8} to @var{65536}.
  1468. Lower values may increase CPU usage.
  1469. @item nbirs
  1470. Set number of input impulse responses streams which will be switchable at runtime.
  1471. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1472. @item ir
  1473. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1474. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1475. This option can be changed at runtime via @ref{commands}.
  1476. @item precision
  1477. Set which precision to use when processing samples.
  1478. @table @option
  1479. @item auto
  1480. Auto pick internal sample format depending on other filters.
  1481. @item float
  1482. Always use single-floating point precision sample format.
  1483. @item double
  1484. Always use double-floating point precision sample format.
  1485. @end table
  1486. Default value is auto.
  1487. @item irload
  1488. Set when to load IR stream. Can be @code{init} or @code{access}.
  1489. First one load and prepares all IRs on initialization, second one
  1490. once on first access of specific IR.
  1491. Default is @code{init}.
  1492. @end table
  1493. @subsection Examples
  1494. @itemize
  1495. @item
  1496. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1497. @example
  1498. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1499. @end example
  1500. @item
  1501. Apply true stereo processing given input stereo stream, and two stereo impulse responses for left and right channel,
  1502. the impulse response files are files with names l_ir.wav and r_ir.wav, and setting irnorm option value:
  1503. @example
  1504. "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:irnorm=1.2,pan=stereo|FL<c0+c2|FR<c1+c3"
  1505. @end example
  1506. @item
  1507. Similar to above example, but with @code{irgain} explicitly set to estimated value and with @code{irnorm} disabled:
  1508. @example
  1509. "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:irgain=-5dB:irnom=-1,pan=stereo|FL<c0+c2|FR<c1+c3"
  1510. @end example
  1511. @end itemize
  1512. @anchor{aformat}
  1513. @section aformat
  1514. Set output format constraints for the input audio. The framework will
  1515. negotiate the most appropriate format to minimize conversions.
  1516. It accepts the following parameters:
  1517. @table @option
  1518. @item sample_fmts, f
  1519. A '|'-separated list of requested sample formats.
  1520. @item sample_rates, r
  1521. A '|'-separated list of requested sample rates.
  1522. @item channel_layouts, cl
  1523. A '|'-separated list of requested channel layouts.
  1524. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1525. for the required syntax.
  1526. @end table
  1527. If a parameter is omitted, all values are allowed.
  1528. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1529. @example
  1530. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1531. @end example
  1532. @section afreqshift
  1533. Apply frequency shift to input audio samples.
  1534. The filter accepts the following options:
  1535. @table @option
  1536. @item shift
  1537. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1538. Default value is 0.0.
  1539. @item level
  1540. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1541. Default value is 1.0.
  1542. @item order
  1543. Set filter order used for filtering. Allowed range is from 1 to 16.
  1544. Default value is 8.
  1545. @end table
  1546. @subsection Commands
  1547. This filter supports the all above options as @ref{commands}.
  1548. @section afwtdn
  1549. Reduce broadband noise from input samples using Wavelets.
  1550. A description of the accepted options follows.
  1551. @table @option
  1552. @item sigma
  1553. Set the noise sigma, allowed range is from 0 to 1.
  1554. Default value is 0.
  1555. This option controls strength of denoising applied to input samples.
  1556. Most useful way to set this option is via decibels, eg. -45dB.
  1557. @item levels
  1558. Set the number of wavelet levels of decomposition.
  1559. Allowed range is from 1 to 12.
  1560. Default value is 10.
  1561. Setting this too low make denoising performance very poor.
  1562. @item wavet
  1563. Set wavelet type for decomposition of input frame.
  1564. They are sorted by number of coefficients, from lowest to highest.
  1565. More coefficients means worse filtering speed, but overall better quality.
  1566. Available wavelets are:
  1567. @table @samp
  1568. @item sym2
  1569. @item sym4
  1570. @item rbior68
  1571. @item deb10
  1572. @item sym10
  1573. @item coif5
  1574. @item bl3
  1575. @end table
  1576. @item percent
  1577. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1578. Default value is 85 percent or partial denoising.
  1579. @item profile
  1580. If enabled, first input frame will be used as noise profile.
  1581. If first frame samples contain non-noise performance will be very poor.
  1582. @item adaptive
  1583. If enabled, input frames are analyzed for presence of noise.
  1584. If noise is detected with high possibility then input frame profile will be
  1585. used for processing following frames, until new noise frame is detected.
  1586. @item samples
  1587. Set size of single frame in number of samples. Allowed range is from 512 to
  1588. 65536. Default frame size is 8192 samples.
  1589. @item softness
  1590. Set softness applied inside thresholding function. Allowed range is from 0 to
  1591. 10. Default softness is 1.
  1592. @end table
  1593. @subsection Commands
  1594. This filter supports the all above options as @ref{commands}.
  1595. @section agate
  1596. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1597. processing reduces disturbing noise between useful signals.
  1598. Gating is done by detecting the volume below a chosen level @var{threshold}
  1599. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1600. floor is set via @var{range}. Because an exact manipulation of the signal
  1601. would cause distortion of the waveform the reduction can be levelled over
  1602. time. This is done by setting @var{attack} and @var{release}.
  1603. @var{attack} determines how long the signal has to fall below the threshold
  1604. before any reduction will occur and @var{release} sets the time the signal
  1605. has to rise above the threshold to reduce the reduction again.
  1606. Shorter signals than the chosen attack time will be left untouched.
  1607. @table @option
  1608. @item level_in
  1609. Set input level before filtering.
  1610. Default is 1. Allowed range is from 0.015625 to 64.
  1611. @item mode
  1612. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1613. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1614. will be amplified, expanding dynamic range in upward direction.
  1615. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1616. @item range
  1617. Set the level of gain reduction when the signal is below the threshold.
  1618. Default is 0.06125. Allowed range is from 0 to 1.
  1619. Setting this to 0 disables reduction and then filter behaves like expander.
  1620. @item threshold
  1621. If a signal rises above this level the gain reduction is released.
  1622. Default is 0.125. Allowed range is from 0 to 1.
  1623. @item ratio
  1624. Set a ratio by which the signal is reduced.
  1625. Default is 2. Allowed range is from 1 to 9000.
  1626. @item attack
  1627. Amount of milliseconds the signal has to rise above the threshold before gain
  1628. reduction stops.
  1629. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1630. @item release
  1631. Amount of milliseconds the signal has to fall below the threshold before the
  1632. reduction is increased again. Default is 250 milliseconds.
  1633. Allowed range is from 0.01 to 9000.
  1634. @item makeup
  1635. Set amount of amplification of signal after processing.
  1636. Default is 1. Allowed range is from 1 to 64.
  1637. @item knee
  1638. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1639. Default is 2.828427125. Allowed range is from 1 to 8.
  1640. @item detection
  1641. Choose if exact signal should be taken for detection or an RMS like one.
  1642. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1643. @item link
  1644. Choose if the average level between all channels or the louder channel affects
  1645. the reduction.
  1646. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1647. @end table
  1648. @subsection Commands
  1649. This filter supports the all above options as @ref{commands}.
  1650. @section aiir
  1651. Apply an arbitrary Infinite Impulse Response filter.
  1652. It accepts the following parameters:
  1653. @table @option
  1654. @item zeros, z
  1655. Set B/numerator/zeros/reflection coefficients.
  1656. @item poles, p
  1657. Set A/denominator/poles/ladder coefficients.
  1658. @item gains, k
  1659. Set channels gains.
  1660. @item dry_gain
  1661. Set input gain.
  1662. @item wet_gain
  1663. Set output gain.
  1664. @item format, f
  1665. Set coefficients format.
  1666. @table @samp
  1667. @item ll
  1668. lattice-ladder function
  1669. @item sf
  1670. analog transfer function
  1671. @item tf
  1672. digital transfer function
  1673. @item zp
  1674. Z-plane zeros/poles, cartesian (default)
  1675. @item pr
  1676. Z-plane zeros/poles, polar radians
  1677. @item pd
  1678. Z-plane zeros/poles, polar degrees
  1679. @item sp
  1680. S-plane zeros/poles
  1681. @end table
  1682. @item process, r
  1683. Set type of processing.
  1684. @table @samp
  1685. @item d
  1686. direct processing
  1687. @item s
  1688. serial processing
  1689. @item p
  1690. parallel processing
  1691. @end table
  1692. @item precision, e
  1693. Set filtering precision.
  1694. @table @samp
  1695. @item dbl
  1696. double-precision floating-point (default)
  1697. @item flt
  1698. single-precision floating-point
  1699. @item i32
  1700. 32-bit integers
  1701. @item i16
  1702. 16-bit integers
  1703. @end table
  1704. @item normalize, n
  1705. Normalize filter coefficients, by default is enabled.
  1706. Enabling it will normalize magnitude response at DC to 0dB.
  1707. @item mix
  1708. How much to use filtered signal in output. Default is 1.
  1709. Range is between 0 and 1.
  1710. @item response
  1711. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1712. By default it is disabled.
  1713. @item channel
  1714. Set for which IR channel to display frequency response. By default is first channel
  1715. displayed. This option is used only when @var{response} is enabled.
  1716. @item size
  1717. Set video stream size. This option is used only when @var{response} is enabled.
  1718. @end table
  1719. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1720. order.
  1721. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1722. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1723. imaginary unit.
  1724. Different coefficients and gains can be provided for every channel, in such case
  1725. use '|' to separate coefficients or gains. Last provided coefficients will be
  1726. used for all remaining channels.
  1727. @subsection Examples
  1728. @itemize
  1729. @item
  1730. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1731. @example
  1732. 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
  1733. @end example
  1734. @item
  1735. Same as above but in @code{zp} format:
  1736. @example
  1737. 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
  1738. @end example
  1739. @item
  1740. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1741. @example
  1742. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1743. @end example
  1744. @end itemize
  1745. @section alimiter
  1746. The limiter prevents an input signal from rising over a desired threshold.
  1747. This limiter uses lookahead technology to prevent your signal from distorting.
  1748. It means that there is a small delay after the signal is processed. Keep in mind
  1749. that the delay it produces is the attack time you set.
  1750. The filter accepts the following options:
  1751. @table @option
  1752. @item level_in
  1753. Set input gain. Default is 1.
  1754. @item level_out
  1755. Set output gain. Default is 1.
  1756. @item limit
  1757. Don't let signals above this level pass the limiter. Default is 1.
  1758. @item attack
  1759. The limiter will reach its attenuation level in this amount of time in
  1760. milliseconds. Default is 5 milliseconds.
  1761. @item release
  1762. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1763. Default is 50 milliseconds.
  1764. @item asc
  1765. When gain reduction is always needed ASC takes care of releasing to an
  1766. average reduction level rather than reaching a reduction of 0 in the release
  1767. time.
  1768. @item asc_level
  1769. Select how much the release time is affected by ASC, 0 means nearly no changes
  1770. in release time while 1 produces higher release times.
  1771. @item level
  1772. Auto level output signal. Default is enabled.
  1773. This normalizes audio back to 0dB if enabled.
  1774. @item latency
  1775. Compensate the delay introduced by using the lookahead buffer set with attack
  1776. parameter. Also flush the valid audio data in the lookahead buffer when the
  1777. stream hits EOF.
  1778. @end table
  1779. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1780. with @ref{aresample} before applying this filter.
  1781. @section allpass
  1782. Apply a two-pole all-pass filter with central frequency (in Hz)
  1783. @var{frequency}, and filter-width @var{width}.
  1784. An all-pass filter changes the audio's frequency to phase relationship
  1785. without changing its frequency to amplitude relationship.
  1786. The filter accepts the following options:
  1787. @table @option
  1788. @item frequency, f
  1789. Set frequency in Hz.
  1790. @item width_type, t
  1791. Set method to specify band-width of filter.
  1792. @table @option
  1793. @item h
  1794. Hz
  1795. @item q
  1796. Q-Factor
  1797. @item o
  1798. octave
  1799. @item s
  1800. slope
  1801. @item k
  1802. kHz
  1803. @end table
  1804. @item width, w
  1805. Specify the band-width of a filter in width_type units.
  1806. @item mix, m
  1807. How much to use filtered signal in output. Default is 1.
  1808. Range is between 0 and 1.
  1809. @item channels, c
  1810. Specify which channels to filter, by default all available are filtered.
  1811. @item normalize, n
  1812. Normalize biquad coefficients, by default is disabled.
  1813. Enabling it will normalize magnitude response at DC to 0dB.
  1814. @item order, o
  1815. Set the filter order, can be 1 or 2. Default is 2.
  1816. @item transform, a
  1817. Set transform type of IIR filter.
  1818. @table @option
  1819. @item di
  1820. @item dii
  1821. @item tdi
  1822. @item tdii
  1823. @item latt
  1824. @item svf
  1825. @item zdf
  1826. @end table
  1827. @item precision, r
  1828. Set precision of filtering.
  1829. @table @option
  1830. @item auto
  1831. Pick automatic sample format depending on surround filters.
  1832. @item s16
  1833. Always use signed 16-bit.
  1834. @item s32
  1835. Always use signed 32-bit.
  1836. @item f32
  1837. Always use float 32-bit.
  1838. @item f64
  1839. Always use float 64-bit.
  1840. @end table
  1841. @end table
  1842. @subsection Commands
  1843. This filter supports the following commands:
  1844. @table @option
  1845. @item frequency, f
  1846. Change allpass frequency.
  1847. Syntax for the command is : "@var{frequency}"
  1848. @item width_type, t
  1849. Change allpass width_type.
  1850. Syntax for the command is : "@var{width_type}"
  1851. @item width, w
  1852. Change allpass width.
  1853. Syntax for the command is : "@var{width}"
  1854. @item mix, m
  1855. Change allpass mix.
  1856. Syntax for the command is : "@var{mix}"
  1857. @end table
  1858. @section aloop
  1859. Loop audio samples.
  1860. The filter accepts the following options:
  1861. @table @option
  1862. @item loop
  1863. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1864. Default is 0.
  1865. @item size
  1866. Set maximal number of samples. Default is 0.
  1867. @item start
  1868. Set first sample of loop. Default is 0.
  1869. @item time
  1870. Set the time of loop start in seconds.
  1871. Only used if option named @var{start} is set to @code{-1}.
  1872. @end table
  1873. @anchor{amerge}
  1874. @section amerge
  1875. Merge two or more audio streams into a single multi-channel stream.
  1876. The filter accepts the following options:
  1877. @table @option
  1878. @item inputs
  1879. Set the number of inputs. Default is 2.
  1880. @end table
  1881. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1882. the channel layout of the output will be set accordingly and the channels
  1883. will be reordered as necessary. If the channel layouts of the inputs are not
  1884. disjoint, the output will have all the channels of the first input then all
  1885. the channels of the second input, in that order, and the channel layout of
  1886. the output will be the default value corresponding to the total number of
  1887. channels.
  1888. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1889. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1890. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1891. first input, b1 is the first channel of the second input).
  1892. On the other hand, if both input are in stereo, the output channels will be
  1893. in the default order: a1, a2, b1, b2, and the channel layout will be
  1894. arbitrarily set to 4.0, which may or may not be the expected value.
  1895. All inputs must have the same sample rate, and format.
  1896. If inputs do not have the same duration, the output will stop with the
  1897. shortest.
  1898. @subsection Examples
  1899. @itemize
  1900. @item
  1901. Merge two mono files into a stereo stream:
  1902. @example
  1903. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1904. @end example
  1905. @item
  1906. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1907. @example
  1908. 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
  1909. @end example
  1910. @end itemize
  1911. @section amix
  1912. Mixes multiple audio inputs into a single output.
  1913. Note that this filter only supports float samples (the @var{amerge}
  1914. and @var{pan} audio filters support many formats). If the @var{amix}
  1915. input has integer samples then @ref{aresample} will be automatically
  1916. inserted to perform the conversion to float samples.
  1917. It accepts the following parameters:
  1918. @table @option
  1919. @item inputs
  1920. The number of inputs. If unspecified, it defaults to 2.
  1921. @item duration
  1922. How to determine the end-of-stream.
  1923. @table @option
  1924. @item longest
  1925. The duration of the longest input. (default)
  1926. @item shortest
  1927. The duration of the shortest input.
  1928. @item first
  1929. The duration of the first input.
  1930. @end table
  1931. @item dropout_transition
  1932. The transition time, in seconds, for volume renormalization when an input
  1933. stream ends. The default value is 2 seconds.
  1934. @item weights
  1935. Specify weight of each input audio stream as a sequence of numbers separated
  1936. by a space. If fewer weights are specified compared to number of inputs, the
  1937. last weight is assigned to the remaining inputs.
  1938. Default weight for each input is 1.
  1939. @item normalize
  1940. Always scale inputs instead of only doing summation of samples.
  1941. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1942. by this filter if this option is disabled. By default is enabled.
  1943. @end table
  1944. @subsection Examples
  1945. @itemize
  1946. @item
  1947. This will mix 3 input audio streams to a single output with the same duration as the
  1948. first input and a dropout transition time of 3 seconds:
  1949. @example
  1950. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1951. @end example
  1952. @item
  1953. This will mix one vocal and one music input audio stream to a single output with the same duration as the
  1954. longest input. The music will have quarter the weight as the vocals, and the inputs are not normalized:
  1955. @example
  1956. ffmpeg -i VOCALS -i MUSIC -filter_complex amix=inputs=2:duration=longest:dropout_transition=0:weights="1 0.25":normalize=0 OUTPUT
  1957. @end example
  1958. @end itemize
  1959. @subsection Commands
  1960. This filter supports the following commands:
  1961. @table @option
  1962. @item weights
  1963. @item normalize
  1964. Syntax is same as option with same name.
  1965. @end table
  1966. @section amultiply
  1967. Multiply first audio stream with second audio stream and store result
  1968. in output audio stream. Multiplication is done by multiplying each
  1969. sample from first stream with sample at same position from second stream.
  1970. With this element-wise multiplication one can create amplitude fades and
  1971. amplitude modulations.
  1972. @section anequalizer
  1973. High-order parametric multiband equalizer for each channel.
  1974. It accepts the following parameters:
  1975. @table @option
  1976. @item params
  1977. This option string is in format:
  1978. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1979. Each equalizer band is separated by '|'.
  1980. @table @option
  1981. @item chn
  1982. Set channel number to which equalization will be applied.
  1983. If input doesn't have that channel the entry is ignored.
  1984. @item f
  1985. Set central frequency for band.
  1986. If input doesn't have that frequency the entry is ignored.
  1987. @item w
  1988. Set band width in Hertz.
  1989. @item g
  1990. Set band gain in dB.
  1991. @item t
  1992. Set filter type for band, optional, can be:
  1993. @table @samp
  1994. @item 0
  1995. Butterworth, this is default.
  1996. @item 1
  1997. Chebyshev type 1.
  1998. @item 2
  1999. Chebyshev type 2.
  2000. @end table
  2001. @end table
  2002. @item curves
  2003. With this option activated frequency response of anequalizer is displayed
  2004. in video stream.
  2005. @item size
  2006. Set video stream size. Only useful if curves option is activated.
  2007. @item mgain
  2008. Set max gain that will be displayed. Only useful if curves option is activated.
  2009. Setting this to a reasonable value makes it possible to display gain which is derived from
  2010. neighbour bands which are too close to each other and thus produce higher gain
  2011. when both are activated.
  2012. @item fscale
  2013. Set frequency scale used to draw frequency response in video output.
  2014. Can be linear or logarithmic. Default is logarithmic.
  2015. @item colors
  2016. Set color for each channel curve which is going to be displayed in video stream.
  2017. This is list of color names separated by space or by '|'.
  2018. Unrecognised or missing colors will be replaced by white color.
  2019. @end table
  2020. @subsection Examples
  2021. @itemize
  2022. @item
  2023. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  2024. for first 2 channels using Chebyshev type 1 filter:
  2025. @example
  2026. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  2027. @end example
  2028. @end itemize
  2029. @subsection Commands
  2030. This filter supports the following commands:
  2031. @table @option
  2032. @item change
  2033. Alter existing filter parameters.
  2034. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  2035. @var{fN} is existing filter number, starting from 0, if no such filter is available
  2036. error is returned.
  2037. @var{freq} set new frequency parameter.
  2038. @var{width} set new width parameter in Hertz.
  2039. @var{gain} set new gain parameter in dB.
  2040. Full filter invocation with asendcmd may look like this:
  2041. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  2042. @end table
  2043. @section anlmdn
  2044. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  2045. Each sample is adjusted by looking for other samples with similar contexts. This
  2046. context similarity is defined by comparing their surrounding patches of size
  2047. @option{p}. Patches are searched in an area of @option{r} around the sample.
  2048. The filter accepts the following options:
  2049. @table @option
  2050. @item strength, s
  2051. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  2052. @item patch, p
  2053. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  2054. Default value is 2 milliseconds.
  2055. @item research, r
  2056. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  2057. Default value is 6 milliseconds.
  2058. @item output, o
  2059. Set the output mode.
  2060. It accepts the following values:
  2061. @table @option
  2062. @item i
  2063. Pass input unchanged.
  2064. @item o
  2065. Pass noise filtered out.
  2066. @item n
  2067. Pass only noise.
  2068. Default value is @var{o}.
  2069. @end table
  2070. @item smooth, m
  2071. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  2072. @end table
  2073. @subsection Commands
  2074. This filter supports the all above options as @ref{commands}.
  2075. @section anlmf, anlms
  2076. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  2077. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  2078. relate to producing the least mean square of the error signal (difference between the desired,
  2079. 2nd input audio stream and the actual signal, the 1st input audio stream).
  2080. A description of the accepted options follows.
  2081. @table @option
  2082. @item order
  2083. Set filter order.
  2084. @item mu
  2085. Set filter mu.
  2086. @item eps
  2087. Set the filter eps.
  2088. @item leakage
  2089. Set the filter leakage.
  2090. @item out_mode
  2091. It accepts the following values:
  2092. @table @option
  2093. @item i
  2094. Pass the 1st input.
  2095. @item d
  2096. Pass the 2nd input.
  2097. @item o
  2098. Pass difference between desired, 2nd input and error signal estimate.
  2099. @item n
  2100. Pass difference between input, 1st input and error signal estimate.
  2101. @item e
  2102. Pass error signal estimated samples.
  2103. Default value is @var{o}.
  2104. @end table
  2105. @item precision
  2106. Set which precision to use when processing samples.
  2107. @table @option
  2108. @item auto
  2109. Auto pick internal sample format depending on other filters.
  2110. @item float
  2111. Always use single-floating point precision sample format.
  2112. @item double
  2113. Always use double-floating point precision sample format.
  2114. @end table
  2115. @end table
  2116. @subsection Examples
  2117. @itemize
  2118. @item
  2119. One of many usages of this filter is noise reduction, input audio is filtered
  2120. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  2121. @example
  2122. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  2123. @end example
  2124. @end itemize
  2125. @subsection Commands
  2126. This filter supports the same commands as options, excluding option @code{order}.
  2127. @section anull
  2128. Pass the audio source unchanged to the output.
  2129. @section apad
  2130. Pad the end of an audio stream with silence.
  2131. This can be used together with @command{ffmpeg} @option{-shortest} to
  2132. extend audio streams to the same length as the video stream.
  2133. A description of the accepted options follows.
  2134. @table @option
  2135. @item packet_size
  2136. Set silence packet size. Default value is 4096.
  2137. @item pad_len
  2138. Set the number of samples of silence to add to the end. After the
  2139. value is reached, the stream is terminated. This option is mutually
  2140. exclusive with @option{whole_len}.
  2141. @item whole_len
  2142. Set the minimum total number of samples in the output audio stream. If
  2143. the value is longer than the input audio length, silence is added to
  2144. the end, until the value is reached. This option is mutually exclusive
  2145. with @option{pad_len}.
  2146. @item pad_dur
  2147. Specify the duration of samples of silence to add. See
  2148. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2149. for the accepted syntax. Used only if set to non-negative value.
  2150. @item whole_dur
  2151. Specify the minimum total duration in the output audio stream. See
  2152. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2153. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  2154. the input audio length, silence is added to the end, until the value is reached.
  2155. This option is mutually exclusive with @option{pad_dur}
  2156. @end table
  2157. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  2158. nor @option{whole_dur} option is set, the filter will add silence to the end of
  2159. the input stream indefinitely.
  2160. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  2161. @option{whole_dur} also caused the filter to add silence indefinitely.
  2162. @subsection Examples
  2163. @itemize
  2164. @item
  2165. Add 1024 samples of silence to the end of the input:
  2166. @example
  2167. apad=pad_len=1024
  2168. @end example
  2169. @item
  2170. Make sure the audio output will contain at least 10000 samples, pad
  2171. the input with silence if required:
  2172. @example
  2173. apad=whole_len=10000
  2174. @end example
  2175. @item
  2176. Use @command{ffmpeg} to pad the audio input with silence, so that the
  2177. video stream will always result the shortest and will be converted
  2178. until the end in the output file when using the @option{shortest}
  2179. option:
  2180. @example
  2181. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  2182. @end example
  2183. @end itemize
  2184. @section aphaser
  2185. Add a phasing effect to the input audio.
  2186. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  2187. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  2188. A description of the accepted parameters follows.
  2189. @table @option
  2190. @item in_gain
  2191. Set input gain. Default is 0.4.
  2192. @item out_gain
  2193. Set output gain. Default is 0.74
  2194. @item delay
  2195. Set delay in milliseconds. Default is 3.0.
  2196. @item decay
  2197. Set decay. Default is 0.4.
  2198. @item speed
  2199. Set modulation speed in Hz. Default is 0.5.
  2200. @item type
  2201. Set modulation type. Default is triangular.
  2202. It accepts the following values:
  2203. @table @samp
  2204. @item triangular, t
  2205. @item sinusoidal, s
  2206. @end table
  2207. @end table
  2208. @section aphaseshift
  2209. Apply phase shift to input audio samples.
  2210. The filter accepts the following options:
  2211. @table @option
  2212. @item shift
  2213. Specify phase shift. Allowed range is from -1.0 to 1.0.
  2214. Default value is 0.0.
  2215. @item level
  2216. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  2217. Default value is 1.0.
  2218. @item order
  2219. Set filter order used for filtering. Allowed range is from 1 to 16.
  2220. Default value is 8.
  2221. @end table
  2222. @subsection Commands
  2223. This filter supports the all above options as @ref{commands}.
  2224. @section apsnr
  2225. Measure Audio Peak Signal-to-Noise Ratio.
  2226. This filter takes two audio streams for input, and outputs first
  2227. audio stream.
  2228. Results are in dB per channel at end of either input.
  2229. @section apsyclip
  2230. Apply Psychoacoustic clipper to input audio stream.
  2231. The filter accepts the following options:
  2232. @table @option
  2233. @item level_in
  2234. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2235. @item level_out
  2236. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2237. @item clip
  2238. Set the clipping start value. Default value is 0dBFS or 1.
  2239. @item diff
  2240. Output only difference samples, useful to hear introduced distortions.
  2241. By default is disabled.
  2242. @item adaptive
  2243. Set strength of adaptive distortion applied. Default value is 0.5.
  2244. Allowed range is from 0 to 1.
  2245. @item iterations
  2246. Set number of iterations of psychoacoustic clipper.
  2247. Allowed range is from 1 to 20. Default value is 10.
  2248. @item level
  2249. Auto level output signal. Default is disabled.
  2250. This normalizes audio back to 0dBFS if enabled.
  2251. @end table
  2252. @subsection Commands
  2253. This filter supports the all above options as @ref{commands}.
  2254. @section apulsator
  2255. Audio pulsator is something between an autopanner and a tremolo.
  2256. But it can produce funny stereo effects as well. Pulsator changes the volume
  2257. of the left and right channel based on a LFO (low frequency oscillator) with
  2258. different waveforms and shifted phases.
  2259. This filter have the ability to define an offset between left and right
  2260. channel. An offset of 0 means that both LFO shapes match each other.
  2261. The left and right channel are altered equally - a conventional tremolo.
  2262. An offset of 50% means that the shape of the right channel is exactly shifted
  2263. in phase (or moved backwards about half of the frequency) - pulsator acts as
  2264. an autopanner. At 1 both curves match again. Every setting in between moves the
  2265. phase shift gapless between all stages and produces some "bypassing" sounds with
  2266. sine and triangle waveforms. The more you set the offset near 1 (starting from
  2267. the 0.5) the faster the signal passes from the left to the right speaker.
  2268. The filter accepts the following options:
  2269. @table @option
  2270. @item level_in
  2271. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2272. @item level_out
  2273. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2274. @item mode
  2275. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  2276. sawup or sawdown. Default is sine.
  2277. @item amount
  2278. Set modulation. Define how much of original signal is affected by the LFO.
  2279. @item offset_l
  2280. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2281. @item offset_r
  2282. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2283. @item width
  2284. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2285. @item timing
  2286. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2287. @item bpm
  2288. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2289. is set to bpm.
  2290. @item ms
  2291. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2292. is set to ms.
  2293. @item hz
  2294. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2295. if timing is set to hz.
  2296. @end table
  2297. @anchor{aresample}
  2298. @section aresample
  2299. Resample the input audio to the specified parameters, using the
  2300. libswresample library. If none are specified then the filter will
  2301. automatically convert between its input and output.
  2302. This filter is also able to stretch/squeeze the audio data to make it match
  2303. the timestamps or to inject silence / cut out audio to make it match the
  2304. timestamps, do a combination of both or do neither.
  2305. The filter accepts the syntax
  2306. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2307. expresses a sample rate and @var{resampler_options} is a list of
  2308. @var{key}=@var{value} pairs, separated by ":". See the
  2309. @ref{Resampler Options,,"Resampler Options" section in the
  2310. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2311. for the complete list of supported options.
  2312. @subsection Examples
  2313. @itemize
  2314. @item
  2315. Resample the input audio to 44100Hz:
  2316. @example
  2317. aresample=44100
  2318. @end example
  2319. @item
  2320. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2321. samples per second compensation:
  2322. @example
  2323. aresample=async=1000
  2324. @end example
  2325. @end itemize
  2326. @section areverse
  2327. Reverse an audio clip.
  2328. Warning: This filter requires memory to buffer the entire clip, so trimming
  2329. is suggested.
  2330. @subsection Examples
  2331. @itemize
  2332. @item
  2333. Take the first 5 seconds of a clip, and reverse it.
  2334. @example
  2335. atrim=end=5,areverse
  2336. @end example
  2337. @end itemize
  2338. @section arls
  2339. Apply Recursive Least Squares algorithm to the first audio stream using the second audio stream.
  2340. This adaptive filter is used to mimic a desired filter by recursively finding the filter coefficients that
  2341. relate to producing the minimal weighted linear least squares cost function of the error signal (difference
  2342. between the desired, 2nd input audio stream and the actual signal, the 1st input audio stream).
  2343. A description of the accepted options follows.
  2344. @table @option
  2345. @item order
  2346. Set the filter order.
  2347. @item lambda
  2348. Set the forgetting factor.
  2349. @item delta
  2350. Set the coefficient to initialize internal covariance matrix.
  2351. @item out_mode
  2352. Set the filter output samples. It accepts the following values:
  2353. @table @option
  2354. @item i
  2355. Pass the 1st input.
  2356. @item d
  2357. Pass the 2nd input.
  2358. @item o
  2359. Pass difference between desired, 2nd input and error signal estimate.
  2360. @item n
  2361. Pass difference between input, 1st input and error signal estimate.
  2362. @item e
  2363. Pass error signal estimated samples.
  2364. Default value is @var{o}.
  2365. @end table
  2366. @item precision
  2367. Set which precision to use when processing samples.
  2368. @table @option
  2369. @item auto
  2370. Auto pick internal sample format depending on other filters.
  2371. @item float
  2372. Always use single-floating point precision sample format.
  2373. @item double
  2374. Always use double-floating point precision sample format.
  2375. @end table
  2376. @end table
  2377. @section arnndn
  2378. Reduce noise from speech using Recurrent Neural Networks.
  2379. This filter accepts the following options:
  2380. @table @option
  2381. @item model, m
  2382. Set train model file to load. This option is always required.
  2383. @item mix
  2384. Set how much to mix filtered samples into final output.
  2385. Allowed range is from -1 to 1. Default value is 1.
  2386. Negative values are special, they set how much to keep filtered noise
  2387. in the final filter output. Set this option to -1 to hear actual
  2388. noise removed from input signal.
  2389. @end table
  2390. @subsection Commands
  2391. This filter supports the all above options as @ref{commands}.
  2392. @section asdr
  2393. Measure Audio Signal-to-Distortion Ratio.
  2394. This filter takes two audio streams for input, and outputs first
  2395. audio stream.
  2396. Results are in dB per channel at end of either input.
  2397. @section asetnsamples
  2398. Set the number of samples per each output audio frame.
  2399. The last output packet may contain a different number of samples, as
  2400. the filter will flush all the remaining samples when the input audio
  2401. signals its end.
  2402. The filter accepts the following options:
  2403. @table @option
  2404. @item nb_out_samples, n
  2405. Set the number of frames per each output audio frame. The number is
  2406. intended as the number of samples @emph{per each channel}.
  2407. Default value is 1024.
  2408. @item pad, p
  2409. If set to 1, the filter will pad the last audio frame with zeroes, so
  2410. that the last frame will contain the same number of samples as the
  2411. previous ones. Default value is 1.
  2412. @end table
  2413. For example, to set the number of per-frame samples to 1234 and
  2414. disable padding for the last frame, use:
  2415. @example
  2416. asetnsamples=n=1234:p=0
  2417. @end example
  2418. @section asetrate
  2419. Set the sample rate without altering the PCM data.
  2420. This will result in a change of speed and pitch.
  2421. The filter accepts the following options:
  2422. @table @option
  2423. @item sample_rate, r
  2424. Set the output sample rate. Default is 44100 Hz.
  2425. @end table
  2426. @section ashowinfo
  2427. Show a line containing various information for each input audio frame.
  2428. The input audio is not modified.
  2429. The shown line contains a sequence of key/value pairs of the form
  2430. @var{key}:@var{value}.
  2431. The following values are shown in the output:
  2432. @table @option
  2433. @item n
  2434. The (sequential) number of the input frame, starting from 0.
  2435. @item pts
  2436. The presentation timestamp of the input frame, in time base units; the time base
  2437. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2438. @item pts_time
  2439. The presentation timestamp of the input frame in seconds.
  2440. @item fmt
  2441. The sample format.
  2442. @item chlayout
  2443. The channel layout.
  2444. @item rate
  2445. The sample rate for the audio frame.
  2446. @item nb_samples
  2447. The number of samples (per channel) in the frame.
  2448. @item checksum
  2449. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2450. audio, the data is treated as if all the planes were concatenated.
  2451. @item plane_checksums
  2452. A list of Adler-32 checksums for each data plane.
  2453. @end table
  2454. @section asisdr
  2455. Measure Audio Scaled-Invariant Signal-to-Distortion Ratio.
  2456. This filter takes two audio streams for input, and outputs first
  2457. audio stream.
  2458. Results are in dB per channel at end of either input.
  2459. @section asoftclip
  2460. Apply audio soft clipping.
  2461. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2462. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2463. This filter accepts the following options:
  2464. @table @option
  2465. @item type
  2466. Set type of soft-clipping.
  2467. It accepts the following values:
  2468. @table @option
  2469. @item hard
  2470. @item tanh
  2471. @item atan
  2472. @item cubic
  2473. @item exp
  2474. @item alg
  2475. @item quintic
  2476. @item sin
  2477. @item erf
  2478. @end table
  2479. @item threshold
  2480. Set threshold from where to start clipping. Default value is 0dB or 1.
  2481. @item output
  2482. Set gain applied to output. Default value is 0dB or 1.
  2483. @item param
  2484. Set additional parameter which controls sigmoid function.
  2485. @item oversample
  2486. Set oversampling factor.
  2487. @end table
  2488. @subsection Commands
  2489. This filter supports the all above options as @ref{commands}.
  2490. @section aspectralstats
  2491. Display frequency domain statistical information about the audio channels.
  2492. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2493. It accepts the following option:
  2494. @table @option
  2495. @item win_size
  2496. Set the window length in samples. Default value is 2048.
  2497. Allowed range is from 32 to 65536.
  2498. @item win_func
  2499. Set window function.
  2500. It accepts the following values:
  2501. @table @samp
  2502. @item rect
  2503. @item bartlett
  2504. @item hann, hanning
  2505. @item hamming
  2506. @item blackman
  2507. @item welch
  2508. @item flattop
  2509. @item bharris
  2510. @item bnuttall
  2511. @item bhann
  2512. @item sine
  2513. @item nuttall
  2514. @item lanczos
  2515. @item gauss
  2516. @item tukey
  2517. @item dolph
  2518. @item cauchy
  2519. @item parzen
  2520. @item poisson
  2521. @item bohman
  2522. @item kaiser
  2523. @end table
  2524. Default is @code{hann}.
  2525. @item overlap
  2526. Set window overlap. Allowed range is from @code{0}
  2527. to @code{1}. Default value is @code{0.5}.
  2528. @item measure
  2529. Select the parameters which are measured. The metadata keys can
  2530. be used as flags, default is @option{all} which measures everything.
  2531. @option{none} disables all measurement.
  2532. @end table
  2533. A list of each metadata key follows:
  2534. @table @option
  2535. @item mean
  2536. @item variance
  2537. @item centroid
  2538. @item spread
  2539. @item skewness
  2540. @item kurtosis
  2541. @item entropy
  2542. @item flatness
  2543. @item crest
  2544. @item flux
  2545. @item slope
  2546. @item decrease
  2547. @item rolloff
  2548. @end table
  2549. @section asr
  2550. Automatic Speech Recognition
  2551. This filter uses PocketSphinx for speech recognition. To enable
  2552. compilation of this filter, you need to configure FFmpeg with
  2553. @code{--enable-pocketsphinx}.
  2554. It accepts the following options:
  2555. @table @option
  2556. @item rate
  2557. Set sampling rate of input audio. Defaults is @code{16000}.
  2558. This need to match speech models, otherwise one will get poor results.
  2559. @item hmm
  2560. Set dictionary containing acoustic model files.
  2561. @item dict
  2562. Set pronunciation dictionary.
  2563. @item lm
  2564. Set language model file.
  2565. @item lmctl
  2566. Set language model set.
  2567. @item lmname
  2568. Set which language model to use.
  2569. @item logfn
  2570. Set output for log messages.
  2571. @end table
  2572. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2573. @anchor{astats}
  2574. @section astats
  2575. Display time domain statistical information about the audio channels.
  2576. Statistics are calculated and displayed for each audio channel and,
  2577. where applicable, an overall figure is also given.
  2578. It accepts the following option:
  2579. @table @option
  2580. @item length
  2581. Short window length in seconds, used for peak and trough RMS measurement.
  2582. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2583. @item metadata
  2584. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2585. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2586. disabled.
  2587. Available keys for each channel are:
  2588. @var{Bit_depth}
  2589. @var{Crest_factor}
  2590. @var{DC_offset}
  2591. @var{Dynamic_range}
  2592. @var{Entropy}
  2593. @var{Flat_factor}
  2594. @var{Max_difference}
  2595. @var{Max_level}
  2596. @var{Mean_difference}
  2597. @var{Min_difference}
  2598. @var{Min_level}
  2599. @var{Noise_floor}
  2600. @var{Noise_floor_count}
  2601. @var{Number_of_Infs}
  2602. @var{Number_of_NaNs}
  2603. @var{Number_of_denormals}
  2604. @var{Peak_count}
  2605. @var{Abs_Peak_count}
  2606. @var{Peak_level}
  2607. @var{RMS_difference}
  2608. @var{RMS_peak}
  2609. @var{RMS_trough}
  2610. @var{Zero_crossings}
  2611. @var{Zero_crossings_rate}
  2612. and for @code{Overall}:
  2613. @var{Bit_depth}
  2614. @var{DC_offset}
  2615. @var{Entropy}
  2616. @var{Flat_factor}
  2617. @var{Max_difference}
  2618. @var{Max_level}
  2619. @var{Mean_difference}
  2620. @var{Min_difference}
  2621. @var{Min_level}
  2622. @var{Noise_floor}
  2623. @var{Noise_floor_count}
  2624. @var{Number_of_Infs}
  2625. @var{Number_of_NaNs}
  2626. @var{Number_of_denormals}
  2627. @var{Number_of_samples}
  2628. @var{Peak_count}
  2629. @var{Abs_Peak_count}
  2630. @var{Peak_level}
  2631. @var{RMS_difference}
  2632. @var{RMS_level}
  2633. @var{RMS_peak}
  2634. @var{RMS_trough}
  2635. For example, a full key looks like @code{lavfi.astats.1.DC_offset} or
  2636. @code{lavfi.astats.Overall.Peak_count}.
  2637. Read below for the description of the keys.
  2638. @item reset
  2639. Set the number of frames over which cumulative stats are calculated before
  2640. being reset. Default is disabled.
  2641. @item measure_perchannel
  2642. Select the parameters which are measured per channel. The metadata keys can
  2643. be used as flags, default is @option{all} which measures everything.
  2644. @option{none} disables all per channel measurement.
  2645. @item measure_overall
  2646. Select the parameters which are measured overall. The metadata keys can
  2647. be used as flags, default is @option{all} which measures everything.
  2648. @option{none} disables all overall measurement.
  2649. @end table
  2650. A description of the measure keys follow:
  2651. @table @option
  2652. @item none
  2653. no measures
  2654. @item all
  2655. all measures
  2656. @item Bit_depth
  2657. overall bit depth of audio, i.e. number of bits used for each sample
  2658. @item Crest_factor
  2659. standard ratio of peak to RMS level (note: not in dB)
  2660. @item DC_offset
  2661. mean amplitude displacement from zero
  2662. @item Dynamic_range
  2663. measured dynamic range of audio in dB
  2664. @item Entropy
  2665. entropy measured across whole audio, entropy of value near 1.0 is typically measured for white noise
  2666. @item Flat_factor
  2667. flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2668. (i.e. either @var{Min_level} or @var{Max_level})
  2669. @item Max_difference
  2670. maximal difference between two consecutive samples
  2671. @item Max_level
  2672. maximal sample level
  2673. @item Mean_difference
  2674. mean difference between two consecutive samples, i.e. the average of each difference between two consecutive samples
  2675. @item Min_difference
  2676. minimal difference between two consecutive samples
  2677. @item Min_level
  2678. minimal sample level
  2679. @item Noise_floor
  2680. minimum local peak measured in dBFS over a short window
  2681. @item Noise_floor_count
  2682. number of occasions (not the number of samples) that the signal attained
  2683. @var{Noise floor}
  2684. @item Number_of_Infs
  2685. number of samples with an infinite value
  2686. @item Number_of_NaNs
  2687. number of samples with a NaN (not a number) value
  2688. @item Number_of_denormals
  2689. number of samples with a subnormal value
  2690. @item Number_of_samples
  2691. number of samples
  2692. @item Peak_count
  2693. number of occasions (not the number of samples) that the signal attained either
  2694. @var{Min_level} or @var{Max_level}
  2695. @item Abs_Peak_count
  2696. number of occasions that the absolute samples taken from the signal attained
  2697. max absolute value of @var{Min_level} and @var{Max_level}
  2698. @item Peak_level
  2699. standard peak level measured in dBFS
  2700. @item RMS_difference
  2701. Root Mean Square difference between two consecutive samples
  2702. @item RMS_level
  2703. standard RMS level measured in dBFS
  2704. @item RMS_peak
  2705. @item RMS_trough
  2706. peak and trough values for RMS level measured over a short window,
  2707. measured in dBFS.
  2708. @item Zero crossings
  2709. number of points where the waveform crosses the zero level axis
  2710. @item Zero crossings rate
  2711. rate of Zero crossings and number of audio samples
  2712. @end table
  2713. @section asubboost
  2714. Boost subwoofer frequencies.
  2715. The filter accepts the following options:
  2716. @table @option
  2717. @item dry
  2718. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2719. Default value is 1.0.
  2720. @item wet
  2721. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2722. Default value is 1.0.
  2723. @item boost
  2724. Set max boost factor. Allowed range is from 1 to 12. Default value is 2.
  2725. @item decay
  2726. Set delay line decay gain value. Allowed range is from 0 to 1.
  2727. Default value is 0.0.
  2728. @item feedback
  2729. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2730. Default value is 0.9.
  2731. @item cutoff
  2732. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2733. Default value is 100.
  2734. @item slope
  2735. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2736. Default value is 0.5.
  2737. @item delay
  2738. Set delay. Allowed range is from 1 to 100.
  2739. Default value is 20.
  2740. @item channels
  2741. Set the channels to process. Default value is all available.
  2742. @end table
  2743. @subsection Commands
  2744. This filter supports the all above options as @ref{commands}.
  2745. @section asubcut
  2746. Cut subwoofer frequencies.
  2747. This filter allows to set custom, steeper
  2748. roll off than highpass filter, and thus is able to more attenuate
  2749. frequency content in stop-band.
  2750. The filter accepts the following options:
  2751. @table @option
  2752. @item cutoff
  2753. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2754. Default value is 20.
  2755. @item order
  2756. Set filter order. Available values are from 3 to 20.
  2757. Default value is 10.
  2758. @item level
  2759. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2760. @end table
  2761. @subsection Commands
  2762. This filter supports the all above options as @ref{commands}.
  2763. @section asupercut
  2764. Cut super frequencies.
  2765. The filter accepts the following options:
  2766. @table @option
  2767. @item cutoff
  2768. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2769. Default value is 20000.
  2770. @item order
  2771. Set filter order. Available values are from 3 to 20.
  2772. Default value is 10.
  2773. @item level
  2774. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2775. @end table
  2776. @subsection Commands
  2777. This filter supports the all above options as @ref{commands}.
  2778. @section asuperpass
  2779. Apply high order Butterworth band-pass filter.
  2780. The filter accepts the following options:
  2781. @table @option
  2782. @item centerf
  2783. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2784. Default value is 1000.
  2785. @item order
  2786. Set filter order. Available values are from 4 to 20.
  2787. Default value is 4.
  2788. @item qfactor
  2789. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2790. @item level
  2791. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2792. @end table
  2793. @subsection Commands
  2794. This filter supports the all above options as @ref{commands}.
  2795. @section asuperstop
  2796. Apply high order Butterworth band-stop filter.
  2797. The filter accepts the following options:
  2798. @table @option
  2799. @item centerf
  2800. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2801. Default value is 1000.
  2802. @item order
  2803. Set filter order. Available values are from 4 to 20.
  2804. Default value is 4.
  2805. @item qfactor
  2806. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2807. @item level
  2808. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2809. @end table
  2810. @subsection Commands
  2811. This filter supports the all above options as @ref{commands}.
  2812. @section atempo
  2813. Adjust audio tempo.
  2814. The filter accepts exactly one parameter, the audio tempo. If not
  2815. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2816. be in the [0.5, 100.0] range.
  2817. Note that tempo greater than 2 will skip some samples rather than
  2818. blend them in. If for any reason this is a concern it is always
  2819. possible to daisy-chain several instances of atempo to achieve the
  2820. desired product tempo.
  2821. @subsection Examples
  2822. @itemize
  2823. @item
  2824. Slow down audio to 80% tempo:
  2825. @example
  2826. atempo=0.8
  2827. @end example
  2828. @item
  2829. To speed up audio to 300% tempo:
  2830. @example
  2831. atempo=3
  2832. @end example
  2833. @item
  2834. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2835. @example
  2836. atempo=sqrt(3),atempo=sqrt(3)
  2837. @end example
  2838. @end itemize
  2839. @subsection Commands
  2840. This filter supports the following commands:
  2841. @table @option
  2842. @item tempo
  2843. Change filter tempo scale factor.
  2844. Syntax for the command is : "@var{tempo}"
  2845. @end table
  2846. @section atilt
  2847. Apply spectral tilt filter to audio stream.
  2848. This filter apply any spectral roll-off slope over any specified frequency band.
  2849. The filter accepts the following options:
  2850. @table @option
  2851. @item freq
  2852. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2853. @item slope
  2854. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2855. @item width
  2856. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2857. @item order
  2858. Set order of tilt filter.
  2859. @item level
  2860. Set input volume level. Allowed range is from 0 to 4.
  2861. Default is 1.
  2862. @end table
  2863. @subsection Commands
  2864. This filter supports the all above options as @ref{commands}.
  2865. @section atrim
  2866. Trim the input so that the output contains one continuous subpart of the input.
  2867. It accepts the following parameters:
  2868. @table @option
  2869. @item start
  2870. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2871. sample with the timestamp @var{start} will be the first sample in the output.
  2872. @item end
  2873. Specify time of the first audio sample that will be dropped, i.e. the
  2874. audio sample immediately preceding the one with the timestamp @var{end} will be
  2875. the last sample in the output.
  2876. @item start_pts
  2877. Same as @var{start}, except this option sets the start timestamp in samples
  2878. instead of seconds.
  2879. @item end_pts
  2880. Same as @var{end}, except this option sets the end timestamp in samples instead
  2881. of seconds.
  2882. @item duration
  2883. The maximum duration of the output in seconds.
  2884. @item start_sample
  2885. The number of the first sample that should be output.
  2886. @item end_sample
  2887. The number of the first sample that should be dropped.
  2888. @end table
  2889. @option{start}, @option{end}, and @option{duration} are expressed as time
  2890. duration specifications; see
  2891. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2892. Note that the first two sets of the start/end options and the @option{duration}
  2893. option look at the frame timestamp, while the _sample options simply count the
  2894. samples that pass through the filter. So start/end_pts and start/end_sample will
  2895. give different results when the timestamps are wrong, inexact or do not start at
  2896. zero. Also note that this filter does not modify the timestamps. If you wish
  2897. to have the output timestamps start at zero, insert the asetpts filter after the
  2898. atrim filter.
  2899. If multiple start or end options are set, this filter tries to be greedy and
  2900. keep all samples that match at least one of the specified constraints. To keep
  2901. only the part that matches all the constraints at once, chain multiple atrim
  2902. filters.
  2903. The defaults are such that all the input is kept. So it is possible to set e.g.
  2904. just the end values to keep everything before the specified time.
  2905. Examples:
  2906. @itemize
  2907. @item
  2908. Drop everything except the second minute of input:
  2909. @example
  2910. ffmpeg -i INPUT -af atrim=60:120
  2911. @end example
  2912. @item
  2913. Keep only the first 1000 samples:
  2914. @example
  2915. ffmpeg -i INPUT -af atrim=end_sample=1000
  2916. @end example
  2917. @end itemize
  2918. @section axcorrelate
  2919. Calculate normalized windowed cross-correlation between two input audio streams.
  2920. Resulted samples are always between -1 and 1 inclusive.
  2921. If result is 1 it means two input samples are highly correlated in that selected segment.
  2922. Result 0 means they are not correlated at all.
  2923. If result is -1 it means two input samples are out of phase, which means they cancel each
  2924. other.
  2925. The filter accepts the following options:
  2926. @table @option
  2927. @item size
  2928. Set size of segment over which cross-correlation is calculated.
  2929. Default is 256. Allowed range is from 2 to 131072.
  2930. @item algo
  2931. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast} or @code{best}.
  2932. Default is @code{best}. Fast algorithm assumes mean values over any given segment
  2933. are always zero and thus need much less calculations to make.
  2934. This is generally not true, but is valid for typical audio streams.
  2935. @end table
  2936. @subsection Examples
  2937. @itemize
  2938. @item
  2939. Calculate correlation between channels in stereo audio stream:
  2940. @example
  2941. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2942. @end example
  2943. @end itemize
  2944. @section bandpass
  2945. Apply a two-pole Butterworth band-pass filter with central
  2946. frequency @var{frequency}, and (3dB-point) band-width width.
  2947. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2948. instead of the default: constant 0dB peak gain.
  2949. The filter roll off at 6dB per octave (20dB per decade).
  2950. The filter accepts the following options:
  2951. @table @option
  2952. @item frequency, f
  2953. Set the filter's central frequency. Default is @code{3000}.
  2954. @item csg
  2955. Constant skirt gain if set to 1. Defaults to 0.
  2956. @item width_type, t
  2957. Set method to specify band-width of filter.
  2958. @table @option
  2959. @item h
  2960. Hz
  2961. @item q
  2962. Q-Factor
  2963. @item o
  2964. octave
  2965. @item s
  2966. slope
  2967. @item k
  2968. kHz
  2969. @end table
  2970. @item width, w
  2971. Specify the band-width of a filter in width_type units.
  2972. @item mix, m
  2973. How much to use filtered signal in output. Default is 1.
  2974. Range is between 0 and 1.
  2975. @item channels, c
  2976. Specify which channels to filter, by default all available are filtered.
  2977. @item normalize, n
  2978. Normalize biquad coefficients, by default is disabled.
  2979. Enabling it will normalize magnitude response at DC to 0dB.
  2980. @item transform, a
  2981. Set transform type of IIR filter.
  2982. @table @option
  2983. @item di
  2984. @item dii
  2985. @item tdi
  2986. @item tdii
  2987. @item latt
  2988. @item svf
  2989. @item zdf
  2990. @end table
  2991. @item precision, r
  2992. Set precision of filtering.
  2993. @table @option
  2994. @item auto
  2995. Pick automatic sample format depending on surround filters.
  2996. @item s16
  2997. Always use signed 16-bit.
  2998. @item s32
  2999. Always use signed 32-bit.
  3000. @item f32
  3001. Always use float 32-bit.
  3002. @item f64
  3003. Always use float 64-bit.
  3004. @end table
  3005. @item block_size, b
  3006. Set block size used for reverse IIR processing. If this value is set to high enough
  3007. value (higher than impulse response length truncated when reaches near zero values) filtering
  3008. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3009. Note that filter delay will be exactly this many samples when set to non-zero value.
  3010. @end table
  3011. @subsection Commands
  3012. This filter supports the following commands:
  3013. @table @option
  3014. @item frequency, f
  3015. Change bandpass frequency.
  3016. Syntax for the command is : "@var{frequency}"
  3017. @item width_type, t
  3018. Change bandpass width_type.
  3019. Syntax for the command is : "@var{width_type}"
  3020. @item width, w
  3021. Change bandpass width.
  3022. Syntax for the command is : "@var{width}"
  3023. @item mix, m
  3024. Change bandpass mix.
  3025. Syntax for the command is : "@var{mix}"
  3026. @end table
  3027. @section bandreject
  3028. Apply a two-pole Butterworth band-reject filter with central
  3029. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  3030. The filter roll off at 6dB per octave (20dB per decade).
  3031. The filter accepts the following options:
  3032. @table @option
  3033. @item frequency, f
  3034. Set the filter's central frequency. Default is @code{3000}.
  3035. @item width_type, t
  3036. Set method to specify band-width of filter.
  3037. @table @option
  3038. @item h
  3039. Hz
  3040. @item q
  3041. Q-Factor
  3042. @item o
  3043. octave
  3044. @item s
  3045. slope
  3046. @item k
  3047. kHz
  3048. @end table
  3049. @item width, w
  3050. Specify the band-width of a filter in width_type units.
  3051. @item mix, m
  3052. How much to use filtered signal in output. Default is 1.
  3053. Range is between 0 and 1.
  3054. @item channels, c
  3055. Specify which channels to filter, by default all available are filtered.
  3056. @item normalize, n
  3057. Normalize biquad coefficients, by default is disabled.
  3058. Enabling it will normalize magnitude response at DC to 0dB.
  3059. @item transform, a
  3060. Set transform type of IIR filter.
  3061. @table @option
  3062. @item di
  3063. @item dii
  3064. @item tdi
  3065. @item tdii
  3066. @item latt
  3067. @item svf
  3068. @item zdf
  3069. @end table
  3070. @item precision, r
  3071. Set precision of filtering.
  3072. @table @option
  3073. @item auto
  3074. Pick automatic sample format depending on surround filters.
  3075. @item s16
  3076. Always use signed 16-bit.
  3077. @item s32
  3078. Always use signed 32-bit.
  3079. @item f32
  3080. Always use float 32-bit.
  3081. @item f64
  3082. Always use float 64-bit.
  3083. @end table
  3084. @item block_size, b
  3085. Set block size used for reverse IIR processing. If this value is set to high enough
  3086. value (higher than impulse response length truncated when reaches near zero values) filtering
  3087. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3088. Note that filter delay will be exactly this many samples when set to non-zero value.
  3089. @end table
  3090. @subsection Commands
  3091. This filter supports the following commands:
  3092. @table @option
  3093. @item frequency, f
  3094. Change bandreject frequency.
  3095. Syntax for the command is : "@var{frequency}"
  3096. @item width_type, t
  3097. Change bandreject width_type.
  3098. Syntax for the command is : "@var{width_type}"
  3099. @item width, w
  3100. Change bandreject width.
  3101. Syntax for the command is : "@var{width}"
  3102. @item mix, m
  3103. Change bandreject mix.
  3104. Syntax for the command is : "@var{mix}"
  3105. @end table
  3106. @section bass, lowshelf
  3107. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  3108. shelving filter with a response similar to that of a standard
  3109. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3110. The filter accepts the following options:
  3111. @table @option
  3112. @item gain, g
  3113. Give the gain at 0 Hz. Its useful range is about -20
  3114. (for a large cut) to +20 (for a large boost).
  3115. Beware of clipping when using a positive gain.
  3116. @item frequency, f
  3117. Set the filter's central frequency and so can be used
  3118. to extend or reduce the frequency range to be boosted or cut.
  3119. The default value is @code{100} Hz.
  3120. @item width_type, t
  3121. Set method to specify band-width of filter.
  3122. @table @option
  3123. @item h
  3124. Hz
  3125. @item q
  3126. Q-Factor
  3127. @item o
  3128. octave
  3129. @item s
  3130. slope
  3131. @item k
  3132. kHz
  3133. @end table
  3134. @item width, w
  3135. Determine how steep is the filter's shelf transition.
  3136. @item poles, p
  3137. Set number of poles. Default is 2.
  3138. @item mix, m
  3139. How much to use filtered signal in output. Default is 1.
  3140. Range is between 0 and 1.
  3141. @item channels, c
  3142. Specify which channels to filter, by default all available are filtered.
  3143. @item normalize, n
  3144. Normalize biquad coefficients, by default is disabled.
  3145. Enabling it will normalize magnitude response at DC to 0dB.
  3146. @item transform, a
  3147. Set transform type of IIR filter.
  3148. @table @option
  3149. @item di
  3150. @item dii
  3151. @item tdi
  3152. @item tdii
  3153. @item latt
  3154. @item svf
  3155. @item zdf
  3156. @end table
  3157. @item precision, r
  3158. Set precision of filtering.
  3159. @table @option
  3160. @item auto
  3161. Pick automatic sample format depending on surround filters.
  3162. @item s16
  3163. Always use signed 16-bit.
  3164. @item s32
  3165. Always use signed 32-bit.
  3166. @item f32
  3167. Always use float 32-bit.
  3168. @item f64
  3169. Always use float 64-bit.
  3170. @end table
  3171. @item block_size, b
  3172. Set block size used for reverse IIR processing. If this value is set to high enough
  3173. value (higher than impulse response length truncated when reaches near zero values) filtering
  3174. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3175. Note that filter delay will be exactly this many samples when set to non-zero value.
  3176. @end table
  3177. @subsection Commands
  3178. This filter supports the following commands:
  3179. @table @option
  3180. @item frequency, f
  3181. Change bass frequency.
  3182. Syntax for the command is : "@var{frequency}"
  3183. @item width_type, t
  3184. Change bass width_type.
  3185. Syntax for the command is : "@var{width_type}"
  3186. @item width, w
  3187. Change bass width.
  3188. Syntax for the command is : "@var{width}"
  3189. @item gain, g
  3190. Change bass gain.
  3191. Syntax for the command is : "@var{gain}"
  3192. @item mix, m
  3193. Change bass mix.
  3194. Syntax for the command is : "@var{mix}"
  3195. @end table
  3196. @section biquad
  3197. Apply a biquad IIR filter with the given coefficients.
  3198. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  3199. are the numerator and denominator coefficients respectively.
  3200. and @var{channels}, @var{c} specify which channels to filter, by default all
  3201. available are filtered.
  3202. @subsection Commands
  3203. This filter supports the following commands:
  3204. @table @option
  3205. @item a0
  3206. @item a1
  3207. @item a2
  3208. @item b0
  3209. @item b1
  3210. @item b2
  3211. Change biquad parameter.
  3212. Syntax for the command is : "@var{value}"
  3213. @item mix, m
  3214. How much to use filtered signal in output. Default is 1.
  3215. Range is between 0 and 1.
  3216. @item channels, c
  3217. Specify which channels to filter, by default all available are filtered.
  3218. @item normalize, n
  3219. Normalize biquad coefficients, by default is disabled.
  3220. Enabling it will normalize magnitude response at DC to 0dB.
  3221. @item transform, a
  3222. Set transform type of IIR filter.
  3223. @table @option
  3224. @item di
  3225. @item dii
  3226. @item tdi
  3227. @item tdii
  3228. @item latt
  3229. @item svf
  3230. @item zdf
  3231. @end table
  3232. @item precision, r
  3233. Set precision of filtering.
  3234. @table @option
  3235. @item auto
  3236. Pick automatic sample format depending on surround filters.
  3237. @item s16
  3238. Always use signed 16-bit.
  3239. @item s32
  3240. Always use signed 32-bit.
  3241. @item f32
  3242. Always use float 32-bit.
  3243. @item f64
  3244. Always use float 64-bit.
  3245. @end table
  3246. @item block_size, b
  3247. Set block size used for reverse IIR processing. If this value is set to high enough
  3248. value (higher than impulse response length truncated when reaches near zero values) filtering
  3249. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3250. Note that filter delay will be exactly this many samples when set to non-zero value.
  3251. @end table
  3252. @section bs2b
  3253. Bauer stereo to binaural transformation, which improves headphone listening of
  3254. stereo audio records.
  3255. To enable compilation of this filter you need to configure FFmpeg with
  3256. @code{--enable-libbs2b}.
  3257. It accepts the following parameters:
  3258. @table @option
  3259. @item profile
  3260. Pre-defined crossfeed level.
  3261. @table @option
  3262. @item default
  3263. Default level (fcut=700, feed=50).
  3264. @item cmoy
  3265. Chu Moy circuit (fcut=700, feed=60).
  3266. @item jmeier
  3267. Jan Meier circuit (fcut=650, feed=95).
  3268. @end table
  3269. @item fcut
  3270. Cut frequency (in Hz).
  3271. @item feed
  3272. Feed level (in Hz).
  3273. @end table
  3274. @section channelmap
  3275. Remap input channels to new locations.
  3276. It accepts the following parameters:
  3277. @table @option
  3278. @item map
  3279. Map channels from input to output. The argument is a '|'-separated list of
  3280. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  3281. @code{@var{in_channel}} form. @var{in_channel} can be either the name of the
  3282. input channel (e.g. FL for front left) or its index in the input channel
  3283. layout. @var{out_channel} is the name of the output channel or its index in the
  3284. output channel layout. If @var{out_channel} is not given then it is implicitly
  3285. an index, starting with zero and increasing by one for each mapping. Mixing
  3286. different types of mappings is not allowed and will result in a parse error.
  3287. @item channel_layout
  3288. The channel layout of the output stream. If not specified, then filter will
  3289. guess it based on the @var{out_channel} names or the number of mappings.
  3290. Guessed layouts will not necessarily contain channels in the order of the
  3291. mappings.
  3292. @end table
  3293. If no mapping is present, the filter will implicitly map input channels to
  3294. output channels, preserving indices.
  3295. @subsection Examples
  3296. @itemize
  3297. @item
  3298. For example, assuming a 5.1+downmix input MOV file,
  3299. @example
  3300. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  3301. @end example
  3302. will create an output WAV file tagged as stereo from the downmix channels of
  3303. the input.
  3304. @item
  3305. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  3306. @example
  3307. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  3308. @end example
  3309. @end itemize
  3310. @section channelsplit
  3311. Split each channel from an input audio stream into a separate output stream.
  3312. It accepts the following parameters:
  3313. @table @option
  3314. @item channel_layout
  3315. The channel layout of the input stream. The default is "stereo".
  3316. @item channels
  3317. A channel layout describing the channels to be extracted as separate output streams
  3318. or "all" to extract each input channel as a separate stream. The default is "all".
  3319. Choosing channels not present in channel layout in the input will result in an error.
  3320. @end table
  3321. @subsection Examples
  3322. @itemize
  3323. @item
  3324. For example, assuming a stereo input MP3 file,
  3325. @example
  3326. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  3327. @end example
  3328. will create an output Matroska file with two audio streams, one containing only
  3329. the left channel and the other the right channel.
  3330. @item
  3331. Split a 5.1 WAV file into per-channel files:
  3332. @example
  3333. ffmpeg -i in.wav -filter_complex
  3334. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  3335. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  3336. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  3337. side_right.wav
  3338. @end example
  3339. @item
  3340. Extract only LFE from a 5.1 WAV file:
  3341. @example
  3342. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  3343. -map '[LFE]' lfe.wav
  3344. @end example
  3345. @end itemize
  3346. @section chorus
  3347. Add a chorus effect to the audio.
  3348. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  3349. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  3350. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  3351. The modulation depth defines the range the modulated delay is played before or after
  3352. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  3353. sound tuned around the original one, like in a chorus where some vocals are slightly
  3354. off key.
  3355. It accepts the following parameters:
  3356. @table @option
  3357. @item in_gain
  3358. Set input gain. Default is 0.4.
  3359. @item out_gain
  3360. Set output gain. Default is 0.4.
  3361. @item delays
  3362. Set delays. A typical delay is around 40ms to 60ms.
  3363. @item decays
  3364. Set decays.
  3365. @item speeds
  3366. Set speeds.
  3367. @item depths
  3368. Set depths.
  3369. @end table
  3370. @subsection Examples
  3371. @itemize
  3372. @item
  3373. A single delay:
  3374. @example
  3375. chorus=0.7:0.9:55:0.4:0.25:2
  3376. @end example
  3377. @item
  3378. Two delays:
  3379. @example
  3380. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3381. @end example
  3382. @item
  3383. Fuller sounding chorus with three delays:
  3384. @example
  3385. 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
  3386. @end example
  3387. @end itemize
  3388. @section compand
  3389. Compress or expand the audio's dynamic range.
  3390. It accepts the following parameters:
  3391. @table @option
  3392. @item attacks
  3393. @item decays
  3394. A list of times in seconds for each channel over which the instantaneous level
  3395. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3396. increase of volume and @var{decays} refers to decrease of volume. For most
  3397. situations, the attack time (response to the audio getting louder) should be
  3398. shorter than the decay time, because the human ear is more sensitive to sudden
  3399. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3400. a typical value for decay is 0.8 seconds.
  3401. If specified number of attacks & decays is lower than number of channels, the last
  3402. set attack/decay will be used for all remaining channels.
  3403. @item points
  3404. A list of points for the transfer function, specified in dB relative to the
  3405. maximum possible signal amplitude. Each key points list must be defined using
  3406. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3407. @code{x0/y0 x1/y1 x2/y2 ....}
  3408. The input values must be in strictly increasing order but the transfer function
  3409. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3410. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3411. function are @code{-70/-70|-60/-20|1/0}.
  3412. @item soft-knee
  3413. Set the curve radius in dB for all joints. It defaults to 0.01.
  3414. @item gain
  3415. Set the additional gain in dB to be applied at all points on the transfer
  3416. function. This allows for easy adjustment of the overall gain.
  3417. It defaults to 0.
  3418. @item volume
  3419. Set an initial volume, in dB, to be assumed for each channel when filtering
  3420. starts. This permits the user to supply a nominal level initially, so that, for
  3421. example, a very large gain is not applied to initial signal levels before the
  3422. companding has begun to operate. A typical value for audio which is initially
  3423. quiet is -90 dB. It defaults to 0.
  3424. @item delay
  3425. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3426. delayed before being fed to the volume adjuster. Specifying a delay
  3427. approximately equal to the attack/decay times allows the filter to effectively
  3428. operate in predictive rather than reactive mode. It defaults to 0.
  3429. @end table
  3430. @subsection Examples
  3431. @itemize
  3432. @item
  3433. Make music with both quiet and loud passages suitable for listening to in a
  3434. noisy environment:
  3435. @example
  3436. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3437. @end example
  3438. Another example for audio with whisper and explosion parts:
  3439. @example
  3440. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3441. @end example
  3442. @item
  3443. A noise gate for when the noise is at a lower level than the signal:
  3444. @example
  3445. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3446. @end example
  3447. @item
  3448. Here is another noise gate, this time for when the noise is at a higher level
  3449. than the signal (making it, in some ways, similar to squelch):
  3450. @example
  3451. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3452. @end example
  3453. @item
  3454. 2:1 compression starting at -6dB:
  3455. @example
  3456. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3457. @end example
  3458. @item
  3459. 2:1 compression starting at -9dB:
  3460. @example
  3461. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3462. @end example
  3463. @item
  3464. 2:1 compression starting at -12dB:
  3465. @example
  3466. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3467. @end example
  3468. @item
  3469. 2:1 compression starting at -18dB:
  3470. @example
  3471. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3472. @end example
  3473. @item
  3474. 3:1 compression starting at -15dB:
  3475. @example
  3476. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3477. @end example
  3478. @item
  3479. Compressor/Gate:
  3480. @example
  3481. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3482. @end example
  3483. @item
  3484. Expander:
  3485. @example
  3486. 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
  3487. @end example
  3488. @item
  3489. Hard limiter at -6dB:
  3490. @example
  3491. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3492. @end example
  3493. @item
  3494. Hard limiter at -12dB:
  3495. @example
  3496. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3497. @end example
  3498. @item
  3499. Hard noise gate at -35 dB:
  3500. @example
  3501. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3502. @end example
  3503. @item
  3504. Soft limiter:
  3505. @example
  3506. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3507. @end example
  3508. @end itemize
  3509. @section compensationdelay
  3510. Compensation Delay Line is a metric based delay to compensate differing
  3511. positions of microphones or speakers.
  3512. For example, you have recorded guitar with two microphones placed in
  3513. different locations. Because the front of sound wave has fixed speed in
  3514. normal conditions, the phasing of microphones can vary and depends on
  3515. their location and interposition. The best sound mix can be achieved when
  3516. these microphones are in phase (synchronized). Note that a distance of
  3517. ~30 cm between microphones makes one microphone capture the signal in
  3518. antiphase to the other microphone. That makes the final mix sound moody.
  3519. This filter helps to solve phasing problems by adding different delays
  3520. to each microphone track and make them synchronized.
  3521. The best result can be reached when you take one track as base and
  3522. synchronize other tracks one by one with it.
  3523. Remember that synchronization/delay tolerance depends on sample rate, too.
  3524. Higher sample rates will give more tolerance.
  3525. The filter accepts the following parameters:
  3526. @table @option
  3527. @item mm
  3528. Set millimeters distance. This is compensation distance for fine tuning.
  3529. Default is 0.
  3530. @item cm
  3531. Set cm distance. This is compensation distance for tightening distance setup.
  3532. Default is 0.
  3533. @item m
  3534. Set meters distance. This is compensation distance for hard distance setup.
  3535. Default is 0.
  3536. @item dry
  3537. Set dry amount. Amount of unprocessed (dry) signal.
  3538. Default is 0.
  3539. @item wet
  3540. Set wet amount. Amount of processed (wet) signal.
  3541. Default is 1.
  3542. @item temp
  3543. Set temperature in degrees Celsius. This is the temperature of the environment.
  3544. Default is 20.
  3545. @end table
  3546. @subsection Commands
  3547. This filter supports the all above options as @ref{commands}.
  3548. @section crossfeed
  3549. Apply headphone crossfeed filter.
  3550. Crossfeed is the process of blending the left and right channels of stereo
  3551. audio recording.
  3552. It is mainly used to reduce extreme stereo separation of low frequencies.
  3553. The intent is to produce more speaker like sound to the listener.
  3554. The filter accepts the following options:
  3555. @table @option
  3556. @item strength
  3557. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3558. This sets gain of low shelf filter for side part of stereo image.
  3559. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3560. @item range
  3561. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3562. This sets cut off frequency of low shelf filter. Default is cut off near
  3563. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3564. @item slope
  3565. Set curve slope of low shelf filter. Default is 0.5.
  3566. Allowed range is from 0.01 to 1.
  3567. @item level_in
  3568. Set input gain. Default is 0.9.
  3569. @item level_out
  3570. Set output gain. Default is 1.
  3571. @item block_size
  3572. Set block size used for reverse IIR processing. If this value is set to high enough
  3573. value (higher than impulse response length truncated when reaches near zero values) filtering
  3574. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3575. Note that filter delay will be exactly this many samples when set to non-zero value.
  3576. @end table
  3577. @subsection Commands
  3578. This filter supports the all above options as @ref{commands}.
  3579. @section crystalizer
  3580. Simple algorithm for audio noise sharpening.
  3581. This filter linearly increases differences between each audio sample.
  3582. The filter accepts the following options:
  3583. @table @option
  3584. @item i
  3585. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3586. (unchanged sound) to 10.0 (maximum effect).
  3587. To inverse filtering use negative value.
  3588. @item c
  3589. Enable clipping. By default is enabled.
  3590. @end table
  3591. @subsection Commands
  3592. This filter supports the all above options as @ref{commands}.
  3593. @section dcshift
  3594. Apply a DC shift to the audio.
  3595. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3596. in the recording chain) from the audio. The effect of a DC offset is reduced
  3597. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3598. a signal has a DC offset.
  3599. @table @option
  3600. @item shift
  3601. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3602. the audio.
  3603. @item limitergain
  3604. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3605. used to prevent clipping.
  3606. @end table
  3607. @section deesser
  3608. Apply de-essing to the audio samples.
  3609. @table @option
  3610. @item i
  3611. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3612. Default is 0.
  3613. @item m
  3614. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3615. Default is 0.5.
  3616. @item f
  3617. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3618. Default is 0.5.
  3619. @item s
  3620. Set the output mode.
  3621. It accepts the following values:
  3622. @table @option
  3623. @item i
  3624. Pass input unchanged.
  3625. @item o
  3626. Pass ess filtered out.
  3627. @item e
  3628. Pass only ess.
  3629. Default value is @var{o}.
  3630. @end table
  3631. @end table
  3632. @section dialoguenhance
  3633. Enhance dialogue in stereo audio.
  3634. This filter accepts stereo input and produce surround (3.0) channels output.
  3635. The newly produced front center channel have enhanced speech dialogue originally
  3636. available in both stereo channels.
  3637. This filter outputs front left and front right channels same as available in stereo input.
  3638. The filter accepts the following options:
  3639. @table @option
  3640. @item original
  3641. Set the original center factor to keep in front center channel output.
  3642. Allowed range is from 0 to 1. Default value is 1.
  3643. @item enhance
  3644. Set the dialogue enhance factor to put in front center channel output.
  3645. Allowed range is from 0 to 3. Default value is 1.
  3646. @item voice
  3647. Set the voice detection factor.
  3648. Allowed range is from 2 to 32. Default value is 2.
  3649. @end table
  3650. @subsection Commands
  3651. This filter supports the all above options as @ref{commands}.
  3652. @section drmeter
  3653. Measure audio dynamic range.
  3654. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3655. is found in transition material. And anything less that 8 have very poor dynamics
  3656. and is very compressed.
  3657. The filter accepts the following options:
  3658. @table @option
  3659. @item length
  3660. Set window length in seconds used to split audio into segments of equal length.
  3661. Default is 3 seconds.
  3662. @end table
  3663. @section dynaudnorm
  3664. Dynamic Audio Normalizer.
  3665. This filter applies a certain amount of gain to the input audio in order
  3666. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3667. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3668. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3669. This allows for applying extra gain to the "quiet" sections of the audio
  3670. while avoiding distortions or clipping the "loud" sections. In other words:
  3671. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3672. sections, in the sense that the volume of each section is brought to the
  3673. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3674. this goal *without* applying "dynamic range compressing". It will retain 100%
  3675. of the dynamic range *within* each section of the audio file.
  3676. @table @option
  3677. @item framelen, f
  3678. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3679. Default is 500 milliseconds.
  3680. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3681. referred to as frames. This is required, because a peak magnitude has no
  3682. meaning for just a single sample value. Instead, we need to determine the
  3683. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3684. normalizer would simply use the peak magnitude of the complete file, the
  3685. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3686. frame. The length of a frame is specified in milliseconds. By default, the
  3687. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3688. been found to give good results with most files.
  3689. Note that the exact frame length, in number of samples, will be determined
  3690. automatically, based on the sampling rate of the individual input audio file.
  3691. @item gausssize, g
  3692. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3693. number. Default is 31.
  3694. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3695. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3696. is specified in frames, centered around the current frame. For the sake of
  3697. simplicity, this must be an odd number. Consequently, the default value of 31
  3698. takes into account the current frame, as well as the 15 preceding frames and
  3699. the 15 subsequent frames. Using a larger window results in a stronger
  3700. smoothing effect and thus in less gain variation, i.e. slower gain
  3701. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3702. effect and thus in more gain variation, i.e. faster gain adaptation.
  3703. In other words, the more you increase this value, the more the Dynamic Audio
  3704. Normalizer will behave like a "traditional" normalization filter. On the
  3705. contrary, the more you decrease this value, the more the Dynamic Audio
  3706. Normalizer will behave like a dynamic range compressor.
  3707. @item peak, p
  3708. Set the target peak value. This specifies the highest permissible magnitude
  3709. level for the normalized audio input. This filter will try to approach the
  3710. target peak magnitude as closely as possible, but at the same time it also
  3711. makes sure that the normalized signal will never exceed the peak magnitude.
  3712. A frame's maximum local gain factor is imposed directly by the target peak
  3713. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3714. It is not recommended to go above this value.
  3715. @item maxgain, m
  3716. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3717. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3718. factor for each input frame, i.e. the maximum gain factor that does not
  3719. result in clipping or distortion. The maximum gain factor is determined by
  3720. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3721. additionally bounds the frame's maximum gain factor by a predetermined
  3722. (global) maximum gain factor. This is done in order to avoid excessive gain
  3723. factors in "silent" or almost silent frames. By default, the maximum gain
  3724. factor is 10.0, For most inputs the default value should be sufficient and
  3725. it usually is not recommended to increase this value. Though, for input
  3726. with an extremely low overall volume level, it may be necessary to allow even
  3727. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3728. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3729. Instead, a "sigmoid" threshold function will be applied. This way, the
  3730. gain factors will smoothly approach the threshold value, but never exceed that
  3731. value.
  3732. @item targetrms, r
  3733. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3734. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3735. This means that the maximum local gain factor for each frame is defined
  3736. (only) by the frame's highest magnitude sample. This way, the samples can
  3737. be amplified as much as possible without exceeding the maximum signal
  3738. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3739. Normalizer can also take into account the frame's root mean square,
  3740. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3741. determine the power of a time-varying signal. It is therefore considered
  3742. that the RMS is a better approximation of the "perceived loudness" than
  3743. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3744. frames to a constant RMS value, a uniform "perceived loudness" can be
  3745. established. If a target RMS value has been specified, a frame's local gain
  3746. factor is defined as the factor that would result in exactly that RMS value.
  3747. Note, however, that the maximum local gain factor is still restricted by the
  3748. frame's highest magnitude sample, in order to prevent clipping.
  3749. @item coupling, n
  3750. Enable channels coupling. By default is enabled.
  3751. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3752. amount. This means the same gain factor will be applied to all channels, i.e.
  3753. the maximum possible gain factor is determined by the "loudest" channel.
  3754. However, in some recordings, it may happen that the volume of the different
  3755. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3756. In this case, this option can be used to disable the channel coupling. This way,
  3757. the gain factor will be determined independently for each channel, depending
  3758. only on the individual channel's highest magnitude sample. This allows for
  3759. harmonizing the volume of the different channels.
  3760. @item correctdc, c
  3761. Enable DC bias correction. By default is disabled.
  3762. An audio signal (in the time domain) is a sequence of sample values.
  3763. In the Dynamic Audio Normalizer these sample values are represented in the
  3764. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3765. audio signal, or "waveform", should be centered around the zero point.
  3766. That means if we calculate the mean value of all samples in a file, or in a
  3767. single frame, then the result should be 0.0 or at least very close to that
  3768. value. If, however, there is a significant deviation of the mean value from
  3769. 0.0, in either positive or negative direction, this is referred to as a
  3770. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3771. Audio Normalizer provides optional DC bias correction.
  3772. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3773. the mean value, or "DC correction" offset, of each input frame and subtract
  3774. that value from all of the frame's sample values which ensures those samples
  3775. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3776. boundaries, the DC correction offset values will be interpolated smoothly
  3777. between neighbouring frames.
  3778. @item altboundary, b
  3779. Enable alternative boundary mode. By default is disabled.
  3780. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3781. around each frame. This includes the preceding frames as well as the
  3782. subsequent frames. However, for the "boundary" frames, located at the very
  3783. beginning and at the very end of the audio file, not all neighbouring
  3784. frames are available. In particular, for the first few frames in the audio
  3785. file, the preceding frames are not known. And, similarly, for the last few
  3786. frames in the audio file, the subsequent frames are not known. Thus, the
  3787. question arises which gain factors should be assumed for the missing frames
  3788. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3789. to deal with this situation. The default boundary mode assumes a gain factor
  3790. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3791. "fade out" at the beginning and at the end of the input, respectively.
  3792. @item compress, s
  3793. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3794. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3795. compression. This means that signal peaks will not be pruned and thus the
  3796. full dynamic range will be retained within each local neighbourhood. However,
  3797. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3798. normalization algorithm with a more "traditional" compression.
  3799. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3800. (thresholding) function. If (and only if) the compression feature is enabled,
  3801. all input frames will be processed by a soft knee thresholding function prior
  3802. to the actual normalization process. Put simply, the thresholding function is
  3803. going to prune all samples whose magnitude exceeds a certain threshold value.
  3804. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3805. value. Instead, the threshold value will be adjusted for each individual
  3806. frame.
  3807. In general, smaller parameters result in stronger compression, and vice versa.
  3808. Values below 3.0 are not recommended, because audible distortion may appear.
  3809. @item threshold, t
  3810. Set the target threshold value. This specifies the lowest permissible
  3811. magnitude level for the audio input which will be normalized.
  3812. If input frame volume is above this value frame will be normalized.
  3813. Otherwise frame may not be normalized at all. The default value is set
  3814. to 0, which means all input frames will be normalized.
  3815. This option is mostly useful if digital noise is not wanted to be amplified.
  3816. @item channels, h
  3817. Specify which channels to filter, by default all available channels are filtered.
  3818. @item overlap, o
  3819. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3820. Using >0 and <1 values will make less conservative gain adjustments, like
  3821. when framelen option is set to smaller value, if framelen option value is
  3822. compensated for non-zero overlap then gain adjustments will be smoother across time
  3823. compared to zero overlap case.
  3824. @item curve, v
  3825. Specify the peak mapping curve expression which is going to be used when calculating
  3826. gain applied to frames. The max output frame gain will still be limited by other
  3827. options mentioned previously for this filter.
  3828. The expression can contain the following constants:
  3829. @table @option
  3830. @item ch
  3831. current channel number
  3832. @item sn
  3833. current sample number
  3834. @item nb_channels
  3835. number of channels
  3836. @item t
  3837. timestamp expressed in seconds
  3838. @item sr
  3839. sample rate
  3840. @item p
  3841. current frame peak value
  3842. @end table
  3843. @end table
  3844. @subsection Commands
  3845. This filter supports the all above options as @ref{commands}.
  3846. @section earwax
  3847. Make audio easier to listen to on headphones.
  3848. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3849. so that when listened to on headphones the stereo image is moved from
  3850. inside your head (standard for headphones) to outside and in front of
  3851. the listener (standard for speakers).
  3852. Ported from SoX.
  3853. @section equalizer
  3854. Apply a two-pole peaking equalisation (EQ) filter. With this
  3855. filter, the signal-level at and around a selected frequency can
  3856. be increased or decreased, whilst (unlike bandpass and bandreject
  3857. filters) that at all other frequencies is unchanged.
  3858. In order to produce complex equalisation curves, this filter can
  3859. be given several times, each with a different central frequency.
  3860. The filter accepts the following options:
  3861. @table @option
  3862. @item frequency, f
  3863. Set the filter's central frequency in Hz.
  3864. @item width_type, t
  3865. Set method to specify band-width of filter.
  3866. @table @option
  3867. @item h
  3868. Hz
  3869. @item q
  3870. Q-Factor
  3871. @item o
  3872. octave
  3873. @item s
  3874. slope
  3875. @item k
  3876. kHz
  3877. @end table
  3878. @item width, w
  3879. Specify the band-width of a filter in width_type units.
  3880. @item gain, g
  3881. Set the required gain or attenuation in dB.
  3882. Beware of clipping when using a positive gain.
  3883. @item mix, m
  3884. How much to use filtered signal in output. Default is 1.
  3885. Range is between 0 and 1.
  3886. @item channels, c
  3887. Specify which channels to filter, by default all available are filtered.
  3888. @item normalize, n
  3889. Normalize biquad coefficients, by default is disabled.
  3890. Enabling it will normalize magnitude response at DC to 0dB.
  3891. @item transform, a
  3892. Set transform type of IIR filter.
  3893. @table @option
  3894. @item di
  3895. @item dii
  3896. @item tdi
  3897. @item tdii
  3898. @item latt
  3899. @item svf
  3900. @item zdf
  3901. @end table
  3902. @item precision, r
  3903. Set precision of filtering.
  3904. @table @option
  3905. @item auto
  3906. Pick automatic sample format depending on surround filters.
  3907. @item s16
  3908. Always use signed 16-bit.
  3909. @item s32
  3910. Always use signed 32-bit.
  3911. @item f32
  3912. Always use float 32-bit.
  3913. @item f64
  3914. Always use float 64-bit.
  3915. @end table
  3916. @item block_size, b
  3917. Set block size used for reverse IIR processing. If this value is set to high enough
  3918. value (higher than impulse response length truncated when reaches near zero values) filtering
  3919. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3920. Note that filter delay will be exactly this many samples when set to non-zero value.
  3921. @end table
  3922. @subsection Examples
  3923. @itemize
  3924. @item
  3925. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3926. @example
  3927. equalizer=f=1000:t=h:width=200:g=-10
  3928. @end example
  3929. @item
  3930. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3931. @example
  3932. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3933. @end example
  3934. @end itemize
  3935. @subsection Commands
  3936. This filter supports the following commands:
  3937. @table @option
  3938. @item frequency, f
  3939. Change equalizer frequency.
  3940. Syntax for the command is : "@var{frequency}"
  3941. @item width_type, t
  3942. Change equalizer width_type.
  3943. Syntax for the command is : "@var{width_type}"
  3944. @item width, w
  3945. Change equalizer width.
  3946. Syntax for the command is : "@var{width}"
  3947. @item gain, g
  3948. Change equalizer gain.
  3949. Syntax for the command is : "@var{gain}"
  3950. @item mix, m
  3951. Change equalizer mix.
  3952. Syntax for the command is : "@var{mix}"
  3953. @end table
  3954. @section extrastereo
  3955. Linearly increases the difference between left and right channels which
  3956. adds some sort of "live" effect to playback.
  3957. The filter accepts the following options:
  3958. @table @option
  3959. @item m
  3960. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3961. (average of both channels), with 1.0 sound will be unchanged, with
  3962. -1.0 left and right channels will be swapped.
  3963. @item c
  3964. Enable clipping. By default is enabled.
  3965. @end table
  3966. @subsection Commands
  3967. This filter supports the all above options as @ref{commands}.
  3968. @section firequalizer
  3969. Apply FIR Equalization using arbitrary frequency response.
  3970. The filter accepts the following option:
  3971. @table @option
  3972. @item gain
  3973. Set gain curve equation (in dB). The expression can contain variables:
  3974. @table @option
  3975. @item f
  3976. the evaluated frequency
  3977. @item sr
  3978. sample rate
  3979. @item ch
  3980. channel number, set to 0 when multichannels evaluation is disabled
  3981. @item chid
  3982. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3983. multichannels evaluation is disabled
  3984. @item chs
  3985. number of channels
  3986. @item chlayout
  3987. channel_layout, see libavutil/channel_layout.h
  3988. @end table
  3989. and functions:
  3990. @table @option
  3991. @item gain_interpolate(f)
  3992. interpolate gain on frequency f based on gain_entry
  3993. @item cubic_interpolate(f)
  3994. same as gain_interpolate, but smoother
  3995. @end table
  3996. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3997. @item gain_entry
  3998. Set gain entry for gain_interpolate function. The expression can
  3999. contain functions:
  4000. @table @option
  4001. @item entry(f, g)
  4002. store gain entry at frequency f with value g
  4003. @end table
  4004. This option is also available as command.
  4005. @item delay
  4006. Set filter delay in seconds. Higher value means more accurate.
  4007. Default is @code{0.01}.
  4008. @item accuracy
  4009. Set filter accuracy in Hz. Lower value means more accurate.
  4010. Default is @code{5}.
  4011. @item wfunc
  4012. Set window function. Acceptable values are:
  4013. @table @option
  4014. @item rectangular
  4015. rectangular window, useful when gain curve is already smooth
  4016. @item hann
  4017. hann window (default)
  4018. @item hamming
  4019. hamming window
  4020. @item blackman
  4021. blackman window
  4022. @item nuttall3
  4023. 3-terms continuous 1st derivative nuttall window
  4024. @item mnuttall3
  4025. minimum 3-terms discontinuous nuttall window
  4026. @item nuttall
  4027. 4-terms continuous 1st derivative nuttall window
  4028. @item bnuttall
  4029. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  4030. @item bharris
  4031. blackman-harris window
  4032. @item tukey
  4033. tukey window
  4034. @end table
  4035. @item fixed
  4036. If enabled, use fixed number of audio samples. This improves speed when
  4037. filtering with large delay. Default is disabled.
  4038. @item multi
  4039. Enable multichannels evaluation on gain. Default is disabled.
  4040. @item zero_phase
  4041. Enable zero phase mode by subtracting timestamp to compensate delay.
  4042. Default is disabled.
  4043. @item scale
  4044. Set scale used by gain. Acceptable values are:
  4045. @table @option
  4046. @item linlin
  4047. linear frequency, linear gain
  4048. @item linlog
  4049. linear frequency, logarithmic (in dB) gain (default)
  4050. @item loglin
  4051. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  4052. @item loglog
  4053. logarithmic frequency, logarithmic gain
  4054. @end table
  4055. @item dumpfile
  4056. Set file for dumping, suitable for gnuplot.
  4057. @item dumpscale
  4058. Set scale for dumpfile. Acceptable values are same with scale option.
  4059. Default is linlog.
  4060. @item fft2
  4061. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  4062. Default is disabled.
  4063. @item min_phase
  4064. Enable minimum phase impulse response. Default is disabled.
  4065. @end table
  4066. @subsection Examples
  4067. @itemize
  4068. @item
  4069. lowpass at 1000 Hz:
  4070. @example
  4071. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  4072. @end example
  4073. @item
  4074. lowpass at 1000 Hz with gain_entry:
  4075. @example
  4076. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  4077. @end example
  4078. @item
  4079. custom equalization:
  4080. @example
  4081. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  4082. @end example
  4083. @item
  4084. higher delay with zero phase to compensate delay:
  4085. @example
  4086. firequalizer=delay=0.1:fixed=on:zero_phase=on
  4087. @end example
  4088. @item
  4089. lowpass on left channel, highpass on right channel:
  4090. @example
  4091. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  4092. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  4093. @end example
  4094. @end itemize
  4095. @section flanger
  4096. Apply a flanging effect to the audio.
  4097. The filter accepts the following options:
  4098. @table @option
  4099. @item delay
  4100. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  4101. @item depth
  4102. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  4103. @item regen
  4104. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  4105. Default value is 0.
  4106. @item width
  4107. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  4108. Default value is 71.
  4109. @item speed
  4110. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  4111. @item shape
  4112. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  4113. Default value is @var{sinusoidal}.
  4114. @item phase
  4115. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  4116. Default value is 25.
  4117. @item interp
  4118. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  4119. Default is @var{linear}.
  4120. @end table
  4121. @section haas
  4122. Apply Haas effect to audio.
  4123. Note that this makes most sense to apply on mono signals.
  4124. With this filter applied to mono signals it give some directionality and
  4125. stretches its stereo image.
  4126. The filter accepts the following options:
  4127. @table @option
  4128. @item level_in
  4129. Set input level. By default is @var{1}, or 0dB
  4130. @item level_out
  4131. Set output level. By default is @var{1}, or 0dB.
  4132. @item side_gain
  4133. Set gain applied to side part of signal. By default is @var{1}.
  4134. @item middle_source
  4135. Set kind of middle source. Can be one of the following:
  4136. @table @samp
  4137. @item left
  4138. Pick left channel.
  4139. @item right
  4140. Pick right channel.
  4141. @item mid
  4142. Pick middle part signal of stereo image.
  4143. @item side
  4144. Pick side part signal of stereo image.
  4145. @end table
  4146. @item middle_phase
  4147. Change middle phase. By default is disabled.
  4148. @item left_delay
  4149. Set left channel delay. By default is @var{2.05} milliseconds.
  4150. @item left_balance
  4151. Set left channel balance. By default is @var{-1}.
  4152. @item left_gain
  4153. Set left channel gain. By default is @var{1}.
  4154. @item left_phase
  4155. Change left phase. By default is disabled.
  4156. @item right_delay
  4157. Set right channel delay. By defaults is @var{2.12} milliseconds.
  4158. @item right_balance
  4159. Set right channel balance. By default is @var{1}.
  4160. @item right_gain
  4161. Set right channel gain. By default is @var{1}.
  4162. @item right_phase
  4163. Change right phase. By default is enabled.
  4164. @end table
  4165. @section hdcd
  4166. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  4167. embedded HDCD codes is expanded into a 20-bit PCM stream.
  4168. The filter supports the Peak Extend and Low-level Gain Adjustment features
  4169. of HDCD, and detects the Transient Filter flag.
  4170. @example
  4171. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  4172. @end example
  4173. When using the filter with wav, note the default encoding for wav is 16-bit,
  4174. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  4175. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  4176. @example
  4177. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  4178. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  4179. @end example
  4180. The filter accepts the following options:
  4181. @table @option
  4182. @item disable_autoconvert
  4183. Disable any automatic format conversion or resampling in the filter graph.
  4184. @item process_stereo
  4185. Process the stereo channels together. If target_gain does not match between
  4186. channels, consider it invalid and use the last valid target_gain.
  4187. @item cdt_ms
  4188. Set the code detect timer period in ms.
  4189. @item force_pe
  4190. Always extend peaks above -3dBFS even if PE isn't signaled.
  4191. @item analyze_mode
  4192. Replace audio with a solid tone and adjust the amplitude to signal some
  4193. specific aspect of the decoding process. The output file can be loaded in
  4194. an audio editor alongside the original to aid analysis.
  4195. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  4196. Modes are:
  4197. @table @samp
  4198. @item 0, off
  4199. Disabled
  4200. @item 1, lle
  4201. Gain adjustment level at each sample
  4202. @item 2, pe
  4203. Samples where peak extend occurs
  4204. @item 3, cdt
  4205. Samples where the code detect timer is active
  4206. @item 4, tgm
  4207. Samples where the target gain does not match between channels
  4208. @end table
  4209. @end table
  4210. @section headphone
  4211. Apply head-related transfer functions (HRTFs) to create virtual
  4212. loudspeakers around the user for binaural listening via headphones.
  4213. The HRIRs are provided via additional streams, for each channel
  4214. one stereo input stream is needed.
  4215. The filter accepts the following options:
  4216. @table @option
  4217. @item map
  4218. Set mapping of input streams for convolution.
  4219. The argument is a '|'-separated list of channel names in order as they
  4220. are given as additional stream inputs for filter.
  4221. This also specify number of input streams. Number of input streams
  4222. must be not less than number of channels in first stream plus one.
  4223. @item gain
  4224. Set gain applied to audio. Value is in dB. Default is 0.
  4225. @item type
  4226. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4227. processing audio in time domain which is slow.
  4228. @var{freq} is processing audio in frequency domain which is fast.
  4229. Default is @var{freq}.
  4230. @item lfe
  4231. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4232. @item size
  4233. Set size of frame in number of samples which will be processed at once.
  4234. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  4235. @item hrir
  4236. Set format of hrir stream.
  4237. Default value is @var{stereo}. Alternative value is @var{multich}.
  4238. If value is set to @var{stereo}, number of additional streams should
  4239. be greater or equal to number of input channels in first input stream.
  4240. Also each additional stream should have stereo number of channels.
  4241. If value is set to @var{multich}, number of additional streams should
  4242. be exactly one. Also number of input channels of additional stream
  4243. should be equal or greater than twice number of channels of first input
  4244. stream.
  4245. @end table
  4246. @subsection Examples
  4247. @itemize
  4248. @item
  4249. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4250. each amovie filter use stereo file with IR coefficients as input.
  4251. The files give coefficients for each position of virtual loudspeaker:
  4252. @example
  4253. ffmpeg -i input.wav
  4254. -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"
  4255. output.wav
  4256. @end example
  4257. @item
  4258. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4259. but now in @var{multich} @var{hrir} format.
  4260. @example
  4261. 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"
  4262. output.wav
  4263. @end example
  4264. @end itemize
  4265. @section highpass
  4266. Apply a high-pass filter with 3dB point frequency.
  4267. The filter can be either single-pole, or double-pole (the default).
  4268. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4269. The filter accepts the following options:
  4270. @table @option
  4271. @item frequency, f
  4272. Set frequency in Hz. Default is 3000.
  4273. @item poles, p
  4274. Set number of poles. Default is 2.
  4275. @item width_type, t
  4276. Set method to specify band-width of filter.
  4277. @table @option
  4278. @item h
  4279. Hz
  4280. @item q
  4281. Q-Factor
  4282. @item o
  4283. octave
  4284. @item s
  4285. slope
  4286. @item k
  4287. kHz
  4288. @end table
  4289. @item width, w
  4290. Specify the band-width of a filter in width_type units.
  4291. Applies only to double-pole filter.
  4292. The default is 0.707q and gives a Butterworth response.
  4293. @item mix, m
  4294. How much to use filtered signal in output. Default is 1.
  4295. Range is between 0 and 1.
  4296. @item channels, c
  4297. Specify which channels to filter, by default all available are filtered.
  4298. @item normalize, n
  4299. Normalize biquad coefficients, by default is disabled.
  4300. Enabling it will normalize magnitude response at DC to 0dB.
  4301. @item transform, a
  4302. Set transform type of IIR filter.
  4303. @table @option
  4304. @item di
  4305. @item dii
  4306. @item tdi
  4307. @item tdii
  4308. @item latt
  4309. @item svf
  4310. @item zdf
  4311. @end table
  4312. @item precision, r
  4313. Set precision of filtering.
  4314. @table @option
  4315. @item auto
  4316. Pick automatic sample format depending on surround filters.
  4317. @item s16
  4318. Always use signed 16-bit.
  4319. @item s32
  4320. Always use signed 32-bit.
  4321. @item f32
  4322. Always use float 32-bit.
  4323. @item f64
  4324. Always use float 64-bit.
  4325. @end table
  4326. @item block_size, b
  4327. Set block size used for reverse IIR processing. If this value is set to high enough
  4328. value (higher than impulse response length truncated when reaches near zero values) filtering
  4329. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4330. Note that filter delay will be exactly this many samples when set to non-zero value.
  4331. @end table
  4332. @subsection Commands
  4333. This filter supports the following commands:
  4334. @table @option
  4335. @item frequency, f
  4336. Change highpass frequency.
  4337. Syntax for the command is : "@var{frequency}"
  4338. @item width_type, t
  4339. Change highpass width_type.
  4340. Syntax for the command is : "@var{width_type}"
  4341. @item width, w
  4342. Change highpass width.
  4343. Syntax for the command is : "@var{width}"
  4344. @item mix, m
  4345. Change highpass mix.
  4346. Syntax for the command is : "@var{mix}"
  4347. @end table
  4348. @section join
  4349. Join multiple input streams into one multi-channel stream.
  4350. It accepts the following parameters:
  4351. @table @option
  4352. @item inputs
  4353. The number of input streams. It defaults to 2.
  4354. @item channel_layout
  4355. The desired output channel layout. It defaults to stereo.
  4356. @item map
  4357. Map channels from inputs to output. The argument is a '|'-separated list of
  4358. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  4359. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  4360. can be either the name of the input channel (e.g. FL for front left) or its
  4361. index in the specified input stream. @var{out_channel} is the name of the output
  4362. channel.
  4363. @end table
  4364. The filter will attempt to guess the mappings when they are not specified
  4365. explicitly. It does so by first trying to find an unused matching input channel
  4366. and if that fails it picks the first unused input channel.
  4367. Join 3 inputs (with properly set channel layouts):
  4368. @example
  4369. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  4370. @end example
  4371. Build a 5.1 output from 6 single-channel streams:
  4372. @example
  4373. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  4374. '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'
  4375. out
  4376. @end example
  4377. @section ladspa
  4378. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  4379. To enable compilation of this filter you need to configure FFmpeg with
  4380. @code{--enable-ladspa}.
  4381. @table @option
  4382. @item file, f
  4383. Specifies the name of LADSPA plugin library to load. If the environment
  4384. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  4385. each one of the directories specified by the colon separated list in
  4386. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  4387. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  4388. @file{/usr/lib/ladspa/}.
  4389. @item plugin, p
  4390. Specifies the plugin within the library. Some libraries contain only
  4391. one plugin, but others contain many of them. If this is not set filter
  4392. will list all available plugins within the specified library.
  4393. @item controls, c
  4394. Set the '|' separated list of controls which are zero or more floating point
  4395. values that determine the behavior of the loaded plugin (for example delay,
  4396. threshold or gain).
  4397. Controls need to be defined using the following syntax:
  4398. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  4399. @var{valuei} is the value set on the @var{i}-th control.
  4400. Alternatively they can be also defined using the following syntax:
  4401. @var{value0}|@var{value1}|@var{value2}|..., where
  4402. @var{valuei} is the value set on the @var{i}-th control.
  4403. If @option{controls} is set to @code{help}, all available controls and
  4404. their valid ranges are printed.
  4405. @item sample_rate, s
  4406. Specify the sample rate, default to 44100. Only used if plugin have
  4407. zero inputs.
  4408. @item nb_samples, n
  4409. Set the number of samples per channel per each output frame, default
  4410. is 1024. Only used if plugin have zero inputs.
  4411. @item duration, d
  4412. Set the minimum duration of the sourced audio. See
  4413. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4414. for the accepted syntax.
  4415. Note that the resulting duration may be greater than the specified duration,
  4416. as the generated audio is always cut at the end of a complete frame.
  4417. If not specified, or the expressed duration is negative, the audio is
  4418. supposed to be generated forever.
  4419. Only used if plugin have zero inputs.
  4420. @item latency, l
  4421. Enable latency compensation, by default is disabled.
  4422. Only used if plugin have inputs.
  4423. @end table
  4424. @subsection Examples
  4425. @itemize
  4426. @item
  4427. List all available plugins within amp (LADSPA example plugin) library:
  4428. @example
  4429. ladspa=file=amp
  4430. @end example
  4431. @item
  4432. List all available controls and their valid ranges for @code{vcf_notch}
  4433. plugin from @code{VCF} library:
  4434. @example
  4435. ladspa=f=vcf:p=vcf_notch:c=help
  4436. @end example
  4437. @item
  4438. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4439. plugin library:
  4440. @example
  4441. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4442. @end example
  4443. @item
  4444. Add reverberation to the audio using TAP-plugins
  4445. (Tom's Audio Processing plugins):
  4446. @example
  4447. ladspa=file=tap_reverb:tap_reverb
  4448. @end example
  4449. @item
  4450. Generate white noise, with 0.2 amplitude:
  4451. @example
  4452. ladspa=file=cmt:noise_source_white:c=c0=.2
  4453. @end example
  4454. @item
  4455. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4456. @code{C* Audio Plugin Suite} (CAPS) library:
  4457. @example
  4458. ladspa=file=caps:Click:c=c1=20'
  4459. @end example
  4460. @item
  4461. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4462. @example
  4463. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4464. @end example
  4465. @item
  4466. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4467. @code{SWH Plugins} collection:
  4468. @example
  4469. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4470. @end example
  4471. @item
  4472. Attenuate low frequencies using Multiband EQ from Steve Harris
  4473. @code{SWH Plugins} collection:
  4474. @example
  4475. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4476. @end example
  4477. @item
  4478. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4479. (CAPS) library:
  4480. @example
  4481. ladspa=caps:Narrower
  4482. @end example
  4483. @item
  4484. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4485. @example
  4486. ladspa=caps:White:.2
  4487. @end example
  4488. @item
  4489. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4490. @example
  4491. ladspa=caps:Fractal:c=c1=1
  4492. @end example
  4493. @item
  4494. Dynamic volume normalization using @code{VLevel} plugin:
  4495. @example
  4496. ladspa=vlevel-ladspa:vlevel_mono
  4497. @end example
  4498. @end itemize
  4499. @subsection Commands
  4500. This filter supports the following commands:
  4501. @table @option
  4502. @item cN
  4503. Modify the @var{N}-th control value.
  4504. If the specified value is not valid, it is ignored and prior one is kept.
  4505. @end table
  4506. @section loudnorm
  4507. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4508. Support for both single pass (livestreams, files) and double pass (files) modes.
  4509. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4510. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4511. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4512. The filter accepts the following options:
  4513. @table @option
  4514. @item I, i
  4515. Set integrated loudness target.
  4516. Range is -70.0 - -5.0. Default value is -24.0.
  4517. @item LRA, lra
  4518. Set loudness range target.
  4519. Range is 1.0 - 50.0. Default value is 7.0.
  4520. @item TP, tp
  4521. Set maximum true peak.
  4522. Range is -9.0 - +0.0. Default value is -2.0.
  4523. @item measured_I, measured_i
  4524. Measured IL of input file.
  4525. Range is -99.0 - +0.0.
  4526. @item measured_LRA, measured_lra
  4527. Measured LRA of input file.
  4528. Range is 0.0 - 99.0.
  4529. @item measured_TP, measured_tp
  4530. Measured true peak of input file.
  4531. Range is -99.0 - +99.0.
  4532. @item measured_thresh
  4533. Measured threshold of input file.
  4534. Range is -99.0 - +0.0.
  4535. @item offset
  4536. Set offset gain. Gain is applied before the true-peak limiter.
  4537. Range is -99.0 - +99.0. Default is +0.0.
  4538. @item linear
  4539. Normalize by linearly scaling the source audio.
  4540. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4541. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4542. be lower than source LRA and the change in integrated loudness shouldn't
  4543. result in a true peak which exceeds the target TP. If any of these
  4544. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4545. Options are @code{true} or @code{false}. Default is @code{true}.
  4546. @item dual_mono
  4547. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4548. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4549. If set to @code{true}, this option will compensate for this effect.
  4550. Multi-channel input files are not affected by this option.
  4551. Options are true or false. Default is false.
  4552. @item print_format
  4553. Set print format for stats. Options are summary, json, or none.
  4554. Default value is none.
  4555. @end table
  4556. @section lowpass
  4557. Apply a low-pass filter with 3dB point frequency.
  4558. The filter can be either single-pole or double-pole (the default).
  4559. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4560. The filter accepts the following options:
  4561. @table @option
  4562. @item frequency, f
  4563. Set frequency in Hz. Default is 500.
  4564. @item poles, p
  4565. Set number of poles. Default is 2.
  4566. @item width_type, t
  4567. Set method to specify band-width of filter.
  4568. @table @option
  4569. @item h
  4570. Hz
  4571. @item q
  4572. Q-Factor
  4573. @item o
  4574. octave
  4575. @item s
  4576. slope
  4577. @item k
  4578. kHz
  4579. @end table
  4580. @item width, w
  4581. Specify the band-width of a filter in width_type units.
  4582. Applies only to double-pole filter.
  4583. The default is 0.707q and gives a Butterworth response.
  4584. @item mix, m
  4585. How much to use filtered signal in output. Default is 1.
  4586. Range is between 0 and 1.
  4587. @item channels, c
  4588. Specify which channels to filter, by default all available are filtered.
  4589. @item normalize, n
  4590. Normalize biquad coefficients, by default is disabled.
  4591. Enabling it will normalize magnitude response at DC to 0dB.
  4592. @item transform, a
  4593. Set transform type of IIR filter.
  4594. @table @option
  4595. @item di
  4596. @item dii
  4597. @item tdi
  4598. @item tdii
  4599. @item latt
  4600. @item svf
  4601. @item zdf
  4602. @end table
  4603. @item precision, r
  4604. Set precision of filtering.
  4605. @table @option
  4606. @item auto
  4607. Pick automatic sample format depending on surround filters.
  4608. @item s16
  4609. Always use signed 16-bit.
  4610. @item s32
  4611. Always use signed 32-bit.
  4612. @item f32
  4613. Always use float 32-bit.
  4614. @item f64
  4615. Always use float 64-bit.
  4616. @end table
  4617. @item block_size, b
  4618. Set block size used for reverse IIR processing. If this value is set to high enough
  4619. value (higher than impulse response length truncated when reaches near zero values) filtering
  4620. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4621. Note that filter delay will be exactly this many samples when set to non-zero value.
  4622. @end table
  4623. @subsection Examples
  4624. @itemize
  4625. @item
  4626. Lowpass only LFE channel, it LFE is not present it does nothing:
  4627. @example
  4628. lowpass=c=LFE
  4629. @end example
  4630. @end itemize
  4631. @subsection Commands
  4632. This filter supports the following commands:
  4633. @table @option
  4634. @item frequency, f
  4635. Change lowpass frequency.
  4636. Syntax for the command is : "@var{frequency}"
  4637. @item width_type, t
  4638. Change lowpass width_type.
  4639. Syntax for the command is : "@var{width_type}"
  4640. @item width, w
  4641. Change lowpass width.
  4642. Syntax for the command is : "@var{width}"
  4643. @item mix, m
  4644. Change lowpass mix.
  4645. Syntax for the command is : "@var{mix}"
  4646. @end table
  4647. @section lv2
  4648. Load a LV2 (LADSPA Version 2) plugin.
  4649. To enable compilation of this filter you need to configure FFmpeg with
  4650. @code{--enable-lv2}.
  4651. @table @option
  4652. @item plugin, p
  4653. Specifies the plugin URI. You may need to escape ':'.
  4654. @item controls, c
  4655. Set the '|' separated list of controls which are zero or more floating point
  4656. values that determine the behavior of the loaded plugin (for example delay,
  4657. threshold or gain).
  4658. If @option{controls} is set to @code{help}, all available controls and
  4659. their valid ranges are printed.
  4660. @item sample_rate, s
  4661. Specify the sample rate, default to 44100. Only used if plugin have
  4662. zero inputs.
  4663. @item nb_samples, n
  4664. Set the number of samples per channel per each output frame, default
  4665. is 1024. Only used if plugin have zero inputs.
  4666. @item duration, d
  4667. Set the minimum duration of the sourced audio. See
  4668. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4669. for the accepted syntax.
  4670. Note that the resulting duration may be greater than the specified duration,
  4671. as the generated audio is always cut at the end of a complete frame.
  4672. If not specified, or the expressed duration is negative, the audio is
  4673. supposed to be generated forever.
  4674. Only used if plugin have zero inputs.
  4675. @end table
  4676. @subsection Examples
  4677. @itemize
  4678. @item
  4679. Apply bass enhancer plugin from Calf:
  4680. @example
  4681. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4682. @end example
  4683. @item
  4684. Apply vinyl plugin from Calf:
  4685. @example
  4686. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4687. @end example
  4688. @item
  4689. Apply bit crusher plugin from ArtyFX:
  4690. @example
  4691. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4692. @end example
  4693. @end itemize
  4694. @subsection Commands
  4695. This filter supports all options that are exported by plugin as commands.
  4696. @section mcompand
  4697. Multiband Compress or expand the audio's dynamic range.
  4698. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4699. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4700. response when absent compander action.
  4701. It accepts the following parameters:
  4702. @table @option
  4703. @item args
  4704. This option syntax is:
  4705. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4706. For explanation of each item refer to compand filter documentation.
  4707. @end table
  4708. @anchor{pan}
  4709. @section pan
  4710. Mix channels with specific gain levels. The filter accepts the output
  4711. channel layout followed by a set of channels definitions.
  4712. This filter is also designed to efficiently remap the channels of an audio
  4713. stream.
  4714. The filter accepts parameters of the form:
  4715. "@var{l}|@var{outdef}|@var{outdef}|..."
  4716. @table @option
  4717. @item l
  4718. output channel layout or number of channels
  4719. @item outdef
  4720. output channel specification, of the form:
  4721. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4722. @item out_name
  4723. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4724. number (c0, c1, etc.)
  4725. @item gain
  4726. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4727. @item in_name
  4728. input channel to use, see out_name for details; it is not possible to mix
  4729. named and numbered input channels
  4730. @end table
  4731. If the `=' in a channel specification is replaced by `<', then the gains for
  4732. that specification will be renormalized so that the total is 1, thus
  4733. avoiding clipping noise.
  4734. @subsection Mixing examples
  4735. For example, if you want to down-mix from stereo to mono, but with a bigger
  4736. factor for the left channel:
  4737. @example
  4738. pan=1c|c0=0.9*c0+0.1*c1
  4739. @end example
  4740. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4741. 7-channels surround:
  4742. @example
  4743. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4744. @end example
  4745. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4746. that should be preferred (see "-ac" option) unless you have very specific
  4747. needs.
  4748. @subsection Remapping examples
  4749. The channel remapping will be effective if, and only if:
  4750. @itemize
  4751. @item gain coefficients are zeroes or ones,
  4752. @item only one input per channel output,
  4753. @end itemize
  4754. If all these conditions are satisfied, the filter will notify the user ("Pure
  4755. channel mapping detected"), and use an optimized and lossless method to do the
  4756. remapping.
  4757. For example, if you have a 5.1 source and want a stereo audio stream by
  4758. dropping the extra channels:
  4759. @example
  4760. pan="stereo| c0=FL | c1=FR"
  4761. @end example
  4762. Given the same source, you can also switch front left and front right channels
  4763. and keep the input channel layout:
  4764. @example
  4765. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4766. @end example
  4767. If the input is a stereo audio stream, you can mute the front left channel (and
  4768. still keep the stereo channel layout) with:
  4769. @example
  4770. pan="stereo|c1=c1"
  4771. @end example
  4772. Still with a stereo audio stream input, you can copy the right channel in both
  4773. front left and right:
  4774. @example
  4775. pan="stereo| c0=FR | c1=FR"
  4776. @end example
  4777. @section replaygain
  4778. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4779. outputs it unchanged.
  4780. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4781. The filter accepts the following exported read-only options:
  4782. @table @option
  4783. @item track_gain
  4784. Exported track gain in dB at end of stream.
  4785. @item track_peak
  4786. Exported track peak at end of stream.
  4787. @end table
  4788. @section resample
  4789. Convert the audio sample format, sample rate and channel layout. It is
  4790. not meant to be used directly.
  4791. @section rubberband
  4792. Apply time-stretching and pitch-shifting with librubberband.
  4793. To enable compilation of this filter, you need to configure FFmpeg with
  4794. @code{--enable-librubberband}.
  4795. The filter accepts the following options:
  4796. @table @option
  4797. @item tempo
  4798. Set tempo scale factor.
  4799. @item pitch
  4800. Set pitch scale factor.
  4801. @item transients
  4802. Set transients detector.
  4803. Possible values are:
  4804. @table @var
  4805. @item crisp
  4806. @item mixed
  4807. @item smooth
  4808. @end table
  4809. @item detector
  4810. Set detector.
  4811. Possible values are:
  4812. @table @var
  4813. @item compound
  4814. @item percussive
  4815. @item soft
  4816. @end table
  4817. @item phase
  4818. Set phase.
  4819. Possible values are:
  4820. @table @var
  4821. @item laminar
  4822. @item independent
  4823. @end table
  4824. @item window
  4825. Set processing window size.
  4826. Possible values are:
  4827. @table @var
  4828. @item standard
  4829. @item short
  4830. @item long
  4831. @end table
  4832. @item smoothing
  4833. Set smoothing.
  4834. Possible values are:
  4835. @table @var
  4836. @item off
  4837. @item on
  4838. @end table
  4839. @item formant
  4840. Enable formant preservation when shift pitching.
  4841. Possible values are:
  4842. @table @var
  4843. @item shifted
  4844. @item preserved
  4845. @end table
  4846. @item pitchq
  4847. Set pitch quality.
  4848. Possible values are:
  4849. @table @var
  4850. @item quality
  4851. @item speed
  4852. @item consistency
  4853. @end table
  4854. @item channels
  4855. Set channels.
  4856. Possible values are:
  4857. @table @var
  4858. @item apart
  4859. @item together
  4860. @end table
  4861. @end table
  4862. @subsection Commands
  4863. This filter supports the following commands:
  4864. @table @option
  4865. @item tempo
  4866. Change filter tempo scale factor.
  4867. Syntax for the command is : "@var{tempo}"
  4868. @item pitch
  4869. Change filter pitch scale factor.
  4870. Syntax for the command is : "@var{pitch}"
  4871. @end table
  4872. @section sidechaincompress
  4873. This filter acts like normal compressor but has the ability to compress
  4874. detected signal using second input signal.
  4875. It needs two input streams and returns one output stream.
  4876. First input stream will be processed depending on second stream signal.
  4877. The filtered signal then can be filtered with other filters in later stages of
  4878. processing. See @ref{pan} and @ref{amerge} filter.
  4879. The filter accepts the following options:
  4880. @table @option
  4881. @item level_in
  4882. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4883. @item mode
  4884. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4885. Default is @code{downward}.
  4886. @item threshold
  4887. If a signal of second stream raises above this level it will affect the gain
  4888. reduction of first stream.
  4889. By default is 0.125. Range is between 0.00097563 and 1.
  4890. @item ratio
  4891. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4892. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4893. Default is 2. Range is between 1 and 20.
  4894. @item attack
  4895. Amount of milliseconds the signal has to rise above the threshold before gain
  4896. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4897. @item release
  4898. Amount of milliseconds the signal has to fall below the threshold before
  4899. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4900. @item makeup
  4901. Set the amount by how much signal will be amplified after processing.
  4902. Default is 1. Range is from 1 to 64.
  4903. @item knee
  4904. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4905. Default is 2.82843. Range is between 1 and 8.
  4906. @item link
  4907. Choose if the @code{average} level between all channels of side-chain stream
  4908. or the louder(@code{maximum}) channel of side-chain stream affects the
  4909. reduction. Default is @code{average}.
  4910. @item detection
  4911. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4912. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4913. @item level_sc
  4914. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4915. @item mix
  4916. How much to use compressed signal in output. Default is 1.
  4917. Range is between 0 and 1.
  4918. @end table
  4919. @subsection Commands
  4920. This filter supports the all above options as @ref{commands}.
  4921. @subsection Examples
  4922. @itemize
  4923. @item
  4924. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4925. depending on the signal of 2nd input and later compressed signal to be
  4926. merged with 2nd input:
  4927. @example
  4928. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4929. @end example
  4930. @end itemize
  4931. @section sidechaingate
  4932. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4933. filter the detected signal before sending it to the gain reduction stage.
  4934. Normally a gate uses the full range signal to detect a level above the
  4935. threshold.
  4936. For example: If you cut all lower frequencies from your sidechain signal
  4937. the gate will decrease the volume of your track only if not enough highs
  4938. appear. With this technique you are able to reduce the resonation of a
  4939. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4940. guitar.
  4941. It needs two input streams and returns one output stream.
  4942. First input stream will be processed depending on second stream signal.
  4943. The filter accepts the following options:
  4944. @table @option
  4945. @item level_in
  4946. Set input level before filtering.
  4947. Default is 1. Allowed range is from 0.015625 to 64.
  4948. @item mode
  4949. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4950. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4951. will be amplified, expanding dynamic range in upward direction.
  4952. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4953. @item range
  4954. Set the level of gain reduction when the signal is below the threshold.
  4955. Default is 0.06125. Allowed range is from 0 to 1.
  4956. Setting this to 0 disables reduction and then filter behaves like expander.
  4957. @item threshold
  4958. If a signal rises above this level the gain reduction is released.
  4959. Default is 0.125. Allowed range is from 0 to 1.
  4960. @item ratio
  4961. Set a ratio about which the signal is reduced.
  4962. Default is 2. Allowed range is from 1 to 9000.
  4963. @item attack
  4964. Amount of milliseconds the signal has to rise above the threshold before gain
  4965. reduction stops.
  4966. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4967. @item release
  4968. Amount of milliseconds the signal has to fall below the threshold before the
  4969. reduction is increased again. Default is 250 milliseconds.
  4970. Allowed range is from 0.01 to 9000.
  4971. @item makeup
  4972. Set amount of amplification of signal after processing.
  4973. Default is 1. Allowed range is from 1 to 64.
  4974. @item knee
  4975. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4976. Default is 2.828427125. Allowed range is from 1 to 8.
  4977. @item detection
  4978. Choose if exact signal should be taken for detection or an RMS like one.
  4979. Default is rms. Can be peak or rms.
  4980. @item link
  4981. Choose if the average level between all channels or the louder channel affects
  4982. the reduction.
  4983. Default is average. Can be average or maximum.
  4984. @item level_sc
  4985. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4986. @end table
  4987. @subsection Commands
  4988. This filter supports the all above options as @ref{commands}.
  4989. @section silencedetect
  4990. Detect silence in an audio stream.
  4991. This filter logs a message when it detects that the input audio volume is less
  4992. or equal to a noise tolerance value for a duration greater or equal to the
  4993. minimum detected noise duration.
  4994. The printed times and duration are expressed in seconds. The
  4995. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4996. is set on the first frame whose timestamp equals or exceeds the detection
  4997. duration and it contains the timestamp of the first frame of the silence.
  4998. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4999. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  5000. keys are set on the first frame after the silence. If @option{mono} is
  5001. enabled, and each channel is evaluated separately, the @code{.X}
  5002. suffixed keys are used, and @code{X} corresponds to the channel number.
  5003. The filter accepts the following options:
  5004. @table @option
  5005. @item noise, n
  5006. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  5007. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  5008. @item duration, d
  5009. Set silence duration until notification (default is 2 seconds). See
  5010. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5011. for the accepted syntax.
  5012. @item mono, m
  5013. Process each channel separately, instead of combined. By default is disabled.
  5014. @end table
  5015. @subsection Examples
  5016. @itemize
  5017. @item
  5018. Detect 5 seconds of silence with -50dB noise tolerance:
  5019. @example
  5020. silencedetect=n=-50dB:d=5
  5021. @end example
  5022. @item
  5023. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  5024. tolerance in @file{silence.mp3}:
  5025. @example
  5026. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  5027. @end example
  5028. @end itemize
  5029. @section silenceremove
  5030. Remove silence from the beginning, middle or end of the audio.
  5031. The filter accepts the following options:
  5032. @table @option
  5033. @item start_periods
  5034. This value is used to indicate if audio should be trimmed at beginning of
  5035. the audio. A value of zero indicates no silence should be trimmed from the
  5036. beginning. When specifying a non-zero value, it trims audio up until it
  5037. finds non-silence. Normally, when trimming silence from beginning of audio
  5038. the @var{start_periods} will be @code{1} but it can be increased to higher
  5039. values to trim all audio up to specific count of non-silence periods.
  5040. Default value is @code{0}.
  5041. @item start_duration
  5042. Specify the amount of time that non-silence must be detected before it stops
  5043. trimming audio. By increasing the duration, bursts of noises can be treated
  5044. as silence and trimmed off. Default value is @code{0}.
  5045. @item start_threshold
  5046. This indicates what sample value should be treated as silence. For digital
  5047. audio, a value of @code{0} may be fine but for audio recorded from analog,
  5048. you may wish to increase the value to account for background noise.
  5049. Can be specified in dB (in case "dB" is appended to the specified value)
  5050. or amplitude ratio. Default value is @code{0}.
  5051. @item start_silence
  5052. Specify max duration of silence at beginning that will be kept after
  5053. trimming. Default is 0, which is equal to trimming all samples detected
  5054. as silence.
  5055. @item start_mode
  5056. Specify mode of detection of silence end at start of multi-channel audio.
  5057. Can be @var{any} or @var{all}. Default is @var{any}.
  5058. With @var{any}, any sample from any channel that is detected as non-silence
  5059. will trigger end of silence trimming at start of audio stream.
  5060. With @var{all}, only if every sample from every channel is detected as non-silence
  5061. will trigger end of silence trimming at start of audio stream, limited usage.
  5062. @item stop_periods
  5063. Set the count for trimming silence from the end of audio. When specifying a
  5064. positive value, it trims audio after it finds specified silence period.
  5065. To remove silence from the middle of a file, specify a @var{stop_periods}
  5066. that is negative. This value is then treated as a positive value and is
  5067. used to indicate the effect should restart processing as specified by
  5068. @var{stop_periods}, making it suitable for removing periods of silence
  5069. in the middle of the audio.
  5070. Default value is @code{0}.
  5071. @item stop_duration
  5072. Specify a duration of silence that must exist before audio is not copied any
  5073. more. By specifying a higher duration, silence that is wanted can be left in
  5074. the audio.
  5075. Default value is @code{0}.
  5076. @item stop_threshold
  5077. This is the same as @option{start_threshold} but for trimming silence from
  5078. the end of audio.
  5079. Can be specified in dB (in case "dB" is appended to the specified value)
  5080. or amplitude ratio. Default value is @code{0}.
  5081. @item stop_silence
  5082. Specify max duration of silence at end that will be kept after
  5083. trimming. Default is 0, which is equal to trimming all samples detected
  5084. as silence.
  5085. @item stop_mode
  5086. Specify mode of detection of silence start after start of multi-channel audio.
  5087. Can be @var{any} or @var{all}. Default is @var{all}.
  5088. With @var{any}, any sample from any channel that is detected as silence
  5089. will trigger start of silence trimming after start of audio stream, limited usage.
  5090. With @var{all}, only if every sample from every channel is detected as silence
  5091. will trigger start of silence trimming after start of audio stream.
  5092. @item detection
  5093. Set how is silence detected.
  5094. @table @option
  5095. @item avg
  5096. Mean of absolute values of samples in moving window.
  5097. @item rms
  5098. Root squared mean of absolute values of samples in moving window.
  5099. @item peak
  5100. Maximum of absolute values of samples in moving window.
  5101. @item median
  5102. Median of absolute values of samples in moving window.
  5103. @item ptp
  5104. Absolute of max peak to min peak difference of samples in moving window.
  5105. @item dev
  5106. Standard deviation of values of samples in moving window.
  5107. @end table
  5108. Default value is @code{rms}.
  5109. @item window
  5110. Set duration in number of seconds used to calculate size of window in number
  5111. of samples for detecting silence. Using @code{0} will effectively disable
  5112. any windowing and use only single sample per channel for silence detection.
  5113. In that case it may be needed to also set @option{start_silence} and/or
  5114. @option{stop_silence} to nonzero values with also @option{start_duration} and/or
  5115. @option{stop_duration} to nonzero values.
  5116. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  5117. @item timestamp
  5118. Set processing mode of every audio frame output timestamp.
  5119. @table @option
  5120. @item write
  5121. Full timestamps rewrite, keep only the start time for the first output frame.
  5122. @item copy
  5123. Non-dropped frames are left with same timestamp as input audio frame.
  5124. @end table
  5125. Defaults value is @code{write}.
  5126. @end table
  5127. @subsection Examples
  5128. @itemize
  5129. @item
  5130. The following example shows how this filter can be used to start a recording
  5131. that does not contain the delay at the start which usually occurs between
  5132. pressing the record button and the start of the performance:
  5133. @example
  5134. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  5135. @end example
  5136. @item
  5137. Trim all silence encountered from beginning to end where there is more than 1
  5138. second of silence in audio:
  5139. @example
  5140. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  5141. @end example
  5142. @item
  5143. Trim all digital silence samples, using peak detection, from beginning to end
  5144. where there is more than 0 samples of digital silence in audio and digital
  5145. silence is detected in all channels at same positions in stream:
  5146. @example
  5147. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  5148. @end example
  5149. @item
  5150. Trim every 2nd encountered silence period from beginning to end where there is
  5151. more than 1 second of silence per silence period in audio:
  5152. @example
  5153. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB
  5154. @end example
  5155. @item
  5156. Similar as above, but keep maximum of 0.5 seconds of silence from each trimmed period:
  5157. @example
  5158. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB:stop_silence=0.5
  5159. @end example
  5160. @item
  5161. Similar as above, but keep maximum of 1.5 seconds of silence from start of audio:
  5162. @example
  5163. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB:stop_silence=0.5:start_periods=1:start_duration=1:start_silence=1.5:stop_threshold=-90dB
  5164. @end example
  5165. @end itemize
  5166. @subsection Commands
  5167. This filter supports some above options as @ref{commands}.
  5168. @section sofalizer
  5169. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  5170. loudspeakers around the user for binaural listening via headphones (audio
  5171. formats up to 9 channels supported).
  5172. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  5173. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  5174. Austrian Academy of Sciences.
  5175. To enable compilation of this filter you need to configure FFmpeg with
  5176. @code{--enable-libmysofa}.
  5177. The filter accepts the following options:
  5178. @table @option
  5179. @item sofa
  5180. Set the SOFA file used for rendering.
  5181. @item gain
  5182. Set gain applied to audio. Value is in dB. Default is 0.
  5183. @item rotation
  5184. Set rotation of virtual loudspeakers in deg. Default is 0.
  5185. @item elevation
  5186. Set elevation of virtual speakers in deg. Default is 0.
  5187. @item radius
  5188. Set distance in meters between loudspeakers and the listener with near-field
  5189. HRTFs. Default is 1.
  5190. @item type
  5191. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  5192. processing audio in time domain which is slow.
  5193. @var{freq} is processing audio in frequency domain which is fast.
  5194. Default is @var{freq}.
  5195. @item speakers
  5196. Set custom positions of virtual loudspeakers. Syntax for this option is:
  5197. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  5198. Each virtual loudspeaker is described with short channel name following with
  5199. azimuth and elevation in degrees.
  5200. Each virtual loudspeaker description is separated by '|'.
  5201. For example to override front left and front right channel positions use:
  5202. 'speakers=FL 45 15|FR 345 15'.
  5203. Descriptions with unrecognised channel names are ignored.
  5204. @item lfegain
  5205. Set custom gain for LFE channels. Value is in dB. Default is 0.
  5206. @item framesize
  5207. Set custom frame size in number of samples. Default is 1024.
  5208. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  5209. is set to @var{freq}.
  5210. @item normalize
  5211. Should all IRs be normalized upon importing SOFA file.
  5212. By default is enabled.
  5213. @item interpolate
  5214. Should nearest IRs be interpolated with neighbor IRs if exact position
  5215. does not match. By default is disabled.
  5216. @item minphase
  5217. Minphase all IRs upon loading of SOFA file. By default is disabled.
  5218. @item anglestep
  5219. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  5220. @item radstep
  5221. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  5222. @end table
  5223. @subsection Examples
  5224. @itemize
  5225. @item
  5226. Using ClubFritz6 sofa file:
  5227. @example
  5228. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  5229. @end example
  5230. @item
  5231. Using ClubFritz12 sofa file and bigger radius with small rotation:
  5232. @example
  5233. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  5234. @end example
  5235. @item
  5236. Similar as above but with custom speaker positions for front left, front right, back left and back right
  5237. and also with custom gain:
  5238. @example
  5239. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  5240. @end example
  5241. @end itemize
  5242. @section speechnorm
  5243. Speech Normalizer.
  5244. This filter expands or compresses each half-cycle of audio samples
  5245. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  5246. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  5247. The filter accepts the following options:
  5248. @table @option
  5249. @item peak, p
  5250. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  5251. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  5252. @item expansion, e
  5253. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5254. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  5255. would be such that local peak value reaches target peak value but never to surpass it and that
  5256. ratio between new and previous peak value does not surpass this option value.
  5257. @item compression, c
  5258. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5259. This option controls maximum local half-cycle of samples compression. This option is used
  5260. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  5261. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  5262. that peak's half-cycle will be compressed by current compression factor.
  5263. @item threshold, t
  5264. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  5265. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  5266. Any half-cycle samples with their local peak value below or same as this option value will be
  5267. compressed by current compression factor, otherwise, if greater than threshold value they will be
  5268. expanded with expansion factor so that it could reach peak target value but never surpass it.
  5269. @item raise, r
  5270. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  5271. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  5272. each new half-cycle until it reaches @option{expansion} value.
  5273. Setting this options too high may lead to distortions.
  5274. @item fall, f
  5275. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  5276. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  5277. each new half-cycle until it reaches @option{compression} value.
  5278. @item channels, h
  5279. Specify which channels to filter, by default all available channels are filtered.
  5280. @item invert, i
  5281. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  5282. option. When enabled any half-cycle of samples with their local peak value below or same as
  5283. @option{threshold} option will be expanded otherwise it will be compressed.
  5284. @item link, l
  5285. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  5286. When disabled each filtered channel gain calculation is independent, otherwise when this option
  5287. is enabled the minimum of all possible gains for each filtered channel is used.
  5288. @item rms, m
  5289. Set the expansion target RMS value. This specifies the highest allowed RMS level for the normalized
  5290. audio input. Default value is 0.0, thus disabled. Allowed range is from 0.0 to 1.0.
  5291. @end table
  5292. @subsection Commands
  5293. This filter supports the all above options as @ref{commands}.
  5294. @subsection Examples
  5295. @itemize
  5296. @item
  5297. Weak and slow amplification:
  5298. @example
  5299. speechnorm=e=3:r=0.00001:l=1
  5300. @end example
  5301. @item
  5302. Moderate and slow amplification:
  5303. @example
  5304. speechnorm=e=6.25:r=0.00001:l=1
  5305. @end example
  5306. @item
  5307. Strong and fast amplification:
  5308. @example
  5309. speechnorm=e=12.5:r=0.0001:l=1
  5310. @end example
  5311. @item
  5312. Very strong and fast amplification:
  5313. @example
  5314. speechnorm=e=25:r=0.0001:l=1
  5315. @end example
  5316. @item
  5317. Extreme and fast amplification:
  5318. @example
  5319. speechnorm=e=50:r=0.0001:l=1
  5320. @end example
  5321. @end itemize
  5322. @section stereotools
  5323. This filter has some handy utilities to manage stereo signals, for converting
  5324. M/S stereo recordings to L/R signal while having control over the parameters
  5325. or spreading the stereo image of master track.
  5326. The filter accepts the following options:
  5327. @table @option
  5328. @item level_in
  5329. Set input level before filtering for both channels. Defaults is 1.
  5330. Allowed range is from 0.015625 to 64.
  5331. @item level_out
  5332. Set output level after filtering for both channels. Defaults is 1.
  5333. Allowed range is from 0.015625 to 64.
  5334. @item balance_in
  5335. Set input balance between both channels. Default is 0.
  5336. Allowed range is from -1 to 1.
  5337. @item balance_out
  5338. Set output balance between both channels. Default is 0.
  5339. Allowed range is from -1 to 1.
  5340. @item softclip
  5341. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  5342. clipping. Disabled by default.
  5343. @item mutel
  5344. Mute the left channel. Disabled by default.
  5345. @item muter
  5346. Mute the right channel. Disabled by default.
  5347. @item phasel
  5348. Change the phase of the left channel. Disabled by default.
  5349. @item phaser
  5350. Change the phase of the right channel. Disabled by default.
  5351. @item mode
  5352. Set stereo mode. Available values are:
  5353. @table @samp
  5354. @item lr>lr
  5355. Left/Right to Left/Right, this is default.
  5356. @item lr>ms
  5357. Left/Right to Mid/Side.
  5358. @item ms>lr
  5359. Mid/Side to Left/Right.
  5360. @item lr>ll
  5361. Left/Right to Left/Left.
  5362. @item lr>rr
  5363. Left/Right to Right/Right.
  5364. @item lr>l+r
  5365. Left/Right to Left + Right.
  5366. @item lr>rl
  5367. Left/Right to Right/Left.
  5368. @item ms>ll
  5369. Mid/Side to Left/Left.
  5370. @item ms>rr
  5371. Mid/Side to Right/Right.
  5372. @item ms>rl
  5373. Mid/Side to Right/Left.
  5374. @item lr>l-r
  5375. Left/Right to Left - Right.
  5376. @end table
  5377. @item slev
  5378. Set level of side signal. Default is 1.
  5379. Allowed range is from 0.015625 to 64.
  5380. @item sbal
  5381. Set balance of side signal. Default is 0.
  5382. Allowed range is from -1 to 1.
  5383. @item mlev
  5384. Set level of the middle signal. Default is 1.
  5385. Allowed range is from 0.015625 to 64.
  5386. @item mpan
  5387. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  5388. @item base
  5389. Set stereo base between mono and inversed channels. Default is 0.
  5390. Allowed range is from -1 to 1.
  5391. @item delay
  5392. Set delay in milliseconds how much to delay left from right channel and
  5393. vice versa. Default is 0. Allowed range is from -20 to 20.
  5394. @item sclevel
  5395. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  5396. @item phase
  5397. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  5398. @item bmode_in, bmode_out
  5399. Set balance mode for balance_in/balance_out option.
  5400. Can be one of the following:
  5401. @table @samp
  5402. @item balance
  5403. Classic balance mode. Attenuate one channel at time.
  5404. Gain is raised up to 1.
  5405. @item amplitude
  5406. Similar as classic mode above but gain is raised up to 2.
  5407. @item power
  5408. Equal power distribution, from -6dB to +6dB range.
  5409. @end table
  5410. @end table
  5411. @subsection Commands
  5412. This filter supports the all above options as @ref{commands}.
  5413. @subsection Examples
  5414. @itemize
  5415. @item
  5416. Apply karaoke like effect:
  5417. @example
  5418. stereotools=mlev=0.015625
  5419. @end example
  5420. @item
  5421. Convert M/S signal to L/R:
  5422. @example
  5423. "stereotools=mode=ms>lr"
  5424. @end example
  5425. @end itemize
  5426. @section stereowiden
  5427. This filter enhance the stereo effect by suppressing signal common to both
  5428. channels and by delaying the signal of left into right and vice versa,
  5429. thereby widening the stereo effect.
  5430. The filter accepts the following options:
  5431. @table @option
  5432. @item delay
  5433. Time in milliseconds of the delay of left signal into right and vice versa.
  5434. Default is 20 milliseconds.
  5435. @item feedback
  5436. Amount of gain in delayed signal into right and vice versa. Gives a delay
  5437. effect of left signal in right output and vice versa which gives widening
  5438. effect. Default is 0.3.
  5439. @item crossfeed
  5440. Cross feed of left into right with inverted phase. This helps in suppressing
  5441. the mono. If the value is 1 it will cancel all the signal common to both
  5442. channels. Default is 0.3.
  5443. @item drymix
  5444. Set level of input signal of original channel. Default is 0.8.
  5445. @end table
  5446. @subsection Commands
  5447. This filter supports the all above options except @code{delay} as @ref{commands}.
  5448. @section superequalizer
  5449. Apply 18 band equalizer.
  5450. The filter accepts the following options:
  5451. @table @option
  5452. @item 1b
  5453. Set 65Hz band gain.
  5454. @item 2b
  5455. Set 92Hz band gain.
  5456. @item 3b
  5457. Set 131Hz band gain.
  5458. @item 4b
  5459. Set 185Hz band gain.
  5460. @item 5b
  5461. Set 262Hz band gain.
  5462. @item 6b
  5463. Set 370Hz band gain.
  5464. @item 7b
  5465. Set 523Hz band gain.
  5466. @item 8b
  5467. Set 740Hz band gain.
  5468. @item 9b
  5469. Set 1047Hz band gain.
  5470. @item 10b
  5471. Set 1480Hz band gain.
  5472. @item 11b
  5473. Set 2093Hz band gain.
  5474. @item 12b
  5475. Set 2960Hz band gain.
  5476. @item 13b
  5477. Set 4186Hz band gain.
  5478. @item 14b
  5479. Set 5920Hz band gain.
  5480. @item 15b
  5481. Set 8372Hz band gain.
  5482. @item 16b
  5483. Set 11840Hz band gain.
  5484. @item 17b
  5485. Set 16744Hz band gain.
  5486. @item 18b
  5487. Set 20000Hz band gain.
  5488. @end table
  5489. @section surround
  5490. Apply audio surround upmix filter.
  5491. This filter allows to produce multichannel output from audio stream.
  5492. The filter accepts the following options:
  5493. @table @option
  5494. @item chl_out
  5495. Set output channel layout. By default, this is @var{5.1}.
  5496. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5497. for the required syntax.
  5498. @item chl_in
  5499. Set input channel layout. By default, this is @var{stereo}.
  5500. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5501. for the required syntax.
  5502. @item level_in
  5503. Set input volume level. By default, this is @var{1}.
  5504. @item level_out
  5505. Set output volume level. By default, this is @var{1}.
  5506. @item lfe
  5507. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5508. @item lfe_low
  5509. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5510. @item lfe_high
  5511. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5512. @item lfe_mode
  5513. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5514. In @var{add} mode, LFE channel is created from input audio and added to output.
  5515. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5516. also all non-LFE output channels are subtracted with output LFE channel.
  5517. @item smooth
  5518. Set temporal smoothness strength, used to gradually change factors when transforming
  5519. stereo sound in time. Allowed range is from @var{0.0} to @var{1.0}.
  5520. Useful to improve output quality with @var{focus} option values greater than @var{0.0}.
  5521. Default is @var{0.0}. Only values inside this range and without edges are effective.
  5522. @item angle
  5523. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5524. Default is @var{90}.
  5525. @item focus
  5526. Set focus of stereo surround transform, Allowed range is from @var{-1} to @var{1}.
  5527. Default is @var{0}.
  5528. @item fc_in
  5529. Set front center input volume. By default, this is @var{1}.
  5530. @item fc_out
  5531. Set front center output volume. By default, this is @var{1}.
  5532. @item fl_in
  5533. Set front left input volume. By default, this is @var{1}.
  5534. @item fl_out
  5535. Set front left output volume. By default, this is @var{1}.
  5536. @item fr_in
  5537. Set front right input volume. By default, this is @var{1}.
  5538. @item fr_out
  5539. Set front right output volume. By default, this is @var{1}.
  5540. @item sl_in
  5541. Set side left input volume. By default, this is @var{1}.
  5542. @item sl_out
  5543. Set side left output volume. By default, this is @var{1}.
  5544. @item sr_in
  5545. Set side right input volume. By default, this is @var{1}.
  5546. @item sr_out
  5547. Set side right output volume. By default, this is @var{1}.
  5548. @item bl_in
  5549. Set back left input volume. By default, this is @var{1}.
  5550. @item bl_out
  5551. Set back left output volume. By default, this is @var{1}.
  5552. @item br_in
  5553. Set back right input volume. By default, this is @var{1}.
  5554. @item br_out
  5555. Set back right output volume. By default, this is @var{1}.
  5556. @item bc_in
  5557. Set back center input volume. By default, this is @var{1}.
  5558. @item bc_out
  5559. Set back center output volume. By default, this is @var{1}.
  5560. @item lfe_in
  5561. Set LFE input volume. By default, this is @var{1}.
  5562. @item lfe_out
  5563. Set LFE output volume. By default, this is @var{1}.
  5564. @item allx
  5565. Set spread usage of stereo image across X axis for all channels.
  5566. Allowed range is from @var{-1} to @var{15}.
  5567. By default this value is negative @var{-1}, and thus unused.
  5568. @item ally
  5569. Set spread usage of stereo image across Y axis for all channels.
  5570. Allowed range is from @var{-1} to @var{15}.
  5571. By default this value is negative @var{-1}, and thus unused.
  5572. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5573. Set spread usage of stereo image across X axis for each channel.
  5574. Allowed range is from @var{0.06} to @var{15}.
  5575. By default this value is @var{0.5}.
  5576. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5577. Set spread usage of stereo image across Y axis for each channel.
  5578. Allowed range is from @var{0.06} to @var{15}.
  5579. By default this value is @var{0.5}.
  5580. @item win_size
  5581. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5582. @item win_func
  5583. Set window function.
  5584. It accepts the following values:
  5585. @table @samp
  5586. @item rect
  5587. @item bartlett
  5588. @item hann, hanning
  5589. @item hamming
  5590. @item blackman
  5591. @item welch
  5592. @item flattop
  5593. @item bharris
  5594. @item bnuttall
  5595. @item bhann
  5596. @item sine
  5597. @item nuttall
  5598. @item lanczos
  5599. @item gauss
  5600. @item tukey
  5601. @item dolph
  5602. @item cauchy
  5603. @item parzen
  5604. @item poisson
  5605. @item bohman
  5606. @item kaiser
  5607. @end table
  5608. Default is @code{hann}.
  5609. @item overlap
  5610. Set window overlap. If set to 1, the recommended overlap for selected
  5611. window function will be picked. Default is @code{0.5}.
  5612. @end table
  5613. @section tiltshelf
  5614. Boost or cut the lower frequencies and cut or boost higher frequencies
  5615. of the audio using a two-pole shelving filter with a response similar to
  5616. that of a standard hi-fi's tone-controls.
  5617. This is also known as shelving equalisation (EQ).
  5618. The filter accepts the following options:
  5619. @table @option
  5620. @item gain, g
  5621. Give the gain at 0 Hz. Its useful range is about -20
  5622. (for a large cut) to +20 (for a large boost).
  5623. Beware of clipping when using a positive gain.
  5624. @item frequency, f
  5625. Set the filter's central frequency and so can be used
  5626. to extend or reduce the frequency range to be boosted or cut.
  5627. The default value is @code{3000} Hz.
  5628. @item width_type, t
  5629. Set method to specify band-width of filter.
  5630. @table @option
  5631. @item h
  5632. Hz
  5633. @item q
  5634. Q-Factor
  5635. @item o
  5636. octave
  5637. @item s
  5638. slope
  5639. @item k
  5640. kHz
  5641. @end table
  5642. @item width, w
  5643. Determine how steep is the filter's shelf transition.
  5644. @item poles, p
  5645. Set number of poles. Default is 2.
  5646. @item mix, m
  5647. How much to use filtered signal in output. Default is 1.
  5648. Range is between 0 and 1.
  5649. @item channels, c
  5650. Specify which channels to filter, by default all available are filtered.
  5651. @item normalize, n
  5652. Normalize biquad coefficients, by default is disabled.
  5653. Enabling it will normalize magnitude response at DC to 0dB.
  5654. @item transform, a
  5655. Set transform type of IIR filter.
  5656. @table @option
  5657. @item di
  5658. @item dii
  5659. @item tdi
  5660. @item tdii
  5661. @item latt
  5662. @item svf
  5663. @item zdf
  5664. @end table
  5665. @item precision, r
  5666. Set precision of filtering.
  5667. @table @option
  5668. @item auto
  5669. Pick automatic sample format depending on surround filters.
  5670. @item s16
  5671. Always use signed 16-bit.
  5672. @item s32
  5673. Always use signed 32-bit.
  5674. @item f32
  5675. Always use float 32-bit.
  5676. @item f64
  5677. Always use float 64-bit.
  5678. @end table
  5679. @item block_size, b
  5680. Set block size used for reverse IIR processing. If this value is set to high enough
  5681. value (higher than impulse response length truncated when reaches near zero values) filtering
  5682. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5683. Note that filter delay will be exactly this many samples when set to non-zero value.
  5684. @end table
  5685. @subsection Commands
  5686. This filter supports some options as @ref{commands}.
  5687. @section treble, highshelf
  5688. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5689. shelving filter with a response similar to that of a standard
  5690. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5691. The filter accepts the following options:
  5692. @table @option
  5693. @item gain, g
  5694. Give the gain at whichever is the lower of ~22 kHz and the
  5695. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5696. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5697. @item frequency, f
  5698. Set the filter's central frequency and so can be used
  5699. to extend or reduce the frequency range to be boosted or cut.
  5700. The default value is @code{3000} Hz.
  5701. @item width_type, t
  5702. Set method to specify band-width of filter.
  5703. @table @option
  5704. @item h
  5705. Hz
  5706. @item q
  5707. Q-Factor
  5708. @item o
  5709. octave
  5710. @item s
  5711. slope
  5712. @item k
  5713. kHz
  5714. @end table
  5715. @item width, w
  5716. Determine how steep is the filter's shelf transition.
  5717. @item poles, p
  5718. Set number of poles. Default is 2.
  5719. @item mix, m
  5720. How much to use filtered signal in output. Default is 1.
  5721. Range is between 0 and 1.
  5722. @item channels, c
  5723. Specify which channels to filter, by default all available are filtered.
  5724. @item normalize, n
  5725. Normalize biquad coefficients, by default is disabled.
  5726. Enabling it will normalize magnitude response at DC to 0dB.
  5727. @item transform, a
  5728. Set transform type of IIR filter.
  5729. @table @option
  5730. @item di
  5731. @item dii
  5732. @item tdi
  5733. @item tdii
  5734. @item latt
  5735. @item svf
  5736. @item zdf
  5737. @end table
  5738. @item precision, r
  5739. Set precision of filtering.
  5740. @table @option
  5741. @item auto
  5742. Pick automatic sample format depending on surround filters.
  5743. @item s16
  5744. Always use signed 16-bit.
  5745. @item s32
  5746. Always use signed 32-bit.
  5747. @item f32
  5748. Always use float 32-bit.
  5749. @item f64
  5750. Always use float 64-bit.
  5751. @end table
  5752. @item block_size, b
  5753. Set block size used for reverse IIR processing. If this value is set to high enough
  5754. value (higher than impulse response length truncated when reaches near zero values) filtering
  5755. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5756. Note that filter delay will be exactly this many samples when set to non-zero value.
  5757. @end table
  5758. @subsection Commands
  5759. This filter supports the following commands:
  5760. @table @option
  5761. @item frequency, f
  5762. Change treble frequency.
  5763. Syntax for the command is : "@var{frequency}"
  5764. @item width_type, t
  5765. Change treble width_type.
  5766. Syntax for the command is : "@var{width_type}"
  5767. @item width, w
  5768. Change treble width.
  5769. Syntax for the command is : "@var{width}"
  5770. @item gain, g
  5771. Change treble gain.
  5772. Syntax for the command is : "@var{gain}"
  5773. @item mix, m
  5774. Change treble mix.
  5775. Syntax for the command is : "@var{mix}"
  5776. @end table
  5777. @section tremolo
  5778. Sinusoidal amplitude modulation.
  5779. The filter accepts the following options:
  5780. @table @option
  5781. @item f
  5782. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5783. (20 Hz or lower) will result in a tremolo effect.
  5784. This filter may also be used as a ring modulator by specifying
  5785. a modulation frequency higher than 20 Hz.
  5786. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5787. @item d
  5788. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5789. Default value is 0.5.
  5790. @end table
  5791. @section vibrato
  5792. Sinusoidal phase modulation.
  5793. The filter accepts the following options:
  5794. @table @option
  5795. @item f
  5796. Modulation frequency in Hertz.
  5797. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5798. @item d
  5799. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5800. Default value is 0.5.
  5801. @end table
  5802. @section virtualbass
  5803. Apply audio Virtual Bass filter.
  5804. This filter accepts stereo input and produce stereo with LFE (2.1) channels output.
  5805. The newly produced LFE channel have enhanced virtual bass originally obtained from both stereo channels.
  5806. This filter outputs front left and front right channels unchanged as available in stereo input.
  5807. The filter accepts the following options:
  5808. @table @option
  5809. @item cutoff
  5810. Set the virtual bass cutoff frequency. Default value is 250 Hz.
  5811. Allowed range is from 100 to 500 Hz.
  5812. @item strength
  5813. Set the virtual bass strength. Allowed range is from 0.5 to 3.
  5814. Default value is 3.
  5815. @end table
  5816. @section volume
  5817. Adjust the input audio volume.
  5818. It accepts the following parameters:
  5819. @table @option
  5820. @item volume
  5821. Set audio volume expression.
  5822. Output values are clipped to the maximum value.
  5823. The output audio volume is given by the relation:
  5824. @example
  5825. @var{output_volume} = @var{volume} * @var{input_volume}
  5826. @end example
  5827. The default value for @var{volume} is "1.0".
  5828. @item precision
  5829. This parameter represents the mathematical precision.
  5830. It determines which input sample formats will be allowed, which affects the
  5831. precision of the volume scaling.
  5832. @table @option
  5833. @item fixed
  5834. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5835. @item float
  5836. 32-bit floating-point; this limits input sample format to FLT. (default)
  5837. @item double
  5838. 64-bit floating-point; this limits input sample format to DBL.
  5839. @end table
  5840. @item replaygain
  5841. Choose the behaviour on encountering ReplayGain side data in input frames.
  5842. @table @option
  5843. @item drop
  5844. Remove ReplayGain side data, ignoring its contents (the default).
  5845. @item ignore
  5846. Ignore ReplayGain side data, but leave it in the frame.
  5847. @item track
  5848. Prefer the track gain, if present.
  5849. @item album
  5850. Prefer the album gain, if present.
  5851. @end table
  5852. @item replaygain_preamp
  5853. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5854. Default value for @var{replaygain_preamp} is 0.0.
  5855. @item replaygain_noclip
  5856. Prevent clipping by limiting the gain applied.
  5857. Default value for @var{replaygain_noclip} is 1.
  5858. @item eval
  5859. Set when the volume expression is evaluated.
  5860. It accepts the following values:
  5861. @table @samp
  5862. @item once
  5863. only evaluate expression once during the filter initialization, or
  5864. when the @samp{volume} command is sent
  5865. @item frame
  5866. evaluate expression for each incoming frame
  5867. @end table
  5868. Default value is @samp{once}.
  5869. @end table
  5870. The volume expression can contain the following parameters.
  5871. @table @option
  5872. @item n
  5873. frame number (starting at zero)
  5874. @item nb_channels
  5875. number of channels
  5876. @item nb_consumed_samples
  5877. number of samples consumed by the filter
  5878. @item nb_samples
  5879. number of samples in the current frame
  5880. @item pos
  5881. original frame position in the file; deprecated, do not use
  5882. @item pts
  5883. frame PTS
  5884. @item sample_rate
  5885. sample rate
  5886. @item startpts
  5887. PTS at start of stream
  5888. @item startt
  5889. time at start of stream
  5890. @item t
  5891. frame time
  5892. @item tb
  5893. timestamp timebase
  5894. @item volume
  5895. last set volume value
  5896. @end table
  5897. Note that when @option{eval} is set to @samp{once} only the
  5898. @var{sample_rate} and @var{tb} variables are available, all other
  5899. variables will evaluate to NAN.
  5900. @subsection Commands
  5901. This filter supports the following commands:
  5902. @table @option
  5903. @item volume
  5904. Modify the volume expression.
  5905. The command accepts the same syntax of the corresponding option.
  5906. If the specified expression is not valid, it is kept at its current
  5907. value.
  5908. @end table
  5909. @subsection Examples
  5910. @itemize
  5911. @item
  5912. Halve the input audio volume:
  5913. @example
  5914. volume=volume=0.5
  5915. volume=volume=1/2
  5916. volume=volume=-6.0206dB
  5917. @end example
  5918. In all the above example the named key for @option{volume} can be
  5919. omitted, for example like in:
  5920. @example
  5921. volume=0.5
  5922. @end example
  5923. @item
  5924. Increase input audio power by 6 decibels using fixed-point precision:
  5925. @example
  5926. volume=volume=6dB:precision=fixed
  5927. @end example
  5928. @item
  5929. Fade volume after time 10 with an annihilation period of 5 seconds:
  5930. @example
  5931. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5932. @end example
  5933. @end itemize
  5934. @section volumedetect
  5935. Detect the volume of the input video.
  5936. The filter has no parameters. It supports only 16-bit signed integer samples,
  5937. so the input will be converted when needed. Statistics about the volume will
  5938. be printed in the log when the input stream end is reached.
  5939. In particular it will show the mean volume (root mean square), maximum
  5940. volume (on a per-sample basis), and the beginning of a histogram of the
  5941. registered volume values (from the maximum value to a cumulated 1/1000 of
  5942. the samples).
  5943. All volumes are in decibels relative to the maximum PCM value.
  5944. @subsection Examples
  5945. Here is an excerpt of the output:
  5946. @example
  5947. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5948. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5949. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5950. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5951. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5952. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5953. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5954. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5955. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5956. @end example
  5957. It means that:
  5958. @itemize
  5959. @item
  5960. The mean square energy is approximately -27 dB, or 10^-2.7.
  5961. @item
  5962. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5963. @item
  5964. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5965. @end itemize
  5966. In other words, raising the volume by +4 dB does not cause any clipping,
  5967. raising it by +5 dB causes clipping for 6 samples, etc.
  5968. @c man end AUDIO FILTERS
  5969. @chapter Audio Sources
  5970. @c man begin AUDIO SOURCES
  5971. Below is a description of the currently available audio sources.
  5972. @section abuffer
  5973. Buffer audio frames, and make them available to the filter chain.
  5974. This source is mainly intended for a programmatic use, in particular
  5975. through the interface defined in @file{libavfilter/buffersrc.h}.
  5976. It accepts the following parameters:
  5977. @table @option
  5978. @item time_base
  5979. The timebase which will be used for timestamps of submitted frames. It must be
  5980. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5981. @item sample_rate
  5982. The sample rate of the incoming audio buffers.
  5983. @item sample_fmt
  5984. The sample format of the incoming audio buffers.
  5985. Either a sample format name or its corresponding integer representation from
  5986. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5987. @item channel_layout
  5988. The channel layout of the incoming audio buffers.
  5989. Either a channel layout name from channel_layout_map in
  5990. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5991. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5992. @item channels
  5993. The number of channels of the incoming audio buffers.
  5994. If both @var{channels} and @var{channel_layout} are specified, then they
  5995. must be consistent.
  5996. @end table
  5997. @subsection Examples
  5998. @example
  5999. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  6000. @end example
  6001. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  6002. Since the sample format with name "s16p" corresponds to the number
  6003. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  6004. equivalent to:
  6005. @example
  6006. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  6007. @end example
  6008. @section aevalsrc
  6009. Generate an audio signal specified by an expression.
  6010. This source accepts in input one or more expressions (one for each
  6011. channel), which are evaluated and used to generate a corresponding
  6012. audio signal.
  6013. This source accepts the following options:
  6014. @table @option
  6015. @item exprs
  6016. Set the '|'-separated expressions list for each separate channel. In case the
  6017. @option{channel_layout} option is not specified, the selected channel layout
  6018. depends on the number of provided expressions. Otherwise the last
  6019. specified expression is applied to the remaining output channels.
  6020. @item channel_layout, c
  6021. Set the channel layout. The number of channels in the specified layout
  6022. must be equal to the number of specified expressions.
  6023. @item duration, d
  6024. Set the minimum duration of the sourced audio. See
  6025. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  6026. for the accepted syntax.
  6027. Note that the resulting duration may be greater than the specified
  6028. duration, as the generated audio is always cut at the end of a
  6029. complete frame.
  6030. If not specified, or the expressed duration is negative, the audio is
  6031. supposed to be generated forever.
  6032. @item nb_samples, n
  6033. Set the number of samples per channel per each output frame,
  6034. default to 1024.
  6035. @item sample_rate, s
  6036. Specify the sample rate, default to 44100.
  6037. @end table
  6038. Each expression in @var{exprs} can contain the following constants:
  6039. @table @option
  6040. @item n
  6041. number of the evaluated sample, starting from 0
  6042. @item t
  6043. time of the evaluated sample expressed in seconds, starting from 0
  6044. @item s
  6045. sample rate
  6046. @end table
  6047. @subsection Examples
  6048. @itemize
  6049. @item
  6050. Generate silence:
  6051. @example
  6052. aevalsrc=0
  6053. @end example
  6054. @item
  6055. Generate a sin signal with frequency of 440 Hz, set sample rate to
  6056. 8000 Hz:
  6057. @example
  6058. aevalsrc="sin(440*2*PI*t):s=8000"
  6059. @end example
  6060. @item
  6061. Generate a two channels signal, specify the channel layout (Front
  6062. Center + Back Center) explicitly:
  6063. @example
  6064. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  6065. @end example
  6066. @item
  6067. Generate white noise:
  6068. @example
  6069. aevalsrc="-2+random(0)"
  6070. @end example
  6071. @item
  6072. Generate an amplitude modulated signal:
  6073. @example
  6074. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  6075. @end example
  6076. @item
  6077. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  6078. @example
  6079. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  6080. @end example
  6081. @end itemize
  6082. @section afdelaysrc
  6083. Generate a fractional delay FIR coefficients.
  6084. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6085. The filter accepts the following options:
  6086. @table @option
  6087. @item delay, d
  6088. Set the fractional delay. Default is 0.
  6089. @item sample_rate, r
  6090. Set the sample rate, default is 44100.
  6091. @item nb_samples, n
  6092. Set the number of samples per each frame. Default is 1024.
  6093. @item taps, t
  6094. Set the number of filter coefficients in output audio stream.
  6095. Default value is 0.
  6096. @item channel_layout, c
  6097. Specifies the channel layout, and can be a string representing a channel layout.
  6098. The default value of @var{channel_layout} is "stereo".
  6099. @end table
  6100. @section afireqsrc
  6101. Generate a FIR equalizer coefficients.
  6102. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6103. The filter accepts the following options:
  6104. @table @option
  6105. @item preset, p
  6106. Set equalizer preset.
  6107. Default preset is @code{flat}.
  6108. Available presets are:
  6109. @table @samp
  6110. @item custom
  6111. @item flat
  6112. @item acoustic
  6113. @item bass
  6114. @item beats
  6115. @item classic
  6116. @item clear
  6117. @item deep bass
  6118. @item dubstep
  6119. @item electronic
  6120. @item hard-style
  6121. @item hip-hop
  6122. @item jazz
  6123. @item metal
  6124. @item movie
  6125. @item pop
  6126. @item r&b
  6127. @item rock
  6128. @item vocal booster
  6129. @end table
  6130. @item gains, g
  6131. Set custom gains for each band. Only used if the preset option is set to @code{custom}.
  6132. Gains are separated by white spaces and each gain is set in dBFS.
  6133. Default is @code{0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}.
  6134. @item bands, b
  6135. Set the custom bands from where custon equalizer gains are set.
  6136. This must be in strictly increasing order. Only used if the preset option is set to @code{custom}.
  6137. Bands are separated by white spaces and each band represent frequency in Hz.
  6138. Default is @code{25 40 63 100 160 250 400 630 1000 1600 2500 4000 6300 10000 16000 24000}.
  6139. @item taps, t
  6140. Set number of filter coefficients in output audio stream.
  6141. Default value is @code{4096}.
  6142. @item sample_rate, r
  6143. Set sample rate of output audio stream, default is @code{44100}.
  6144. @item nb_samples, n
  6145. Set number of samples per each frame in output audio stream. Default is @code{1024}.
  6146. @item interp, i
  6147. Set interpolation method for FIR equalizer coefficients. Can be @code{linear} or @code{cubic}.
  6148. @item phase, h
  6149. Set phase type of FIR filter. Can be @code{linear} or @code{min}: minimum-phase.
  6150. Default is minimum-phase filter.
  6151. @end table
  6152. @section afirsrc
  6153. Generate a FIR coefficients using frequency sampling method.
  6154. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6155. The filter accepts the following options:
  6156. @table @option
  6157. @item taps, t
  6158. Set number of filter coefficients in output audio stream.
  6159. Default value is 1025.
  6160. @item frequency, f
  6161. Set frequency points from where magnitude and phase are set.
  6162. This must be in non decreasing order, and first element must be 0, while last element
  6163. must be 1. Elements are separated by white spaces.
  6164. @item magnitude, m
  6165. Set magnitude value for every frequency point set by @option{frequency}.
  6166. Number of values must be same as number of frequency points.
  6167. Values are separated by white spaces.
  6168. @item phase, p
  6169. Set phase value for every frequency point set by @option{frequency}.
  6170. Number of values must be same as number of frequency points.
  6171. Values are separated by white spaces.
  6172. @item sample_rate, r
  6173. Set sample rate, default is 44100.
  6174. @item nb_samples, n
  6175. Set number of samples per each frame. Default is 1024.
  6176. @item win_func, w
  6177. Set window function. Default is blackman.
  6178. @end table
  6179. @section anullsrc
  6180. The null audio source, return unprocessed audio frames. It is mainly useful
  6181. as a template and to be employed in analysis / debugging tools, or as
  6182. the source for filters which ignore the input data (for example the sox
  6183. synth filter).
  6184. This source accepts the following options:
  6185. @table @option
  6186. @item channel_layout, cl
  6187. Specifies the channel layout, and can be either an integer or a string
  6188. representing a channel layout. The default value of @var{channel_layout}
  6189. is "stereo".
  6190. Check the channel_layout_map definition in
  6191. @file{libavutil/channel_layout.c} for the mapping between strings and
  6192. channel layout values.
  6193. @item sample_rate, r
  6194. Specifies the sample rate, and defaults to 44100.
  6195. @item nb_samples, n
  6196. Set the number of samples per requested frames.
  6197. @item duration, d
  6198. Set the duration of the sourced audio. See
  6199. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  6200. for the accepted syntax.
  6201. If not specified, or the expressed duration is negative, the audio is
  6202. supposed to be generated forever.
  6203. @end table
  6204. @subsection Examples
  6205. @itemize
  6206. @item
  6207. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  6208. @example
  6209. anullsrc=r=48000:cl=4
  6210. @end example
  6211. @item
  6212. Do the same operation with a more obvious syntax:
  6213. @example
  6214. anullsrc=r=48000:cl=mono
  6215. @end example
  6216. @end itemize
  6217. All the parameters need to be explicitly defined.
  6218. @section flite
  6219. Synthesize a voice utterance using the libflite library.
  6220. To enable compilation of this filter you need to configure FFmpeg with
  6221. @code{--enable-libflite}.
  6222. Note that versions of the flite library prior to 2.0 are not thread-safe.
  6223. The filter accepts the following options:
  6224. @table @option
  6225. @item list_voices
  6226. If set to 1, list the names of the available voices and exit
  6227. immediately. Default value is 0.
  6228. @item nb_samples, n
  6229. Set the maximum number of samples per frame. Default value is 512.
  6230. @item textfile
  6231. Set the filename containing the text to speak.
  6232. @item text
  6233. Set the text to speak.
  6234. @item voice, v
  6235. Set the voice to use for the speech synthesis. Default value is
  6236. @code{kal}. See also the @var{list_voices} option.
  6237. @end table
  6238. @subsection Examples
  6239. @itemize
  6240. @item
  6241. Read from file @file{speech.txt}, and synthesize the text using the
  6242. standard flite voice:
  6243. @example
  6244. flite=textfile=speech.txt
  6245. @end example
  6246. @item
  6247. Read the specified text selecting the @code{slt} voice:
  6248. @example
  6249. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  6250. @end example
  6251. @item
  6252. Input text to ffmpeg:
  6253. @example
  6254. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  6255. @end example
  6256. @item
  6257. Make @file{ffplay} speak the specified text, using @code{flite} and
  6258. the @code{lavfi} device:
  6259. @example
  6260. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  6261. @end example
  6262. @end itemize
  6263. For more information about libflite, check:
  6264. @url{http://www.festvox.org/flite/}
  6265. @section anoisesrc
  6266. Generate a noise audio signal.
  6267. The filter accepts the following options:
  6268. @table @option
  6269. @item sample_rate, r
  6270. Specify the sample rate. Default value is 48000 Hz.
  6271. @item amplitude, a
  6272. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  6273. is 1.0.
  6274. @item duration, d
  6275. Specify the duration of the generated audio stream. Not specifying this option
  6276. results in noise with an infinite length.
  6277. @item color, colour, c
  6278. Specify the color of noise. Available noise colors are white, pink, brown,
  6279. blue, violet and velvet. Default color is white.
  6280. @item seed, s
  6281. Specify a value used to seed the PRNG.
  6282. @item nb_samples, n
  6283. Set the number of samples per each output frame, default is 1024.
  6284. @item density
  6285. Set the density (0.0 - 1.0) for the velvet noise generator, default is 0.05.
  6286. @end table
  6287. @subsection Examples
  6288. @itemize
  6289. @item
  6290. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  6291. @example
  6292. anoisesrc=d=60:c=pink:r=44100:a=0.5
  6293. @end example
  6294. @end itemize
  6295. @section hilbert
  6296. Generate odd-tap Hilbert transform FIR coefficients.
  6297. The resulting stream can be used with @ref{afir} filter for phase-shifting
  6298. the signal by 90 degrees.
  6299. This is used in many matrix coding schemes and for analytic signal generation.
  6300. The process is often written as a multiplication by i (or j), the imaginary unit.
  6301. The filter accepts the following options:
  6302. @table @option
  6303. @item sample_rate, s
  6304. Set sample rate, default is 44100.
  6305. @item taps, t
  6306. Set length of FIR filter, default is 22051.
  6307. @item nb_samples, n
  6308. Set number of samples per each frame.
  6309. @item win_func, w
  6310. Set window function to be used when generating FIR coefficients.
  6311. @end table
  6312. @section sinc
  6313. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  6314. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6315. The filter accepts the following options:
  6316. @table @option
  6317. @item sample_rate, r
  6318. Set sample rate, default is 44100.
  6319. @item nb_samples, n
  6320. Set number of samples per each frame. Default is 1024.
  6321. @item hp
  6322. Set high-pass frequency. Default is 0.
  6323. @item lp
  6324. Set low-pass frequency. Default is 0.
  6325. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  6326. is higher than 0 then filter will create band-pass filter coefficients,
  6327. otherwise band-reject filter coefficients.
  6328. @item phase
  6329. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  6330. @item beta
  6331. Set Kaiser window beta.
  6332. @item att
  6333. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  6334. @item round
  6335. Enable rounding, by default is disabled.
  6336. @item hptaps
  6337. Set number of taps for high-pass filter.
  6338. @item lptaps
  6339. Set number of taps for low-pass filter.
  6340. @end table
  6341. @section sine
  6342. Generate an audio signal made of a sine wave with amplitude 1/8.
  6343. The audio signal is bit-exact.
  6344. The filter accepts the following options:
  6345. @table @option
  6346. @item frequency, f
  6347. Set the carrier frequency. Default is 440 Hz.
  6348. @item beep_factor, b
  6349. Enable a periodic beep every second with frequency @var{beep_factor} times
  6350. the carrier frequency. Default is 0, meaning the beep is disabled.
  6351. @item sample_rate, r
  6352. Specify the sample rate, default is 44100.
  6353. @item duration, d
  6354. Specify the duration of the generated audio stream.
  6355. @item samples_per_frame
  6356. Set the number of samples per output frame.
  6357. The expression can contain the following constants:
  6358. @table @option
  6359. @item n
  6360. The (sequential) number of the output audio frame, starting from 0.
  6361. @item pts
  6362. The PTS (Presentation TimeStamp) of the output audio frame,
  6363. expressed in @var{TB} units.
  6364. @item t
  6365. The PTS of the output audio frame, expressed in seconds.
  6366. @item TB
  6367. The timebase of the output audio frames.
  6368. @end table
  6369. Default is @code{1024}.
  6370. @end table
  6371. @subsection Examples
  6372. @itemize
  6373. @item
  6374. Generate a simple 440 Hz sine wave:
  6375. @example
  6376. sine
  6377. @end example
  6378. @item
  6379. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  6380. @example
  6381. sine=220:4:d=5
  6382. sine=f=220:b=4:d=5
  6383. sine=frequency=220:beep_factor=4:duration=5
  6384. @end example
  6385. @item
  6386. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  6387. pattern:
  6388. @example
  6389. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  6390. @end example
  6391. @end itemize
  6392. @c man end AUDIO SOURCES
  6393. @chapter Audio Sinks
  6394. @c man begin AUDIO SINKS
  6395. Below is a description of the currently available audio sinks.
  6396. @section abuffersink
  6397. Buffer audio frames, and make them available to the end of filter chain.
  6398. This sink is mainly intended for programmatic use, in particular
  6399. through the interface defined in @file{libavfilter/buffersink.h}
  6400. or the options system.
  6401. It accepts a pointer to an AVABufferSinkContext structure, which
  6402. defines the incoming buffers' formats, to be passed as the opaque
  6403. parameter to @code{avfilter_init_filter} for initialization.
  6404. @section anullsink
  6405. Null audio sink; do absolutely nothing with the input audio. It is
  6406. mainly useful as a template and for use in analysis / debugging
  6407. tools.
  6408. @c man end AUDIO SINKS
  6409. @chapter Video Filters
  6410. @c man begin VIDEO FILTERS
  6411. When you configure your FFmpeg build, you can disable any of the
  6412. existing filters using @code{--disable-filters}.
  6413. The configure output will show the video filters included in your
  6414. build.
  6415. Below is a description of the currently available video filters.
  6416. @section addroi
  6417. Mark a region of interest in a video frame.
  6418. The frame data is passed through unchanged, but metadata is attached
  6419. to the frame indicating regions of interest which can affect the
  6420. behaviour of later encoding. Multiple regions can be marked by
  6421. applying the filter multiple times.
  6422. @table @option
  6423. @item x
  6424. Region distance in pixels from the left edge of the frame.
  6425. @item y
  6426. Region distance in pixels from the top edge of the frame.
  6427. @item w
  6428. Region width in pixels.
  6429. @item h
  6430. Region height in pixels.
  6431. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  6432. and may contain the following variables:
  6433. @table @option
  6434. @item iw
  6435. Width of the input frame.
  6436. @item ih
  6437. Height of the input frame.
  6438. @end table
  6439. @item qoffset
  6440. Quantisation offset to apply within the region.
  6441. This must be a real value in the range -1 to +1. A value of zero
  6442. indicates no quality change. A negative value asks for better quality
  6443. (less quantisation), while a positive value asks for worse quality
  6444. (greater quantisation).
  6445. The range is calibrated so that the extreme values indicate the
  6446. largest possible offset - if the rest of the frame is encoded with the
  6447. worst possible quality, an offset of -1 indicates that this region
  6448. should be encoded with the best possible quality anyway. Intermediate
  6449. values are then interpolated in some codec-dependent way.
  6450. For example, in 10-bit H.264 the quantisation parameter varies between
  6451. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  6452. this region should be encoded with a QP around one-tenth of the full
  6453. range better than the rest of the frame. So, if most of the frame
  6454. were to be encoded with a QP of around 30, this region would get a QP
  6455. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  6456. An extreme value of -1 would indicate that this region should be
  6457. encoded with the best possible quality regardless of the treatment of
  6458. the rest of the frame - that is, should be encoded at a QP of -12.
  6459. @item clear
  6460. If set to true, remove any existing regions of interest marked on the
  6461. frame before adding the new one.
  6462. @end table
  6463. @subsection Examples
  6464. @itemize
  6465. @item
  6466. Mark the centre quarter of the frame as interesting.
  6467. @example
  6468. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  6469. @end example
  6470. @item
  6471. Mark the 100-pixel-wide region on the left edge of the frame as very
  6472. uninteresting (to be encoded at much lower quality than the rest of
  6473. the frame).
  6474. @example
  6475. addroi=0:0:100:ih:+1/5
  6476. @end example
  6477. @end itemize
  6478. @section alphaextract
  6479. Extract the alpha component from the input as a grayscale video. This
  6480. is especially useful with the @var{alphamerge} filter.
  6481. @section alphamerge
  6482. Add or replace the alpha component of the primary input with the
  6483. grayscale value of a second input. This is intended for use with
  6484. @var{alphaextract} to allow the transmission or storage of frame
  6485. sequences that have alpha in a format that doesn't support an alpha
  6486. channel.
  6487. For example, to reconstruct full frames from a normal YUV-encoded video
  6488. and a separate video created with @var{alphaextract}, you might use:
  6489. @example
  6490. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  6491. @end example
  6492. @section amplify
  6493. Amplify differences between current pixel and pixels of adjacent frames in
  6494. same pixel location.
  6495. This filter accepts the following options:
  6496. @table @option
  6497. @item radius
  6498. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  6499. For example radius of 3 will instruct filter to calculate average of 7 frames.
  6500. @item factor
  6501. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  6502. @item threshold
  6503. Set threshold for difference amplification. Any difference greater or equal to
  6504. this value will not alter source pixel. Default is 10.
  6505. Allowed range is from 0 to 65535.
  6506. @item tolerance
  6507. Set tolerance for difference amplification. Any difference lower to
  6508. this value will not alter source pixel. Default is 0.
  6509. Allowed range is from 0 to 65535.
  6510. @item low
  6511. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6512. This option controls maximum possible value that will decrease source pixel value.
  6513. @item high
  6514. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6515. This option controls maximum possible value that will increase source pixel value.
  6516. @item planes
  6517. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  6518. @end table
  6519. @subsection Commands
  6520. This filter supports the following @ref{commands} that corresponds to option of same name:
  6521. @table @option
  6522. @item factor
  6523. @item threshold
  6524. @item tolerance
  6525. @item low
  6526. @item high
  6527. @item planes
  6528. @end table
  6529. @section ass
  6530. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  6531. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  6532. Substation Alpha) subtitles files.
  6533. This filter accepts the following option in addition to the common options from
  6534. the @ref{subtitles} filter:
  6535. @table @option
  6536. @item shaping
  6537. Set the shaping engine
  6538. Available values are:
  6539. @table @samp
  6540. @item auto
  6541. The default libass shaping engine, which is the best available.
  6542. @item simple
  6543. Fast, font-agnostic shaper that can do only substitutions
  6544. @item complex
  6545. Slower shaper using OpenType for substitutions and positioning
  6546. @end table
  6547. The default is @code{auto}.
  6548. @end table
  6549. @section atadenoise
  6550. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  6551. The filter accepts the following options:
  6552. @table @option
  6553. @item 0a
  6554. Set threshold A for 1st plane. Default is 0.02.
  6555. Valid range is 0 to 0.3.
  6556. @item 0b
  6557. Set threshold B for 1st plane. Default is 0.04.
  6558. Valid range is 0 to 5.
  6559. @item 1a
  6560. Set threshold A for 2nd plane. Default is 0.02.
  6561. Valid range is 0 to 0.3.
  6562. @item 1b
  6563. Set threshold B for 2nd plane. Default is 0.04.
  6564. Valid range is 0 to 5.
  6565. @item 2a
  6566. Set threshold A for 3rd plane. Default is 0.02.
  6567. Valid range is 0 to 0.3.
  6568. @item 2b
  6569. Set threshold B for 3rd plane. Default is 0.04.
  6570. Valid range is 0 to 5.
  6571. Threshold A is designed to react on abrupt changes in the input signal and
  6572. threshold B is designed to react on continuous changes in the input signal.
  6573. @item s
  6574. Set number of frames filter will use for averaging. Default is 9. Must be odd
  6575. number in range [5, 129].
  6576. @item p
  6577. Set what planes of frame filter will use for averaging. Default is all.
  6578. @item a
  6579. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  6580. Alternatively can be set to @code{s} serial.
  6581. Parallel can be faster then serial, while other way around is never true.
  6582. Parallel will abort early on first change being greater then thresholds, while serial
  6583. will continue processing other side of frames if they are equal or below thresholds.
  6584. @item 0s
  6585. @item 1s
  6586. @item 2s
  6587. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  6588. Valid range is from 0 to 32767.
  6589. This options controls weight for each pixel in radius defined by size.
  6590. Default value means every pixel have same weight.
  6591. Setting this option to 0 effectively disables filtering.
  6592. @end table
  6593. @subsection Commands
  6594. This filter supports same @ref{commands} as options except option @code{s}.
  6595. The command accepts the same syntax of the corresponding option.
  6596. @section avgblur
  6597. Apply average blur filter.
  6598. The filter accepts the following options:
  6599. @table @option
  6600. @item sizeX
  6601. Set horizontal radius size.
  6602. @item planes
  6603. Set which planes to filter. By default all planes are filtered.
  6604. @item sizeY
  6605. Set vertical radius size, if zero it will be same as @code{sizeX}.
  6606. Default is @code{0}.
  6607. @end table
  6608. @subsection Commands
  6609. This filter supports same commands as options.
  6610. The command accepts the same syntax of the corresponding option.
  6611. If the specified expression is not valid, it is kept at its current
  6612. value.
  6613. @section backgroundkey
  6614. Turns a static background into transparency.
  6615. The filter accepts the following option:
  6616. @table @option
  6617. @item threshold
  6618. Threshold for scene change detection.
  6619. @item similarity
  6620. Similarity percentage with the background.
  6621. @item blend
  6622. Set the blend amount for pixels that are not similar.
  6623. @end table
  6624. @subsection Commands
  6625. This filter supports the all above options as @ref{commands}.
  6626. @section bbox
  6627. Compute the bounding box for the non-black pixels in the input frame
  6628. luma plane.
  6629. This filter computes the bounding box containing all the pixels with a
  6630. luma value greater than the minimum allowed value.
  6631. The parameters describing the bounding box are printed on the filter
  6632. log.
  6633. The filter accepts the following option:
  6634. @table @option
  6635. @item min_val
  6636. Set the minimal luma value. Default is @code{16}.
  6637. @end table
  6638. @subsection Commands
  6639. This filter supports the all above options as @ref{commands}.
  6640. @section bilateral
  6641. Apply bilateral filter, spatial smoothing while preserving edges.
  6642. The filter accepts the following options:
  6643. @table @option
  6644. @item sigmaS
  6645. Set sigma of gaussian function to calculate spatial weight.
  6646. Allowed range is 0 to 512. Default is 0.1.
  6647. @item sigmaR
  6648. Set sigma of gaussian function to calculate range weight.
  6649. Allowed range is 0 to 1. Default is 0.1.
  6650. @item planes
  6651. Set planes to filter. Default is first only.
  6652. @end table
  6653. @subsection Commands
  6654. This filter supports the all above options as @ref{commands}.
  6655. @section bitplanenoise
  6656. Show and measure bit plane noise.
  6657. The filter accepts the following options:
  6658. @table @option
  6659. @item bitplane
  6660. Set which plane to analyze. Default is @code{1}.
  6661. @item filter
  6662. Filter out noisy pixels from @code{bitplane} set above.
  6663. Default is disabled.
  6664. @end table
  6665. @section blackdetect
  6666. Detect video intervals that are (almost) completely black. Can be
  6667. useful to detect chapter transitions, commercials, or invalid
  6668. recordings.
  6669. The filter outputs its detection analysis to both the log as well as
  6670. frame metadata. If a black segment of at least the specified minimum
  6671. duration is found, a line with the start and end timestamps as well
  6672. as duration is printed to the log with level @code{info}. In addition,
  6673. a log line with level @code{debug} is printed per frame showing the
  6674. black amount detected for that frame.
  6675. The filter also attaches metadata to the first frame of a black
  6676. segment with key @code{lavfi.black_start} and to the first frame
  6677. after the black segment ends with key @code{lavfi.black_end}. The
  6678. value is the frame's timestamp. This metadata is added regardless
  6679. of the minimum duration specified.
  6680. The filter accepts the following options:
  6681. @table @option
  6682. @item black_min_duration, d
  6683. Set the minimum detected black duration expressed in seconds. It must
  6684. be a non-negative floating point number.
  6685. Default value is 2.0.
  6686. @item picture_black_ratio_th, pic_th
  6687. Set the threshold for considering a picture "black".
  6688. Express the minimum value for the ratio:
  6689. @example
  6690. @var{nb_black_pixels} / @var{nb_pixels}
  6691. @end example
  6692. for which a picture is considered black.
  6693. Default value is 0.98.
  6694. @item pixel_black_th, pix_th
  6695. Set the threshold for considering a pixel "black".
  6696. The threshold expresses the maximum pixel luma value for which a
  6697. pixel is considered "black". The provided value is scaled according to
  6698. the following equation:
  6699. @example
  6700. @var{absolute_threshold} = @var{luma_minimum_value} + @var{pixel_black_th} * @var{luma_range_size}
  6701. @end example
  6702. @var{luma_range_size} and @var{luma_minimum_value} depend on
  6703. the input video format, the range is [0-255] for YUV full-range
  6704. formats and [16-235] for YUV non full-range formats.
  6705. Default value is 0.10.
  6706. @end table
  6707. The following example sets the maximum pixel threshold to the minimum
  6708. value, and detects only black intervals of 2 or more seconds:
  6709. @example
  6710. blackdetect=d=2:pix_th=0.00
  6711. @end example
  6712. @section blackframe
  6713. Detect frames that are (almost) completely black. Can be useful to
  6714. detect chapter transitions or commercials. Output lines consist of
  6715. the frame number of the detected frame, the percentage of blackness,
  6716. the position in the file if known or -1 and the timestamp in seconds.
  6717. In order to display the output lines, you need to set the loglevel at
  6718. least to the AV_LOG_INFO value.
  6719. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6720. The value represents the percentage of pixels in the picture that
  6721. are below the threshold value.
  6722. It accepts the following parameters:
  6723. @table @option
  6724. @item amount
  6725. The percentage of the pixels that have to be below the threshold; it defaults to
  6726. @code{98}.
  6727. @item threshold, thresh
  6728. The threshold below which a pixel value is considered black; it defaults to
  6729. @code{32}.
  6730. @end table
  6731. @anchor{blend}
  6732. @section blend
  6733. Blend two video frames into each other.
  6734. The @code{blend} filter takes two input streams and outputs one
  6735. stream, the first input is the "top" layer and second input is
  6736. "bottom" layer. By default, the output terminates when the longest input terminates.
  6737. The @code{tblend} (time blend) filter takes two consecutive frames
  6738. from one single stream, and outputs the result obtained by blending
  6739. the new frame on top of the old frame.
  6740. A description of the accepted options follows.
  6741. @table @option
  6742. @item c0_mode
  6743. @item c1_mode
  6744. @item c2_mode
  6745. @item c3_mode
  6746. @item all_mode
  6747. Set blend mode for specific pixel component or all pixel components in case
  6748. of @var{all_mode}. Default value is @code{normal}.
  6749. Available values for component modes are:
  6750. @table @samp
  6751. @item addition
  6752. @item and
  6753. @item average
  6754. @item bleach
  6755. @item burn
  6756. @item darken
  6757. @item difference
  6758. @item divide
  6759. @item dodge
  6760. @item exclusion
  6761. @item extremity
  6762. @item freeze
  6763. @item geometric
  6764. @item glow
  6765. @item grainextract
  6766. @item grainmerge
  6767. @item hardlight
  6768. @item hardmix
  6769. @item hardoverlay
  6770. @item harmonic
  6771. @item heat
  6772. @item interpolate
  6773. @item lighten
  6774. @item linearlight
  6775. @item multiply
  6776. @item multiply128
  6777. @item negation
  6778. @item normal
  6779. @item or
  6780. @item overlay
  6781. @item phoenix
  6782. @item pinlight
  6783. @item reflect
  6784. @item screen
  6785. @item softdifference
  6786. @item softlight
  6787. @item stain
  6788. @item subtract
  6789. @item vividlight
  6790. @item xor
  6791. @end table
  6792. @item c0_opacity
  6793. @item c1_opacity
  6794. @item c2_opacity
  6795. @item c3_opacity
  6796. @item all_opacity
  6797. Set blend opacity for specific pixel component or all pixel components in case
  6798. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6799. @item c0_expr
  6800. @item c1_expr
  6801. @item c2_expr
  6802. @item c3_expr
  6803. @item all_expr
  6804. Set blend expression for specific pixel component or all pixel components in case
  6805. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6806. The expressions can use the following variables:
  6807. @table @option
  6808. @item N
  6809. The sequential number of the filtered frame, starting from @code{0}.
  6810. @item X
  6811. @item Y
  6812. the coordinates of the current sample
  6813. @item W
  6814. @item H
  6815. the width and height of currently filtered plane
  6816. @item SW
  6817. @item SH
  6818. Width and height scale for the plane being filtered. It is the
  6819. ratio between the dimensions of the current plane to the luma plane,
  6820. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6821. the luma plane and @code{0.5,0.5} for the chroma planes.
  6822. @item T
  6823. Time of the current frame, expressed in seconds.
  6824. @item TOP, A
  6825. Value of pixel component at current location for first video frame (top layer).
  6826. @item BOTTOM, B
  6827. Value of pixel component at current location for second video frame (bottom layer).
  6828. @end table
  6829. @end table
  6830. The @code{blend} filter also supports the @ref{framesync} options.
  6831. @subsection Examples
  6832. @itemize
  6833. @item
  6834. Apply transition from bottom layer to top layer in first 10 seconds:
  6835. @example
  6836. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6837. @end example
  6838. @item
  6839. Apply linear horizontal transition from top layer to bottom layer:
  6840. @example
  6841. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6842. @end example
  6843. @item
  6844. Apply 1x1 checkerboard effect:
  6845. @example
  6846. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6847. @end example
  6848. @item
  6849. Apply uncover left effect:
  6850. @example
  6851. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6852. @end example
  6853. @item
  6854. Apply uncover down effect:
  6855. @example
  6856. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6857. @end example
  6858. @item
  6859. Apply uncover up-left effect:
  6860. @example
  6861. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6862. @end example
  6863. @item
  6864. Split diagonally video and shows top and bottom layer on each side:
  6865. @example
  6866. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6867. @end example
  6868. @item
  6869. Display differences between the current and the previous frame:
  6870. @example
  6871. tblend=all_mode=grainextract
  6872. @end example
  6873. @end itemize
  6874. @subsection Commands
  6875. This filter supports same @ref{commands} as options.
  6876. @anchor{blockdetect}
  6877. @section blockdetect
  6878. Determines blockiness of frames without altering the input frames.
  6879. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference.
  6880. The filter accepts the following options:
  6881. @table @option
  6882. @item period_min
  6883. @item period_max
  6884. Set minimum and maximum values for determining pixel grids (periods).
  6885. Default values are [3,24].
  6886. @item planes
  6887. Set planes to filter. Default is first only.
  6888. @end table
  6889. @subsection Examples
  6890. @itemize
  6891. @item
  6892. Determine blockiness for the first plane and search for periods within [8,32]:
  6893. @example
  6894. blockdetect=period_min=8:period_max=32:planes=1
  6895. @end example
  6896. @end itemize
  6897. @anchor{blurdetect}
  6898. @section blurdetect
  6899. Determines blurriness of frames without altering the input frames.
  6900. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6901. Allows for a block-based abbreviation.
  6902. The filter accepts the following options:
  6903. @table @option
  6904. @item low
  6905. @item high
  6906. Set low and high threshold values used by the Canny thresholding
  6907. algorithm.
  6908. The high threshold selects the "strong" edge pixels, which are then
  6909. connected through 8-connectivity with the "weak" edge pixels selected
  6910. by the low threshold.
  6911. @var{low} and @var{high} threshold values must be chosen in the range
  6912. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6913. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6914. is @code{50/255}.
  6915. @item radius
  6916. Define the radius to search around an edge pixel for local maxima.
  6917. @item block_pct
  6918. Determine blurriness only for the most significant blocks, given in percentage.
  6919. @item block_width
  6920. 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}.
  6921. @item block_height
  6922. 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}.
  6923. @item planes
  6924. Set planes to filter. Default is first only.
  6925. @end table
  6926. @subsection Examples
  6927. @itemize
  6928. @item
  6929. Determine blur for 80% of most significant 32x32 blocks:
  6930. @example
  6931. blurdetect=block_width=32:block_height=32:block_pct=80
  6932. @end example
  6933. @end itemize
  6934. @section bm3d
  6935. Denoise frames using Block-Matching 3D algorithm.
  6936. The filter accepts the following options.
  6937. @table @option
  6938. @item sigma
  6939. Set denoising strength. Default value is 1.
  6940. Allowed range is from 0 to 999.9.
  6941. The denoising algorithm is very sensitive to sigma, so adjust it
  6942. according to the source.
  6943. @item block
  6944. Set local patch size. This sets dimensions in 2D.
  6945. @item bstep
  6946. Set sliding step for processing blocks. Default value is 4.
  6947. Allowed range is from 1 to 64.
  6948. Smaller values allows processing more reference blocks and is slower.
  6949. @item group
  6950. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6951. When set to 1, no block matching is done. Larger values allows more blocks
  6952. in single group.
  6953. Allowed range is from 1 to 256.
  6954. @item range
  6955. Set radius for search block matching. Default is 9.
  6956. Allowed range is from 1 to INT32_MAX.
  6957. @item mstep
  6958. Set step between two search locations for block matching. Default is 1.
  6959. Allowed range is from 1 to 64. Smaller is slower.
  6960. @item thmse
  6961. Set threshold of mean square error for block matching. Valid range is 0 to
  6962. INT32_MAX.
  6963. @item hdthr
  6964. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6965. Larger values results in stronger hard-thresholding filtering in frequency
  6966. domain.
  6967. @item estim
  6968. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6969. Default is @code{basic}.
  6970. @item ref
  6971. If enabled, filter will use 2nd stream for block matching.
  6972. Default is disabled for @code{basic} value of @var{estim} option,
  6973. and always enabled if value of @var{estim} is @code{final}.
  6974. @item planes
  6975. Set planes to filter. Default is all available except alpha.
  6976. @end table
  6977. @subsection Examples
  6978. @itemize
  6979. @item
  6980. Basic filtering with bm3d:
  6981. @example
  6982. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6983. @end example
  6984. @item
  6985. Same as above, but filtering only luma:
  6986. @example
  6987. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6988. @end example
  6989. @item
  6990. Same as above, but with both estimation modes:
  6991. @example
  6992. 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
  6993. @end example
  6994. @item
  6995. Same as above, but prefilter with @ref{nlmeans} filter instead:
  6996. @example
  6997. 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
  6998. @end example
  6999. @end itemize
  7000. @section boxblur
  7001. Apply a boxblur algorithm to the input video.
  7002. It accepts the following parameters:
  7003. @table @option
  7004. @item luma_radius, lr
  7005. @item luma_power, lp
  7006. @item chroma_radius, cr
  7007. @item chroma_power, cp
  7008. @item alpha_radius, ar
  7009. @item alpha_power, ap
  7010. @end table
  7011. A description of the accepted options follows.
  7012. @table @option
  7013. @item luma_radius, lr
  7014. @item chroma_radius, cr
  7015. @item alpha_radius, ar
  7016. Set an expression for the box radius in pixels used for blurring the
  7017. corresponding input plane.
  7018. The radius value must be a non-negative number, and must not be
  7019. greater than the value of the expression @code{min(w,h)/2} for the
  7020. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  7021. planes.
  7022. Default value for @option{luma_radius} is "2". If not specified,
  7023. @option{chroma_radius} and @option{alpha_radius} default to the
  7024. corresponding value set for @option{luma_radius}.
  7025. The expressions can contain the following constants:
  7026. @table @option
  7027. @item w
  7028. @item h
  7029. The input width and height in pixels.
  7030. @item cw
  7031. @item ch
  7032. The input chroma image width and height in pixels.
  7033. @item hsub
  7034. @item vsub
  7035. The horizontal and vertical chroma subsample values. For example, for the
  7036. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  7037. @end table
  7038. @item luma_power, lp
  7039. @item chroma_power, cp
  7040. @item alpha_power, ap
  7041. Specify how many times the boxblur filter is applied to the
  7042. corresponding plane.
  7043. Default value for @option{luma_power} is 2. If not specified,
  7044. @option{chroma_power} and @option{alpha_power} default to the
  7045. corresponding value set for @option{luma_power}.
  7046. A value of 0 will disable the effect.
  7047. @end table
  7048. @subsection Examples
  7049. @itemize
  7050. @item
  7051. Apply a boxblur filter with the luma, chroma, and alpha radii
  7052. set to 2:
  7053. @example
  7054. boxblur=luma_radius=2:luma_power=1
  7055. boxblur=2:1
  7056. @end example
  7057. @item
  7058. Set the luma radius to 2, and alpha and chroma radius to 0:
  7059. @example
  7060. boxblur=2:1:cr=0:ar=0
  7061. @end example
  7062. @item
  7063. Set the luma and chroma radii to a fraction of the video dimension:
  7064. @example
  7065. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  7066. @end example
  7067. @end itemize
  7068. @anchor{bwdif}
  7069. @section bwdif
  7070. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  7071. Deinterlacing Filter").
  7072. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  7073. interpolation algorithms.
  7074. It accepts the following parameters:
  7075. @table @option
  7076. @item mode
  7077. The interlacing mode to adopt. It accepts one of the following values:
  7078. @table @option
  7079. @item 0, send_frame
  7080. Output one frame for each frame.
  7081. @item 1, send_field
  7082. Output one frame for each field.
  7083. @end table
  7084. The default value is @code{send_field}.
  7085. @item parity
  7086. The picture field parity assumed for the input interlaced video. It accepts one
  7087. of the following values:
  7088. @table @option
  7089. @item 0, tff
  7090. Assume the top field is first.
  7091. @item 1, bff
  7092. Assume the bottom field is first.
  7093. @item -1, auto
  7094. Enable automatic detection of field parity.
  7095. @end table
  7096. The default value is @code{auto}.
  7097. If the interlacing is unknown or the decoder does not export this information,
  7098. top field first will be assumed.
  7099. @item deint
  7100. Specify which frames to deinterlace. Accepts one of the following
  7101. values:
  7102. @table @option
  7103. @item 0, all
  7104. Deinterlace all frames.
  7105. @item 1, interlaced
  7106. Only deinterlace frames marked as interlaced.
  7107. @end table
  7108. The default value is @code{all}.
  7109. @end table
  7110. @section ccrepack
  7111. Repack CEA-708 closed captioning side data
  7112. This filter fixes various issues seen with commerical encoders
  7113. related to upstream malformed CEA-708 payloads, specifically
  7114. incorrect number of tuples (wrong cc_count for the target FPS),
  7115. and incorrect ordering of tuples (i.e. the CEA-608 tuples are not at
  7116. the first entries in the payload).
  7117. @section cas
  7118. Apply Contrast Adaptive Sharpen filter to video stream.
  7119. The filter accepts the following options:
  7120. @table @option
  7121. @item strength
  7122. Set the sharpening strength. Default value is 0.
  7123. @item planes
  7124. Set planes to filter. Default value is to filter all
  7125. planes except alpha plane.
  7126. @end table
  7127. @subsection Commands
  7128. This filter supports same @ref{commands} as options.
  7129. @section chromahold
  7130. Remove all color information for all colors except for certain one.
  7131. The filter accepts the following options:
  7132. @table @option
  7133. @item color
  7134. The color which will not be replaced with neutral chroma.
  7135. @item similarity
  7136. Similarity percentage with the above color.
  7137. 0.01 matches only the exact key color, while 1.0 matches everything.
  7138. @item blend
  7139. Blend percentage.
  7140. 0.0 makes pixels either fully gray, or not gray at all.
  7141. Higher values result in more preserved color.
  7142. @item yuv
  7143. Signals that the color passed is already in YUV instead of RGB.
  7144. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7145. This can be used to pass exact YUV values as hexadecimal numbers.
  7146. @end table
  7147. @subsection Commands
  7148. This filter supports same @ref{commands} as options.
  7149. The command accepts the same syntax of the corresponding option.
  7150. If the specified expression is not valid, it is kept at its current
  7151. value.
  7152. @anchor{chromakey}
  7153. @section chromakey
  7154. YUV colorspace color/chroma keying.
  7155. The filter accepts the following options:
  7156. @table @option
  7157. @item color
  7158. The color which will be replaced with transparency.
  7159. @item similarity
  7160. Similarity percentage with the key color.
  7161. 0.01 matches only the exact key color, while 1.0 matches everything.
  7162. @item blend
  7163. Blend percentage.
  7164. 0.0 makes pixels either fully transparent, or not transparent at all.
  7165. Higher values result in semi-transparent pixels, with a higher transparency
  7166. the more similar the pixels color is to the key color.
  7167. @item yuv
  7168. Signals that the color passed is already in YUV instead of RGB.
  7169. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7170. This can be used to pass exact YUV values as hexadecimal numbers.
  7171. @end table
  7172. @subsection Commands
  7173. This filter supports same @ref{commands} as options.
  7174. The command accepts the same syntax of the corresponding option.
  7175. If the specified expression is not valid, it is kept at its current
  7176. value.
  7177. @subsection Examples
  7178. @itemize
  7179. @item
  7180. Make every green pixel in the input image transparent:
  7181. @example
  7182. ffmpeg -i input.png -vf chromakey=green out.png
  7183. @end example
  7184. @item
  7185. Overlay a greenscreen-video on top of a static black background.
  7186. @example
  7187. 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
  7188. @end example
  7189. @end itemize
  7190. @section chromanr
  7191. Reduce chrominance noise.
  7192. The filter accepts the following options:
  7193. @table @option
  7194. @item thres
  7195. Set threshold for averaging chrominance values.
  7196. Sum of absolute difference of Y, U and V pixel components of current
  7197. pixel and neighbour pixels lower than this threshold will be used in
  7198. averaging. Luma component is left unchanged and is copied to output.
  7199. Default value is 30. Allowed range is from 1 to 200.
  7200. @item sizew
  7201. Set horizontal radius of rectangle used for averaging.
  7202. Allowed range is from 1 to 100. Default value is 5.
  7203. @item sizeh
  7204. Set vertical radius of rectangle used for averaging.
  7205. Allowed range is from 1 to 100. Default value is 5.
  7206. @item stepw
  7207. Set horizontal step when averaging. Default value is 1.
  7208. Allowed range is from 1 to 50.
  7209. Mostly useful to speed-up filtering.
  7210. @item steph
  7211. Set vertical step when averaging. Default value is 1.
  7212. Allowed range is from 1 to 50.
  7213. Mostly useful to speed-up filtering.
  7214. @item threy
  7215. Set Y threshold for averaging chrominance values.
  7216. Set finer control for max allowed difference between Y components
  7217. of current pixel and neigbour pixels.
  7218. Default value is 200. Allowed range is from 1 to 200.
  7219. @item threu
  7220. Set U threshold for averaging chrominance values.
  7221. Set finer control for max allowed difference between U components
  7222. of current pixel and neigbour pixels.
  7223. Default value is 200. Allowed range is from 1 to 200.
  7224. @item threv
  7225. Set V threshold for averaging chrominance values.
  7226. Set finer control for max allowed difference between V components
  7227. of current pixel and neigbour pixels.
  7228. Default value is 200. Allowed range is from 1 to 200.
  7229. @item distance
  7230. Set distance type used in calculations.
  7231. @table @samp
  7232. @item manhattan
  7233. Absolute difference.
  7234. @item euclidean
  7235. Difference squared.
  7236. @end table
  7237. Default distance type is manhattan.
  7238. @end table
  7239. @subsection Commands
  7240. This filter supports same @ref{commands} as options.
  7241. The command accepts the same syntax of the corresponding option.
  7242. @section chromashift
  7243. Shift chroma pixels horizontally and/or vertically.
  7244. The filter accepts the following options:
  7245. @table @option
  7246. @item cbh
  7247. Set amount to shift chroma-blue horizontally.
  7248. @item cbv
  7249. Set amount to shift chroma-blue vertically.
  7250. @item crh
  7251. Set amount to shift chroma-red horizontally.
  7252. @item crv
  7253. Set amount to shift chroma-red vertically.
  7254. @item edge
  7255. Set edge mode, can be @var{smear}, default, or @var{warp}.
  7256. @end table
  7257. @subsection Commands
  7258. This filter supports the all above options as @ref{commands}.
  7259. @section ciescope
  7260. Display CIE color diagram with pixels overlaid onto it.
  7261. The filter accepts the following options:
  7262. @table @option
  7263. @item system
  7264. Set color system.
  7265. @table @samp
  7266. @item ntsc, 470m
  7267. @item ebu, 470bg
  7268. @item smpte
  7269. @item 240m
  7270. @item apple
  7271. @item widergb
  7272. @item cie1931
  7273. @item rec709, hdtv
  7274. @item uhdtv, rec2020
  7275. @item dcip3
  7276. @end table
  7277. @item cie
  7278. Set CIE system.
  7279. @table @samp
  7280. @item xyy
  7281. @item ucs
  7282. @item luv
  7283. @end table
  7284. @item gamuts
  7285. Set what gamuts to draw.
  7286. See @code{system} option for available values.
  7287. @item size, s
  7288. Set ciescope size, by default set to 512.
  7289. @item intensity, i
  7290. Set intensity used to map input pixel values to CIE diagram.
  7291. @item contrast
  7292. Set contrast used to draw tongue colors that are out of active color system gamut.
  7293. @item corrgamma
  7294. Correct gamma displayed on scope, by default enabled.
  7295. @item showwhite
  7296. Show white point on CIE diagram, by default disabled.
  7297. @item gamma
  7298. Set input gamma. Used only with XYZ input color space.
  7299. @item fill
  7300. Fill with CIE colors. By default is enabled.
  7301. @end table
  7302. @section codecview
  7303. Visualize information exported by some codecs.
  7304. Some codecs can export information through frames using side-data or other
  7305. means. For example, some MPEG based codecs export motion vectors through the
  7306. @var{export_mvs} flag in the codec @option{flags2} option.
  7307. The filter accepts the following option:
  7308. @table @option
  7309. @item block
  7310. Display block partition structure using the luma plane.
  7311. @item mv
  7312. Set motion vectors to visualize.
  7313. Available flags for @var{mv} are:
  7314. @table @samp
  7315. @item pf
  7316. forward predicted MVs of P-frames
  7317. @item bf
  7318. forward predicted MVs of B-frames
  7319. @item bb
  7320. backward predicted MVs of B-frames
  7321. @end table
  7322. @item qp
  7323. Display quantization parameters using the chroma planes.
  7324. @item mv_type, mvt
  7325. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  7326. Available flags for @var{mv_type} are:
  7327. @table @samp
  7328. @item fp
  7329. forward predicted MVs
  7330. @item bp
  7331. backward predicted MVs
  7332. @end table
  7333. @item frame_type, ft
  7334. Set frame type to visualize motion vectors of.
  7335. Available flags for @var{frame_type} are:
  7336. @table @samp
  7337. @item if
  7338. intra-coded frames (I-frames)
  7339. @item pf
  7340. predicted frames (P-frames)
  7341. @item bf
  7342. bi-directionally predicted frames (B-frames)
  7343. @end table
  7344. @end table
  7345. @subsection Examples
  7346. @itemize
  7347. @item
  7348. Visualize forward predicted MVs of all frames using @command{ffplay}:
  7349. @example
  7350. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  7351. @end example
  7352. @item
  7353. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  7354. @example
  7355. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  7356. @end example
  7357. @end itemize
  7358. @section colorbalance
  7359. Modify intensity of primary colors (red, green and blue) of input frames.
  7360. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  7361. regions for the red-cyan, green-magenta or blue-yellow balance.
  7362. A positive adjustment value shifts the balance towards the primary color, a negative
  7363. value towards the complementary color.
  7364. The filter accepts the following options:
  7365. @table @option
  7366. @item rs
  7367. @item gs
  7368. @item bs
  7369. Adjust red, green and blue shadows (darkest pixels).
  7370. @item rm
  7371. @item gm
  7372. @item bm
  7373. Adjust red, green and blue midtones (medium pixels).
  7374. @item rh
  7375. @item gh
  7376. @item bh
  7377. Adjust red, green and blue highlights (brightest pixels).
  7378. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7379. @item pl
  7380. Preserve lightness when changing color balance. Default is disabled.
  7381. @end table
  7382. @subsection Examples
  7383. @itemize
  7384. @item
  7385. Add red color cast to shadows:
  7386. @example
  7387. colorbalance=rs=.3
  7388. @end example
  7389. @end itemize
  7390. @subsection Commands
  7391. This filter supports the all above options as @ref{commands}.
  7392. @section colorcontrast
  7393. Adjust color contrast between RGB components.
  7394. The filter accepts the following options:
  7395. @table @option
  7396. @item rc
  7397. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7398. @item gm
  7399. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7400. @item by
  7401. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7402. @item rcw
  7403. @item gmw
  7404. @item byw
  7405. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  7406. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  7407. @item pl
  7408. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  7409. @end table
  7410. @subsection Commands
  7411. This filter supports the all above options as @ref{commands}.
  7412. @section colorcorrect
  7413. Adjust color white balance selectively for blacks and whites.
  7414. This filter operates in YUV colorspace.
  7415. The filter accepts the following options:
  7416. @table @option
  7417. @item rl
  7418. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  7419. Default value is 0.
  7420. @item bl
  7421. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  7422. Default value is 0.
  7423. @item rh
  7424. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7425. Default value is 0.
  7426. @item bh
  7427. Set the blue highlight spot. Allowed range is from -1.0 to 1.0.
  7428. Default value is 0.
  7429. @item saturation
  7430. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  7431. Default value is 1.
  7432. @item analyze
  7433. If set to anything other than @code{manual} it will analyze every frame and use derived
  7434. parameters for filtering output frame.
  7435. Possible values are:
  7436. @table @samp
  7437. @item manual
  7438. @item average
  7439. @item minmax
  7440. @item median
  7441. @end table
  7442. Default value is @code{manual}.
  7443. @end table
  7444. @subsection Commands
  7445. This filter supports the all above options as @ref{commands}.
  7446. @section colorchannelmixer
  7447. Adjust video input frames by re-mixing color channels.
  7448. This filter modifies a color channel by adding the values associated to
  7449. the other channels of the same pixels. For example if the value to
  7450. modify is red, the output value will be:
  7451. @example
  7452. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  7453. @end example
  7454. The filter accepts the following options:
  7455. @table @option
  7456. @item rr
  7457. @item rg
  7458. @item rb
  7459. @item ra
  7460. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  7461. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  7462. @item gr
  7463. @item gg
  7464. @item gb
  7465. @item ga
  7466. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  7467. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  7468. @item br
  7469. @item bg
  7470. @item bb
  7471. @item ba
  7472. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  7473. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  7474. @item ar
  7475. @item ag
  7476. @item ab
  7477. @item aa
  7478. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  7479. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  7480. Allowed ranges for options are @code{[-2.0, 2.0]}.
  7481. @item pc
  7482. Set preserve color mode. The accepted values are:
  7483. @table @samp
  7484. @item none
  7485. Disable color preserving, this is default.
  7486. @item lum
  7487. Preserve luminance.
  7488. @item max
  7489. Preserve max value of RGB triplet.
  7490. @item avg
  7491. Preserve average value of RGB triplet.
  7492. @item sum
  7493. Preserve sum value of RGB triplet.
  7494. @item nrm
  7495. Preserve normalized value of RGB triplet.
  7496. @item pwr
  7497. Preserve power value of RGB triplet.
  7498. @end table
  7499. @item pa
  7500. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  7501. Default is @code{0.0}, thus disabled.
  7502. @end table
  7503. @subsection Examples
  7504. @itemize
  7505. @item
  7506. Convert source to grayscale:
  7507. @example
  7508. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  7509. @end example
  7510. @item
  7511. Simulate sepia tones:
  7512. @example
  7513. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  7514. @end example
  7515. @end itemize
  7516. @subsection Commands
  7517. This filter supports the all above options as @ref{commands}.
  7518. @section colorize
  7519. Overlay a solid color on the video stream.
  7520. The filter accepts the following options:
  7521. @table @option
  7522. @item hue
  7523. Set the color hue. Allowed range is from 0 to 360.
  7524. Default value is 0.
  7525. @item saturation
  7526. Set the color saturation. Allowed range is from 0 to 1.
  7527. Default value is 0.5.
  7528. @item lightness
  7529. Set the color lightness. Allowed range is from 0 to 1.
  7530. Default value is 0.5.
  7531. @item mix
  7532. Set the mix of source lightness. By default is set to 1.0.
  7533. Allowed range is from 0.0 to 1.0.
  7534. @end table
  7535. @subsection Commands
  7536. This filter supports the all above options as @ref{commands}.
  7537. @section colorkey
  7538. RGB colorspace color keying.
  7539. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  7540. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  7541. the similarity radius depends on the value of the blend option.
  7542. The filter accepts the following options:
  7543. @table @option
  7544. @item color
  7545. Set the color for which alpha will be set to 0 (full transparency).
  7546. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7547. Default is @code{black}.
  7548. @item similarity
  7549. Set the radius from the key color within which other colors also have full transparency.
  7550. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  7551. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  7552. around the exact key color, while 1.0 matches everything.
  7553. Default is @code{0.01}.
  7554. @item blend
  7555. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  7556. 0.0 makes pixels either fully transparent or fully opaque.
  7557. Higher values result in semi-transparent pixels, with greater transparency
  7558. the more similar the pixel color is to the key color.
  7559. Range is 0.0 to 1.0. Default is @code{0.0}.
  7560. @end table
  7561. @subsection Examples
  7562. @itemize
  7563. @item
  7564. Make every green pixel in the input image transparent:
  7565. @example
  7566. ffmpeg -i input.png -vf colorkey=green out.png
  7567. @end example
  7568. @item
  7569. Overlay a greenscreen-video on top of a static background image.
  7570. @example
  7571. 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
  7572. @end example
  7573. @end itemize
  7574. @subsection Commands
  7575. This filter supports same @ref{commands} as options.
  7576. The command accepts the same syntax of the corresponding option.
  7577. If the specified expression is not valid, it is kept at its current
  7578. value.
  7579. @section colorhold
  7580. Remove all color information for all RGB colors except for certain one.
  7581. The filter accepts the following options:
  7582. @table @option
  7583. @item color
  7584. The color which will not be replaced with neutral gray.
  7585. @item similarity
  7586. Similarity percentage with the above color.
  7587. 0.01 matches only the exact key color, while 1.0 matches everything.
  7588. @item blend
  7589. Blend percentage. 0.0 makes pixels fully gray.
  7590. Higher values result in more preserved color.
  7591. @end table
  7592. @subsection Commands
  7593. This filter supports same @ref{commands} as options.
  7594. The command accepts the same syntax of the corresponding option.
  7595. If the specified expression is not valid, it is kept at its current
  7596. value.
  7597. @section colorlevels
  7598. Adjust video input frames using levels.
  7599. The filter accepts the following options:
  7600. @table @option
  7601. @item rimin
  7602. @item gimin
  7603. @item bimin
  7604. @item aimin
  7605. Adjust red, green, blue and alpha input black point.
  7606. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7607. @item rimax
  7608. @item gimax
  7609. @item bimax
  7610. @item aimax
  7611. Adjust red, green, blue and alpha input white point.
  7612. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  7613. Input levels are used to lighten highlights (bright tones), darken shadows
  7614. (dark tones), change the balance of bright and dark tones.
  7615. @item romin
  7616. @item gomin
  7617. @item bomin
  7618. @item aomin
  7619. Adjust red, green, blue and alpha output black point.
  7620. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  7621. @item romax
  7622. @item gomax
  7623. @item bomax
  7624. @item aomax
  7625. Adjust red, green, blue and alpha output white point.
  7626. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  7627. Output levels allows manual selection of a constrained output level range.
  7628. @item preserve
  7629. Set preserve color mode. The accepted values are:
  7630. @table @samp
  7631. @item none
  7632. Disable color preserving, this is default.
  7633. @item lum
  7634. Preserve luminance.
  7635. @item max
  7636. Preserve max value of RGB triplet.
  7637. @item avg
  7638. Preserve average value of RGB triplet.
  7639. @item sum
  7640. Preserve sum value of RGB triplet.
  7641. @item nrm
  7642. Preserve normalized value of RGB triplet.
  7643. @item pwr
  7644. Preserve power value of RGB triplet.
  7645. @end table
  7646. @end table
  7647. @subsection Examples
  7648. @itemize
  7649. @item
  7650. Make video output darker:
  7651. @example
  7652. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  7653. @end example
  7654. @item
  7655. Increase contrast:
  7656. @example
  7657. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  7658. @end example
  7659. @item
  7660. Make video output lighter:
  7661. @example
  7662. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  7663. @end example
  7664. @item
  7665. Increase brightness:
  7666. @example
  7667. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  7668. @end example
  7669. @end itemize
  7670. @subsection Commands
  7671. This filter supports the all above options as @ref{commands}.
  7672. @section colormap
  7673. Apply custom color maps to video stream.
  7674. This filter needs three input video streams.
  7675. First stream is video stream that is going to be filtered out.
  7676. Second and third video stream specify color patches for source
  7677. color to target color mapping.
  7678. The filter accepts the following options:
  7679. @table @option
  7680. @item patch_size
  7681. Set the source and target video stream patch size in pixels.
  7682. @item nb_patches
  7683. Set the max number of used patches from source and target video stream.
  7684. Default value is number of patches available in additional video streams.
  7685. Max allowed number of patches is @code{64}.
  7686. @item type
  7687. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  7688. Defaults is @code{absolute}.
  7689. @item kernel
  7690. Set the kernel used to measure color differences between mapped colors.
  7691. The accepted values are:
  7692. @table @samp
  7693. @item euclidean
  7694. @item weuclidean
  7695. @end table
  7696. Default is @code{euclidean}.
  7697. @end table
  7698. @section colormatrix
  7699. Convert color matrix.
  7700. The filter accepts the following options:
  7701. @table @option
  7702. @item src
  7703. @item dst
  7704. Specify the source and destination color matrix. Both values must be
  7705. specified.
  7706. The accepted values are:
  7707. @table @samp
  7708. @item bt709
  7709. BT.709
  7710. @item fcc
  7711. FCC
  7712. @item bt601
  7713. BT.601
  7714. @item bt470
  7715. BT.470
  7716. @item bt470bg
  7717. BT.470BG
  7718. @item smpte170m
  7719. SMPTE-170M
  7720. @item smpte240m
  7721. SMPTE-240M
  7722. @item bt2020
  7723. BT.2020
  7724. @end table
  7725. @end table
  7726. For example to convert from BT.601 to SMPTE-240M, use the command:
  7727. @example
  7728. colormatrix=bt601:smpte240m
  7729. @end example
  7730. @section colorspace
  7731. Convert colorspace, transfer characteristics or color primaries.
  7732. Input video needs to have an even size.
  7733. The filter accepts the following options:
  7734. @table @option
  7735. @anchor{all}
  7736. @item all
  7737. Specify all color properties at once.
  7738. The accepted values are:
  7739. @table @samp
  7740. @item bt470m
  7741. BT.470M
  7742. @item bt470bg
  7743. BT.470BG
  7744. @item bt601-6-525
  7745. BT.601-6 525
  7746. @item bt601-6-625
  7747. BT.601-6 625
  7748. @item bt709
  7749. BT.709
  7750. @item smpte170m
  7751. SMPTE-170M
  7752. @item smpte240m
  7753. SMPTE-240M
  7754. @item bt2020
  7755. BT.2020
  7756. @end table
  7757. @anchor{space}
  7758. @item space
  7759. Specify output colorspace.
  7760. The accepted values are:
  7761. @table @samp
  7762. @item bt709
  7763. BT.709
  7764. @item fcc
  7765. FCC
  7766. @item bt470bg
  7767. BT.470BG or BT.601-6 625
  7768. @item smpte170m
  7769. SMPTE-170M or BT.601-6 525
  7770. @item smpte240m
  7771. SMPTE-240M
  7772. @item ycgco
  7773. YCgCo
  7774. @item bt2020ncl
  7775. BT.2020 with non-constant luminance
  7776. @end table
  7777. @anchor{trc}
  7778. @item trc
  7779. Specify output transfer characteristics.
  7780. The accepted values are:
  7781. @table @samp
  7782. @item bt709
  7783. BT.709
  7784. @item bt470m
  7785. BT.470M
  7786. @item bt470bg
  7787. BT.470BG
  7788. @item gamma22
  7789. Constant gamma of 2.2
  7790. @item gamma28
  7791. Constant gamma of 2.8
  7792. @item smpte170m
  7793. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7794. @item smpte240m
  7795. SMPTE-240M
  7796. @item srgb
  7797. SRGB
  7798. @item iec61966-2-1
  7799. iec61966-2-1
  7800. @item iec61966-2-4
  7801. iec61966-2-4
  7802. @item xvycc
  7803. xvycc
  7804. @item bt2020-10
  7805. BT.2020 for 10-bits content
  7806. @item bt2020-12
  7807. BT.2020 for 12-bits content
  7808. @end table
  7809. @anchor{primaries}
  7810. @item primaries
  7811. Specify output color primaries.
  7812. The accepted values are:
  7813. @table @samp
  7814. @item bt709
  7815. BT.709
  7816. @item bt470m
  7817. BT.470M
  7818. @item bt470bg
  7819. BT.470BG or BT.601-6 625
  7820. @item smpte170m
  7821. SMPTE-170M or BT.601-6 525
  7822. @item smpte240m
  7823. SMPTE-240M
  7824. @item film
  7825. film
  7826. @item smpte431
  7827. SMPTE-431
  7828. @item smpte432
  7829. SMPTE-432
  7830. @item bt2020
  7831. BT.2020
  7832. @item jedec-p22
  7833. JEDEC P22 phosphors
  7834. @end table
  7835. @anchor{range}
  7836. @item range
  7837. Specify output color range.
  7838. The accepted values are:
  7839. @table @samp
  7840. @item tv
  7841. TV (restricted) range
  7842. @item mpeg
  7843. MPEG (restricted) range
  7844. @item pc
  7845. PC (full) range
  7846. @item jpeg
  7847. JPEG (full) range
  7848. @end table
  7849. @item format
  7850. Specify output color format.
  7851. The accepted values are:
  7852. @table @samp
  7853. @item yuv420p
  7854. YUV 4:2:0 planar 8-bits
  7855. @item yuv420p10
  7856. YUV 4:2:0 planar 10-bits
  7857. @item yuv420p12
  7858. YUV 4:2:0 planar 12-bits
  7859. @item yuv422p
  7860. YUV 4:2:2 planar 8-bits
  7861. @item yuv422p10
  7862. YUV 4:2:2 planar 10-bits
  7863. @item yuv422p12
  7864. YUV 4:2:2 planar 12-bits
  7865. @item yuv444p
  7866. YUV 4:4:4 planar 8-bits
  7867. @item yuv444p10
  7868. YUV 4:4:4 planar 10-bits
  7869. @item yuv444p12
  7870. YUV 4:4:4 planar 12-bits
  7871. @end table
  7872. @item fast
  7873. Do a fast conversion, which skips gamma/primary correction. This will take
  7874. significantly less CPU, but will be mathematically incorrect. To get output
  7875. compatible with that produced by the colormatrix filter, use fast=1.
  7876. @item dither
  7877. Specify dithering mode.
  7878. The accepted values are:
  7879. @table @samp
  7880. @item none
  7881. No dithering
  7882. @item fsb
  7883. Floyd-Steinberg dithering
  7884. @end table
  7885. @item wpadapt
  7886. Whitepoint adaptation mode.
  7887. The accepted values are:
  7888. @table @samp
  7889. @item bradford
  7890. Bradford whitepoint adaptation
  7891. @item vonkries
  7892. von Kries whitepoint adaptation
  7893. @item identity
  7894. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7895. @end table
  7896. @item iall
  7897. Override all input properties at once. Same accepted values as @ref{all}.
  7898. @item ispace
  7899. Override input colorspace. Same accepted values as @ref{space}.
  7900. @item iprimaries
  7901. Override input color primaries. Same accepted values as @ref{primaries}.
  7902. @item itrc
  7903. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7904. @item irange
  7905. Override input color range. Same accepted values as @ref{range}.
  7906. @end table
  7907. The filter converts the transfer characteristics, color space and color
  7908. primaries to the specified user values. The output value, if not specified,
  7909. is set to a default value based on the "all" property. If that property is
  7910. also not specified, the filter will log an error. The output color range and
  7911. format default to the same value as the input color range and format. The
  7912. input transfer characteristics, color space, color primaries and color range
  7913. should be set on the input data. If any of these are missing, the filter will
  7914. log an error and no conversion will take place.
  7915. For example to convert the input to SMPTE-240M, use the command:
  7916. @example
  7917. colorspace=smpte240m
  7918. @end example
  7919. @section colortemperature
  7920. Adjust color temperature in video to simulate variations in ambient color temperature.
  7921. The filter accepts the following options:
  7922. @table @option
  7923. @item temperature
  7924. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7925. Default value is 6500 K.
  7926. @item mix
  7927. Set mixing with filtered output. Allowed range is from 0 to 1.
  7928. Default value is 1.
  7929. @item pl
  7930. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  7931. Default value is 0.
  7932. @end table
  7933. @subsection Commands
  7934. This filter supports same @ref{commands} as options.
  7935. @section convolution
  7936. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  7937. The filter accepts the following options:
  7938. @table @option
  7939. @item 0m
  7940. @item 1m
  7941. @item 2m
  7942. @item 3m
  7943. Set matrix for each plane.
  7944. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  7945. and from 1 to 49 odd number of signed integers in @var{row} mode.
  7946. @item 0rdiv
  7947. @item 1rdiv
  7948. @item 2rdiv
  7949. @item 3rdiv
  7950. Set multiplier for calculated value for each plane.
  7951. If unset or 0, it will be 1/sum of all matrix elements.
  7952. @item 0bias
  7953. @item 1bias
  7954. @item 2bias
  7955. @item 3bias
  7956. Set bias for each plane. This value is added to the result of the multiplication.
  7957. Useful for making the overall image brighter or darker. Default is 0.0.
  7958. @item 0mode
  7959. @item 1mode
  7960. @item 2mode
  7961. @item 3mode
  7962. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  7963. Default is @var{square}.
  7964. @end table
  7965. @subsection Commands
  7966. This filter supports the all above options as @ref{commands}.
  7967. @subsection Examples
  7968. @itemize
  7969. @item
  7970. Apply sharpen:
  7971. @example
  7972. 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"
  7973. @end example
  7974. @item
  7975. Apply blur:
  7976. @example
  7977. 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"
  7978. @end example
  7979. @item
  7980. Apply edge enhance:
  7981. @example
  7982. 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"
  7983. @end example
  7984. @item
  7985. Apply edge detect:
  7986. @example
  7987. 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"
  7988. @end example
  7989. @item
  7990. Apply laplacian edge detector which includes diagonals:
  7991. @example
  7992. 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"
  7993. @end example
  7994. @item
  7995. Apply emboss:
  7996. @example
  7997. 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"
  7998. @end example
  7999. @end itemize
  8000. @section convolve
  8001. Apply 2D convolution of video stream in frequency domain using second stream
  8002. as impulse.
  8003. The filter accepts the following options:
  8004. @table @option
  8005. @item planes
  8006. Set which planes to process.
  8007. @item impulse
  8008. Set which impulse video frames will be processed, can be @var{first}
  8009. or @var{all}. Default is @var{all}.
  8010. @end table
  8011. The @code{convolve} filter also supports the @ref{framesync} options.
  8012. @section copy
  8013. Copy the input video source unchanged to the output. This is mainly useful for
  8014. testing purposes.
  8015. @anchor{coreimage}
  8016. @section coreimage
  8017. Video filtering on GPU using Apple's CoreImage API on OSX.
  8018. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  8019. processed by video hardware. However, software-based OpenGL implementations
  8020. exist which means there is no guarantee for hardware processing. It depends on
  8021. the respective OSX.
  8022. There are many filters and image generators provided by Apple that come with a
  8023. large variety of options. The filter has to be referenced by its name along
  8024. with its options.
  8025. The coreimage filter accepts the following options:
  8026. @table @option
  8027. @item list_filters
  8028. List all available filters and generators along with all their respective
  8029. options as well as possible minimum and maximum values along with the default
  8030. values.
  8031. @example
  8032. list_filters=true
  8033. @end example
  8034. @item filter
  8035. Specify all filters by their respective name and options.
  8036. Use @var{list_filters} to determine all valid filter names and options.
  8037. Numerical options are specified by a float value and are automatically clamped
  8038. to their respective value range. Vector and color options have to be specified
  8039. by a list of space separated float values. Character escaping has to be done.
  8040. A special option name @code{default} is available to use default options for a
  8041. filter.
  8042. It is required to specify either @code{default} or at least one of the filter options.
  8043. All omitted options are used with their default values.
  8044. The syntax of the filter string is as follows:
  8045. @example
  8046. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  8047. @end example
  8048. @item output_rect
  8049. Specify a rectangle where the output of the filter chain is copied into the
  8050. input image. It is given by a list of space separated float values:
  8051. @example
  8052. output_rect=x\ y\ width\ height
  8053. @end example
  8054. If not given, the output rectangle equals the dimensions of the input image.
  8055. The output rectangle is automatically cropped at the borders of the input
  8056. image. Negative values are valid for each component.
  8057. @example
  8058. output_rect=25\ 25\ 100\ 100
  8059. @end example
  8060. @end table
  8061. Several filters can be chained for successive processing without GPU-HOST
  8062. transfers allowing for fast processing of complex filter chains.
  8063. Currently, only filters with zero (generators) or exactly one (filters) input
  8064. image and one output image are supported. Also, transition filters are not yet
  8065. usable as intended.
  8066. Some filters generate output images with additional padding depending on the
  8067. respective filter kernel. The padding is automatically removed to ensure the
  8068. filter output has the same size as the input image.
  8069. For image generators, the size of the output image is determined by the
  8070. previous output image of the filter chain or the input image of the whole
  8071. filterchain, respectively. The generators do not use the pixel information of
  8072. this image to generate their output. However, the generated output is
  8073. blended onto this image, resulting in partial or complete coverage of the
  8074. output image.
  8075. The @ref{coreimagesrc} video source can be used for generating input images
  8076. which are directly fed into the filter chain. By using it, providing input
  8077. images by another video source or an input video is not required.
  8078. @subsection Examples
  8079. @itemize
  8080. @item
  8081. List all filters available:
  8082. @example
  8083. coreimage=list_filters=true
  8084. @end example
  8085. @item
  8086. Use the CIBoxBlur filter with default options to blur an image:
  8087. @example
  8088. coreimage=filter=CIBoxBlur@@default
  8089. @end example
  8090. @item
  8091. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  8092. its center at 100x100 and a radius of 50 pixels:
  8093. @example
  8094. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  8095. @end example
  8096. @item
  8097. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  8098. given as complete and escaped command-line for Apple's standard bash shell:
  8099. @example
  8100. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  8101. @end example
  8102. @end itemize
  8103. @section corr
  8104. Obtain the correlation between two input videos.
  8105. This filter takes two input videos.
  8106. Both input videos must have the same resolution and pixel format for
  8107. this filter to work correctly. Also it assumes that both inputs
  8108. have the same number of frames, which are compared one by one.
  8109. The obtained per component, average, min and max correlation is printed through
  8110. the logging system.
  8111. The filter stores the calculated correlation of each frame in frame metadata.
  8112. This filter also supports the @ref{framesync} options.
  8113. In the below example the input file @file{main.mpg} being processed is compared
  8114. with the reference file @file{ref.mpg}.
  8115. @example
  8116. ffmpeg -i main.mpg -i ref.mpg -lavfi corr -f null -
  8117. @end example
  8118. @section cover_rect
  8119. Cover a rectangular object
  8120. It accepts the following options:
  8121. @table @option
  8122. @item cover
  8123. Filepath of the optional cover image, needs to be in yuv420.
  8124. @item mode
  8125. Set covering mode.
  8126. It accepts the following values:
  8127. @table @samp
  8128. @item cover
  8129. cover it by the supplied image
  8130. @item blur
  8131. cover it by interpolating the surrounding pixels
  8132. @end table
  8133. Default value is @var{blur}.
  8134. @end table
  8135. @subsection Examples
  8136. @itemize
  8137. @item
  8138. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8139. @example
  8140. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8141. @end example
  8142. @end itemize
  8143. @section crop
  8144. Crop the input video to given dimensions.
  8145. It accepts the following parameters:
  8146. @table @option
  8147. @item w, out_w
  8148. The width of the output video. It defaults to @code{iw}.
  8149. This expression is evaluated only once during the filter
  8150. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  8151. @item h, out_h
  8152. The height of the output video. It defaults to @code{ih}.
  8153. This expression is evaluated only once during the filter
  8154. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  8155. @item x
  8156. The horizontal position, in the input video, of the left edge of the output
  8157. video. It defaults to @code{(in_w-out_w)/2}.
  8158. This expression is evaluated per-frame.
  8159. @item y
  8160. The vertical position, in the input video, of the top edge of the output video.
  8161. It defaults to @code{(in_h-out_h)/2}.
  8162. This expression is evaluated per-frame.
  8163. @item keep_aspect
  8164. If set to 1 will force the output display aspect ratio
  8165. to be the same of the input, by changing the output sample aspect
  8166. ratio. It defaults to 0.
  8167. @item exact
  8168. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  8169. width/height/x/y as specified and will not be rounded to nearest smaller value.
  8170. It defaults to 0.
  8171. @end table
  8172. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  8173. expressions containing the following constants:
  8174. @table @option
  8175. @item x
  8176. @item y
  8177. The computed values for @var{x} and @var{y}. They are evaluated for
  8178. each new frame.
  8179. @item in_w
  8180. @item in_h
  8181. The input width and height.
  8182. @item iw
  8183. @item ih
  8184. These are the same as @var{in_w} and @var{in_h}.
  8185. @item out_w
  8186. @item out_h
  8187. The output (cropped) width and height.
  8188. @item ow
  8189. @item oh
  8190. These are the same as @var{out_w} and @var{out_h}.
  8191. @item a
  8192. same as @var{iw} / @var{ih}
  8193. @item sar
  8194. input sample aspect ratio
  8195. @item dar
  8196. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8197. @item hsub
  8198. @item vsub
  8199. horizontal and vertical chroma subsample values. For example for the
  8200. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8201. @item n
  8202. The number of the input frame, starting from 0.
  8203. @item pos
  8204. the position in the file of the input frame, NAN if unknown; deprecated,
  8205. do not use
  8206. @item t
  8207. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  8208. @end table
  8209. The expression for @var{out_w} may depend on the value of @var{out_h},
  8210. and the expression for @var{out_h} may depend on @var{out_w}, but they
  8211. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  8212. evaluated after @var{out_w} and @var{out_h}.
  8213. The @var{x} and @var{y} parameters specify the expressions for the
  8214. position of the top-left corner of the output (non-cropped) area. They
  8215. are evaluated for each frame. If the evaluated value is not valid, it
  8216. is approximated to the nearest valid value.
  8217. The expression for @var{x} may depend on @var{y}, and the expression
  8218. for @var{y} may depend on @var{x}.
  8219. @subsection Examples
  8220. @itemize
  8221. @item
  8222. Crop area with size 100x100 at position (12,34).
  8223. @example
  8224. crop=100:100:12:34
  8225. @end example
  8226. Using named options, the example above becomes:
  8227. @example
  8228. crop=w=100:h=100:x=12:y=34
  8229. @end example
  8230. @item
  8231. Crop the central input area with size 100x100:
  8232. @example
  8233. crop=100:100
  8234. @end example
  8235. @item
  8236. Crop the central input area with size 2/3 of the input video:
  8237. @example
  8238. crop=2/3*in_w:2/3*in_h
  8239. @end example
  8240. @item
  8241. Crop the input video central square:
  8242. @example
  8243. crop=out_w=in_h
  8244. crop=in_h
  8245. @end example
  8246. @item
  8247. Delimit the rectangle with the top-left corner placed at position
  8248. 100:100 and the right-bottom corner corresponding to the right-bottom
  8249. corner of the input image.
  8250. @example
  8251. crop=in_w-100:in_h-100:100:100
  8252. @end example
  8253. @item
  8254. Crop 10 pixels from the left and right borders, and 20 pixels from
  8255. the top and bottom borders
  8256. @example
  8257. crop=in_w-2*10:in_h-2*20
  8258. @end example
  8259. @item
  8260. Keep only the bottom right quarter of the input image:
  8261. @example
  8262. crop=in_w/2:in_h/2:in_w/2:in_h/2
  8263. @end example
  8264. @item
  8265. Crop height for getting Greek harmony:
  8266. @example
  8267. crop=in_w:1/PHI*in_w
  8268. @end example
  8269. @item
  8270. Apply trembling effect:
  8271. @example
  8272. 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)
  8273. @end example
  8274. @item
  8275. Apply erratic camera effect depending on timestamp:
  8276. @example
  8277. 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)
  8278. @end example
  8279. @item
  8280. Set x depending on the value of y:
  8281. @example
  8282. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  8283. @end example
  8284. @end itemize
  8285. @subsection Commands
  8286. This filter supports the following commands:
  8287. @table @option
  8288. @item w, out_w
  8289. @item h, out_h
  8290. @item x
  8291. @item y
  8292. Set width/height of the output video and the horizontal/vertical position
  8293. in the input video.
  8294. The command accepts the same syntax of the corresponding option.
  8295. If the specified expression is not valid, it is kept at its current
  8296. value.
  8297. @end table
  8298. @section cropdetect
  8299. Auto-detect the crop size.
  8300. It calculates the necessary cropping parameters and prints the
  8301. recommended parameters via the logging system. The detected dimensions
  8302. correspond to the non-black or video area of the input video according to @var{mode}.
  8303. It accepts the following parameters:
  8304. @table @option
  8305. @item mode
  8306. Depending on @var{mode} crop detection is based on either the mere black value of surrounding pixels or a combination of motion vectors and edge pixels.
  8307. @table @samp
  8308. @item black
  8309. Detect black pixels surrounding the playing video. For fine control use option @var{limit}.
  8310. @item mvedges
  8311. Detect the playing video by the motion vectors inside the video and scanning for edge pixels typically forming the border of a playing video.
  8312. @end table
  8313. @item limit
  8314. Set higher black value threshold, which can be optionally specified
  8315. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  8316. value greater to the set value is considered non-black. It defaults to 24.
  8317. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  8318. on the bitdepth of the pixel format.
  8319. @item round
  8320. The value which the width/height should be divisible by. It defaults to
  8321. 16. The offset is automatically adjusted to center the video. Use 2 to
  8322. get only even dimensions (needed for 4:2:2 video). 16 is best when
  8323. encoding to most video codecs.
  8324. @item skip
  8325. Set the number of initial frames for which evaluation is skipped.
  8326. Default is 2. Range is 0 to INT_MAX.
  8327. @item reset_count, reset
  8328. Set the counter that determines after how many frames cropdetect will
  8329. reset the previously detected largest video area and start over to
  8330. detect the current optimal crop area. Default value is 0.
  8331. This can be useful when channel logos distort the video area. 0
  8332. indicates 'never reset', and returns the largest area encountered during
  8333. playback.
  8334. @item mv_threshold
  8335. Set motion in pixel units as threshold for motion detection. It defaults to 8.
  8336. @item low
  8337. @item high
  8338. Set low and high threshold values used by the Canny thresholding
  8339. algorithm.
  8340. The high threshold selects the "strong" edge pixels, which are then
  8341. connected through 8-connectivity with the "weak" edge pixels selected
  8342. by the low threshold.
  8343. @var{low} and @var{high} threshold values must be chosen in the range
  8344. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8345. Default value for @var{low} is @code{5/255}, and default value for @var{high}
  8346. is @code{15/255}.
  8347. @end table
  8348. @subsection Examples
  8349. @itemize
  8350. @item
  8351. Find video area surrounded by black borders:
  8352. @example
  8353. ffmpeg -i file.mp4 -vf cropdetect,metadata=mode=print -f null -
  8354. @end example
  8355. @item
  8356. Find an embedded video area, generate motion vectors beforehand:
  8357. @example
  8358. ffmpeg -i file.mp4 -vf mestimate,cropdetect=mode=mvedges,metadata=mode=print -f null -
  8359. @end example
  8360. @item
  8361. Find an embedded video area, use motion vectors from decoder:
  8362. @example
  8363. ffmpeg -flags2 +export_mvs -i file.mp4 -vf cropdetect=mode=mvedges,metadata=mode=print -f null -
  8364. @end example
  8365. @end itemize
  8366. @subsection Commands
  8367. This filter supports the following commands:
  8368. @table @option
  8369. @item limit
  8370. The command accepts the same syntax of the corresponding option.
  8371. If the specified expression is not valid, it is kept at its current value.
  8372. @end table
  8373. @anchor{cue}
  8374. @section cue
  8375. Delay video filtering until a given wallclock timestamp. The filter first
  8376. passes on @option{preroll} amount of frames, then it buffers at most
  8377. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  8378. it forwards the buffered frames and also any subsequent frames coming in its
  8379. input.
  8380. The filter can be used synchronize the output of multiple ffmpeg processes for
  8381. realtime output devices like decklink. By putting the delay in the filtering
  8382. chain and pre-buffering frames the process can pass on data to output almost
  8383. immediately after the target wallclock timestamp is reached.
  8384. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  8385. some use cases.
  8386. @table @option
  8387. @item cue
  8388. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  8389. @item preroll
  8390. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  8391. @item buffer
  8392. The maximum duration of content to buffer before waiting for the cue expressed
  8393. in seconds. Default is 0.
  8394. @end table
  8395. @anchor{curves}
  8396. @section curves
  8397. Apply color adjustments using curves.
  8398. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  8399. component (red, green and blue) has its values defined by @var{N} key points
  8400. tied from each other using a smooth curve. The x-axis represents the pixel
  8401. values from the input frame, and the y-axis the new pixel values to be set for
  8402. the output frame.
  8403. By default, a component curve is defined by the two points @var{(0;0)} and
  8404. @var{(1;1)}. This creates a straight line where each original pixel value is
  8405. "adjusted" to its own value, which means no change to the image.
  8406. The filter allows you to redefine these two points and add some more. A new
  8407. curve will be defined to pass smoothly through all these new coordinates. The
  8408. new defined points need to be strictly increasing over the x-axis, and their
  8409. @var{x} and @var{y} values must be in the @var{[0;1]} interval. The curve is
  8410. formed by using a natural or monotonic cubic spline interpolation, depending
  8411. on the @var{interp} option (default: @code{natural}). The @code{natural}
  8412. spline produces a smoother curve in general while the monotonic (@code{pchip})
  8413. spline guarantees the transitions between the specified points to be
  8414. monotonic. If the computed curves happened to go outside the vector spaces,
  8415. the values will be clipped accordingly.
  8416. The filter accepts the following options:
  8417. @table @option
  8418. @item preset
  8419. Select one of the available color presets. This option can be used in addition
  8420. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  8421. options takes priority on the preset values.
  8422. Available presets are:
  8423. @table @samp
  8424. @item none
  8425. @item color_negative
  8426. @item cross_process
  8427. @item darker
  8428. @item increase_contrast
  8429. @item lighter
  8430. @item linear_contrast
  8431. @item medium_contrast
  8432. @item negative
  8433. @item strong_contrast
  8434. @item vintage
  8435. @end table
  8436. Default is @code{none}.
  8437. @item master, m
  8438. Set the master key points. These points will define a second pass mapping. It
  8439. is sometimes called a "luminance" or "value" mapping. It can be used with
  8440. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  8441. post-processing LUT.
  8442. @item red, r
  8443. Set the key points for the red component.
  8444. @item green, g
  8445. Set the key points for the green component.
  8446. @item blue, b
  8447. Set the key points for the blue component.
  8448. @item all
  8449. Set the key points for all components (not including master).
  8450. Can be used in addition to the other key points component
  8451. options. In this case, the unset component(s) will fallback on this
  8452. @option{all} setting.
  8453. @item psfile
  8454. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  8455. @item plot
  8456. Save Gnuplot script of the curves in specified file.
  8457. @item interp
  8458. Specify the kind of interpolation. Available algorithms are:
  8459. @table @samp
  8460. @item natural
  8461. Natural cubic spline using a piece-wise cubic polynomial that is twice continuously differentiable.
  8462. @item pchip
  8463. Monotonic cubic spline using a piecewise cubic Hermite interpolating polynomial (PCHIP).
  8464. @end table
  8465. @end table
  8466. To avoid some filtergraph syntax conflicts, each key points list need to be
  8467. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  8468. @subsection Commands
  8469. This filter supports same @ref{commands} as options.
  8470. @subsection Examples
  8471. @itemize
  8472. @item
  8473. Increase slightly the middle level of blue:
  8474. @example
  8475. curves=blue='0/0 0.5/0.58 1/1'
  8476. @end example
  8477. @item
  8478. Vintage effect:
  8479. @example
  8480. 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'
  8481. @end example
  8482. Here we obtain the following coordinates for each components:
  8483. @table @var
  8484. @item red
  8485. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  8486. @item green
  8487. @code{(0;0) (0.50;0.48) (1;1)}
  8488. @item blue
  8489. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  8490. @end table
  8491. @item
  8492. The previous example can also be achieved with the associated built-in preset:
  8493. @example
  8494. curves=preset=vintage
  8495. @end example
  8496. @item
  8497. Or simply:
  8498. @example
  8499. curves=vintage
  8500. @end example
  8501. @item
  8502. Use a Photoshop preset and redefine the points of the green component:
  8503. @example
  8504. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  8505. @end example
  8506. @item
  8507. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  8508. and @command{gnuplot}:
  8509. @example
  8510. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  8511. gnuplot -p /tmp/curves.plt
  8512. @end example
  8513. @end itemize
  8514. @section datascope
  8515. Video data analysis filter.
  8516. This filter shows hexadecimal pixel values of part of video.
  8517. The filter accepts the following options:
  8518. @table @option
  8519. @item size, s
  8520. Set output video size.
  8521. @item x
  8522. Set x offset from where to pick pixels.
  8523. @item y
  8524. Set y offset from where to pick pixels.
  8525. @item mode
  8526. Set scope mode, can be one of the following:
  8527. @table @samp
  8528. @item mono
  8529. Draw hexadecimal pixel values with white color on black background.
  8530. @item color
  8531. Draw hexadecimal pixel values with input video pixel color on black
  8532. background.
  8533. @item color2
  8534. Draw hexadecimal pixel values on color background picked from input video,
  8535. the text color is picked in such way so its always visible.
  8536. @end table
  8537. @item axis
  8538. Draw rows and columns numbers on left and top of video.
  8539. @item opacity
  8540. Set background opacity.
  8541. @item format
  8542. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  8543. @item components
  8544. Set pixel components to display. By default all pixel components are displayed.
  8545. @end table
  8546. @subsection Commands
  8547. This filter supports same @ref{commands} as options excluding @code{size} option.
  8548. @section dblur
  8549. Apply Directional blur filter.
  8550. The filter accepts the following options:
  8551. @table @option
  8552. @item angle
  8553. Set angle of directional blur. Default is @code{45}.
  8554. @item radius
  8555. Set radius of directional blur. Default is @code{5}.
  8556. @item planes
  8557. Set which planes to filter. By default all planes are filtered.
  8558. @end table
  8559. @subsection Commands
  8560. This filter supports same @ref{commands} as options.
  8561. The command accepts the same syntax of the corresponding option.
  8562. If the specified expression is not valid, it is kept at its current
  8563. value.
  8564. @section dctdnoiz
  8565. Denoise frames using 2D DCT (frequency domain filtering).
  8566. This filter is not designed for real time.
  8567. The filter accepts the following options:
  8568. @table @option
  8569. @item sigma, s
  8570. Set the noise sigma constant.
  8571. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  8572. coefficient (absolute value) below this threshold with be dropped.
  8573. If you need a more advanced filtering, see @option{expr}.
  8574. Default is @code{0}.
  8575. @item overlap
  8576. Set number overlapping pixels for each block. Since the filter can be slow, you
  8577. may want to reduce this value, at the cost of a less effective filter and the
  8578. risk of various artefacts.
  8579. If the overlapping value doesn't permit processing the whole input width or
  8580. height, a warning will be displayed and according borders won't be denoised.
  8581. Default value is @var{blocksize}-1, which is the best possible setting.
  8582. @item expr, e
  8583. Set the coefficient factor expression.
  8584. For each coefficient of a DCT block, this expression will be evaluated as a
  8585. multiplier value for the coefficient.
  8586. If this is option is set, the @option{sigma} option will be ignored.
  8587. The absolute value of the coefficient can be accessed through the @var{c}
  8588. variable.
  8589. @item n
  8590. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  8591. @var{blocksize}, which is the width and height of the processed blocks.
  8592. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  8593. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  8594. on the speed processing. Also, a larger block size does not necessarily means a
  8595. better de-noising.
  8596. @end table
  8597. @subsection Examples
  8598. Apply a denoise with a @option{sigma} of @code{4.5}:
  8599. @example
  8600. dctdnoiz=4.5
  8601. @end example
  8602. The same operation can be achieved using the expression system:
  8603. @example
  8604. dctdnoiz=e='gte(c, 4.5*3)'
  8605. @end example
  8606. Violent denoise using a block size of @code{16x16}:
  8607. @example
  8608. dctdnoiz=15:n=4
  8609. @end example
  8610. @section deband
  8611. Remove banding artifacts from input video.
  8612. It works by replacing banded pixels with average value of referenced pixels.
  8613. The filter accepts the following options:
  8614. @table @option
  8615. @item 1thr
  8616. @item 2thr
  8617. @item 3thr
  8618. @item 4thr
  8619. Set banding detection threshold for each plane. Default is 0.02.
  8620. Valid range is 0.00003 to 0.5.
  8621. If difference between current pixel and reference pixel is less than threshold,
  8622. it will be considered as banded.
  8623. @item range, r
  8624. Banding detection range in pixels. Default is 16. If positive, random number
  8625. in range 0 to set value will be used. If negative, exact absolute value
  8626. will be used.
  8627. The range defines square of four pixels around current pixel.
  8628. @item direction, d
  8629. Set direction in radians from which four pixel will be compared. If positive,
  8630. random direction from 0 to set direction will be picked. If negative, exact of
  8631. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  8632. will pick only pixels on same row and -PI/2 will pick only pixels on same
  8633. column.
  8634. @item blur, b
  8635. If enabled, current pixel is compared with average value of all four
  8636. surrounding pixels. The default is enabled. If disabled current pixel is
  8637. compared with all four surrounding pixels. The pixel is considered banded
  8638. if only all four differences with surrounding pixels are less than threshold.
  8639. @item coupling, c
  8640. If enabled, current pixel is changed if and only if all pixel components are banded,
  8641. e.g. banding detection threshold is triggered for all color components.
  8642. The default is disabled.
  8643. @end table
  8644. @subsection Commands
  8645. This filter supports the all above options as @ref{commands}.
  8646. @section deblock
  8647. Remove blocking artifacts from input video.
  8648. The filter accepts the following options:
  8649. @table @option
  8650. @item filter
  8651. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  8652. This controls what kind of deblocking is applied.
  8653. @item block
  8654. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  8655. @item alpha
  8656. @item beta
  8657. @item gamma
  8658. @item delta
  8659. Set blocking detection thresholds. Allowed range is 0 to 1.
  8660. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  8661. Using higher threshold gives more deblocking strength.
  8662. Setting @var{alpha} controls threshold detection at exact edge of block.
  8663. Remaining options controls threshold detection near the edge. Each one for
  8664. below/above or left/right. Setting any of those to @var{0} disables
  8665. deblocking.
  8666. @item planes
  8667. Set planes to filter. Default is to filter all available planes.
  8668. @end table
  8669. @subsection Examples
  8670. @itemize
  8671. @item
  8672. Deblock using weak filter and block size of 4 pixels.
  8673. @example
  8674. deblock=filter=weak:block=4
  8675. @end example
  8676. @item
  8677. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  8678. deblocking more edges.
  8679. @example
  8680. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  8681. @end example
  8682. @item
  8683. Similar as above, but filter only first plane.
  8684. @example
  8685. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  8686. @end example
  8687. @item
  8688. Similar as above, but filter only second and third plane.
  8689. @example
  8690. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  8691. @end example
  8692. @end itemize
  8693. @subsection Commands
  8694. This filter supports the all above options as @ref{commands}.
  8695. @anchor{decimate}
  8696. @section decimate
  8697. Drop duplicated frames at regular intervals.
  8698. The filter accepts the following options:
  8699. @table @option
  8700. @item cycle
  8701. Set the number of frames from which one will be dropped. Setting this to
  8702. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  8703. Default is @code{5}.
  8704. @item dupthresh
  8705. Set the threshold for duplicate detection. If the difference metric for a frame
  8706. is less than or equal to this value, then it is declared as duplicate. Default
  8707. is @code{1.1}
  8708. @item scthresh
  8709. Set scene change threshold. Default is @code{15}.
  8710. @item blockx
  8711. @item blocky
  8712. Set the size of the x and y-axis blocks used during metric calculations.
  8713. Larger blocks give better noise suppression, but also give worse detection of
  8714. small movements. Must be a power of two. Default is @code{32}.
  8715. @item ppsrc
  8716. Mark main input as a pre-processed input and activate clean source input
  8717. stream. This allows the input to be pre-processed with various filters to help
  8718. the metrics calculation while keeping the frame selection lossless. When set to
  8719. @code{1}, the first stream is for the pre-processed input, and the second
  8720. stream is the clean source from where the kept frames are chosen. Default is
  8721. @code{0}.
  8722. @item chroma
  8723. Set whether or not chroma is considered in the metric calculations. Default is
  8724. @code{1}.
  8725. @item mixed
  8726. Set whether or not the input only partially contains content to be decimated.
  8727. Default is @code{false}.
  8728. If enabled video output stream will be in variable frame rate.
  8729. @end table
  8730. @section deconvolve
  8731. Apply 2D deconvolution of video stream in frequency domain using second stream
  8732. as impulse.
  8733. The filter accepts the following options:
  8734. @table @option
  8735. @item planes
  8736. Set which planes to process.
  8737. @item impulse
  8738. Set which impulse video frames will be processed, can be @var{first}
  8739. or @var{all}. Default is @var{all}.
  8740. @item noise
  8741. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  8742. and height are not same and not power of 2 or if stream prior to convolving
  8743. had noise.
  8744. @end table
  8745. The @code{deconvolve} filter also supports the @ref{framesync} options.
  8746. @section dedot
  8747. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  8748. It accepts the following options:
  8749. @table @option
  8750. @item m
  8751. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  8752. @var{rainbows} for cross-color reduction.
  8753. @item lt
  8754. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  8755. @item tl
  8756. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  8757. @item tc
  8758. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  8759. @item ct
  8760. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  8761. @end table
  8762. @section deflate
  8763. Apply deflate effect to the video.
  8764. This filter replaces the pixel by the local(3x3) average by taking into account
  8765. only values lower than the pixel.
  8766. It accepts the following options:
  8767. @table @option
  8768. @item threshold0
  8769. @item threshold1
  8770. @item threshold2
  8771. @item threshold3
  8772. Limit the maximum change for each plane, default is 65535.
  8773. If 0, plane will remain unchanged.
  8774. @end table
  8775. @subsection Commands
  8776. This filter supports the all above options as @ref{commands}.
  8777. @section deflicker
  8778. Remove temporal frame luminance variations.
  8779. It accepts the following options:
  8780. @table @option
  8781. @item size, s
  8782. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  8783. @item mode, m
  8784. Set averaging mode to smooth temporal luminance variations.
  8785. Available values are:
  8786. @table @samp
  8787. @item am
  8788. Arithmetic mean
  8789. @item gm
  8790. Geometric mean
  8791. @item hm
  8792. Harmonic mean
  8793. @item qm
  8794. Quadratic mean
  8795. @item cm
  8796. Cubic mean
  8797. @item pm
  8798. Power mean
  8799. @item median
  8800. Median
  8801. @end table
  8802. @item bypass
  8803. Do not actually modify frame. Useful when one only wants metadata.
  8804. @end table
  8805. @section dejudder
  8806. Remove judder produced by partially interlaced telecined content.
  8807. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8808. source was partially telecined content then the output of @code{pullup,dejudder}
  8809. will have a variable frame rate. May change the recorded frame rate of the
  8810. container. Aside from that change, this filter will not affect constant frame
  8811. rate video.
  8812. The option available in this filter is:
  8813. @table @option
  8814. @item cycle
  8815. Specify the length of the window over which the judder repeats.
  8816. Accepts any integer greater than 1. Useful values are:
  8817. @table @samp
  8818. @item 4
  8819. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8820. @item 5
  8821. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8822. @item 20
  8823. If a mixture of the two.
  8824. @end table
  8825. The default is @samp{4}.
  8826. @end table
  8827. @section delogo
  8828. Suppress a TV station logo by a simple interpolation of the surrounding
  8829. pixels. Just set a rectangle covering the logo and watch it disappear
  8830. (and sometimes something even uglier appear - your mileage may vary).
  8831. It accepts the following parameters:
  8832. @table @option
  8833. @item x
  8834. @item y
  8835. Specify the top left corner coordinates of the logo. They must be
  8836. specified.
  8837. @item w
  8838. @item h
  8839. Specify the width and height of the logo to clear. They must be
  8840. specified.
  8841. @item show
  8842. When set to 1, a green rectangle is drawn on the screen to simplify
  8843. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8844. The default value is 0.
  8845. The rectangle is drawn on the outermost pixels which will be (partly)
  8846. replaced with interpolated values. The values of the next pixels
  8847. immediately outside this rectangle in each direction will be used to
  8848. compute the interpolated pixel values inside the rectangle.
  8849. @end table
  8850. @subsection Examples
  8851. @itemize
  8852. @item
  8853. Set a rectangle covering the area with top left corner coordinates 0,0
  8854. and size 100x77:
  8855. @example
  8856. delogo=x=0:y=0:w=100:h=77
  8857. @end example
  8858. @end itemize
  8859. @anchor{derain}
  8860. @section derain
  8861. Remove the rain in the input image/video by applying the derain methods based on
  8862. convolutional neural networks. Supported models:
  8863. @itemize
  8864. @item
  8865. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8866. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8867. @end itemize
  8868. Training as well as model generation scripts are provided in
  8869. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8870. The filter accepts the following options:
  8871. @table @option
  8872. @item filter_type
  8873. Specify which filter to use. This option accepts the following values:
  8874. @table @samp
  8875. @item derain
  8876. Derain filter. To conduct derain filter, you need to use a derain model.
  8877. @item dehaze
  8878. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  8879. @end table
  8880. Default value is @samp{derain}.
  8881. @item dnn_backend
  8882. Specify which DNN backend to use for model loading and execution. This option accepts
  8883. the following values:
  8884. @table @samp
  8885. @item tensorflow
  8886. TensorFlow backend. To enable this backend you
  8887. need to install the TensorFlow for C library (see
  8888. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8889. @code{--enable-libtensorflow}
  8890. @end table
  8891. @item model
  8892. Set path to model file specifying network architecture and its parameters.
  8893. Note that different backends use different file formats. TensorFlow can load files for only its format.
  8894. @end table
  8895. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  8896. @section deshake
  8897. Attempt to fix small changes in horizontal and/or vertical shift. This
  8898. filter helps remove camera shake from hand-holding a camera, bumping a
  8899. tripod, moving on a vehicle, etc.
  8900. The filter accepts the following options:
  8901. @table @option
  8902. @item x
  8903. @item y
  8904. @item w
  8905. @item h
  8906. Specify a rectangular area where to limit the search for motion
  8907. vectors.
  8908. If desired the search for motion vectors can be limited to a
  8909. rectangular area of the frame defined by its top left corner, width
  8910. and height. These parameters have the same meaning as the drawbox
  8911. filter which can be used to visualise the position of the bounding
  8912. box.
  8913. This is useful when simultaneous movement of subjects within the frame
  8914. might be confused for camera motion by the motion vector search.
  8915. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  8916. then the full frame is used. This allows later options to be set
  8917. without specifying the bounding box for the motion vector search.
  8918. Default - search the whole frame.
  8919. @item rx
  8920. @item ry
  8921. Specify the maximum extent of movement in x and y directions in the
  8922. range 0-64 pixels. Default 16.
  8923. @item edge
  8924. Specify how to generate pixels to fill blanks at the edge of the
  8925. frame. Available values are:
  8926. @table @samp
  8927. @item blank, 0
  8928. Fill zeroes at blank locations
  8929. @item original, 1
  8930. Original image at blank locations
  8931. @item clamp, 2
  8932. Extruded edge value at blank locations
  8933. @item mirror, 3
  8934. Mirrored edge at blank locations
  8935. @end table
  8936. Default value is @samp{mirror}.
  8937. @item blocksize
  8938. Specify the blocksize to use for motion search. Range 4-128 pixels,
  8939. default 8.
  8940. @item contrast
  8941. Specify the contrast threshold for blocks. Only blocks with more than
  8942. the specified contrast (difference between darkest and lightest
  8943. pixels) will be considered. Range 1-255, default 125.
  8944. @item search
  8945. Specify the search strategy. Available values are:
  8946. @table @samp
  8947. @item exhaustive, 0
  8948. Set exhaustive search
  8949. @item less, 1
  8950. Set less exhaustive search.
  8951. @end table
  8952. Default value is @samp{exhaustive}.
  8953. @item filename
  8954. If set then a detailed log of the motion search is written to the
  8955. specified file.
  8956. @end table
  8957. @section despill
  8958. Remove unwanted contamination of foreground colors, caused by reflected color of
  8959. greenscreen or bluescreen.
  8960. This filter accepts the following options:
  8961. @table @option
  8962. @item type
  8963. Set what type of despill to use.
  8964. @item mix
  8965. Set how spillmap will be generated.
  8966. @item expand
  8967. Set how much to get rid of still remaining spill.
  8968. @item red
  8969. Controls amount of red in spill area.
  8970. @item green
  8971. Controls amount of green in spill area.
  8972. Should be -1 for greenscreen.
  8973. @item blue
  8974. Controls amount of blue in spill area.
  8975. Should be -1 for bluescreen.
  8976. @item brightness
  8977. Controls brightness of spill area, preserving colors.
  8978. @item alpha
  8979. Modify alpha from generated spillmap.
  8980. @end table
  8981. @subsection Commands
  8982. This filter supports the all above options as @ref{commands}.
  8983. @section detelecine
  8984. Apply an exact inverse of the telecine operation. It requires a predefined
  8985. pattern specified using the pattern option which must be the same as that passed
  8986. to the telecine filter.
  8987. This filter accepts the following options:
  8988. @table @option
  8989. @item first_field
  8990. @table @samp
  8991. @item top, t
  8992. top field first
  8993. @item bottom, b
  8994. bottom field first
  8995. The default value is @code{top}.
  8996. @end table
  8997. @item pattern
  8998. A string of numbers representing the pulldown pattern you wish to apply.
  8999. The default value is @code{23}.
  9000. @item start_frame
  9001. A number representing position of the first frame with respect to the telecine
  9002. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  9003. @end table
  9004. @anchor{dilation}
  9005. @section dilation
  9006. Apply dilation effect to the video.
  9007. This filter replaces the pixel by the local(3x3) maximum.
  9008. It accepts the following options:
  9009. @table @option
  9010. @item threshold0
  9011. @item threshold1
  9012. @item threshold2
  9013. @item threshold3
  9014. Limit the maximum change for each plane, default is 65535.
  9015. If 0, plane will remain unchanged.
  9016. @item coordinates
  9017. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9018. pixels are used.
  9019. Flags to local 3x3 coordinates maps like this:
  9020. 1 2 3
  9021. 4 5
  9022. 6 7 8
  9023. @end table
  9024. @subsection Commands
  9025. This filter supports the all above options as @ref{commands}.
  9026. @section displace
  9027. Displace pixels as indicated by second and third input stream.
  9028. It takes three input streams and outputs one stream, the first input is the
  9029. source, and second and third input are displacement maps.
  9030. The second input specifies how much to displace pixels along the
  9031. x-axis, while the third input specifies how much to displace pixels
  9032. along the y-axis.
  9033. If one of displacement map streams terminates, last frame from that
  9034. displacement map will be used.
  9035. Note that once generated, displacements maps can be reused over and over again.
  9036. A description of the accepted options follows.
  9037. @table @option
  9038. @item edge
  9039. Set displace behavior for pixels that are out of range.
  9040. Available values are:
  9041. @table @samp
  9042. @item blank
  9043. Missing pixels are replaced by black pixels.
  9044. @item smear
  9045. Adjacent pixels will spread out to replace missing pixels.
  9046. @item wrap
  9047. Out of range pixels are wrapped so they point to pixels of other side.
  9048. @item mirror
  9049. Out of range pixels will be replaced with mirrored pixels.
  9050. @end table
  9051. Default is @samp{smear}.
  9052. @end table
  9053. @subsection Examples
  9054. @itemize
  9055. @item
  9056. Add ripple effect to rgb input of video size hd720:
  9057. @example
  9058. 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
  9059. @end example
  9060. @item
  9061. Add wave effect to rgb input of video size hd720:
  9062. @example
  9063. 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
  9064. @end example
  9065. @end itemize
  9066. @section dnn_classify
  9067. Do classification with deep neural networks based on bounding boxes.
  9068. The filter accepts the following options:
  9069. @table @option
  9070. @item dnn_backend
  9071. Specify which DNN backend to use for model loading and execution. This option accepts
  9072. only openvino now, tensorflow backends will be added.
  9073. @item model
  9074. Set path to model file specifying network architecture and its parameters.
  9075. Note that different backends use different file formats.
  9076. @item input
  9077. Set the input name of the dnn network.
  9078. @item output
  9079. Set the output name of the dnn network.
  9080. @item confidence
  9081. Set the confidence threshold (default: 0.5).
  9082. @item labels
  9083. Set path to label file specifying the mapping between label id and name.
  9084. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9085. The first line is the name of label id 0,
  9086. and the second line is the name of label id 1, etc.
  9087. The label id is considered as name if the label file is not provided.
  9088. @item backend_configs
  9089. Set the configs to be passed into backend
  9090. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9091. please use tools/python/tf_sess_config.py to get the configs for your system.
  9092. @end table
  9093. @section dnn_detect
  9094. Do object detection with deep neural networks.
  9095. The filter accepts the following options:
  9096. @table @option
  9097. @item dnn_backend
  9098. Specify which DNN backend to use for model loading and execution. This option accepts
  9099. only openvino now, tensorflow backends will be added.
  9100. @item model
  9101. Set path to model file specifying network architecture and its parameters.
  9102. Note that different backends use different file formats.
  9103. @item input
  9104. Set the input name of the dnn network.
  9105. @item output
  9106. Set the output name of the dnn network.
  9107. @item confidence
  9108. Set the confidence threshold (default: 0.5).
  9109. @item labels
  9110. Set path to label file specifying the mapping between label id and name.
  9111. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9112. The first line is the name of label id 0 (usually it is 'background'),
  9113. and the second line is the name of label id 1, etc.
  9114. The label id is considered as name if the label file is not provided.
  9115. @item backend_configs
  9116. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9117. Roll back to sync execution if the backend does not support async.
  9118. @end table
  9119. @anchor{dnn_processing}
  9120. @section dnn_processing
  9121. Do image processing with deep neural networks. It works together with another filter
  9122. which converts the pixel format of the Frame to what the dnn network requires.
  9123. The filter accepts the following options:
  9124. @table @option
  9125. @item dnn_backend
  9126. Specify which DNN backend to use for model loading and execution. This option accepts
  9127. the following values:
  9128. @table @samp
  9129. @item tensorflow
  9130. TensorFlow backend. To enable this backend you
  9131. need to install the TensorFlow for C library (see
  9132. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  9133. @code{--enable-libtensorflow}
  9134. @item openvino
  9135. OpenVINO backend. To enable this backend you
  9136. need to build and install the OpenVINO for C library (see
  9137. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  9138. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  9139. be needed if the header files and libraries are not installed into system path)
  9140. @item torch
  9141. Libtorch backend. To enable this backend you need to build and install Libtroch
  9142. for C++ library. Please download cxx11 ABI version (see
  9143. @url{https://pytorch.org/get-started/locally})
  9144. and configure FFmpeg with @code{--enable-libtorch
  9145. --extra-cflags=-I/libtorch_root/libtorch/include
  9146. --extra-cflags=-I/libtorch_root/libtorch/include/torch/csrc/api/include
  9147. --extra-ldflags=-L/libtorch_root/libtorch/lib/}
  9148. @end table
  9149. @item model
  9150. Set path to model file specifying network architecture and its parameters.
  9151. Note that different backends use different file formats. TensorFlow, OpenVINO
  9152. and Libtorch backend can load files for only its format.
  9153. @item input
  9154. Set the input name of the dnn network.
  9155. @item output
  9156. Set the output name of the dnn network.
  9157. @item backend_configs
  9158. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9159. Roll back to sync execution if the backend does not support async.
  9160. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9161. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9162. @end table
  9163. @subsection Examples
  9164. @itemize
  9165. @item
  9166. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  9167. @example
  9168. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  9169. @end example
  9170. @item
  9171. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  9172. @example
  9173. ./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
  9174. @end example
  9175. @item
  9176. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  9177. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9178. @example
  9179. ./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
  9180. @end example
  9181. @end itemize
  9182. @section drawbox
  9183. Draw a colored box on the input image.
  9184. It accepts the following parameters:
  9185. @table @option
  9186. @item x
  9187. @item y
  9188. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  9189. @item width, w
  9190. @item height, h
  9191. The expressions which specify the width and height of the box; if 0 they are interpreted as
  9192. the input width and height. It defaults to 0.
  9193. @item color, c
  9194. Specify the color of the box to write. For the general syntax of this option,
  9195. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9196. value @code{invert} is used, the box edge color is the same as the
  9197. video with inverted luma.
  9198. @item thickness, t
  9199. The expression which sets the thickness of the box edge.
  9200. A value of @code{fill} will create a filled box. Default value is @code{3}.
  9201. See below for the list of accepted constants.
  9202. @item replace
  9203. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  9204. will overwrite the video's color and alpha pixels.
  9205. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  9206. @end table
  9207. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9208. following constants:
  9209. @table @option
  9210. @item dar
  9211. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9212. @item hsub
  9213. @item vsub
  9214. horizontal and vertical chroma subsample values. For example for the
  9215. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9216. @item in_h, ih
  9217. @item in_w, iw
  9218. The input width and height.
  9219. @item sar
  9220. The input sample aspect ratio.
  9221. @item x
  9222. @item y
  9223. The x and y offset coordinates where the box is drawn.
  9224. @item w
  9225. @item h
  9226. The width and height of the drawn box.
  9227. @item box_source
  9228. Box source can be set as side_data_detection_bboxes if you want to use box data in
  9229. detection bboxes of side data.
  9230. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  9231. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  9232. not sure about the box source.
  9233. @item t
  9234. The thickness of the drawn box.
  9235. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9236. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9237. @end table
  9238. @subsection Examples
  9239. @itemize
  9240. @item
  9241. Draw a black box around the edge of the input image:
  9242. @example
  9243. drawbox
  9244. @end example
  9245. @item
  9246. Draw a box with color red and an opacity of 50%:
  9247. @example
  9248. drawbox=10:20:200:60:red@@0.5
  9249. @end example
  9250. The previous example can be specified as:
  9251. @example
  9252. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  9253. @end example
  9254. @item
  9255. Fill the box with pink color:
  9256. @example
  9257. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  9258. @end example
  9259. @item
  9260. Draw a 2-pixel red 2.40:1 mask:
  9261. @example
  9262. 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
  9263. @end example
  9264. @end itemize
  9265. @subsection Commands
  9266. This filter supports same commands as options.
  9267. The command accepts the same syntax of the corresponding option.
  9268. If the specified expression is not valid, it is kept at its current
  9269. value.
  9270. @anchor{drawgraph}
  9271. @section drawgraph
  9272. Draw a graph using input video metadata.
  9273. It accepts the following parameters:
  9274. @table @option
  9275. @item m1
  9276. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  9277. @item fg1
  9278. Set 1st foreground color expression.
  9279. @item m2
  9280. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  9281. @item fg2
  9282. Set 2nd foreground color expression.
  9283. @item m3
  9284. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  9285. @item fg3
  9286. Set 3rd foreground color expression.
  9287. @item m4
  9288. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  9289. @item fg4
  9290. Set 4th foreground color expression.
  9291. @item min
  9292. Set minimal value of metadata value.
  9293. @item max
  9294. Set maximal value of metadata value.
  9295. @item bg
  9296. Set graph background color. Default is white.
  9297. @item mode
  9298. Set graph mode.
  9299. Available values for mode is:
  9300. @table @samp
  9301. @item bar
  9302. @item dot
  9303. @item line
  9304. @end table
  9305. Default is @code{line}.
  9306. @item slide
  9307. Set slide mode.
  9308. Available values for slide is:
  9309. @table @samp
  9310. @item frame
  9311. Draw new frame when right border is reached.
  9312. @item replace
  9313. Replace old columns with new ones.
  9314. @item scroll
  9315. Scroll from right to left.
  9316. @item rscroll
  9317. Scroll from left to right.
  9318. @item picture
  9319. Draw single picture.
  9320. @end table
  9321. Default is @code{frame}.
  9322. @item size
  9323. Set size of graph video. For the syntax of this option, check the
  9324. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9325. The default value is @code{900x256}.
  9326. @item rate, r
  9327. Set the output frame rate. Default value is @code{25}.
  9328. The foreground color expressions can use the following variables:
  9329. @table @option
  9330. @item MIN
  9331. Minimal value of metadata value.
  9332. @item MAX
  9333. Maximal value of metadata value.
  9334. @item VAL
  9335. Current metadata key value.
  9336. @end table
  9337. The color is defined as 0xAABBGGRR.
  9338. @end table
  9339. Example using metadata from @ref{signalstats} filter:
  9340. @example
  9341. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  9342. @end example
  9343. Example using metadata from @ref{ebur128} filter:
  9344. @example
  9345. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  9346. @end example
  9347. @section drawgrid
  9348. Draw a grid on the input image.
  9349. It accepts the following parameters:
  9350. @table @option
  9351. @item x
  9352. @item y
  9353. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  9354. @item width, w
  9355. @item height, h
  9356. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  9357. input width and height, respectively, minus @code{thickness}, so image gets
  9358. framed. Default to 0.
  9359. @item color, c
  9360. Specify the color of the grid. For the general syntax of this option,
  9361. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9362. value @code{invert} is used, the grid color is the same as the
  9363. video with inverted luma.
  9364. @item thickness, t
  9365. The expression which sets the thickness of the grid line. Default value is @code{1}.
  9366. See below for the list of accepted constants.
  9367. @item replace
  9368. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  9369. will overwrite the video's color and alpha pixels.
  9370. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  9371. @end table
  9372. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9373. following constants:
  9374. @table @option
  9375. @item dar
  9376. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9377. @item hsub
  9378. @item vsub
  9379. horizontal and vertical chroma subsample values. For example for the
  9380. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9381. @item in_h, ih
  9382. @item in_w, iw
  9383. The input grid cell width and height.
  9384. @item sar
  9385. The input sample aspect ratio.
  9386. @item x
  9387. @item y
  9388. The x and y coordinates of some point of grid intersection (meant to configure offset).
  9389. @item w
  9390. @item h
  9391. The width and height of the drawn cell.
  9392. @item t
  9393. The thickness of the drawn cell.
  9394. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9395. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9396. @end table
  9397. @subsection Examples
  9398. @itemize
  9399. @item
  9400. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  9401. @example
  9402. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  9403. @end example
  9404. @item
  9405. Draw a white 3x3 grid with an opacity of 50%:
  9406. @example
  9407. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  9408. @end example
  9409. @end itemize
  9410. @subsection Commands
  9411. This filter supports same commands as options.
  9412. The command accepts the same syntax of the corresponding option.
  9413. If the specified expression is not valid, it is kept at its current
  9414. value.
  9415. @anchor{drawtext}
  9416. @section drawtext
  9417. Draw a text string or text from a specified file on top of a video, using the
  9418. libfreetype library.
  9419. To enable compilation of this filter, you need to configure FFmpeg with
  9420. @code{--enable-libfreetype} and @code{--enable-libharfbuzz}.
  9421. To enable default font fallback and the @var{font} option you need to
  9422. configure FFmpeg with @code{--enable-libfontconfig}.
  9423. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  9424. @code{--enable-libfribidi}.
  9425. @subsection Syntax
  9426. It accepts the following parameters:
  9427. @table @option
  9428. @item box
  9429. Used to draw a box around text using the background color.
  9430. The value must be either 1 (enable) or 0 (disable).
  9431. The default value of @var{box} is 0.
  9432. @item boxborderw
  9433. Set the width of the border to be drawn around the box using @var{boxcolor}.
  9434. The value must be specified using one of the following formats:
  9435. @itemize @bullet
  9436. @item @code{boxborderw=10} set the width of all the borders to 10
  9437. @item @code{boxborderw=10|20} set the width of the top and bottom borders to 10
  9438. and the width of the left and right borders to 20
  9439. @item @code{boxborderw=10|20|30} set the width of the top border to 10, the width
  9440. of the bottom border to 30 and the width of the left and right borders to 20
  9441. @item @code{boxborderw=10|20|30|40} set the borders width to 10 (top), 20 (right),
  9442. 30 (bottom), 40 (left)
  9443. @end itemize
  9444. The default value of @var{boxborderw} is "0".
  9445. @item boxcolor
  9446. The color to be used for drawing box around text. For the syntax of this
  9447. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9448. The default value of @var{boxcolor} is "white".
  9449. @item line_spacing
  9450. Set the line spacing in pixels. The default value of @var{line_spacing} is 0.
  9451. @item text_align
  9452. Set the vertical and horizontal alignment of the text with respect to the box boundaries.
  9453. The value is combination of flags, one for the vertical alignment (T=top,
  9454. M=middle, B=bottom) and one for the horizontal alignment (L=left, C=center, R=right).
  9455. Please note that tab characters are only supported with the left horizontal alignment.
  9456. @item y_align
  9457. Specify what the @var{y} value is referred to. Possible values are:
  9458. @itemize @bullet
  9459. @item @code{text} the top of the highest glyph of the first text line is placed at @var{y}
  9460. @item @code{baseline} the baseline of the first text line is placed at @var{y}
  9461. @item @code{font} the baseline of the first text line is placed at @var{y} plus the
  9462. ascent (in pixels) defined in the font metrics
  9463. @end itemize
  9464. The default value of @var{y_align} is "text" for backward compatibility.
  9465. @item borderw
  9466. Set the width of the border to be drawn around the text using @var{bordercolor}.
  9467. The default value of @var{borderw} is 0.
  9468. @item bordercolor
  9469. Set the color to be used for drawing border around text. For the syntax of this
  9470. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9471. The default value of @var{bordercolor} is "black".
  9472. @item expansion
  9473. Select how the @var{text} is expanded. Can be either @code{none},
  9474. @code{strftime} (deprecated) or @code{normal} (default). See the
  9475. @ref{drawtext_expansion, Text expansion} section below for details.
  9476. @item basetime
  9477. Set a start time for the count. Value is in microseconds. Only applied
  9478. in the deprecated @code{strftime} expansion mode. To emulate in normal expansion
  9479. mode use the @code{pts} function, supplying the start time (in seconds)
  9480. as the second argument.
  9481. @item fix_bounds
  9482. If true, check and fix text coords to avoid clipping.
  9483. @item fontcolor
  9484. The color to be used for drawing fonts. For the syntax of this option, check
  9485. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9486. The default value of @var{fontcolor} is "black".
  9487. @item fontcolor_expr
  9488. String which is expanded the same way as @var{text} to obtain dynamic
  9489. @var{fontcolor} value. By default this option has empty value and is not
  9490. processed. When this option is set, it overrides @var{fontcolor} option.
  9491. @item font
  9492. The font family to be used for drawing text. By default Sans.
  9493. @item fontfile
  9494. The font file to be used for drawing text. The path must be included.
  9495. This parameter is mandatory if the fontconfig support is disabled.
  9496. @item alpha
  9497. Draw the text applying alpha blending. The value can
  9498. be a number between 0.0 and 1.0.
  9499. The expression accepts the same variables @var{x, y} as well.
  9500. The default value is 1.
  9501. Please see @var{fontcolor_expr}.
  9502. @item fontsize
  9503. The font size to be used for drawing text.
  9504. The default value of @var{fontsize} is 16.
  9505. @item text_shaping
  9506. If set to 1, attempt to shape the text (for example, reverse the order of
  9507. right-to-left text and join Arabic characters) before drawing it.
  9508. Otherwise, just draw the text exactly as given.
  9509. By default 1 (if supported).
  9510. @item ft_load_flags
  9511. The flags to be used for loading the fonts.
  9512. The flags map the corresponding flags supported by libfreetype, and are
  9513. a combination of the following values:
  9514. @table @var
  9515. @item default
  9516. @item no_scale
  9517. @item no_hinting
  9518. @item render
  9519. @item no_bitmap
  9520. @item vertical_layout
  9521. @item force_autohint
  9522. @item crop_bitmap
  9523. @item pedantic
  9524. @item ignore_global_advance_width
  9525. @item no_recurse
  9526. @item ignore_transform
  9527. @item monochrome
  9528. @item linear_design
  9529. @item no_autohint
  9530. @end table
  9531. Default value is "default".
  9532. For more information consult the documentation for the FT_LOAD_*
  9533. libfreetype flags.
  9534. @item shadowcolor
  9535. The color to be used for drawing a shadow behind the drawn text. For the
  9536. syntax of this option, check the @ref{color syntax,,"Color" section in the
  9537. ffmpeg-utils manual,ffmpeg-utils}.
  9538. The default value of @var{shadowcolor} is "black".
  9539. @item boxw
  9540. Set the width of the box to be drawn around text.
  9541. The default value of @var{boxw} is computed automatically to match the text width
  9542. @item boxh
  9543. Set the height of the box to be drawn around text.
  9544. The default value of @var{boxh} is computed automatically to match the text height
  9545. @item shadowx
  9546. @item shadowy
  9547. The x and y offsets for the text shadow position with respect to the
  9548. position of the text. They can be either positive or negative
  9549. values. The default value for both is "0".
  9550. @item start_number
  9551. The starting frame number for the n/frame_num variable. The default value
  9552. is "0".
  9553. @item tabsize
  9554. The size in number of spaces to use for rendering the tab.
  9555. Default value is 4.
  9556. @item timecode
  9557. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  9558. format. It can be used with or without text parameter. @var{timecode_rate}
  9559. option must be specified.
  9560. @item timecode_rate, rate, r
  9561. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  9562. integer. Minimum value is "1".
  9563. Drop-frame timecode is supported for frame rates 30 & 60.
  9564. @item tc24hmax
  9565. If set to 1, the output of the timecode option will wrap around at 24 hours.
  9566. Default is 0 (disabled).
  9567. @item text
  9568. The text string to be drawn. The text must be a sequence of UTF-8
  9569. encoded characters.
  9570. This parameter is mandatory if no file is specified with the parameter
  9571. @var{textfile}.
  9572. @item textfile
  9573. A text file containing text to be drawn. The text must be a sequence
  9574. of UTF-8 encoded characters.
  9575. This parameter is mandatory if no text string is specified with the
  9576. parameter @var{text}.
  9577. If both @var{text} and @var{textfile} are specified, an error is thrown.
  9578. @item text_source
  9579. Text source should be set as side_data_detection_bboxes if you want to use text data in
  9580. detection bboxes of side data.
  9581. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  9582. text data in detection bboxes of side data. So please do not use this parameter
  9583. if you are not sure about the text source.
  9584. @item reload
  9585. The @var{textfile} will be reloaded at specified frame interval.
  9586. Be sure to update @var{textfile} atomically, or it may be read partially,
  9587. or even fail.
  9588. Range is 0 to INT_MAX. Default is 0.
  9589. @item x
  9590. @item y
  9591. The expressions which specify the offsets where text will be drawn
  9592. within the video frame. They are relative to the top/left border of the
  9593. output image.
  9594. The default value of @var{x} and @var{y} is "0".
  9595. See below for the list of accepted constants and functions.
  9596. @end table
  9597. The parameters for @var{x} and @var{y} are expressions containing the
  9598. following constants and functions:
  9599. @table @option
  9600. @item dar
  9601. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9602. @item hsub
  9603. @item vsub
  9604. horizontal and vertical chroma subsample values. For example for the
  9605. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9606. @item line_h, lh
  9607. the height of each text line
  9608. @item main_h, h, H
  9609. the input height
  9610. @item main_w, w, W
  9611. the input width
  9612. @item max_glyph_a, ascent
  9613. the maximum distance from the baseline to the highest/upper grid
  9614. coordinate used to place a glyph outline point, for all the rendered
  9615. glyphs.
  9616. It is a positive value, due to the grid's orientation with the Y axis
  9617. upwards.
  9618. @item max_glyph_d, descent
  9619. the maximum distance from the baseline to the lowest grid coordinate
  9620. used to place a glyph outline point, for all the rendered glyphs.
  9621. This is a negative value, due to the grid's orientation, with the Y axis
  9622. upwards.
  9623. @item max_glyph_h
  9624. maximum glyph height, that is the maximum height for all the glyphs
  9625. contained in the rendered text, it is equivalent to @var{ascent} -
  9626. @var{descent}.
  9627. @item max_glyph_w
  9628. maximum glyph width, that is the maximum width for all the glyphs
  9629. contained in the rendered text
  9630. @item font_a
  9631. the ascent size defined in the font metrics
  9632. @item font_d
  9633. the descent size defined in the font metrics
  9634. @item top_a
  9635. the maximum ascender of the glyphs of the first text line
  9636. @item bottom_d
  9637. the maximum descender of the glyphs of the last text line
  9638. @item n
  9639. the number of input frame, starting from 0
  9640. @item rand(min, max)
  9641. return a random number included between @var{min} and @var{max}
  9642. @item sar
  9643. The input sample aspect ratio.
  9644. @item t
  9645. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9646. @item text_h, th
  9647. the height of the rendered text
  9648. @item text_w, tw
  9649. the width of the rendered text
  9650. @item x
  9651. @item y
  9652. the x and y offset coordinates where the text is drawn.
  9653. These parameters allow the @var{x} and @var{y} expressions to refer
  9654. to each other, so you can for example specify @code{y=x/dar}.
  9655. @item pict_type
  9656. A one character description of the current frame's picture type.
  9657. @item pkt_pos
  9658. The current packet's position in the input file or stream
  9659. (in bytes, from the start of the input). A value of -1 indicates
  9660. this info is not available.
  9661. @item duration
  9662. The current packet's duration, in seconds.
  9663. @item pkt_size
  9664. The current packet's size (in bytes).
  9665. @end table
  9666. @anchor{drawtext_expansion}
  9667. @subsection Text expansion
  9668. If @option{expansion} is set to @code{strftime}, the filter recognizes
  9669. sequences accepted by the @code{strftime} C function in the provided
  9670. text and expands them accordingly. Check the documentation of
  9671. @code{strftime}. This feature is deprecated in favor of @code{normal}
  9672. expansion with the @code{gmtime} or @code{localtime} expansion
  9673. functions.
  9674. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  9675. If @option{expansion} is set to @code{normal} (which is the default),
  9676. the following expansion mechanism is used.
  9677. The backslash character @samp{\}, followed by any character, always expands to
  9678. the second character.
  9679. Sequences of the form @code{%@{...@}} are expanded. The text between the
  9680. braces is a function name, possibly followed by arguments separated by ':'.
  9681. If the arguments contain special characters or delimiters (':' or '@}'),
  9682. they should be escaped.
  9683. Note that they probably must also be escaped as the value for the @option{text}
  9684. option in the filter argument string and as the filter argument in the
  9685. filtergraph description, and possibly also for the shell, that makes up to four
  9686. levels of escaping; using a text file with the @option{textfile} option avoids
  9687. these problems.
  9688. The following functions are available:
  9689. @table @command
  9690. @item expr, e
  9691. The expression evaluation result.
  9692. It must take one argument specifying the expression to be evaluated,
  9693. which accepts the same constants and functions as the @var{x} and
  9694. @var{y} values. Note that not all constants should be used, for
  9695. example the text size is not known when evaluating the expression, so
  9696. the constants @var{text_w} and @var{text_h} will have an undefined
  9697. value.
  9698. @item expr_int_format, eif
  9699. Evaluate the expression's value and output as formatted integer.
  9700. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  9701. The second argument specifies the output format. Allowed values are @samp{x},
  9702. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  9703. @code{printf} function.
  9704. The third parameter is optional and sets the number of positions taken by the output.
  9705. It can be used to add padding with zeros from the left.
  9706. @item gmtime
  9707. The time at which the filter is running, expressed in UTC.
  9708. It can accept an argument: a @code{strftime} C function format string.
  9709. The format string is extended to support the variable @var{%[1-6]N}
  9710. which prints fractions of the second with optionally specified number of digits.
  9711. @item localtime
  9712. The time at which the filter is running, expressed in the local time zone.
  9713. It can accept an argument: a @code{strftime} C function format string.
  9714. The format string is extended to support the variable @var{%[1-6]N}
  9715. which prints fractions of the second with optionally specified number of digits.
  9716. @item metadata
  9717. Frame metadata. Takes one or two arguments.
  9718. The first argument is mandatory and specifies the metadata key.
  9719. The second argument is optional and specifies a default value, used when the
  9720. metadata key is not found or empty.
  9721. Available metadata can be identified by inspecting entries
  9722. starting with TAG included within each frame section
  9723. printed by running @code{ffprobe -show_frames}.
  9724. String metadata generated in filters leading to
  9725. the drawtext filter are also available.
  9726. @item n, frame_num
  9727. The frame number, starting from 0.
  9728. @item pict_type
  9729. A one character description of the current picture type.
  9730. @item pts
  9731. The timestamp of the current frame.
  9732. It can take up to three arguments.
  9733. The first argument is the format of the timestamp; it defaults to @code{flt}
  9734. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  9735. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  9736. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  9737. @code{localtime} stands for the timestamp of the frame formatted as
  9738. local time zone time.
  9739. The second argument is an offset added to the timestamp.
  9740. If the format is set to @code{hms}, a third argument @code{24HH} may be
  9741. supplied to present the hour part of the formatted timestamp in 24h format
  9742. (00-23).
  9743. If the format is set to @code{localtime} or @code{gmtime}, a third
  9744. argument may be supplied: a @code{strftime} C function format string.
  9745. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  9746. @end table
  9747. @subsection Commands
  9748. This filter supports altering parameters via commands:
  9749. @table @option
  9750. @item reinit
  9751. Alter existing filter parameters.
  9752. Syntax for the argument is the same as for filter invocation, e.g.
  9753. @example
  9754. fontsize=56:fontcolor=green:text='Hello World'
  9755. @end example
  9756. Full filter invocation with sendcmd would look like this:
  9757. @example
  9758. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  9759. @end example
  9760. If the entire argument can't be parsed or applied as valid values then the filter will
  9761. continue with its existing parameters.
  9762. @end table
  9763. The following options are also supported as @ref{commands}:
  9764. @itemize @bullet
  9765. @item x
  9766. @item y
  9767. @item alpha
  9768. @item fontsize
  9769. @item fontcolor
  9770. @item boxcolor
  9771. @item bordercolor
  9772. @item shadowcolor
  9773. @item box
  9774. @item boxw
  9775. @item boxh
  9776. @item boxborderw
  9777. @item line_spacing
  9778. @item text_align
  9779. @item shadowx
  9780. @item shadowy
  9781. @item borderw
  9782. @end itemize
  9783. @subsection Examples
  9784. @itemize
  9785. @item
  9786. Draw "Test Text" with font FreeSerif, using the default values for the
  9787. optional parameters.
  9788. @example
  9789. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  9790. @end example
  9791. @item
  9792. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  9793. and y=50 (counting from the top-left corner of the screen), text is
  9794. yellow with a red box around it. Both the text and the box have an
  9795. opacity of 20%.
  9796. @example
  9797. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  9798. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  9799. @end example
  9800. Note that the double quotes are not necessary if spaces are not used
  9801. within the parameter list.
  9802. @item
  9803. Show the text at the center of the video frame:
  9804. @example
  9805. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  9806. @end example
  9807. @item
  9808. Show the text at a random position, switching to a new position every 30 seconds:
  9809. @example
  9810. 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)"
  9811. @end example
  9812. @item
  9813. Show a text line sliding from right to left in the last row of the video
  9814. frame. The file @file{LONG_LINE} is assumed to contain a single line
  9815. with no newlines.
  9816. @example
  9817. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  9818. @end example
  9819. @item
  9820. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  9821. @example
  9822. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  9823. @end example
  9824. @item
  9825. Draw a single green letter "g", at the center of the input video.
  9826. The glyph baseline is placed at half screen height.
  9827. @example
  9828. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  9829. @end example
  9830. @item
  9831. Show text for 1 second every 3 seconds:
  9832. @example
  9833. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  9834. @end example
  9835. @item
  9836. Use fontconfig to set the font. Note that the colons need to be escaped.
  9837. @example
  9838. drawtext='fontfile=Linux Libertine O-40\\:style=Semibold:text=FFmpeg'
  9839. @end example
  9840. @item
  9841. Draw "Test Text" with font size dependent on height of the video.
  9842. @example
  9843. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  9844. @end example
  9845. @item
  9846. Print the date of a real-time encoding (see documentation for the
  9847. @code{strftime} C function):
  9848. @example
  9849. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  9850. @end example
  9851. @item
  9852. Show text fading in and out (appearing/disappearing):
  9853. @example
  9854. #!/bin/sh
  9855. DS=1.0 # display start
  9856. DE=10.0 # display end
  9857. FID=1.5 # fade in duration
  9858. FOD=5 # fade out duration
  9859. 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 @}"
  9860. @end example
  9861. @item
  9862. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9863. and the @option{fontsize} value are included in the @option{y} offset.
  9864. @example
  9865. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9866. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9867. @end example
  9868. @item
  9869. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9870. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9871. must have option @option{-export_path_metadata 1} for the special metadata fields
  9872. to be available for filters.
  9873. @example
  9874. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  9875. @end example
  9876. @end itemize
  9877. For more information about libfreetype, check:
  9878. @url{http://www.freetype.org/}.
  9879. For more information about fontconfig, check:
  9880. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  9881. For more information about libfribidi, check:
  9882. @url{http://fribidi.org/}.
  9883. For more information about libharfbuzz, check:
  9884. @url{https://github.com/harfbuzz/harfbuzz}.
  9885. @section edgedetect
  9886. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  9887. The filter accepts the following options:
  9888. @table @option
  9889. @item low
  9890. @item high
  9891. Set low and high threshold values used by the Canny thresholding
  9892. algorithm.
  9893. The high threshold selects the "strong" edge pixels, which are then
  9894. connected through 8-connectivity with the "weak" edge pixels selected
  9895. by the low threshold.
  9896. @var{low} and @var{high} threshold values must be chosen in the range
  9897. [0,1], and @var{low} should be lesser or equal to @var{high}.
  9898. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  9899. is @code{50/255}.
  9900. @item mode
  9901. Define the drawing mode.
  9902. @table @samp
  9903. @item wires
  9904. Draw white/gray wires on black background.
  9905. @item colormix
  9906. Mix the colors to create a paint/cartoon effect.
  9907. @item canny
  9908. Apply Canny edge detector on all selected planes.
  9909. @end table
  9910. Default value is @var{wires}.
  9911. @item planes
  9912. Select planes for filtering. By default all available planes are filtered.
  9913. @end table
  9914. @subsection Examples
  9915. @itemize
  9916. @item
  9917. Standard edge detection with custom values for the hysteresis thresholding:
  9918. @example
  9919. edgedetect=low=0.1:high=0.4
  9920. @end example
  9921. @item
  9922. Painting effect without thresholding:
  9923. @example
  9924. edgedetect=mode=colormix:high=0
  9925. @end example
  9926. @end itemize
  9927. @section elbg
  9928. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  9929. For each input image, the filter will compute the optimal mapping from
  9930. the input to the output given the codebook length, that is the number
  9931. of distinct output colors.
  9932. This filter accepts the following options.
  9933. @table @option
  9934. @item codebook_length, l
  9935. Set codebook length. The value must be a positive integer, and
  9936. represents the number of distinct output colors. Default value is 256.
  9937. @item nb_steps, n
  9938. Set the maximum number of iterations to apply for computing the optimal
  9939. mapping. The higher the value the better the result and the higher the
  9940. computation time. Default value is 1.
  9941. @item seed, s
  9942. Set a random seed, must be an integer included between 0 and
  9943. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  9944. will try to use a good random seed on a best effort basis.
  9945. @item pal8
  9946. Set pal8 output pixel format. This option does not work with codebook
  9947. length greater than 256. Default is disabled.
  9948. @item use_alpha
  9949. Include alpha values in the quantization calculation. Allows creating
  9950. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  9951. @end table
  9952. @section entropy
  9953. Measure graylevel entropy in histogram of color channels of video frames.
  9954. It accepts the following parameters:
  9955. @table @option
  9956. @item mode
  9957. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  9958. @var{diff} mode measures entropy of histogram delta values, absolute differences
  9959. between neighbour histogram values.
  9960. @end table
  9961. @section epx
  9962. Apply the EPX magnification filter which is designed for pixel art.
  9963. It accepts the following option:
  9964. @table @option
  9965. @item n
  9966. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  9967. @code{3xEPX}.
  9968. Default is @code{3}.
  9969. @end table
  9970. @section eq
  9971. Set brightness, contrast, saturation and approximate gamma adjustment.
  9972. The filter accepts the following options:
  9973. @table @option
  9974. @item contrast
  9975. Set the contrast expression. The value must be a float value in range
  9976. @code{-1000.0} to @code{1000.0}. The default value is "1".
  9977. @item brightness
  9978. Set the brightness expression. The value must be a float value in
  9979. range @code{-1.0} to @code{1.0}. The default value is "0".
  9980. @item saturation
  9981. Set the saturation expression. The value must be a float in
  9982. range @code{0.0} to @code{3.0}. The default value is "1".
  9983. @item gamma
  9984. Set the gamma expression. The value must be a float in range
  9985. @code{0.1} to @code{10.0}. The default value is "1".
  9986. @item gamma_r
  9987. Set the gamma expression for red. The value must be a float in
  9988. range @code{0.1} to @code{10.0}. The default value is "1".
  9989. @item gamma_g
  9990. Set the gamma expression for green. The value must be a float in range
  9991. @code{0.1} to @code{10.0}. The default value is "1".
  9992. @item gamma_b
  9993. Set the gamma expression for blue. The value must be a float in range
  9994. @code{0.1} to @code{10.0}. The default value is "1".
  9995. @item gamma_weight
  9996. Set the gamma weight expression. It can be used to reduce the effect
  9997. of a high gamma value on bright image areas, e.g. keep them from
  9998. getting overamplified and just plain white. The value must be a float
  9999. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  10000. gamma correction all the way down while @code{1.0} leaves it at its
  10001. full strength. Default is "1".
  10002. @item eval
  10003. Set when the expressions for brightness, contrast, saturation and
  10004. gamma expressions are evaluated.
  10005. It accepts the following values:
  10006. @table @samp
  10007. @item init
  10008. only evaluate expressions once during the filter initialization or
  10009. when a command is processed
  10010. @item frame
  10011. evaluate expressions for each incoming frame
  10012. @end table
  10013. Default value is @samp{init}.
  10014. @end table
  10015. The expressions accept the following parameters:
  10016. @table @option
  10017. @item n
  10018. frame count of the input frame starting from 0
  10019. @item pos
  10020. byte position of the corresponding packet in the input file, NAN if
  10021. unspecified; deprecated, do not use
  10022. @item r
  10023. frame rate of the input video, NAN if the input frame rate is unknown
  10024. @item t
  10025. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10026. @end table
  10027. @subsection Commands
  10028. The filter supports the following commands:
  10029. @table @option
  10030. @item contrast
  10031. Set the contrast expression.
  10032. @item brightness
  10033. Set the brightness expression.
  10034. @item saturation
  10035. Set the saturation expression.
  10036. @item gamma
  10037. Set the gamma expression.
  10038. @item gamma_r
  10039. Set the gamma_r expression.
  10040. @item gamma_g
  10041. Set gamma_g expression.
  10042. @item gamma_b
  10043. Set gamma_b expression.
  10044. @item gamma_weight
  10045. Set gamma_weight expression.
  10046. The command accepts the same syntax of the corresponding option.
  10047. If the specified expression is not valid, it is kept at its current
  10048. value.
  10049. @end table
  10050. @anchor{erosion}
  10051. @section erosion
  10052. Apply erosion effect to the video.
  10053. This filter replaces the pixel by the local(3x3) minimum.
  10054. It accepts the following options:
  10055. @table @option
  10056. @item threshold0
  10057. @item threshold1
  10058. @item threshold2
  10059. @item threshold3
  10060. Limit the maximum change for each plane, default is 65535.
  10061. If 0, plane will remain unchanged.
  10062. @item coordinates
  10063. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  10064. pixels are used.
  10065. Flags to local 3x3 coordinates maps like this:
  10066. 1 2 3
  10067. 4 5
  10068. 6 7 8
  10069. @end table
  10070. @subsection Commands
  10071. This filter supports the all above options as @ref{commands}.
  10072. @section estdif
  10073. Deinterlace the input video ("estdif" stands for "Edge Slope
  10074. Tracing Deinterlacing Filter").
  10075. Spatial only filter that uses edge slope tracing algorithm
  10076. to interpolate missing lines.
  10077. It accepts the following parameters:
  10078. @table @option
  10079. @item mode
  10080. The interlacing mode to adopt. It accepts one of the following values:
  10081. @table @option
  10082. @item frame
  10083. Output one frame for each frame.
  10084. @item field
  10085. Output one frame for each field.
  10086. @end table
  10087. The default value is @code{field}.
  10088. @item parity
  10089. The picture field parity assumed for the input interlaced video. It accepts one
  10090. of the following values:
  10091. @table @option
  10092. @item tff
  10093. Assume the top field is first.
  10094. @item bff
  10095. Assume the bottom field is first.
  10096. @item auto
  10097. Enable automatic detection of field parity.
  10098. @end table
  10099. The default value is @code{auto}.
  10100. If the interlacing is unknown or the decoder does not export this information,
  10101. top field first will be assumed.
  10102. @item deint
  10103. Specify which frames to deinterlace. Accepts one of the following
  10104. values:
  10105. @table @option
  10106. @item all
  10107. Deinterlace all frames.
  10108. @item interlaced
  10109. Only deinterlace frames marked as interlaced.
  10110. @end table
  10111. The default value is @code{all}.
  10112. @item rslope
  10113. Specify the search radius for edge slope tracing. Default value is 1.
  10114. Allowed range is from 1 to 15.
  10115. @item redge
  10116. Specify the search radius for best edge matching. Default value is 2.
  10117. Allowed range is from 0 to 15.
  10118. @item ecost
  10119. Specify the edge cost for edge matching. Default value is 2.
  10120. Allowed range is from 0 to 50.
  10121. @item mcost
  10122. Specify the middle cost for edge matching. Default value is 1.
  10123. Allowed range is from 0 to 50.
  10124. @item dcost
  10125. Specify the distance cost for edge matching. Default value is 1.
  10126. Allowed range is from 0 to 50.
  10127. @item interp
  10128. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  10129. of the following values:
  10130. @table @option
  10131. @item 2p
  10132. Two-point interpolation.
  10133. @item 4p
  10134. Four-point interpolation.
  10135. @item 6p
  10136. Six-point interpolation.
  10137. @end table
  10138. @end table
  10139. @subsection Commands
  10140. This filter supports same @ref{commands} as options.
  10141. @section exposure
  10142. Adjust exposure of the video stream.
  10143. The filter accepts the following options:
  10144. @table @option
  10145. @item exposure
  10146. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  10147. Default value is 0 EV.
  10148. @item black
  10149. Set the black level correction. Allowed range is from -1.0 to 1.0.
  10150. Default value is 0.
  10151. @end table
  10152. @subsection Commands
  10153. This filter supports same @ref{commands} as options.
  10154. @section extractplanes
  10155. Extract color channel components from input video stream into
  10156. separate grayscale video streams.
  10157. The filter accepts the following option:
  10158. @table @option
  10159. @item planes
  10160. Set plane(s) to extract.
  10161. Available values for planes are:
  10162. @table @samp
  10163. @item y
  10164. @item u
  10165. @item v
  10166. @item a
  10167. @item r
  10168. @item g
  10169. @item b
  10170. @end table
  10171. Choosing planes not available in the input will result in an error.
  10172. That means you cannot select @code{r}, @code{g}, @code{b} planes
  10173. with @code{y}, @code{u}, @code{v} planes at same time.
  10174. @end table
  10175. @subsection Examples
  10176. @itemize
  10177. @item
  10178. Extract luma, u and v color channel component from input video frame
  10179. into 3 grayscale outputs:
  10180. @example
  10181. 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
  10182. @end example
  10183. @end itemize
  10184. @section fade
  10185. Apply a fade-in/out effect to the input video.
  10186. It accepts the following parameters:
  10187. @table @option
  10188. @item type, t
  10189. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  10190. effect.
  10191. Default is @code{in}.
  10192. @item start_frame, s
  10193. Specify the number of the frame to start applying the fade
  10194. effect at. Default is 0.
  10195. @item nb_frames, n
  10196. The number of frames that the fade effect lasts. At the end of the
  10197. fade-in effect, the output video will have the same intensity as the input video.
  10198. At the end of the fade-out transition, the output video will be filled with the
  10199. selected @option{color}.
  10200. Default is 25.
  10201. @item alpha
  10202. If set to 1, fade only alpha channel, if one exists on the input.
  10203. Default value is 0.
  10204. @item start_time, st
  10205. Specify the timestamp (in seconds) of the frame to start to apply the fade
  10206. effect. If both start_frame and start_time are specified, the fade will start at
  10207. whichever comes last. Default is 0.
  10208. @item duration, d
  10209. The number of seconds for which the fade effect has to last. At the end of the
  10210. fade-in effect the output video will have the same intensity as the input video,
  10211. at the end of the fade-out transition the output video will be filled with the
  10212. selected @option{color}.
  10213. If both duration and nb_frames are specified, duration is used. Default is 0
  10214. (nb_frames is used by default).
  10215. @item color, c
  10216. Specify the color of the fade. Default is "black".
  10217. @end table
  10218. @subsection Examples
  10219. @itemize
  10220. @item
  10221. Fade in the first 30 frames of video:
  10222. @example
  10223. fade=in:0:30
  10224. @end example
  10225. The command above is equivalent to:
  10226. @example
  10227. fade=t=in:s=0:n=30
  10228. @end example
  10229. @item
  10230. Fade out the last 45 frames of a 200-frame video:
  10231. @example
  10232. fade=out:155:45
  10233. fade=type=out:start_frame=155:nb_frames=45
  10234. @end example
  10235. @item
  10236. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  10237. @example
  10238. fade=in:0:25, fade=out:975:25
  10239. @end example
  10240. @item
  10241. Make the first 5 frames yellow, then fade in from frame 5-24:
  10242. @example
  10243. fade=in:5:20:color=yellow
  10244. @end example
  10245. @item
  10246. Fade in alpha over first 25 frames of video:
  10247. @example
  10248. fade=in:0:25:alpha=1
  10249. @end example
  10250. @item
  10251. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  10252. @example
  10253. fade=t=in:st=5.5:d=0.5
  10254. @end example
  10255. @end itemize
  10256. @section feedback
  10257. Apply feedback video filter.
  10258. This filter pass cropped input frames to 2nd output.
  10259. From there it can be filtered with other video filters.
  10260. After filter receives frame from 2nd input, that frame
  10261. is combined on top of original frame from 1st input and passed
  10262. to 1st output.
  10263. The typical usage is filter only part of frame.
  10264. The filter accepts the following options:
  10265. @table @option
  10266. @item x
  10267. @item y
  10268. Set the top left crop position.
  10269. @item w
  10270. @item h
  10271. Set the crop size.
  10272. @end table
  10273. @subsection Examples
  10274. @itemize
  10275. @item
  10276. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  10277. @example
  10278. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  10279. @end example
  10280. @item
  10281. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  10282. @example
  10283. [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]
  10284. @end example
  10285. @item
  10286. Pixelize rectangular part of video frame of size 100x100 with pixelize filter.
  10287. @example
  10288. [in][blurin]feedback=x=320:y=240:w=100:h=100[out][blurout];[blurout]pixelize[blurin]
  10289. @end example
  10290. @end itemize
  10291. @section fftdnoiz
  10292. Denoise frames using 3D FFT (frequency domain filtering).
  10293. The filter accepts the following options:
  10294. @table @option
  10295. @item sigma
  10296. Set the noise sigma constant. This sets denoising strength.
  10297. Default value is 1. Allowed range is from 0 to 30.
  10298. Using very high sigma with low overlap may give blocking artifacts.
  10299. @item amount
  10300. Set amount of denoising. By default all detected noise is reduced.
  10301. Default value is 1. Allowed range is from 0 to 1.
  10302. @item block
  10303. Set size of block in pixels, Default is 32, can be 8 to 256.
  10304. @item overlap
  10305. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  10306. @item method
  10307. Set denoising method. Default is @code{wiener}, can also be @code{hard}.
  10308. @item prev
  10309. Set number of previous frames to use for denoising. By default is set to 0.
  10310. @item next
  10311. Set number of next frames to to use for denoising. By default is set to 0.
  10312. @item planes
  10313. Set planes which will be filtered, by default are all available filtered
  10314. except alpha.
  10315. @end table
  10316. @section fftfilt
  10317. Apply arbitrary expressions to samples in frequency domain
  10318. @table @option
  10319. @item dc_Y
  10320. Adjust the dc value (gain) of the luma plane of the image. The filter
  10321. accepts an integer value in range @code{0} to @code{1000}. The default
  10322. value is set to @code{0}.
  10323. @item dc_U
  10324. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  10325. filter accepts an integer value in range @code{0} to @code{1000}. The
  10326. default value is set to @code{0}.
  10327. @item dc_V
  10328. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  10329. filter accepts an integer value in range @code{0} to @code{1000}. The
  10330. default value is set to @code{0}.
  10331. @item weight_Y
  10332. Set the frequency domain weight expression for the luma plane.
  10333. @item weight_U
  10334. Set the frequency domain weight expression for the 1st chroma plane.
  10335. @item weight_V
  10336. Set the frequency domain weight expression for the 2nd chroma plane.
  10337. @item eval
  10338. Set when the expressions are evaluated.
  10339. It accepts the following values:
  10340. @table @samp
  10341. @item init
  10342. Only evaluate expressions once during the filter initialization.
  10343. @item frame
  10344. Evaluate expressions for each incoming frame.
  10345. @end table
  10346. Default value is @samp{init}.
  10347. The filter accepts the following variables:
  10348. @item X
  10349. @item Y
  10350. The coordinates of the current sample.
  10351. @item W
  10352. @item H
  10353. The width and height of the image.
  10354. @item N
  10355. The number of input frame, starting from 0.
  10356. @item WS
  10357. @item HS
  10358. The size of FFT array for horizontal and vertical processing.
  10359. @end table
  10360. @subsection Examples
  10361. @itemize
  10362. @item
  10363. High-pass:
  10364. @example
  10365. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  10366. @end example
  10367. @item
  10368. Low-pass:
  10369. @example
  10370. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  10371. @end example
  10372. @item
  10373. Sharpen:
  10374. @example
  10375. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  10376. @end example
  10377. @item
  10378. Blur:
  10379. @example
  10380. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  10381. @end example
  10382. @end itemize
  10383. @section field
  10384. Extract a single field from an interlaced image using stride
  10385. arithmetic to avoid wasting CPU time. The output frames are marked as
  10386. non-interlaced.
  10387. The filter accepts the following options:
  10388. @table @option
  10389. @item type
  10390. Specify whether to extract the top (if the value is @code{0} or
  10391. @code{top}) or the bottom field (if the value is @code{1} or
  10392. @code{bottom}).
  10393. @end table
  10394. @section fieldhint
  10395. Create new frames by copying the top and bottom fields from surrounding frames
  10396. supplied as numbers by the hint file.
  10397. @table @option
  10398. @item hint
  10399. Set file containing hints: absolute/relative frame numbers.
  10400. There must be one line for each frame in a clip. Each line must contain two
  10401. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  10402. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  10403. is current frame number for @code{absolute} mode or out of [-1, 1] range
  10404. for @code{relative} mode. First number tells from which frame to pick up top
  10405. field and second number tells from which frame to pick up bottom field.
  10406. If optionally followed by @code{+} output frame will be marked as interlaced,
  10407. else if followed by @code{-} output frame will be marked as progressive, else
  10408. it will be marked same as input frame.
  10409. If optionally followed by @code{t} output frame will use only top field, or in
  10410. case of @code{b} it will use only bottom field.
  10411. If line starts with @code{#} or @code{;} that line is skipped.
  10412. @item mode
  10413. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  10414. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  10415. are more frames to process than @code{hint} file is seek back to start.
  10416. @end table
  10417. Example of first several lines of @code{hint} file for @code{relative} mode:
  10418. @example
  10419. 0,0 - # first frame
  10420. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  10421. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  10422. 1,0 -
  10423. 0,0 -
  10424. 0,0 -
  10425. 1,0 -
  10426. 1,0 -
  10427. 1,0 -
  10428. 0,0 -
  10429. 0,0 -
  10430. 1,0 -
  10431. 1,0 -
  10432. 1,0 -
  10433. 0,0 -
  10434. @end example
  10435. @section fieldmatch
  10436. Field matching filter for inverse telecine. It is meant to reconstruct the
  10437. progressive frames from a telecined stream. The filter does not drop duplicated
  10438. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  10439. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  10440. The separation of the field matching and the decimation is notably motivated by
  10441. the possibility of inserting a de-interlacing filter fallback between the two.
  10442. If the source has mixed telecined and real interlaced content,
  10443. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  10444. But these remaining combed frames will be marked as interlaced, and thus can be
  10445. de-interlaced by a later filter such as @ref{yadif} before decimation.
  10446. In addition to the various configuration options, @code{fieldmatch} can take an
  10447. optional second stream, activated through the @option{ppsrc} option. If
  10448. enabled, the frames reconstruction will be based on the fields and frames from
  10449. this second stream. This allows the first input to be pre-processed in order to
  10450. help the various algorithms of the filter, while keeping the output lossless
  10451. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  10452. or brightness/contrast adjustments can help.
  10453. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  10454. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  10455. which @code{fieldmatch} is based on. While the semantic and usage are very
  10456. close, some behaviour and options names can differ.
  10457. The @ref{decimate} filter currently only works for constant frame rate input.
  10458. If your input has mixed telecined (30fps) and progressive content with a lower
  10459. framerate like 24fps use the following filterchain to produce the necessary cfr
  10460. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  10461. The filter accepts the following options:
  10462. @table @option
  10463. @item order
  10464. Specify the assumed field order of the input stream. Available values are:
  10465. @table @samp
  10466. @item auto
  10467. Auto detect parity (use FFmpeg's internal parity value).
  10468. @item bff
  10469. Assume bottom field first.
  10470. @item tff
  10471. Assume top field first.
  10472. @end table
  10473. Note that it is sometimes recommended not to trust the parity announced by the
  10474. stream.
  10475. Default value is @var{auto}.
  10476. @item mode
  10477. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  10478. sense that it won't risk creating jerkiness due to duplicate frames when
  10479. possible, but if there are bad edits or blended fields it will end up
  10480. outputting combed frames when a good match might actually exist. On the other
  10481. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  10482. but will almost always find a good frame if there is one. The other values are
  10483. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  10484. jerkiness and creating duplicate frames versus finding good matches in sections
  10485. with bad edits, orphaned fields, blended fields, etc.
  10486. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  10487. Available values are:
  10488. @table @samp
  10489. @item pc
  10490. 2-way matching (p/c)
  10491. @item pc_n
  10492. 2-way matching, and trying 3rd match if still combed (p/c + n)
  10493. @item pc_u
  10494. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  10495. @item pc_n_ub
  10496. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  10497. still combed (p/c + n + u/b)
  10498. @item pcn
  10499. 3-way matching (p/c/n)
  10500. @item pcn_ub
  10501. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  10502. detected as combed (p/c/n + u/b)
  10503. @end table
  10504. The parenthesis at the end indicate the matches that would be used for that
  10505. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  10506. @var{top}).
  10507. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  10508. the slowest.
  10509. Default value is @var{pc_n}.
  10510. @item ppsrc
  10511. Mark the main input stream as a pre-processed input, and enable the secondary
  10512. input stream as the clean source to pick the fields from. See the filter
  10513. introduction for more details. It is similar to the @option{clip2} feature from
  10514. VFM/TFM.
  10515. Default value is @code{0} (disabled).
  10516. @item field
  10517. Set the field to match from. It is recommended to set this to the same value as
  10518. @option{order} unless you experience matching failures with that setting. In
  10519. certain circumstances changing the field that is used to match from can have a
  10520. large impact on matching performance. Available values are:
  10521. @table @samp
  10522. @item auto
  10523. Automatic (same value as @option{order}).
  10524. @item bottom
  10525. Match from the bottom field.
  10526. @item top
  10527. Match from the top field.
  10528. @end table
  10529. Default value is @var{auto}.
  10530. @item mchroma
  10531. Set whether or not chroma is included during the match comparisons. In most
  10532. cases it is recommended to leave this enabled. You should set this to @code{0}
  10533. only if your clip has bad chroma problems such as heavy rainbowing or other
  10534. artifacts. Setting this to @code{0} could also be used to speed things up at
  10535. the cost of some accuracy.
  10536. Default value is @code{1}.
  10537. @item y0
  10538. @item y1
  10539. These define an exclusion band which excludes the lines between @option{y0} and
  10540. @option{y1} from being included in the field matching decision. An exclusion
  10541. band can be used to ignore subtitles, a logo, or other things that may
  10542. interfere with the matching. @option{y0} sets the starting scan line and
  10543. @option{y1} sets the ending line; all lines in between @option{y0} and
  10544. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  10545. @option{y0} and @option{y1} to the same value will disable the feature.
  10546. @option{y0} and @option{y1} defaults to @code{0}.
  10547. @item scthresh
  10548. Set the scene change detection threshold as a percentage of maximum change on
  10549. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  10550. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  10551. @option{scthresh} is @code{[0.0, 100.0]}.
  10552. Default value is @code{12.0}.
  10553. @item combmatch
  10554. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  10555. account the combed scores of matches when deciding what match to use as the
  10556. final match. Available values are:
  10557. @table @samp
  10558. @item none
  10559. No final matching based on combed scores.
  10560. @item sc
  10561. Combed scores are only used when a scene change is detected.
  10562. @item full
  10563. Use combed scores all the time.
  10564. @end table
  10565. Default is @var{sc}.
  10566. @item combdbg
  10567. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  10568. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  10569. Available values are:
  10570. @table @samp
  10571. @item none
  10572. No forced calculation.
  10573. @item pcn
  10574. Force p/c/n calculations.
  10575. @item pcnub
  10576. Force p/c/n/u/b calculations.
  10577. @end table
  10578. Default value is @var{none}.
  10579. @item cthresh
  10580. This is the area combing threshold used for combed frame detection. This
  10581. essentially controls how "strong" or "visible" combing must be to be detected.
  10582. Larger values mean combing must be more visible and smaller values mean combing
  10583. can be less visible or strong and still be detected. Valid settings are from
  10584. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  10585. be detected as combed). This is basically a pixel difference value. A good
  10586. range is @code{[8, 12]}.
  10587. Default value is @code{9}.
  10588. @item chroma
  10589. Sets whether or not chroma is considered in the combed frame decision. Only
  10590. disable this if your source has chroma problems (rainbowing, etc.) that are
  10591. causing problems for the combed frame detection with chroma enabled. Actually,
  10592. using @option{chroma}=@var{0} is usually more reliable, except for the case
  10593. where there is chroma only combing in the source.
  10594. Default value is @code{0}.
  10595. @item blockx
  10596. @item blocky
  10597. Respectively set the x-axis and y-axis size of the window used during combed
  10598. frame detection. This has to do with the size of the area in which
  10599. @option{combpel} pixels are required to be detected as combed for a frame to be
  10600. declared combed. See the @option{combpel} parameter description for more info.
  10601. Possible values are any number that is a power of 2 starting at 4 and going up
  10602. to 512.
  10603. Default value is @code{16}.
  10604. @item combpel
  10605. The number of combed pixels inside any of the @option{blocky} by
  10606. @option{blockx} size blocks on the frame for the frame to be detected as
  10607. combed. While @option{cthresh} controls how "visible" the combing must be, this
  10608. setting controls "how much" combing there must be in any localized area (a
  10609. window defined by the @option{blockx} and @option{blocky} settings) on the
  10610. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  10611. which point no frames will ever be detected as combed). This setting is known
  10612. as @option{MI} in TFM/VFM vocabulary.
  10613. Default value is @code{80}.
  10614. @end table
  10615. @anchor{p/c/n/u/b meaning}
  10616. @subsection p/c/n/u/b meaning
  10617. @subsubsection p/c/n
  10618. We assume the following telecined stream:
  10619. @example
  10620. Top fields: 1 2 2 3 4
  10621. Bottom fields: 1 2 3 4 4
  10622. @end example
  10623. The numbers correspond to the progressive frame the fields relate to. Here, the
  10624. first two frames are progressive, the 3rd and 4th are combed, and so on.
  10625. When @code{fieldmatch} is configured to run a matching from bottom
  10626. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  10627. @example
  10628. Input stream:
  10629. T 1 2 2 3 4
  10630. B 1 2 3 4 4 <-- matching reference
  10631. Matches: c c n n c
  10632. Output stream:
  10633. T 1 2 3 4 4
  10634. B 1 2 3 4 4
  10635. @end example
  10636. As a result of the field matching, we can see that some frames get duplicated.
  10637. To perform a complete inverse telecine, you need to rely on a decimation filter
  10638. after this operation. See for instance the @ref{decimate} filter.
  10639. The same operation now matching from top fields (@option{field}=@var{top})
  10640. looks like this:
  10641. @example
  10642. Input stream:
  10643. T 1 2 2 3 4 <-- matching reference
  10644. B 1 2 3 4 4
  10645. Matches: c c p p c
  10646. Output stream:
  10647. T 1 2 2 3 4
  10648. B 1 2 2 3 4
  10649. @end example
  10650. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  10651. basically, they refer to the frame and field of the opposite parity:
  10652. @itemize
  10653. @item @var{p} matches the field of the opposite parity in the previous frame
  10654. @item @var{c} matches the field of the opposite parity in the current frame
  10655. @item @var{n} matches the field of the opposite parity in the next frame
  10656. @end itemize
  10657. @subsubsection u/b
  10658. The @var{u} and @var{b} matching are a bit special in the sense that they match
  10659. from the opposite parity flag. In the following examples, we assume that we are
  10660. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  10661. 'x' is placed above and below each matched fields.
  10662. With bottom matching (@option{field}=@var{bottom}):
  10663. @example
  10664. Match: c p n b u
  10665. x x x x x
  10666. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10667. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10668. x x x x x
  10669. Output frames:
  10670. 2 1 2 2 2
  10671. 2 2 2 1 3
  10672. @end example
  10673. With top matching (@option{field}=@var{top}):
  10674. @example
  10675. Match: c p n b u
  10676. x x x x x
  10677. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10678. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10679. x x x x x
  10680. Output frames:
  10681. 2 2 2 1 2
  10682. 2 1 3 2 2
  10683. @end example
  10684. @subsection Examples
  10685. Simple IVTC of a top field first telecined stream:
  10686. @example
  10687. fieldmatch=order=tff:combmatch=none, decimate
  10688. @end example
  10689. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  10690. @example
  10691. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  10692. @end example
  10693. @section fieldorder
  10694. Transform the field order of the input video.
  10695. It accepts the following parameters:
  10696. @table @option
  10697. @item order
  10698. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  10699. for bottom field first.
  10700. @end table
  10701. The default value is @samp{tff}.
  10702. The transformation is done by shifting the picture content up or down
  10703. by one line, and filling the remaining line with appropriate picture content.
  10704. This method is consistent with most broadcast field order converters.
  10705. If the input video is not flagged as being interlaced, or it is already
  10706. flagged as being of the required output field order, then this filter does
  10707. not alter the incoming video.
  10708. It is very useful when converting to or from PAL DV material,
  10709. which is bottom field first.
  10710. For example:
  10711. @example
  10712. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  10713. @end example
  10714. @section fillborders
  10715. Fill borders of the input video, without changing video stream dimensions.
  10716. Sometimes video can have garbage at the four edges and you may not want to
  10717. crop video input to keep size multiple of some number.
  10718. This filter accepts the following options:
  10719. @table @option
  10720. @item left
  10721. Number of pixels to fill from left border.
  10722. @item right
  10723. Number of pixels to fill from right border.
  10724. @item top
  10725. Number of pixels to fill from top border.
  10726. @item bottom
  10727. Number of pixels to fill from bottom border.
  10728. @item mode
  10729. Set fill mode.
  10730. It accepts the following values:
  10731. @table @samp
  10732. @item smear
  10733. fill pixels using outermost pixels
  10734. @item mirror
  10735. fill pixels using mirroring (half sample symmetric)
  10736. @item fixed
  10737. fill pixels with constant value
  10738. @item reflect
  10739. fill pixels using reflecting (whole sample symmetric)
  10740. @item wrap
  10741. fill pixels using wrapping
  10742. @item fade
  10743. fade pixels to constant value
  10744. @item margins
  10745. fill pixels at top and bottom with weighted averages pixels near borders
  10746. @end table
  10747. Default is @var{smear}.
  10748. @item color
  10749. Set color for pixels in fixed or fade mode. Default is @var{black}.
  10750. @end table
  10751. @subsection Commands
  10752. This filter supports same @ref{commands} as options.
  10753. The command accepts the same syntax of the corresponding option.
  10754. If the specified expression is not valid, it is kept at its current
  10755. value.
  10756. @section find_rect
  10757. Find a rectangular object in the input video.
  10758. The object to search for must be specified as a gray8 image specified with the
  10759. @option{object} option.
  10760. For each possible match, a score is computed. If the score reaches the specified
  10761. threshold, the object is considered found.
  10762. If the input video contains multiple instances of the object, the filter will
  10763. find only one of them.
  10764. When an object is found, the following metadata entries are set in the matching
  10765. frame:
  10766. @table @option
  10767. @item lavfi.rect.w
  10768. width of object
  10769. @item lavfi.rect.h
  10770. height of object
  10771. @item lavfi.rect.x
  10772. x position of object
  10773. @item lavfi.rect.y
  10774. y position of object
  10775. @item lavfi.rect.score
  10776. match score of the found object
  10777. @end table
  10778. It accepts the following options:
  10779. @table @option
  10780. @item object
  10781. Filepath of the object image, needs to be in gray8.
  10782. @item threshold
  10783. Detection threshold, expressed as a decimal number in the range 0-1.
  10784. A threshold value of 0.01 means only exact matches, a threshold of 0.99 means
  10785. almost everything matches.
  10786. Default value is 0.5.
  10787. @item mipmaps
  10788. Number of mipmaps, default is 3.
  10789. @item xmin, ymin, xmax, ymax
  10790. Specifies the rectangle in which to search.
  10791. @item discard
  10792. Discard frames where object is not detected. Default is disabled.
  10793. @end table
  10794. @subsection Examples
  10795. @itemize
  10796. @item
  10797. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  10798. @example
  10799. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  10800. @end example
  10801. @item
  10802. Find the position of an object in each frame using @command{ffprobe} and write
  10803. it to a log file:
  10804. @example
  10805. ffprobe -f lavfi movie=test.mp4,find_rect=object=object.pgm:threshold=0.3 \
  10806. -show_entries frame=pkt_pts_time:frame_tags=lavfi.rect.x,lavfi.rect.y \
  10807. -of csv -o find_rect.csv
  10808. @end example
  10809. @end itemize
  10810. @section floodfill
  10811. Flood area with values of same pixel components with another values.
  10812. It accepts the following options:
  10813. @table @option
  10814. @item x
  10815. Set pixel x coordinate.
  10816. @item y
  10817. Set pixel y coordinate.
  10818. @item s0
  10819. Set source #0 component value.
  10820. @item s1
  10821. Set source #1 component value.
  10822. @item s2
  10823. Set source #2 component value.
  10824. @item s3
  10825. Set source #3 component value.
  10826. @item d0
  10827. Set destination #0 component value.
  10828. @item d1
  10829. Set destination #1 component value.
  10830. @item d2
  10831. Set destination #2 component value.
  10832. @item d3
  10833. Set destination #3 component value.
  10834. @end table
  10835. @anchor{format}
  10836. @section format
  10837. Convert the input video to one of the specified pixel formats.
  10838. Libavfilter will try to pick one that is suitable as input to
  10839. the next filter.
  10840. It accepts the following parameters:
  10841. @table @option
  10842. @item pix_fmts
  10843. A '|'-separated list of pixel format names, such as
  10844. "pix_fmts=yuv420p|monow|rgb24".
  10845. @item color_spaces
  10846. A '|'-separated list of color space names, such as
  10847. "color_spaces=bt709|bt470bg|bt2020nc".
  10848. @item color_ranges
  10849. A '|'-separated list of color range names, such as
  10850. "color_ranges=tv|pc".
  10851. @end table
  10852. @subsection Examples
  10853. @itemize
  10854. @item
  10855. Convert the input video to the @var{yuv420p} format
  10856. @example
  10857. format=pix_fmts=yuv420p
  10858. @end example
  10859. Convert the input video to any of the formats in the list
  10860. @example
  10861. format=pix_fmts=yuv420p|yuv444p|yuv410p
  10862. @end example
  10863. @end itemize
  10864. @anchor{fps}
  10865. @section fps
  10866. Convert the video to specified constant frame rate by duplicating or dropping
  10867. frames as necessary.
  10868. It accepts the following parameters:
  10869. @table @option
  10870. @item fps
  10871. The desired output frame rate. It accepts expressions containing the following
  10872. constants:
  10873. @table @samp
  10874. @item source_fps
  10875. The input's frame rate
  10876. @item ntsc
  10877. NTSC frame rate of @code{30000/1001}
  10878. @item pal
  10879. PAL frame rate of @code{25.0}
  10880. @item film
  10881. Film frame rate of @code{24.0}
  10882. @item ntsc_film
  10883. NTSC-film frame rate of @code{24000/1001}
  10884. @end table
  10885. The default is @code{25}.
  10886. @item start_time
  10887. Assume the first PTS should be the given value, in seconds. This allows for
  10888. padding/trimming at the start of stream. By default, no assumption is made
  10889. about the first frame's expected PTS, so no padding or trimming is done.
  10890. For example, this could be set to 0 to pad the beginning with duplicates of
  10891. the first frame if a video stream starts after the audio stream or to trim any
  10892. frames with a negative PTS.
  10893. @item round
  10894. Timestamp (PTS) rounding method.
  10895. Possible values are:
  10896. @table @option
  10897. @item zero
  10898. round towards 0
  10899. @item inf
  10900. round away from 0
  10901. @item down
  10902. round towards -infinity
  10903. @item up
  10904. round towards +infinity
  10905. @item near
  10906. round to nearest
  10907. @end table
  10908. The default is @code{near}.
  10909. @item eof_action
  10910. Action performed when reading the last frame.
  10911. Possible values are:
  10912. @table @option
  10913. @item round
  10914. Use same timestamp rounding method as used for other frames.
  10915. @item pass
  10916. Pass through last frame if input duration has not been reached yet.
  10917. @end table
  10918. The default is @code{round}.
  10919. @end table
  10920. Alternatively, the options can be specified as a flat string:
  10921. @var{fps}[:@var{start_time}[:@var{round}]].
  10922. See also the @ref{setpts} filter.
  10923. @subsection Examples
  10924. @itemize
  10925. @item
  10926. A typical usage in order to set the fps to 25:
  10927. @example
  10928. fps=fps=25
  10929. @end example
  10930. @item
  10931. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  10932. @example
  10933. fps=fps=film:round=near
  10934. @end example
  10935. @end itemize
  10936. @section framepack
  10937. Pack two different video streams into a stereoscopic video, setting proper
  10938. metadata on supported codecs. The two views should have the same size and
  10939. framerate and processing will stop when the shorter video ends. Please note
  10940. that you may conveniently adjust view properties with the @ref{scale} and
  10941. @ref{fps} filters.
  10942. It accepts the following parameters:
  10943. @table @option
  10944. @item format
  10945. The desired packing format. Supported values are:
  10946. @table @option
  10947. @item sbs
  10948. The views are next to each other (default).
  10949. @item tab
  10950. The views are on top of each other.
  10951. @item lines
  10952. The views are packed by line.
  10953. @item columns
  10954. The views are packed by column.
  10955. @item frameseq
  10956. The views are temporally interleaved.
  10957. @end table
  10958. @end table
  10959. Some examples:
  10960. @example
  10961. # Convert left and right views into a frame-sequential video
  10962. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  10963. # Convert views into a side-by-side video with the same output resolution as the input
  10964. 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
  10965. @end example
  10966. @section framerate
  10967. Change the frame rate by interpolating new video output frames from the source
  10968. frames.
  10969. This filter is not designed to function correctly with interlaced media. If
  10970. you wish to change the frame rate of interlaced media then you are required
  10971. to deinterlace before this filter and re-interlace after this filter.
  10972. A description of the accepted options follows.
  10973. @table @option
  10974. @item fps
  10975. Specify the output frames per second. This option can also be specified
  10976. as a value alone. The default is @code{50}.
  10977. @item interp_start
  10978. Specify the start of a range where the output frame will be created as a
  10979. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10980. the default is @code{15}.
  10981. @item interp_end
  10982. Specify the end of a range where the output frame will be created as a
  10983. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10984. the default is @code{240}.
  10985. @item scene
  10986. Specify the level at which a scene change is detected as a value between
  10987. 0 and 100 to indicate a new scene; a low value reflects a low
  10988. probability for the current frame to introduce a new scene, while a higher
  10989. value means the current frame is more likely to be one.
  10990. The default is @code{8.2}.
  10991. @item flags
  10992. Specify flags influencing the filter process.
  10993. Available value for @var{flags} is:
  10994. @table @option
  10995. @item scene_change_detect, scd
  10996. Enable scene change detection using the value of the option @var{scene}.
  10997. This flag is enabled by default.
  10998. @end table
  10999. @end table
  11000. @section framestep
  11001. Select one frame every N-th frame.
  11002. This filter accepts the following option:
  11003. @table @option
  11004. @item step
  11005. Select frame after every @code{step} frames.
  11006. Allowed values are positive integers higher than 0. Default value is @code{1}.
  11007. @end table
  11008. @section freezedetect
  11009. Detect frozen video.
  11010. This filter logs a message and sets frame metadata when it detects that the
  11011. input video has no significant change in content during a specified duration.
  11012. Video freeze detection calculates the mean average absolute difference of all
  11013. the components of video frames and compares it to a noise floor.
  11014. The printed times and duration are expressed in seconds. The
  11015. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  11016. whose timestamp equals or exceeds the detection duration and it contains the
  11017. timestamp of the first frame of the freeze. The
  11018. @code{lavfi.freezedetect.freeze_duration} and
  11019. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  11020. after the freeze.
  11021. The filter accepts the following options:
  11022. @table @option
  11023. @item noise, n
  11024. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  11025. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  11026. 0.001.
  11027. @item duration, d
  11028. Set freeze duration until notification (default is 2 seconds).
  11029. @end table
  11030. @section freezeframes
  11031. Freeze video frames.
  11032. This filter freezes video frames using frame from 2nd input.
  11033. The filter accepts the following options:
  11034. @table @option
  11035. @item first
  11036. Set number of first frame from which to start freeze.
  11037. @item last
  11038. Set number of last frame from which to end freeze.
  11039. @item replace
  11040. Set number of frame from 2nd input which will be used instead of replaced frames.
  11041. @end table
  11042. @anchor{frei0r}
  11043. @section frei0r
  11044. Apply a frei0r effect to the input video.
  11045. To enable the compilation of this filter, you need to install the frei0r
  11046. header and configure FFmpeg with @code{--enable-frei0r}.
  11047. It accepts the following parameters:
  11048. @table @option
  11049. @item filter_name
  11050. The name of the frei0r effect to load. If the environment variable
  11051. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  11052. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  11053. Otherwise, the standard frei0r paths are searched, in this order:
  11054. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  11055. @file{/usr/lib/frei0r-1/}.
  11056. @item filter_params
  11057. A '|'-separated list of parameters to pass to the frei0r effect.
  11058. @end table
  11059. A frei0r effect parameter can be a boolean (its value is either
  11060. "y" or "n"), a double, a color (specified as
  11061. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  11062. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  11063. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  11064. a position (specified as @var{X}/@var{Y}, where
  11065. @var{X} and @var{Y} are floating point numbers) and/or a string.
  11066. The number and types of parameters depend on the loaded effect. If an
  11067. effect parameter is not specified, the default value is set.
  11068. @subsection Examples
  11069. @itemize
  11070. @item
  11071. Apply the distort0r effect, setting the first two double parameters:
  11072. @example
  11073. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  11074. @end example
  11075. @item
  11076. Apply the colordistance effect, taking a color as the first parameter:
  11077. @example
  11078. frei0r=colordistance:0.2/0.3/0.4
  11079. frei0r=colordistance:violet
  11080. frei0r=colordistance:0x112233
  11081. @end example
  11082. @item
  11083. Apply the perspective effect, specifying the top left and top right image
  11084. positions:
  11085. @example
  11086. frei0r=perspective:0.2/0.2|0.8/0.2
  11087. @end example
  11088. @end itemize
  11089. For more information, see
  11090. @url{http://frei0r.dyne.org}
  11091. @subsection Commands
  11092. This filter supports the @option{filter_params} option as @ref{commands}.
  11093. @section fspp
  11094. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  11095. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  11096. processing filter, one of them is performed once per block, not per pixel.
  11097. This allows for much higher speed.
  11098. The filter accepts the following options:
  11099. @table @option
  11100. @item quality
  11101. Set quality. This option defines the number of levels for averaging. It accepts
  11102. an integer in the range 4-5. Default value is @code{4}.
  11103. @item qp
  11104. Force a constant quantization parameter. It accepts an integer in range 0-63.
  11105. If not set, the filter will use the QP from the video stream (if available).
  11106. @item strength
  11107. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  11108. more details but also more artifacts, while higher values make the image smoother
  11109. but also blurrier. Default value is @code{0} − PSNR optimal.
  11110. @item use_bframe_qp
  11111. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11112. option may cause flicker since the B-Frames have often larger QP. Default is
  11113. @code{0} (not enabled).
  11114. @end table
  11115. @anchor{fsync}
  11116. @section fsync
  11117. Synchronize video frames with an external mapping from a file.
  11118. For each input PTS given in the map file it either drops or creates as many
  11119. frames as necessary to recreate the sequence of output frames given in the
  11120. map file.
  11121. This filter is useful to recreate the output frames of a framerate conversion
  11122. by the @ref{fps} filter, recorded into a map file using the ffmpeg option
  11123. @code{-stats_mux_pre}, and do further processing to the corresponding frames
  11124. e.g. quality comparison.
  11125. Each line of the map file must contain three items per input frame, the input
  11126. PTS (decimal), the output PTS (decimal) and the
  11127. output TIMEBASE (decimal/decimal), seperated by a space.
  11128. This file format corresponds to the output
  11129. of @code{-stats_mux_pre_fmt="@{ptsi@} @{pts@} @{tb@}"}.
  11130. The filter assumes the map file is sorted by increasing input PTS.
  11131. The filter accepts the following options:
  11132. @table @option
  11133. @item file, f
  11134. The filename of the map file to be used.
  11135. @end table
  11136. Example:
  11137. @example
  11138. # Convert a video to 25 fps and record a MAP_FILE file with the default format of this filter
  11139. ffmpeg -i INPUT -vf fps=fps=25 -stats_mux_pre MAP_FILE -stats_mux_pre_fmt "@{ptsi@} @{pts@} @{tb@}" OUTPUT
  11140. # Sort MAP_FILE by increasing input PTS
  11141. sort -n MAP_FILE
  11142. # Use INPUT, OUTPUT and the MAP_FILE from above to compare the corresponding frames in INPUT and OUTPUT via SSIM
  11143. ffmpeg -i INPUT -i OUTPUT -filter_complex '[0:v]fsync=file=MAP_FILE[ref];[1:v][ref]ssim' -f null -
  11144. @end example
  11145. @section gblur
  11146. Apply Gaussian blur filter.
  11147. The filter accepts the following options:
  11148. @table @option
  11149. @item sigma
  11150. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  11151. @item steps
  11152. Set number of steps for Gaussian approximation. Default is @code{1}.
  11153. @item planes
  11154. Set which planes to filter. By default all planes are filtered.
  11155. @item sigmaV
  11156. Set vertical sigma, if negative it will be same as @code{sigma}.
  11157. Default is @code{-1}.
  11158. @end table
  11159. @subsection Commands
  11160. This filter supports same commands as options.
  11161. The command accepts the same syntax of the corresponding option.
  11162. If the specified expression is not valid, it is kept at its current
  11163. value.
  11164. @section geq
  11165. Apply generic equation to each pixel.
  11166. The filter accepts the following options:
  11167. @table @option
  11168. @item lum_expr, lum
  11169. Set the luma expression.
  11170. @item cb_expr, cb
  11171. Set the chrominance blue expression.
  11172. @item cr_expr, cr
  11173. Set the chrominance red expression.
  11174. @item alpha_expr, a
  11175. Set the alpha expression.
  11176. @item red_expr, r
  11177. Set the red expression.
  11178. @item green_expr, g
  11179. Set the green expression.
  11180. @item blue_expr, b
  11181. Set the blue expression.
  11182. @end table
  11183. The colorspace is selected according to the specified options. If one
  11184. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  11185. options is specified, the filter will automatically select a YCbCr
  11186. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  11187. @option{blue_expr} options is specified, it will select an RGB
  11188. colorspace.
  11189. If one of the chrominance expression is not defined, it falls back on the other
  11190. one. If no alpha expression is specified it will evaluate to opaque value.
  11191. If none of chrominance expressions are specified, they will evaluate
  11192. to the luma expression.
  11193. The expressions can use the following variables and functions:
  11194. @table @option
  11195. @item N
  11196. The sequential number of the filtered frame, starting from @code{0}.
  11197. @item X
  11198. @item Y
  11199. The coordinates of the current sample.
  11200. @item W
  11201. @item H
  11202. The width and height of the image.
  11203. @item SW
  11204. @item SH
  11205. Width and height scale depending on the currently filtered plane. It is the
  11206. ratio between the corresponding luma plane number of pixels and the current
  11207. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  11208. @code{0.5,0.5} for chroma planes.
  11209. @item T
  11210. Time of the current frame, expressed in seconds.
  11211. @item p(x, y)
  11212. Return the value of the pixel at location (@var{x},@var{y}) of the current
  11213. plane.
  11214. @item lum(x, y)
  11215. Return the value of the pixel at location (@var{x},@var{y}) of the luma
  11216. plane.
  11217. @item cb(x, y)
  11218. Return the value of the pixel at location (@var{x},@var{y}) of the
  11219. blue-difference chroma plane. Return 0 if there is no such plane.
  11220. @item cr(x, y)
  11221. Return the value of the pixel at location (@var{x},@var{y}) of the
  11222. red-difference chroma plane. Return 0 if there is no such plane.
  11223. @item r(x, y)
  11224. @item g(x, y)
  11225. @item b(x, y)
  11226. Return the value of the pixel at location (@var{x},@var{y}) of the
  11227. red/green/blue component. Return 0 if there is no such component.
  11228. @item alpha(x, y)
  11229. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  11230. plane. Return 0 if there is no such plane.
  11231. @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)
  11232. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  11233. sums of samples within a rectangle. See the functions without the sum postfix.
  11234. @item interpolation
  11235. Set one of interpolation methods:
  11236. @table @option
  11237. @item nearest, n
  11238. @item bilinear, b
  11239. @end table
  11240. Default is bilinear.
  11241. @end table
  11242. For functions, if @var{x} and @var{y} are outside the area, the value will be
  11243. automatically clipped to the closer edge.
  11244. Please note that this filter can use multiple threads in which case each slice
  11245. will have its own expression state. If you want to use only a single expression
  11246. state because your expressions depend on previous state then you should limit
  11247. the number of filter threads to 1.
  11248. @subsection Examples
  11249. @itemize
  11250. @item
  11251. Flip the image horizontally:
  11252. @example
  11253. geq=p(W-X\,Y)
  11254. @end example
  11255. @item
  11256. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  11257. wavelength of 100 pixels:
  11258. @example
  11259. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  11260. @end example
  11261. @item
  11262. Generate a fancy enigmatic moving light:
  11263. @example
  11264. 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
  11265. @end example
  11266. @item
  11267. Generate a quick emboss effect:
  11268. @example
  11269. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  11270. @end example
  11271. @item
  11272. Modify RGB components depending on pixel position:
  11273. @example
  11274. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  11275. @end example
  11276. @item
  11277. Create a radial gradient that is the same size as the input (also see
  11278. the @ref{vignette} filter):
  11279. @example
  11280. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  11281. @end example
  11282. @end itemize
  11283. @section gradfun
  11284. Fix the banding artifacts that are sometimes introduced into nearly flat
  11285. regions by truncation to 8-bit color depth.
  11286. Interpolate the gradients that should go where the bands are, and
  11287. dither them.
  11288. It is designed for playback only. Do not use it prior to
  11289. lossy compression, because compression tends to lose the dither and
  11290. bring back the bands.
  11291. It accepts the following parameters:
  11292. @table @option
  11293. @item strength
  11294. The maximum amount by which the filter will change any one pixel. This is also
  11295. the threshold for detecting nearly flat regions. Acceptable values range from
  11296. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  11297. valid range.
  11298. @item radius
  11299. The neighborhood to fit the gradient to. A larger radius makes for smoother
  11300. gradients, but also prevents the filter from modifying the pixels near detailed
  11301. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  11302. values will be clipped to the valid range.
  11303. @end table
  11304. Alternatively, the options can be specified as a flat string:
  11305. @var{strength}[:@var{radius}]
  11306. @subsection Examples
  11307. @itemize
  11308. @item
  11309. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  11310. @example
  11311. gradfun=3.5:8
  11312. @end example
  11313. @item
  11314. Specify radius, omitting the strength (which will fall-back to the default
  11315. value):
  11316. @example
  11317. gradfun=radius=8
  11318. @end example
  11319. @end itemize
  11320. @anchor{graphmonitor}
  11321. @section graphmonitor
  11322. Show various filtergraph stats.
  11323. With this filter one can debug complete filtergraph.
  11324. Especially issues with links filling with queued frames.
  11325. The filter accepts the following options:
  11326. @table @option
  11327. @item size, s
  11328. Set video output size. Default is @var{hd720}.
  11329. @item opacity, o
  11330. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  11331. @item mode, m
  11332. Set output mode flags.
  11333. Available values for flags are:
  11334. @table @samp
  11335. @item full
  11336. No any filtering. Default.
  11337. @item compact
  11338. Show only filters with queued frames.
  11339. @item nozero
  11340. Show only filters with non-zero stats.
  11341. @item noeof
  11342. Show only filters with non-eof stat.
  11343. @item nodisabled
  11344. Show only filters that are enabled in timeline.
  11345. @end table
  11346. @item flags, f
  11347. Set flags which enable which stats are shown in video.
  11348. Available values for flags are:
  11349. @table @samp
  11350. @item none
  11351. All flags turned off.
  11352. @item all
  11353. All flags turned on.
  11354. @item queue
  11355. Display number of queued frames in each link.
  11356. @item frame_count_in
  11357. Display number of frames taken from filter.
  11358. @item frame_count_out
  11359. Display number of frames given out from filter.
  11360. @item frame_count_delta
  11361. Display delta number of frames between above two values.
  11362. @item pts
  11363. Display current filtered frame pts.
  11364. @item pts_delta
  11365. Display pts delta between current and previous frame.
  11366. @item time
  11367. Display current filtered frame time.
  11368. @item time_delta
  11369. Display time delta between current and previous frame.
  11370. @item timebase
  11371. Display time base for filter link.
  11372. @item format
  11373. Display used format for filter link.
  11374. @item size
  11375. Display video size or number of audio channels in case of audio used by filter link.
  11376. @item rate
  11377. Display video frame rate or sample rate in case of audio used by filter link.
  11378. @item eof
  11379. Display link output status.
  11380. @item sample_count_in
  11381. Display number of samples taken from filter.
  11382. @item sample_count_out
  11383. Display number of samples given out from filter.
  11384. @item sample_count_delta
  11385. Display delta number of samples between above two values.
  11386. @item disabled
  11387. Show the timeline filter status.
  11388. @end table
  11389. @item rate, r
  11390. Set upper limit for video rate of output stream, Default value is @var{25}.
  11391. This guarantee that output video frame rate will not be higher than this value.
  11392. @end table
  11393. @section grayworld
  11394. A color constancy filter that applies color correction based on the grayworld assumption
  11395. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  11396. The algorithm uses linear light, so input
  11397. data should be linearized beforehand (and possibly correctly tagged).
  11398. @example
  11399. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  11400. @end example
  11401. @section greyedge
  11402. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  11403. and corrects the scene colors accordingly.
  11404. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  11405. The filter accepts the following options:
  11406. @table @option
  11407. @item difford
  11408. The order of differentiation to be applied on the scene. Must be chosen in the range
  11409. [0,2] and default value is 1.
  11410. @item minknorm
  11411. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  11412. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  11413. max value instead of calculating Minkowski distance.
  11414. @item sigma
  11415. The standard deviation of Gaussian blur to be applied on the scene. Must be
  11416. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  11417. can't be equal to 0 if @var{difford} is greater than 0.
  11418. @end table
  11419. @subsection Examples
  11420. @itemize
  11421. @item
  11422. Grey Edge:
  11423. @example
  11424. greyedge=difford=1:minknorm=5:sigma=2
  11425. @end example
  11426. @item
  11427. Max Edge:
  11428. @example
  11429. greyedge=difford=1:minknorm=0:sigma=2
  11430. @end example
  11431. @end itemize
  11432. @section guided
  11433. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  11434. The filter accepts the following options:
  11435. @table @option
  11436. @item radius
  11437. Set the box radius in pixels.
  11438. Allowed range is 1 to 20. Default is 3.
  11439. @item eps
  11440. Set regularization parameter (with square).
  11441. Allowed range is 0 to 1. Default is 0.01.
  11442. @item mode
  11443. Set filter mode. Can be @code{basic} or @code{fast}.
  11444. Default is @code{basic}.
  11445. @item sub
  11446. Set subsampling ratio for @code{fast} mode.
  11447. Range is 2 to 64. Default is 4.
  11448. No subsampling occurs in @code{basic} mode.
  11449. @item guidance
  11450. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  11451. If @code{off}, single input is required.
  11452. If @code{on}, two inputs of the same resolution and pixel format are required.
  11453. The second input serves as the guidance.
  11454. @item planes
  11455. Set planes to filter. Default is first only.
  11456. @end table
  11457. @subsection Commands
  11458. This filter supports the all above options as @ref{commands}.
  11459. @subsection Examples
  11460. @itemize
  11461. @item
  11462. Edge-preserving smoothing with guided filter:
  11463. @example
  11464. ffmpeg -i in.png -vf guided out.png
  11465. @end example
  11466. @item
  11467. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  11468. For the generation of guidance image, refer to paper "Guided Image Filtering".
  11469. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  11470. @example
  11471. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  11472. @end example
  11473. @end itemize
  11474. @anchor{haldclut}
  11475. @section haldclut
  11476. Apply a Hald CLUT to a video stream.
  11477. First input is the video stream to process, and second one is the Hald CLUT.
  11478. The Hald CLUT input can be a simple picture or a complete video stream.
  11479. The filter accepts the following options:
  11480. @table @option
  11481. @item clut
  11482. Set which CLUT video frames will be processed from second input stream,
  11483. can be @var{first} or @var{all}. Default is @var{all}.
  11484. @item shortest
  11485. Force termination when the shortest input terminates. Default is @code{0}.
  11486. @item repeatlast
  11487. Continue applying the last CLUT after the end of the stream. A value of
  11488. @code{0} disable the filter after the last frame of the CLUT is reached.
  11489. Default is @code{1}.
  11490. @end table
  11491. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  11492. filters share the same internals).
  11493. This filter also supports the @ref{framesync} options.
  11494. More information about the Hald CLUT can be found on Eskil Steenberg's website
  11495. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  11496. @subsection Commands
  11497. This filter supports the @code{interp} option as @ref{commands}.
  11498. @subsection Workflow examples
  11499. @subsubsection Hald CLUT video stream
  11500. Generate an identity Hald CLUT stream altered with various effects:
  11501. @example
  11502. 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
  11503. @end example
  11504. Note: make sure you use a lossless codec.
  11505. Then use it with @code{haldclut} to apply it on some random stream:
  11506. @example
  11507. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  11508. @end example
  11509. The Hald CLUT will be applied to the 10 first seconds (duration of
  11510. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  11511. to the remaining frames of the @code{mandelbrot} stream.
  11512. @subsubsection Hald CLUT with preview
  11513. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  11514. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  11515. biggest possible square starting at the top left of the picture. The remaining
  11516. padding pixels (bottom or right) will be ignored. This area can be used to add
  11517. a preview of the Hald CLUT.
  11518. Typically, the following generated Hald CLUT will be supported by the
  11519. @code{haldclut} filter:
  11520. @example
  11521. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  11522. pad=iw+320 [padded_clut];
  11523. smptebars=s=320x256, split [a][b];
  11524. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  11525. [main][b] overlay=W-320" -frames:v 1 clut.png
  11526. @end example
  11527. It contains the original and a preview of the effect of the CLUT: SMPTE color
  11528. bars are displayed on the right-top, and below the same color bars processed by
  11529. the color changes.
  11530. Then, the effect of this Hald CLUT can be visualized with:
  11531. @example
  11532. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  11533. @end example
  11534. @section hflip
  11535. Flip the input video horizontally.
  11536. For example, to horizontally flip the input video with @command{ffmpeg}:
  11537. @example
  11538. ffmpeg -i in.avi -vf "hflip" out.avi
  11539. @end example
  11540. @section histeq
  11541. This filter applies a global color histogram equalization on a
  11542. per-frame basis.
  11543. It can be used to correct video that has a compressed range of pixel
  11544. intensities. The filter redistributes the pixel intensities to
  11545. equalize their distribution across the intensity range. It may be
  11546. viewed as an "automatically adjusting contrast filter". This filter is
  11547. useful only for correcting degraded or poorly captured source
  11548. video.
  11549. The filter accepts the following options:
  11550. @table @option
  11551. @item strength
  11552. Determine the amount of equalization to be applied. As the strength
  11553. is reduced, the distribution of pixel intensities more-and-more
  11554. approaches that of the input frame. The value must be a float number
  11555. in the range [0,1] and defaults to 0.200.
  11556. @item intensity
  11557. Set the maximum intensity that can generated and scale the output
  11558. values appropriately. The strength should be set as desired and then
  11559. the intensity can be limited if needed to avoid washing-out. The value
  11560. must be a float number in the range [0,1] and defaults to 0.210.
  11561. @item antibanding
  11562. Set the antibanding level. If enabled the filter will randomly vary
  11563. the luminance of output pixels by a small amount to avoid banding of
  11564. the histogram. Possible values are @code{none}, @code{weak} or
  11565. @code{strong}. It defaults to @code{none}.
  11566. @end table
  11567. @anchor{histogram}
  11568. @section histogram
  11569. Compute and draw a color distribution histogram for the input video.
  11570. The computed histogram is a representation of the color component
  11571. distribution in an image.
  11572. Standard histogram displays the color components distribution in an image.
  11573. Displays color graph for each color component. Shows distribution of
  11574. the Y, U, V, A or R, G, B components, depending on input format, in the
  11575. current frame. Below each graph a color component scale meter is shown.
  11576. The filter accepts the following options:
  11577. @table @option
  11578. @item level_height
  11579. Set height of level. Default value is @code{200}.
  11580. Allowed range is [50, 2048].
  11581. @item scale_height
  11582. Set height of color scale. Default value is @code{12}.
  11583. Allowed range is [0, 40].
  11584. @item display_mode
  11585. Set display mode.
  11586. It accepts the following values:
  11587. @table @samp
  11588. @item stack
  11589. Per color component graphs are placed below each other.
  11590. @item parade
  11591. Per color component graphs are placed side by side.
  11592. @item overlay
  11593. Presents information identical to that in the @code{parade}, except
  11594. that the graphs representing color components are superimposed directly
  11595. over one another.
  11596. @end table
  11597. Default is @code{stack}.
  11598. @item levels_mode
  11599. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  11600. Default is @code{linear}.
  11601. @item components
  11602. Set what color components to display.
  11603. Default is @code{7}.
  11604. @item fgopacity
  11605. Set foreground opacity. Default is @code{0.7}.
  11606. @item bgopacity
  11607. Set background opacity. Default is @code{0.5}.
  11608. @item colors_mode
  11609. Set colors mode.
  11610. It accepts the following values:
  11611. @table @samp
  11612. @item whiteonblack
  11613. @item blackonwhite
  11614. @item whiteongray
  11615. @item blackongray
  11616. @item coloronblack
  11617. @item coloronwhite
  11618. @item colorongray
  11619. @item blackoncolor
  11620. @item whiteoncolor
  11621. @item grayoncolor
  11622. @end table
  11623. Default is @code{whiteonblack}.
  11624. @end table
  11625. @subsection Examples
  11626. @itemize
  11627. @item
  11628. Calculate and draw histogram:
  11629. @example
  11630. ffplay -i input -vf histogram
  11631. @end example
  11632. @end itemize
  11633. @anchor{hqdn3d}
  11634. @section hqdn3d
  11635. This is a high precision/quality 3d denoise filter. It aims to reduce
  11636. image noise, producing smooth images and making still images really
  11637. still. It should enhance compressibility.
  11638. It accepts the following optional parameters:
  11639. @table @option
  11640. @item luma_spatial
  11641. A non-negative floating point number which specifies spatial luma strength.
  11642. It defaults to 4.0.
  11643. @item chroma_spatial
  11644. A non-negative floating point number which specifies spatial chroma strength.
  11645. It defaults to 3.0*@var{luma_spatial}/4.0.
  11646. @item luma_tmp
  11647. A floating point number which specifies luma temporal strength. It defaults to
  11648. 6.0*@var{luma_spatial}/4.0.
  11649. @item chroma_tmp
  11650. A floating point number which specifies chroma temporal strength. It defaults to
  11651. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  11652. @end table
  11653. @subsection Commands
  11654. This filter supports same @ref{commands} as options.
  11655. The command accepts the same syntax of the corresponding option.
  11656. If the specified expression is not valid, it is kept at its current
  11657. value.
  11658. @anchor{hwdownload}
  11659. @section hwdownload
  11660. Download hardware frames to system memory.
  11661. The input must be in hardware frames, and the output a non-hardware format.
  11662. Not all formats will be supported on the output - it may be necessary to insert
  11663. an additional @option{format} filter immediately following in the graph to get
  11664. the output in a supported format.
  11665. @section hwmap
  11666. Map hardware frames to system memory or to another device.
  11667. This filter has several different modes of operation; which one is used depends
  11668. on the input and output formats:
  11669. @itemize
  11670. @item
  11671. Hardware frame input, normal frame output
  11672. Map the input frames to system memory and pass them to the output. If the
  11673. original hardware frame is later required (for example, after overlaying
  11674. something else on part of it), the @option{hwmap} filter can be used again
  11675. in the next mode to retrieve it.
  11676. @item
  11677. Normal frame input, hardware frame output
  11678. If the input is actually a software-mapped hardware frame, then unmap it -
  11679. that is, return the original hardware frame.
  11680. Otherwise, a device must be provided. Create new hardware surfaces on that
  11681. device for the output, then map them back to the software format at the input
  11682. and give those frames to the preceding filter. This will then act like the
  11683. @option{hwupload} filter, but may be able to avoid an additional copy when
  11684. the input is already in a compatible format.
  11685. @item
  11686. Hardware frame input and output
  11687. A device must be supplied for the output, either directly or with the
  11688. @option{derive_device} option. The input and output devices must be of
  11689. different types and compatible - the exact meaning of this is
  11690. system-dependent, but typically it means that they must refer to the same
  11691. underlying hardware context (for example, refer to the same graphics card).
  11692. If the input frames were originally created on the output device, then unmap
  11693. to retrieve the original frames.
  11694. Otherwise, map the frames to the output device - create new hardware frames
  11695. on the output corresponding to the frames on the input.
  11696. @end itemize
  11697. The following additional parameters are accepted:
  11698. @table @option
  11699. @item mode
  11700. Set the frame mapping mode. Some combination of:
  11701. @table @var
  11702. @item read
  11703. The mapped frame should be readable.
  11704. @item write
  11705. The mapped frame should be writeable.
  11706. @item overwrite
  11707. The mapping will always overwrite the entire frame.
  11708. This may improve performance in some cases, as the original contents of the
  11709. frame need not be loaded.
  11710. @item direct
  11711. The mapping must not involve any copying.
  11712. Indirect mappings to copies of frames are created in some cases where either
  11713. direct mapping is not possible or it would have unexpected properties.
  11714. Setting this flag ensures that the mapping is direct and will fail if that is
  11715. not possible.
  11716. @end table
  11717. Defaults to @var{read+write} if not specified.
  11718. @item derive_device @var{type}
  11719. Rather than using the device supplied at initialisation, instead derive a new
  11720. device of type @var{type} from the device the input frames exist on.
  11721. @item reverse
  11722. In a hardware to hardware mapping, map in reverse - create frames in the sink
  11723. and map them back to the source. This may be necessary in some cases where
  11724. a mapping in one direction is required but only the opposite direction is
  11725. supported by the devices being used.
  11726. This option is dangerous - it may break the preceding filter in undefined
  11727. ways if there are any additional constraints on that filter's output.
  11728. Do not use it without fully understanding the implications of its use.
  11729. @end table
  11730. @anchor{hwupload}
  11731. @section hwupload
  11732. Upload system memory frames to hardware surfaces.
  11733. The device to upload to must be supplied when the filter is initialised. If
  11734. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  11735. option or with the @option{derive_device} option. The input and output devices
  11736. must be of different types and compatible - the exact meaning of this is
  11737. system-dependent, but typically it means that they must refer to the same
  11738. underlying hardware context (for example, refer to the same graphics card).
  11739. The following additional parameters are accepted:
  11740. @table @option
  11741. @item derive_device @var{type}
  11742. Rather than using the device supplied at initialisation, instead derive a new
  11743. device of type @var{type} from the device the input frames exist on.
  11744. @end table
  11745. @anchor{hwupload_cuda}
  11746. @section hwupload_cuda
  11747. Upload system memory frames to a CUDA device.
  11748. It accepts the following optional parameters:
  11749. @table @option
  11750. @item device
  11751. The number of the CUDA device to use
  11752. @end table
  11753. @section hqx
  11754. Apply a high-quality magnification filter designed for pixel art. This filter
  11755. was originally created by Maxim Stepin.
  11756. It accepts the following option:
  11757. @table @option
  11758. @item n
  11759. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  11760. @code{hq3x} and @code{4} for @code{hq4x}.
  11761. Default is @code{3}.
  11762. @end table
  11763. @anchor{hstack}
  11764. @section hstack
  11765. Stack input videos horizontally.
  11766. All streams must be of same pixel format and of same height.
  11767. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11768. to create same output.
  11769. The filter accepts the following option:
  11770. @table @option
  11771. @item inputs
  11772. Set number of input streams. Default is 2.
  11773. @item shortest
  11774. If set to 1, force the output to terminate when the shortest input
  11775. terminates. Default value is 0.
  11776. @end table
  11777. @section hsvhold
  11778. Turns a certain HSV range into gray values.
  11779. This filter measures color difference between set HSV color in options
  11780. and ones measured in video stream. Depending on options, output
  11781. colors can be changed to be gray or not.
  11782. The filter accepts the following options:
  11783. @table @option
  11784. @item hue
  11785. Set the hue value which will be used in color difference calculation.
  11786. Allowed range is from -360 to 360. Default value is 0.
  11787. @item sat
  11788. Set the saturation value which will be used in color difference calculation.
  11789. Allowed range is from -1 to 1. Default value is 0.
  11790. @item val
  11791. Set the value which will be used in color difference calculation.
  11792. Allowed range is from -1 to 1. Default value is 0.
  11793. @item similarity
  11794. Set similarity percentage with the key color.
  11795. Allowed range is from 0 to 1. Default value is 0.01.
  11796. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11797. @item blend
  11798. Blend percentage.
  11799. Allowed range is from 0 to 1. Default value is 0.
  11800. 0.0 makes pixels either fully gray, or not gray at all.
  11801. Higher values result in more gray pixels, with a higher gray pixel
  11802. the more similar the pixels color is to the key color.
  11803. @end table
  11804. @section hsvkey
  11805. Turns a certain HSV range into transparency.
  11806. This filter measures color difference between set HSV color in options
  11807. and ones measured in video stream. Depending on options, output
  11808. colors can be changed to transparent by adding alpha channel.
  11809. The filter accepts the following options:
  11810. @table @option
  11811. @item hue
  11812. Set the hue value which will be used in color difference calculation.
  11813. Allowed range is from -360 to 360. Default value is 0.
  11814. @item sat
  11815. Set the saturation value which will be used in color difference calculation.
  11816. Allowed range is from -1 to 1. Default value is 0.
  11817. @item val
  11818. Set the value which will be used in color difference calculation.
  11819. Allowed range is from -1 to 1. Default value is 0.
  11820. @item similarity
  11821. Set similarity percentage with the key color.
  11822. Allowed range is from 0 to 1. Default value is 0.01.
  11823. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11824. @item blend
  11825. Blend percentage.
  11826. Allowed range is from 0 to 1. Default value is 0.
  11827. 0.0 makes pixels either fully transparent, or not transparent at all.
  11828. Higher values result in semi-transparent pixels, with a higher transparency
  11829. the more similar the pixels color is to the key color.
  11830. @end table
  11831. @section hue
  11832. Modify the hue and/or the saturation of the input.
  11833. It accepts the following parameters:
  11834. @table @option
  11835. @item h
  11836. Specify the hue angle as a number of degrees. It accepts an expression,
  11837. and defaults to "0".
  11838. @item s
  11839. Specify the saturation in the [-10,10] range. It accepts an expression and
  11840. defaults to "1".
  11841. @item H
  11842. Specify the hue angle as a number of radians. It accepts an
  11843. expression, and defaults to "0".
  11844. @item b
  11845. Specify the brightness in the [-10,10] range. It accepts an expression and
  11846. defaults to "0".
  11847. @end table
  11848. @option{h} and @option{H} are mutually exclusive, and can't be
  11849. specified at the same time.
  11850. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  11851. expressions containing the following constants:
  11852. @table @option
  11853. @item n
  11854. frame count of the input frame starting from 0
  11855. @item pts
  11856. presentation timestamp of the input frame expressed in time base units
  11857. @item r
  11858. frame rate of the input video, NAN if the input frame rate is unknown
  11859. @item t
  11860. timestamp expressed in seconds, NAN if the input timestamp is unknown
  11861. @item tb
  11862. time base of the input video
  11863. @end table
  11864. @subsection Examples
  11865. @itemize
  11866. @item
  11867. Set the hue to 90 degrees and the saturation to 1.0:
  11868. @example
  11869. hue=h=90:s=1
  11870. @end example
  11871. @item
  11872. Same command but expressing the hue in radians:
  11873. @example
  11874. hue=H=PI/2:s=1
  11875. @end example
  11876. @item
  11877. Rotate hue and make the saturation swing between 0
  11878. and 2 over a period of 1 second:
  11879. @example
  11880. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  11881. @end example
  11882. @item
  11883. Apply a 3 seconds saturation fade-in effect starting at 0:
  11884. @example
  11885. hue="s=min(t/3\,1)"
  11886. @end example
  11887. The general fade-in expression can be written as:
  11888. @example
  11889. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  11890. @end example
  11891. @item
  11892. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  11893. @example
  11894. hue="s=max(0\, min(1\, (8-t)/3))"
  11895. @end example
  11896. The general fade-out expression can be written as:
  11897. @example
  11898. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  11899. @end example
  11900. @end itemize
  11901. @subsection Commands
  11902. This filter supports the following commands:
  11903. @table @option
  11904. @item b
  11905. @item s
  11906. @item h
  11907. @item H
  11908. Modify the hue and/or the saturation and/or brightness of the input video.
  11909. The command accepts the same syntax of the corresponding option.
  11910. If the specified expression is not valid, it is kept at its current
  11911. value.
  11912. @end table
  11913. @section huesaturation
  11914. Apply hue-saturation-intensity adjustments to input video stream.
  11915. This filter operates in RGB colorspace.
  11916. This filter accepts the following options:
  11917. @table @option
  11918. @item hue
  11919. Set the hue shift in degrees to apply. Default is 0.
  11920. Allowed range is from -180 to 180.
  11921. @item saturation
  11922. Set the saturation shift. Default is 0.
  11923. Allowed range is from -1 to 1.
  11924. @item intensity
  11925. Set the intensity shift. Default is 0.
  11926. Allowed range is from -1 to 1.
  11927. @item colors
  11928. Set which primary and complementary colors are going to be adjusted.
  11929. This options is set by providing one or multiple values.
  11930. This can select multiple colors at once. By default all colors are selected.
  11931. @table @samp
  11932. @item r
  11933. Adjust reds.
  11934. @item y
  11935. Adjust yellows.
  11936. @item g
  11937. Adjust greens.
  11938. @item c
  11939. Adjust cyans.
  11940. @item b
  11941. Adjust blues.
  11942. @item m
  11943. Adjust magentas.
  11944. @item a
  11945. Adjust all colors.
  11946. @end table
  11947. @item strength
  11948. Set strength of filtering. Allowed range is from 0 to 100.
  11949. Default value is 1.
  11950. @item rw, gw, bw
  11951. Set weight for each RGB component. Allowed range is from 0 to 1.
  11952. By default is set to 0.333, 0.334, 0.333.
  11953. Those options are used in saturation and lightess processing.
  11954. @item lightness
  11955. Set preserving lightness, by default is disabled.
  11956. Adjusting hues can change lightness from original RGB triplet,
  11957. with this option enabled lightness is kept at same value.
  11958. @end table
  11959. @section hysteresis
  11960. Grow first stream into second stream by connecting components.
  11961. This makes it possible to build more robust edge masks.
  11962. This filter accepts the following options:
  11963. @table @option
  11964. @item planes
  11965. Set which planes will be processed as bitmap, unprocessed planes will be
  11966. copied from first stream.
  11967. By default value 0xf, all planes will be processed.
  11968. @item threshold
  11969. Set threshold which is used in filtering. If pixel component value is higher than
  11970. this value filter algorithm for connecting components is activated.
  11971. By default value is 0.
  11972. @end table
  11973. The @code{hysteresis} filter also supports the @ref{framesync} options.
  11974. @section iccdetect
  11975. Detect the colorspace from an embedded ICC profile (if present), and update
  11976. the frame's tags accordingly.
  11977. This filter accepts the following options:
  11978. @table @option
  11979. @item force
  11980. If true, the frame's existing colorspace tags will always be overridden by
  11981. values detected from an ICC profile. Otherwise, they will only be assigned if
  11982. they contain @code{unknown}. Enabled by default.
  11983. @end table
  11984. @section iccgen
  11985. Generate ICC profiles and attach them to frames.
  11986. This filter accepts the following options:
  11987. @table @option
  11988. @item color_primaries
  11989. @item color_trc
  11990. Configure the colorspace that the ICC profile will be generated for. The
  11991. default value of @code{auto} infers the value from the input frame's metadata,
  11992. defaulting to BT.709/sRGB as appropriate.
  11993. See the @ref{setparams} filter for a list of possible values, but note that
  11994. @code{unknown} are not valid values for this filter.
  11995. @item force
  11996. If true, an ICC profile will be generated even if it would overwrite an
  11997. already existing ICC profile. Disabled by default.
  11998. @end table
  11999. @section identity
  12000. Obtain the identity score between two input videos.
  12001. This filter takes two input videos.
  12002. Both input videos must have the same resolution and pixel format for
  12003. this filter to work correctly. Also it assumes that both inputs
  12004. have the same number of frames, which are compared one by one.
  12005. The obtained per component, average, min and max identity score is printed through
  12006. the logging system.
  12007. The filter stores the calculated identity scores of each frame in frame metadata.
  12008. This filter also supports the @ref{framesync} options.
  12009. In the below example the input file @file{main.mpg} being processed is compared
  12010. with the reference file @file{ref.mpg}.
  12011. @example
  12012. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  12013. @end example
  12014. @section idet
  12015. Detect video interlacing type.
  12016. This filter tries to detect if the input frames are interlaced, progressive,
  12017. top or bottom field first. It will also try to detect fields that are
  12018. repeated between adjacent frames (a sign of telecine).
  12019. Single frame detection considers only immediately adjacent frames when classifying each frame.
  12020. Multiple frame detection incorporates the classification history of previous frames.
  12021. The filter will log these metadata values:
  12022. @table @option
  12023. @item single.current_frame
  12024. Detected type of current frame using single-frame detection. One of:
  12025. ``tff'' (top field first), ``bff'' (bottom field first),
  12026. ``progressive'', or ``undetermined''
  12027. @item single.tff
  12028. Cumulative number of frames detected as top field first using single-frame detection.
  12029. @item multiple.tff
  12030. Cumulative number of frames detected as top field first using multiple-frame detection.
  12031. @item single.bff
  12032. Cumulative number of frames detected as bottom field first using single-frame detection.
  12033. @item multiple.current_frame
  12034. Detected type of current frame using multiple-frame detection. One of:
  12035. ``tff'' (top field first), ``bff'' (bottom field first),
  12036. ``progressive'', or ``undetermined''
  12037. @item multiple.bff
  12038. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  12039. @item single.progressive
  12040. Cumulative number of frames detected as progressive using single-frame detection.
  12041. @item multiple.progressive
  12042. Cumulative number of frames detected as progressive using multiple-frame detection.
  12043. @item single.undetermined
  12044. Cumulative number of frames that could not be classified using single-frame detection.
  12045. @item multiple.undetermined
  12046. Cumulative number of frames that could not be classified using multiple-frame detection.
  12047. @item repeated.current_frame
  12048. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  12049. @item repeated.neither
  12050. Cumulative number of frames with no repeated field.
  12051. @item repeated.top
  12052. Cumulative number of frames with the top field repeated from the previous frame's top field.
  12053. @item repeated.bottom
  12054. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  12055. @end table
  12056. The filter accepts the following options:
  12057. @table @option
  12058. @item intl_thres
  12059. Set interlacing threshold.
  12060. @item prog_thres
  12061. Set progressive threshold.
  12062. @item rep_thres
  12063. Threshold for repeated field detection.
  12064. @item half_life
  12065. Number of frames after which a given frame's contribution to the
  12066. statistics is halved (i.e., it contributes only 0.5 to its
  12067. classification). The default of 0 means that all frames seen are given
  12068. full weight of 1.0 forever.
  12069. @item analyze_interlaced_flag
  12070. When this is not 0 then idet will use the specified number of frames to determine
  12071. if the interlaced flag is accurate, it will not count undetermined frames.
  12072. If the flag is found to be accurate it will be used without any further
  12073. computations, if it is found to be inaccurate it will be cleared without any
  12074. further computations. This allows inserting the idet filter as a low computational
  12075. method to clean up the interlaced flag
  12076. @end table
  12077. @subsection Examples
  12078. Inspect the field order of the first 360 frames in a video, in verbose detail:
  12079. @example
  12080. ffmpeg -i INPUT -filter:v idet,metadata=mode=print -frames:v 360 -an -f null -
  12081. @end example
  12082. The idet filter will add analysis metadata to each frame, which will then be
  12083. discarded. At the end, the filter will also print a final report with statistics.
  12084. @section il
  12085. Deinterleave or interleave fields.
  12086. This filter allows one to process interlaced images fields without
  12087. deinterlacing them. Deinterleaving splits the input frame into 2
  12088. fields (so called half pictures). Odd lines are moved to the top
  12089. half of the output image, even lines to the bottom half.
  12090. You can process (filter) them independently and then re-interleave them.
  12091. The filter accepts the following options:
  12092. @table @option
  12093. @item luma_mode, l
  12094. @item chroma_mode, c
  12095. @item alpha_mode, a
  12096. Available values for @var{luma_mode}, @var{chroma_mode} and
  12097. @var{alpha_mode} are:
  12098. @table @samp
  12099. @item none
  12100. Do nothing.
  12101. @item deinterleave, d
  12102. Deinterleave fields, placing one above the other.
  12103. @item interleave, i
  12104. Interleave fields. Reverse the effect of deinterleaving.
  12105. @end table
  12106. Default value is @code{none}.
  12107. @item luma_swap, ls
  12108. @item chroma_swap, cs
  12109. @item alpha_swap, as
  12110. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  12111. @end table
  12112. @subsection Commands
  12113. This filter supports the all above options as @ref{commands}.
  12114. @section inflate
  12115. Apply inflate effect to the video.
  12116. This filter replaces the pixel by the local(3x3) average by taking into account
  12117. only values higher than the pixel.
  12118. It accepts the following options:
  12119. @table @option
  12120. @item threshold0
  12121. @item threshold1
  12122. @item threshold2
  12123. @item threshold3
  12124. Limit the maximum change for each plane, default is 65535.
  12125. If 0, plane will remain unchanged.
  12126. @end table
  12127. @subsection Commands
  12128. This filter supports the all above options as @ref{commands}.
  12129. @section interlace, interlace_vulkan
  12130. Simple interlacing filter from progressive contents. This interleaves upper (or
  12131. lower) lines from odd frames with lower (or upper) lines from even frames,
  12132. halving the frame rate and preserving image height.
  12133. @example
  12134. Original Original New Frame
  12135. Frame 'j' Frame 'j+1' (tff)
  12136. ========== =========== ==================
  12137. Line 0 --------------------> Frame 'j' Line 0
  12138. Line 1 Line 1 ----> Frame 'j+1' Line 1
  12139. Line 2 ---------------------> Frame 'j' Line 2
  12140. Line 3 Line 3 ----> Frame 'j+1' Line 3
  12141. ... ... ...
  12142. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  12143. @end example
  12144. It accepts the following optional parameters:
  12145. @table @option
  12146. @item scan
  12147. This determines whether the interlaced frame is taken from the even
  12148. (tff - default) or odd (bff) lines of the progressive frame.
  12149. @item lowpass
  12150. Vertical lowpass filter to avoid twitter interlacing and
  12151. reduce moire patterns.
  12152. @table @samp
  12153. @item 0, off
  12154. Disable vertical lowpass filter
  12155. @item 1, linear
  12156. Enable linear filter (default)
  12157. @item 2, complex
  12158. Enable complex filter. This will slightly less reduce twitter and moire
  12159. but better retain detail and subjective sharpness impression.
  12160. @end table
  12161. @end table
  12162. @section kerndeint
  12163. Deinterlace input video by applying Donald Graft's adaptive kernel
  12164. deinterling. Work on interlaced parts of a video to produce
  12165. progressive frames.
  12166. The description of the accepted parameters follows.
  12167. @table @option
  12168. @item thresh
  12169. Set the threshold which affects the filter's tolerance when
  12170. determining if a pixel line must be processed. It must be an integer
  12171. in the range [0,255] and defaults to 10. A value of 0 will result in
  12172. applying the process on every pixels.
  12173. @item map
  12174. Paint pixels exceeding the threshold value to white if set to 1.
  12175. Default is 0.
  12176. @item order
  12177. Set the fields order. Swap fields if set to 1, leave fields alone if
  12178. 0. Default is 0.
  12179. @item sharp
  12180. Enable additional sharpening if set to 1. Default is 0.
  12181. @item twoway
  12182. Enable twoway sharpening if set to 1. Default is 0.
  12183. @end table
  12184. @subsection Examples
  12185. @itemize
  12186. @item
  12187. Apply default values:
  12188. @example
  12189. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  12190. @end example
  12191. @item
  12192. Enable additional sharpening:
  12193. @example
  12194. kerndeint=sharp=1
  12195. @end example
  12196. @item
  12197. Paint processed pixels in white:
  12198. @example
  12199. kerndeint=map=1
  12200. @end example
  12201. @end itemize
  12202. @section kirsch
  12203. Apply kirsch operator to input video stream.
  12204. The filter accepts the following option:
  12205. @table @option
  12206. @item planes
  12207. Set which planes will be processed, unprocessed planes will be copied.
  12208. By default value 0xf, all planes will be processed.
  12209. @item scale
  12210. Set value which will be multiplied with filtered result.
  12211. @item delta
  12212. Set value which will be added to filtered result.
  12213. @end table
  12214. @subsection Commands
  12215. This filter supports the all above options as @ref{commands}.
  12216. @section lagfun
  12217. Slowly update darker pixels.
  12218. This filter makes short flashes of light appear longer.
  12219. This filter accepts the following options:
  12220. @table @option
  12221. @item decay
  12222. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  12223. @item planes
  12224. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  12225. @end table
  12226. @subsection Commands
  12227. This filter supports the all above options as @ref{commands}.
  12228. @section lenscorrection
  12229. Correct radial lens distortion
  12230. This filter can be used to correct for radial distortion as can result from the use
  12231. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  12232. one can use tools available for example as part of opencv or simply trial-and-error.
  12233. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  12234. and extract the k1 and k2 coefficients from the resulting matrix.
  12235. Note that effectively the same filter is available in the open-source tools Krita and
  12236. Digikam from the KDE project.
  12237. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  12238. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  12239. brightness distribution, so you may want to use both filters together in certain
  12240. cases, though you will have to take care of ordering, i.e. whether vignetting should
  12241. be applied before or after lens correction.
  12242. @subsection Options
  12243. The filter accepts the following options:
  12244. @table @option
  12245. @item cx
  12246. Relative x-coordinate of the focal point of the image, and thereby the center of the
  12247. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12248. width. Default is 0.5.
  12249. @item cy
  12250. Relative y-coordinate of the focal point of the image, and thereby the center of the
  12251. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12252. height. Default is 0.5.
  12253. @item k1
  12254. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  12255. no correction. Default is 0.
  12256. @item k2
  12257. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  12258. 0 means no correction. Default is 0.
  12259. @item i
  12260. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  12261. Default is @code{nearest}.
  12262. @item fc
  12263. Specify the color of the unmapped pixels. For the syntax of this option,
  12264. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12265. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  12266. @end table
  12267. The formula that generates the correction is:
  12268. @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)
  12269. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  12270. distances from the focal point in the source and target images, respectively.
  12271. @subsection Commands
  12272. This filter supports the all above options as @ref{commands}.
  12273. @section lensfun
  12274. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  12275. The @code{lensfun} filter requires the camera make, camera model, and lens model
  12276. to apply the lens correction. The filter will load the lensfun database and
  12277. query it to find the corresponding camera and lens entries in the database. As
  12278. long as these entries can be found with the given options, the filter can
  12279. perform corrections on frames. Note that incomplete strings will result in the
  12280. filter choosing the best match with the given options, and the filter will
  12281. output the chosen camera and lens models (logged with level "info"). You must
  12282. provide the make, camera model, and lens model as they are required.
  12283. To obtain a list of available makes and models, leave out one or both of @code{make} and
  12284. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  12285. The first column is the make and the second column is the model.
  12286. To obtain a list of available lenses, set any values for make and model and leave out the
  12287. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  12288. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  12289. The filter accepts the following options:
  12290. @table @option
  12291. @item make
  12292. The make of the camera (for example, "Canon"). This option is required.
  12293. @item model
  12294. The model of the camera (for example, "Canon EOS 100D"). This option is
  12295. required.
  12296. @item lens_model
  12297. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  12298. option is required.
  12299. @item db_path
  12300. The full path to the lens database folder. If not set, the filter will attempt to
  12301. load the database from the install path when the library was built. Default is unset.
  12302. @item mode
  12303. The type of correction to apply. The following values are valid options:
  12304. @table @samp
  12305. @item vignetting
  12306. Enables fixing lens vignetting.
  12307. @item geometry
  12308. Enables fixing lens geometry. This is the default.
  12309. @item subpixel
  12310. Enables fixing chromatic aberrations.
  12311. @item vig_geo
  12312. Enables fixing lens vignetting and lens geometry.
  12313. @item vig_subpixel
  12314. Enables fixing lens vignetting and chromatic aberrations.
  12315. @item distortion
  12316. Enables fixing both lens geometry and chromatic aberrations.
  12317. @item all
  12318. Enables all possible corrections.
  12319. @end table
  12320. @item focal_length
  12321. The focal length of the image/video (zoom; expected constant for video). For
  12322. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  12323. range should be chosen when using that lens. Default 18.
  12324. @item aperture
  12325. The aperture of the image/video (expected constant for video). Note that
  12326. aperture is only used for vignetting correction. Default 3.5.
  12327. @item focus_distance
  12328. The focus distance of the image/video (expected constant for video). Note that
  12329. focus distance is only used for vignetting and only slightly affects the
  12330. vignetting correction process. If unknown, leave it at the default value (which
  12331. is 1000).
  12332. @item scale
  12333. The scale factor which is applied after transformation. After correction the
  12334. video is no longer necessarily rectangular. This parameter controls how much of
  12335. the resulting image is visible. The value 0 means that a value will be chosen
  12336. automatically such that there is little or no unmapped area in the output
  12337. image. 1.0 means that no additional scaling is done. Lower values may result
  12338. in more of the corrected image being visible, while higher values may avoid
  12339. unmapped areas in the output.
  12340. @item target_geometry
  12341. The target geometry of the output image/video. The following values are valid
  12342. options:
  12343. @table @samp
  12344. @item rectilinear (default)
  12345. @item fisheye
  12346. @item panoramic
  12347. @item equirectangular
  12348. @item fisheye_orthographic
  12349. @item fisheye_stereographic
  12350. @item fisheye_equisolid
  12351. @item fisheye_thoby
  12352. @end table
  12353. @item reverse
  12354. Apply the reverse of image correction (instead of correcting distortion, apply
  12355. it).
  12356. @item interpolation
  12357. The type of interpolation used when correcting distortion. The following values
  12358. are valid options:
  12359. @table @samp
  12360. @item nearest
  12361. @item linear (default)
  12362. @item lanczos
  12363. @end table
  12364. @end table
  12365. @subsection Examples
  12366. @itemize
  12367. @item
  12368. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  12369. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  12370. aperture of "8.0".
  12371. @example
  12372. 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
  12373. @end example
  12374. @item
  12375. Apply the same as before, but only for the first 5 seconds of video.
  12376. @example
  12377. 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
  12378. @end example
  12379. @end itemize
  12380. @section lcevc
  12381. Low Complexity Enhancement Video Codec filter based on liblcevc_dec
  12382. (@url{https://github.com/v-novaltd/LCEVCdec}).
  12383. @section libplacebo
  12384. Flexible GPU-accelerated processing filter based on libplacebo
  12385. (@url{https://code.videolan.org/videolan/libplacebo}).
  12386. @subsection Options
  12387. The options for this filter are divided into the following sections:
  12388. @subsubsection Output mode
  12389. These options control the overall output mode. By default, libplacebo will try
  12390. to preserve the source colorimetry and size as best as it can, but it will
  12391. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  12392. in source frames.
  12393. @table @option
  12394. @item inputs
  12395. Set the number of inputs. This can be used, alongside the @code{idx} variable,
  12396. to allow placing/blending multiple inputs inside the output frame. This
  12397. effectively enables functionality similar to @ref{hstack}, @ref{overlay}, etc.
  12398. @item w
  12399. @item h
  12400. Set the output video dimension expression. Default values are @code{iw} and
  12401. @code{ih}.
  12402. Allows for the same expressions as the @ref{scale} filter.
  12403. @item crop_x
  12404. @item crop_y
  12405. Set the input crop x/y expressions, default values are @code{(iw-cw)/2} and
  12406. @code{(ih-ch)/2}.
  12407. @item crop_w
  12408. @item crop_h
  12409. Set the input crop width/height expressions, default values are @code{iw} and
  12410. @code{ih}.
  12411. @item pos_x
  12412. @item pos_y
  12413. Set the output placement x/y expressions, default values are @code{(ow-pw)/2}
  12414. and @code{(oh-ph)/2}.
  12415. @item pos_w
  12416. @item pos_h
  12417. Set the output placement width/height expressions, default values are @code{ow}
  12418. and @code{oh}.
  12419. @item fps
  12420. Set the output frame rate. This can be rational, e.g. @code{60000/1001}. If
  12421. set to the special string @code{none} (the default), input timestamps will
  12422. instead be passed through to the output unmodified. Otherwise, the input video
  12423. frames will be interpolated as necessary to rescale the video to the specified
  12424. target framerate, in a manner as determined by the @option{frame_mixer} option.
  12425. @item format
  12426. Set the output format override. If unset (the default), frames will be output
  12427. in the same format as the respective input frames. Otherwise, format conversion
  12428. will be performed.
  12429. @item force_original_aspect_ratio
  12430. @item force_divisible_by
  12431. Work the same as the identical @ref{scale} filter options.
  12432. @item normalize_sar
  12433. If enabled, output frames will always have a pixel aspect ratio of 1:1. This
  12434. will introduce additional padding/cropping as necessary. If disabled (the
  12435. default), any aspect ratio mismatches, including those from e.g. anamorphic
  12436. video sources, are forwarded to the output pixel aspect ratio.
  12437. @item pad_crop_ratio
  12438. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  12439. cropping when the input aspect ratio does not match the output aspect ratio and
  12440. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  12441. content with black borders, while a value of @code{1.0} always crops off parts
  12442. of the content. Intermediate values are possible, leading to a mix of the two
  12443. approaches.
  12444. @item fillcolor
  12445. Set the color used to fill the output area not covered by the output image, for
  12446. example as a result of @option{normalize_sar}. For the general syntax of this
  12447. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12448. manual,ffmpeg-utils}. Defaults to @code{black@@0}.
  12449. @item corner_rounding
  12450. Render frames with rounded corners. The value, given as a float ranging from
  12451. @code{0.0} to @code{1.0}, indicates the relative degree of rounding, from fully
  12452. square to fully circular. In other words, it gives the radius divided by half
  12453. the smaller side length. Defaults to @code{0.0}.
  12454. @item extra_opts
  12455. Pass extra libplacebo internal configuration options. These can be specified
  12456. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  12457. shows how to configure a custom filter kernel ("EWA LanczosSharp") and use it
  12458. to double the input image resolution:
  12459. @example
  12460. -vf "libplacebo=w=iw*2:h=ih*2:extra_opts='upscaler=custom\:upscaler_preset=ewa_lanczos\:upscaler_blur=0.9812505644269356'"
  12461. @end example
  12462. @item colorspace
  12463. @item color_primaries
  12464. @item color_trc
  12465. @item range
  12466. Configure the colorspace that output frames will be delivered in. The default
  12467. value of @code{auto} outputs frames in the same format as the input frames,
  12468. leading to no change. For any other value, conversion will be performed.
  12469. See the @ref{setparams} filter for a list of possible values.
  12470. @item apply_filmgrain
  12471. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  12472. it from the output. Enabled by default.
  12473. @item apply_dolbyvision
  12474. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  12475. the output. Enabled by default. Note that Dolby Vision will always output
  12476. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  12477. picked as the values of @code{auto} for the respective frame output options.
  12478. @end table
  12479. In addition to the expression constants documented for the @ref{scale} filter,
  12480. the @option{crop_w}, @option{crop_h}, @option{crop_x}, @option{crop_y},
  12481. @option{pos_w}, @option{pos_h}, @option{pos_x} and @option{pos_y} options can
  12482. also contain the following constants:
  12483. @table @option
  12484. @item in_idx, idx
  12485. The (0-based) numeric index of the currently active input stream.
  12486. @item crop_w, cw
  12487. @item crop_h, ch
  12488. The computed values of @option{crop_w} and @option{crop_h}.
  12489. @item pos_w, pw
  12490. @item pos_h, ph
  12491. The computed values of @option{pos_w} and @option{pos_h}.
  12492. @item in_t, t
  12493. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12494. @item out_t, ot
  12495. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12496. @item n
  12497. The input frame number, starting with 0.
  12498. @end table
  12499. @subsubsection Scaling
  12500. The options in this section control how libplacebo performs upscaling and (if
  12501. necessary) downscaling. Note that libplacebo will always internally operate on
  12502. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  12503. necessarily be upsampled and downsampled as part of the rendering process. That
  12504. means scaling might be in effect even if the source and destination resolution
  12505. are the same.
  12506. @table @option
  12507. @item upscaler
  12508. @item downscaler
  12509. Configure the filter kernel used for upscaling and downscaling. The respective
  12510. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  12511. values, pass @code{help} to these options. The most important values are:
  12512. @table @samp
  12513. @item none
  12514. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  12515. fast but poor quality, especially when downscaling.
  12516. @item bilinear
  12517. Bilinear interpolation. Can generally be done for free on GPUs, except when
  12518. doing so would lead to aliasing. Fast and low quality.
  12519. @item nearest
  12520. Nearest-neighbour interpolation. Sharp but highly aliasing.
  12521. @item oversample
  12522. Algorithm that looks visually similar to nearest-neighbour interpolation but
  12523. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  12524. minimal distortion of the artistic appearance.
  12525. @item lanczos
  12526. Standard sinc-sinc interpolation kernel.
  12527. @item spline36
  12528. Cubic spline approximation of lanczos. No difference in performance, but has
  12529. very slightly less ringing.
  12530. @item ewa_lanczos
  12531. Elliptically weighted average version of lanczos, based on a jinc-jinc kernel.
  12532. This is also popularly referred to as just "Jinc scaling". Slow but very high
  12533. quality.
  12534. @item gaussian
  12535. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  12536. very blurry.
  12537. @item mitchell
  12538. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  12539. little ringing.
  12540. @end table
  12541. @item frame_mixer
  12542. Controls the kernel used for mixing frames temporally. The default value is
  12543. @code{none}, which disables frame mixing. For a full list of possible values,
  12544. pass @code{help} to this option. The most important values are:
  12545. @table @samp
  12546. @item none
  12547. Disables frame mixing, giving a result equivalent to "nearest neighbour"
  12548. semantics.
  12549. @item oversample
  12550. Oversamples the input video to create a "Smooth Motion"-type effect: if an
  12551. output frame would exactly fall on the transition between two video frames, it
  12552. is blended according to the relative overlap. This is the recommended option
  12553. whenever preserving the original subjective appearance is desired.
  12554. @item mitchell_clamp
  12555. Larger filter kernel that smoothly interpolates multiple frames in a manner
  12556. designed to eliminate ringing and other artefacts as much as possible. This is
  12557. the recommended option wherever maximum visual smoothness is desired.
  12558. @item linear
  12559. Linear blend/fade between frames. Especially useful for constructing e.g.
  12560. slideshows.
  12561. @end table
  12562. @item antiringing
  12563. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  12564. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  12565. aliasing if set too high. Disabled by default.
  12566. @item sigmoid
  12567. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  12568. Enabled by default.
  12569. @end table
  12570. @subsubsection Deinterlacing
  12571. Deinterlacing is automatically supported when frames are tagged as interlaced,
  12572. however frames are not deinterlaced unless a deinterlacing algorithm is chosen.
  12573. @table @option
  12574. @item deinterlace
  12575. The the deinterlacing algorithm to use.
  12576. @table @samp
  12577. @item weave
  12578. No deinterlacing, weave fields together into a single frame. This is the default.
  12579. @item bob
  12580. Naive bob deinterlacing, simply repeat each field line twice.
  12581. @item yadif
  12582. Yet another deinterlacing filter. See the @ref{yadif} filter for more details.
  12583. @end table
  12584. @item skip_spatial_check
  12585. Skip the spatial deinterlacing check when using @code{yadif} deinterlacing.
  12586. @item send_fields
  12587. Output a frame for each field, rather than for each frame. Note that this will
  12588. always double the tagged output frame rate, even if the input does not contain
  12589. any interlaced frames. Disabled by default.
  12590. @end table
  12591. @subsubsection Debanding
  12592. Libplacebo comes with a built-in debanding filter that is good at counteracting
  12593. many common sources of banding and blocking. Turning this on is highly
  12594. recommended whenever quality is desired.
  12595. @table @option
  12596. @item deband
  12597. Enable (fast) debanding algorithm. Disabled by default.
  12598. @item deband_iterations
  12599. Number of deband iterations of the debanding algorithm. Each iteration is
  12600. performed with progressively increased radius (and diminished threshold).
  12601. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  12602. @item deband_threshold
  12603. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  12604. Defaults to @code{4.0}.
  12605. @item deband_radius
  12606. Debanding filter radius. A higher radius is better for slow gradients, while
  12607. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  12608. @item deband_grain
  12609. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  12610. @code{6.0}.
  12611. @end table
  12612. @subsubsection Color adjustment
  12613. A collection of subjective color controls. Not very rigorous, so the exact
  12614. effect will vary somewhat depending on the input primaries and colorspace.
  12615. @table @option
  12616. @item brightness
  12617. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  12618. @item contrast
  12619. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12620. @item saturation
  12621. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12622. @item hue
  12623. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  12624. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  12625. coefficients for RGB inputs.
  12626. @item gamma
  12627. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12628. @item cones
  12629. Cone model to use for color blindness simulation. Accepts any combination of
  12630. @code{l}, @code{m} and @code{s}. Here are some examples:
  12631. @table @samp
  12632. @item m
  12633. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  12634. @item l
  12635. Protanomaly / protanopia (affecting 1%-2% of the population)
  12636. @item l+m
  12637. Monochromacy (very rare)
  12638. @item l+m+s
  12639. Achromatopsy (complete loss of daytime vision, extremely rare)
  12640. @end table
  12641. @item cone-strength
  12642. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  12643. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  12644. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  12645. above @code{1.0} result in exaggerating the differences between cones, which
  12646. may help compensate for reduced color vision.
  12647. @end table
  12648. @subsubsection Peak detection
  12649. To help deal with sources that only have static HDR10 metadata (or no tagging
  12650. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  12651. analyze source frames and adapt the tone mapping function in realtime. If this
  12652. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  12653. recommended to turn this feature off.
  12654. @table @option
  12655. @item peak_detect
  12656. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  12657. dynamic detection from the input. Note that the detected values do not get
  12658. written back to the output frames, they merely guide the internal tone mapping
  12659. process. Enabled by default.
  12660. @item smoothing_period
  12661. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  12662. values result in peak detection becoming less responsive to changes in the
  12663. input. Defaults to @code{100.0}.
  12664. @item scene_threshold_low
  12665. @item scene_threshold_high
  12666. Lower and upper thresholds for scene change detection. Expressed in a
  12667. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  12668. and @code{10.0}, respectively. Setting either to a negative value disables
  12669. this functionality.
  12670. @item percentile
  12671. Which percentile of the frame brightness histogram to use as the source peak
  12672. for tone-mapping. Defaults to @code{99.995}, a fairly conservative value.
  12673. Setting this to @code{100.0} disables frame histogram measurement and instead
  12674. uses the true peak brightness for tone-mapping.
  12675. @end table
  12676. @subsubsection Tone mapping
  12677. The options in this section control how libplacebo performs tone-mapping and
  12678. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  12679. In general, libplacebo relies on accurate source tagging and mastering display
  12680. gamut information to produce the best results.
  12681. @table @option
  12682. @item gamut_mode
  12683. How to handle out-of-gamut colors that can occur as a result of colorimetric
  12684. gamut mapping.
  12685. @table @samp
  12686. @item clip
  12687. Do nothing, simply clip out-of-range colors to the RGB volume. Low quality but
  12688. extremely fast.
  12689. @item perceptual
  12690. Perceptually soft-clip colors to the gamut volume. This is the default.
  12691. @item relative
  12692. Relative colorimetric hard-clip. Similar to @code{perceptual} but without
  12693. the soft knee.
  12694. @item saturation
  12695. Saturation mapping, maps primaries directly to primaries in RGB space.
  12696. Not recommended except for artificial computer graphics for which a bright,
  12697. saturated display is desired.
  12698. @item absolute
  12699. Absolute colorimetric hard-clip. Performs no adjustment of the white point.
  12700. @item desaturate
  12701. Hard-desaturates out-of-gamut colors towards white, while preserving the
  12702. luminance. Has a tendency to distort the visual appearance of bright objects.
  12703. @item darken
  12704. Linearly reduces content brightness to preserves saturated details, followed by
  12705. clipping the remaining out-of-gamut colors.
  12706. @item warn
  12707. Highlight out-of-gamut pixels (by inverting/marking them).
  12708. @item linear
  12709. Linearly reduces chromaticity of the entire image to make it fit within the
  12710. target color volume. Be careful when using this on BT.2020 sources without
  12711. proper mastering metadata, as doing so will lead to excessive desaturation.
  12712. @end table
  12713. @item tonemapping
  12714. Tone-mapping algorithm to use. Available values are:
  12715. @table @samp
  12716. @item auto
  12717. Automatic selection based on internal heuristics. This is the default.
  12718. @item clip
  12719. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  12720. accuracy for in-range colors but completely destroys out-of-range information.
  12721. Does not perform any black point adaptation. Not configurable.
  12722. @item st2094-40
  12723. EETF from SMPTE ST 2094-40 Annex B, which applies the Bezier curves from HDR10+
  12724. dynamic metadata based on Bezier curves to perform tone-mapping. The OOTF used
  12725. is adjusted based on the ratio between the targeted and actual display peak
  12726. luminances.
  12727. @item st2094-10
  12728. EETF from SMPTE ST 2094-10 Annex B.2, which takes into account the input signal
  12729. average luminance in addition to the maximum/minimum. The configurable contrast
  12730. parameter influences the slope of the linear output segment, defaulting to
  12731. @code{1.0} for no increase/decrease in contrast. Note that this does not
  12732. currently include the subjective gain/offset/gamma controls defined in Annex
  12733. B.3.
  12734. @item bt.2390
  12735. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  12736. segment. The knee point offset is configurable. Note that this parameter
  12737. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  12738. spec.
  12739. @item bt.2446a
  12740. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  12741. sources. Can be used for both forward and inverse tone mapping. Not
  12742. configurable.
  12743. @item spline
  12744. Simple spline consisting of two polynomials, joined by a single pivot point.
  12745. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  12746. Can be used for both forward and inverse tone mapping.
  12747. @item reinhard
  12748. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  12749. local contrast coefficient at the display peak. Essentially, a parameter of
  12750. @code{0.5} implies that the reference white will be about half as bright as
  12751. when clipping. Defaults to @code{0.5}, which results in the simplest
  12752. formulation of this function.
  12753. @item mobius
  12754. Generalization of the reinhard tone mapping algorithm to support an additional
  12755. linear slope near black. The tone mapping parameter indicates the trade-off
  12756. between the linear section and the non-linear section. Essentially, for a given
  12757. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  12758. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  12759. this curve behave like @code{clip}, while values near @code{0.0} make this
  12760. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  12761. provides a good balance between colorimetric accuracy and preserving
  12762. out-of-gamut details.
  12763. @item hable
  12764. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  12765. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  12766. Popularized by its use in video games with HDR rendering. Preserves both dark
  12767. and bright details very well, but comes with the drawback of changing the
  12768. average brightness quite significantly. This is sort of similar to
  12769. @code{reinhard} with parameter @code{0.24}.
  12770. @item gamma
  12771. Fits a gamma (power) function to transfer between the source and target color
  12772. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  12773. linear sections. This preserves details at all scales fairly accurately, but
  12774. can result in an image with a muted or dull appearance. The parameter is used
  12775. as the cutoff point, defaulting to @code{0.5}.
  12776. @item linear
  12777. Linearly stretches the input range to the output range, in PQ space. This will
  12778. preserve all details accurately, but results in a significantly different
  12779. average brightness. Can be used for inverse tone-mapping in addition to regular
  12780. tone-mapping. The parameter can be used as an additional linear gain
  12781. coefficient (defaulting to @code{1.0}).
  12782. @end table
  12783. @item tonemapping_param
  12784. For tunable tone mapping functions, this parameter can be used to fine-tune the
  12785. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  12786. value of @code{0.0} is replaced by the curve's preferred default setting.
  12787. @item inverse_tonemapping
  12788. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  12789. output color volumes. Disabled by default.
  12790. @item tonemapping_lut_size
  12791. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  12792. @code{256}. Note that this figure is squared when combined with
  12793. @code{peak_detect}.
  12794. @item contrast_recovery
  12795. Contrast recovery strength. If set to a value above @code{0.0}, the source
  12796. image will be divided into high-frequency and low-frequency components, and a
  12797. portion of the high-frequency image is added back onto the tone-mapped output.
  12798. May cause excessive ringing artifacts for some HDR sources, but can improve the
  12799. subjective sharpness and detail left over in the image after tone-mapping.
  12800. Defaults to @code{0.30}.
  12801. @item contrast_smoothness
  12802. Contrast recovery lowpass kernel size. Defaults to @code{3.5}. Increasing or
  12803. decreasing this will affect the visual appearance substantially. Has no effect
  12804. when @code{contrast_recovery} is disabled.
  12805. @end table
  12806. @subsubsection Dithering
  12807. By default, libplacebo will dither whenever necessary, which includes rendering
  12808. to any integer format below 16-bit precision. It's recommended to always leave
  12809. this on, since not doing so may result in visible banding in the output, even
  12810. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12811. use @code{ordered_fixed} instead of disabling dithering.
  12812. @table @option
  12813. @item dithering
  12814. Dithering method to use. Accepts the following values:
  12815. @table @samp
  12816. @item none
  12817. Disables dithering completely. May result in visible banding.
  12818. @item blue
  12819. Dither with pseudo-blue noise. This is the default.
  12820. @item ordered
  12821. Tunable ordered dither pattern.
  12822. @item ordered_fixed
  12823. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12824. @item white
  12825. Dither with white noise. Texture-less.
  12826. @end table
  12827. @item dither_lut_size
  12828. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12829. @code{6}, corresponding to a LUT size of @code{64x64}.
  12830. @item dither_temporal
  12831. Enables temporal dithering. Disabled by default.
  12832. @end table
  12833. @subsubsection Custom shaders
  12834. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12835. syntax. A collection of such shaders can be found here:
  12836. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12837. A full description of the mpv shader format is beyond the scope of this
  12838. section, but a summary can be found here:
  12839. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12840. @table @option
  12841. @item custom_shader_path
  12842. Specifies a path to a custom shader file to load at runtime.
  12843. @item custom_shader_bin
  12844. Specifies a complete custom shader as a raw string.
  12845. @end table
  12846. @subsubsection Debugging / performance
  12847. All of the options in this section default off. They may be of assistance when
  12848. attempting to squeeze the maximum performance at the cost of quality.
  12849. @table @option
  12850. @item skip_aa
  12851. Disable anti-aliasing when downscaling.
  12852. @item disable_linear
  12853. Disable linear light scaling.
  12854. @item disable_builtin
  12855. Disable built-in GPU sampling (forces LUT).
  12856. @item disable_fbos
  12857. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12858. offering the maximum possible speed.
  12859. @end table
  12860. @subsection Commands
  12861. This filter supports almost all of the above options as @ref{commands}.
  12862. @subsection Examples
  12863. @itemize
  12864. @item
  12865. Tone-map input to standard gamut BT.709 output:
  12866. @example
  12867. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12868. @end example
  12869. @item
  12870. Rescale input to fit into standard 1080p, with high quality scaling:
  12871. @example
  12872. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12873. @end example
  12874. @item
  12875. Interpolate low FPS / VFR input to smoothed constant 60 fps output:
  12876. @example
  12877. libplacebo=fps=60:frame_mixer=mitchell_clamp
  12878. @end example
  12879. @item
  12880. Convert input to standard sRGB JPEG:
  12881. @example
  12882. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12883. @end example
  12884. @item
  12885. Use higher quality debanding settings:
  12886. @example
  12887. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  12888. @end example
  12889. @item
  12890. Run this filter on the CPU, on systems with Mesa installed (and with the most
  12891. expensive options disabled):
  12892. @example
  12893. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  12894. @end example
  12895. @item
  12896. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  12897. doing it with this filter. Note that this is only a gain if the frames are
  12898. either already on the GPU, or if you're using libplacebo for other purposes,
  12899. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  12900. @example
  12901. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  12902. @end example
  12903. @item
  12904. Interop with VAAPI hwdec to avoid round-tripping through RAM:
  12905. @example
  12906. ffmpeg -init_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi ... -vf libplacebo
  12907. @end example
  12908. @end itemize
  12909. @anchor{libvmaf}
  12910. @section libvmaf
  12911. Calculate the VMAF (Video Multi-Method Assessment Fusion) score for a
  12912. reference/distorted pair of input videos.
  12913. The first input is the distorted video, and the second input is the reference video.
  12914. The obtained VMAF score is printed through the logging system.
  12915. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12916. After installing the library it can be enabled using:
  12917. @code{./configure --enable-libvmaf}.
  12918. The filter has following options:
  12919. @table @option
  12920. @item model
  12921. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  12922. Default value: @code{"version=vmaf_v0.6.1"}
  12923. @item feature
  12924. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  12925. @item log_path
  12926. Set the file path to be used to store log files.
  12927. @item log_fmt
  12928. Set the format of the log file (xml, json, csv, or sub).
  12929. @item pool
  12930. Set the pool method to be used for computing vmaf.
  12931. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  12932. @item n_threads
  12933. Set number of threads to be used when initializing libvmaf.
  12934. Default value: @code{0}, no threads.
  12935. @item n_subsample
  12936. Set frame subsampling interval to be used.
  12937. @end table
  12938. This filter also supports the @ref{framesync} options.
  12939. @subsection Examples
  12940. @itemize
  12941. @item
  12942. In the examples below, a distorted video @file{distorted.mpg} is
  12943. compared with a reference file @file{reference.mpg}.
  12944. @item
  12945. Basic usage:
  12946. @example
  12947. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  12948. @end example
  12949. @item
  12950. Example with multiple models:
  12951. @example
  12952. 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 -
  12953. @end example
  12954. @item
  12955. Example with multiple additional features:
  12956. @example
  12957. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  12958. @end example
  12959. @item
  12960. Example with options and different containers:
  12961. @example
  12962. 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 -
  12963. @end example
  12964. @end itemize
  12965. @section libvmaf_cuda
  12966. This is the CUDA variant of the @ref{libvmaf} filter. It only accepts CUDA frames.
  12967. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12968. After installing the library it can be enabled using:
  12969. @code{./configure --enable-nonfree --enable-ffnvcodec --enable-libvmaf}.
  12970. @subsection Examples
  12971. @itemize
  12972. @item
  12973. Basic usage showing CUVID hardware decoding and CUDA scaling with @ref{scale_cuda}:
  12974. @example
  12975. ffmpeg \
  12976. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i dis.obu \
  12977. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i ref.obu \
  12978. -filter_complex "
  12979. [0:v]scale_cuda=format=yuv420p[dis]; \
  12980. [1:v]scale_cuda=format=yuv420p[ref]; \
  12981. [dis][ref]libvmaf_cuda=log_fmt=json:log_path=output.json
  12982. " \
  12983. -f null -
  12984. @end example
  12985. @end itemize
  12986. @section limitdiff
  12987. Apply limited difference filter using second and optionally third video stream.
  12988. The filter accepts the following options:
  12989. @table @option
  12990. @item threshold
  12991. Set the threshold to use when allowing certain differences between video streams.
  12992. Any absolute difference value lower or exact than this threshold will pick pixel components from
  12993. first video stream.
  12994. @item elasticity
  12995. Set the elasticity of soft thresholding when processing video streams.
  12996. This value multiplied with first one sets second threshold.
  12997. Any absolute difference value greater or exact than second threshold will pick pixel components
  12998. from second video stream. For values between those two threshold
  12999. linear interpolation between first and second video stream will be used.
  13000. @item reference
  13001. Enable the reference (third) video stream processing. By default is disabled.
  13002. If set, this video stream will be used for calculating absolute difference with first video
  13003. stream.
  13004. @item planes
  13005. Specify which planes will be processed. Defaults to all available.
  13006. @end table
  13007. @subsection Commands
  13008. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  13009. @section limiter
  13010. Limits the pixel components values to the specified range [min, max].
  13011. The filter accepts the following options:
  13012. @table @option
  13013. @item min
  13014. Lower bound. Defaults to the lowest allowed value for the input.
  13015. @item max
  13016. Upper bound. Defaults to the highest allowed value for the input.
  13017. @item planes
  13018. Specify which planes will be processed. Defaults to all available.
  13019. @end table
  13020. @subsection Commands
  13021. This filter supports the all above options as @ref{commands}.
  13022. @section loop
  13023. Loop video frames.
  13024. The filter accepts the following options:
  13025. @table @option
  13026. @item loop
  13027. Set the number of loops. Setting this value to -1 will result in infinite loops.
  13028. Default is 0.
  13029. @item size
  13030. Set maximal size in number of frames. Default is 0.
  13031. @item start
  13032. Set first frame of loop. Default is 0.
  13033. @item time
  13034. Set the time of loop start in seconds.
  13035. Only used if option named @var{start} is set to @code{-1}.
  13036. @end table
  13037. @subsection Examples
  13038. @itemize
  13039. @item
  13040. Loop single first frame infinitely:
  13041. @example
  13042. loop=loop=-1:size=1:start=0
  13043. @end example
  13044. @item
  13045. Loop single first frame 10 times:
  13046. @example
  13047. loop=loop=10:size=1:start=0
  13048. @end example
  13049. @item
  13050. Loop 10 first frames 5 times:
  13051. @example
  13052. loop=loop=5:size=10:start=0
  13053. @end example
  13054. @end itemize
  13055. @section lut1d
  13056. Apply a 1D LUT to an input video.
  13057. The filter accepts the following options:
  13058. @table @option
  13059. @item file
  13060. Set the 1D LUT file name.
  13061. Currently supported formats:
  13062. @table @samp
  13063. @item cube
  13064. Iridas
  13065. @item csp
  13066. cineSpace
  13067. @end table
  13068. @item interp
  13069. Select interpolation mode.
  13070. Available values are:
  13071. @table @samp
  13072. @item nearest
  13073. Use values from the nearest defined point.
  13074. @item linear
  13075. Interpolate values using the linear interpolation.
  13076. @item cosine
  13077. Interpolate values using the cosine interpolation.
  13078. @item cubic
  13079. Interpolate values using the cubic interpolation.
  13080. @item spline
  13081. Interpolate values using the spline interpolation.
  13082. @end table
  13083. @end table
  13084. @subsection Commands
  13085. This filter supports the all above options as @ref{commands}.
  13086. @anchor{lut3d}
  13087. @section lut3d
  13088. Apply a 3D LUT to an input video.
  13089. The filter accepts the following options:
  13090. @table @option
  13091. @item file
  13092. Set the 3D LUT file name.
  13093. Currently supported formats:
  13094. @table @samp
  13095. @item 3dl
  13096. AfterEffects
  13097. @item cube
  13098. Iridas
  13099. @item dat
  13100. DaVinci
  13101. @item m3d
  13102. Pandora
  13103. @item csp
  13104. cineSpace
  13105. @end table
  13106. @item interp
  13107. Select interpolation mode.
  13108. Available values are:
  13109. @table @samp
  13110. @item nearest
  13111. Use values from the nearest defined point.
  13112. @item trilinear
  13113. Interpolate values using the 8 points defining a cube.
  13114. @item tetrahedral
  13115. Interpolate values using a tetrahedron.
  13116. @item pyramid
  13117. Interpolate values using a pyramid.
  13118. @item prism
  13119. Interpolate values using a prism.
  13120. @end table
  13121. @end table
  13122. @subsection Commands
  13123. This filter supports the @code{interp} option as @ref{commands}.
  13124. @section lumakey
  13125. Turn certain luma values into transparency.
  13126. The filter accepts the following options:
  13127. @table @option
  13128. @item threshold
  13129. Set the luma which will be used as base for transparency.
  13130. Default value is @code{0}.
  13131. @item tolerance
  13132. Set the range of luma values to be keyed out.
  13133. Default value is @code{0.01}.
  13134. @item softness
  13135. Set the range of softness. Default value is @code{0}.
  13136. Use this to control gradual transition from zero to full transparency.
  13137. @end table
  13138. @subsection Commands
  13139. This filter supports same @ref{commands} as options.
  13140. The command accepts the same syntax of the corresponding option.
  13141. If the specified expression is not valid, it is kept at its current
  13142. value.
  13143. @anchor{lutrgb}
  13144. @anchor{lutyuv}
  13145. @anchor{lut}
  13146. @section lut, lutrgb, lutyuv
  13147. Compute a look-up table for binding each pixel component input value
  13148. to an output value, and apply it to the input video.
  13149. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  13150. to an RGB input video.
  13151. These filters accept the following parameters:
  13152. @table @option
  13153. @item c0
  13154. set first pixel component expression
  13155. @item c1
  13156. set second pixel component expression
  13157. @item c2
  13158. set third pixel component expression
  13159. @item c3
  13160. set fourth pixel component expression, corresponds to the alpha component
  13161. @item r
  13162. set red component expression
  13163. @item g
  13164. set green component expression
  13165. @item b
  13166. set blue component expression
  13167. @item a
  13168. alpha component expression
  13169. @item y
  13170. set Y/luma component expression
  13171. @item u
  13172. set U/Cb component expression
  13173. @item v
  13174. set V/Cr component expression
  13175. @end table
  13176. Each of them specifies the expression to use for computing the lookup table for
  13177. the corresponding pixel component values.
  13178. The exact component associated to each of the @var{c*} options depends on the
  13179. format in input.
  13180. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  13181. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  13182. The expressions can contain the following constants and functions:
  13183. @table @option
  13184. @item w
  13185. @item h
  13186. The input width and height.
  13187. @item val
  13188. The input value for the pixel component.
  13189. @item clipval
  13190. The input value, clipped to the @var{minval}-@var{maxval} range.
  13191. @item maxval
  13192. The maximum value for the pixel component.
  13193. @item minval
  13194. The minimum value for the pixel component.
  13195. @item negval
  13196. The negated value for the pixel component value, clipped to the
  13197. @var{minval}-@var{maxval} range; it corresponds to the expression
  13198. "maxval-clipval+minval".
  13199. @item clip(val)
  13200. The computed value in @var{val}, clipped to the
  13201. @var{minval}-@var{maxval} range.
  13202. @item gammaval(gamma)
  13203. The computed gamma correction value of the pixel component value,
  13204. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  13205. expression
  13206. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  13207. @end table
  13208. All expressions default to "clipval".
  13209. @subsection Commands
  13210. This filter supports same @ref{commands} as options.
  13211. @subsection Examples
  13212. @itemize
  13213. @item
  13214. Negate input video:
  13215. @example
  13216. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  13217. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  13218. @end example
  13219. The above is the same as:
  13220. @example
  13221. lutrgb="r=negval:g=negval:b=negval"
  13222. lutyuv="y=negval:u=negval:v=negval"
  13223. @end example
  13224. @item
  13225. Negate luma:
  13226. @example
  13227. lutyuv=y=negval
  13228. @end example
  13229. @item
  13230. Remove chroma components, turning the video into a graytone image:
  13231. @example
  13232. lutyuv="u=128:v=128"
  13233. @end example
  13234. @item
  13235. Apply a luma burning effect:
  13236. @example
  13237. lutyuv="y=2*val"
  13238. @end example
  13239. @item
  13240. Remove green and blue components:
  13241. @example
  13242. lutrgb="g=0:b=0"
  13243. @end example
  13244. @item
  13245. Set a constant alpha channel value on input:
  13246. @example
  13247. format=rgba,lutrgb=a="maxval-minval/2"
  13248. @end example
  13249. @item
  13250. Correct luma gamma by a factor of 0.5:
  13251. @example
  13252. lutyuv=y=gammaval(0.5)
  13253. @end example
  13254. @item
  13255. Discard least significant bits of luma:
  13256. @example
  13257. lutyuv=y='bitand(val, 128+64+32)'
  13258. @end example
  13259. @item
  13260. Technicolor like effect:
  13261. @example
  13262. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  13263. @end example
  13264. @end itemize
  13265. @section lut2, tlut2
  13266. The @code{lut2} filter takes two input streams and outputs one
  13267. stream.
  13268. The @code{tlut2} (time lut2) filter takes two consecutive frames
  13269. from one single stream.
  13270. This filter accepts the following parameters:
  13271. @table @option
  13272. @item c0
  13273. set first pixel component expression
  13274. @item c1
  13275. set second pixel component expression
  13276. @item c2
  13277. set third pixel component expression
  13278. @item c3
  13279. set fourth pixel component expression, corresponds to the alpha component
  13280. @item d
  13281. set output bit depth, only available for @code{lut2} filter. By default is 0,
  13282. which means bit depth is automatically picked from first input format.
  13283. @end table
  13284. The @code{lut2} filter also supports the @ref{framesync} options.
  13285. Each of them specifies the expression to use for computing the lookup table for
  13286. the corresponding pixel component values.
  13287. The exact component associated to each of the @var{c*} options depends on the
  13288. format in inputs.
  13289. The expressions can contain the following constants:
  13290. @table @option
  13291. @item w
  13292. @item h
  13293. The input width and height.
  13294. @item x
  13295. The first input value for the pixel component.
  13296. @item y
  13297. The second input value for the pixel component.
  13298. @item bdx
  13299. The first input video bit depth.
  13300. @item bdy
  13301. The second input video bit depth.
  13302. @end table
  13303. All expressions default to "x".
  13304. @subsection Commands
  13305. This filter supports the all above options as @ref{commands} except option @code{d}.
  13306. @subsection Examples
  13307. @itemize
  13308. @item
  13309. Highlight differences between two RGB video streams:
  13310. @example
  13311. 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)'
  13312. @end example
  13313. @item
  13314. Highlight differences between two YUV video streams:
  13315. @example
  13316. 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)'
  13317. @end example
  13318. @item
  13319. Show max difference between two video streams:
  13320. @example
  13321. 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)))'
  13322. @end example
  13323. @end itemize
  13324. @section maskedclamp
  13325. Clamp the first input stream with the second input and third input stream.
  13326. Returns the value of first stream to be between second input
  13327. stream - @code{undershoot} and third input stream + @code{overshoot}.
  13328. This filter accepts the following options:
  13329. @table @option
  13330. @item undershoot
  13331. Default value is @code{0}.
  13332. @item overshoot
  13333. Default value is @code{0}.
  13334. @item planes
  13335. Set which planes will be processed as bitmap, unprocessed planes will be
  13336. copied from first stream.
  13337. By default value 0xf, all planes will be processed.
  13338. @end table
  13339. @subsection Commands
  13340. This filter supports the all above options as @ref{commands}.
  13341. @section maskedmax
  13342. Merge the second and third input stream into output stream using absolute differences
  13343. between second input stream and first input stream and absolute difference between
  13344. third input stream and first input stream. The picked value will be from second input
  13345. stream if second absolute difference is greater than first one or from third input stream
  13346. otherwise.
  13347. This filter accepts the following options:
  13348. @table @option
  13349. @item planes
  13350. Set which planes will be processed as bitmap, unprocessed planes will be
  13351. copied from first stream.
  13352. By default value 0xf, all planes will be processed.
  13353. @end table
  13354. @subsection Commands
  13355. This filter supports the all above options as @ref{commands}.
  13356. @section maskedmerge
  13357. Merge the first input stream with the second input stream using per pixel
  13358. weights in the third input stream.
  13359. A value of 0 in the third stream pixel component means that pixel component
  13360. from first stream is returned unchanged, while maximum value (eg. 255 for
  13361. 8-bit videos) means that pixel component from second stream is returned
  13362. unchanged. Intermediate values define the amount of merging between both
  13363. input stream's pixel components.
  13364. This filter accepts the following options:
  13365. @table @option
  13366. @item planes
  13367. Set which planes will be processed as bitmap, unprocessed planes will be
  13368. copied from first stream.
  13369. By default value 0xf, all planes will be processed.
  13370. @end table
  13371. @subsection Commands
  13372. This filter supports the all above options as @ref{commands}.
  13373. @section maskedmin
  13374. Merge the second and third input stream into output stream using absolute differences
  13375. between second input stream and first input stream and absolute difference between
  13376. third input stream and first input stream. The picked value will be from second input
  13377. stream if second absolute difference is less than first one or from third input stream
  13378. otherwise.
  13379. This filter accepts the following options:
  13380. @table @option
  13381. @item planes
  13382. Set which planes will be processed as bitmap, unprocessed planes will be
  13383. copied from first stream.
  13384. By default value 0xf, all planes will be processed.
  13385. @end table
  13386. @subsection Commands
  13387. This filter supports the all above options as @ref{commands}.
  13388. @section maskedthreshold
  13389. Pick pixels comparing absolute difference of two video streams with fixed
  13390. threshold.
  13391. If absolute difference between pixel component of first and second video
  13392. stream is equal or lower than user supplied threshold than pixel component
  13393. from first video stream is picked, otherwise pixel component from second
  13394. video stream is picked.
  13395. This filter accepts the following options:
  13396. @table @option
  13397. @item threshold
  13398. Set threshold used when picking pixels from absolute difference from two input
  13399. video streams.
  13400. @item planes
  13401. Set which planes will be processed as bitmap, unprocessed planes will be
  13402. copied from second stream.
  13403. By default value 0xf, all planes will be processed.
  13404. @item mode
  13405. Set mode of filter operation. Can be @code{abs} or @code{diff}.
  13406. Default is @code{abs}.
  13407. @end table
  13408. @subsection Commands
  13409. This filter supports the all above options as @ref{commands}.
  13410. @section maskfun
  13411. Create mask from input video.
  13412. For example it is useful to create motion masks after @code{tblend} filter.
  13413. This filter accepts the following options:
  13414. @table @option
  13415. @item low
  13416. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  13417. @item high
  13418. Set high threshold. Any pixel component higher than this value will be set to max value
  13419. allowed for current pixel format.
  13420. @item planes
  13421. Set planes to filter, by default all available planes are filtered.
  13422. @item fill
  13423. Fill all frame pixels with this value.
  13424. @item sum
  13425. Set max average pixel value for frame. If sum of all pixel components is higher that this
  13426. average, output frame will be completely filled with value set by @var{fill} option.
  13427. Typically useful for scene changes when used in combination with @code{tblend} filter.
  13428. @end table
  13429. @subsection Commands
  13430. This filter supports the all above options as @ref{commands}.
  13431. @section mcdeint
  13432. Apply motion-compensation deinterlacing.
  13433. It needs one field per frame as input and must thus be used together
  13434. with yadif=1/3 or equivalent.
  13435. This filter accepts the following options:
  13436. @table @option
  13437. @item mode
  13438. Set the deinterlacing mode.
  13439. It accepts one of the following values:
  13440. @table @samp
  13441. @item fast
  13442. @item medium
  13443. @item slow
  13444. use iterative motion estimation
  13445. @item extra_slow
  13446. like @samp{slow}, but use multiple reference frames.
  13447. @end table
  13448. Default value is @samp{fast}.
  13449. @item parity
  13450. Set the picture field parity assumed for the input video. It must be
  13451. one of the following values:
  13452. @table @samp
  13453. @item 0, tff
  13454. assume top field first
  13455. @item 1, bff
  13456. assume bottom field first
  13457. @end table
  13458. Default value is @samp{bff}.
  13459. @item qp
  13460. Set per-block quantization parameter (QP) used by the internal
  13461. encoder.
  13462. Higher values should result in a smoother motion vector field but less
  13463. optimal individual vectors. Default value is 1.
  13464. @end table
  13465. @section median
  13466. Pick median pixel from certain rectangle defined by radius.
  13467. This filter accepts the following options:
  13468. @table @option
  13469. @item radius
  13470. Set horizontal radius size. Default value is @code{1}.
  13471. Allowed range is integer from 1 to 127.
  13472. @item planes
  13473. Set which planes to process. Default is @code{15}, which is all available planes.
  13474. @item radiusV
  13475. Set vertical radius size. Default value is @code{0}.
  13476. Allowed range is integer from 0 to 127.
  13477. If it is 0, value will be picked from horizontal @code{radius} option.
  13478. @item percentile
  13479. Set median percentile. Default value is @code{0.5}.
  13480. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  13481. minimum values, and @code{1} maximum values.
  13482. @end table
  13483. @subsection Commands
  13484. This filter supports same @ref{commands} as options.
  13485. The command accepts the same syntax of the corresponding option.
  13486. If the specified expression is not valid, it is kept at its current
  13487. value.
  13488. @section mergeplanes
  13489. Merge color channel components from several video streams.
  13490. The filter accepts up to 4 input streams, and merge selected input
  13491. planes to the output video.
  13492. This filter accepts the following options:
  13493. @table @option
  13494. @item mapping
  13495. Set input to output plane mapping. Default is @code{0}.
  13496. The mappings is specified as a bitmap. It should be specified as a
  13497. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  13498. mapping for the first plane of the output stream. 'A' sets the number of
  13499. the input stream to use (from 0 to 3), and 'a' the plane number of the
  13500. corresponding input to use (from 0 to 3). The rest of the mappings is
  13501. similar, 'Bb' describes the mapping for the output stream second
  13502. plane, 'Cc' describes the mapping for the output stream third plane and
  13503. 'Dd' describes the mapping for the output stream fourth plane.
  13504. @item format
  13505. Set output pixel format. Default is @code{yuva444p}.
  13506. @item map0s
  13507. @item map1s
  13508. @item map2s
  13509. @item map3s
  13510. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  13511. @item map0p
  13512. @item map1p
  13513. @item map2p
  13514. @item map3p
  13515. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  13516. @end table
  13517. @subsection Examples
  13518. @itemize
  13519. @item
  13520. Merge three gray video streams of same width and height into single video stream:
  13521. @example
  13522. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  13523. @end example
  13524. @item
  13525. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  13526. @example
  13527. [a0][a1]mergeplanes=0x00010210:yuva444p
  13528. @end example
  13529. @item
  13530. Swap Y and A plane in yuva444p stream:
  13531. @example
  13532. format=yuva444p,mergeplanes=0x03010200:yuva444p
  13533. @end example
  13534. @item
  13535. Swap U and V plane in yuv420p stream:
  13536. @example
  13537. format=yuv420p,mergeplanes=0x000201:yuv420p
  13538. @end example
  13539. @item
  13540. Cast a rgb24 clip to yuv444p:
  13541. @example
  13542. format=rgb24,mergeplanes=0x000102:yuv444p
  13543. @end example
  13544. @end itemize
  13545. @section mestimate
  13546. Estimate and export motion vectors using block matching algorithms.
  13547. Motion vectors are stored in frame side data to be used by other filters.
  13548. This filter accepts the following options:
  13549. @table @option
  13550. @item method
  13551. Specify the motion estimation method. Accepts one of the following values:
  13552. @table @samp
  13553. @item esa
  13554. Exhaustive search algorithm.
  13555. @item tss
  13556. Three step search algorithm.
  13557. @item tdls
  13558. Two dimensional logarithmic search algorithm.
  13559. @item ntss
  13560. New three step search algorithm.
  13561. @item fss
  13562. Four step search algorithm.
  13563. @item ds
  13564. Diamond search algorithm.
  13565. @item hexbs
  13566. Hexagon-based search algorithm.
  13567. @item epzs
  13568. Enhanced predictive zonal search algorithm.
  13569. @item umh
  13570. Uneven multi-hexagon search algorithm.
  13571. @end table
  13572. Default value is @samp{esa}.
  13573. @item mb_size
  13574. Macroblock size. Default @code{16}.
  13575. @item search_param
  13576. Search parameter. Default @code{7}.
  13577. @end table
  13578. @section midequalizer
  13579. Apply Midway Image Equalization effect using two video streams.
  13580. Midway Image Equalization adjusts a pair of images to have the same
  13581. histogram, while maintaining their dynamics as much as possible. It's
  13582. useful for e.g. matching exposures from a pair of stereo cameras.
  13583. This filter has two inputs and one output, which must be of same pixel format, but
  13584. may be of different sizes. The output of filter is first input adjusted with
  13585. midway histogram of both inputs.
  13586. This filter accepts the following option:
  13587. @table @option
  13588. @item planes
  13589. Set which planes to process. Default is @code{15}, which is all available planes.
  13590. @end table
  13591. @section minterpolate
  13592. Convert the video to specified frame rate using motion interpolation.
  13593. This filter accepts the following options:
  13594. @table @option
  13595. @item fps
  13596. 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}.
  13597. @item mi_mode
  13598. Motion interpolation mode. Following values are accepted:
  13599. @table @samp
  13600. @item dup
  13601. Duplicate previous or next frame for interpolating new ones.
  13602. @item blend
  13603. Blend source frames. Interpolated frame is mean of previous and next frames.
  13604. @item mci
  13605. Motion compensated interpolation. Following options are effective when this mode is selected:
  13606. @table @samp
  13607. @item mc_mode
  13608. Motion compensation mode. Following values are accepted:
  13609. @table @samp
  13610. @item obmc
  13611. Overlapped block motion compensation.
  13612. @item aobmc
  13613. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  13614. @end table
  13615. Default mode is @samp{obmc}.
  13616. @item me_mode
  13617. Motion estimation mode. Following values are accepted:
  13618. @table @samp
  13619. @item bidir
  13620. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  13621. @item bilat
  13622. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  13623. @end table
  13624. Default mode is @samp{bilat}.
  13625. @item me
  13626. The algorithm to be used for motion estimation. Following values are accepted:
  13627. @table @samp
  13628. @item esa
  13629. Exhaustive search algorithm.
  13630. @item tss
  13631. Three step search algorithm.
  13632. @item tdls
  13633. Two dimensional logarithmic search algorithm.
  13634. @item ntss
  13635. New three step search algorithm.
  13636. @item fss
  13637. Four step search algorithm.
  13638. @item ds
  13639. Diamond search algorithm.
  13640. @item hexbs
  13641. Hexagon-based search algorithm.
  13642. @item epzs
  13643. Enhanced predictive zonal search algorithm.
  13644. @item umh
  13645. Uneven multi-hexagon search algorithm.
  13646. @end table
  13647. Default algorithm is @samp{epzs}.
  13648. @item mb_size
  13649. Macroblock size. Default @code{16}.
  13650. @item search_param
  13651. Motion estimation search parameter. Default @code{32}.
  13652. @item vsbmc
  13653. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make them less blurry. Default is @code{0} (disabled).
  13654. @end table
  13655. @end table
  13656. @item scd
  13657. 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:
  13658. @table @samp
  13659. @item none
  13660. Disable scene change detection.
  13661. @item fdiff
  13662. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  13663. @end table
  13664. Default method is @samp{fdiff}.
  13665. @item scd_threshold
  13666. Scene change detection threshold. Default is @code{10.}.
  13667. @end table
  13668. @section mix
  13669. Mix several video input streams into one video stream.
  13670. A description of the accepted options follows.
  13671. @table @option
  13672. @item inputs
  13673. The number of inputs. If unspecified, it defaults to 2.
  13674. @item weights
  13675. Specify weight of each input video stream as sequence.
  13676. Each weight is separated by space. If number of weights
  13677. is smaller than number of @var{frames} last specified
  13678. weight will be used for all remaining unset weights.
  13679. @item scale
  13680. Specify scale, if it is set it will be multiplied with sum
  13681. of each weight multiplied with pixel values to give final destination
  13682. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13683. @item planes
  13684. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  13685. @item duration
  13686. Specify how end of stream is determined.
  13687. @table @samp
  13688. @item longest
  13689. The duration of the longest input. (default)
  13690. @item shortest
  13691. The duration of the shortest input.
  13692. @item first
  13693. The duration of the first input.
  13694. @end table
  13695. @end table
  13696. @subsection Commands
  13697. This filter supports the following commands:
  13698. @table @option
  13699. @item weights
  13700. @item scale
  13701. @item planes
  13702. Syntax is same as option with same name.
  13703. @end table
  13704. @section monochrome
  13705. Convert video to gray using custom color filter.
  13706. A description of the accepted options follows.
  13707. @table @option
  13708. @item cb
  13709. Set the chroma blue spot. Allowed range is from -1 to 1.
  13710. Default value is 0.
  13711. @item cr
  13712. Set the chroma red spot. Allowed range is from -1 to 1.
  13713. Default value is 0.
  13714. @item size
  13715. Set the color filter size. Allowed range is from .1 to 10.
  13716. Default value is 1.
  13717. @item high
  13718. Set the highlights strength. Allowed range is from 0 to 1.
  13719. Default value is 0.
  13720. @end table
  13721. @subsection Commands
  13722. This filter supports the all above options as @ref{commands}.
  13723. @section morpho
  13724. This filter allows to apply main morphological grayscale transforms,
  13725. erode and dilate with arbitrary structures set in second input stream.
  13726. Unlike naive implementation and much slower performance in @ref{erosion}
  13727. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  13728. should be used instead.
  13729. A description of accepted options follows,
  13730. @table @option
  13731. @item mode
  13732. Set morphological transform to apply, can be:
  13733. @table @samp
  13734. @item erode
  13735. @item dilate
  13736. @item open
  13737. @item close
  13738. @item gradient
  13739. @item tophat
  13740. @item blackhat
  13741. @end table
  13742. Default is @code{erode}.
  13743. @item planes
  13744. Set planes to filter, by default all planes except alpha are filtered.
  13745. @item structure
  13746. Set which structure video frames will be processed from second input stream,
  13747. can be @var{first} or @var{all}. Default is @var{all}.
  13748. @end table
  13749. The @code{morpho} filter also supports the @ref{framesync} options.
  13750. @subsection Commands
  13751. This filter supports same @ref{commands} as options.
  13752. @section mpdecimate
  13753. Drop frames that do not differ greatly from the previous frame in
  13754. order to reduce frame rate.
  13755. The main use of this filter is for very-low-bitrate encoding
  13756. (e.g. streaming over dialup modem), but it could in theory be used for
  13757. fixing movies that were inverse-telecined incorrectly.
  13758. A description of the accepted options follows.
  13759. @table @option
  13760. @item max
  13761. Set the maximum number of consecutive frames which can be dropped (if
  13762. positive), or the minimum interval between dropped frames (if
  13763. negative). If the value is 0, the frame is dropped disregarding the
  13764. number of previous sequentially dropped frames.
  13765. Default value is 0.
  13766. @item keep
  13767. Set the maximum number of consecutive similar frames to ignore before to start dropping them.
  13768. If the value is 0, the frame is dropped disregarding the
  13769. number of previous sequentially similar frames.
  13770. Default value is 0.
  13771. @item hi
  13772. @item lo
  13773. @item frac
  13774. Set the dropping threshold values.
  13775. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  13776. represent actual pixel value differences, so a threshold of 64
  13777. corresponds to 1 unit of difference for each pixel, or the same spread
  13778. out differently over the block.
  13779. A frame is a candidate for dropping if no 8x8 blocks differ by more
  13780. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  13781. meaning the whole image) differ by more than a threshold of @option{lo}.
  13782. Default value for @option{hi} is 64*12, default value for @option{lo} is
  13783. 64*5, and default value for @option{frac} is 0.33.
  13784. @end table
  13785. @section msad
  13786. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  13787. This filter takes two input videos.
  13788. Both input videos must have the same resolution and pixel format for
  13789. this filter to work correctly. Also it assumes that both inputs
  13790. have the same number of frames, which are compared one by one.
  13791. The obtained per component, average, min and max MSAD is printed through
  13792. the logging system.
  13793. The filter stores the calculated MSAD of each frame in frame metadata.
  13794. This filter also supports the @ref{framesync} options.
  13795. In the below example the input file @file{main.mpg} being processed is compared
  13796. with the reference file @file{ref.mpg}.
  13797. @example
  13798. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  13799. @end example
  13800. @section multiply
  13801. Multiply first video stream pixels values with second video stream pixels values.
  13802. The filter accepts the following options:
  13803. @table @option
  13804. @item scale
  13805. Set the scale applied to second video stream. By default is @code{1}.
  13806. Allowed range is from @code{0} to @code{9}.
  13807. @item offset
  13808. Set the offset applied to second video stream. By default is @code{0.5}.
  13809. Allowed range is from @code{-1} to @code{1}.
  13810. @item planes
  13811. Specify planes from input video stream that will be processed.
  13812. By default all planes are processed.
  13813. @end table
  13814. @subsection Commands
  13815. This filter supports same @ref{commands} as options.
  13816. @section negate
  13817. Negate (invert) the input video.
  13818. It accepts the following option:
  13819. @table @option
  13820. @item components
  13821. Set components to negate.
  13822. Available values for components are:
  13823. @table @samp
  13824. @item y
  13825. @item u
  13826. @item v
  13827. @item a
  13828. @item r
  13829. @item g
  13830. @item b
  13831. @end table
  13832. @item negate_alpha
  13833. With value 1, it negates the alpha component, if present. Default value is 0.
  13834. @end table
  13835. @subsection Commands
  13836. This filter supports same @ref{commands} as options.
  13837. @anchor{nlmeans}
  13838. @section nlmeans
  13839. Denoise frames using Non-Local Means algorithm.
  13840. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13841. context similarity is defined by comparing their surrounding patches of size
  13842. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13843. around the pixel.
  13844. Note that the research area defines centers for patches, which means some
  13845. patches will be made of pixels outside that research area.
  13846. The filter accepts the following options.
  13847. @table @option
  13848. @item s
  13849. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13850. @item p
  13851. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13852. @item pc
  13853. Same as @option{p} but for chroma planes.
  13854. The default value is @var{0} and means automatic.
  13855. @item r
  13856. Set research size. Default is 15. Must be odd number in range [0, 99].
  13857. @item rc
  13858. Same as @option{r} but for chroma planes.
  13859. The default value is @var{0} and means automatic.
  13860. @end table
  13861. @section nnedi
  13862. Deinterlace video using neural network edge directed interpolation.
  13863. This filter accepts the following options:
  13864. @table @option
  13865. @item weights
  13866. Mandatory option, without binary file filter can not work.
  13867. Currently file can be found here:
  13868. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13869. @item deint
  13870. Set which frames to deinterlace, by default it is @code{all}.
  13871. Can be @code{all} or @code{interlaced}.
  13872. @item field
  13873. Set mode of operation.
  13874. Can be one of the following:
  13875. @table @samp
  13876. @item af
  13877. Use frame flags, both fields.
  13878. @item a
  13879. Use frame flags, single field.
  13880. @item t
  13881. Use top field only.
  13882. @item b
  13883. Use bottom field only.
  13884. @item tf
  13885. Use both fields, top first.
  13886. @item bf
  13887. Use both fields, bottom first.
  13888. @end table
  13889. @item planes
  13890. Set which planes to process, by default filter process all frames.
  13891. @item nsize
  13892. Set size of local neighborhood around each pixel, used by the predictor neural
  13893. network.
  13894. Can be one of the following:
  13895. @table @samp
  13896. @item s8x6
  13897. @item s16x6
  13898. @item s32x6
  13899. @item s48x6
  13900. @item s8x4
  13901. @item s16x4
  13902. @item s32x4
  13903. @end table
  13904. @item nns
  13905. Set the number of neurons in predictor neural network.
  13906. Can be one of the following:
  13907. @table @samp
  13908. @item n16
  13909. @item n32
  13910. @item n64
  13911. @item n128
  13912. @item n256
  13913. @end table
  13914. @item qual
  13915. Controls the number of different neural network predictions that are blended
  13916. together to compute the final output value. Can be @code{fast}, default or
  13917. @code{slow}.
  13918. @item etype
  13919. Set which set of weights to use in the predictor.
  13920. Can be one of the following:
  13921. @table @samp
  13922. @item a, abs
  13923. weights trained to minimize absolute error
  13924. @item s, mse
  13925. weights trained to minimize squared error
  13926. @end table
  13927. @item pscrn
  13928. Controls whether or not the prescreener neural network is used to decide
  13929. which pixels should be processed by the predictor neural network and which
  13930. can be handled by simple cubic interpolation.
  13931. The prescreener is trained to know whether cubic interpolation will be
  13932. sufficient for a pixel or whether it should be predicted by the predictor nn.
  13933. The computational complexity of the prescreener nn is much less than that of
  13934. the predictor nn. Since most pixels can be handled by cubic interpolation,
  13935. using the prescreener generally results in much faster processing.
  13936. The prescreener is pretty accurate, so the difference between using it and not
  13937. using it is almost always unnoticeable.
  13938. Can be one of the following:
  13939. @table @samp
  13940. @item none
  13941. @item original
  13942. @item new
  13943. @item new2
  13944. @item new3
  13945. @end table
  13946. Default is @code{new}.
  13947. @end table
  13948. @subsection Commands
  13949. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  13950. @section noformat
  13951. Force libavfilter not to use any of the specified pixel formats for the
  13952. input to the next filter.
  13953. It accepts the following parameters:
  13954. @table @option
  13955. @item pix_fmts
  13956. A '|'-separated list of pixel format names, such as
  13957. pix_fmts=yuv420p|monow|rgb24".
  13958. @end table
  13959. @subsection Examples
  13960. @itemize
  13961. @item
  13962. Force libavfilter to use a format different from @var{yuv420p} for the
  13963. input to the vflip filter:
  13964. @example
  13965. noformat=pix_fmts=yuv420p,vflip
  13966. @end example
  13967. @item
  13968. Convert the input video to any of the formats not contained in the list:
  13969. @example
  13970. noformat=yuv420p|yuv444p|yuv410p
  13971. @end example
  13972. @end itemize
  13973. @section noise
  13974. Add noise on video input frame.
  13975. The filter accepts the following options:
  13976. @table @option
  13977. @item all_seed
  13978. @item c0_seed
  13979. @item c1_seed
  13980. @item c2_seed
  13981. @item c3_seed
  13982. Set noise seed for specific pixel component or all pixel components in case
  13983. of @var{all_seed}. Default value is @code{123457}.
  13984. @item all_strength, alls
  13985. @item c0_strength, c0s
  13986. @item c1_strength, c1s
  13987. @item c2_strength, c2s
  13988. @item c3_strength, c3s
  13989. Set noise strength for specific pixel component or all pixel components in case
  13990. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  13991. @item all_flags, allf
  13992. @item c0_flags, c0f
  13993. @item c1_flags, c1f
  13994. @item c2_flags, c2f
  13995. @item c3_flags, c3f
  13996. Set pixel component flags or set flags for all components if @var{all_flags}.
  13997. Available values for component flags are:
  13998. @table @samp
  13999. @item a
  14000. averaged temporal noise (smoother)
  14001. @item p
  14002. mix random noise with a (semi)regular pattern
  14003. @item t
  14004. temporal noise (noise pattern changes between frames)
  14005. @item u
  14006. uniform noise (gaussian otherwise)
  14007. @end table
  14008. @end table
  14009. @subsection Examples
  14010. Add temporal and uniform noise to input video:
  14011. @example
  14012. noise=alls=20:allf=t+u
  14013. @end example
  14014. @section normalize
  14015. Normalize RGB video (aka histogram stretching, contrast stretching).
  14016. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  14017. For each channel of each frame, the filter computes the input range and maps
  14018. it linearly to the user-specified output range. The output range defaults
  14019. to the full dynamic range from pure black to pure white.
  14020. Temporal smoothing can be used on the input range to reduce flickering (rapid
  14021. changes in brightness) caused when small dark or bright objects enter or leave
  14022. the scene. This is similar to the auto-exposure (automatic gain control) on a
  14023. video camera, and, like a video camera, it may cause a period of over- or
  14024. under-exposure of the video.
  14025. The R,G,B channels can be normalized independently, which may cause some
  14026. color shifting, or linked together as a single channel, which prevents
  14027. color shifting. Linked normalization preserves hue. Independent normalization
  14028. does not, so it can be used to remove some color casts. Independent and linked
  14029. normalization can be combined in any ratio.
  14030. The normalize filter accepts the following options:
  14031. @table @option
  14032. @item blackpt
  14033. @item whitept
  14034. Colors which define the output range. The minimum input value is mapped to
  14035. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  14036. The defaults are black and white respectively. Specifying white for
  14037. @var{blackpt} and black for @var{whitept} will give color-inverted,
  14038. normalized video. Shades of grey can be used to reduce the dynamic range
  14039. (contrast). Specifying saturated colors here can create some interesting
  14040. effects.
  14041. @item smoothing
  14042. The number of previous frames to use for temporal smoothing. The input range
  14043. of each channel is smoothed using a rolling average over the current frame
  14044. and the @var{smoothing} previous frames. The default is 0 (no temporal
  14045. smoothing).
  14046. @item independence
  14047. Controls the ratio of independent (color shifting) channel normalization to
  14048. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  14049. independent. Defaults to 1.0 (fully independent).
  14050. @item strength
  14051. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  14052. expensive no-op. Defaults to 1.0 (full strength).
  14053. @end table
  14054. @subsection Commands
  14055. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  14056. The command accepts the same syntax of the corresponding option.
  14057. If the specified expression is not valid, it is kept at its current
  14058. value.
  14059. @subsection Examples
  14060. Stretch video contrast to use the full dynamic range, with no temporal
  14061. smoothing; may flicker depending on the source content:
  14062. @example
  14063. normalize=blackpt=black:whitept=white:smoothing=0
  14064. @end example
  14065. As above, but with 50 frames of temporal smoothing; flicker should be
  14066. reduced, depending on the source content:
  14067. @example
  14068. normalize=blackpt=black:whitept=white:smoothing=50
  14069. @end example
  14070. As above, but with hue-preserving linked channel normalization:
  14071. @example
  14072. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  14073. @end example
  14074. As above, but with half strength:
  14075. @example
  14076. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  14077. @end example
  14078. Map the darkest input color to red, the brightest input color to cyan:
  14079. @example
  14080. normalize=blackpt=red:whitept=cyan
  14081. @end example
  14082. @section null
  14083. Pass the video source unchanged to the output.
  14084. @section ocr
  14085. Optical Character Recognition
  14086. This filter uses Tesseract for optical character recognition. To enable
  14087. compilation of this filter, you need to configure FFmpeg with
  14088. @code{--enable-libtesseract}.
  14089. It accepts the following options:
  14090. @table @option
  14091. @item datapath
  14092. Set datapath to tesseract data. Default is to use whatever was
  14093. set at installation.
  14094. @item language
  14095. Set language, default is "eng".
  14096. @item whitelist
  14097. Set character whitelist.
  14098. @item blacklist
  14099. Set character blacklist.
  14100. @end table
  14101. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  14102. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  14103. @section ocv
  14104. Apply a video transform using libopencv.
  14105. To enable this filter, install the libopencv library and headers and
  14106. configure FFmpeg with @code{--enable-libopencv}.
  14107. It accepts the following parameters:
  14108. @table @option
  14109. @item filter_name
  14110. The name of the libopencv filter to apply.
  14111. @item filter_params
  14112. The parameters to pass to the libopencv filter. If not specified, the default
  14113. values are assumed.
  14114. @end table
  14115. Refer to the official libopencv documentation for more precise
  14116. information:
  14117. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  14118. Several libopencv filters are supported; see the following subsections.
  14119. @anchor{dilate}
  14120. @subsection dilate
  14121. Dilate an image by using a specific structuring element.
  14122. It corresponds to the libopencv function @code{cvDilate}.
  14123. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  14124. @var{struct_el} represents a structuring element, and has the syntax:
  14125. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  14126. @var{cols} and @var{rows} represent the number of columns and rows of
  14127. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  14128. point, and @var{shape} the shape for the structuring element. @var{shape}
  14129. must be "rect", "cross", "ellipse", or "custom".
  14130. If the value for @var{shape} is "custom", it must be followed by a
  14131. string of the form "=@var{filename}". The file with name
  14132. @var{filename} is assumed to represent a binary image, with each
  14133. printable character corresponding to a bright pixel. When a custom
  14134. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  14135. or columns and rows of the read file are assumed instead.
  14136. The default value for @var{struct_el} is "3x3+0x0/rect".
  14137. @var{nb_iterations} specifies the number of times the transform is
  14138. applied to the image, and defaults to 1.
  14139. Some examples:
  14140. @example
  14141. # Use the default values
  14142. ocv=dilate
  14143. # Dilate using a structuring element with a 5x5 cross, iterating two times
  14144. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  14145. # Read the shape from the file diamond.shape, iterating two times.
  14146. # The file diamond.shape may contain a pattern of characters like this
  14147. # *
  14148. # ***
  14149. # *****
  14150. # ***
  14151. # *
  14152. # The specified columns and rows are ignored
  14153. # but the anchor point coordinates are not
  14154. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  14155. @end example
  14156. @subsection erode
  14157. Erode an image by using a specific structuring element.
  14158. It corresponds to the libopencv function @code{cvErode}.
  14159. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  14160. with the same syntax and semantics as the @ref{dilate} filter.
  14161. @subsection smooth
  14162. Smooth the input video.
  14163. The filter takes the following parameters:
  14164. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  14165. @var{type} is the type of smooth filter to apply, and must be one of
  14166. the following values: "blur", "blur_no_scale", "median", "gaussian",
  14167. or "bilateral". The default value is "gaussian".
  14168. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  14169. depends on the smooth type. @var{param1} and
  14170. @var{param2} accept integer positive values or 0. @var{param3} and
  14171. @var{param4} accept floating point values.
  14172. The default value for @var{param1} is 3. The default value for the
  14173. other parameters is 0.
  14174. These parameters correspond to the parameters assigned to the
  14175. libopencv function @code{cvSmooth}.
  14176. @section oscilloscope
  14177. 2D Video Oscilloscope.
  14178. Useful to measure spatial impulse, step responses, chroma delays, etc.
  14179. It accepts the following parameters:
  14180. @table @option
  14181. @item x
  14182. Set scope center x position.
  14183. @item y
  14184. Set scope center y position.
  14185. @item s
  14186. Set scope size, relative to frame diagonal.
  14187. @item t
  14188. Set scope tilt/rotation.
  14189. @item o
  14190. Set trace opacity.
  14191. @item tx
  14192. Set trace center x position.
  14193. @item ty
  14194. Set trace center y position.
  14195. @item tw
  14196. Set trace width, relative to width of frame.
  14197. @item th
  14198. Set trace height, relative to height of frame.
  14199. @item c
  14200. Set which components to trace. By default it traces first three components.
  14201. @item g
  14202. Draw trace grid. By default is enabled.
  14203. @item st
  14204. Draw some statistics. By default is enabled.
  14205. @item sc
  14206. Draw scope. By default is enabled.
  14207. @end table
  14208. @subsection Commands
  14209. This filter supports same @ref{commands} as options.
  14210. The command accepts the same syntax of the corresponding option.
  14211. If the specified expression is not valid, it is kept at its current
  14212. value.
  14213. @subsection Examples
  14214. @itemize
  14215. @item
  14216. Inspect full first row of video frame.
  14217. @example
  14218. oscilloscope=x=0.5:y=0:s=1
  14219. @end example
  14220. @item
  14221. Inspect full last row of video frame.
  14222. @example
  14223. oscilloscope=x=0.5:y=1:s=1
  14224. @end example
  14225. @item
  14226. Inspect full 5th line of video frame of height 1080.
  14227. @example
  14228. oscilloscope=x=0.5:y=5/1080:s=1
  14229. @end example
  14230. @item
  14231. Inspect full last column of video frame.
  14232. @example
  14233. oscilloscope=x=1:y=0.5:s=1:t=1
  14234. @end example
  14235. @end itemize
  14236. @anchor{overlay}
  14237. @section overlay
  14238. Overlay one video on top of another.
  14239. It takes two inputs and has one output. The first input is the "main"
  14240. video on which the second input is overlaid.
  14241. It accepts the following parameters:
  14242. A description of the accepted options follows.
  14243. @table @option
  14244. @item x
  14245. @item y
  14246. Set the expression for the x and y coordinates of the overlaid video
  14247. on the main video. Default value is "0" for both expressions. In case
  14248. the expression is invalid, it is set to a huge value (meaning that the
  14249. overlay will not be displayed within the output visible area).
  14250. @item eof_action
  14251. See @ref{framesync}.
  14252. @item eval
  14253. Set when the expressions for @option{x}, and @option{y} are evaluated.
  14254. It accepts the following values:
  14255. @table @samp
  14256. @item init
  14257. only evaluate expressions once during the filter initialization or
  14258. when a command is processed
  14259. @item frame
  14260. evaluate expressions for each incoming frame
  14261. @end table
  14262. Default value is @samp{frame}.
  14263. @item shortest
  14264. See @ref{framesync}.
  14265. @item format
  14266. Set the format for the output video.
  14267. It accepts the following values:
  14268. @table @samp
  14269. @item yuv420
  14270. force YUV 4:2:0 8-bit planar output
  14271. @item yuv420p10
  14272. force YUV 4:2:0 10-bit planar output
  14273. @item yuv422
  14274. force YUV 4:2:2 8-bit planar output
  14275. @item yuv422p10
  14276. force YUV 4:2:2 10-bit planar output
  14277. @item yuv444
  14278. force YUV 4:4:4 8-bit planar output
  14279. @item yuv444p10
  14280. force YUV 4:4:4 10-bit planar output
  14281. @item rgb
  14282. force RGB 8-bit packed output
  14283. @item gbrp
  14284. force RGB 8-bit planar output
  14285. @item auto
  14286. automatically pick format
  14287. @end table
  14288. Default value is @samp{yuv420}.
  14289. @item repeatlast
  14290. See @ref{framesync}.
  14291. @item alpha
  14292. Set format of alpha of the overlaid video, it can be @var{straight} or
  14293. @var{premultiplied}. Default is @var{straight}.
  14294. @end table
  14295. The @option{x}, and @option{y} expressions can contain the following
  14296. parameters.
  14297. @table @option
  14298. @item main_w, W
  14299. @item main_h, H
  14300. The main input width and height.
  14301. @item overlay_w, w
  14302. @item overlay_h, h
  14303. The overlay input width and height.
  14304. @item x
  14305. @item y
  14306. The computed values for @var{x} and @var{y}. They are evaluated for
  14307. each new frame.
  14308. @item hsub
  14309. @item vsub
  14310. horizontal and vertical chroma subsample values of the output
  14311. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  14312. @var{vsub} is 1.
  14313. @item n
  14314. the number of input frame, starting from 0
  14315. @item pos
  14316. the position in the file of the input frame, NAN if unknown; deprecated,
  14317. do not use
  14318. @item t
  14319. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  14320. @end table
  14321. This filter also supports the @ref{framesync} options.
  14322. Note that the @var{n}, @var{t} variables are available only
  14323. when evaluation is done @emph{per frame}, and will evaluate to NAN
  14324. when @option{eval} is set to @samp{init}.
  14325. Be aware that frames are taken from each input video in timestamp
  14326. order, hence, if their initial timestamps differ, it is a good idea
  14327. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  14328. have them begin in the same zero timestamp, as the example for
  14329. the @var{movie} filter does.
  14330. You can chain together more overlays but you should test the
  14331. efficiency of such approach.
  14332. @subsection Commands
  14333. This filter supports the following commands:
  14334. @table @option
  14335. @item x
  14336. @item y
  14337. Modify the x and y of the overlay input.
  14338. The command accepts the same syntax of the corresponding option.
  14339. If the specified expression is not valid, it is kept at its current
  14340. value.
  14341. @end table
  14342. @subsection Examples
  14343. @itemize
  14344. @item
  14345. Draw the overlay at 10 pixels from the bottom right corner of the main
  14346. video:
  14347. @example
  14348. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  14349. @end example
  14350. Using named options the example above becomes:
  14351. @example
  14352. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  14353. @end example
  14354. @item
  14355. Insert a transparent PNG logo in the bottom left corner of the input,
  14356. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  14357. @example
  14358. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  14359. @end example
  14360. @item
  14361. Insert 2 different transparent PNG logos (second logo on bottom
  14362. right corner) using the @command{ffmpeg} tool:
  14363. @example
  14364. 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
  14365. @end example
  14366. @item
  14367. Add a transparent color layer on top of the main video; @code{WxH}
  14368. must specify the size of the main input to the overlay filter:
  14369. @example
  14370. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  14371. @end example
  14372. @item
  14373. Play an original video and a filtered version (here with the deshake
  14374. filter) side by side using the @command{ffplay} tool:
  14375. @example
  14376. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  14377. @end example
  14378. The above command is the same as:
  14379. @example
  14380. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  14381. @end example
  14382. @item
  14383. Make a sliding overlay appearing from the left to the right top part of the
  14384. screen starting since time 2:
  14385. @example
  14386. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  14387. @end example
  14388. @item
  14389. Compose output by putting two input videos side to side:
  14390. @example
  14391. ffmpeg -i left.avi -i right.avi -filter_complex "
  14392. nullsrc=size=200x100 [background];
  14393. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  14394. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  14395. [background][left] overlay=shortest=1 [background+left];
  14396. [background+left][right] overlay=shortest=1:x=100 [left+right]
  14397. "
  14398. @end example
  14399. @item
  14400. Mask 10-20 seconds of a video by applying the delogo filter to a section
  14401. @example
  14402. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  14403. -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]'
  14404. masked.avi
  14405. @end example
  14406. @item
  14407. Chain several overlays in cascade:
  14408. @example
  14409. nullsrc=s=200x200 [bg];
  14410. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  14411. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  14412. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  14413. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  14414. [in3] null, [mid2] overlay=100:100 [out0]
  14415. @end example
  14416. @end itemize
  14417. @section owdenoise
  14418. Apply Overcomplete Wavelet denoiser.
  14419. The filter accepts the following options:
  14420. @table @option
  14421. @item depth
  14422. Set depth.
  14423. Larger depth values will denoise lower frequency components more, but
  14424. slow down filtering.
  14425. Must be an int in the range 8-16, default is @code{8}.
  14426. @item luma_strength, ls
  14427. Set luma strength.
  14428. Must be a double value in the range 0-1000, default is @code{1.0}.
  14429. @item chroma_strength, cs
  14430. Set chroma strength.
  14431. Must be a double value in the range 0-1000, default is @code{1.0}.
  14432. @end table
  14433. @anchor{pad}
  14434. @section pad
  14435. Add paddings to the input image, and place the original input at the
  14436. provided @var{x}, @var{y} coordinates.
  14437. It accepts the following parameters:
  14438. @table @option
  14439. @item width, w
  14440. @item height, h
  14441. Specify an expression for the size of the output image with the
  14442. paddings added. If the value for @var{width} or @var{height} is 0, the
  14443. corresponding input size is used for the output.
  14444. The @var{width} expression can reference the value set by the
  14445. @var{height} expression, and vice versa.
  14446. The default value of @var{width} and @var{height} is 0.
  14447. @item x
  14448. @item y
  14449. Specify the offsets to place the input image at within the padded area,
  14450. with respect to the top/left border of the output image.
  14451. The @var{x} expression can reference the value set by the @var{y}
  14452. expression, and vice versa.
  14453. The default value of @var{x} and @var{y} is 0.
  14454. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  14455. so the input image is centered on the padded area.
  14456. @item color
  14457. Specify the color of the padded area. For the syntax of this option,
  14458. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14459. manual,ffmpeg-utils}.
  14460. The default value of @var{color} is "black".
  14461. @item eval
  14462. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  14463. It accepts the following values:
  14464. @table @samp
  14465. @item init
  14466. Only evaluate expressions once during the filter initialization or when
  14467. a command is processed.
  14468. @item frame
  14469. Evaluate expressions for each incoming frame.
  14470. @end table
  14471. Default value is @samp{init}.
  14472. @item aspect
  14473. Pad to aspect instead to a resolution.
  14474. @end table
  14475. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  14476. options are expressions containing the following constants:
  14477. @table @option
  14478. @item in_w
  14479. @item in_h
  14480. The input video width and height.
  14481. @item iw
  14482. @item ih
  14483. These are the same as @var{in_w} and @var{in_h}.
  14484. @item out_w
  14485. @item out_h
  14486. The output width and height (the size of the padded area), as
  14487. specified by the @var{width} and @var{height} expressions.
  14488. @item ow
  14489. @item oh
  14490. These are the same as @var{out_w} and @var{out_h}.
  14491. @item x
  14492. @item y
  14493. The x and y offsets as specified by the @var{x} and @var{y}
  14494. expressions, or NAN if not yet specified.
  14495. @item a
  14496. same as @var{iw} / @var{ih}
  14497. @item sar
  14498. input sample aspect ratio
  14499. @item dar
  14500. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  14501. @item hsub
  14502. @item vsub
  14503. The horizontal and vertical chroma subsample values. For example for the
  14504. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14505. @end table
  14506. @subsection Examples
  14507. @itemize
  14508. @item
  14509. Add paddings with the color "violet" to the input video. The output video
  14510. size is 640x480, and the top-left corner of the input video is placed at
  14511. column 0, row 40
  14512. @example
  14513. pad=640:480:0:40:violet
  14514. @end example
  14515. The example above is equivalent to the following command:
  14516. @example
  14517. pad=width=640:height=480:x=0:y=40:color=violet
  14518. @end example
  14519. @item
  14520. Pad the input to get an output with dimensions increased by 3/2,
  14521. and put the input video at the center of the padded area:
  14522. @example
  14523. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  14524. @end example
  14525. @item
  14526. Pad the input to get a squared output with size equal to the maximum
  14527. value between the input width and height, and put the input video at
  14528. the center of the padded area:
  14529. @example
  14530. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  14531. @end example
  14532. @item
  14533. Pad the input to get a final w/h ratio of 16:9:
  14534. @example
  14535. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  14536. @end example
  14537. @item
  14538. In case of anamorphic video, in order to set the output display aspect
  14539. correctly, it is necessary to use @var{sar} in the expression,
  14540. according to the relation:
  14541. @example
  14542. (ih * X / ih) * sar = output_dar
  14543. X = output_dar / sar
  14544. @end example
  14545. Thus the previous example needs to be modified to:
  14546. @example
  14547. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  14548. @end example
  14549. @item
  14550. Double the output size and put the input video in the bottom-right
  14551. corner of the output padded area:
  14552. @example
  14553. pad="2*iw:2*ih:ow-iw:oh-ih"
  14554. @end example
  14555. @end itemize
  14556. @anchor{palettegen}
  14557. @section palettegen
  14558. Generate one palette for a whole video stream.
  14559. It accepts the following options:
  14560. @table @option
  14561. @item max_colors
  14562. Set the maximum number of colors to quantize in the palette.
  14563. Note: the palette will still contain 256 colors; the unused palette entries
  14564. will be black.
  14565. @item reserve_transparent
  14566. Create a palette of 255 colors maximum and reserve the last one for
  14567. transparency. Reserving the transparency color is useful for GIF optimization.
  14568. If not set, the maximum of colors in the palette will be 256. You probably want
  14569. to disable this option for a standalone image.
  14570. Set by default.
  14571. @item transparency_color
  14572. Set the color that will be used as background for transparency.
  14573. @item stats_mode
  14574. Set statistics mode.
  14575. It accepts the following values:
  14576. @table @samp
  14577. @item full
  14578. Compute full frame histograms.
  14579. @item diff
  14580. Compute histograms only for the part that differs from previous frame. This
  14581. might be relevant to give more importance to the moving part of your input if
  14582. the background is static.
  14583. @item single
  14584. Compute new histogram for each frame.
  14585. @end table
  14586. Default value is @var{full}.
  14587. @end table
  14588. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  14589. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  14590. color quantization of the palette. This information is also visible at
  14591. @var{info} logging level.
  14592. @subsection Examples
  14593. @itemize
  14594. @item
  14595. Generate a representative palette of a given video using @command{ffmpeg}:
  14596. @example
  14597. ffmpeg -i input.mkv -vf palettegen palette.png
  14598. @end example
  14599. @end itemize
  14600. @section paletteuse
  14601. Use a palette to downsample an input video stream.
  14602. The filter takes two inputs: one video stream and a palette. The palette must
  14603. be a 256 pixels image.
  14604. It accepts the following options:
  14605. @table @option
  14606. @item dither
  14607. Select dithering mode. Available algorithms are:
  14608. @table @samp
  14609. @item bayer
  14610. Ordered 8x8 bayer dithering (deterministic)
  14611. @item heckbert
  14612. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  14613. Note: this dithering is sometimes considered "wrong" and is included as a
  14614. reference.
  14615. @item floyd_steinberg
  14616. Floyd and Steingberg dithering (error diffusion)
  14617. @item sierra2
  14618. Frankie Sierra dithering v2 (error diffusion)
  14619. @item sierra2_4a
  14620. Frankie Sierra dithering v2 "Lite" (error diffusion)
  14621. @item sierra3
  14622. Frankie Sierra dithering v3 (error diffusion)
  14623. @item burkes
  14624. Burkes dithering (error diffusion)
  14625. @item atkinson
  14626. Atkinson dithering by Bill Atkinson at Apple Computer (error diffusion)
  14627. @item none
  14628. Disable dithering.
  14629. @end table
  14630. Default is @var{sierra2_4a}.
  14631. @item bayer_scale
  14632. When @var{bayer} dithering is selected, this option defines the scale of the
  14633. pattern (how much the crosshatch pattern is visible). A low value means more
  14634. visible pattern for less banding, and higher value means less visible pattern
  14635. at the cost of more banding.
  14636. The option must be an integer value in the range [0,5]. Default is @var{2}.
  14637. @item diff_mode
  14638. If set, define the zone to process
  14639. @table @samp
  14640. @item rectangle
  14641. Only the changing rectangle will be reprocessed. This is similar to GIF
  14642. cropping/offsetting compression mechanism. This option can be useful for speed
  14643. if only a part of the image is changing, and has use cases such as limiting the
  14644. scope of the error diffusal @option{dither} to the rectangle that bounds the
  14645. moving scene (it leads to more deterministic output if the scene doesn't change
  14646. much, and as a result less moving noise and better GIF compression).
  14647. @end table
  14648. Default is @var{none}.
  14649. @item new
  14650. Take new palette for each output frame.
  14651. @item alpha_threshold
  14652. Sets the alpha threshold for transparency. Alpha values above this threshold
  14653. will be treated as completely opaque, and values below this threshold will be
  14654. treated as completely transparent.
  14655. The option must be an integer value in the range [0,255]. Default is @var{128}.
  14656. @end table
  14657. @subsection Examples
  14658. @itemize
  14659. @item
  14660. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  14661. using @command{ffmpeg}:
  14662. @example
  14663. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  14664. @end example
  14665. @end itemize
  14666. @section perspective
  14667. Correct perspective of video not recorded perpendicular to the screen.
  14668. A description of the accepted parameters follows.
  14669. @table @option
  14670. @item x0
  14671. @item y0
  14672. @item x1
  14673. @item y1
  14674. @item x2
  14675. @item y2
  14676. @item x3
  14677. @item y3
  14678. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  14679. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  14680. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  14681. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  14682. then the corners of the source will be sent to the specified coordinates.
  14683. The expressions can use the following variables:
  14684. @table @option
  14685. @item W
  14686. @item H
  14687. the width and height of video frame.
  14688. @item in
  14689. Input frame count.
  14690. @item on
  14691. Output frame count.
  14692. @end table
  14693. @item interpolation
  14694. Set interpolation for perspective correction.
  14695. It accepts the following values:
  14696. @table @samp
  14697. @item linear
  14698. @item cubic
  14699. @end table
  14700. Default value is @samp{linear}.
  14701. @item sense
  14702. Set interpretation of coordinate options.
  14703. It accepts the following values:
  14704. @table @samp
  14705. @item 0, source
  14706. Send point in the source specified by the given coordinates to
  14707. the corners of the destination.
  14708. @item 1, destination
  14709. Send the corners of the source to the point in the destination specified
  14710. by the given coordinates.
  14711. Default value is @samp{source}.
  14712. @end table
  14713. @item eval
  14714. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  14715. It accepts the following values:
  14716. @table @samp
  14717. @item init
  14718. only evaluate expressions once during the filter initialization or
  14719. when a command is processed
  14720. @item frame
  14721. evaluate expressions for each incoming frame
  14722. @end table
  14723. Default value is @samp{init}.
  14724. @end table
  14725. @section phase
  14726. Delay interlaced video by one field time so that the field order changes.
  14727. The intended use is to fix PAL movies that have been captured with the
  14728. opposite field order to the film-to-video transfer.
  14729. A description of the accepted parameters follows.
  14730. @table @option
  14731. @item mode
  14732. Set phase mode.
  14733. It accepts the following values:
  14734. @table @samp
  14735. @item t
  14736. Capture field order top-first, transfer bottom-first.
  14737. Filter will delay the bottom field.
  14738. @item b
  14739. Capture field order bottom-first, transfer top-first.
  14740. Filter will delay the top field.
  14741. @item p
  14742. Capture and transfer with the same field order. This mode only exists
  14743. for the documentation of the other options to refer to, but if you
  14744. actually select it, the filter will faithfully do nothing.
  14745. @item a
  14746. Capture field order determined automatically by field flags, transfer
  14747. opposite.
  14748. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  14749. basis using field flags. If no field information is available,
  14750. then this works just like @samp{u}.
  14751. @item u
  14752. Capture unknown or varying, transfer opposite.
  14753. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  14754. analyzing the images and selecting the alternative that produces best
  14755. match between the fields.
  14756. @item T
  14757. Capture top-first, transfer unknown or varying.
  14758. Filter selects among @samp{t} and @samp{p} using image analysis.
  14759. @item B
  14760. Capture bottom-first, transfer unknown or varying.
  14761. Filter selects among @samp{b} and @samp{p} using image analysis.
  14762. @item A
  14763. Capture determined by field flags, transfer unknown or varying.
  14764. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  14765. image analysis. If no field information is available, then this works just
  14766. like @samp{U}. This is the default mode.
  14767. @item U
  14768. Both capture and transfer unknown or varying.
  14769. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  14770. @end table
  14771. @end table
  14772. @subsection Commands
  14773. This filter supports the all above options as @ref{commands}.
  14774. @section photosensitivity
  14775. Reduce various flashes in video, so to help users with epilepsy.
  14776. It accepts the following options:
  14777. @table @option
  14778. @item frames, f
  14779. Set how many frames to use when filtering. Default is 30.
  14780. @item threshold, t
  14781. Set detection threshold factor. Default is 1.
  14782. Lower is stricter.
  14783. @item skip
  14784. Set how many pixels to skip when sampling frames. Default is 1.
  14785. Allowed range is from 1 to 1024.
  14786. @item bypass
  14787. Leave frames unchanged. Default is disabled.
  14788. @end table
  14789. @section pixdesctest
  14790. Pixel format descriptor test filter, mainly useful for internal
  14791. testing. The output video should be equal to the input video.
  14792. For example:
  14793. @example
  14794. format=monow, pixdesctest
  14795. @end example
  14796. can be used to test the monowhite pixel format descriptor definition.
  14797. @section pixelize
  14798. Apply pixelization to video stream.
  14799. The filter accepts the following options:
  14800. @table @option
  14801. @item width, w
  14802. @item height, h
  14803. Set block dimensions that will be used for pixelization.
  14804. Default value is @code{16}.
  14805. @item mode, m
  14806. Set the mode of pixelization used.
  14807. Possible values are:
  14808. @table @samp
  14809. @item avg
  14810. @item min
  14811. @item max
  14812. @end table
  14813. Default value is @code{avg}.
  14814. @item planes, p
  14815. Set what planes to filter. Default is to filter all planes.
  14816. @end table
  14817. @subsection Commands
  14818. This filter supports all options as @ref{commands}.
  14819. @section pixscope
  14820. Display sample values of color channels. Mainly useful for checking color
  14821. and levels. Minimum supported resolution is 640x480.
  14822. The filters accept the following options:
  14823. @table @option
  14824. @item x
  14825. Set scope X position, relative offset on X axis.
  14826. @item y
  14827. Set scope Y position, relative offset on Y axis.
  14828. @item w
  14829. Set scope width.
  14830. @item h
  14831. Set scope height.
  14832. @item o
  14833. Set window opacity. This window also holds statistics about pixel area.
  14834. @item wx
  14835. Set window X position, relative offset on X axis.
  14836. @item wy
  14837. Set window Y position, relative offset on Y axis.
  14838. @end table
  14839. @subsection Commands
  14840. This filter supports same @ref{commands} as options.
  14841. @section pp7
  14842. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  14843. similar to spp = 6 with 7 point DCT, where only the center sample is
  14844. used after IDCT.
  14845. The filter accepts the following options:
  14846. @table @option
  14847. @item qp
  14848. Force a constant quantization parameter. It accepts an integer in range
  14849. 0 to 63. If not set, the filter will use the QP from the video stream
  14850. (if available).
  14851. @item mode
  14852. Set thresholding mode. Available modes are:
  14853. @table @samp
  14854. @item hard
  14855. Set hard thresholding.
  14856. @item soft
  14857. Set soft thresholding (better de-ringing effect, but likely blurrier).
  14858. @item medium
  14859. Set medium thresholding (good results, default).
  14860. @end table
  14861. @end table
  14862. @section premultiply
  14863. Apply alpha premultiply effect to input video stream using first plane
  14864. of second stream as alpha.
  14865. Both streams must have same dimensions and same pixel format.
  14866. The filter accepts the following option:
  14867. @table @option
  14868. @item planes
  14869. Set which planes will be processed, unprocessed planes will be copied.
  14870. By default value 0xf, all planes will be processed.
  14871. @item inplace
  14872. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14873. @end table
  14874. @section prewitt
  14875. Apply prewitt operator to input video stream.
  14876. The filter accepts the following option:
  14877. @table @option
  14878. @item planes
  14879. Set which planes will be processed, unprocessed planes will be copied.
  14880. By default value 0xf, all planes will be processed.
  14881. @item scale
  14882. Set value which will be multiplied with filtered result.
  14883. @item delta
  14884. Set value which will be added to filtered result.
  14885. @end table
  14886. @subsection Commands
  14887. This filter supports the all above options as @ref{commands}.
  14888. @section pseudocolor
  14889. Alter frame colors in video with pseudocolors.
  14890. This filter accepts the following options:
  14891. @table @option
  14892. @item c0
  14893. set pixel first component expression
  14894. @item c1
  14895. set pixel second component expression
  14896. @item c2
  14897. set pixel third component expression
  14898. @item c3
  14899. set pixel fourth component expression, corresponds to the alpha component
  14900. @item index, i
  14901. set component to use as base for altering colors
  14902. @item preset, p
  14903. Pick one of built-in LUTs. By default is set to none.
  14904. Available LUTs:
  14905. @table @samp
  14906. @item magma
  14907. @item inferno
  14908. @item plasma
  14909. @item viridis
  14910. @item turbo
  14911. @item cividis
  14912. @item range1
  14913. @item range2
  14914. @item shadows
  14915. @item highlights
  14916. @item solar
  14917. @item nominal
  14918. @item preferred
  14919. @item total
  14920. @item spectral
  14921. @item cool
  14922. @item heat
  14923. @item fiery
  14924. @item blues
  14925. @item green
  14926. @item helix
  14927. @end table
  14928. @item opacity
  14929. Set opacity of output colors. Allowed range is from 0 to 1.
  14930. Default value is set to 1.
  14931. @end table
  14932. Each of the expression options specifies the expression to use for computing
  14933. the lookup table for the corresponding pixel component values.
  14934. The expressions can contain the following constants and functions:
  14935. @table @option
  14936. @item w
  14937. @item h
  14938. The input width and height.
  14939. @item val
  14940. The input value for the pixel component.
  14941. @item ymin, umin, vmin, amin
  14942. The minimum allowed component value.
  14943. @item ymax, umax, vmax, amax
  14944. The maximum allowed component value.
  14945. @end table
  14946. All expressions default to "val".
  14947. @subsection Commands
  14948. This filter supports the all above options as @ref{commands}.
  14949. @subsection Examples
  14950. @itemize
  14951. @item
  14952. Change too high luma values to gradient:
  14953. @example
  14954. 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'"
  14955. @end example
  14956. @end itemize
  14957. @anchor{psnr}
  14958. @section psnr
  14959. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  14960. Ratio) between two input videos.
  14961. This filter takes in input two input videos, the first input is
  14962. considered the "main" source and is passed unchanged to the
  14963. output. The second input is used as a "reference" video for computing
  14964. the PSNR.
  14965. Both video inputs must have the same resolution and pixel format for
  14966. this filter to work correctly. Also it assumes that both inputs
  14967. have the same number of frames, which are compared one by one.
  14968. The obtained average PSNR is printed through the logging system.
  14969. The filter stores the accumulated MSE (mean squared error) of each
  14970. frame, and at the end of the processing it is averaged across all frames
  14971. equally, and the following formula is applied to obtain the PSNR:
  14972. @example
  14973. PSNR = 10*log10(MAX^2/MSE)
  14974. @end example
  14975. Where MAX is the average of the maximum values of each component of the
  14976. image.
  14977. The description of the accepted parameters follows.
  14978. @table @option
  14979. @item stats_file, f
  14980. If specified the filter will use the named file to save the PSNR of
  14981. each individual frame. When filename equals "-" the data is sent to
  14982. standard output.
  14983. @item stats_version
  14984. Specifies which version of the stats file format to use. Details of
  14985. each format are written below.
  14986. Default value is 1.
  14987. @item stats_add_max
  14988. Determines whether the max value is output to the stats log.
  14989. Default value is 0.
  14990. Requires stats_version >= 2. If this is set and stats_version < 2,
  14991. the filter will return an error.
  14992. @end table
  14993. This filter also supports the @ref{framesync} options.
  14994. The file printed if @var{stats_file} is selected, contains a sequence of
  14995. key/value pairs of the form @var{key}:@var{value} for each compared
  14996. couple of frames.
  14997. If a @var{stats_version} greater than 1 is specified, a header line precedes
  14998. the list of per-frame-pair stats, with key value pairs following the frame
  14999. format with the following parameters:
  15000. @table @option
  15001. @item psnr_log_version
  15002. The version of the log file format. Will match @var{stats_version}.
  15003. @item fields
  15004. A comma separated list of the per-frame-pair parameters included in
  15005. the log.
  15006. @end table
  15007. A description of each shown per-frame-pair parameter follows:
  15008. @table @option
  15009. @item n
  15010. sequential number of the input frame, starting from 1
  15011. @item mse_avg
  15012. Mean Square Error pixel-by-pixel average difference of the compared
  15013. frames, averaged over all the image components.
  15014. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  15015. Mean Square Error pixel-by-pixel average difference of the compared
  15016. frames for the component specified by the suffix.
  15017. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  15018. Peak Signal to Noise ratio of the compared frames for the component
  15019. specified by the suffix.
  15020. @item max_avg, max_y, max_u, max_v
  15021. Maximum allowed value for each channel, and average over all
  15022. channels.
  15023. @end table
  15024. @subsection Examples
  15025. @itemize
  15026. @item
  15027. For example:
  15028. @example
  15029. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  15030. [main][ref] psnr="stats_file=stats.log" [out]
  15031. @end example
  15032. On this example the input file being processed is compared with the
  15033. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  15034. is stored in @file{stats.log}.
  15035. @item
  15036. Another example with different containers:
  15037. @example
  15038. 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 -
  15039. @end example
  15040. @end itemize
  15041. @anchor{pullup}
  15042. @section pullup
  15043. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  15044. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  15045. content.
  15046. The pullup filter is designed to take advantage of future context in making
  15047. its decisions. This filter is stateless in the sense that it does not lock
  15048. onto a pattern to follow, but it instead looks forward to the following
  15049. fields in order to identify matches and rebuild progressive frames.
  15050. To produce content with an even framerate, insert the fps filter after
  15051. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  15052. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  15053. The filter accepts the following options:
  15054. @table @option
  15055. @item jl
  15056. @item jr
  15057. @item jt
  15058. @item jb
  15059. These options set the amount of "junk" to ignore at the left, right, top, and
  15060. bottom of the image, respectively. Left and right are in units of 8 pixels,
  15061. while top and bottom are in units of 2 lines.
  15062. The default is 8 pixels on each side.
  15063. @item sb
  15064. Set the strict breaks. Setting this option to 1 will reduce the chances of
  15065. filter generating an occasional mismatched frame, but it may also cause an
  15066. excessive number of frames to be dropped during high motion sequences.
  15067. Conversely, setting it to -1 will make filter match fields more easily.
  15068. This may help processing of video where there is slight blurring between
  15069. the fields, but may also cause there to be interlaced frames in the output.
  15070. Default value is @code{0}.
  15071. @item mp
  15072. Set the metric plane to use. It accepts the following values:
  15073. @table @samp
  15074. @item l
  15075. Use luma plane.
  15076. @item u
  15077. Use chroma blue plane.
  15078. @item v
  15079. Use chroma red plane.
  15080. @end table
  15081. This option may be set to use chroma plane instead of the default luma plane
  15082. for doing filter's computations. This may improve accuracy on very clean
  15083. source material, but more likely will decrease accuracy, especially if there
  15084. is chroma noise (rainbow effect) or any grayscale video.
  15085. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  15086. load and make pullup usable in realtime on slow machines.
  15087. @end table
  15088. For best results (without duplicated frames in the output file) it is
  15089. necessary to change the output frame rate. For example, to inverse
  15090. telecine NTSC input:
  15091. @example
  15092. ffmpeg -i input -vf pullup -r 24000/1001 ...
  15093. @end example
  15094. @section qp
  15095. Change video quantization parameters (QP).
  15096. The filter accepts the following option:
  15097. @table @option
  15098. @item qp
  15099. Set expression for quantization parameter.
  15100. @end table
  15101. The expression is evaluated through the eval API and can contain, among others,
  15102. the following constants:
  15103. @table @var
  15104. @item known
  15105. 1 if index is not 129, 0 otherwise.
  15106. @item qp
  15107. Sequential index starting from -129 to 128.
  15108. @end table
  15109. @subsection Examples
  15110. @itemize
  15111. @item
  15112. Some equation like:
  15113. @example
  15114. qp=2+2*sin(PI*qp)
  15115. @end example
  15116. @end itemize
  15117. @section qrencode
  15118. Generate a QR code using the libqrencode library (see
  15119. @url{https://fukuchi.org/works/qrencode/}), and overlay it on top of the current
  15120. frame.
  15121. To enable the compilation of this filter, you need to configure FFmpeg with
  15122. @code{--enable-libqrencode}.
  15123. The QR code is generated from the provided text or text pattern. The
  15124. corresponding QR code is scaled and overlayed into the video output according to
  15125. the specified options.
  15126. In case no text is specified, no QR code is overlaied.
  15127. This filter accepts the following options:
  15128. @table @option
  15129. @item qrcode_width, q
  15130. @item padded_qrcode_width, Q
  15131. Specify an expression for the width of the rendered QR code, with and without
  15132. padding. The @var{qrcode_width} expression can reference the value set by the
  15133. @var{padded_qrcode_width} expression, and vice versa.
  15134. By default @var{padded_qrcode_width} is set to @var{qrcode_width}, meaning that
  15135. there is no padding.
  15136. These expressions are evaluated for each new frame.
  15137. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  15138. @item x
  15139. @item y
  15140. Specify an expression for positioning the padded QR code top-left corner. The
  15141. @var{x} expression can reference the value set by the @var{y} expression, and
  15142. vice.
  15143. By default @var{x} and @var{y} are set set to @var{0}, meaning that the QR code
  15144. is placed in the top left corner of the input.
  15145. These expressions are evaluated for each new frame.
  15146. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  15147. @item case_sensitive, cs
  15148. Instruct libqrencode to use case sensitive encoding. This is enabled by
  15149. default. This can be disabled to reduce the QR encoding size.
  15150. @item level, l
  15151. Specify the QR encoding error correction level. With an higher correction level,
  15152. the encoding size will increase but the code will be more robust to corruption.
  15153. Lower level is @var{L}.
  15154. It accepts the following values:
  15155. @table @samp
  15156. @item L
  15157. @item M
  15158. @item Q
  15159. @item H
  15160. @end table
  15161. @item expansion
  15162. Select how the input text is expanded. Can be either @code{none}, or
  15163. @code{normal} (default). See the @ref{qrencode_text_expansion,,qrencode Text expansion}
  15164. section below for details.
  15165. @item text
  15166. @item textfile
  15167. Define the text to be rendered. In case neither is specified, no QR is encoded
  15168. (just an empty colored frame).
  15169. In case expansion is enabled, the text is treated as a text template, using the
  15170. qrencode expansion mechanism. See the @ref{qrencode_text_expansion,,qrencode
  15171. Text expansion} section below for details.
  15172. @item background_color, bc
  15173. @item foreground_color, fc
  15174. Set the QR code and background color. The default value of
  15175. @var{foreground_color} is "black", the default value of @var{background_color}
  15176. is "white".
  15177. For the syntax of the color options, check the @ref{color syntax,,"Color"
  15178. section in the ffmpeg-utils manual,ffmpeg-utils}.
  15179. @end table
  15180. @anchor{qrencode_expressions}
  15181. @subsection qrencode Expressions
  15182. The expressions set by the options contain the following constants and functions.
  15183. @table @option
  15184. @item dar
  15185. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  15186. @item duration
  15187. the current frame's duration, in seconds
  15188. @item hsub
  15189. @item vsub
  15190. horizontal and vertical chroma subsample values. For example for the
  15191. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15192. @item main_h, H
  15193. the input height
  15194. @item main_w, W
  15195. the input width
  15196. @item n
  15197. the number of input frame, starting from 0
  15198. @item pict_type
  15199. a number representing the picture type
  15200. @item qr_w, w
  15201. the width of the encoded QR code
  15202. @item rendered_qr_w, q
  15203. @item rendered_padded_qr_w, Q
  15204. the width of the rendered QR code, without and without padding.
  15205. These parameters allow the @var{q} and @var{Q} expressions to refer to each
  15206. other, so you can for example specify @code{q=3/4*Q}.
  15207. @item rand(min, max)
  15208. return a random number included between @var{min} and @var{max}
  15209. @item sar
  15210. the input sample aspect ratio
  15211. @item t
  15212. timestamp expressed in seconds, NAN if the input timestamp is unknown
  15213. @item x
  15214. @item y
  15215. the x and y offset coordinates where the text is drawn.
  15216. These parameters allow the @var{x} and @var{y} expressions to refer to each
  15217. other, so you can for example specify @code{y=x/dar}.
  15218. @end table
  15219. @anchor{qrencode_text_expansion}
  15220. @subsection qrencode Text expansion
  15221. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  15222. If @option{expansion} is set to @code{normal} (which is the default),
  15223. the following expansion mechanism is used.
  15224. The backslash character @samp{\}, followed by any character, always expands to
  15225. the second character.
  15226. Sequences of the form @code{%@{...@}} are expanded. The text between the
  15227. braces is a function name, possibly followed by arguments separated by ':'.
  15228. If the arguments contain special characters or delimiters (':' or '@}'),
  15229. they should be escaped.
  15230. Note that they probably must also be escaped as the value for the @option{text}
  15231. option in the filter argument string and as the filter argument in the
  15232. filtergraph description, and possibly also for the shell, that makes up to four
  15233. levels of escaping; using a text file with the @option{textfile} option avoids
  15234. these problems.
  15235. The following functions are available:
  15236. @table @command
  15237. @item n, frame_num
  15238. return the frame number
  15239. @item pts
  15240. Return the presentation timestamp of the current frame.
  15241. It can take up to two arguments.
  15242. The first argument is the format of the timestamp; it defaults to @code{flt} for
  15243. seconds as a decimal number with microsecond accuracy; @code{hms} stands for a
  15244. formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  15245. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  15246. @code{localtime} stands for the timestamp of the frame formatted as local time
  15247. zone time. If the format is set to @code{hms24hh}, the time is formatted in 24h
  15248. format (00-23).
  15249. The second argument is an offset added to the timestamp.
  15250. If the format is set to @code{localtime} or @code{gmtime}, a third argument may
  15251. be supplied: a @code{strftime} C function format string. By default,
  15252. @var{YYYY-MM-DD HH:MM:SS} format will be used.
  15253. @item expr, e
  15254. Evaluate the expression's value and output as a double.
  15255. It must take one argument specifying the expression to be evaluated, accepting
  15256. the constants and functions defined in @ref{qrencode_expressions}.
  15257. @item expr_formatted, ef
  15258. Evaluate the expression's value and output as a formatted string.
  15259. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  15260. The second argument specifies the output format. Allowed values are @samp{x},
  15261. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  15262. @code{printf} function.
  15263. The third parameter is optional and sets the number of positions taken by the output.
  15264. It can be used to add padding with zeros from the left.
  15265. @item gmtime
  15266. The time at which the filter is running, expressed in UTC.
  15267. It can accept an argument: a @code{strftime} C function format string.
  15268. The format string is extended to support the variable @var{%[1-6]N}
  15269. which prints fractions of the second with optionally specified number of digits.
  15270. @item localtime
  15271. The time at which the filter is running, expressed in the local time zone.
  15272. It can accept an argument: a @code{strftime} C function format string.
  15273. The format string is extended to support the variable @var{%[1-6]N}
  15274. which prints fractions of the second with optionally specified number of digits.
  15275. @item metadata
  15276. Frame metadata. Takes one or two arguments.
  15277. The first argument is mandatory and specifies the metadata key.
  15278. The second argument is optional and specifies a default value, used when the
  15279. metadata key is not found or empty.
  15280. Available metadata can be identified by inspecting entries starting with TAG
  15281. included within each frame section printed by running @code{ffprobe
  15282. -show_frames}.
  15283. String metadata generated in filters leading to the qrencode filter are also
  15284. available.
  15285. @item rand(min, max)
  15286. return a random number included between @var{min} and @var{max}
  15287. @end table
  15288. @subsection Examples
  15289. @itemize
  15290. @item
  15291. Generate a QR code encoding the specified text with the default size, overalaid
  15292. in the top left corner of the input video, with the default size:
  15293. @example
  15294. qrencode=text=www.ffmpeg.org
  15295. @end example
  15296. @item
  15297. Same as below, but select blue on pink colors:
  15298. @example
  15299. qrencode=text=www.ffmpeg.org:bc=pink@@0.5:fc=blue
  15300. @end example
  15301. @item
  15302. Place the QR code in the bottom right corner of the input video:
  15303. @example
  15304. qrencode=text=www.ffmpeg.org:x=W-Q:y=H-Q
  15305. @end example
  15306. @item
  15307. Generate a QR code with width of 200 pixels and padding, making the padded width
  15308. 4/3 of the QR code width:
  15309. @example
  15310. qrencode=text=www.ffmpeg.org:q=200:Q=4/3*q
  15311. @end example
  15312. @item
  15313. Generate a QR code with padded width of 200 pixels and padding, making the QR
  15314. code width 3/4 of the padded width:
  15315. @example
  15316. qrencode=text=www.ffmpeg.org:Q=200:q=3/4*Q
  15317. @end example
  15318. @item
  15319. Make the QR code a fraction of the input video width:
  15320. @example
  15321. qrencode=text=www.ffmpeg.org:q=W/5
  15322. @end example
  15323. @item
  15324. Generate a QR code encoding the frame number:
  15325. @example
  15326. qrencode=text=%@{n@}
  15327. @end example
  15328. @item
  15329. Generate a QR code encoding the GMT timestamp:
  15330. @example
  15331. qrencode=text=%@{gmtime@}
  15332. @end example
  15333. @item
  15334. Generate a QR code encoding the timestamp expressed as a float:
  15335. @example
  15336. qrencode=text=%@{pts@}
  15337. @end example
  15338. @end itemize
  15339. @section quirc
  15340. Identify and decode a QR code using the libquirc library (see
  15341. @url{https://github.com/dlbeer/quirc/}), and print the identified QR codes
  15342. positions and payload as metadata.
  15343. To enable the compilation of this filter, you need to configure FFmpeg with
  15344. @code{--enable-libquirc}.
  15345. For each found QR code in the input video, some metadata entries are added with
  15346. the prefix @var{lavfi.quirc.N}, where @var{N} is the index, starting from 0,
  15347. associated to the QR code.
  15348. A description of each metadata value follows:
  15349. @table @option
  15350. @item lavfi.quirc.count
  15351. the number of found QR codes, it is not set in case none was found
  15352. @item lavfi.quirc.N.corner.M.x
  15353. @item lavfi.quirc.N.coreer.M.y
  15354. the x/y positions of the four corners of the square containing the QR code,
  15355. where @var{M} is the index of the corner starting from 0
  15356. @item lavfi.quirc.N.payload
  15357. the payload of the QR code
  15358. @end table
  15359. @section random
  15360. Flush video frames from internal cache of frames into a random order.
  15361. No frame is discarded.
  15362. Inspired by @ref{frei0r} nervous filter.
  15363. @table @option
  15364. @item frames
  15365. Set size in number of frames of internal cache, in range from @code{2} to
  15366. @code{512}. Default is @code{30}.
  15367. @item seed
  15368. Set seed for random number generator, must be an integer included between
  15369. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15370. less than @code{0}, the filter will try to use a good random seed on a
  15371. best effort basis.
  15372. @end table
  15373. @section readeia608
  15374. Read closed captioning (EIA-608) information from the top lines of a video frame.
  15375. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  15376. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  15377. with EIA-608 data (starting from 0). A description of each metadata value follows:
  15378. @table @option
  15379. @item lavfi.readeia608.X.cc
  15380. The two bytes stored as EIA-608 data (printed in hexadecimal).
  15381. @item lavfi.readeia608.X.line
  15382. The number of the line on which the EIA-608 data was identified and read.
  15383. @end table
  15384. This filter accepts the following options:
  15385. @table @option
  15386. @item scan_min
  15387. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  15388. @item scan_max
  15389. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  15390. @item spw
  15391. Set the ratio of width reserved for sync code detection.
  15392. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  15393. @item chp
  15394. Enable checking the parity bit. In the event of a parity error, the filter will output
  15395. @code{0x00} for that character. Default is false.
  15396. @item lp
  15397. Lowpass lines prior to further processing. Default is enabled.
  15398. @end table
  15399. @subsection Commands
  15400. This filter supports the all above options as @ref{commands}.
  15401. @subsection Examples
  15402. @itemize
  15403. @item
  15404. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  15405. @example
  15406. 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
  15407. @end example
  15408. @end itemize
  15409. @section readvitc
  15410. Read vertical interval timecode (VITC) information from the top lines of a
  15411. video frame.
  15412. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  15413. timecode value, if a valid timecode has been detected. Further metadata key
  15414. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  15415. timecode data has been found or not.
  15416. This filter accepts the following options:
  15417. @table @option
  15418. @item scan_max
  15419. Set the maximum number of lines to scan for VITC data. If the value is set to
  15420. @code{-1} the full video frame is scanned. Default is @code{45}.
  15421. @item thr_b
  15422. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  15423. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  15424. @item thr_w
  15425. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  15426. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  15427. @end table
  15428. @subsection Examples
  15429. @itemize
  15430. @item
  15431. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  15432. draw @code{--:--:--:--} as a placeholder:
  15433. @example
  15434. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  15435. @end example
  15436. @end itemize
  15437. @section remap
  15438. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  15439. Destination pixel at position (X, Y) will be picked from source (x, y) position
  15440. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  15441. value for pixel will be used for destination pixel.
  15442. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  15443. will have Xmap/Ymap video stream dimensions.
  15444. Xmap and Ymap input video streams are 16bit depth, single channel.
  15445. @table @option
  15446. @item format
  15447. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  15448. Default is @code{color}.
  15449. @item fill
  15450. Specify the color of the unmapped pixels. For the syntax of this option,
  15451. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  15452. manual,ffmpeg-utils}. Default color is @code{black}.
  15453. @end table
  15454. @section removegrain
  15455. The removegrain filter is a spatial denoiser for progressive video.
  15456. @table @option
  15457. @item m0
  15458. Set mode for the first plane.
  15459. @item m1
  15460. Set mode for the second plane.
  15461. @item m2
  15462. Set mode for the third plane.
  15463. @item m3
  15464. Set mode for the fourth plane.
  15465. @end table
  15466. Range of mode is from 0 to 24. Description of each mode follows:
  15467. @table @var
  15468. @item 0
  15469. Leave input plane unchanged. Default.
  15470. @item 1
  15471. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  15472. @item 2
  15473. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  15474. @item 3
  15475. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  15476. @item 4
  15477. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  15478. This is equivalent to a median filter.
  15479. @item 5
  15480. Line-sensitive clipping giving the minimal change.
  15481. @item 6
  15482. Line-sensitive clipping, intermediate.
  15483. @item 7
  15484. Line-sensitive clipping, intermediate.
  15485. @item 8
  15486. Line-sensitive clipping, intermediate.
  15487. @item 9
  15488. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  15489. @item 10
  15490. Replaces the target pixel with the closest neighbour.
  15491. @item 11
  15492. [1 2 1] horizontal and vertical kernel blur.
  15493. @item 12
  15494. Same as mode 11.
  15495. @item 13
  15496. Bob mode, interpolates top field from the line where the neighbours
  15497. pixels are the closest.
  15498. @item 14
  15499. Bob mode, interpolates bottom field from the line where the neighbours
  15500. pixels are the closest.
  15501. @item 15
  15502. Bob mode, interpolates top field. Same as 13 but with a more complicated
  15503. interpolation formula.
  15504. @item 16
  15505. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  15506. interpolation formula.
  15507. @item 17
  15508. Clips the pixel with the minimum and maximum of respectively the maximum and
  15509. minimum of each pair of opposite neighbour pixels.
  15510. @item 18
  15511. Line-sensitive clipping using opposite neighbours whose greatest distance from
  15512. the current pixel is minimal.
  15513. @item 19
  15514. Replaces the pixel with the average of its 8 neighbours.
  15515. @item 20
  15516. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  15517. @item 21
  15518. Clips pixels using the averages of opposite neighbour.
  15519. @item 22
  15520. Same as mode 21 but simpler and faster.
  15521. @item 23
  15522. Small edge and halo removal, but reputed useless.
  15523. @item 24
  15524. Similar as 23.
  15525. @end table
  15526. @section removelogo
  15527. Suppress a TV station logo, using an image file to determine which
  15528. pixels comprise the logo. It works by filling in the pixels that
  15529. comprise the logo with neighboring pixels.
  15530. The filter accepts the following options:
  15531. @table @option
  15532. @item filename, f
  15533. Set the filter bitmap file, which can be any image format supported by
  15534. libavformat. The width and height of the image file must match those of the
  15535. video stream being processed.
  15536. @end table
  15537. Pixels in the provided bitmap image with a value of zero are not
  15538. considered part of the logo, non-zero pixels are considered part of
  15539. the logo. If you use white (255) for the logo and black (0) for the
  15540. rest, you will be safe. For making the filter bitmap, it is
  15541. recommended to take a screen capture of a black frame with the logo
  15542. visible, and then using a threshold filter followed by the erode
  15543. filter once or twice.
  15544. If needed, little splotches can be fixed manually. Remember that if
  15545. logo pixels are not covered, the filter quality will be much
  15546. reduced. Marking too many pixels as part of the logo does not hurt as
  15547. much, but it will increase the amount of blurring needed to cover over
  15548. the image and will destroy more information than necessary, and extra
  15549. pixels will slow things down on a large logo.
  15550. @section repeatfields
  15551. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  15552. fields based on its value.
  15553. @section reverse
  15554. Reverse a video clip.
  15555. Warning: This filter requires memory to buffer the entire clip, so trimming
  15556. is suggested.
  15557. @subsection Examples
  15558. @itemize
  15559. @item
  15560. Take the first 5 seconds of a clip, and reverse it.
  15561. @example
  15562. trim=end=5,reverse
  15563. @end example
  15564. @end itemize
  15565. @section rgbashift
  15566. Shift R/G/B/A pixels horizontally and/or vertically.
  15567. The filter accepts the following options:
  15568. @table @option
  15569. @item rh
  15570. Set amount to shift red horizontally.
  15571. @item rv
  15572. Set amount to shift red vertically.
  15573. @item gh
  15574. Set amount to shift green horizontally.
  15575. @item gv
  15576. Set amount to shift green vertically.
  15577. @item bh
  15578. Set amount to shift blue horizontally.
  15579. @item bv
  15580. Set amount to shift blue vertically.
  15581. @item ah
  15582. Set amount to shift alpha horizontally.
  15583. @item av
  15584. Set amount to shift alpha vertically.
  15585. @item edge
  15586. Set edge mode, can be @var{smear}, default, or @var{warp}.
  15587. @end table
  15588. @subsection Commands
  15589. This filter supports the all above options as @ref{commands}.
  15590. @section roberts
  15591. Apply roberts cross operator to input video stream.
  15592. The filter accepts the following option:
  15593. @table @option
  15594. @item planes
  15595. Set which planes will be processed, unprocessed planes will be copied.
  15596. By default value 0xf, all planes will be processed.
  15597. @item scale
  15598. Set value which will be multiplied with filtered result.
  15599. @item delta
  15600. Set value which will be added to filtered result.
  15601. @end table
  15602. @subsection Commands
  15603. This filter supports the all above options as @ref{commands}.
  15604. @section rotate
  15605. Rotate video by an arbitrary angle expressed in radians.
  15606. The filter accepts the following options:
  15607. A description of the optional parameters follows.
  15608. @table @option
  15609. @item angle, a
  15610. Set an expression for the angle by which to rotate the input video
  15611. clockwise, expressed as a number of radians. A negative value will
  15612. result in a counter-clockwise rotation. By default it is set to "0".
  15613. This expression is evaluated for each frame.
  15614. @item out_w, ow
  15615. Set the output width expression, default value is "iw".
  15616. This expression is evaluated just once during configuration.
  15617. @item out_h, oh
  15618. Set the output height expression, default value is "ih".
  15619. This expression is evaluated just once during configuration.
  15620. @item bilinear
  15621. Enable bilinear interpolation if set to 1, a value of 0 disables
  15622. it. Default value is 1.
  15623. @item fillcolor, c
  15624. Set the color used to fill the output area not covered by the rotated
  15625. image. For the general syntax of this option, check the
  15626. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15627. If the special value "none" is selected then no
  15628. background is printed (useful for example if the background is never shown).
  15629. Default value is "black".
  15630. @end table
  15631. The expressions for the angle and the output size can contain the
  15632. following constants and functions:
  15633. @table @option
  15634. @item n
  15635. sequential number of the input frame, starting from 0. It is always NAN
  15636. before the first frame is filtered.
  15637. @item t
  15638. time in seconds of the input frame, it is set to 0 when the filter is
  15639. configured. It is always NAN before the first frame is filtered.
  15640. @item hsub
  15641. @item vsub
  15642. horizontal and vertical chroma subsample values. For example for the
  15643. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15644. @item in_w, iw
  15645. @item in_h, ih
  15646. the input video width and height
  15647. @item out_w, ow
  15648. @item out_h, oh
  15649. the output width and height, that is the size of the padded area as
  15650. specified by the @var{width} and @var{height} expressions
  15651. @item rotw(a)
  15652. @item roth(a)
  15653. the minimal width/height required for completely containing the input
  15654. video rotated by @var{a} radians.
  15655. These are only available when computing the @option{out_w} and
  15656. @option{out_h} expressions.
  15657. @end table
  15658. @subsection Examples
  15659. @itemize
  15660. @item
  15661. Rotate the input by PI/6 radians clockwise:
  15662. @example
  15663. rotate=PI/6
  15664. @end example
  15665. @item
  15666. Rotate the input by PI/6 radians counter-clockwise:
  15667. @example
  15668. rotate=-PI/6
  15669. @end example
  15670. @item
  15671. Rotate the input by 45 degrees clockwise:
  15672. @example
  15673. rotate=45*PI/180
  15674. @end example
  15675. @item
  15676. Apply a constant rotation with period T, starting from an angle of PI/3:
  15677. @example
  15678. rotate=PI/3+2*PI*t/T
  15679. @end example
  15680. @item
  15681. Make the input video rotation oscillating with a period of T
  15682. seconds and an amplitude of A radians:
  15683. @example
  15684. rotate=A*sin(2*PI/T*t)
  15685. @end example
  15686. @item
  15687. Rotate the video, output size is chosen so that the whole rotating
  15688. input video is always completely contained in the output:
  15689. @example
  15690. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  15691. @end example
  15692. @item
  15693. Rotate the video, reduce the output size so that no background is ever
  15694. shown:
  15695. @example
  15696. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  15697. @end example
  15698. @end itemize
  15699. @subsection Commands
  15700. The filter supports the following commands:
  15701. @table @option
  15702. @item a, angle
  15703. Set the angle expression.
  15704. The command accepts the same syntax of the corresponding option.
  15705. If the specified expression is not valid, it is kept at its current
  15706. value.
  15707. @end table
  15708. @section sab
  15709. Apply Shape Adaptive Blur.
  15710. The filter accepts the following options:
  15711. @table @option
  15712. @item luma_radius, lr
  15713. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  15714. value is 1.0. A greater value will result in a more blurred image, and
  15715. in slower processing.
  15716. @item luma_pre_filter_radius, lpfr
  15717. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  15718. value is 1.0.
  15719. @item luma_strength, ls
  15720. Set luma maximum difference between pixels to still be considered, must
  15721. be a value in the 0.1-100.0 range, default value is 1.0.
  15722. @item chroma_radius, cr
  15723. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  15724. greater value will result in a more blurred image, and in slower
  15725. processing.
  15726. @item chroma_pre_filter_radius, cpfr
  15727. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  15728. @item chroma_strength, cs
  15729. Set chroma maximum difference between pixels to still be considered,
  15730. must be a value in the -0.9-100.0 range.
  15731. @end table
  15732. Each chroma option value, if not explicitly specified, is set to the
  15733. corresponding luma option value.
  15734. @anchor{scale}
  15735. @section scale
  15736. Scale (resize) the input video, using the libswscale library.
  15737. The scale filter forces the output display aspect ratio to be the same
  15738. of the input, by changing the output sample aspect ratio.
  15739. If the input image format is different from the format requested by
  15740. the next filter, the scale filter will convert the input to the
  15741. requested format.
  15742. @subsection Options
  15743. The filter accepts the following options, any of the options supported
  15744. by the libswscale scaler, as well as any of the @ref{framesync} options.
  15745. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  15746. the complete list of scaler options.
  15747. @table @option
  15748. @item width, w
  15749. @item height, h
  15750. Set the output video dimension expression. Default value is the input
  15751. dimension.
  15752. If the @var{width} or @var{w} value is 0, the input width is used for
  15753. the output. If the @var{height} or @var{h} value is 0, the input height
  15754. is used for the output.
  15755. If one and only one of the values is -n with n >= 1, the scale filter
  15756. will use a value that maintains the aspect ratio of the input image,
  15757. calculated from the other specified dimension. After that it will,
  15758. however, make sure that the calculated dimension is divisible by n and
  15759. adjust the value if necessary.
  15760. If both values are -n with n >= 1, the behavior will be identical to
  15761. both values being set to 0 as previously detailed.
  15762. See below for the list of accepted constants for use in the dimension
  15763. expression.
  15764. @item eval
  15765. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15766. @table @samp
  15767. @item init
  15768. Only evaluate expressions once during the filter initialization or when a command is processed.
  15769. @item frame
  15770. Evaluate expressions for each incoming frame.
  15771. @end table
  15772. Default value is @samp{init}.
  15773. @item interl
  15774. Set the interlacing mode. It accepts the following values:
  15775. @table @samp
  15776. @item 1
  15777. Force interlaced aware scaling.
  15778. @item 0
  15779. Do not apply interlaced scaling.
  15780. @item -1
  15781. Select interlaced aware scaling depending on whether the source frames
  15782. are flagged as interlaced or not.
  15783. @end table
  15784. Default value is @samp{0}.
  15785. @item flags
  15786. Set libswscale scaling flags. See
  15787. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15788. complete list of values. If not explicitly specified the filter applies
  15789. the default flags.
  15790. @item param0, param1
  15791. Set libswscale input parameters for scaling algorithms that need them. See
  15792. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15793. complete documentation. If not explicitly specified the filter applies
  15794. empty parameters.
  15795. @item intent
  15796. Set the ICC rendering intent to use when transforming between different color
  15797. spaces. It accepts the following values:
  15798. @table @samp
  15799. @item perceptual
  15800. Use a perceptually guided tone and gamut mapping curve. The exact details of
  15801. the mapping used may change at any time and should not be relied on as stable.
  15802. This intent is recommended for final viewing of image/video content in typical
  15803. viewing settings.
  15804. @item relative_colorimetric
  15805. Statically clip out-of-gamut colors using a colorimetric clipping curve which
  15806. attempts to find the colorimetrically least dissimilar in-gamut color. This
  15807. intent performs white point adaptation and black point adaptation. This is
  15808. the default. This intent is recommended wherever faithful color reproduction
  15809. is of the utmost importance, even at the cost of clipping.
  15810. @item absolute_colorimetric
  15811. Hard clip out-of-gamut colors with no attempt at white or black point
  15812. reproduction. This intent will reproduce in-gamut colors 1:1 on the output
  15813. display as they would appear on the reference display, assuming the output
  15814. display is appropriately calibrated.
  15815. @item saturation
  15816. Performs saturation mapping - that is, stretches the input color volume
  15817. directly onto the output color volume, in non-linear fashion that preserves the
  15818. original signal appearance as much as possible. This intent is recommended for
  15819. signal content evaluation, as it will not lead to any clipping. It is roughly
  15820. analogous to not performing any color mapping, although it still takes into
  15821. account the mastering display primaries and any differences in encoding TRC.
  15822. @end table
  15823. @item size, s
  15824. Set the video size. For the syntax of this option, check the
  15825. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15826. @item in_color_matrix
  15827. @item out_color_matrix
  15828. Set in/output YCbCr color space type.
  15829. This allows the autodetected value to be overridden as well as allows forcing
  15830. a specific value used for the output and encoder.
  15831. If not specified, the color space type depends on the pixel format.
  15832. Possible values:
  15833. @table @samp
  15834. @item auto
  15835. Choose automatically.
  15836. @item bt709
  15837. Format conforming to International Telecommunication Union (ITU)
  15838. Recommendation BT.709.
  15839. @item fcc
  15840. Set color space conforming to the United States Federal Communications
  15841. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  15842. @item bt601
  15843. @item bt470
  15844. @item smpte170m
  15845. Set color space conforming to:
  15846. @itemize
  15847. @item
  15848. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  15849. @item
  15850. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  15851. @item
  15852. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  15853. @end itemize
  15854. @item smpte240m
  15855. Set color space conforming to SMPTE ST 240:1999.
  15856. @item bt2020
  15857. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  15858. @end table
  15859. @item in_range
  15860. @item out_range
  15861. Set in/output YCbCr sample range.
  15862. This allows the autodetected value to be overridden as well as allows forcing
  15863. a specific value used for the output and encoder. If not specified, the
  15864. range depends on the pixel format. Possible values:
  15865. @table @samp
  15866. @item auto/unknown
  15867. Choose automatically.
  15868. @item jpeg/full/pc
  15869. Set full range (0-255 in case of 8-bit luma).
  15870. @item mpeg/limited/tv
  15871. Set "MPEG" range (16-235 in case of 8-bit luma).
  15872. @end table
  15873. @item in_chroma_loc
  15874. @item out_chroma_loc
  15875. Set in/output chroma sample location. If not specified, center-sited chroma
  15876. is used by default. Possible values:
  15877. @table @samp
  15878. @item auto, unknown
  15879. @item left
  15880. @item center
  15881. @item topleft
  15882. @item top
  15883. @item bottomleft
  15884. @item bottom
  15885. @end table
  15886. @item in_primaries
  15887. @item out_primaries
  15888. Set in/output RGB primaries.
  15889. This allows the autodetected value to be overridden as well as allows forcing
  15890. a specific value used for the output and encoder. Possible values:
  15891. @table @samp
  15892. @item auto
  15893. Choose automatically. This is the default.
  15894. @item bt709
  15895. @item bt470m
  15896. @item bt470bg
  15897. @item smpte170m
  15898. @item smpte240m
  15899. @item film
  15900. @item bt2020
  15901. @item smpte428
  15902. @item smpte431
  15903. @item smpte432
  15904. @item jedec-p22
  15905. @item ebu3213
  15906. @end table
  15907. @item in_transfer
  15908. @item out_transfer
  15909. Set in/output transfer response curve (TRC).
  15910. This allows the autodetected value to be overridden as well as allows forcing
  15911. a specific value used for the output and encoder. Possible values:
  15912. @table @samp
  15913. @item auto
  15914. Choose automatically. This is the default.
  15915. @item bt709
  15916. @item bt470m
  15917. @item gamma22
  15918. @item bt470bg
  15919. @item gamma28
  15920. @item smpte170m
  15921. @item smpte240m
  15922. @item linear
  15923. @item iec61966-2-1
  15924. @item srgb
  15925. @item iec61966-2-4
  15926. @item xvycc
  15927. @item bt1361e
  15928. @item bt2020-10
  15929. @item bt2020-12
  15930. @item smpte2084
  15931. @item smpte428
  15932. @item arib-std-b67
  15933. @end table
  15934. @item force_original_aspect_ratio
  15935. Enable decreasing or increasing output video width or height if necessary to
  15936. keep the original aspect ratio. Possible values:
  15937. @table @samp
  15938. @item disable
  15939. Scale the video as specified and disable this feature.
  15940. @item decrease
  15941. The output video dimensions will automatically be decreased if needed.
  15942. @item increase
  15943. The output video dimensions will automatically be increased if needed.
  15944. @end table
  15945. One useful instance of this option is that when you know a specific device's
  15946. maximum allowed resolution, you can use this to limit the output video to
  15947. that, while retaining the aspect ratio. For example, device A allows
  15948. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15949. decrease) and specifying 1280x720 to the command line makes the output
  15950. 1280x533.
  15951. Please note that this is a different thing than specifying -1 for @option{w}
  15952. or @option{h}, you still need to specify the output resolution for this option
  15953. to work.
  15954. @item force_divisible_by
  15955. Ensures that both the output dimensions, width and height, are divisible by the
  15956. given integer when used together with @option{force_original_aspect_ratio}. This
  15957. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15958. This option respects the value set for @option{force_original_aspect_ratio},
  15959. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15960. may be slightly modified.
  15961. This option can be handy if you need to have a video fit within or exceed
  15962. a defined resolution using @option{force_original_aspect_ratio} but also have
  15963. encoder restrictions on width or height divisibility.
  15964. @item reset_sar
  15965. Enabling this option leads to the output SAR being reset to 1.
  15966. Additionally, if the user requests proportional scaling either
  15967. through the width or height expressions, e.g. @code{w=-4:h=360} or @code{w=iw/2:h=-1}
  15968. or by enabling @code{force_original_aspect_ratio}, then the input DAR is taken into
  15969. account and the output is scaled to produce square pixels.
  15970. Default is false.
  15971. @end table
  15972. The values of the @option{w} and @option{h} options are expressions
  15973. containing the following constants:
  15974. @table @var
  15975. @item in_w
  15976. @item in_h
  15977. The input width and height
  15978. @item iw
  15979. @item ih
  15980. These are the same as @var{in_w} and @var{in_h}.
  15981. @item out_w
  15982. @item out_h
  15983. The output (scaled) width and height
  15984. @item ow
  15985. @item oh
  15986. These are the same as @var{out_w} and @var{out_h}
  15987. @item a
  15988. The same as @var{iw} / @var{ih}
  15989. @item sar
  15990. input sample aspect ratio
  15991. @item dar
  15992. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15993. @item hsub
  15994. @item vsub
  15995. horizontal and vertical input chroma subsample values. For example for the
  15996. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15997. @item ohsub
  15998. @item ovsub
  15999. horizontal and vertical output chroma subsample values. For example for the
  16000. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16001. @item n
  16002. The (sequential) number of the input frame, starting from 0.
  16003. Only available with @code{eval=frame}.
  16004. @item t
  16005. The presentation timestamp of the input frame, expressed as a number of
  16006. seconds. Only available with @code{eval=frame}.
  16007. @item pos
  16008. The position (byte offset) of the frame in the input stream, or NaN if
  16009. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16010. Only available with @code{eval=frame}.
  16011. Deprecated, do not use.
  16012. @item ref_w, rw
  16013. @item ref_h, rh
  16014. @item ref_a
  16015. @item ref_dar, rdar
  16016. @item ref_n
  16017. @item ref_t
  16018. @item ref_pos
  16019. Eqvuialent to the above, but for a second reference input. If any of these
  16020. variables are present, this filter accepts two inputs.
  16021. @end table
  16022. @subsection Examples
  16023. @itemize
  16024. @item
  16025. Scale the input video to a size of 200x100
  16026. @example
  16027. scale=w=200:h=100
  16028. @end example
  16029. This is equivalent to:
  16030. @example
  16031. scale=200:100
  16032. @end example
  16033. or:
  16034. @example
  16035. scale=200x100
  16036. @end example
  16037. @item
  16038. Specify a size abbreviation for the output size:
  16039. @example
  16040. scale=qcif
  16041. @end example
  16042. which can also be written as:
  16043. @example
  16044. scale=size=qcif
  16045. @end example
  16046. @item
  16047. Scale the input to 2x:
  16048. @example
  16049. scale=w=2*iw:h=2*ih
  16050. @end example
  16051. @item
  16052. The above is the same as:
  16053. @example
  16054. scale=2*in_w:2*in_h
  16055. @end example
  16056. @item
  16057. Scale the input to 2x with forced interlaced scaling:
  16058. @example
  16059. scale=2*iw:2*ih:interl=1
  16060. @end example
  16061. @item
  16062. Scale the input to half size:
  16063. @example
  16064. scale=w=iw/2:h=ih/2
  16065. @end example
  16066. @item
  16067. Increase the width, and set the height to the same size:
  16068. @example
  16069. scale=3/2*iw:ow
  16070. @end example
  16071. @item
  16072. Seek Greek harmony:
  16073. @example
  16074. scale=iw:1/PHI*iw
  16075. scale=ih*PHI:ih
  16076. @end example
  16077. @item
  16078. Increase the height, and set the width to 3/2 of the height:
  16079. @example
  16080. scale=w=3/2*oh:h=3/5*ih
  16081. @end example
  16082. @item
  16083. Increase the size, making the size a multiple of the chroma
  16084. subsample values:
  16085. @example
  16086. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  16087. @end example
  16088. @item
  16089. Increase the width to a maximum of 500 pixels,
  16090. keeping the same aspect ratio as the input:
  16091. @example
  16092. scale=w='min(500\, iw*3/2):h=-1'
  16093. @end example
  16094. @item
  16095. Make pixels square by combining scale and setsar:
  16096. @example
  16097. scale='trunc(ih*dar):ih',setsar=1/1
  16098. @end example
  16099. @item
  16100. Make pixels square using reset_sar,
  16101. making sure the resulting resolution is even (required by some codecs):
  16102. @example
  16103. scale='-2:ih-mod(ih,2):reset_sar=1'
  16104. @end example
  16105. @item
  16106. Scale to target exactly, however reset SAR to 1:
  16107. @example
  16108. scale='400:300:reset_sar=1'
  16109. @end example
  16110. @item
  16111. Scale to even dimensions that fit within 400x300, preserving input SAR:
  16112. @example
  16113. scale='400:300:force_original_aspect_ratio=decrease:force_divisible_by=2'
  16114. @end example
  16115. @item
  16116. Scale to produce square pixels with even dimensions that fit within 400x300:
  16117. @example
  16118. scale='400:300:force_original_aspect_ratio=decrease:force_divisible_by=2:reset_sar=1'
  16119. @end example
  16120. @item
  16121. Scale a subtitle stream (sub) to match the main video (main) in size before
  16122. overlaying. ("scale2ref")
  16123. @example
  16124. '[main]split[a][b]; [ref][a]scale=rw:rh[c]; [b][c]overlay'
  16125. @end example
  16126. @item
  16127. Scale a logo to 1/10th the height of a video, while preserving its display
  16128. aspect ratio.
  16129. @example
  16130. [logo-in][video-in]scale=w=oh*dar:h=rh/10[logo-out]
  16131. @end example
  16132. @end itemize
  16133. @subsection Commands
  16134. This filter supports the following commands:
  16135. @table @option
  16136. @item width, w
  16137. @item height, h
  16138. Set the output video dimension expression.
  16139. The command accepts the same syntax of the corresponding option.
  16140. If the specified expression is not valid, it is kept at its current
  16141. value.
  16142. @end table
  16143. @section scale_vt
  16144. Scale and convert the color parameters using VTPixelTransferSession.
  16145. The filter accepts the following options:
  16146. @table @option
  16147. @item w
  16148. @item h
  16149. Set the output video dimension expression. Default value is the input dimension.
  16150. @item color_matrix
  16151. Set the output colorspace matrix.
  16152. @item color_primaries
  16153. Set the output color primaries.
  16154. @item color_transfer
  16155. Set the output transfer characteristics.
  16156. @end table
  16157. @section scharr
  16158. Apply scharr operator to input video stream.
  16159. The filter accepts the following option:
  16160. @table @option
  16161. @item planes
  16162. Set which planes will be processed, unprocessed planes will be copied.
  16163. By default value 0xf, all planes will be processed.
  16164. @item scale
  16165. Set value which will be multiplied with filtered result.
  16166. @item delta
  16167. Set value which will be added to filtered result.
  16168. @end table
  16169. @subsection Commands
  16170. This filter supports the all above options as @ref{commands}.
  16171. @section scroll
  16172. Scroll input video horizontally and/or vertically by constant speed.
  16173. The filter accepts the following options:
  16174. @table @option
  16175. @item horizontal, h
  16176. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16177. Negative values changes scrolling direction.
  16178. @item vertical, v
  16179. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16180. Negative values changes scrolling direction.
  16181. @item hpos
  16182. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  16183. @item vpos
  16184. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  16185. @end table
  16186. @subsection Commands
  16187. This filter supports the following @ref{commands}:
  16188. @table @option
  16189. @item horizontal, h
  16190. Set the horizontal scrolling speed.
  16191. @item vertical, v
  16192. Set the vertical scrolling speed.
  16193. @end table
  16194. @anchor{scdet}
  16195. @section scdet
  16196. Detect video scene change.
  16197. This filter sets frame metadata with mafd between frame, the scene score, and
  16198. forward the frame to the next filter, so they can use these metadata to detect
  16199. scene change or others.
  16200. In addition, this filter logs a message and sets frame metadata when it detects
  16201. a scene change by @option{threshold}.
  16202. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  16203. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  16204. to detect scene change.
  16205. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  16206. detect scene change with @option{threshold}.
  16207. The filter accepts the following options:
  16208. @table @option
  16209. @item threshold, t
  16210. Set the scene change detection threshold as a percentage of maximum change. Good
  16211. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  16212. @code{[0., 100.]}.
  16213. Default value is @code{10.}.
  16214. @item sc_pass, s
  16215. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  16216. You can enable it if you want to get snapshot of scene change frames only.
  16217. @end table
  16218. @anchor{selectivecolor}
  16219. @section selectivecolor
  16220. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  16221. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  16222. by the "purity" of the color (that is, how saturated it already is).
  16223. This filter is similar to the Adobe Photoshop Selective Color tool.
  16224. The filter accepts the following options:
  16225. @table @option
  16226. @item correction_method
  16227. Select color correction method.
  16228. Available values are:
  16229. @table @samp
  16230. @item absolute
  16231. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  16232. component value).
  16233. @item relative
  16234. Specified adjustments are relative to the original component value.
  16235. @end table
  16236. Default is @code{absolute}.
  16237. @item reds
  16238. Adjustments for red pixels (pixels where the red component is the maximum)
  16239. @item yellows
  16240. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  16241. @item greens
  16242. Adjustments for green pixels (pixels where the green component is the maximum)
  16243. @item cyans
  16244. Adjustments for cyan pixels (pixels where the red component is the minimum)
  16245. @item blues
  16246. Adjustments for blue pixels (pixels where the blue component is the maximum)
  16247. @item magentas
  16248. Adjustments for magenta pixels (pixels where the green component is the minimum)
  16249. @item whites
  16250. Adjustments for white pixels (pixels where all components are greater than 128)
  16251. @item neutrals
  16252. Adjustments for all pixels except pure black and pure white
  16253. @item blacks
  16254. Adjustments for black pixels (pixels where all components are lesser than 128)
  16255. @item psfile
  16256. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  16257. @end table
  16258. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  16259. 4 space separated floating point adjustment values in the [-1,1] range,
  16260. respectively to adjust the amount of cyan, magenta, yellow and black for the
  16261. pixels of its range.
  16262. @subsection Examples
  16263. @itemize
  16264. @item
  16265. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  16266. increase magenta by 27% in blue areas:
  16267. @example
  16268. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  16269. @end example
  16270. @item
  16271. Use a Photoshop selective color preset:
  16272. @example
  16273. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  16274. @end example
  16275. @end itemize
  16276. @anchor{separatefields}
  16277. @section separatefields
  16278. The @code{separatefields} takes a frame-based video input and splits
  16279. each frame into its components fields, producing a new half height clip
  16280. with twice the frame rate and twice the frame count.
  16281. This filter use field-dominance information in frame to decide which
  16282. of each pair of fields to place first in the output.
  16283. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  16284. @section setdar, setsar
  16285. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  16286. output video.
  16287. This is done by changing the specified Sample (aka Pixel) Aspect
  16288. Ratio, according to the following equation:
  16289. @example
  16290. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  16291. @end example
  16292. Keep in mind that the @code{setdar} filter does not modify the pixel
  16293. dimensions of the video frame. Also, the display aspect ratio set by
  16294. this filter may be changed by later filters in the filterchain,
  16295. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  16296. applied.
  16297. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  16298. the filter output video.
  16299. Note that as a consequence of the application of this filter, the
  16300. output display aspect ratio will change according to the equation
  16301. above.
  16302. Keep in mind that the sample aspect ratio set by the @code{setsar}
  16303. filter may be changed by later filters in the filterchain, e.g. if
  16304. another "setsar" or a "setdar" filter is applied.
  16305. It accepts the following parameters:
  16306. @table @option
  16307. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  16308. Set the aspect ratio used by the filter.
  16309. The parameter can be a floating point number string, or an expression. If the
  16310. parameter is not specified, the value "0" is assumed, meaning that the same
  16311. input value is used.
  16312. @item max
  16313. Set the maximum integer value to use for expressing numerator and
  16314. denominator when reducing the expressed aspect ratio to a rational.
  16315. Default value is @code{100}.
  16316. @end table
  16317. The parameter @var{sar} is an expression containing the following constants:
  16318. @table @option
  16319. @item w, h
  16320. The input width and height.
  16321. @item a
  16322. Same as @var{w} / @var{h}.
  16323. @item sar
  16324. The input sample aspect ratio.
  16325. @item dar
  16326. The input display aspect ratio. It is the same as
  16327. (@var{w} / @var{h}) * @var{sar}.
  16328. @item hsub, vsub
  16329. Horizontal and vertical chroma subsample values. For example, for the
  16330. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16331. @end table
  16332. @subsection Examples
  16333. @itemize
  16334. @item
  16335. To change the display aspect ratio to 16:9, specify one of the following:
  16336. @example
  16337. setdar=dar=1.77777
  16338. setdar=dar=16/9
  16339. @end example
  16340. @item
  16341. To change the sample aspect ratio to 10:11, specify:
  16342. @example
  16343. setsar=sar=10/11
  16344. @end example
  16345. @item
  16346. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  16347. 1000 in the aspect ratio reduction, use the command:
  16348. @example
  16349. setdar=ratio=16/9:max=1000
  16350. @end example
  16351. @end itemize
  16352. @anchor{setfield}
  16353. @section setfield
  16354. Force field for the output video frame.
  16355. The @code{setfield} filter marks the interlace type field for the
  16356. output frames. It does not change the input frame, but only sets the
  16357. corresponding property, which affects how the frame is treated by
  16358. following filters (e.g. @code{fieldorder} or @code{yadif}).
  16359. The filter accepts the following options:
  16360. @table @option
  16361. @item mode
  16362. Available values are:
  16363. @table @samp
  16364. @item auto
  16365. Keep the same field property.
  16366. @item bff
  16367. Mark the frame as bottom-field-first.
  16368. @item tff
  16369. Mark the frame as top-field-first.
  16370. @item prog
  16371. Mark the frame as progressive.
  16372. @end table
  16373. @end table
  16374. @anchor{setparams}
  16375. @section setparams
  16376. Force frame parameter for the output video frame.
  16377. The @code{setparams} filter marks interlace and color range for the
  16378. output frames. It does not change the input frame, but only sets the
  16379. corresponding property, which affects how the frame is treated by
  16380. filters/encoders.
  16381. @table @option
  16382. @item field_mode
  16383. Available values are:
  16384. @table @samp
  16385. @item auto
  16386. Keep the same field property (default).
  16387. @item bff
  16388. Mark the frame as bottom-field-first.
  16389. @item tff
  16390. Mark the frame as top-field-first.
  16391. @item prog
  16392. Mark the frame as progressive.
  16393. @end table
  16394. @item range
  16395. Available values are:
  16396. @table @samp
  16397. @item auto
  16398. Keep the same color range property (default).
  16399. @item unspecified, unknown
  16400. Mark the frame as unspecified color range.
  16401. @item limited, tv, mpeg
  16402. Mark the frame as limited range.
  16403. @item full, pc, jpeg
  16404. Mark the frame as full range.
  16405. @end table
  16406. @item color_primaries
  16407. Set the color primaries.
  16408. Available values are:
  16409. @table @samp
  16410. @item auto
  16411. Keep the same color primaries property (default).
  16412. @item bt709
  16413. @item unknown
  16414. @item bt470m
  16415. @item bt470bg
  16416. @item smpte170m
  16417. @item smpte240m
  16418. @item film
  16419. @item bt2020
  16420. @item smpte428
  16421. @item smpte431
  16422. @item smpte432
  16423. @item jedec-p22
  16424. @end table
  16425. @item color_trc
  16426. Set the color transfer.
  16427. Available values are:
  16428. @table @samp
  16429. @item auto
  16430. Keep the same color trc property (default).
  16431. @item bt709
  16432. @item unknown
  16433. @item bt470m
  16434. @item bt470bg
  16435. @item smpte170m
  16436. @item smpte240m
  16437. @item linear
  16438. @item log100
  16439. @item log316
  16440. @item iec61966-2-4
  16441. @item bt1361e
  16442. @item iec61966-2-1
  16443. @item bt2020-10
  16444. @item bt2020-12
  16445. @item smpte2084
  16446. @item smpte428
  16447. @item arib-std-b67
  16448. @end table
  16449. @item colorspace
  16450. Set the colorspace.
  16451. Available values are:
  16452. @table @samp
  16453. @item auto
  16454. Keep the same colorspace property (default).
  16455. @item gbr
  16456. @item bt709
  16457. @item unknown
  16458. @item fcc
  16459. @item bt470bg
  16460. @item smpte170m
  16461. @item smpte240m
  16462. @item ycgco
  16463. @item bt2020nc
  16464. @item bt2020c
  16465. @item smpte2085
  16466. @item chroma-derived-nc
  16467. @item chroma-derived-c
  16468. @item ictcp
  16469. @end table
  16470. @item chroma_location
  16471. Set the chroma sample location.
  16472. Available values are:
  16473. @table @samp
  16474. @item auto
  16475. Keep the same chroma location (default).
  16476. @item unspecified, unknown
  16477. @item left
  16478. @item center
  16479. @item topleft
  16480. @item top
  16481. @item bottomleft
  16482. @item bottom
  16483. @end table
  16484. @end table
  16485. @section shear
  16486. Apply shear transform to input video.
  16487. This filter supports the following options:
  16488. @table @option
  16489. @item shx
  16490. Shear factor in X-direction. Default value is 0.
  16491. Allowed range is from -2 to 2.
  16492. @item shy
  16493. Shear factor in Y-direction. Default value is 0.
  16494. Allowed range is from -2 to 2.
  16495. @item fillcolor, c
  16496. Set the color used to fill the output area not covered by the transformed
  16497. video. For the general syntax of this option, check the
  16498. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16499. If the special value "none" is selected then no
  16500. background is printed (useful for example if the background is never shown).
  16501. Default value is "black".
  16502. @item interp
  16503. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  16504. @end table
  16505. @subsection Commands
  16506. This filter supports the all above options as @ref{commands}.
  16507. @section showinfo
  16508. Show a line containing various information for each input video frame.
  16509. The input video is not modified.
  16510. This filter supports the following options:
  16511. @table @option
  16512. @item checksum
  16513. Calculate checksums of each plane. By default enabled.
  16514. @item udu_sei_as_ascii
  16515. Try to print user data unregistered SEI as ascii character when possible,
  16516. in hex format otherwise.
  16517. @end table
  16518. The shown line contains a sequence of key/value pairs of the form
  16519. @var{key}:@var{value}.
  16520. The following values are shown in the output:
  16521. @table @option
  16522. @item n
  16523. The (sequential) number of the input frame, starting from 0.
  16524. @item pts
  16525. The Presentation TimeStamp of the input frame, expressed as a number of
  16526. time base units. The time base unit depends on the filter input pad.
  16527. @item pts_time
  16528. The Presentation TimeStamp of the input frame, expressed as a number of
  16529. seconds.
  16530. @item fmt
  16531. The pixel format name.
  16532. @item sar
  16533. The sample aspect ratio of the input frame, expressed in the form
  16534. @var{num}/@var{den}.
  16535. @item s
  16536. The size of the input frame. For the syntax of this option, check the
  16537. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16538. @item i
  16539. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  16540. for bottom field first).
  16541. @item iskey
  16542. This is 1 if the frame is a key frame, 0 otherwise.
  16543. @item type
  16544. The picture type of the input frame ("I" for an I-frame, "P" for a
  16545. P-frame, "B" for a B-frame, or "?" for an unknown type).
  16546. Also refer to the documentation of the @code{AVPictureType} enum and of
  16547. the @code{av_get_picture_type_char} function defined in
  16548. @file{libavutil/avutil.h}.
  16549. @item checksum
  16550. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  16551. @item plane_checksum
  16552. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  16553. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  16554. @item mean
  16555. The mean value of pixels in each plane of the input frame, expressed in the form
  16556. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  16557. @item stdev
  16558. The standard deviation of pixel values in each plane of the input frame, expressed
  16559. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  16560. @end table
  16561. @section showpalette
  16562. Displays the 256 colors palette of each frame. This filter is only relevant for
  16563. @var{pal8} pixel format frames.
  16564. It accepts the following option:
  16565. @table @option
  16566. @item s
  16567. Set the size of the box used to represent one palette color entry. Default is
  16568. @code{30} (for a @code{30x30} pixel box).
  16569. @end table
  16570. @section shuffleframes
  16571. Reorder and/or duplicate and/or drop video frames.
  16572. It accepts the following parameters:
  16573. @table @option
  16574. @item mapping
  16575. Set the destination indexes of input frames.
  16576. This is space or '|' separated list of indexes that maps input frames to output
  16577. frames. Number of indexes also sets maximal value that each index may have.
  16578. '-1' index have special meaning and that is to drop frame.
  16579. @end table
  16580. The first frame has the index 0. The default is to keep the input unchanged.
  16581. @subsection Examples
  16582. @itemize
  16583. @item
  16584. Swap second and third frame of every three frames of the input:
  16585. @example
  16586. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  16587. @end example
  16588. @item
  16589. Swap 10th and 1st frame of every ten frames of the input:
  16590. @example
  16591. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  16592. @end example
  16593. @end itemize
  16594. @section shufflepixels
  16595. Reorder pixels in video frames.
  16596. This filter accepts the following options:
  16597. @table @option
  16598. @item direction, d
  16599. Set shuffle direction. Can be forward or inverse direction.
  16600. Default direction is forward.
  16601. @item mode, m
  16602. Set shuffle mode. Can be horizontal, vertical or block mode.
  16603. @item width, w
  16604. @item height, h
  16605. Set shuffle block_size. In case of horizontal shuffle mode only width
  16606. part of size is used, and in case of vertical shuffle mode only height
  16607. part of size is used.
  16608. @item seed, s
  16609. Set random seed used with shuffling pixels. Mainly useful to set to be able
  16610. to reverse filtering process to get original input.
  16611. For example, to reverse forward shuffle you need to use same parameters
  16612. and exact same seed and to set direction to inverse.
  16613. @end table
  16614. @section shuffleplanes
  16615. Reorder and/or duplicate video planes.
  16616. It accepts the following parameters:
  16617. @table @option
  16618. @item map0
  16619. The index of the input plane to be used as the first output plane.
  16620. @item map1
  16621. The index of the input plane to be used as the second output plane.
  16622. @item map2
  16623. The index of the input plane to be used as the third output plane.
  16624. @item map3
  16625. The index of the input plane to be used as the fourth output plane.
  16626. @end table
  16627. The first plane has the index 0. The default is to keep the input unchanged.
  16628. @subsection Examples
  16629. @itemize
  16630. @item
  16631. Swap the second and third planes of the input:
  16632. @example
  16633. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  16634. @end example
  16635. @end itemize
  16636. @anchor{signalstats}
  16637. @section signalstats
  16638. Evaluate various visual metrics that assist in determining issues associated
  16639. with the digitization of analog video media.
  16640. By default the filter will log these metadata values:
  16641. @table @option
  16642. @item YMIN
  16643. Display the minimal Y value contained within the input frame. Expressed in
  16644. range of [0-255].
  16645. @item YLOW
  16646. Display the Y value at the 10% percentile within the input frame. Expressed in
  16647. range of [0-255].
  16648. @item YAVG
  16649. Display the average Y value within the input frame. Expressed in range of
  16650. [0-255].
  16651. @item YHIGH
  16652. Display the Y value at the 90% percentile within the input frame. Expressed in
  16653. range of [0-255].
  16654. @item YMAX
  16655. Display the maximum Y value contained within the input frame. Expressed in
  16656. range of [0-255].
  16657. @item UMIN
  16658. Display the minimal U value contained within the input frame. Expressed in
  16659. range of [0-255].
  16660. @item ULOW
  16661. Display the U value at the 10% percentile within the input frame. Expressed in
  16662. range of [0-255].
  16663. @item UAVG
  16664. Display the average U value within the input frame. Expressed in range of
  16665. [0-255].
  16666. @item UHIGH
  16667. Display the U value at the 90% percentile within the input frame. Expressed in
  16668. range of [0-255].
  16669. @item UMAX
  16670. Display the maximum U value contained within the input frame. Expressed in
  16671. range of [0-255].
  16672. @item VMIN
  16673. Display the minimal V value contained within the input frame. Expressed in
  16674. range of [0-255].
  16675. @item VLOW
  16676. Display the V value at the 10% percentile within the input frame. Expressed in
  16677. range of [0-255].
  16678. @item VAVG
  16679. Display the average V value within the input frame. Expressed in range of
  16680. [0-255].
  16681. @item VHIGH
  16682. Display the V value at the 90% percentile within the input frame. Expressed in
  16683. range of [0-255].
  16684. @item VMAX
  16685. Display the maximum V value contained within the input frame. Expressed in
  16686. range of [0-255].
  16687. @item SATMIN
  16688. Display the minimal saturation value contained within the input frame.
  16689. Expressed in range of [0-~181.02].
  16690. @item SATLOW
  16691. Display the saturation value at the 10% percentile within the input frame.
  16692. Expressed in range of [0-~181.02].
  16693. @item SATAVG
  16694. Display the average saturation value within the input frame. Expressed in range
  16695. of [0-~181.02].
  16696. @item SATHIGH
  16697. Display the saturation value at the 90% percentile within the input frame.
  16698. Expressed in range of [0-~181.02].
  16699. @item SATMAX
  16700. Display the maximum saturation value contained within the input frame.
  16701. Expressed in range of [0-~181.02].
  16702. @item HUEMED
  16703. Display the median value for hue within the input frame. Expressed in range of
  16704. [0-360].
  16705. @item HUEAVG
  16706. Display the average value for hue within the input frame. Expressed in range of
  16707. [0-360].
  16708. @item YDIF
  16709. Display the average of sample value difference between all values of the Y
  16710. plane in the current frame and corresponding values of the previous input frame.
  16711. Expressed in range of [0-255].
  16712. @item UDIF
  16713. Display the average of sample value difference between all values of the U
  16714. plane in the current frame and corresponding values of the previous input frame.
  16715. Expressed in range of [0-255].
  16716. @item VDIF
  16717. Display the average of sample value difference between all values of the V
  16718. plane in the current frame and corresponding values of the previous input frame.
  16719. Expressed in range of [0-255].
  16720. @item YBITDEPTH
  16721. Display bit depth of Y plane in current frame.
  16722. Expressed in range of [0-16].
  16723. @item UBITDEPTH
  16724. Display bit depth of U plane in current frame.
  16725. Expressed in range of [0-16].
  16726. @item VBITDEPTH
  16727. Display bit depth of V plane in current frame.
  16728. Expressed in range of [0-16].
  16729. @end table
  16730. The filter accepts the following options:
  16731. @table @option
  16732. @item stat
  16733. @item out
  16734. @option{stat} specify an additional form of image analysis.
  16735. @option{out} output video with the specified type of pixel highlighted.
  16736. Both options accept the following values:
  16737. @table @samp
  16738. @item tout
  16739. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  16740. unlike the neighboring pixels of the same field. Examples of temporal outliers
  16741. include the results of video dropouts, head clogs, or tape tracking issues.
  16742. @item vrep
  16743. Identify @var{vertical line repetition}. Vertical line repetition includes
  16744. similar rows of pixels within a frame. In born-digital video vertical line
  16745. repetition is common, but this pattern is uncommon in video digitized from an
  16746. analog source. When it occurs in video that results from the digitization of an
  16747. analog source it can indicate concealment from a dropout compensator.
  16748. @item brng
  16749. Identify pixels that fall outside of legal broadcast range.
  16750. @end table
  16751. @item color, c
  16752. Set the highlight color for the @option{out} option. The default color is
  16753. yellow.
  16754. @end table
  16755. @subsection Examples
  16756. @itemize
  16757. @item
  16758. Output data of various video metrics:
  16759. @example
  16760. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  16761. @end example
  16762. @item
  16763. Output specific data about the minimum and maximum values of the Y plane per frame:
  16764. @example
  16765. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  16766. @end example
  16767. @item
  16768. Playback video while highlighting pixels that are outside of broadcast range in red.
  16769. @example
  16770. ffplay example.mov -vf signalstats="out=brng:color=red"
  16771. @end example
  16772. @item
  16773. Playback video with signalstats metadata drawn over the frame.
  16774. @example
  16775. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  16776. @end example
  16777. The contents of signalstat_drawtext.txt used in the command are:
  16778. @example
  16779. time %@{pts:hms@}
  16780. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  16781. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  16782. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  16783. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  16784. @end example
  16785. @end itemize
  16786. @anchor{signature}
  16787. @section signature
  16788. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  16789. input. In this case the matching between the inputs can be calculated additionally.
  16790. The filter always passes through the first input. The signature of each stream can
  16791. be written into a file.
  16792. It accepts the following options:
  16793. @table @option
  16794. @item detectmode
  16795. Enable or disable the matching process.
  16796. Available values are:
  16797. @table @samp
  16798. @item off
  16799. Disable the calculation of a matching (default).
  16800. @item full
  16801. Calculate the matching for the whole video and output whether the whole video
  16802. matches or only parts.
  16803. @item fast
  16804. Calculate only until a matching is found or the video ends. Should be faster in
  16805. some cases.
  16806. @end table
  16807. @item nb_inputs
  16808. Set the number of inputs. The option value must be a non negative integer.
  16809. Default value is 1.
  16810. @item filename
  16811. Set the path to which the output is written. If there is more than one input,
  16812. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  16813. integer), that will be replaced with the input number. If no filename is
  16814. specified, no output will be written. This is the default.
  16815. @item format
  16816. Choose the output format.
  16817. Available values are:
  16818. @table @samp
  16819. @item binary
  16820. Use the specified binary representation (default).
  16821. @item xml
  16822. Use the specified xml representation.
  16823. @end table
  16824. @item th_d
  16825. Set threshold to detect one word as similar. The option value must be an integer
  16826. greater than zero. The default value is 9000.
  16827. @item th_dc
  16828. Set threshold to detect all words as similar. The option value must be an integer
  16829. greater than zero. The default value is 60000.
  16830. @item th_xh
  16831. Set threshold to detect frames as similar. The option value must be an integer
  16832. greater than zero. The default value is 116.
  16833. @item th_di
  16834. Set the minimum length of a sequence in frames to recognize it as matching
  16835. sequence. The option value must be a non negative integer value.
  16836. The default value is 0.
  16837. @item th_it
  16838. Set the minimum relation, that matching frames to all frames must have.
  16839. The option value must be a double value between 0 and 1. The default value is 0.5.
  16840. @end table
  16841. @subsection Examples
  16842. @itemize
  16843. @item
  16844. To calculate the signature of an input video and store it in signature.bin:
  16845. @example
  16846. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  16847. @end example
  16848. @item
  16849. To detect whether two videos match and store the signatures in XML format in
  16850. signature0.xml and signature1.xml:
  16851. @example
  16852. 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 -
  16853. @end example
  16854. @end itemize
  16855. @anchor{siti}
  16856. @section siti
  16857. Calculate Spatial Information (SI) and Temporal Information (TI) scores for a video,
  16858. as defined in ITU-T Rec. P.910 (11/21): Subjective video quality assessment methods
  16859. for multimedia applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
  16860. Note that this is a legacy implementation that corresponds to a superseded recommendation.
  16861. Refer to ITU-T Rec. P.910 (07/22) for the latest version: @url{https://www.itu.int/rec/T-REC-P.910-202207-I/en}
  16862. It accepts the following option:
  16863. @table @option
  16864. @item print_summary
  16865. If set to 1, Summary statistics will be printed to the console. Default 0.
  16866. @end table
  16867. @subsection Examples
  16868. @itemize
  16869. @item
  16870. To calculate SI/TI metrics and print summary:
  16871. @example
  16872. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  16873. @end example
  16874. @end itemize
  16875. @anchor{smartblur}
  16876. @section smartblur
  16877. Blur the input video without impacting the outlines.
  16878. It accepts the following options:
  16879. @table @option
  16880. @item luma_radius, lr
  16881. Set the luma radius. The option value must be a float number in
  16882. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16883. used to blur the image (slower if larger). Default value is 1.0.
  16884. @item luma_strength, ls
  16885. Set the luma strength. The option value must be a float number
  16886. in the range [-1.0,1.0] that configures the blurring. A value included
  16887. in [0.0,1.0] will blur the image whereas a value included in
  16888. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  16889. @item luma_threshold, lt
  16890. Set the luma threshold used as a coefficient to determine
  16891. whether a pixel should be blurred or not. The option value must be an
  16892. integer in the range [-30,30]. A value of 0 will filter all the image,
  16893. a value included in [0,30] will filter flat areas and a value included
  16894. in [-30,0] will filter edges. Default value is 0.
  16895. @item chroma_radius, cr
  16896. Set the chroma radius. The option value must be a float number in
  16897. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16898. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  16899. @item chroma_strength, cs
  16900. Set the chroma strength. The option value must be a float number
  16901. in the range [-1.0,1.0] that configures the blurring. A value included
  16902. in [0.0,1.0] will blur the image whereas a value included in
  16903. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  16904. @item chroma_threshold, ct
  16905. Set the chroma threshold used as a coefficient to determine
  16906. whether a pixel should be blurred or not. The option value must be an
  16907. integer in the range [-30,30]. A value of 0 will filter all the image,
  16908. a value included in [0,30] will filter flat areas and a value included
  16909. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  16910. @item alpha_radius, ar
  16911. Set the alpha radius. The option value must be a float number in
  16912. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16913. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  16914. @item alpha_strength, as
  16915. Set the alpha strength. The option value must be a float number
  16916. in the range [-1.0,1.0] that configures the blurring. A value included
  16917. in [0.0,1.0] will blur the image whereas a value included in
  16918. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  16919. @item alpha_threshold, at
  16920. Set the alpha threshold used as a coefficient to determine
  16921. whether a pixel should be blurred or not. The option value must be an
  16922. integer in the range [-30,30]. A value of 0 will filter all the image,
  16923. a value included in [0,30] will filter flat areas and a value included
  16924. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  16925. @end table
  16926. If a chroma or alpha option is not explicitly set, the corresponding luma value
  16927. is set.
  16928. @section sobel
  16929. Apply sobel operator to input video stream.
  16930. The filter accepts the following option:
  16931. @table @option
  16932. @item planes
  16933. Set which planes will be processed, unprocessed planes will be copied.
  16934. By default value 0xf, all planes will be processed.
  16935. @item scale
  16936. Set value which will be multiplied with filtered result.
  16937. @item delta
  16938. Set value which will be added to filtered result.
  16939. @end table
  16940. @subsection Commands
  16941. This filter supports the all above options as @ref{commands}.
  16942. @anchor{spp}
  16943. @section spp
  16944. Apply a simple postprocessing filter that compresses and decompresses the image
  16945. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  16946. and average the results.
  16947. The filter accepts the following options:
  16948. @table @option
  16949. @item quality
  16950. Set quality. This option defines the number of levels for averaging. It accepts
  16951. an integer in the range 0-6. If set to @code{0}, the filter will have no
  16952. effect. A value of @code{6} means the higher quality. For each increment of
  16953. that value the speed drops by a factor of approximately 2. Default value is
  16954. @code{3}.
  16955. @item qp
  16956. Force a constant quantization parameter. If not set, the filter will use the QP
  16957. from the video stream (if available).
  16958. @item mode
  16959. Set thresholding mode. Available modes are:
  16960. @table @samp
  16961. @item hard
  16962. Set hard thresholding (default).
  16963. @item soft
  16964. Set soft thresholding (better de-ringing effect, but likely blurrier).
  16965. @end table
  16966. @item use_bframe_qp
  16967. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  16968. option may cause flicker since the B-Frames have often larger QP. Default is
  16969. @code{0} (not enabled).
  16970. @end table
  16971. @subsection Commands
  16972. This filter supports the following commands:
  16973. @table @option
  16974. @item quality, level
  16975. Set quality level. The value @code{max} can be used to set the maximum level,
  16976. currently @code{6}.
  16977. @end table
  16978. @anchor{sr}
  16979. @section sr
  16980. Scale the input by applying one of the super-resolution methods based on
  16981. convolutional neural networks. Supported models:
  16982. @itemize
  16983. @item
  16984. Super-Resolution Convolutional Neural Network model (SRCNN).
  16985. See @url{https://arxiv.org/abs/1501.00092}.
  16986. @item
  16987. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  16988. See @url{https://arxiv.org/abs/1609.05158}.
  16989. @end itemize
  16990. Training scripts as well as scripts for model file (.pb) saving can be found at
  16991. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  16992. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  16993. The filter accepts the following options:
  16994. @table @option
  16995. @item dnn_backend
  16996. Specify which DNN backend to use for model loading and execution. This option accepts
  16997. the following values:
  16998. @table @samp
  16999. @item tensorflow
  17000. TensorFlow backend. To enable this backend you
  17001. need to install the TensorFlow for C library (see
  17002. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  17003. @code{--enable-libtensorflow}
  17004. @end table
  17005. @item model
  17006. Set path to model file specifying network architecture and its parameters.
  17007. Note that different backends use different file formats. TensorFlow, OpenVINO backend
  17008. can load files for only its format.
  17009. @item scale_factor
  17010. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  17011. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  17012. input upscaled using bicubic upscaling with proper scale factor.
  17013. @end table
  17014. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  17015. @anchor{sr_amf}
  17016. @section sr_amf
  17017. Upscale (size increasing) for the input video using AMD Advanced Media Framework library for hardware acceleration.
  17018. Use advanced algorithms for upscaling with higher output quality.
  17019. Setting the output width and height works in the same way as for the @ref{scale} filter.
  17020. The filter accepts the following options:
  17021. @table @option
  17022. @item w
  17023. @item h
  17024. Set the output video dimension expression. Default value is the input dimension.
  17025. Allows for the same expressions as the @ref{scale} filter.
  17026. @item algorithm
  17027. Sets the algorithm used for scaling:
  17028. @table @var
  17029. @item bilinear
  17030. Bilinear
  17031. @item bicubic
  17032. Bicubic
  17033. @item sr1-0
  17034. Video SR1.0
  17035. This is a default value
  17036. @item point
  17037. Point
  17038. @item sr1-1
  17039. Video SR1.1
  17040. @end table
  17041. @item sharpness
  17042. Control hq scaler sharpening. The value is a float in the range of [0.0, 2.0]
  17043. @item format
  17044. Controls the output pixel format. By default, or if none is specified, the input
  17045. pixel format is used.
  17046. @item keep-ratio
  17047. Force the scaler to keep the aspect ratio of the input image when the output size has a different aspect ratio.
  17048. Default value is false.
  17049. @item fill
  17050. Specifies whether the output image outside the region of interest,
  17051. which does not fill the entire output surface should be filled with a solid color.
  17052. @end table
  17053. @subsection Examples
  17054. @itemize
  17055. @item
  17056. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  17057. @example
  17058. sr_amf=-2:720:format=yuv420p
  17059. @end example
  17060. @item
  17061. Upscale to 4K with algorithm video SR1.1.
  17062. @example
  17063. sr_amf=4096:2160:algorithm=sr1-1
  17064. @end example
  17065. @end itemize
  17066. @section ssim
  17067. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  17068. This filter takes in input two input videos, the first input is
  17069. considered the "main" source and is passed unchanged to the
  17070. output. The second input is used as a "reference" video for computing
  17071. the SSIM.
  17072. Both video inputs must have the same resolution and pixel format for
  17073. this filter to work correctly. Also it assumes that both inputs
  17074. have the same number of frames, which are compared one by one.
  17075. The filter stores the calculated SSIM of each frame.
  17076. The description of the accepted parameters follows.
  17077. @table @option
  17078. @item stats_file, f
  17079. If specified the filter will use the named file to save the SSIM of
  17080. each individual frame. When filename equals "-" the data is sent to
  17081. standard output.
  17082. @end table
  17083. The file printed if @var{stats_file} is selected, contains a sequence of
  17084. key/value pairs of the form @var{key}:@var{value} for each compared
  17085. couple of frames.
  17086. A description of each shown parameter follows:
  17087. @table @option
  17088. @item n
  17089. sequential number of the input frame, starting from 1
  17090. @item Y, U, V, R, G, B
  17091. SSIM of the compared frames for the component specified by the suffix.
  17092. @item All
  17093. SSIM of the compared frames for the whole frame.
  17094. @item dB
  17095. Same as above but in dB representation.
  17096. @end table
  17097. This filter also supports the @ref{framesync} options.
  17098. @subsection Examples
  17099. @itemize
  17100. @item
  17101. For example:
  17102. @example
  17103. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  17104. [main][ref] ssim="stats_file=stats.log" [out]
  17105. @end example
  17106. On this example the input file being processed is compared with the
  17107. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  17108. is stored in @file{stats.log}.
  17109. @item
  17110. Another example with both psnr and ssim at same time:
  17111. @example
  17112. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  17113. @end example
  17114. @item
  17115. Another example with different containers:
  17116. @example
  17117. 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 -
  17118. @end example
  17119. @end itemize
  17120. @section stereo3d
  17121. Convert between different stereoscopic image formats.
  17122. The filters accept the following options:
  17123. @table @option
  17124. @item in
  17125. Set stereoscopic image format of input.
  17126. Available values for input image formats are:
  17127. @table @samp
  17128. @item sbsl
  17129. side by side parallel (left eye left, right eye right)
  17130. @item sbsr
  17131. side by side crosseye (right eye left, left eye right)
  17132. @item sbs2l
  17133. side by side parallel with half width resolution
  17134. (left eye left, right eye right)
  17135. @item sbs2r
  17136. side by side crosseye with half width resolution
  17137. (right eye left, left eye right)
  17138. @item abl
  17139. @item tbl
  17140. above-below (left eye above, right eye below)
  17141. @item abr
  17142. @item tbr
  17143. above-below (right eye above, left eye below)
  17144. @item ab2l
  17145. @item tb2l
  17146. above-below with half height resolution
  17147. (left eye above, right eye below)
  17148. @item ab2r
  17149. @item tb2r
  17150. above-below with half height resolution
  17151. (right eye above, left eye below)
  17152. @item al
  17153. alternating frames (left eye first, right eye second)
  17154. @item ar
  17155. alternating frames (right eye first, left eye second)
  17156. @item irl
  17157. interleaved rows (left eye has top row, right eye starts on next row)
  17158. @item irr
  17159. interleaved rows (right eye has top row, left eye starts on next row)
  17160. @item icl
  17161. interleaved columns, left eye first
  17162. @item icr
  17163. interleaved columns, right eye first
  17164. Default value is @samp{sbsl}.
  17165. @end table
  17166. @item out
  17167. Set stereoscopic image format of output.
  17168. @table @samp
  17169. @item sbsl
  17170. side by side parallel (left eye left, right eye right)
  17171. @item sbsr
  17172. side by side crosseye (right eye left, left eye right)
  17173. @item sbs2l
  17174. side by side parallel with half width resolution
  17175. (left eye left, right eye right)
  17176. @item sbs2r
  17177. side by side crosseye with half width resolution
  17178. (right eye left, left eye right)
  17179. @item abl
  17180. @item tbl
  17181. above-below (left eye above, right eye below)
  17182. @item abr
  17183. @item tbr
  17184. above-below (right eye above, left eye below)
  17185. @item ab2l
  17186. @item tb2l
  17187. above-below with half height resolution
  17188. (left eye above, right eye below)
  17189. @item ab2r
  17190. @item tb2r
  17191. above-below with half height resolution
  17192. (right eye above, left eye below)
  17193. @item al
  17194. alternating frames (left eye first, right eye second)
  17195. @item ar
  17196. alternating frames (right eye first, left eye second)
  17197. @item irl
  17198. interleaved rows (left eye has top row, right eye starts on next row)
  17199. @item irr
  17200. interleaved rows (right eye has top row, left eye starts on next row)
  17201. @item arbg
  17202. anaglyph red/blue gray
  17203. (red filter on left eye, blue filter on right eye)
  17204. @item argg
  17205. anaglyph red/green gray
  17206. (red filter on left eye, green filter on right eye)
  17207. @item arcg
  17208. anaglyph red/cyan gray
  17209. (red filter on left eye, cyan filter on right eye)
  17210. @item arch
  17211. anaglyph red/cyan half colored
  17212. (red filter on left eye, cyan filter on right eye)
  17213. @item arcc
  17214. anaglyph red/cyan color
  17215. (red filter on left eye, cyan filter on right eye)
  17216. @item arcd
  17217. anaglyph red/cyan color optimized with the least squares projection of dubois
  17218. (red filter on left eye, cyan filter on right eye)
  17219. @item agmg
  17220. anaglyph green/magenta gray
  17221. (green filter on left eye, magenta filter on right eye)
  17222. @item agmh
  17223. anaglyph green/magenta half colored
  17224. (green filter on left eye, magenta filter on right eye)
  17225. @item agmc
  17226. anaglyph green/magenta colored
  17227. (green filter on left eye, magenta filter on right eye)
  17228. @item agmd
  17229. anaglyph green/magenta color optimized with the least squares projection of dubois
  17230. (green filter on left eye, magenta filter on right eye)
  17231. @item aybg
  17232. anaglyph yellow/blue gray
  17233. (yellow filter on left eye, blue filter on right eye)
  17234. @item aybh
  17235. anaglyph yellow/blue half colored
  17236. (yellow filter on left eye, blue filter on right eye)
  17237. @item aybc
  17238. anaglyph yellow/blue colored
  17239. (yellow filter on left eye, blue filter on right eye)
  17240. @item aybd
  17241. anaglyph yellow/blue color optimized with the least squares projection of dubois
  17242. (yellow filter on left eye, blue filter on right eye)
  17243. @item ml
  17244. mono output (left eye only)
  17245. @item mr
  17246. mono output (right eye only)
  17247. @item chl
  17248. checkerboard, left eye first
  17249. @item chr
  17250. checkerboard, right eye first
  17251. @item icl
  17252. interleaved columns, left eye first
  17253. @item icr
  17254. interleaved columns, right eye first
  17255. @item hdmi
  17256. HDMI frame pack
  17257. @end table
  17258. Default value is @samp{arcd}.
  17259. @end table
  17260. @subsection Examples
  17261. @itemize
  17262. @item
  17263. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  17264. @example
  17265. stereo3d=sbsl:aybd
  17266. @end example
  17267. @item
  17268. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  17269. @example
  17270. stereo3d=abl:sbsr
  17271. @end example
  17272. @end itemize
  17273. @section streamselect, astreamselect
  17274. Select video or audio streams.
  17275. The filter accepts the following options:
  17276. @table @option
  17277. @item inputs
  17278. Set number of inputs. Default is 2.
  17279. @item map
  17280. Set input indexes to remap to outputs.
  17281. @end table
  17282. @subsection Commands
  17283. The @code{streamselect} and @code{astreamselect} filter supports the following
  17284. commands:
  17285. @table @option
  17286. @item map
  17287. Set input indexes to remap to outputs.
  17288. @end table
  17289. @subsection Examples
  17290. @itemize
  17291. @item
  17292. Select first 5 seconds 1st stream and rest of time 2nd stream:
  17293. @example
  17294. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  17295. @end example
  17296. @item
  17297. Same as above, but for audio:
  17298. @example
  17299. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  17300. @end example
  17301. @end itemize
  17302. @anchor{subtitles}
  17303. @section subtitles
  17304. Draw subtitles on top of input video using the libass library.
  17305. To enable compilation of this filter you need to configure FFmpeg with
  17306. @code{--enable-libass}. This filter also requires a build with libavcodec and
  17307. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  17308. Alpha) subtitles format.
  17309. The filter accepts the following options:
  17310. @table @option
  17311. @item filename, f
  17312. Set the filename of the subtitle file to read. It must be specified.
  17313. @item original_size
  17314. Specify the size of the original video, the video for which the ASS file
  17315. was composed. For the syntax of this option, check the
  17316. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17317. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  17318. correctly scale the fonts if the aspect ratio has been changed.
  17319. @item fontsdir
  17320. Set a directory path containing fonts that can be used by the filter.
  17321. These fonts will be used in addition to whatever the font provider uses.
  17322. @item alpha
  17323. Process alpha channel, by default alpha channel is untouched.
  17324. @item charenc
  17325. Set subtitles input character encoding. @code{subtitles} filter only. Only
  17326. useful if not UTF-8.
  17327. @item stream_index, si
  17328. Set subtitles stream index. @code{subtitles} filter only.
  17329. @item force_style
  17330. Override default style or script info parameters of the subtitles. It accepts a
  17331. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  17332. @item wrap_unicode
  17333. Break lines according to the Unicode Line Breaking Algorithm. Availability requires
  17334. at least libass release 0.17.0 (or LIBASS_VERSION 0x01600010), @emph{and} libass must
  17335. have been built with libunibreak.
  17336. The option is enabled by default except for native ASS.
  17337. @end table
  17338. If the first key is not specified, it is assumed that the first value
  17339. specifies the @option{filename}.
  17340. For example, to render the file @file{sub.srt} on top of the input
  17341. video, use the command:
  17342. @example
  17343. subtitles=sub.srt
  17344. @end example
  17345. which is equivalent to:
  17346. @example
  17347. subtitles=filename=sub.srt
  17348. @end example
  17349. To render the default subtitles stream from file @file{video.mkv}, use:
  17350. @example
  17351. subtitles=video.mkv
  17352. @end example
  17353. To render the second subtitles stream from that file, use:
  17354. @example
  17355. subtitles=video.mkv:si=1
  17356. @end example
  17357. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  17358. @code{DejaVu Serif}, use:
  17359. @example
  17360. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  17361. @end example
  17362. @section super2xsai
  17363. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  17364. Interpolate) pixel art scaling algorithm.
  17365. Useful for enlarging pixel art images without reducing sharpness.
  17366. @section swaprect
  17367. Swap two rectangular objects in video.
  17368. This filter accepts the following options:
  17369. @table @option
  17370. @item w
  17371. Set object width.
  17372. @item h
  17373. Set object height.
  17374. @item x1
  17375. Set 1st rect x coordinate.
  17376. @item y1
  17377. Set 1st rect y coordinate.
  17378. @item x2
  17379. Set 2nd rect x coordinate.
  17380. @item y2
  17381. Set 2nd rect y coordinate.
  17382. All expressions are evaluated once for each frame.
  17383. @end table
  17384. The all options are expressions containing the following constants:
  17385. @table @option
  17386. @item w
  17387. @item h
  17388. The input width and height.
  17389. @item a
  17390. same as @var{w} / @var{h}
  17391. @item sar
  17392. input sample aspect ratio
  17393. @item dar
  17394. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  17395. @item n
  17396. The number of the input frame, starting from 0.
  17397. @item t
  17398. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  17399. @item pos
  17400. the position in the file of the input frame, NAN if unknown; deprecated,
  17401. do not use
  17402. @end table
  17403. @subsection Commands
  17404. This filter supports the all above options as @ref{commands}.
  17405. @section swapuv
  17406. Swap U & V plane.
  17407. @section tblend
  17408. Blend successive video frames.
  17409. See @ref{blend}
  17410. @section telecine
  17411. Apply telecine process to the video.
  17412. This filter accepts the following options:
  17413. @table @option
  17414. @item first_field
  17415. @table @samp
  17416. @item top, t
  17417. top field first
  17418. @item bottom, b
  17419. bottom field first
  17420. The default value is @code{top}.
  17421. @end table
  17422. @item pattern
  17423. A string of numbers representing the pulldown pattern you wish to apply.
  17424. The default value is @code{23}.
  17425. @end table
  17426. @example
  17427. Some typical patterns:
  17428. NTSC output (30i):
  17429. 27.5p: 32222
  17430. 24p: 23 (classic)
  17431. 24p: 2332 (preferred)
  17432. 20p: 33
  17433. 18p: 334
  17434. 16p: 3444
  17435. PAL output (25i):
  17436. 27.5p: 12222
  17437. 24p: 222222222223 ("Euro pulldown")
  17438. 16.67p: 33
  17439. 16p: 33333334
  17440. @end example
  17441. @section thistogram
  17442. Compute and draw a color distribution histogram for the input video across time.
  17443. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  17444. at certain time, this filter shows also past histograms of number of frames defined
  17445. by @code{width} option.
  17446. The computed histogram is a representation of the color component
  17447. distribution in an image.
  17448. The filter accepts the following options:
  17449. @table @option
  17450. @item width, w
  17451. Set width of single color component output. Default value is @code{0}.
  17452. Value of @code{0} means width will be picked from input video.
  17453. This also set number of passed histograms to keep.
  17454. Allowed range is [0, 8192].
  17455. @item display_mode, d
  17456. Set display mode.
  17457. It accepts the following values:
  17458. @table @samp
  17459. @item stack
  17460. Per color component graphs are placed below each other.
  17461. @item parade
  17462. Per color component graphs are placed side by side.
  17463. @item overlay
  17464. Presents information identical to that in the @code{parade}, except
  17465. that the graphs representing color components are superimposed directly
  17466. over one another.
  17467. @end table
  17468. Default is @code{stack}.
  17469. @item levels_mode, m
  17470. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  17471. Default is @code{linear}.
  17472. @item components, c
  17473. Set what color components to display.
  17474. Default is @code{7}.
  17475. @item bgopacity, b
  17476. Set background opacity. Default is @code{0.9}.
  17477. @item envelope, e
  17478. Show envelope. Default is disabled.
  17479. @item ecolor, ec
  17480. Set envelope color. Default is @code{gold}.
  17481. @item slide
  17482. Set slide mode.
  17483. Available values for slide is:
  17484. @table @samp
  17485. @item frame
  17486. Draw new frame when right border is reached.
  17487. @item replace
  17488. Replace old columns with new ones.
  17489. @item scroll
  17490. Scroll from right to left.
  17491. @item rscroll
  17492. Scroll from left to right.
  17493. @item picture
  17494. Draw single picture.
  17495. @end table
  17496. Default is @code{replace}.
  17497. @end table
  17498. @section threshold
  17499. Apply threshold effect to video stream.
  17500. This filter needs four video streams to perform thresholding.
  17501. First stream is stream we are filtering.
  17502. Second stream is holding threshold values, third stream is holding min values,
  17503. and last, fourth stream is holding max values.
  17504. The filter accepts the following option:
  17505. @table @option
  17506. @item planes
  17507. Set which planes will be processed, unprocessed planes will be copied.
  17508. By default value 0xf, all planes will be processed.
  17509. @end table
  17510. For example if first stream pixel's component value is less then threshold value
  17511. of pixel component from 2nd threshold stream, third stream value will picked,
  17512. otherwise fourth stream pixel component value will be picked.
  17513. Using color source filter one can perform various types of thresholding:
  17514. @subsection Commands
  17515. This filter supports the all options as @ref{commands}.
  17516. @subsection Examples
  17517. @itemize
  17518. @item
  17519. Binary threshold, using gray color as threshold:
  17520. @example
  17521. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  17522. @end example
  17523. @item
  17524. Inverted binary threshold, using gray color as threshold:
  17525. @example
  17526. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  17527. @end example
  17528. @item
  17529. Truncate binary threshold, using gray color as threshold:
  17530. @example
  17531. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  17532. @end example
  17533. @item
  17534. Threshold to zero, using gray color as threshold:
  17535. @example
  17536. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  17537. @end example
  17538. @item
  17539. Inverted threshold to zero, using gray color as threshold:
  17540. @example
  17541. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  17542. @end example
  17543. @end itemize
  17544. @section thumbnail
  17545. Select the most representative frame in a given sequence of consecutive frames.
  17546. The filter accepts the following options:
  17547. @table @option
  17548. @item n
  17549. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  17550. will pick one of them, and then handle the next batch of @var{n} frames until
  17551. the end. Default is @code{100}.
  17552. @item log
  17553. Set the log level to display picked frame stats.
  17554. Default is @code{info}.
  17555. @end table
  17556. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  17557. value will result in a higher memory usage, so a high value is not recommended.
  17558. @subsection Examples
  17559. @itemize
  17560. @item
  17561. Extract one picture each 50 frames:
  17562. @example
  17563. thumbnail=50
  17564. @end example
  17565. @item
  17566. Complete example of a thumbnail creation with @command{ffmpeg}:
  17567. @example
  17568. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  17569. @end example
  17570. @end itemize
  17571. @anchor{tile}
  17572. @section tile
  17573. Tile several successive frames together.
  17574. The @ref{untile} filter can do the reverse.
  17575. The filter accepts the following options:
  17576. @table @option
  17577. @item layout
  17578. Set the grid size in the form @code{COLUMNSxROWS}. Range is up to UINT_MAX cells.
  17579. Default is @code{6x5}.
  17580. @item nb_frames
  17581. Set the maximum number of frames to render in the given area. It must be less
  17582. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  17583. the area will be used.
  17584. @item margin
  17585. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  17586. @item padding
  17587. Set the inner border thickness (i.e. the number of pixels between frames). For
  17588. more advanced padding options (such as having different values for the edges),
  17589. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  17590. @item color
  17591. Specify the color of the unused area. For the syntax of this option, check the
  17592. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17593. The default value of @var{color} is "black".
  17594. @item overlap
  17595. Set the number of frames to overlap when tiling several successive frames together.
  17596. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17597. @item init_padding
  17598. Set the number of frames to initially be empty before displaying first output frame.
  17599. This controls how soon will one get first output frame.
  17600. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17601. @end table
  17602. @subsection Examples
  17603. @itemize
  17604. @item
  17605. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  17606. @example
  17607. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  17608. @end example
  17609. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  17610. duplicating each output frame to accommodate the originally detected frame
  17611. rate.
  17612. @item
  17613. Display @code{5} pictures in an area of @code{3x2} frames,
  17614. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  17615. mixed flat and named options:
  17616. @example
  17617. tile=3x2:nb_frames=5:padding=7:margin=2
  17618. @end example
  17619. @end itemize
  17620. @section tiltandshift
  17621. Apply tilt-and-shift effect.
  17622. What happens when you invert time and space?
  17623. Normally a video is composed of several frames that represent a different
  17624. instant of time and shows a scene that evolves in the space captured by the
  17625. frame. This filter is the antipode of that concept, taking inspiration from
  17626. tilt and shift photography.
  17627. A filtered frame contains the whole timeline of events composing the sequence,
  17628. and this is obtained by placing a slice of pixels from each frame into a single
  17629. one. However, since there are no infinite-width frames, this is done up the
  17630. width of the input frame, and a video is recomposed by shifting away one
  17631. column for each subsequent frame. In order to map space to time, the filter
  17632. tilts each input frame as well, so that motion is preserved. This is accomplished
  17633. by progressively selecting a different column from each input frame.
  17634. The end result is a sort of inverted parallax, so that far away objects move
  17635. much faster that the ones in the front. The ideal conditions for this video
  17636. effect are when there is either very little motion and the backgroud is static,
  17637. or when there is a lot of motion and a very wide depth of field (e.g. wide
  17638. panorama, while moving on a train).
  17639. The filter accepts the following parameters:
  17640. @table @option
  17641. @item tilt
  17642. Tilt video while shifting (default). When unset, video will be sliding a
  17643. static image, composed of the first column of each frame.
  17644. @item start
  17645. What to do at the start of filtering (see below).
  17646. @item end
  17647. What to do at the end of filtering (see below).
  17648. @item hold
  17649. How many columns should pass through before start of filtering.
  17650. @item pad
  17651. How many columns should be inserted before end of filtering.
  17652. @end table
  17653. Normally the filter shifts and tilts from the very first frame, and stops when
  17654. the last one is received. However, before filtering starts, normal video may
  17655. be preseved, so that the effect is slowly shifted in its place. Similarly,
  17656. the last video frame may be reconstructed at the end. Alternatively it is
  17657. possible to just start and end with black.
  17658. @table @samp
  17659. @item none
  17660. Filtering starts immediately and ends when the last frame is received.
  17661. @item frame
  17662. The first frames or the very last frame are kept intact during processing.
  17663. @item black
  17664. Black is padded at the beginning or at the end of filtering.
  17665. @end table
  17666. @section tinterlace
  17667. Perform various types of temporal field interlacing.
  17668. Frames are counted starting from 1, so the first input frame is
  17669. considered odd.
  17670. The filter accepts the following options:
  17671. @table @option
  17672. @item mode
  17673. Specify the mode of the interlacing. This option can also be specified
  17674. as a value alone. See below for a list of values for this option.
  17675. Available values are:
  17676. @table @samp
  17677. @item merge, 0
  17678. Move odd frames into the upper field, even into the lower field,
  17679. generating a double height frame at half frame rate.
  17680. @example
  17681. ------> time
  17682. Input:
  17683. Frame 1 Frame 2 Frame 3 Frame 4
  17684. 11111 22222 33333 44444
  17685. 11111 22222 33333 44444
  17686. 11111 22222 33333 44444
  17687. 11111 22222 33333 44444
  17688. Output:
  17689. 11111 33333
  17690. 22222 44444
  17691. 11111 33333
  17692. 22222 44444
  17693. 11111 33333
  17694. 22222 44444
  17695. 11111 33333
  17696. 22222 44444
  17697. @end example
  17698. @item drop_even, 1
  17699. Only output odd frames, even frames are dropped, generating a frame with
  17700. unchanged height at half frame rate.
  17701. @example
  17702. ------> time
  17703. Input:
  17704. Frame 1 Frame 2 Frame 3 Frame 4
  17705. 11111 22222 33333 44444
  17706. 11111 22222 33333 44444
  17707. 11111 22222 33333 44444
  17708. 11111 22222 33333 44444
  17709. Output:
  17710. 11111 33333
  17711. 11111 33333
  17712. 11111 33333
  17713. 11111 33333
  17714. @end example
  17715. @item drop_odd, 2
  17716. Only output even frames, odd frames are dropped, generating a frame with
  17717. unchanged height at half frame rate.
  17718. @example
  17719. ------> time
  17720. Input:
  17721. Frame 1 Frame 2 Frame 3 Frame 4
  17722. 11111 22222 33333 44444
  17723. 11111 22222 33333 44444
  17724. 11111 22222 33333 44444
  17725. 11111 22222 33333 44444
  17726. Output:
  17727. 22222 44444
  17728. 22222 44444
  17729. 22222 44444
  17730. 22222 44444
  17731. @end example
  17732. @item pad, 3
  17733. Expand each frame to full height, but pad alternate lines with black,
  17734. generating a frame with double height at the same input frame rate.
  17735. @example
  17736. ------> time
  17737. Input:
  17738. Frame 1 Frame 2 Frame 3 Frame 4
  17739. 11111 22222 33333 44444
  17740. 11111 22222 33333 44444
  17741. 11111 22222 33333 44444
  17742. 11111 22222 33333 44444
  17743. Output:
  17744. 11111 ..... 33333 .....
  17745. ..... 22222 ..... 44444
  17746. 11111 ..... 33333 .....
  17747. ..... 22222 ..... 44444
  17748. 11111 ..... 33333 .....
  17749. ..... 22222 ..... 44444
  17750. 11111 ..... 33333 .....
  17751. ..... 22222 ..... 44444
  17752. @end example
  17753. @item interleave_top, 4
  17754. Interleave the upper field from odd frames with the lower field from
  17755. even frames, generating a frame with unchanged height at half frame rate.
  17756. @example
  17757. ------> time
  17758. Input:
  17759. Frame 1 Frame 2 Frame 3 Frame 4
  17760. 11111<- 22222 33333<- 44444
  17761. 11111 22222<- 33333 44444<-
  17762. 11111<- 22222 33333<- 44444
  17763. 11111 22222<- 33333 44444<-
  17764. Output:
  17765. 11111 33333
  17766. 22222 44444
  17767. 11111 33333
  17768. 22222 44444
  17769. @end example
  17770. @item interleave_bottom, 5
  17771. Interleave the lower field from odd frames with the upper field from
  17772. even frames, generating a frame with unchanged height at half frame rate.
  17773. @example
  17774. ------> time
  17775. Input:
  17776. Frame 1 Frame 2 Frame 3 Frame 4
  17777. 11111 22222<- 33333 44444<-
  17778. 11111<- 22222 33333<- 44444
  17779. 11111 22222<- 33333 44444<-
  17780. 11111<- 22222 33333<- 44444
  17781. Output:
  17782. 22222 44444
  17783. 11111 33333
  17784. 22222 44444
  17785. 11111 33333
  17786. @end example
  17787. @item interlacex2, 6
  17788. Double frame rate with unchanged height. Frames are inserted each
  17789. containing the second temporal field from the previous input frame and
  17790. the first temporal field from the next input frame. This mode relies on
  17791. the top_field_first flag. Useful for interlaced video displays with no
  17792. field synchronisation.
  17793. @example
  17794. ------> time
  17795. Input:
  17796. Frame 1 Frame 2 Frame 3 Frame 4
  17797. 11111 22222 33333 44444
  17798. 11111 22222 33333 44444
  17799. 11111 22222 33333 44444
  17800. 11111 22222 33333 44444
  17801. Output:
  17802. 11111 22222 22222 33333 33333 44444 44444
  17803. 11111 11111 22222 22222 33333 33333 44444
  17804. 11111 22222 22222 33333 33333 44444 44444
  17805. 11111 11111 22222 22222 33333 33333 44444
  17806. @end example
  17807. @item mergex2, 7
  17808. Move odd frames into the upper field, even into the lower field,
  17809. generating a double height frame at same frame rate.
  17810. @example
  17811. ------> time
  17812. Input:
  17813. Frame 1 Frame 2 Frame 3 Frame 4
  17814. 11111 22222 33333 44444
  17815. 11111 22222 33333 44444
  17816. 11111 22222 33333 44444
  17817. 11111 22222 33333 44444
  17818. Output:
  17819. 11111 33333 33333 55555
  17820. 22222 22222 44444 44444
  17821. 11111 33333 33333 55555
  17822. 22222 22222 44444 44444
  17823. 11111 33333 33333 55555
  17824. 22222 22222 44444 44444
  17825. 11111 33333 33333 55555
  17826. 22222 22222 44444 44444
  17827. @end example
  17828. @end table
  17829. Numeric values are deprecated but are accepted for backward
  17830. compatibility reasons.
  17831. Default mode is @code{merge}.
  17832. @item flags
  17833. Specify flags influencing the filter process.
  17834. Available value for @var{flags} is:
  17835. @table @option
  17836. @item low_pass_filter, vlpf
  17837. Enable linear vertical low-pass filtering in the filter.
  17838. Vertical low-pass filtering is required when creating an interlaced
  17839. destination from a progressive source which contains high-frequency
  17840. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  17841. patterning.
  17842. @item complex_filter, cvlpf
  17843. Enable complex vertical low-pass filtering.
  17844. This will slightly less reduce interlace 'twitter' and Moire
  17845. patterning but better retain detail and subjective sharpness impression.
  17846. @item bypass_il
  17847. Bypass already interlaced frames, only adjust the frame rate.
  17848. @end table
  17849. Vertical low-pass filtering and bypassing already interlaced frames can only be
  17850. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  17851. @end table
  17852. @section tmedian
  17853. Pick median pixels from several successive input video frames.
  17854. The filter accepts the following options:
  17855. @table @option
  17856. @item radius
  17857. Set radius of median filter.
  17858. Default is 1. Allowed range is from 1 to 127.
  17859. @item planes
  17860. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  17861. @item percentile
  17862. Set median percentile. Default value is @code{0.5}.
  17863. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  17864. minimum values, and @code{1} maximum values.
  17865. @end table
  17866. @subsection Commands
  17867. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  17868. @section tmidequalizer
  17869. Apply Temporal Midway Video Equalization effect.
  17870. Midway Video Equalization adjusts a sequence of video frames to have the same
  17871. histograms, while maintaining their dynamics as much as possible. It's
  17872. useful for e.g. matching exposures from a video frames sequence.
  17873. This filter accepts the following option:
  17874. @table @option
  17875. @item radius
  17876. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  17877. @item sigma
  17878. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  17879. Setting this option to 0 effectively does nothing.
  17880. @item planes
  17881. Set which planes to process. Default is @code{15}, which is all available planes.
  17882. @end table
  17883. @section tmix
  17884. Mix successive video frames.
  17885. A description of the accepted options follows.
  17886. @table @option
  17887. @item frames
  17888. The number of successive frames to mix. If unspecified, it defaults to 3.
  17889. @item weights
  17890. Specify weight of each input video frame.
  17891. Each weight is separated by space. If number of weights is smaller than
  17892. number of @var{frames} last specified weight will be used for all remaining
  17893. unset weights.
  17894. @item scale
  17895. Specify scale, if it is set it will be multiplied with sum
  17896. of each weight multiplied with pixel values to give final destination
  17897. pixel value. By default @var{scale} is auto scaled to sum of weights.
  17898. @item planes
  17899. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  17900. @end table
  17901. @subsection Examples
  17902. @itemize
  17903. @item
  17904. Average 7 successive frames:
  17905. @example
  17906. tmix=frames=7:weights="1 1 1 1 1 1 1"
  17907. @end example
  17908. @item
  17909. Apply simple temporal convolution:
  17910. @example
  17911. tmix=frames=3:weights="-1 3 -1"
  17912. @end example
  17913. @item
  17914. Similar as above but only showing temporal differences:
  17915. @example
  17916. tmix=frames=3:weights="-1 2 -1":scale=1
  17917. @end example
  17918. @end itemize
  17919. @subsection Commands
  17920. This filter supports the following commands:
  17921. @table @option
  17922. @item weights
  17923. @item scale
  17924. @item planes
  17925. Syntax is same as option with same name.
  17926. @end table
  17927. @anchor{tonemap}
  17928. @section tonemap
  17929. Tone map colors from different dynamic ranges.
  17930. This filter expects data in single precision floating point, as it needs to
  17931. operate on (and can output) out-of-range values. Another filter, such as
  17932. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  17933. The tonemapping algorithms implemented only work on linear light, so input
  17934. data should be linearized beforehand (and possibly correctly tagged).
  17935. @example
  17936. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  17937. @end example
  17938. @subsection Options
  17939. The filter accepts the following options.
  17940. @table @option
  17941. @item tonemap
  17942. Set the tone map algorithm to use.
  17943. Possible values are:
  17944. @table @var
  17945. @item none
  17946. Do not apply any tone map, only desaturate overbright pixels.
  17947. @item clip
  17948. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  17949. in-range values, while distorting out-of-range values.
  17950. @item linear
  17951. Stretch the entire reference gamut to a linear multiple of the display.
  17952. @item gamma
  17953. Fit a logarithmic transfer between the tone curves.
  17954. @item reinhard
  17955. Preserve overall image brightness with a simple curve, using nonlinear
  17956. contrast, which results in flattening details and degrading color accuracy.
  17957. @item hable
  17958. Preserve both dark and bright details better than @var{reinhard}, at the cost
  17959. of slightly darkening everything. Use it when detail preservation is more
  17960. important than color and brightness accuracy.
  17961. @item mobius
  17962. Smoothly map out-of-range values, while retaining contrast and colors for
  17963. in-range material as much as possible. Use it when color accuracy is more
  17964. important than detail preservation.
  17965. @end table
  17966. Default is none.
  17967. @item param
  17968. Tune the tone mapping algorithm.
  17969. This affects the following algorithms:
  17970. @table @var
  17971. @item none
  17972. Ignored.
  17973. @item linear
  17974. Specifies the scale factor to use while stretching.
  17975. Default to 1.0.
  17976. @item gamma
  17977. Specifies the exponent of the function.
  17978. Default to 1.8.
  17979. @item clip
  17980. Specify an extra linear coefficient to multiply into the signal before clipping.
  17981. Default to 1.0.
  17982. @item reinhard
  17983. Specify the local contrast coefficient at the display peak.
  17984. Default to 0.5, which means that in-gamut values will be about half as bright
  17985. as when clipping.
  17986. @item hable
  17987. Ignored.
  17988. @item mobius
  17989. Specify the transition point from linear to mobius transform. Every value
  17990. below this point is guaranteed to be mapped 1:1. The higher the value, the
  17991. more accurate the result will be, at the cost of losing bright details.
  17992. Default to 0.3, which due to the steep initial slope still preserves in-range
  17993. colors fairly accurately.
  17994. @end table
  17995. @item desat
  17996. Apply desaturation for highlights that exceed this level of brightness. The
  17997. higher the parameter, the more color information will be preserved. This
  17998. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17999. (smoothly) turning into white instead. This makes images feel more natural,
  18000. at the cost of reducing information about out-of-range colors.
  18001. The default of 2.0 is somewhat conservative and will mostly just apply to
  18002. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  18003. This option works only if the input frame has a supported color tag.
  18004. @item peak
  18005. Override signal/nominal/reference peak with this value. Useful when the
  18006. embedded peak information in display metadata is not reliable or when tone
  18007. mapping from a lower range to a higher range.
  18008. @end table
  18009. @section tpad
  18010. Temporarily pad video frames.
  18011. The filter accepts the following options:
  18012. @table @option
  18013. @item start
  18014. Specify number of delay frames before input video stream. Default is 0.
  18015. @item stop
  18016. Specify number of padding frames after input video stream.
  18017. Set to -1 to pad indefinitely. Default is 0.
  18018. @item start_mode
  18019. Set kind of frames added to beginning of stream.
  18020. Can be either @var{add} or @var{clone}.
  18021. With @var{add} frames of solid-color are added.
  18022. With @var{clone} frames are clones of first frame.
  18023. Default is @var{add}.
  18024. @item stop_mode
  18025. Set kind of frames added to end of stream.
  18026. Can be either @var{add} or @var{clone}.
  18027. With @var{add} frames of solid-color are added.
  18028. With @var{clone} frames are clones of last frame.
  18029. Default is @var{add}.
  18030. @item start_duration, stop_duration
  18031. Specify the duration of the start/stop delay. See
  18032. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18033. for the accepted syntax.
  18034. These options override @var{start} and @var{stop}. Default is 0.
  18035. @item color
  18036. Specify the color of the padded area. For the syntax of this option,
  18037. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  18038. manual,ffmpeg-utils}.
  18039. The default value of @var{color} is "black".
  18040. @end table
  18041. @anchor{transpose}
  18042. @section transpose
  18043. Transpose rows with columns in the input video and optionally flip it.
  18044. It accepts the following parameters:
  18045. @table @option
  18046. @item dir
  18047. Specify the transposition direction.
  18048. Can assume the following values:
  18049. @table @samp
  18050. @item 0, 4, cclock_flip
  18051. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  18052. @example
  18053. L.R L.l
  18054. . . -> . .
  18055. l.r R.r
  18056. @end example
  18057. @item 1, 5, clock
  18058. Rotate by 90 degrees clockwise, that is:
  18059. @example
  18060. L.R l.L
  18061. . . -> . .
  18062. l.r r.R
  18063. @end example
  18064. @item 2, 6, cclock
  18065. Rotate by 90 degrees counterclockwise, that is:
  18066. @example
  18067. L.R R.r
  18068. . . -> . .
  18069. l.r L.l
  18070. @end example
  18071. @item 3, 7, clock_flip
  18072. Rotate by 90 degrees clockwise and vertically flip, that is:
  18073. @example
  18074. L.R r.R
  18075. . . -> . .
  18076. l.r l.L
  18077. @end example
  18078. @end table
  18079. For values between 4-7, the transposition is only done if the input
  18080. video geometry is portrait and not landscape. These values are
  18081. deprecated, the @code{passthrough} option should be used instead.
  18082. Numerical values are deprecated, and should be dropped in favor of
  18083. symbolic constants.
  18084. @item passthrough
  18085. Do not apply the transposition if the input geometry matches the one
  18086. specified by the specified value. It accepts the following values:
  18087. @table @samp
  18088. @item none
  18089. Always apply transposition.
  18090. @item portrait
  18091. Preserve portrait geometry (when @var{height} >= @var{width}).
  18092. @item landscape
  18093. Preserve landscape geometry (when @var{width} >= @var{height}).
  18094. @end table
  18095. Default value is @code{none}.
  18096. @end table
  18097. For example to rotate by 90 degrees clockwise and preserve portrait
  18098. layout:
  18099. @example
  18100. transpose=dir=1:passthrough=portrait
  18101. @end example
  18102. The command above can also be specified as:
  18103. @example
  18104. transpose=1:portrait
  18105. @end example
  18106. @section trim
  18107. Trim the input so that the output contains one continuous subpart of the input.
  18108. It accepts the following parameters:
  18109. @table @option
  18110. @item start
  18111. Specify the time of the start of the kept section, i.e. the frame with the
  18112. timestamp @var{start} will be the first frame in the output.
  18113. @item end
  18114. Specify the time of the first frame that will be dropped, i.e. the frame
  18115. immediately preceding the one with the timestamp @var{end} will be the last
  18116. frame in the output.
  18117. @item start_pts
  18118. This is the same as @var{start}, except this option sets the start timestamp
  18119. in timebase units instead of seconds.
  18120. @item end_pts
  18121. This is the same as @var{end}, except this option sets the end timestamp
  18122. in timebase units instead of seconds.
  18123. @item duration
  18124. The maximum duration of the output in seconds.
  18125. @item start_frame
  18126. The number of the first frame that should be passed to the output.
  18127. @item end_frame
  18128. The number of the first frame that should be dropped.
  18129. @end table
  18130. @option{start}, @option{end}, and @option{duration} are expressed as time
  18131. duration specifications; see
  18132. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18133. for the accepted syntax.
  18134. Note that the first two sets of the start/end options and the @option{duration}
  18135. option look at the frame timestamp, while the _frame variants simply count the
  18136. frames that pass through the filter. Also note that this filter does not modify
  18137. the timestamps. If you wish for the output timestamps to start at zero, insert a
  18138. setpts filter after the trim filter.
  18139. If multiple start or end options are set, this filter tries to be greedy and
  18140. keep all the frames that match at least one of the specified constraints. To keep
  18141. only the part that matches all the constraints at once, chain multiple trim
  18142. filters.
  18143. The defaults are such that all the input is kept. So it is possible to set e.g.
  18144. just the end values to keep everything before the specified time.
  18145. Examples:
  18146. @itemize
  18147. @item
  18148. Drop everything except the second minute of input:
  18149. @example
  18150. ffmpeg -i INPUT -vf trim=60:120
  18151. @end example
  18152. @item
  18153. Keep only the first second:
  18154. @example
  18155. ffmpeg -i INPUT -vf trim=duration=1
  18156. @end example
  18157. @end itemize
  18158. @section unpremultiply
  18159. Apply alpha unpremultiply effect to input video stream using first plane
  18160. of second stream as alpha.
  18161. Both streams must have same dimensions and same pixel format.
  18162. The filter accepts the following option:
  18163. @table @option
  18164. @item planes
  18165. Set which planes will be processed, unprocessed planes will be copied.
  18166. By default value 0xf, all planes will be processed.
  18167. If the format has 1 or 2 components, then luma is bit 0.
  18168. If the format has 3 or 4 components:
  18169. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  18170. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  18171. If present, the alpha channel is always the last bit.
  18172. @item inplace
  18173. Do not require 2nd input for processing, instead use alpha plane from input stream.
  18174. @end table
  18175. @anchor{unsharp}
  18176. @section unsharp
  18177. Sharpen or blur the input video.
  18178. It accepts the following parameters:
  18179. @table @option
  18180. @item luma_msize_x, lx
  18181. Set the luma matrix horizontal size. It must be an odd integer between
  18182. 3 and 23. The default value is 5.
  18183. @item luma_msize_y, ly
  18184. Set the luma matrix vertical size. It must be an odd integer between 3
  18185. and 23. The default value is 5.
  18186. @item luma_amount, la
  18187. Set the luma effect strength. It must be a floating point number, reasonable
  18188. values lay between -1.5 and 1.5.
  18189. Negative values will blur the input video, while positive values will
  18190. sharpen it, a value of zero will disable the effect.
  18191. Default value is 1.0.
  18192. @item chroma_msize_x, cx
  18193. Set the chroma matrix horizontal size. It must be an odd integer
  18194. between 3 and 23. The default value is 5.
  18195. @item chroma_msize_y, cy
  18196. Set the chroma matrix vertical size. It must be an odd integer
  18197. between 3 and 23. The default value is 5.
  18198. @item chroma_amount, ca
  18199. Set the chroma effect strength. It must be a floating point number, reasonable
  18200. values lay between -1.5 and 1.5.
  18201. Negative values will blur the input video, while positive values will
  18202. sharpen it, a value of zero will disable the effect.
  18203. Default value is 0.0.
  18204. @item alpha_msize_x, ax
  18205. Set the alpha matrix horizontal size. It must be an odd integer
  18206. between 3 and 23. The default value is 5.
  18207. @item alpha_msize_y, ay
  18208. Set the alpha matrix vertical size. It must be an odd integer
  18209. between 3 and 23. The default value is 5.
  18210. @item alpha_amount, aa
  18211. Set the alpha effect strength. It must be a floating point number, reasonable
  18212. values lay between -1.5 and 1.5.
  18213. Negative values will blur the input video, while positive values will
  18214. sharpen it, a value of zero will disable the effect.
  18215. Default value is 0.0.
  18216. @end table
  18217. All parameters are optional and default to the equivalent of the
  18218. string '5:5:1.0:5:5:0.0'.
  18219. @subsection Examples
  18220. @itemize
  18221. @item
  18222. Apply strong luma sharpen effect:
  18223. @example
  18224. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  18225. @end example
  18226. @item
  18227. Apply a strong blur of both luma and chroma parameters:
  18228. @example
  18229. unsharp=7:7:-2:7:7:-2
  18230. @end example
  18231. @end itemize
  18232. @anchor{untile}
  18233. @section untile
  18234. Decompose a video made of tiled images into the individual images.
  18235. The frame rate of the output video is the frame rate of the input video
  18236. multiplied by the number of tiles.
  18237. This filter does the reverse of @ref{tile}.
  18238. The filter accepts the following options:
  18239. @table @option
  18240. @item layout
  18241. Set the grid size (i.e. the number of lines and columns). For the syntax of
  18242. this option, check the
  18243. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18244. @end table
  18245. @subsection Examples
  18246. @itemize
  18247. @item
  18248. Produce a 1-second video from a still image file made of 25 frames stacked
  18249. vertically, like an analogic film reel:
  18250. @example
  18251. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  18252. @end example
  18253. @end itemize
  18254. @section uspp
  18255. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  18256. the image at several (or - in the case of @option{quality} level @code{8} - all)
  18257. shifts and average the results.
  18258. The way this differs from the behavior of spp is that uspp actually encodes &
  18259. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  18260. DCT similar to MJPEG.
  18261. This filter is not available in ffmpeg versions between 5.0 and 6.0.
  18262. The filter accepts the following options:
  18263. @table @option
  18264. @item quality
  18265. Set quality. This option defines the number of levels for averaging. It accepts
  18266. an integer in the range 0-8. If set to @code{0}, the filter will have no
  18267. effect. A value of @code{8} means the higher quality. For each increment of
  18268. that value the speed drops by a factor of approximately 2. Default value is
  18269. @code{3}.
  18270. @item qp
  18271. Force a constant quantization parameter. If not set, the filter will use the QP
  18272. from the video stream (if available).
  18273. @item codec
  18274. Use specified codec instead of snow.
  18275. @end table
  18276. @section v360
  18277. Convert 360 videos between various formats.
  18278. The filter accepts the following options:
  18279. @table @option
  18280. @item input
  18281. @item output
  18282. Set format of the input/output video.
  18283. Available formats:
  18284. @table @samp
  18285. @item e
  18286. @item equirect
  18287. Equirectangular projection.
  18288. @item c3x2
  18289. @item c6x1
  18290. @item c1x6
  18291. Cubemap with 3x2/6x1/1x6 layout.
  18292. Format specific options:
  18293. @table @option
  18294. @item in_pad
  18295. @item out_pad
  18296. Set padding proportion for the input/output cubemap. Values in decimals.
  18297. Example values:
  18298. @table @samp
  18299. @item 0
  18300. No padding.
  18301. @item 0.01
  18302. 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)
  18303. @end table
  18304. Default value is @b{@samp{0}}.
  18305. Maximum value is @b{@samp{0.1}}.
  18306. @item fin_pad
  18307. @item fout_pad
  18308. Set fixed padding for the input/output cubemap. Values in pixels.
  18309. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  18310. @item in_forder
  18311. @item out_forder
  18312. Set order of faces for the input/output cubemap. Choose one direction for each position.
  18313. Designation of directions:
  18314. @table @samp
  18315. @item r
  18316. right
  18317. @item l
  18318. left
  18319. @item u
  18320. up
  18321. @item d
  18322. down
  18323. @item f
  18324. forward
  18325. @item b
  18326. back
  18327. @end table
  18328. Default value is @b{@samp{rludfb}}.
  18329. @item in_frot
  18330. @item out_frot
  18331. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  18332. Designation of angles:
  18333. @table @samp
  18334. @item 0
  18335. 0 degrees clockwise
  18336. @item 1
  18337. 90 degrees clockwise
  18338. @item 2
  18339. 180 degrees clockwise
  18340. @item 3
  18341. 270 degrees clockwise
  18342. @end table
  18343. Default value is @b{@samp{000000}}.
  18344. @end table
  18345. @item eac
  18346. Equi-Angular Cubemap.
  18347. @item flat
  18348. @item gnomonic
  18349. @item rectilinear
  18350. Regular video.
  18351. Format specific options:
  18352. @table @option
  18353. @item h_fov
  18354. @item v_fov
  18355. @item d_fov
  18356. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18357. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18358. @item ih_fov
  18359. @item iv_fov
  18360. @item id_fov
  18361. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18362. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18363. @end table
  18364. @item dfisheye
  18365. Dual fisheye.
  18366. Format specific options:
  18367. @table @option
  18368. @item h_fov
  18369. @item v_fov
  18370. @item d_fov
  18371. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18372. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18373. @item ih_fov
  18374. @item iv_fov
  18375. @item id_fov
  18376. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18377. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18378. @end table
  18379. @item barrel
  18380. @item fb
  18381. @item barrelsplit
  18382. Facebook's 360 formats.
  18383. @item sg
  18384. Stereographic format.
  18385. Format specific options:
  18386. @table @option
  18387. @item h_fov
  18388. @item v_fov
  18389. @item d_fov
  18390. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18391. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18392. @item ih_fov
  18393. @item iv_fov
  18394. @item id_fov
  18395. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18396. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18397. @end table
  18398. @item mercator
  18399. Mercator format.
  18400. @item ball
  18401. Ball format, gives significant distortion toward the back.
  18402. @item hammer
  18403. Hammer-Aitoff map projection format.
  18404. @item sinusoidal
  18405. Sinusoidal map projection format.
  18406. @item fisheye
  18407. Fisheye projection.
  18408. Format specific options:
  18409. @table @option
  18410. @item h_fov
  18411. @item v_fov
  18412. @item d_fov
  18413. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18414. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18415. @item ih_fov
  18416. @item iv_fov
  18417. @item id_fov
  18418. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18419. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18420. @end table
  18421. @item pannini
  18422. Pannini projection.
  18423. Format specific options:
  18424. @table @option
  18425. @item h_fov
  18426. Set output pannini parameter.
  18427. @item ih_fov
  18428. Set input pannini parameter.
  18429. @end table
  18430. @item cylindrical
  18431. Cylindrical projection.
  18432. Format specific options:
  18433. @table @option
  18434. @item h_fov
  18435. @item v_fov
  18436. @item d_fov
  18437. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18438. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18439. @item ih_fov
  18440. @item iv_fov
  18441. @item id_fov
  18442. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18443. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18444. @end table
  18445. @item perspective
  18446. Perspective projection. @i{(output only)}
  18447. Format specific options:
  18448. @table @option
  18449. @item v_fov
  18450. Set perspective parameter.
  18451. @end table
  18452. @item tetrahedron
  18453. Tetrahedron projection.
  18454. @item tsp
  18455. Truncated square pyramid projection.
  18456. @item he
  18457. @item hequirect
  18458. Half equirectangular projection.
  18459. @item equisolid
  18460. Equisolid format.
  18461. Format specific options:
  18462. @table @option
  18463. @item h_fov
  18464. @item v_fov
  18465. @item d_fov
  18466. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18467. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18468. @item ih_fov
  18469. @item iv_fov
  18470. @item id_fov
  18471. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18472. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18473. @end table
  18474. @item og
  18475. Orthographic format.
  18476. Format specific options:
  18477. @table @option
  18478. @item h_fov
  18479. @item v_fov
  18480. @item d_fov
  18481. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18482. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18483. @item ih_fov
  18484. @item iv_fov
  18485. @item id_fov
  18486. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18487. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18488. @end table
  18489. @item octahedron
  18490. Octahedron projection.
  18491. @item cylindricalea
  18492. Cylindrical Equal Area projection.
  18493. @end table
  18494. @item interp
  18495. Set interpolation method.@*
  18496. @i{Note: more complex interpolation methods require much more memory to run.}
  18497. Available methods:
  18498. @table @samp
  18499. @item near
  18500. @item nearest
  18501. Nearest neighbour.
  18502. @item line
  18503. @item linear
  18504. Bilinear interpolation.
  18505. @item lagrange9
  18506. Lagrange9 interpolation.
  18507. @item cube
  18508. @item cubic
  18509. Bicubic interpolation.
  18510. @item lanc
  18511. @item lanczos
  18512. Lanczos interpolation.
  18513. @item sp16
  18514. @item spline16
  18515. Spline16 interpolation.
  18516. @item gauss
  18517. @item gaussian
  18518. Gaussian interpolation.
  18519. @item mitchell
  18520. Mitchell interpolation.
  18521. @end table
  18522. Default value is @b{@samp{line}}.
  18523. @item w
  18524. @item h
  18525. Set the output video resolution.
  18526. Default resolution depends on formats.
  18527. @item in_stereo
  18528. @item out_stereo
  18529. Set the input/output stereo format.
  18530. @table @samp
  18531. @item 2d
  18532. 2D mono
  18533. @item sbs
  18534. Side by side
  18535. @item tb
  18536. Top bottom
  18537. @end table
  18538. Default value is @b{@samp{2d}} for input and output format.
  18539. @item yaw
  18540. @item pitch
  18541. @item roll
  18542. Set rotation for the output video. Values in degrees.
  18543. @item rorder
  18544. Set rotation order for the output video. Choose one item for each position.
  18545. @table @samp
  18546. @item y, Y
  18547. yaw
  18548. @item p, P
  18549. pitch
  18550. @item r, R
  18551. roll
  18552. @end table
  18553. Default value is @b{@samp{ypr}}.
  18554. @item h_flip
  18555. @item v_flip
  18556. @item d_flip
  18557. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  18558. @item ih_flip
  18559. @item iv_flip
  18560. Set if input video is flipped horizontally/vertically. Boolean values.
  18561. @item in_trans
  18562. Set if input video is transposed. Boolean value, by default disabled.
  18563. @item out_trans
  18564. Set if output video needs to be transposed. Boolean value, by default disabled.
  18565. @item h_offset
  18566. @item v_offset
  18567. Set output horizontal/vertical off-axis offset. Default is set to 0.
  18568. Allowed range is from -1 to 1.
  18569. @item alpha_mask
  18570. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  18571. @item reset_rot
  18572. Reset rotation of output video. Boolean value, by default disabled.
  18573. @end table
  18574. @subsection Examples
  18575. @itemize
  18576. @item
  18577. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  18578. @example
  18579. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  18580. @end example
  18581. @item
  18582. Extract back view of Equi-Angular Cubemap:
  18583. @example
  18584. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  18585. @end example
  18586. @item
  18587. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  18588. @example
  18589. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  18590. @end example
  18591. @end itemize
  18592. @subsection Commands
  18593. This filter supports subset of above options as @ref{commands}.
  18594. @section vaguedenoiser
  18595. Apply a wavelet based denoiser.
  18596. It transforms each frame from the video input into the wavelet domain,
  18597. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  18598. the obtained coefficients. It does an inverse wavelet transform after.
  18599. Due to wavelet properties, it should give a nice smoothed result, and
  18600. reduced noise, without blurring picture features.
  18601. This filter accepts the following options:
  18602. @table @option
  18603. @item threshold
  18604. The filtering strength. The higher, the more filtered the video will be.
  18605. Hard thresholding can use a higher threshold than soft thresholding
  18606. before the video looks overfiltered. Default value is 2.
  18607. @item method
  18608. The filtering method the filter will use.
  18609. It accepts the following values:
  18610. @table @samp
  18611. @item hard
  18612. All values under the threshold will be zeroed.
  18613. @item soft
  18614. All values under the threshold will be zeroed. All values above will be
  18615. reduced by the threshold.
  18616. @item garrote
  18617. Scales or nullifies coefficients - intermediary between (more) soft and
  18618. (less) hard thresholding.
  18619. @end table
  18620. Default is garrote.
  18621. @item nsteps
  18622. Number of times, the wavelet will decompose the picture. Picture can't
  18623. be decomposed beyond a particular point (typically, 8 for a 640x480
  18624. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  18625. @item percent
  18626. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  18627. @item planes
  18628. A list of the planes to process. By default all planes are processed.
  18629. @item type
  18630. The threshold type the filter will use.
  18631. It accepts the following values:
  18632. @table @samp
  18633. @item universal
  18634. Threshold used is same for all decompositions.
  18635. @item bayes
  18636. Threshold used depends also on each decomposition coefficients.
  18637. @end table
  18638. Default is universal.
  18639. @end table
  18640. @section varblur
  18641. Apply variable blur filter by using 2nd video stream to set blur radius.
  18642. The 2nd stream must have the same dimensions.
  18643. This filter accepts the following options:
  18644. @table @option
  18645. @item min_r
  18646. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  18647. @item max_r
  18648. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  18649. @item planes
  18650. Set which planes to process. By default, all are used.
  18651. @end table
  18652. The @code{varblur} filter also supports the @ref{framesync} options.
  18653. @subsection Commands
  18654. This filter supports all the above options as @ref{commands}.
  18655. @section vectorscope
  18656. Display 2 color component values in the two dimensional graph (which is called
  18657. a vectorscope).
  18658. This filter accepts the following options:
  18659. @table @option
  18660. @item mode, m
  18661. Set vectorscope mode.
  18662. It accepts the following values:
  18663. @table @samp
  18664. @item gray
  18665. @item tint
  18666. Gray values are displayed on graph, higher brightness means more pixels have
  18667. same component color value on location in graph. This is the default mode.
  18668. @item color
  18669. Gray values are displayed on graph. Surrounding pixels values which are not
  18670. present in video frame are drawn in gradient of 2 color components which are
  18671. set by option @code{x} and @code{y}. The 3rd color component is static.
  18672. @item color2
  18673. Actual color components values present in video frame are displayed on graph.
  18674. @item color3
  18675. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  18676. on graph increases value of another color component, which is luminance by
  18677. default values of @code{x} and @code{y}.
  18678. @item color4
  18679. Actual colors present in video frame are displayed on graph. If two different
  18680. colors map to same position on graph then color with higher value of component
  18681. not present in graph is picked.
  18682. @item color5
  18683. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  18684. component picked from radial gradient.
  18685. @end table
  18686. @item x
  18687. Set which color component will be represented on X-axis. Default is @code{1}.
  18688. @item y
  18689. Set which color component will be represented on Y-axis. Default is @code{2}.
  18690. @item intensity, i
  18691. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  18692. of color component which represents frequency of (X, Y) location in graph.
  18693. @item envelope, e
  18694. @table @samp
  18695. @item none
  18696. No envelope, this is default.
  18697. @item instant
  18698. Instant envelope, even darkest single pixel will be clearly highlighted.
  18699. @item peak
  18700. Hold maximum and minimum values presented in graph over time. This way you
  18701. can still spot out of range values without constantly looking at vectorscope.
  18702. @item peak+instant
  18703. Peak and instant envelope combined together.
  18704. @end table
  18705. @item graticule, g
  18706. Set what kind of graticule to draw.
  18707. @table @samp
  18708. @item none
  18709. @item green
  18710. @item color
  18711. @item invert
  18712. @end table
  18713. @item opacity, o
  18714. Set graticule opacity.
  18715. @item flags, f
  18716. Set graticule flags.
  18717. @table @samp
  18718. @item white
  18719. Draw graticule for white point.
  18720. @item black
  18721. Draw graticule for black point.
  18722. @item name
  18723. Draw color points short names.
  18724. @end table
  18725. @item bgopacity, b
  18726. Set background opacity.
  18727. @item lthreshold, l
  18728. Set low threshold for color component not represented on X or Y axis.
  18729. Values lower than this value will be ignored. Default is 0.
  18730. Note this value is multiplied with actual max possible value one pixel component
  18731. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  18732. is 0.1 * 255 = 25.
  18733. @item hthreshold, h
  18734. Set high threshold for color component not represented on X or Y axis.
  18735. Values higher than this value will be ignored. Default is 1.
  18736. Note this value is multiplied with actual max possible value one pixel component
  18737. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  18738. is 0.9 * 255 = 230.
  18739. @item colorspace, c
  18740. Set what kind of colorspace to use when drawing graticule.
  18741. @table @samp
  18742. @item auto
  18743. @item 601
  18744. @item 709
  18745. @end table
  18746. Default is auto.
  18747. @item tint0, t0
  18748. @item tint1, t1
  18749. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  18750. This means no tint, and output will remain gray.
  18751. @end table
  18752. @anchor{vidstabdetect}
  18753. @section vidstabdetect
  18754. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  18755. @ref{vidstabtransform} for pass 2.
  18756. This filter generates a file with relative translation and rotation
  18757. transform information about subsequent frames, which is then used by
  18758. the @ref{vidstabtransform} filter.
  18759. To enable compilation of this filter you need to configure FFmpeg with
  18760. @code{--enable-libvidstab}.
  18761. This filter accepts the following options:
  18762. @table @option
  18763. @item result
  18764. Set the path to the file used to write the transforms information.
  18765. Default value is @file{transforms.trf}.
  18766. @item shakiness
  18767. Set how shaky the video is and how quick the camera is. It accepts an
  18768. integer in the range 1-10, a value of 1 means little shakiness, a
  18769. value of 10 means strong shakiness. Default value is 5.
  18770. @item accuracy
  18771. Set the accuracy of the detection process. It must be a value in the
  18772. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  18773. accuracy. Default value is 15.
  18774. @item stepsize
  18775. Set stepsize of the search process. The region around minimum is
  18776. scanned with 1 pixel resolution. Default value is 6.
  18777. @item mincontrast
  18778. Set minimum contrast. Below this value a local measurement field is
  18779. discarded. Must be a floating point value in the range 0-1. Default
  18780. value is 0.3.
  18781. @item tripod
  18782. Set reference frame number for tripod mode.
  18783. If enabled, the motion of the frames is compared to a reference frame
  18784. in the filtered stream, identified by the specified number. The idea
  18785. is to compensate all movements in a more-or-less static scene and keep
  18786. the camera view absolutely still.
  18787. If set to 0, it is disabled. The frames are counted starting from 1.
  18788. @item show
  18789. Show fields and transforms in the resulting frames. It accepts an
  18790. integer in the range 0-2. Default value is 0, which disables any
  18791. visualization.
  18792. @item fileformat
  18793. Format for the transforms data file to be written.
  18794. Acceptable values are
  18795. @table @samp
  18796. @item ascii
  18797. Human-readable plain text
  18798. @item binary
  18799. Binary format, roughly 40% smaller than @code{ascii}. (@emph{default})
  18800. @end table
  18801. @end table
  18802. @subsection Examples
  18803. @itemize
  18804. @item
  18805. Use default values:
  18806. @example
  18807. vidstabdetect
  18808. @end example
  18809. @item
  18810. Analyze strongly shaky movie and put the results in file
  18811. @file{mytransforms.trf}:
  18812. @example
  18813. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  18814. @end example
  18815. @item
  18816. Visualize the result of internal transformations in the resulting
  18817. video:
  18818. @example
  18819. vidstabdetect=show=1
  18820. @end example
  18821. @item
  18822. Analyze a video with medium shakiness using @command{ffmpeg}:
  18823. @example
  18824. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  18825. @end example
  18826. @end itemize
  18827. @anchor{vidstabtransform}
  18828. @section vidstabtransform
  18829. Video stabilization/deshaking: pass 2 of 2,
  18830. see @ref{vidstabdetect} for pass 1.
  18831. Read a file with transform information for each frame and
  18832. apply/compensate them. Together with the @ref{vidstabdetect}
  18833. filter this can be used to deshake videos. See also
  18834. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  18835. the @ref{unsharp} filter, see below.
  18836. To enable compilation of this filter you need to configure FFmpeg with
  18837. @code{--enable-libvidstab}.
  18838. @subsection Options
  18839. @table @option
  18840. @item input
  18841. Set path to the file used to read the transforms. Default value is
  18842. @file{transforms.trf}.
  18843. @item smoothing
  18844. Set the number of frames (value*2 + 1) used for lowpass filtering the
  18845. camera movements. Default value is 10.
  18846. For example a number of 10 means that 21 frames are used (10 in the
  18847. past and 10 in the future) to smoothen the motion in the video. A
  18848. larger value leads to a smoother video, but limits the acceleration of
  18849. the camera (pan/tilt movements). 0 is a special case where a static
  18850. camera is simulated.
  18851. @item optalgo
  18852. Set the camera path optimization algorithm.
  18853. Accepted values are:
  18854. @table @samp
  18855. @item gauss
  18856. gaussian kernel low-pass filter on camera motion (default)
  18857. @item avg
  18858. averaging on transformations
  18859. @end table
  18860. @item maxshift
  18861. Set maximal number of pixels to translate frames. Default value is -1,
  18862. meaning no limit.
  18863. @item maxangle
  18864. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  18865. value is -1, meaning no limit.
  18866. @item crop
  18867. Specify how to deal with borders that may be visible due to movement
  18868. compensation.
  18869. Available values are:
  18870. @table @samp
  18871. @item keep
  18872. keep image information from previous frame (default)
  18873. @item black
  18874. fill the border black
  18875. @end table
  18876. @item invert
  18877. Invert transforms if set to 1. Default value is 0.
  18878. @item relative
  18879. Consider transforms as relative to previous frame if set to 1,
  18880. absolute if set to 0. Default value is 0.
  18881. @item zoom
  18882. Set percentage to zoom. A positive value will result in a zoom-in
  18883. effect, a negative value in a zoom-out effect. Default value is 0 (no
  18884. zoom).
  18885. @item optzoom
  18886. Set optimal zooming to avoid borders.
  18887. Accepted values are:
  18888. @table @samp
  18889. @item 0
  18890. disabled
  18891. @item 1
  18892. optimal static zoom value is determined (only very strong movements
  18893. will lead to visible borders) (default)
  18894. @item 2
  18895. optimal adaptive zoom value is determined (no borders will be
  18896. visible), see @option{zoomspeed}
  18897. @end table
  18898. Note that the value given at zoom is added to the one calculated here.
  18899. @item zoomspeed
  18900. Set percent to zoom maximally each frame (enabled when
  18901. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  18902. 0.25.
  18903. @item interpol
  18904. Specify type of interpolation.
  18905. Available values are:
  18906. @table @samp
  18907. @item no
  18908. no interpolation
  18909. @item linear
  18910. linear only horizontal
  18911. @item bilinear
  18912. linear in both directions (default)
  18913. @item bicubic
  18914. cubic in both directions (slow)
  18915. @end table
  18916. @item tripod
  18917. Enable virtual tripod mode if set to 1, which is equivalent to
  18918. @code{relative=0:smoothing=0}. Default value is 0.
  18919. Use also @code{tripod} option of @ref{vidstabdetect}.
  18920. @item debug
  18921. Increase log verbosity if set to 1. Also the detected global motions
  18922. are written to the temporary file @file{global_motions.trf}. Default
  18923. value is 0.
  18924. @end table
  18925. @subsection Examples
  18926. @itemize
  18927. @item
  18928. Use @command{ffmpeg} for a typical stabilization with default values:
  18929. @example
  18930. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  18931. @end example
  18932. Note the use of the @ref{unsharp} filter which is always recommended.
  18933. @item
  18934. Zoom in a bit more and load transform data from a given file:
  18935. @example
  18936. vidstabtransform=zoom=5:input="mytransforms.trf"
  18937. @end example
  18938. @item
  18939. Smoothen the video even more:
  18940. @example
  18941. vidstabtransform=smoothing=30
  18942. @end example
  18943. @end itemize
  18944. @section vflip
  18945. Flip the input video vertically.
  18946. For example, to vertically flip a video with @command{ffmpeg}:
  18947. @example
  18948. ffmpeg -i in.avi -vf "vflip" out.avi
  18949. @end example
  18950. @section vfrdet
  18951. Detect variable frame rate video.
  18952. This filter tries to detect if the input is variable or constant frame rate.
  18953. At end it will output number of frames detected as having variable delta pts,
  18954. and ones with constant delta pts.
  18955. If there was frames with variable delta, than it will also show min, max and
  18956. average delta encountered.
  18957. @section vibrance
  18958. Boost or alter saturation.
  18959. The filter accepts the following options:
  18960. @table @option
  18961. @item intensity
  18962. Set strength of boost if positive value or strength of alter if negative value.
  18963. Default is 0. Allowed range is from -2 to 2.
  18964. @item rbal
  18965. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  18966. @item gbal
  18967. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  18968. @item bbal
  18969. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  18970. @item rlum
  18971. Set the red luma coefficient.
  18972. @item glum
  18973. Set the green luma coefficient.
  18974. @item blum
  18975. Set the blue luma coefficient.
  18976. @item alternate
  18977. If @code{intensity} is negative and this is set to 1, colors will change,
  18978. otherwise colors will be less saturated, more towards gray.
  18979. @end table
  18980. @subsection Commands
  18981. This filter supports the all above options as @ref{commands}.
  18982. @section vif
  18983. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  18984. This filter takes two input videos.
  18985. Both input videos must have the same resolution and pixel format for
  18986. this filter to work correctly. Also it assumes that both inputs
  18987. have the same number of frames, which are compared one by one.
  18988. The obtained average VIF score is printed through the logging system.
  18989. The filter stores the calculated VIF score of each frame.
  18990. This filter also supports the @ref{framesync} options.
  18991. In the below example the input file @file{main.mpg} being processed is compared
  18992. with the reference file @file{ref.mpg}.
  18993. @example
  18994. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  18995. @end example
  18996. @anchor{vignette}
  18997. @section vignette
  18998. Make or reverse a natural vignetting effect.
  18999. The filter accepts the following options:
  19000. @table @option
  19001. @item angle, a
  19002. Set lens angle expression as a number of radians.
  19003. The value is clipped in the @code{[0,PI/2]} range.
  19004. Default value: @code{"PI/5"}
  19005. @item x0
  19006. @item y0
  19007. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  19008. by default.
  19009. @item mode
  19010. Set forward/backward mode.
  19011. Available modes are:
  19012. @table @samp
  19013. @item forward
  19014. The larger the distance from the central point, the darker the image becomes.
  19015. @item backward
  19016. The larger the distance from the central point, the brighter the image becomes.
  19017. This can be used to reverse a vignette effect, though there is no automatic
  19018. detection to extract the lens @option{angle} and other settings (yet). It can
  19019. also be used to create a burning effect.
  19020. @end table
  19021. Default value is @samp{forward}.
  19022. @item eval
  19023. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  19024. It accepts the following values:
  19025. @table @samp
  19026. @item init
  19027. Evaluate expressions only once during the filter initialization.
  19028. @item frame
  19029. Evaluate expressions for each incoming frame. This is way slower than the
  19030. @samp{init} mode since it requires all the scalers to be re-computed, but it
  19031. allows advanced dynamic expressions.
  19032. @end table
  19033. Default value is @samp{init}.
  19034. @item dither
  19035. Set dithering to reduce the circular banding effects. Default is @code{1}
  19036. (enabled).
  19037. @item aspect
  19038. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  19039. Setting this value to the SAR of the input will make a rectangular vignetting
  19040. following the dimensions of the video.
  19041. Default is @code{1/1}.
  19042. @end table
  19043. @subsection Expressions
  19044. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  19045. following parameters.
  19046. @table @option
  19047. @item w
  19048. @item h
  19049. input width and height
  19050. @item n
  19051. the number of input frame, starting from 0
  19052. @item pts
  19053. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  19054. @var{TB} units, NAN if undefined
  19055. @item r
  19056. frame rate of the input video, NAN if the input frame rate is unknown
  19057. @item t
  19058. the PTS (Presentation TimeStamp) of the filtered video frame,
  19059. expressed in seconds, NAN if undefined
  19060. @item tb
  19061. time base of the input video
  19062. @end table
  19063. @subsection Examples
  19064. @itemize
  19065. @item
  19066. Apply simple strong vignetting effect:
  19067. @example
  19068. vignette=PI/4
  19069. @end example
  19070. @item
  19071. Make a flickering vignetting:
  19072. @example
  19073. vignette='PI/4+random(1)*PI/50':eval=frame
  19074. @end example
  19075. @end itemize
  19076. @section vmafmotion
  19077. Obtain the average VMAF motion score of a video.
  19078. It is one of the component metrics of VMAF.
  19079. The obtained average motion score is printed through the logging system.
  19080. The filter accepts the following options:
  19081. @table @option
  19082. @item stats_file
  19083. If specified, the filter will use the named file to save the motion score of
  19084. each frame with respect to the previous frame.
  19085. When filename equals "-" the data is sent to standard output.
  19086. @end table
  19087. Example:
  19088. @example
  19089. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  19090. @end example
  19091. @anchor{vpp_amf}
  19092. @section vpp_amf
  19093. Scale (resize) and convert colorspace, transfer characteristics or color primaries for the input video, using AMD Advanced Media Framework library for hardware acceleration.
  19094. Setting the output width and height works in the same way as for the @ref{scale} filter.
  19095. The filter accepts the following options:
  19096. @table @option
  19097. @item w
  19098. @item h
  19099. Set the output video dimension expression. Default value is the input dimension.
  19100. Allows for the same expressions as the @ref{scale} filter.
  19101. @item scale_type
  19102. Sets the algorithm used for scaling:
  19103. @table @var
  19104. @item bilinear
  19105. Bilinear
  19106. This is the default.
  19107. @item bicubic
  19108. Bicubic
  19109. @end table
  19110. @item format
  19111. Controls the output pixel format. By default, or if none is specified, the input
  19112. pixel format is used.
  19113. @item force_original_aspect_ratio
  19114. @item force_divisible_by
  19115. Work the same as the identical @ref{scale} filter options.
  19116. @item reset_sar
  19117. Works the same as the identical @ref{scale} filter option.
  19118. @anchor{color_profile}
  19119. @item color_profile
  19120. Specify all color properties at once.
  19121. The accepted values are:
  19122. @table @samp
  19123. @item bt601
  19124. BT.601
  19125. @item bt709
  19126. BT.709
  19127. @item bt2020
  19128. BT.2020
  19129. @end table
  19130. @item trc
  19131. Specify output transfer characteristics.
  19132. The accepted values are:
  19133. @table @samp
  19134. @item bt709
  19135. BT.709
  19136. @item gamma22
  19137. Constant gamma of 2.2
  19138. @item gamma28
  19139. Constant gamma of 2.8
  19140. @item smpte170m
  19141. SMPTE-170M
  19142. @item smpte240m
  19143. SMPTE-240M
  19144. @item linear
  19145. Linear
  19146. @item log
  19147. LOG
  19148. @item log-sqrt
  19149. LOG_SQRT
  19150. @item iec61966-2-4
  19151. iec61966-2-4
  19152. @item bt1361-ecg
  19153. BT1361_ECG
  19154. @item iec61966-2-1
  19155. iec61966-2-1
  19156. @item bt2020-10
  19157. BT.2020 for 10-bits content
  19158. @item bt2020-12
  19159. BT.2020 for 12-bits content
  19160. @item smpte2084
  19161. SMPTE2084
  19162. @item smpte428
  19163. SMPTE428
  19164. @item arib-std-b67
  19165. ARIB_STD_B67
  19166. @end table
  19167. @item primaries
  19168. Specify output color primaries.
  19169. The accepted values are:
  19170. @table @samp
  19171. @item bt709
  19172. BT.709
  19173. @item bt470m
  19174. BT.470M
  19175. @item bt470bg
  19176. BT.470BG or BT.601-6 625
  19177. @item smpte170m
  19178. SMPTE-170M or BT.601-6 525
  19179. @item smpte240m
  19180. SMPTE-240M
  19181. @item film
  19182. film
  19183. @item bt2020
  19184. BT.2020
  19185. @item smpte428
  19186. SMPTE-428
  19187. @item smpte431
  19188. SMPTE-431
  19189. @item smpte432
  19190. SMPTE-432
  19191. @item jedec-p22
  19192. JEDEC P22 phosphors
  19193. @end table
  19194. @end table
  19195. @subsection Examples
  19196. @itemize
  19197. @item
  19198. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  19199. @example
  19200. vpp_amf=-2:720:format=yuv420p
  19201. @end example
  19202. @item
  19203. Upscale to 4K and change color profile to bt2020.
  19204. @example
  19205. vpp_amf=4096:2160:color_profile=bt2020
  19206. @end example
  19207. @end itemize
  19208. @anchor{vstack}
  19209. @section vstack
  19210. Stack input videos vertically.
  19211. All streams must be of same pixel format and of same width.
  19212. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  19213. to create same output.
  19214. The filter accepts the following options:
  19215. @table @option
  19216. @item inputs
  19217. Set number of input streams. Default is 2.
  19218. @item shortest
  19219. If set to 1, force the output to terminate when the shortest input
  19220. terminates. Default value is 0.
  19221. @end table
  19222. @section w3fdif
  19223. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  19224. Deinterlacing Filter").
  19225. Based on the process described by Martin Weston for BBC R&D, and
  19226. implemented based on the de-interlace algorithm written by Jim
  19227. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  19228. uses filter coefficients calculated by BBC R&D.
  19229. This filter uses field-dominance information in frame to decide which
  19230. of each pair of fields to place first in the output.
  19231. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  19232. There are two sets of filter coefficients, so called "simple"
  19233. and "complex". Which set of filter coefficients is used can
  19234. be set by passing an optional parameter:
  19235. @table @option
  19236. @item filter
  19237. Set the interlacing filter coefficients. Accepts one of the following values:
  19238. @table @samp
  19239. @item simple
  19240. Simple filter coefficient set.
  19241. @item complex
  19242. More-complex filter coefficient set.
  19243. @end table
  19244. Default value is @samp{complex}.
  19245. @item mode
  19246. The interlacing mode to adopt. It accepts one of the following values:
  19247. @table @option
  19248. @item frame
  19249. Output one frame for each frame.
  19250. @item field
  19251. Output one frame for each field.
  19252. @end table
  19253. The default value is @code{field}.
  19254. @item parity
  19255. The picture field parity assumed for the input interlaced video. It accepts one
  19256. of the following values:
  19257. @table @option
  19258. @item tff
  19259. Assume the top field is first.
  19260. @item bff
  19261. Assume the bottom field is first.
  19262. @item auto
  19263. Enable automatic detection of field parity.
  19264. @end table
  19265. The default value is @code{auto}.
  19266. If the interlacing is unknown or the decoder does not export this information,
  19267. top field first will be assumed.
  19268. @item deint
  19269. Specify which frames to deinterlace. Accepts one of the following values:
  19270. @table @samp
  19271. @item all
  19272. Deinterlace all frames,
  19273. @item interlaced
  19274. Only deinterlace frames marked as interlaced.
  19275. @end table
  19276. Default value is @samp{all}.
  19277. @end table
  19278. @subsection Commands
  19279. This filter supports same @ref{commands} as options.
  19280. @section waveform
  19281. Video waveform monitor.
  19282. The waveform monitor plots color component intensity. By default luma
  19283. only. Each column of the waveform corresponds to a column of pixels in the
  19284. source video.
  19285. It accepts the following options:
  19286. @table @option
  19287. @item mode, m
  19288. Can be either @code{row}, or @code{column}. Default is @code{column}.
  19289. In row mode, the graph on the left side represents color component value 0 and
  19290. the right side represents value = 255. In column mode, the top side represents
  19291. color component value = 0 and bottom side represents value = 255.
  19292. @item intensity, i
  19293. Set intensity. Smaller values are useful to find out how many values of the same
  19294. luminance are distributed across input rows/columns.
  19295. Default value is @code{0.04}. Allowed range is [0, 1].
  19296. @item mirror, r
  19297. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  19298. In mirrored mode, higher values will be represented on the left
  19299. side for @code{row} mode and at the top for @code{column} mode. Default is
  19300. @code{1} (mirrored).
  19301. @item display, d
  19302. Set display mode.
  19303. It accepts the following values:
  19304. @table @samp
  19305. @item overlay
  19306. Presents information identical to that in the @code{parade}, except
  19307. that the graphs representing color components are superimposed directly
  19308. over one another.
  19309. This display mode makes it easier to spot relative differences or similarities
  19310. in overlapping areas of the color components that are supposed to be identical,
  19311. such as neutral whites, grays, or blacks.
  19312. @item stack
  19313. Display separate graph for the color components side by side in
  19314. @code{row} mode or one below the other in @code{column} mode.
  19315. @item parade
  19316. Display separate graph for the color components side by side in
  19317. @code{column} mode or one below the other in @code{row} mode.
  19318. Using this display mode makes it easy to spot color casts in the highlights
  19319. and shadows of an image, by comparing the contours of the top and the bottom
  19320. graphs of each waveform. Since whites, grays, and blacks are characterized
  19321. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  19322. should display three waveforms of roughly equal width/height. If not, the
  19323. correction is easy to perform by making level adjustments the three waveforms.
  19324. @end table
  19325. Default is @code{stack}.
  19326. @item components, c
  19327. Set which color components to display. Default is 1, which means only luma
  19328. or red color component if input is in RGB colorspace. If is set for example to
  19329. 7 it will display all 3 (if) available color components.
  19330. @item envelope, e
  19331. @table @samp
  19332. @item none
  19333. No envelope, this is default.
  19334. @item instant
  19335. Instant envelope, minimum and maximum values presented in graph will be easily
  19336. visible even with small @code{step} value.
  19337. @item peak
  19338. Hold minimum and maximum values presented in graph across time. This way you
  19339. can still spot out of range values without constantly looking at waveforms.
  19340. @item peak+instant
  19341. Peak and instant envelope combined together.
  19342. @end table
  19343. @item filter, f
  19344. @table @samp
  19345. @item lowpass
  19346. No filtering, this is default.
  19347. @item flat
  19348. Luma and chroma combined together.
  19349. @item aflat
  19350. Similar as above, but shows difference between blue and red chroma.
  19351. @item xflat
  19352. Similar as above, but use different colors.
  19353. @item yflat
  19354. Similar as above, but again with different colors.
  19355. @item chroma
  19356. Displays only chroma.
  19357. @item color
  19358. Displays actual color value on waveform.
  19359. @item acolor
  19360. Similar as above, but with luma showing frequency of chroma values.
  19361. @end table
  19362. @item graticule, g
  19363. Set which graticule to display.
  19364. @table @samp
  19365. @item none
  19366. Do not display graticule.
  19367. @item green
  19368. Display green graticule showing legal broadcast ranges.
  19369. @item orange
  19370. Display orange graticule showing legal broadcast ranges.
  19371. @item invert
  19372. Display invert graticule showing legal broadcast ranges.
  19373. @end table
  19374. @item opacity, o
  19375. Set graticule opacity.
  19376. @item flags, fl
  19377. Set graticule flags.
  19378. @table @samp
  19379. @item numbers
  19380. Draw numbers above lines. By default enabled.
  19381. @item dots
  19382. Draw dots instead of lines.
  19383. @end table
  19384. @item scale, s
  19385. Set scale used for displaying graticule.
  19386. @table @samp
  19387. @item digital
  19388. @item millivolts
  19389. @item ire
  19390. @end table
  19391. Default is digital.
  19392. @item bgopacity, b
  19393. Set background opacity.
  19394. @item tint0, t0
  19395. @item tint1, t1
  19396. Set tint for output.
  19397. Only used with lowpass filter and when display is not overlay and input
  19398. pixel formats are not RGB.
  19399. @item fitmode, fm
  19400. Set sample aspect ratio of video output frames.
  19401. Can be used to configure waveform so it is not
  19402. streched too much in one of directions.
  19403. @table @samp
  19404. @item none
  19405. Set sample aspect ration to 1/1.
  19406. @item size
  19407. Set sample aspect ratio to match input size of video
  19408. @end table
  19409. Default is @samp{none}.
  19410. @item input
  19411. Set input formats for filter to pick from.
  19412. Can be @samp{all}, for selecting from all available formats,
  19413. or @samp{first}, for selecting first available format.
  19414. Default is @samp{first}.
  19415. @end table
  19416. @section weave, doubleweave
  19417. The @code{weave} takes a field-based video input and join
  19418. each two sequential fields into single frame, producing a new double
  19419. height clip with half the frame rate and half the frame count.
  19420. The @code{doubleweave} works same as @code{weave} but without
  19421. halving frame rate and frame count.
  19422. It accepts the following option:
  19423. @table @option
  19424. @item first_field
  19425. Set first field. Available values are:
  19426. @table @samp
  19427. @item top, t
  19428. Set the frame as top-field-first.
  19429. @item bottom, b
  19430. Set the frame as bottom-field-first.
  19431. @end table
  19432. @end table
  19433. @subsection Examples
  19434. @itemize
  19435. @item
  19436. Interlace video using @ref{select} and @ref{separatefields} filter:
  19437. @example
  19438. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  19439. @end example
  19440. @end itemize
  19441. @section xbr
  19442. Apply the xBR high-quality magnification filter which is designed for pixel
  19443. art. It follows a set of edge-detection rules, see
  19444. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  19445. It accepts the following option:
  19446. @table @option
  19447. @item n
  19448. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  19449. @code{3xBR} and @code{4} for @code{4xBR}.
  19450. Default is @code{3}.
  19451. @end table
  19452. @section xcorrelate
  19453. Apply normalized cross-correlation between first and second input video stream.
  19454. Second input video stream dimensions must be lower than first input video stream.
  19455. The filter accepts the following options:
  19456. @table @option
  19457. @item planes
  19458. Set which planes to process.
  19459. @item secondary
  19460. Set which secondary video frames will be processed from second input video stream,
  19461. can be @var{first} or @var{all}. Default is @var{all}.
  19462. @end table
  19463. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  19464. @section xfade
  19465. Apply cross fade from one input video stream to another input video stream.
  19466. The cross fade is applied for specified duration.
  19467. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  19468. frame rate and timebase.
  19469. The filter accepts the following options:
  19470. @table @option
  19471. @item transition
  19472. Set one of available transition effects:
  19473. @table @samp
  19474. @item custom
  19475. @item fade
  19476. @item wipeleft
  19477. @item wiperight
  19478. @item wipeup
  19479. @item wipedown
  19480. @item slideleft
  19481. @item slideright
  19482. @item slideup
  19483. @item slidedown
  19484. @item circlecrop
  19485. @item rectcrop
  19486. @item distance
  19487. @item fadeblack
  19488. @item fadewhite
  19489. @item radial
  19490. @item smoothleft
  19491. @item smoothright
  19492. @item smoothup
  19493. @item smoothdown
  19494. @item circleopen
  19495. @item circleclose
  19496. @item vertopen
  19497. @item vertclose
  19498. @item horzopen
  19499. @item horzclose
  19500. @item dissolve
  19501. @item pixelize
  19502. @item diagtl
  19503. @item diagtr
  19504. @item diagbl
  19505. @item diagbr
  19506. @item hlslice
  19507. @item hrslice
  19508. @item vuslice
  19509. @item vdslice
  19510. @item hblur
  19511. @item fadegrays
  19512. @item wipetl
  19513. @item wipetr
  19514. @item wipebl
  19515. @item wipebr
  19516. @item squeezeh
  19517. @item squeezev
  19518. @item zoomin
  19519. @item fadefast
  19520. @item fadeslow
  19521. @item hlwind
  19522. @item hrwind
  19523. @item vuwind
  19524. @item vdwind
  19525. @item coverleft
  19526. @item coverright
  19527. @item coverup
  19528. @item coverdown
  19529. @item revealleft
  19530. @item revealright
  19531. @item revealup
  19532. @item revealdown
  19533. @end table
  19534. Default transition effect is fade.
  19535. @item duration
  19536. Set cross fade duration in seconds.
  19537. Range is 0 to 60 seconds.
  19538. Default duration is 1 second.
  19539. @item offset
  19540. Set cross fade start relative to first input stream in seconds.
  19541. Default offset is 0.
  19542. @item expr
  19543. Set expression for custom transition effect.
  19544. The expressions can use the following variables and functions:
  19545. @table @option
  19546. @item X
  19547. @item Y
  19548. The coordinates of the current sample.
  19549. @item W
  19550. @item H
  19551. The width and height of the image.
  19552. @item P
  19553. Progress of transition effect.
  19554. @item PLANE
  19555. Currently processed plane.
  19556. @item A
  19557. Return value of first input at current location and plane.
  19558. @item B
  19559. Return value of second input at current location and plane.
  19560. @item a0(x, y)
  19561. @item a1(x, y)
  19562. @item a2(x, y)
  19563. @item a3(x, y)
  19564. Return the value of the pixel at location (@var{x},@var{y}) of the
  19565. first/second/third/fourth component of first input.
  19566. @item b0(x, y)
  19567. @item b1(x, y)
  19568. @item b2(x, y)
  19569. @item b3(x, y)
  19570. Return the value of the pixel at location (@var{x},@var{y}) of the
  19571. first/second/third/fourth component of second input.
  19572. @end table
  19573. @end table
  19574. @subsection Examples
  19575. @itemize
  19576. @item
  19577. Cross fade from one input video to another input video, with fade transition and duration of transition
  19578. of 2 seconds starting at offset of 5 seconds:
  19579. @example
  19580. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  19581. @end example
  19582. @end itemize
  19583. @section xmedian
  19584. Pick median pixels from several input videos.
  19585. The filter accepts the following options:
  19586. @table @option
  19587. @item inputs
  19588. Set number of inputs.
  19589. Default is 3. Allowed range is from 3 to 255.
  19590. If number of inputs is even number, than result will be mean value between two median values.
  19591. @item planes
  19592. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  19593. @item percentile
  19594. Set median percentile. Default value is @code{0.5}.
  19595. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  19596. minimum values, and @code{1} maximum values.
  19597. @end table
  19598. @subsection Commands
  19599. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  19600. @anchor{xpsnr}
  19601. @section xpsnr
  19602. Obtain the average (across all input frames) and minimum (across all color plane averages)
  19603. eXtended Perceptually weighted peak Signal-to-Noise Ratio (XPSNR) between two input videos.
  19604. The XPSNR is a low-complexity psychovisually motivated distortion measurement algorithm for
  19605. assessing the difference between two video streams or images. This is especially useful for
  19606. objectively quantifying the distortions caused by video and image codecs, as an alternative
  19607. to a formal subjective test. The logarithmic XPSNR output values are in a similar range as
  19608. those of traditional @ref{psnr} assessments but better reflect human impressions of visual
  19609. coding quality. More details on the XPSNR measure, which essentially represents a blockwise
  19610. weighted variant of the PSNR measure, can be found in the following freely available papers:
  19611. @itemize
  19612. @item
  19613. C. R. Helmrich, M. Siekmann, S. Becker, S. Bosse, D. Marpe, and T. Wiegand, "XPSNR: A
  19614. Low-Complexity Extension of the Perceptually Weighted Peak Signal-to-Noise Ratio for
  19615. High-Resolution Video Quality Assessment," in Proc. IEEE Int. Conf. Acoustics, Speech,
  19616. Sig. Process. (ICASSP), virt./online, May 2020. @url{www.ecodis.de/xpsnr.htm}
  19617. @item
  19618. C. R. Helmrich, S. Bosse, H. Schwarz, D. Marpe, and T. Wiegand, "A Study of the
  19619. Extended Perceptually Weighted Peak Signal-to-Noise Ratio (XPSNR) for Video Compression
  19620. with Different Resolutions and Bit Depths," ITU Journal: ICT Discoveries, vol. 3, no.
  19621. 1, pp. 65 - 72, May 2020. @url{http://handle.itu.int/11.1002/pub/8153d78b-en}
  19622. @end itemize
  19623. When publishing the results of XPSNR assessments obtained using, e.g., this FFmpeg filter, a
  19624. reference to the above papers as a means of documentation is strongly encouraged. The filter
  19625. requires two input videos. The first input is considered a (usually not distorted) reference
  19626. source and is passed unchanged to the output, whereas the second input is a (distorted) test
  19627. signal. Except for the bit depth, these two video inputs must have the same pixel format. In
  19628. addition, for best performance, both compared input videos should be in YCbCr color format.
  19629. The obtained overall XPSNR values mentioned above are printed through the logging system. In
  19630. case of input with multiple color planes, we suggest reporting of the minimum XPSNR average.
  19631. The following parameter, which behaves like the one for the @ref{psnr} filter, is accepted:
  19632. @table @option
  19633. @item stats_file, f
  19634. If specified, the filter will use the named file to save the XPSNR value of each individual
  19635. frame and color plane. When the file name equals "-", that data is sent to standard output.
  19636. @end table
  19637. This filter also supports the @ref{framesync} options.
  19638. @subsection Examples
  19639. @itemize
  19640. @item
  19641. XPSNR analysis of two 1080p HD videos, ref_source.yuv and test_video.yuv, both at 24 frames
  19642. per second, with color format 4:2:0, bit depth 8, and output of a logfile named "xpsnr.log":
  19643. @example
  19644. ffmpeg -s 1920x1080 -framerate 24 -pix_fmt yuv420p -i ref_source.yuv -s 1920x1080 -framerate
  19645. 24 -pix_fmt yuv420p -i test_video.yuv -lavfi xpsnr="stats_file=xpsnr.log" -f null -
  19646. @end example
  19647. @item
  19648. XPSNR analysis of two 2160p UHD videos, ref_source.yuv with bit depth 8 and test_video.yuv
  19649. with bit depth 10, both at 60 frames per second with color format 4:2:0, no logfile output:
  19650. @example
  19651. ffmpeg -s 3840x2160 -framerate 60 -pix_fmt yuv420p -i ref_source.yuv -s 3840x2160 -framerate
  19652. 60 -pix_fmt yuv420p10le -i test_video.yuv -lavfi xpsnr="stats_file=-" -f null -
  19653. @end example
  19654. @end itemize
  19655. @anchor{xstack}
  19656. @section xstack
  19657. Stack video inputs into custom layout.
  19658. All streams must be of same pixel format.
  19659. The filter accepts the following options:
  19660. @table @option
  19661. @item inputs
  19662. Set number of input streams. Default is 2.
  19663. @item layout
  19664. Specify layout of inputs.
  19665. This option requires the desired layout configuration to be explicitly set by the user.
  19666. This sets position of each video input in output. Each input
  19667. is separated by '|'.
  19668. The first number represents the column, and the second number represents the row.
  19669. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  19670. where X is video input from which to take width or height.
  19671. Multiple values can be used when separated by '+'. In such
  19672. case values are summed together.
  19673. Note that if inputs are of different sizes gaps may appear, as not all of
  19674. the output video frame will be filled. Similarly, videos can overlap each
  19675. other if their position doesn't leave enough space for the full frame of
  19676. adjoining videos.
  19677. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  19678. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  19679. the user. Either @code{grid} or @code{layout} can be specified at a time.
  19680. Specifying both will result in an error.
  19681. @item grid
  19682. Specify a fixed size grid of inputs.
  19683. This option is used to create a fixed size grid of the input streams. Set the
  19684. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  19685. input streams and they will be arranged as a grid with @code{ROWS} rows and
  19686. @code{COLUMNS} columns. When using this option, each input stream within a row
  19687. must have the same height and all the rows must have the same width.
  19688. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  19689. set to @code{ROWS * COLUMNS}.
  19690. For 2 inputs, a default grid of @code{2x1} (equivalent to
  19691. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  19692. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  19693. Specifying both will result in an error.
  19694. @item shortest
  19695. If set to 1, force the output to terminate when the shortest input
  19696. terminates. Default value is 0.
  19697. @item fill
  19698. If set to valid color, all unused pixels will be filled with that color.
  19699. By default fill is set to none, so it is disabled.
  19700. @end table
  19701. @subsection Examples
  19702. @itemize
  19703. @item
  19704. Display 4 inputs into 2x2 grid.
  19705. Layout:
  19706. @example
  19707. input1(0, 0) | input3(w0, 0)
  19708. input2(0, h0) | input4(w0, h0)
  19709. @end example
  19710. @example
  19711. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  19712. @end example
  19713. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19714. @item
  19715. Display 4 inputs into 1x4 grid.
  19716. Layout:
  19717. @example
  19718. input1(0, 0)
  19719. input2(0, h0)
  19720. input3(0, h0+h1)
  19721. input4(0, h0+h1+h2)
  19722. @end example
  19723. @example
  19724. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  19725. @end example
  19726. Note that if inputs are of different widths, unused space will appear.
  19727. @item
  19728. Display 9 inputs into 3x3 grid.
  19729. Layout:
  19730. @example
  19731. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  19732. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  19733. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  19734. @end example
  19735. @example
  19736. 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
  19737. @end example
  19738. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19739. @item
  19740. Display 16 inputs into 4x4 grid.
  19741. Layout:
  19742. @example
  19743. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  19744. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  19745. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  19746. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  19747. @end example
  19748. @example
  19749. 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|
  19750. 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
  19751. @end example
  19752. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19753. @end itemize
  19754. @anchor{yadif}
  19755. @section yadif
  19756. Deinterlace the input video ("yadif" means "yet another deinterlacing
  19757. filter").
  19758. It accepts the following parameters:
  19759. @table @option
  19760. @item mode
  19761. The interlacing mode to adopt. It accepts one of the following values:
  19762. @table @option
  19763. @item 0, send_frame
  19764. Output one frame for each frame.
  19765. @item 1, send_field
  19766. Output one frame for each field.
  19767. @item 2, send_frame_nospatial
  19768. Like @code{send_frame}, but it skips the spatial interlacing check.
  19769. @item 3, send_field_nospatial
  19770. Like @code{send_field}, but it skips the spatial interlacing check.
  19771. @end table
  19772. The default value is @code{send_frame}.
  19773. @item parity
  19774. The picture field parity assumed for the input interlaced video. It accepts one
  19775. of the following values:
  19776. @table @option
  19777. @item 0, tff
  19778. Assume the top field is first.
  19779. @item 1, bff
  19780. Assume the bottom field is first.
  19781. @item -1, auto
  19782. Enable automatic detection of field parity.
  19783. @end table
  19784. The default value is @code{auto}.
  19785. If the interlacing is unknown or the decoder does not export this information,
  19786. top field first will be assumed.
  19787. @item deint
  19788. Specify which frames to deinterlace. Accepts one of the following
  19789. values:
  19790. @table @option
  19791. @item 0, all
  19792. Deinterlace all frames.
  19793. @item 1, interlaced
  19794. Only deinterlace frames marked as interlaced.
  19795. @end table
  19796. The default value is @code{all}.
  19797. @end table
  19798. @section yaepblur
  19799. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  19800. The algorithm is described in
  19801. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  19802. It accepts the following parameters:
  19803. @table @option
  19804. @item radius, r
  19805. Set the window radius. Default value is 3.
  19806. @item planes, p
  19807. Set which planes to filter. Default is only the first plane.
  19808. @item sigma, s
  19809. Set blur strength. Default value is 128.
  19810. @end table
  19811. @subsection Commands
  19812. This filter supports same @ref{commands} as options.
  19813. @section zoompan
  19814. Apply Zoom & Pan effect.
  19815. This filter accepts the following options:
  19816. @table @option
  19817. @item zoom, z
  19818. Set the zoom expression. Range is 1-10. Default is 1.
  19819. @item x
  19820. @item y
  19821. Set the x and y expression. Default is 0.
  19822. @item d
  19823. Set the duration expression in number of frames.
  19824. This sets for how many number of frames effect will last for
  19825. single input image. Default is 90.
  19826. @item s
  19827. Set the output image size, default is 'hd720'.
  19828. @item fps
  19829. Set the output frame rate, default is '25'.
  19830. @end table
  19831. Each expression can contain the following constants:
  19832. @table @option
  19833. @item in_w, iw
  19834. Input width.
  19835. @item in_h, ih
  19836. Input height.
  19837. @item out_w, ow
  19838. Output width.
  19839. @item out_h, oh
  19840. Output height.
  19841. @item in
  19842. Input frame count.
  19843. @item on
  19844. Output frame count.
  19845. @item in_time, it
  19846. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  19847. @item out_time, time, ot
  19848. The output timestamp expressed in seconds.
  19849. @item x
  19850. @item y
  19851. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  19852. for current input frame.
  19853. @item px
  19854. @item py
  19855. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  19856. not yet such frame (first input frame).
  19857. @item zoom
  19858. Last calculated zoom from 'z' expression for current input frame.
  19859. @item pzoom
  19860. Last calculated zoom of last output frame of previous input frame.
  19861. @item duration
  19862. Number of output frames for current input frame. Calculated from 'd' expression
  19863. for each input frame.
  19864. @item pduration
  19865. number of output frames created for previous input frame
  19866. @item a
  19867. Rational number: input width / input height
  19868. @item sar
  19869. sample aspect ratio
  19870. @item dar
  19871. display aspect ratio
  19872. @end table
  19873. @subsection Examples
  19874. @itemize
  19875. @item
  19876. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  19877. @example
  19878. 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
  19879. @end example
  19880. @item
  19881. Zoom in up to 1.5x and pan always at center of picture:
  19882. @example
  19883. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19884. @end example
  19885. @item
  19886. Same as above but without pausing:
  19887. @example
  19888. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19889. @end example
  19890. @item
  19891. Zoom in 2x into center of picture only for the first second of the input video:
  19892. @example
  19893. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19894. @end example
  19895. @end itemize
  19896. @anchor{zscale}
  19897. @section zscale
  19898. Scale (resize) the input video, using the z.lib library:
  19899. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  19900. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  19901. The zscale filter forces the output display aspect ratio to be the same
  19902. as the input, by changing the output sample aspect ratio.
  19903. If the input image format is different from the format requested by
  19904. the next filter, the zscale filter will convert the input to the
  19905. requested format.
  19906. @subsection Options
  19907. The filter accepts the following options.
  19908. @table @option
  19909. @item width, w
  19910. @item height, h
  19911. Set the output video dimension expression. Default value is the input
  19912. dimension.
  19913. If the @var{width} or @var{w} value is 0, the input width is used for
  19914. the output. If the @var{height} or @var{h} value is 0, the input height
  19915. is used for the output.
  19916. If one and only one of the values is -n with n >= 1, the zscale filter
  19917. will use a value that maintains the aspect ratio of the input image,
  19918. calculated from the other specified dimension. After that it will,
  19919. however, make sure that the calculated dimension is divisible by n and
  19920. adjust the value if necessary.
  19921. If both values are -n with n >= 1, the behavior will be identical to
  19922. both values being set to 0 as previously detailed.
  19923. See below for the list of accepted constants for use in the dimension
  19924. expression.
  19925. @item size, s
  19926. Set the video size. For the syntax of this option, check the
  19927. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19928. @item dither, d
  19929. Set the dither type.
  19930. Possible values are:
  19931. @table @var
  19932. @item none
  19933. @item ordered
  19934. @item random
  19935. @item error_diffusion
  19936. @end table
  19937. Default is none.
  19938. @item filter, f
  19939. Set the resize filter type.
  19940. Possible values are:
  19941. @table @var
  19942. @item point
  19943. @item bilinear
  19944. @item bicubic
  19945. @item spline16
  19946. @item spline36
  19947. @item lanczos
  19948. @end table
  19949. Default is bilinear.
  19950. @item range, r
  19951. Set the color range.
  19952. Possible values are:
  19953. @table @var
  19954. @item input
  19955. @item limited
  19956. @item full
  19957. @end table
  19958. Default is same as input.
  19959. @item primaries, p
  19960. Set the color primaries.
  19961. Possible values are:
  19962. @table @var
  19963. @item input
  19964. @item 709
  19965. @item unspecified
  19966. @item 170m
  19967. @item 240m
  19968. @item 2020
  19969. @end table
  19970. Default is same as input.
  19971. @item transfer, t
  19972. Set the transfer characteristics.
  19973. Possible values are:
  19974. @table @var
  19975. @item input
  19976. @item 709
  19977. @item unspecified
  19978. @item 601
  19979. @item linear
  19980. @item 2020_10
  19981. @item 2020_12
  19982. @item smpte2084
  19983. @item iec61966-2-1
  19984. @item arib-std-b67
  19985. @end table
  19986. Default is same as input.
  19987. @item matrix, m
  19988. Set the colorspace matrix.
  19989. Possible value are:
  19990. @table @var
  19991. @item input
  19992. @item 709
  19993. @item unspecified
  19994. @item 470bg
  19995. @item 170m
  19996. @item 2020_ncl
  19997. @item 2020_cl
  19998. @end table
  19999. Default is same as input.
  20000. @item rangein, rin
  20001. Set the input color range.
  20002. Possible values are:
  20003. @table @var
  20004. @item input
  20005. @item limited
  20006. @item full
  20007. @end table
  20008. Default is same as input.
  20009. @item primariesin, pin
  20010. Set the input color primaries.
  20011. Possible values are:
  20012. @table @var
  20013. @item input
  20014. @item 709
  20015. @item unspecified
  20016. @item 170m
  20017. @item 240m
  20018. @item 2020
  20019. @end table
  20020. Default is same as input.
  20021. @item transferin, tin
  20022. Set the input transfer characteristics.
  20023. Possible values are:
  20024. @table @var
  20025. @item input
  20026. @item 709
  20027. @item unspecified
  20028. @item 601
  20029. @item linear
  20030. @item 2020_10
  20031. @item 2020_12
  20032. @end table
  20033. Default is same as input.
  20034. @item matrixin, min
  20035. Set the input colorspace matrix.
  20036. Possible value are:
  20037. @table @var
  20038. @item input
  20039. @item 709
  20040. @item unspecified
  20041. @item 470bg
  20042. @item 170m
  20043. @item 2020_ncl
  20044. @item 2020_cl
  20045. @end table
  20046. @item chromal, c
  20047. Set the output chroma location.
  20048. Possible values are:
  20049. @table @var
  20050. @item input
  20051. @item left
  20052. @item center
  20053. @item topleft
  20054. @item top
  20055. @item bottomleft
  20056. @item bottom
  20057. @end table
  20058. @item chromalin, cin
  20059. Set the input chroma location.
  20060. Possible values are:
  20061. @table @var
  20062. @item input
  20063. @item left
  20064. @item center
  20065. @item topleft
  20066. @item top
  20067. @item bottomleft
  20068. @item bottom
  20069. @end table
  20070. @item npl
  20071. Set the nominal peak luminance.
  20072. @item param_a
  20073. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  20074. filter taps for lanczos.
  20075. @item param_b
  20076. Parameter B for scaling filters. Parameter "c" for bicubic.
  20077. @end table
  20078. The values of the @option{w} and @option{h} options are expressions
  20079. containing the following constants:
  20080. @table @var
  20081. @item in_w
  20082. @item in_h
  20083. The input width and height
  20084. @item iw
  20085. @item ih
  20086. These are the same as @var{in_w} and @var{in_h}.
  20087. @item out_w
  20088. @item out_h
  20089. The output (scaled) width and height
  20090. @item ow
  20091. @item oh
  20092. These are the same as @var{out_w} and @var{out_h}
  20093. @item a
  20094. The same as @var{iw} / @var{ih}
  20095. @item sar
  20096. input sample aspect ratio
  20097. @item dar
  20098. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  20099. @item hsub
  20100. @item vsub
  20101. horizontal and vertical input chroma subsample values. For example for the
  20102. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  20103. @item ohsub
  20104. @item ovsub
  20105. horizontal and vertical output chroma subsample values. For example for the
  20106. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  20107. @end table
  20108. @subsection Commands
  20109. This filter supports the following commands:
  20110. @table @option
  20111. @item width, w
  20112. @item height, h
  20113. Set the output video dimension expression.
  20114. The command accepts the same syntax of the corresponding option.
  20115. If the specified expression is not valid, it is kept at its current
  20116. value.
  20117. @end table
  20118. @c man end VIDEO FILTERS
  20119. @chapter CUDA Video Filters
  20120. @c man begin CUDA Video Filters
  20121. To enable CUDA and/or NPP filters please refer to configuration guidelines for @ref{CUDA} and for @ref{CUDA NPP} filters.
  20122. Running CUDA filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  20123. @table @option
  20124. @item -init_hw_device cuda[=@var{name}][:@var{device}[,@var{key=value}...]]
  20125. Initialise a new hardware device of type @var{cuda} called @var{name}, using the
  20126. given device parameters.
  20127. @item -filter_hw_device @var{name}
  20128. Pass the hardware device called @var{name} to all filters in any filter graph.
  20129. @end table
  20130. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  20131. @itemize
  20132. @item
  20133. Example of initializing second CUDA device on the system and running scale_cuda and bilateral_cuda filters.
  20134. @example
  20135. ./ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -init_hw_device cuda:1 -filter_complex \
  20136. "[0:v]scale_cuda=format=yuv444p[scaled_video];[scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  20137. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  20138. @end example
  20139. @end itemize
  20140. Since CUDA filters operate exclusively on GPU memory, frame data must sometimes be uploaded (@ref{hwupload}) to hardware surfaces associated with the appropriate CUDA device before processing, and downloaded (@ref{hwdownload}) back to normal memory afterward, if required. Whether @ref{hwupload} or @ref{hwdownload} is necessary depends on the specific workflow:
  20141. @itemize
  20142. @item If the input frames are already in GPU memory (e.g., when using @code{-hwaccel cuda} or @code{-hwaccel_output_format cuda}), explicit use of @ref{hwupload} is not needed, as the data is already in the appropriate memory space.
  20143. @item If the input frames are in CPU memory (e.g., software-decoded frames or frames processed by CPU-based filters), it is necessary to use @ref{hwupload} to transfer the data to GPU memory for CUDA processing.
  20144. @item If the output of the CUDA filters needs to be further processed by software-based filters or saved in a format not supported by GPU-based encoders, @ref{hwdownload} is required to transfer the data back to CPU memory.
  20145. @end itemize
  20146. Note that @ref{hwupload} uploads data to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before @ref{hwupload} to ensure the input is in the correct format. Similarly, @ref{hwdownload} may not support all output formats, so an additional @ref{format} filter may need to be inserted immediately after @ref{hwdownload} in the filter graph to ensure compatibility.
  20147. @anchor{CUDA}
  20148. @section CUDA
  20149. Below is a description of the currently available Nvidia CUDA video filters.
  20150. Prerequisites:
  20151. @itemize
  20152. @item Install Nvidia CUDA Toolkit
  20153. @end itemize
  20154. Note: If FFmpeg detects the Nvidia CUDA Toolkit during configuration, it will enable CUDA filters automatically without requiring any additional flags. If you want to explicitly enable them, use the following options:
  20155. @itemize
  20156. @item Configure FFmpeg with @code{--enable-cuda-nvcc --enable-nonfree}.
  20157. @item Configure FFmpeg with @code{--enable-cuda-llvm}. Additional requirement: @code{llvm} lib must be installed.
  20158. @end itemize
  20159. @subsection bilateral_cuda
  20160. CUDA accelerated bilateral filter, an edge preserving filter.
  20161. This filter is mathematically accurate thanks to the use of GPU acceleration.
  20162. For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
  20163. The filter accepts the following options:
  20164. @table @option
  20165. @item sigmaS
  20166. Set sigma of gaussian function to calculate spatial weight, also called sigma space.
  20167. Allowed range is 0.1 to 512. Default is 0.1.
  20168. @item sigmaR
  20169. Set sigma of gaussian function to calculate color range weight, also called sigma color.
  20170. Allowed range is 0.1 to 512. Default is 0.1.
  20171. @item window_size
  20172. Set window size of the bilateral function to determine the number of neighbours to loop on.
  20173. If the number entered is even, one will be added automatically.
  20174. Allowed range is 1 to 255. Default is 1.
  20175. @end table
  20176. @subsubsection Examples
  20177. @itemize
  20178. @item
  20179. Apply the bilateral filter on a video.
  20180. @example
  20181. ./ffmpeg -v verbose \
  20182. -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \
  20183. -init_hw_device cuda \
  20184. -filter_complex \
  20185. " \
  20186. [0:v]scale_cuda=format=yuv444p[scaled_video];
  20187. [scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  20188. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  20189. @end example
  20190. @end itemize
  20191. @subsection bwdif_cuda
  20192. Deinterlace the input video using the @ref{bwdif} algorithm, but implemented
  20193. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  20194. and/or nvenc.
  20195. It accepts the following parameters:
  20196. @table @option
  20197. @item mode
  20198. The interlacing mode to adopt. It accepts one of the following values:
  20199. @table @option
  20200. @item 0, send_frame
  20201. Output one frame for each frame.
  20202. @item 1, send_field
  20203. Output one frame for each field.
  20204. @end table
  20205. The default value is @code{send_field}.
  20206. @item parity
  20207. The picture field parity assumed for the input interlaced video. It accepts one
  20208. of the following values:
  20209. @table @option
  20210. @item 0, tff
  20211. Assume the top field is first.
  20212. @item 1, bff
  20213. Assume the bottom field is first.
  20214. @item -1, auto
  20215. Enable automatic detection of field parity.
  20216. @end table
  20217. The default value is @code{auto}.
  20218. If the interlacing is unknown or the decoder does not export this information,
  20219. top field first will be assumed.
  20220. @item deint
  20221. Specify which frames to deinterlace. Accepts one of the following
  20222. values:
  20223. @table @option
  20224. @item 0, all
  20225. Deinterlace all frames.
  20226. @item 1, interlaced
  20227. Only deinterlace frames marked as interlaced.
  20228. @end table
  20229. The default value is @code{all}.
  20230. @end table
  20231. @subsection chromakey_cuda
  20232. CUDA accelerated YUV colorspace color/chroma keying.
  20233. This filter works like normal chromakey filter but operates on CUDA frames.
  20234. for more details and parameters see @ref{chromakey}.
  20235. @subsubsection Examples
  20236. @itemize
  20237. @item
  20238. Make all the green pixels in the input video transparent and use it as an overlay for another video:
  20239. @example
  20240. ./ffmpeg \
  20241. -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
  20242. -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
  20243. -init_hw_device cuda \
  20244. -filter_complex \
  20245. " \
  20246. [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
  20247. [1:v]scale_cuda=format=yuv420p[base]; \
  20248. [base][overlay_video]overlay_cuda" \
  20249. -an -sn -c:v h264_nvenc -cq 20 output.mp4
  20250. @end example
  20251. @item
  20252. Process two software sources, explicitly uploading the frames:
  20253. @example
  20254. ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
  20255. -f lavfi -i color=size=800x600:color=white,format=yuv420p \
  20256. -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
  20257. -filter_complex \
  20258. " \
  20259. [0]hwupload[under]; \
  20260. [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
  20261. [under][over]overlay_cuda" \
  20262. -c:v hevc_nvenc -cq 18 -preset slow output.mp4
  20263. @end example
  20264. @end itemize
  20265. @subsection colorspace_cuda
  20266. CUDA accelerated implementation of the colorspace filter.
  20267. It is by no means feature complete compared to the software colorspace filter,
  20268. and at the current time only supports color range conversion between jpeg/full
  20269. and mpeg/limited range.
  20270. The filter accepts the following options:
  20271. @table @option
  20272. @item range
  20273. Specify output color range.
  20274. The accepted values are:
  20275. @table @samp
  20276. @item tv
  20277. TV (restricted) range
  20278. @item mpeg
  20279. MPEG (restricted) range
  20280. @item pc
  20281. PC (full) range
  20282. @item jpeg
  20283. JPEG (full) range
  20284. @end table
  20285. @end table
  20286. @anchor{overlay_cuda}
  20287. @subsection overlay_cuda
  20288. Overlay one video on top of another.
  20289. This is the CUDA variant of the @ref{overlay} filter.
  20290. It only accepts CUDA frames. The underlying input pixel formats have to match.
  20291. It takes two inputs and has one output. The first input is the "main"
  20292. video on which the second input is overlaid.
  20293. It accepts the following parameters:
  20294. @table @option
  20295. @item x
  20296. @item y
  20297. Set expressions for the x and y coordinates of the overlaid video
  20298. on the main video.
  20299. They can contain the following parameters:
  20300. @table @option
  20301. @item main_w, W
  20302. @item main_h, H
  20303. The main input width and height.
  20304. @item overlay_w, w
  20305. @item overlay_h, h
  20306. The overlay input width and height.
  20307. @item x
  20308. @item y
  20309. The computed values for @var{x} and @var{y}. They are evaluated for
  20310. each new frame.
  20311. @item n
  20312. The ordinal index of the main input frame, starting from 0.
  20313. @item pos
  20314. The byte offset position in the file of the main input frame, NAN if unknown.
  20315. Deprecated, do not use.
  20316. @item t
  20317. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  20318. @end table
  20319. Default value is "0" for both expressions.
  20320. @item eval
  20321. Set when the expressions for @option{x} and @option{y} are evaluated.
  20322. It accepts the following values:
  20323. @table @option
  20324. @item init
  20325. Evaluate expressions once during filter initialization or
  20326. when a command is processed.
  20327. @item frame
  20328. Evaluate expressions for each incoming frame
  20329. @end table
  20330. Default value is @option{frame}.
  20331. @item eof_action
  20332. See @ref{framesync}.
  20333. @item shortest
  20334. See @ref{framesync}.
  20335. @item repeatlast
  20336. See @ref{framesync}.
  20337. @end table
  20338. This filter also supports the @ref{framesync} options.
  20339. @anchor{scale_cuda}
  20340. @subsection scale_cuda
  20341. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  20342. Setting the output width and height works in the same way as for the @ref{scale} filter.
  20343. The filter accepts the following options:
  20344. @table @option
  20345. @item w
  20346. @item h
  20347. Set the output video dimension expression. Default value is the input dimension.
  20348. Allows for the same expressions as the @ref{scale} filter.
  20349. @item interp_algo
  20350. Sets the algorithm used for scaling:
  20351. @table @var
  20352. @item nearest
  20353. Nearest neighbour
  20354. Used by default if input parameters match the desired output.
  20355. @item bilinear
  20356. Bilinear
  20357. @item bicubic
  20358. Bicubic
  20359. This is the default.
  20360. @item lanczos
  20361. Lanczos
  20362. @end table
  20363. @item format
  20364. Controls the output pixel format. By default, or if none is specified, the input
  20365. pixel format is used.
  20366. The filter does not support converting between YUV and RGB pixel formats.
  20367. @item passthrough
  20368. If set to 0, every frame is processed, even if no conversion is necessary.
  20369. This mode can be useful to use the filter as a buffer for a downstream
  20370. frame-consumer that exhausts the limited decoder frame pool.
  20371. If set to 1, frames are passed through as-is if they match the desired output
  20372. parameters. This is the default behaviour.
  20373. @item param
  20374. Algorithm-Specific parameter.
  20375. Affects the curves of the bicubic algorithm.
  20376. @item force_original_aspect_ratio
  20377. @item force_divisible_by
  20378. Work the same as the identical @ref{scale} filter options.
  20379. @item reset_sar
  20380. Works the same as the identical @ref{scale} filter option.
  20381. @end table
  20382. @subsubsection Examples
  20383. @itemize
  20384. @item
  20385. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  20386. @example
  20387. scale_cuda=-2:720:format=yuv420p
  20388. @end example
  20389. @item
  20390. Upscale to 4K using nearest neighbour algorithm.
  20391. @example
  20392. scale_cuda=4096:2160:interp_algo=nearest
  20393. @end example
  20394. @item
  20395. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  20396. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  20397. decoders frame pool.
  20398. @example
  20399. scale_cuda=passthrough=0
  20400. @end example
  20401. @end itemize
  20402. @subsection thumbnail_cuda
  20403. Select the most representative frame in a given sequence of consecutive frames using CUDA.
  20404. The filter accepts the following options:
  20405. @table @option
  20406. @item n
  20407. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  20408. will pick one of them, and then handle the next batch of @var{n} frames until
  20409. the end. Default is @code{100}.
  20410. @end table
  20411. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  20412. value will result in a higher memory usage, so a high value is not recommended.
  20413. @subsubsection Example
  20414. @itemize
  20415. @item
  20416. Thumbnails are extracted from every @var{n}=150-frame batch, selecting one per batch. Chosen frames are then scaled with @ref{scale_cuda}.
  20417. @example
  20418. ./ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i ./input.mp4 -vf "thumbnail_cuda=150,scale_cuda=1920:1080,hwdownload,format=nv12" ./output/out%03d.png
  20419. @end example
  20420. @end itemize
  20421. @subsection yadif_cuda
  20422. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  20423. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  20424. and/or nvenc.
  20425. It accepts the following parameters:
  20426. @table @option
  20427. @item mode
  20428. The interlacing mode to adopt. It accepts one of the following values:
  20429. @table @option
  20430. @item 0, send_frame
  20431. Output one frame for each frame.
  20432. @item 1, send_field
  20433. Output one frame for each field.
  20434. @item 2, send_frame_nospatial
  20435. Like @code{send_frame}, but it skips the spatial interlacing check.
  20436. @item 3, send_field_nospatial
  20437. Like @code{send_field}, but it skips the spatial interlacing check.
  20438. @end table
  20439. The default value is @code{send_frame}.
  20440. @item parity
  20441. The picture field parity assumed for the input interlaced video. It accepts one
  20442. of the following values:
  20443. @table @option
  20444. @item 0, tff
  20445. Assume the top field is first.
  20446. @item 1, bff
  20447. Assume the bottom field is first.
  20448. @item -1, auto
  20449. Enable automatic detection of field parity.
  20450. @end table
  20451. The default value is @code{auto}.
  20452. If the interlacing is unknown or the decoder does not export this information,
  20453. top field first will be assumed.
  20454. @item deint
  20455. Specify which frames to deinterlace. Accepts one of the following
  20456. values:
  20457. @table @option
  20458. @item 0, all
  20459. Deinterlace all frames.
  20460. @item 1, interlaced
  20461. Only deinterlace frames marked as interlaced.
  20462. @end table
  20463. The default value is @code{all}.
  20464. @end table
  20465. @anchor{CUDA NPP}
  20466. @section CUDA NPP
  20467. Below is a description of the currently available NVIDIA Performance Primitives (libnpp) video filters.
  20468. Prerequisites:
  20469. @itemize
  20470. @item Install Nvidia CUDA Toolkit
  20471. @item Install libnpp
  20472. @end itemize
  20473. To enable CUDA NPP filters:
  20474. @itemize
  20475. @item Configure FFmpeg with @code{--enable-nonfree --enable-libnpp}.
  20476. @end itemize
  20477. @anchor{scale_npp}
  20478. @subsection scale_npp
  20479. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  20480. format conversion on CUDA video frames. Setting the output width and height
  20481. works in the same way as for the @var{scale} filter.
  20482. The following additional options are accepted:
  20483. @table @option
  20484. @item format
  20485. The pixel format of the output CUDA frames. If set to the string "same" (the
  20486. default), the input format will be kept. Note that automatic format negotiation
  20487. and conversion is not yet supported for hardware frames
  20488. @item interp_algo
  20489. The interpolation algorithm used for resizing. One of the following:
  20490. @table @option
  20491. @item nn
  20492. Nearest neighbour.
  20493. @item linear
  20494. @item cubic
  20495. @item cubic2p_bspline
  20496. 2-parameter cubic (B=1, C=0)
  20497. @item cubic2p_catmullrom
  20498. 2-parameter cubic (B=0, C=1/2)
  20499. @item cubic2p_b05c03
  20500. 2-parameter cubic (B=1/2, C=3/10)
  20501. @item super
  20502. Supersampling
  20503. @item lanczos
  20504. @end table
  20505. @item force_original_aspect_ratio
  20506. Enable decreasing or increasing output video width or height if necessary to
  20507. keep the original aspect ratio. Possible values:
  20508. @table @samp
  20509. @item disable
  20510. Scale the video as specified and disable this feature.
  20511. @item decrease
  20512. The output video dimensions will automatically be decreased if needed.
  20513. @item increase
  20514. The output video dimensions will automatically be increased if needed.
  20515. @end table
  20516. One useful instance of this option is that when you know a specific device's
  20517. maximum allowed resolution, you can use this to limit the output video to
  20518. that, while retaining the aspect ratio. For example, device A allows
  20519. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  20520. decrease) and specifying 1280x720 to the command line makes the output
  20521. 1280x533.
  20522. Please note that this is a different thing than specifying -1 for @option{w}
  20523. or @option{h}, you still need to specify the output resolution for this option
  20524. to work.
  20525. @item force_divisible_by
  20526. Ensures that both the output dimensions, width and height, are divisible by the
  20527. given integer when used together with @option{force_original_aspect_ratio}. This
  20528. works similar to using @code{-n} in the @option{w} and @option{h} options.
  20529. This option respects the value set for @option{force_original_aspect_ratio},
  20530. increasing or decreasing the resolution accordingly. The video's aspect ratio
  20531. may be slightly modified.
  20532. This option can be handy if you need to have a video fit within or exceed
  20533. a defined resolution using @option{force_original_aspect_ratio} but also have
  20534. encoder restrictions on width or height divisibility.
  20535. @item reset_sar
  20536. Works the same as the identical @ref{scale} filter option.
  20537. @item eval
  20538. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  20539. @table @samp
  20540. @item init
  20541. Only evaluate expressions once during the filter initialization or when a command is processed.
  20542. @item frame
  20543. Evaluate expressions for each incoming frame.
  20544. @end table
  20545. @end table
  20546. The values of the @option{w} and @option{h} options are expressions
  20547. containing the following constants:
  20548. @table @var
  20549. @item in_w
  20550. @item in_h
  20551. The input width and height
  20552. @item iw
  20553. @item ih
  20554. These are the same as @var{in_w} and @var{in_h}.
  20555. @item out_w
  20556. @item out_h
  20557. The output (scaled) width and height
  20558. @item ow
  20559. @item oh
  20560. These are the same as @var{out_w} and @var{out_h}
  20561. @item a
  20562. The same as @var{iw} / @var{ih}
  20563. @item sar
  20564. input sample aspect ratio
  20565. @item dar
  20566. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  20567. @item n
  20568. The (sequential) number of the input frame, starting from 0.
  20569. Only available with @code{eval=frame}.
  20570. @item t
  20571. The presentation timestamp of the input frame, expressed as a number of
  20572. seconds. Only available with @code{eval=frame}.
  20573. @item pos
  20574. The position (byte offset) of the frame in the input stream, or NaN if
  20575. this information is unavailable and/or meaningless (for example in case of synthetic video).
  20576. Only available with @code{eval=frame}.
  20577. Deprecated, do not use.
  20578. @end table
  20579. @subsection scale2ref_npp
  20580. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  20581. video, based on a reference video.
  20582. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  20583. but uses the reference video instead of the main input as basis. scale2ref_npp
  20584. also supports the following additional constants for the @option{w} and
  20585. @option{h} options:
  20586. @table @var
  20587. @item main_w
  20588. @item main_h
  20589. The main input video's width and height
  20590. @item main_a
  20591. The same as @var{main_w} / @var{main_h}
  20592. @item main_sar
  20593. The main input video's sample aspect ratio
  20594. @item main_dar, mdar
  20595. The main input video's display aspect ratio. Calculated from
  20596. @code{(main_w / main_h) * main_sar}.
  20597. @item main_n
  20598. The (sequential) number of the main input frame, starting from 0.
  20599. Only available with @code{eval=frame}.
  20600. @item main_t
  20601. The presentation timestamp of the main input frame, expressed as a number of
  20602. seconds. Only available with @code{eval=frame}.
  20603. @item main_pos
  20604. The position (byte offset) of the frame in the main input stream, or NaN if
  20605. this information is unavailable and/or meaningless (for example in case of synthetic video).
  20606. Only available with @code{eval=frame}.
  20607. @end table
  20608. @subsubsection Examples
  20609. @itemize
  20610. @item
  20611. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  20612. @example
  20613. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  20614. @end example
  20615. @item
  20616. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  20617. @example
  20618. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  20619. @end example
  20620. @end itemize
  20621. @subsection sharpen_npp
  20622. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  20623. border control.
  20624. The following additional options are accepted:
  20625. @table @option
  20626. @item border_type
  20627. Type of sampling to be used ad frame borders. One of the following:
  20628. @table @option
  20629. @item replicate
  20630. Replicate pixel values.
  20631. @end table
  20632. @end table
  20633. @subsection transpose_npp
  20634. Transpose rows with columns in the input video and optionally flip it.
  20635. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  20636. It accepts the following parameters:
  20637. @table @option
  20638. @item dir
  20639. Specify the transposition direction.
  20640. Can assume the following values:
  20641. @table @samp
  20642. @item cclock_flip
  20643. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  20644. @item clock
  20645. Rotate by 90 degrees clockwise.
  20646. @item cclock
  20647. Rotate by 90 degrees counterclockwise.
  20648. @item clock_flip
  20649. Rotate by 90 degrees clockwise and vertically flip.
  20650. @end table
  20651. @item passthrough
  20652. Do not apply the transposition if the input geometry matches the one
  20653. specified by the specified value. It accepts the following values:
  20654. @table @samp
  20655. @item none
  20656. Always apply transposition. (default)
  20657. @item portrait
  20658. Preserve portrait geometry (when @var{height} >= @var{width}).
  20659. @item landscape
  20660. Preserve landscape geometry (when @var{width} >= @var{height}).
  20661. @end table
  20662. @end table
  20663. @c man end CUDA Video Filters
  20664. @chapter OpenCL Video Filters
  20665. @c man begin OPENCL VIDEO FILTERS
  20666. Below is a description of the currently available OpenCL video filters.
  20667. To enable compilation of these filters you need to configure FFmpeg with
  20668. @code{--enable-opencl}.
  20669. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  20670. @table @option
  20671. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  20672. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  20673. given device parameters.
  20674. @item -filter_hw_device @var{name}
  20675. Pass the hardware device called @var{name} to all filters in any filter graph.
  20676. @end table
  20677. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  20678. @itemize
  20679. @item
  20680. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  20681. @example
  20682. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  20683. @end example
  20684. @end itemize
  20685. 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.
  20686. @section avgblur_opencl
  20687. Apply average blur filter.
  20688. The filter accepts the following options:
  20689. @table @option
  20690. @item sizeX
  20691. Set horizontal radius size.
  20692. Range is @code{[1, 1024]} and default value is @code{1}.
  20693. @item planes
  20694. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20695. @item sizeY
  20696. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  20697. @end table
  20698. @subsection Example
  20699. @itemize
  20700. @item
  20701. 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.
  20702. @example
  20703. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  20704. @end example
  20705. @end itemize
  20706. @section boxblur_opencl
  20707. Apply a boxblur algorithm to the input video.
  20708. It accepts the following parameters:
  20709. @table @option
  20710. @item luma_radius, lr
  20711. @item luma_power, lp
  20712. @item chroma_radius, cr
  20713. @item chroma_power, cp
  20714. @item alpha_radius, ar
  20715. @item alpha_power, ap
  20716. @end table
  20717. A description of the accepted options follows.
  20718. @table @option
  20719. @item luma_radius, lr
  20720. @item chroma_radius, cr
  20721. @item alpha_radius, ar
  20722. Set an expression for the box radius in pixels used for blurring the
  20723. corresponding input plane.
  20724. The radius value must be a non-negative number, and must not be
  20725. greater than the value of the expression @code{min(w,h)/2} for the
  20726. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  20727. planes.
  20728. Default value for @option{luma_radius} is "2". If not specified,
  20729. @option{chroma_radius} and @option{alpha_radius} default to the
  20730. corresponding value set for @option{luma_radius}.
  20731. The expressions can contain the following constants:
  20732. @table @option
  20733. @item w
  20734. @item h
  20735. The input width and height in pixels.
  20736. @item cw
  20737. @item ch
  20738. The input chroma image width and height in pixels.
  20739. @item hsub
  20740. @item vsub
  20741. The horizontal and vertical chroma subsample values. For example, for the
  20742. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  20743. @end table
  20744. @item luma_power, lp
  20745. @item chroma_power, cp
  20746. @item alpha_power, ap
  20747. Specify how many times the boxblur filter is applied to the
  20748. corresponding plane.
  20749. Default value for @option{luma_power} is 2. If not specified,
  20750. @option{chroma_power} and @option{alpha_power} default to the
  20751. corresponding value set for @option{luma_power}.
  20752. A value of 0 will disable the effect.
  20753. @end table
  20754. @subsection Examples
  20755. 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.
  20756. @itemize
  20757. @item
  20758. Apply a boxblur filter with the luma, chroma, and alpha radius
  20759. 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.
  20760. @example
  20761. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  20762. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  20763. @end example
  20764. @item
  20765. 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.
  20766. For the luma plane, a 2x2 box radius will be run once.
  20767. For the chroma plane, a 4x4 box radius will be run 5 times.
  20768. For the alpha plane, a 3x3 box radius will be run 7 times.
  20769. @example
  20770. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  20771. @end example
  20772. @end itemize
  20773. @section colorkey_opencl
  20774. RGB colorspace color keying.
  20775. The filter accepts the following options:
  20776. @table @option
  20777. @item color
  20778. The color which will be replaced with transparency.
  20779. @item similarity
  20780. Similarity percentage with the key color.
  20781. 0.01 matches only the exact key color, while 1.0 matches everything.
  20782. @item blend
  20783. Blend percentage.
  20784. 0.0 makes pixels either fully transparent, or not transparent at all.
  20785. Higher values result in semi-transparent pixels, with a higher transparency
  20786. the more similar the pixels color is to the key color.
  20787. @end table
  20788. @subsection Examples
  20789. @itemize
  20790. @item
  20791. Make every semi-green pixel in the input transparent with some slight blending:
  20792. @example
  20793. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  20794. @end example
  20795. @end itemize
  20796. @section convolution_opencl
  20797. Apply convolution of 3x3, 5x5, 7x7 matrix.
  20798. The filter accepts the following options:
  20799. @table @option
  20800. @item 0m
  20801. @item 1m
  20802. @item 2m
  20803. @item 3m
  20804. Set matrix for each plane.
  20805. Matrix is sequence of 9, 25 or 49 signed numbers.
  20806. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  20807. @item 0rdiv
  20808. @item 1rdiv
  20809. @item 2rdiv
  20810. @item 3rdiv
  20811. Set multiplier for calculated value for each plane.
  20812. If unset or 0, it will be sum of all matrix elements.
  20813. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  20814. @item 0bias
  20815. @item 1bias
  20816. @item 2bias
  20817. @item 3bias
  20818. Set bias for each plane. This value is added to the result of the multiplication.
  20819. Useful for making the overall image brighter or darker.
  20820. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  20821. @end table
  20822. @subsection Examples
  20823. @itemize
  20824. @item
  20825. Apply sharpen:
  20826. @example
  20827. -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
  20828. @end example
  20829. @item
  20830. Apply blur:
  20831. @example
  20832. -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
  20833. @end example
  20834. @item
  20835. Apply edge enhance:
  20836. @example
  20837. -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
  20838. @end example
  20839. @item
  20840. Apply edge detect:
  20841. @example
  20842. -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
  20843. @end example
  20844. @item
  20845. Apply laplacian edge detector which includes diagonals:
  20846. @example
  20847. -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
  20848. @end example
  20849. @item
  20850. Apply emboss:
  20851. @example
  20852. -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
  20853. @end example
  20854. @end itemize
  20855. @section erosion_opencl
  20856. Apply erosion effect to the video.
  20857. This filter replaces the pixel by the local(3x3) minimum.
  20858. It accepts the following options:
  20859. @table @option
  20860. @item threshold0
  20861. @item threshold1
  20862. @item threshold2
  20863. @item threshold3
  20864. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20865. If @code{0}, plane will remain unchanged.
  20866. @item coordinates
  20867. Flag which specifies the pixel to refer to.
  20868. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20869. Flags to local 3x3 coordinates region centered on @code{x}:
  20870. 1 2 3
  20871. 4 x 5
  20872. 6 7 8
  20873. @end table
  20874. @subsection Example
  20875. @itemize
  20876. @item
  20877. 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.
  20878. @example
  20879. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20880. @end example
  20881. @end itemize
  20882. @section deshake_opencl
  20883. Feature-point based video stabilization filter.
  20884. The filter accepts the following options:
  20885. @table @option
  20886. @item tripod
  20887. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  20888. @item debug
  20889. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  20890. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  20891. Viewing point matches in the output video is only supported for RGB input.
  20892. Defaults to @code{0}.
  20893. @item adaptive_crop
  20894. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  20895. Defaults to @code{1}.
  20896. @item refine_features
  20897. Whether or not feature points should be refined at a sub-pixel level.
  20898. This can be turned off for a slight performance gain at the cost of precision.
  20899. Defaults to @code{1}.
  20900. @item smooth_strength
  20901. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  20902. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  20903. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  20904. Defaults to @code{0.0}.
  20905. @item smooth_window_multiplier
  20906. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  20907. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  20908. Acceptable values range from @code{0.1} to @code{10.0}.
  20909. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  20910. potentially improving smoothness, but also increase latency and memory usage.
  20911. Defaults to @code{2.0}.
  20912. @end table
  20913. @subsection Examples
  20914. @itemize
  20915. @item
  20916. Stabilize a video with a fixed, medium smoothing strength:
  20917. @example
  20918. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  20919. @end example
  20920. @item
  20921. Stabilize a video with debugging (both in console and in rendered video):
  20922. @example
  20923. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  20924. @end example
  20925. @end itemize
  20926. @section dilation_opencl
  20927. Apply dilation effect to the video.
  20928. This filter replaces the pixel by the local(3x3) maximum.
  20929. It accepts the following options:
  20930. @table @option
  20931. @item threshold0
  20932. @item threshold1
  20933. @item threshold2
  20934. @item threshold3
  20935. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20936. If @code{0}, plane will remain unchanged.
  20937. @item coordinates
  20938. Flag which specifies the pixel to refer to.
  20939. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20940. Flags to local 3x3 coordinates region centered on @code{x}:
  20941. 1 2 3
  20942. 4 x 5
  20943. 6 7 8
  20944. @end table
  20945. @subsection Example
  20946. @itemize
  20947. @item
  20948. 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.
  20949. @example
  20950. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20951. @end example
  20952. @end itemize
  20953. @anchor{nlmeans_opencl}
  20954. @section nlmeans_opencl
  20955. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  20956. @section overlay_opencl
  20957. Overlay one video on top of another.
  20958. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20959. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  20960. The filter accepts the following options:
  20961. @table @option
  20962. @item x
  20963. Set the x coordinate of the overlaid video on the main video.
  20964. Default value is @code{0}.
  20965. @item y
  20966. Set the y coordinate of the overlaid video on the main video.
  20967. Default value is @code{0}.
  20968. @end table
  20969. @subsection Examples
  20970. @itemize
  20971. @item
  20972. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  20973. @example
  20974. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20975. @end example
  20976. @item
  20977. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20978. @example
  20979. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20980. @end example
  20981. @end itemize
  20982. @section pad_opencl
  20983. Add paddings to the input image, and place the original input at the
  20984. provided @var{x}, @var{y} coordinates.
  20985. It accepts the following options:
  20986. @table @option
  20987. @item width, w
  20988. @item height, h
  20989. Specify an expression for the size of the output image with the
  20990. paddings added. If the value for @var{width} or @var{height} is 0, the
  20991. corresponding input size is used for the output.
  20992. The @var{width} expression can reference the value set by the
  20993. @var{height} expression, and vice versa.
  20994. The default value of @var{width} and @var{height} is 0.
  20995. @item x
  20996. @item y
  20997. Specify the offsets to place the input image at within the padded area,
  20998. with respect to the top/left border of the output image.
  20999. The @var{x} expression can reference the value set by the @var{y}
  21000. expression, and vice versa.
  21001. The default value of @var{x} and @var{y} is 0.
  21002. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  21003. so the input image is centered on the padded area.
  21004. @item color
  21005. Specify the color of the padded area. For the syntax of this option,
  21006. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  21007. manual,ffmpeg-utils}.
  21008. @item aspect
  21009. Pad to an aspect instead to a resolution.
  21010. @end table
  21011. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  21012. options are expressions containing the following constants:
  21013. @table @option
  21014. @item in_w
  21015. @item in_h
  21016. The input video width and height.
  21017. @item iw
  21018. @item ih
  21019. These are the same as @var{in_w} and @var{in_h}.
  21020. @item out_w
  21021. @item out_h
  21022. The output width and height (the size of the padded area), as
  21023. specified by the @var{width} and @var{height} expressions.
  21024. @item ow
  21025. @item oh
  21026. These are the same as @var{out_w} and @var{out_h}.
  21027. @item x
  21028. @item y
  21029. The x and y offsets as specified by the @var{x} and @var{y}
  21030. expressions, or NAN if not yet specified.
  21031. @item a
  21032. same as @var{iw} / @var{ih}
  21033. @item sar
  21034. input sample aspect ratio
  21035. @item dar
  21036. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  21037. @end table
  21038. @section prewitt_opencl
  21039. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  21040. The filter accepts the following option:
  21041. @table @option
  21042. @item planes
  21043. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21044. @item scale
  21045. Set value which will be multiplied with filtered result.
  21046. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  21047. @item delta
  21048. Set value which will be added to filtered result.
  21049. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  21050. @end table
  21051. @subsection Example
  21052. @itemize
  21053. @item
  21054. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  21055. @example
  21056. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  21057. @end example
  21058. @end itemize
  21059. @anchor{program_opencl}
  21060. @section program_opencl
  21061. Filter video using an OpenCL program.
  21062. @table @option
  21063. @item source
  21064. OpenCL program source file.
  21065. @item kernel
  21066. Kernel name in program.
  21067. @item inputs
  21068. Number of inputs to the filter. Defaults to 1.
  21069. @item size, s
  21070. Size of output frames. Defaults to the same as the first input.
  21071. @end table
  21072. The @code{program_opencl} filter also supports the @ref{framesync} options.
  21073. The program source file must contain a kernel function with the given name,
  21074. which will be run once for each plane of the output. Each run on a plane
  21075. gets enqueued as a separate 2D global NDRange with one work-item for each
  21076. pixel to be generated. The global ID offset for each work-item is therefore
  21077. the coordinates of a pixel in the destination image.
  21078. The kernel function needs to take the following arguments:
  21079. @itemize
  21080. @item
  21081. Destination image, @var{__write_only image2d_t}.
  21082. This image will become the output; the kernel should write all of it.
  21083. @item
  21084. Frame index, @var{unsigned int}.
  21085. This is a counter starting from zero and increasing by one for each frame.
  21086. @item
  21087. Source images, @var{__read_only image2d_t}.
  21088. These are the most recent images on each input. The kernel may read from
  21089. them to generate the output, but they can't be written to.
  21090. @end itemize
  21091. Example programs:
  21092. @itemize
  21093. @item
  21094. Copy the input to the output (output must be the same size as the input).
  21095. @verbatim
  21096. __kernel void copy(__write_only image2d_t destination,
  21097. unsigned int index,
  21098. __read_only image2d_t source)
  21099. {
  21100. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  21101. int2 location = (int2)(get_global_id(0), get_global_id(1));
  21102. float4 value = read_imagef(source, sampler, location);
  21103. write_imagef(destination, location, value);
  21104. }
  21105. @end verbatim
  21106. @item
  21107. Apply a simple transformation, rotating the input by an amount increasing
  21108. with the index counter. Pixel values are linearly interpolated by the
  21109. sampler, and the output need not have the same dimensions as the input.
  21110. @verbatim
  21111. __kernel void rotate_image(__write_only image2d_t dst,
  21112. unsigned int index,
  21113. __read_only image2d_t src)
  21114. {
  21115. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  21116. CLK_FILTER_LINEAR);
  21117. float angle = (float)index / 100.0f;
  21118. float2 dst_dim = convert_float2(get_image_dim(dst));
  21119. float2 src_dim = convert_float2(get_image_dim(src));
  21120. float2 dst_cen = dst_dim / 2.0f;
  21121. float2 src_cen = src_dim / 2.0f;
  21122. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  21123. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  21124. float2 src_pos = {
  21125. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  21126. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  21127. };
  21128. src_pos = src_pos * src_dim / dst_dim;
  21129. float2 src_loc = src_pos + src_cen;
  21130. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  21131. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  21132. write_imagef(dst, dst_loc, 0.5f);
  21133. else
  21134. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  21135. }
  21136. @end verbatim
  21137. @item
  21138. Blend two inputs together, with the amount of each input used varying
  21139. with the index counter.
  21140. @verbatim
  21141. __kernel void blend_images(__write_only image2d_t dst,
  21142. unsigned int index,
  21143. __read_only image2d_t src1,
  21144. __read_only image2d_t src2)
  21145. {
  21146. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  21147. CLK_FILTER_LINEAR);
  21148. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  21149. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  21150. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  21151. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  21152. float4 val1 = read_imagef(src1, sampler, src1_loc);
  21153. float4 val2 = read_imagef(src2, sampler, src2_loc);
  21154. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  21155. }
  21156. @end verbatim
  21157. @end itemize
  21158. @section remap_opencl
  21159. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  21160. Destination pixel at position (X, Y) will be picked from source (x, y) position
  21161. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  21162. value for pixel will be used for destination pixel.
  21163. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  21164. will have Xmap/Ymap video stream dimensions.
  21165. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  21166. @table @option
  21167. @item interp
  21168. Specify interpolation used for remapping of pixels.
  21169. Allowed values are @code{near} and @code{linear}.
  21170. Default value is @code{linear}.
  21171. @item fill
  21172. Specify the color of the unmapped pixels. For the syntax of this option,
  21173. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  21174. manual,ffmpeg-utils}. Default color is @code{black}.
  21175. @end table
  21176. @section roberts_opencl
  21177. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  21178. The filter accepts the following option:
  21179. @table @option
  21180. @item planes
  21181. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21182. @item scale
  21183. Set value which will be multiplied with filtered result.
  21184. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  21185. @item delta
  21186. Set value which will be added to filtered result.
  21187. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  21188. @end table
  21189. @subsection Example
  21190. @itemize
  21191. @item
  21192. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  21193. @example
  21194. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  21195. @end example
  21196. @end itemize
  21197. @section sobel_opencl
  21198. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  21199. The filter accepts the following option:
  21200. @table @option
  21201. @item planes
  21202. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21203. @item scale
  21204. Set value which will be multiplied with filtered result.
  21205. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  21206. @item delta
  21207. Set value which will be added to filtered result.
  21208. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  21209. @end table
  21210. @subsection Example
  21211. @itemize
  21212. @item
  21213. Apply sobel operator with scale set to 2 and delta set to 10
  21214. @example
  21215. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  21216. @end example
  21217. @end itemize
  21218. @section tonemap_opencl
  21219. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  21220. It accepts the following parameters:
  21221. @table @option
  21222. @item tonemap
  21223. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  21224. @item param
  21225. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  21226. @item desat
  21227. Apply desaturation for highlights that exceed this level of brightness. The
  21228. higher the parameter, the more color information will be preserved. This
  21229. setting helps prevent unnaturally blown-out colors for super-highlights, by
  21230. (smoothly) turning into white instead. This makes images feel more natural,
  21231. at the cost of reducing information about out-of-range colors.
  21232. The default value is 0.5, and the algorithm here is a little different from
  21233. the cpu version tonemap currently. A setting of 0.0 disables this option.
  21234. @item threshold
  21235. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  21236. is used to detect whether the scene has changed or not. If the distance between
  21237. the current frame average brightness and the current running average exceeds
  21238. a threshold value, we would re-calculate scene average and peak brightness.
  21239. The default value is 0.2.
  21240. @item format
  21241. Specify the output pixel format.
  21242. Currently supported formats are:
  21243. @table @var
  21244. @item p010
  21245. @item nv12
  21246. @end table
  21247. @item range, r
  21248. Set the output color range.
  21249. Possible values are:
  21250. @table @var
  21251. @item tv/mpeg
  21252. @item pc/jpeg
  21253. @end table
  21254. Default is same as input.
  21255. @item primaries, p
  21256. Set the output color primaries.
  21257. Possible values are:
  21258. @table @var
  21259. @item bt709
  21260. @item bt2020
  21261. @end table
  21262. Default is same as input.
  21263. @item transfer, t
  21264. Set the output transfer characteristics.
  21265. Possible values are:
  21266. @table @var
  21267. @item bt709
  21268. @item bt2020
  21269. @end table
  21270. Default is bt709.
  21271. @item matrix, m
  21272. Set the output colorspace matrix.
  21273. Possible value are:
  21274. @table @var
  21275. @item bt709
  21276. @item bt2020
  21277. @end table
  21278. Default is same as input.
  21279. @end table
  21280. @subsection Example
  21281. @itemize
  21282. @item
  21283. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  21284. @example
  21285. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  21286. @end example
  21287. @end itemize
  21288. @section unsharp_opencl
  21289. Sharpen or blur the input video.
  21290. It accepts the following parameters:
  21291. @table @option
  21292. @item luma_msize_x, lx
  21293. Set the luma matrix horizontal size.
  21294. Range is @code{[1, 23]} and default value is @code{5}.
  21295. @item luma_msize_y, ly
  21296. Set the luma matrix vertical size.
  21297. Range is @code{[1, 23]} and default value is @code{5}.
  21298. @item luma_amount, la
  21299. Set the luma effect strength.
  21300. Range is @code{[-10, 10]} and default value is @code{1.0}.
  21301. Negative values will blur the input video, while positive values will
  21302. sharpen it, a value of zero will disable the effect.
  21303. @item chroma_msize_x, cx
  21304. Set the chroma matrix horizontal size.
  21305. Range is @code{[1, 23]} and default value is @code{5}.
  21306. @item chroma_msize_y, cy
  21307. Set the chroma matrix vertical size.
  21308. Range is @code{[1, 23]} and default value is @code{5}.
  21309. @item chroma_amount, ca
  21310. Set the chroma effect strength.
  21311. Range is @code{[-10, 10]} and default value is @code{0.0}.
  21312. Negative values will blur the input video, while positive values will
  21313. sharpen it, a value of zero will disable the effect.
  21314. @end table
  21315. All parameters are optional and default to the equivalent of the
  21316. string '5:5:1.0:5:5:0.0'.
  21317. @subsection Examples
  21318. @itemize
  21319. @item
  21320. Apply strong luma sharpen effect:
  21321. @example
  21322. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  21323. @end example
  21324. @item
  21325. Apply a strong blur of both luma and chroma parameters:
  21326. @example
  21327. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  21328. @end example
  21329. @end itemize
  21330. @section xfade_opencl
  21331. Cross fade two videos with custom transition effect by using OpenCL.
  21332. It accepts the following options:
  21333. @table @option
  21334. @item transition
  21335. Set one of possible transition effects.
  21336. @table @option
  21337. @item custom
  21338. Select custom transition effect, the actual transition description
  21339. will be picked from source and kernel options.
  21340. @item fade
  21341. @item wipeleft
  21342. @item wiperight
  21343. @item wipeup
  21344. @item wipedown
  21345. @item slideleft
  21346. @item slideright
  21347. @item slideup
  21348. @item slidedown
  21349. Default transition is fade.
  21350. @end table
  21351. @item source
  21352. OpenCL program source file for custom transition.
  21353. @item kernel
  21354. Set name of kernel to use for custom transition from program source file.
  21355. @item duration
  21356. Set duration of video transition.
  21357. @item offset
  21358. Set time of start of transition relative to first video.
  21359. @end table
  21360. The program source file must contain a kernel function with the given name,
  21361. which will be run once for each plane of the output. Each run on a plane
  21362. gets enqueued as a separate 2D global NDRange with one work-item for each
  21363. pixel to be generated. The global ID offset for each work-item is therefore
  21364. the coordinates of a pixel in the destination image.
  21365. The kernel function needs to take the following arguments:
  21366. @itemize
  21367. @item
  21368. Destination image, @var{__write_only image2d_t}.
  21369. This image will become the output; the kernel should write all of it.
  21370. @item
  21371. First Source image, @var{__read_only image2d_t}.
  21372. Second Source image, @var{__read_only image2d_t}.
  21373. These are the most recent images on each input. The kernel may read from
  21374. them to generate the output, but they can't be written to.
  21375. @item
  21376. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  21377. @end itemize
  21378. Example programs:
  21379. @itemize
  21380. @item
  21381. Apply dots curtain transition effect:
  21382. @verbatim
  21383. __kernel void blend_images(__write_only image2d_t dst,
  21384. __read_only image2d_t src1,
  21385. __read_only image2d_t src2,
  21386. float progress)
  21387. {
  21388. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  21389. CLK_FILTER_LINEAR);
  21390. int2 p = (int2)(get_global_id(0), get_global_id(1));
  21391. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  21392. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  21393. rp = rp / dim;
  21394. float2 dots = (float2)(20.0, 20.0);
  21395. float2 center = (float2)(0,0);
  21396. float2 unused;
  21397. float4 val1 = read_imagef(src1, sampler, p);
  21398. float4 val2 = read_imagef(src2, sampler, p);
  21399. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  21400. write_imagef(dst, p, next ? val1 : val2);
  21401. }
  21402. @end verbatim
  21403. @end itemize
  21404. @c man end OPENCL VIDEO FILTERS
  21405. @chapter VAAPI Video Filters
  21406. @c man begin VAAPI VIDEO FILTERS
  21407. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  21408. To enable compilation of these filters you need to configure FFmpeg with
  21409. @code{--enable-vaapi}.
  21410. 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}
  21411. @section overlay_vaapi
  21412. Overlay one video on the top of another.
  21413. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21414. The filter accepts the following options:
  21415. @table @option
  21416. @item x
  21417. @item y
  21418. Set expressions for the x and y coordinates of the overlaid video
  21419. on the main video.
  21420. Default value is "0" for both expressions.
  21421. @item w
  21422. @item h
  21423. Set expressions for the width and height the overlaid video
  21424. on the main video.
  21425. Default values are 'overlay_iw' for 'w' and 'overlay_ih*w/overlay_iw' for 'h'.
  21426. The expressions can contain the following parameters:
  21427. @table @option
  21428. @item main_w, W
  21429. @item main_h, H
  21430. The main input width and height.
  21431. @item overlay_iw
  21432. @item overlay_ih
  21433. The overlay input width and height.
  21434. @item overlay_w, w
  21435. @item overlay_h, h
  21436. The overlay output width and height.
  21437. @item overlay_x, x
  21438. @item overlay_y, y
  21439. Position of the overlay layer inside of main
  21440. @end table
  21441. @item alpha
  21442. Set transparency of overlaid video. Allowed range is 0.0 to 1.0.
  21443. Higher value means lower transparency.
  21444. Default value is @code{1.0}.
  21445. @item eof_action
  21446. See @ref{framesync}.
  21447. @item shortest
  21448. See @ref{framesync}.
  21449. @item repeatlast
  21450. See @ref{framesync}.
  21451. @end table
  21452. This filter also supports the @ref{framesync} options.
  21453. @subsection Examples
  21454. @itemize
  21455. @item
  21456. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  21457. @example
  21458. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  21459. @end example
  21460. @item
  21461. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  21462. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  21463. @example
  21464. -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
  21465. @end example
  21466. @end itemize
  21467. @section tonemap_vaapi
  21468. Perform HDR-to-SDR or HDR-to-HDR tone-mapping.
  21469. It currently only accepts HDR10 as input.
  21470. It accepts the following parameters:
  21471. @table @option
  21472. @item format
  21473. Specify the output pixel format.
  21474. Default is nv12 for HDR-to-SDR tone-mapping and p010 for HDR-to-HDR
  21475. tone-mapping.
  21476. @item primaries, p
  21477. Set the output color primaries.
  21478. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21479. tone-mapping.
  21480. @item transfer, t
  21481. Set the output transfer characteristics.
  21482. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21483. tone-mapping.
  21484. @item matrix, m
  21485. Set the output colorspace matrix.
  21486. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21487. tone-mapping.
  21488. @item display
  21489. Set the output mastering display colour volume. It is given by a '|'-separated
  21490. list of two values, two values are space separated. It set display primaries
  21491. x & y in G, B, R order, then white point x & y, the nominal minimum & maximum
  21492. display luminances.
  21493. HDR-to-HDR tone-mapping will be performed when this option is set.
  21494. @item light
  21495. Set the output content light level information. It accepts 2 space-separated
  21496. values, the first input is the maximum light level and the second input is
  21497. the maximum average light level.
  21498. It is ignored for HDR-to-SDR tone-mapping, and optional for HDR-to-HDR
  21499. tone-mapping.
  21500. @end table
  21501. @subsection Example
  21502. @itemize
  21503. @item
  21504. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  21505. @example
  21506. tonemap_vaapi=format=p010:t=bt2020-10
  21507. @end example
  21508. @item
  21509. Convert HDR video to HDR video
  21510. @example
  21511. tonemap_vaapi=display=7500\ 3000|34000\ 16000|13250\ 34500|15635\ 16450|500\ 10000000
  21512. @end example
  21513. @end itemize
  21514. @section hstack_vaapi
  21515. Stack input videos horizontally.
  21516. This is the VA-API variant of the @ref{hstack} filter, each input stream may
  21517. have different height, this filter will scale down/up each input stream while
  21518. keeping the original aspect.
  21519. It accepts the following options:
  21520. @table @option
  21521. @item inputs
  21522. See @ref{hstack}.
  21523. @item shortest
  21524. See @ref{hstack}.
  21525. @item height
  21526. Set height of output. If set to 0, this filter will set height of output to
  21527. height of the first input stream. Default value is 0.
  21528. @end table
  21529. @section vstack_vaapi
  21530. Stack input videos vertically.
  21531. This is the VA-API variant of the @ref{vstack} filter, each input stream may
  21532. have different width, this filter will scale down/up each input stream while
  21533. keeping the original aspect.
  21534. It accepts the following options:
  21535. @table @option
  21536. @item inputs
  21537. See @ref{vstack}.
  21538. @item shortest
  21539. See @ref{vstack}.
  21540. @item width
  21541. Set width of output. If set to 0, this filter will set width of output to
  21542. width of the first input stream. Default value is 0.
  21543. @end table
  21544. @section xstack_vaapi
  21545. Stack video inputs into custom layout.
  21546. This is the VA-API variant of the @ref{xstack} filter, each input stream may
  21547. have different size, this filter will scale down/up each input stream to the
  21548. given output size, or the size of the first input stream.
  21549. It accepts the following options:
  21550. @table @option
  21551. @item inputs
  21552. See @ref{xstack}.
  21553. @item shortest
  21554. See @ref{xstack}.
  21555. @item layout
  21556. See @ref{xstack}.
  21557. Moreover, this permits the user to supply output size for each input stream.
  21558. @example
  21559. xstack_vaapi=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  21560. @end example
  21561. @item grid
  21562. See @ref{xstack}.
  21563. @item grid_tile_size
  21564. Set output size for each input stream when @option{grid} is set. If this option
  21565. is not set, this filter will set output size by default to the size of the
  21566. first input stream. For the syntax of this option, check the
  21567. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21568. @item fill
  21569. See @ref{xstack}.
  21570. @end table
  21571. @section pad_vaapi
  21572. Add paddings to the input image, and place the original input at the
  21573. provided @var{x}, @var{y} coordinates.
  21574. It accepts the following options:
  21575. @table @option
  21576. @item width, w
  21577. @item height, h
  21578. Specify an expression for the size of the output image with the
  21579. paddings added. If the value for @var{width} or @var{height} is 0, the
  21580. corresponding input size is used for the output.
  21581. The @var{width} expression can reference the value set by the
  21582. @var{height} expression, and vice versa.
  21583. The default value of @var{width} and @var{height} is 0.
  21584. @item x
  21585. @item y
  21586. Specify the offsets to place the input image at within the padded area,
  21587. with respect to the top/left border of the output image.
  21588. The @var{x} expression can reference the value set by the @var{y}
  21589. expression, and vice versa.
  21590. The default value of @var{x} and @var{y} is 0.
  21591. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  21592. so the input image is centered on the padded area.
  21593. @item color
  21594. Specify the color of the padded area. For the syntax of this option,
  21595. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  21596. manual,ffmpeg-utils}.
  21597. @item aspect
  21598. Pad to an aspect instead to a resolution.
  21599. @end table
  21600. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  21601. options are expressions containing the following constants:
  21602. @table @option
  21603. @item in_w
  21604. @item in_h
  21605. The input video width and height.
  21606. @item iw
  21607. @item ih
  21608. These are the same as @var{in_w} and @var{in_h}.
  21609. @item out_w
  21610. @item out_h
  21611. The output width and height (the size of the padded area), as
  21612. specified by the @var{width} and @var{height} expressions.
  21613. @item ow
  21614. @item oh
  21615. These are the same as @var{out_w} and @var{out_h}.
  21616. @item x
  21617. @item y
  21618. The x and y offsets as specified by the @var{x} and @var{y}
  21619. expressions, or NAN if not yet specified.
  21620. @item a
  21621. same as @var{iw} / @var{ih}
  21622. @item sar
  21623. input sample aspect ratio
  21624. @item dar
  21625. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  21626. @end table
  21627. @section drawbox_vaapi
  21628. Draw a colored box on the input image.
  21629. It accepts the following parameters:
  21630. @table @option
  21631. @item x
  21632. @item y
  21633. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  21634. @item width, w
  21635. @item height, h
  21636. The expressions which specify the width and height of the box; if 0 they are interpreted as
  21637. the input width and height. It defaults to 0.
  21638. @item color, c
  21639. Specify the color of the box to write. For the general syntax of this option,
  21640. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21641. @item thickness, t
  21642. The expression which sets the thickness of the box edge.
  21643. A value of @code{fill} will create a filled box. Default value is @code{3}.
  21644. See below for the list of accepted constants.
  21645. @item replace
  21646. With value @code{1}, the pixels of the painted box will overwrite the video's color and alpha pixels.
  21647. Default is @code{0}, which composites the box onto the input video.
  21648. @end table
  21649. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  21650. following constants:
  21651. @table @option
  21652. @item in_h, ih
  21653. @item in_w, iw
  21654. The input width and height.
  21655. @item x
  21656. @item y
  21657. The x and y offset coordinates where the box is drawn.
  21658. @item w
  21659. @item h
  21660. The width and height of the drawn box.
  21661. @item t
  21662. The thickness of the drawn box.
  21663. @end table
  21664. @subsection Examples
  21665. @itemize
  21666. @item
  21667. Draw a black box around the edge of the input image:
  21668. @example
  21669. drawbox
  21670. @end example
  21671. @item
  21672. Draw a box with color red and an opacity of 50%:
  21673. @example
  21674. drawbox=10:20:200:60:red@@0.5
  21675. @end example
  21676. The previous example can be specified as:
  21677. @example
  21678. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  21679. @end example
  21680. @item
  21681. Fill the box with pink color:
  21682. @example
  21683. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  21684. @end example
  21685. @item
  21686. Draw a 2-pixel red 2.40:1 mask:
  21687. @example
  21688. 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
  21689. @end example
  21690. @end itemize
  21691. @c man end VAAPI VIDEO FILTERS
  21692. @chapter Vulkan Video Filters
  21693. @c man begin VULKAN VIDEO FILTERS
  21694. Below is a description of the currently available Vulkan video filters.
  21695. To enable compilation of these filters you need to configure FFmpeg with
  21696. @code{--enable-vulkan} and either @code{--enable-libglslang} or @code{--enable-libshaderc}.
  21697. Running Vulkan filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  21698. @table @option
  21699. @item -init_hw_device vulkan[=@var{name}][:@var{device}[,@var{key=value}...]]
  21700. Initialise a new hardware device of type @var{vulkan} called @var{name}, using the
  21701. given device parameters and options in @var{key=value}. The following options
  21702. are supported:
  21703. @table @option
  21704. @item debug
  21705. Switches validation layers on if set to 1.
  21706. @item linear_images
  21707. Allocates linear images. Does not apply to decoding.
  21708. @item disable_multiplane
  21709. Disables multiplane images. Does not apply to decoding.
  21710. @end table
  21711. @item -filter_hw_device @var{name}
  21712. Pass the hardware device called @var{name} to all filters in any filter graph.
  21713. @end table
  21714. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  21715. @itemize
  21716. @item
  21717. Example of choosing the first device and running nlmeans_vulkan filter with default parameters on it.
  21718. @example
  21719. -init_hw_device vulkan=vk:0 -filter_hw_device vk -i INPUT -vf "hwupload,nlmeans_vulkan,hwdownload" OUTPUT
  21720. @end example
  21721. @end itemize
  21722. As Vulkan filters are not able to access frame data in normal memory, all frame data needs to be uploaded (@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded (@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a frame with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it is usually necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
  21723. @section avgblur_vulkan
  21724. Apply an average blur filter, implemented on the GPU using Vulkan.
  21725. The filter accepts the following options:
  21726. @table @option
  21727. @item sizeX
  21728. Set horizontal radius size.
  21729. Range is @code{[1, 32]} and default value is @code{3}.
  21730. @item sizeY
  21731. Set vertical radius size. Range is @code{[1, 32]} and default value is @code{3}.
  21732. @item planes
  21733. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21734. @end table
  21735. @section blend_vulkan
  21736. Blend two Vulkan frames into each other.
  21737. The @code{blend} filter takes two input streams and outputs one
  21738. stream, the first input is the "top" layer and second input is
  21739. "bottom" layer. By default, the output terminates when the longest input terminates.
  21740. A description of the accepted options follows.
  21741. @table @option
  21742. @item c0_mode
  21743. @item c1_mode
  21744. @item c2_mode
  21745. @item c3_mode
  21746. @item all_mode
  21747. Set blend mode for specific pixel component or all pixel components in case
  21748. of @var{all_mode}. Default value is @code{normal}.
  21749. Available values for component modes are:
  21750. @table @samp
  21751. @item normal
  21752. @item multiply
  21753. @end table
  21754. @end table
  21755. @section bwdif_vulkan
  21756. Deinterlacer using @ref{bwdif}, the "Bob Weaver Deinterlacing Filter" algorithm, implemented
  21757. on the GPU using Vulkan.
  21758. It accepts the following parameters:
  21759. @table @option
  21760. @item mode
  21761. The interlacing mode to adopt. It accepts one of the following values:
  21762. @table @option
  21763. @item 0, send_frame
  21764. Output one frame for each frame.
  21765. @item 1, send_field
  21766. Output one frame for each field.
  21767. @end table
  21768. The default value is @code{send_field}.
  21769. @item parity
  21770. The picture field parity assumed for the input interlaced video. It accepts one
  21771. of the following values:
  21772. @table @option
  21773. @item 0, tff
  21774. Assume the top field is first.
  21775. @item 1, bff
  21776. Assume the bottom field is first.
  21777. @item -1, auto
  21778. Enable automatic detection of field parity.
  21779. @end table
  21780. The default value is @code{auto}.
  21781. If the interlacing is unknown or the decoder does not export this information,
  21782. top field first will be assumed.
  21783. @item deint
  21784. Specify which frames to deinterlace. Accepts one of the following
  21785. values:
  21786. @table @option
  21787. @item 0, all
  21788. Deinterlace all frames.
  21789. @item 1, interlaced
  21790. Only deinterlace frames marked as interlaced.
  21791. @end table
  21792. The default value is @code{all}.
  21793. @end table
  21794. @section chromaber_vulkan
  21795. Apply an effect that emulates chromatic aberration. Works best with RGB inputs,
  21796. but provides a similar effect with YCbCr inputs too.
  21797. @table @option
  21798. @item dist_x
  21799. Horizontal displacement multiplier. Each chroma pixel's position will be multiplied
  21800. by this amount, starting from the center of the image. Default is @code{0}.
  21801. @item dist_y
  21802. Similarly, this sets the vertical displacement multiplier. Default is @code{0}.
  21803. @end table
  21804. @section color_vulkan
  21805. Video source that creates a Vulkan frame of a solid color.
  21806. Useful for benchmarking, or overlaying.
  21807. It accepts the following parameters:
  21808. @table @option
  21809. @item color
  21810. The color to use. Either a name, or a hexadecimal value.
  21811. The default value is @code{black}.
  21812. @item size
  21813. The size of the output frame. Default value is @code{1920x1080}.
  21814. @item rate
  21815. The framerate to output at. Default value is @code{60} frames per second.
  21816. @item duration
  21817. The video duration. Default value is @code{-0.000001}.
  21818. @item sar
  21819. The video signal aspect ratio. Default value is @code{1/1}.
  21820. @item format
  21821. The pixel format of the output Vulkan frames. Default value is @code{yuv444p}.
  21822. @item out_range
  21823. Set the output YCbCr sample range.
  21824. This allows the autodetected value to be overridden as well as allows forcing
  21825. a specific value used for the output and encoder. If not specified, the
  21826. range depends on the pixel format. Possible values:
  21827. @table @samp
  21828. @item auto/unknown
  21829. Choose automatically.
  21830. @item jpeg/full/pc
  21831. Set full range (0-255 in case of 8-bit luma).
  21832. @item mpeg/limited/tv
  21833. Set "MPEG" range (16-235 in case of 8-bit luma).
  21834. @end table
  21835. @end table
  21836. @section vflip_vulkan
  21837. Flips an image vertically.
  21838. @section hflip_vulkan
  21839. Flips an image horizontally.
  21840. @section flip_vulkan
  21841. Flips an image along both the vertical and horizontal axis.
  21842. @section gblur_vulkan
  21843. Apply Gaussian blur filter on Vulkan frames.
  21844. The filter accepts the following options:
  21845. @table @option
  21846. @item sigma
  21847. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  21848. @item sigmaV
  21849. Set vertical sigma, if negative it will be same as @code{sigma}.
  21850. Default is @code{-1}.
  21851. @item planes
  21852. Set which planes to filter. By default all planes are filtered.
  21853. @item size
  21854. Set the kernel size along the horizontal axis. Default is @code{19}.
  21855. @item sizeV
  21856. Set the kernel size along the vertical axis. Default is @code{0},
  21857. which sets to use the same value as @var{size}.
  21858. @end table
  21859. @section nlmeans_vulkan
  21860. Denoise frames using Non-Local Means algorithm, implemented on the GPU using
  21861. Vulkan.
  21862. Supports more pixel formats than @ref{nlmeans} or @ref{nlmeans_opencl}, including
  21863. alpha channel support.
  21864. The filter accepts the following options.
  21865. @table @option
  21866. @item s
  21867. Set denoising strength for all components. Default is 1.0. Must be in range [1.0, 100.0].
  21868. @item p
  21869. Set patch size for all planes. Default is 7. Must be odd number in range [0, 99].
  21870. @item r
  21871. Set research size. Default is 15. Must be odd number in range [0, 99].
  21872. @item t
  21873. Set parallelism. Default is 36. Must be a number in the range [1, 168].
  21874. Larger values may speed up processing, at the cost of more VRAM.
  21875. Lower values will slow it down, reducing VRAM usage.
  21876. Only supported on GPUs with atomic float operations (RDNA3+, Ampere+).
  21877. @item s0
  21878. @item s1
  21879. @item s2
  21880. @item s3
  21881. Set denoising strength for a specific component. Default is @var{1}, equal to @option{s}.
  21882. Must be odd number in range [1, 100].
  21883. @item p0
  21884. @item p1
  21885. @item p2
  21886. @item p3
  21887. Set patch size for a specific component. Default is @var{7}, equal to @option{p}.
  21888. Must be odd number in range [0, 99].
  21889. @end table
  21890. @section overlay_vulkan
  21891. Overlay one video on top of another.
  21892. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21893. This filter requires all inputs to use the same pixel format. So, format conversion may be needed.
  21894. The filter accepts the following options:
  21895. @table @option
  21896. @item x
  21897. Set the x coordinate of the overlaid video on the main video.
  21898. Default value is @code{0}.
  21899. @item y
  21900. Set the y coordinate of the overlaid video on the main video.
  21901. Default value is @code{0}.
  21902. @end table
  21903. @section transpose_vt
  21904. Transpose rows with columns in the input video and optionally flip it.
  21905. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21906. It accepts the following parameters:
  21907. @table @option
  21908. @item dir
  21909. Specify the transposition direction.
  21910. Can assume the following values:
  21911. @table @samp
  21912. @item cclock_flip
  21913. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21914. @item clock
  21915. Rotate by 90 degrees clockwise.
  21916. @item cclock
  21917. Rotate by 90 degrees counterclockwise.
  21918. @item clock_flip
  21919. Rotate by 90 degrees clockwise and vertically flip.
  21920. @item hflip
  21921. Flip the input video horizontally.
  21922. @item vflip
  21923. Flip the input video vertically.
  21924. @end table
  21925. @item passthrough
  21926. Do not apply the transposition if the input geometry matches the one
  21927. specified by the specified value. It accepts the following values:
  21928. @table @samp
  21929. @item none
  21930. Always apply transposition. (default)
  21931. @item portrait
  21932. Preserve portrait geometry (when @var{height} >= @var{width}).
  21933. @item landscape
  21934. Preserve landscape geometry (when @var{width} >= @var{height}).
  21935. @end table
  21936. @end table
  21937. @section transpose_vulkan
  21938. Transpose rows with columns in the input video and optionally flip it.
  21939. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21940. It accepts the following parameters:
  21941. @table @option
  21942. @item dir
  21943. Specify the transposition direction.
  21944. Can assume the following values:
  21945. @table @samp
  21946. @item cclock_flip
  21947. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21948. @item clock
  21949. Rotate by 90 degrees clockwise.
  21950. @item cclock
  21951. Rotate by 90 degrees counterclockwise.
  21952. @item clock_flip
  21953. Rotate by 90 degrees clockwise and vertically flip.
  21954. @end table
  21955. @item passthrough
  21956. Do not apply the transposition if the input geometry matches the one
  21957. specified by the specified value. It accepts the following values:
  21958. @table @samp
  21959. @item none
  21960. Always apply transposition. (default)
  21961. @item portrait
  21962. Preserve portrait geometry (when @var{height} >= @var{width}).
  21963. @item landscape
  21964. Preserve landscape geometry (when @var{width} >= @var{height}).
  21965. @end table
  21966. @end table
  21967. @c man end VULKAN VIDEO FILTERS
  21968. @chapter QSV Video Filters
  21969. @c man begin QSV VIDEO FILTERS
  21970. Below is a description of the currently available QSV video filters.
  21971. To enable compilation of these filters you need to configure FFmpeg with
  21972. @code{--enable-libmfx} or @code{--enable-libvpl}.
  21973. To use QSV filters, you need to setup the QSV device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/QuickSync}
  21974. @section hstack_qsv
  21975. Stack input videos horizontally.
  21976. This is the QSV variant of the @ref{hstack} filter, each input stream may
  21977. have different height, this filter will scale down/up each input stream while
  21978. keeping the original aspect.
  21979. It accepts the following options:
  21980. @table @option
  21981. @item inputs
  21982. See @ref{hstack}.
  21983. @item shortest
  21984. See @ref{hstack}.
  21985. @item height
  21986. Set height of output. If set to 0, this filter will set height of output to
  21987. height of the first input stream. Default value is 0.
  21988. @end table
  21989. @section vstack_qsv
  21990. Stack input videos vertically.
  21991. This is the QSV variant of the @ref{vstack} filter, each input stream may
  21992. have different width, this filter will scale down/up each input stream while
  21993. keeping the original aspect.
  21994. It accepts the following options:
  21995. @table @option
  21996. @item inputs
  21997. See @ref{vstack}.
  21998. @item shortest
  21999. See @ref{vstack}.
  22000. @item width
  22001. Set width of output. If set to 0, this filter will set width of output to
  22002. width of the first input stream. Default value is 0.
  22003. @end table
  22004. @section xstack_qsv
  22005. Stack video inputs into custom layout.
  22006. This is the QSV variant of the @ref{xstack} filter.
  22007. It accepts the following options:
  22008. @table @option
  22009. @item inputs
  22010. See @ref{xstack}.
  22011. @item shortest
  22012. See @ref{xstack}.
  22013. @item layout
  22014. See @ref{xstack}.
  22015. Moreover, this permits the user to supply output size for each input stream.
  22016. @example
  22017. xstack_qsv=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  22018. @end example
  22019. @item grid
  22020. See @ref{xstack}.
  22021. @item grid_tile_size
  22022. Set output size for each input stream when @option{grid} is set. If this option
  22023. is not set, this filter will set output size by default to the size of the
  22024. first input stream. For the syntax of this option, check the
  22025. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22026. @item fill
  22027. See @ref{xstack}.
  22028. @end table
  22029. @c man end QSV VIDEO FILTERS
  22030. @chapter Video Sources
  22031. @c man begin VIDEO SOURCES
  22032. Below is a description of the currently available video sources.
  22033. @section buffer
  22034. Buffer video frames, and make them available to the filter chain.
  22035. This source is mainly intended for a programmatic use, in particular
  22036. through the interface defined in @file{libavfilter/buffersrc.h}.
  22037. It accepts the following parameters:
  22038. @table @option
  22039. @item video_size
  22040. Specify the size (width and height) of the buffered video frames. For the
  22041. syntax of this option, check the
  22042. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22043. @item width
  22044. The input video width.
  22045. @item height
  22046. The input video height.
  22047. @item pix_fmt
  22048. A string representing the pixel format of the buffered video frames.
  22049. It may be a number corresponding to a pixel format, or a pixel format
  22050. name.
  22051. @item time_base
  22052. Specify the timebase assumed by the timestamps of the buffered frames.
  22053. @item frame_rate
  22054. Specify the frame rate expected for the video stream.
  22055. @item colorspace
  22056. A string representing the color space of the buffered video frames.
  22057. It may be a number corresponding to a color space, or a color space
  22058. name.
  22059. @item range
  22060. A string representing the color range of the buffered video frames.
  22061. It may be a number corresponding to a color range, or a color range
  22062. name.
  22063. @item pixel_aspect, sar
  22064. The sample (pixel) aspect ratio of the input video.
  22065. @item hw_frames_ctx
  22066. When using a hardware pixel format, this should be a reference to an
  22067. AVHWFramesContext describing input frames.
  22068. @end table
  22069. For example:
  22070. @example
  22071. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  22072. @end example
  22073. will instruct the source to accept video frames with size 320x240 and
  22074. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  22075. square pixels (1:1 sample aspect ratio).
  22076. Since the pixel format with name "yuv410p" corresponds to the number 6
  22077. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  22078. this example corresponds to:
  22079. @example
  22080. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  22081. @end example
  22082. Alternatively, the options can be specified as a flat string, but this
  22083. syntax is deprecated:
  22084. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  22085. @section cellauto
  22086. Create a pattern generated by an elementary cellular automaton.
  22087. The initial state of the cellular automaton can be defined through the
  22088. @option{filename} and @option{pattern} options. If such options are
  22089. not specified an initial state is created randomly.
  22090. At each new frame a new row in the video is filled with the result of
  22091. the cellular automaton next generation. The behavior when the whole
  22092. frame is filled is defined by the @option{scroll} option.
  22093. This source accepts the following options:
  22094. @table @option
  22095. @item filename, f
  22096. Read the initial cellular automaton state, i.e. the starting row, from
  22097. the specified file.
  22098. In the file, each non-whitespace character is considered an alive
  22099. cell, a newline will terminate the row, and further characters in the
  22100. file will be ignored.
  22101. @item pattern, p
  22102. Read the initial cellular automaton state, i.e. the starting row, from
  22103. the specified string.
  22104. Each non-whitespace character in the string is considered an alive
  22105. cell, a newline will terminate the row, and further characters in the
  22106. string will be ignored.
  22107. @item rate, r
  22108. Set the video rate, that is the number of frames generated per second.
  22109. Default is 25.
  22110. @item random_fill_ratio, ratio
  22111. Set the random fill ratio for the initial cellular automaton row. It
  22112. is a floating point number value ranging from 0 to 1, defaults to
  22113. 1/PHI.
  22114. This option is ignored when a file or a pattern is specified.
  22115. @item random_seed, seed
  22116. Set the seed for filling randomly the initial row, must be an integer
  22117. included between 0 and UINT32_MAX. If not specified, or if explicitly
  22118. set to -1, the filter will try to use a good random seed on a best
  22119. effort basis.
  22120. @item rule
  22121. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  22122. Default value is 110.
  22123. @item size, s
  22124. Set the size of the output video. For the syntax of this option, check the
  22125. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22126. If @option{filename} or @option{pattern} is specified, the size is set
  22127. by default to the width of the specified initial state row, and the
  22128. height is set to @var{width} * PHI.
  22129. If @option{size} is set, it must contain the width of the specified
  22130. pattern string, and the specified pattern will be centered in the
  22131. larger row.
  22132. If a filename or a pattern string is not specified, the size value
  22133. defaults to "320x518" (used for a randomly generated initial state).
  22134. @item scroll
  22135. If set to 1, scroll the output upward when all the rows in the output
  22136. have been already filled. If set to 0, the new generated row will be
  22137. written over the top row just after the bottom row is filled.
  22138. Defaults to 1.
  22139. @item start_full, full
  22140. If set to 1, completely fill the output with generated rows before
  22141. outputting the first frame.
  22142. This is the default behavior, for disabling set the value to 0.
  22143. @item stitch
  22144. If set to 1, stitch the left and right row edges together.
  22145. This is the default behavior, for disabling set the value to 0.
  22146. @end table
  22147. @subsection Examples
  22148. @itemize
  22149. @item
  22150. Read the initial state from @file{pattern}, and specify an output of
  22151. size 200x400.
  22152. @example
  22153. cellauto=f=pattern:s=200x400
  22154. @end example
  22155. @item
  22156. Generate a random initial row with a width of 200 cells, with a fill
  22157. ratio of 2/3:
  22158. @example
  22159. cellauto=ratio=2/3:s=200x200
  22160. @end example
  22161. @item
  22162. Create a pattern generated by rule 18 starting by a single alive cell
  22163. centered on an initial row with width 100:
  22164. @example
  22165. cellauto=p=@@:s=100x400:full=0:rule=18
  22166. @end example
  22167. @item
  22168. Specify a more elaborated initial pattern:
  22169. @example
  22170. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  22171. @end example
  22172. @end itemize
  22173. @anchor{coreimagesrc}
  22174. @section coreimagesrc
  22175. Video source generated on GPU using Apple's CoreImage API on OSX.
  22176. This video source is a specialized version of the @ref{coreimage} video filter.
  22177. Use a core image generator at the beginning of the applied filterchain to
  22178. generate the content.
  22179. The coreimagesrc video source accepts the following options:
  22180. @table @option
  22181. @item list_generators
  22182. List all available generators along with all their respective options as well as
  22183. possible minimum and maximum values along with the default values.
  22184. @example
  22185. list_generators=true
  22186. @end example
  22187. @item size, s
  22188. Specify the size of the sourced video. For the syntax of this option, check the
  22189. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22190. The default value is @code{320x240}.
  22191. @item rate, r
  22192. Specify the frame rate of the sourced video, as the number of frames
  22193. generated per second. It has to be a string in the format
  22194. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22195. number or a valid video frame rate abbreviation. The default value is
  22196. "25".
  22197. @item sar
  22198. Set the sample aspect ratio of the sourced video.
  22199. @item duration, d
  22200. Set the duration of the sourced video. See
  22201. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22202. for the accepted syntax.
  22203. If not specified, or the expressed duration is negative, the video is
  22204. supposed to be generated forever.
  22205. @end table
  22206. Additionally, all options of the @ref{coreimage} video filter are accepted.
  22207. A complete filterchain can be used for further processing of the
  22208. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  22209. and examples for details.
  22210. @subsection Examples
  22211. @itemize
  22212. @item
  22213. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  22214. given as complete and escaped command-line for Apple's standard bash shell:
  22215. @example
  22216. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  22217. @end example
  22218. This example is equivalent to the QRCode example of @ref{coreimage} without the
  22219. need for a nullsrc video source.
  22220. @end itemize
  22221. @section ddagrab
  22222. Captures the Windows Desktop via Desktop Duplication API.
  22223. The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding
  22224. or processing. So an explicit @ref{hwdownload} is needed for any kind of
  22225. software processing.
  22226. It accepts the following options:
  22227. @table @option
  22228. @item output_idx
  22229. DXGI Output Index to capture.
  22230. Usually corresponds to the index Windows has given the screen minus one,
  22231. so it's starting at 0.
  22232. Defaults to output 0.
  22233. @item draw_mouse
  22234. Whether to draw the mouse cursor.
  22235. Defaults to true.
  22236. Only affects hardware cursors. If a game or application renders its own cursor,
  22237. it'll always be captured.
  22238. @item framerate
  22239. Maximum framerate at which the desktop will be captured - the interval between
  22240. successive frames will not be smaller than the inverse of the framerate. When
  22241. @var{dup_frames} is true (the default) and the desktop is not being updated
  22242. often enough, the filter will duplicate a previous frame. Note that there is no
  22243. background buffering going on, so when the filter is not polled often enough
  22244. then the actual inter-frame interval may be significantly larger.
  22245. Defaults to 30 FPS.
  22246. @item video_size
  22247. Specify the size of the captured video.
  22248. Defaults to the full size of the screen.
  22249. Cropped from the bottom/right if smaller than screen size.
  22250. @item offset_x
  22251. Horizontal offset of the captured video.
  22252. @item offset_y
  22253. Vertical offset of the captured video.
  22254. @item output_fmt
  22255. Desired filter output format.
  22256. Defaults to 8 Bit BGRA.
  22257. It accepts the following values:
  22258. @table @samp
  22259. @item auto
  22260. Passes all supported output formats to DDA and returns what DDA decides to use.
  22261. @item 8bit
  22262. @item bgra
  22263. 8 Bit formats always work, and DDA will convert to them if necessary.
  22264. @item 10bit
  22265. @item x2bgr10
  22266. Filter initialization will fail if 10 bit format is requested but unavailable.
  22267. @end table
  22268. @item dup_frames
  22269. When this option is set to true (the default), the filter will duplicate frames
  22270. when the desktop has not been updated in order to maintain approximately
  22271. constant target framerate. When this option is set to false, the filter will
  22272. wait for the desktop to be updated (inter-frame intervals may vary significantly
  22273. in this case).
  22274. @end table
  22275. @subsection Examples
  22276. Capture primary screen and encode using nvenc:
  22277. @example
  22278. ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4
  22279. @end example
  22280. You can also skip the lavfi device and directly use the filter.
  22281. Also demonstrates downloading the frame and encoding with libx264.
  22282. Explicit output format specification is required in this case:
  22283. @example
  22284. ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4
  22285. @end example
  22286. If you want to capture only a subsection of the desktop, this can be achieved
  22287. by specifying a smaller size and its offsets into the screen:
  22288. @example
  22289. ddagrab=video_size=800x600:offset_x=100:offset_y=100
  22290. @end example
  22291. @section gradients
  22292. Generate several gradients.
  22293. @table @option
  22294. @item size, s
  22295. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22296. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22297. @item rate, r
  22298. Set frame rate, expressed as number of frames per second. Default
  22299. value is "25".
  22300. @item c0, c1, c2, c3, c4, c5, c6, c7
  22301. Set 8 colors. Default values for colors is to pick random one.
  22302. @item x0, y0, y0, y1
  22303. Set gradient line source and destination points. If negative or out of range, random ones
  22304. are picked.
  22305. @item nb_colors, n
  22306. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  22307. @item seed
  22308. Set seed for picking gradient line points.
  22309. @item duration, d
  22310. Set the duration of the sourced video. See
  22311. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22312. for the accepted syntax.
  22313. If not specified, or the expressed duration is negative, the video is
  22314. supposed to be generated forever.
  22315. @item speed
  22316. Set speed of gradients rotation.
  22317. @item type, t
  22318. Set type of gradients.
  22319. Available values are:
  22320. @table @samp
  22321. @item linear
  22322. @item radial
  22323. @item circular
  22324. @item spiral
  22325. @item square
  22326. @end table
  22327. Default type is @var{linear}.
  22328. @end table
  22329. @subsection Commands
  22330. This source supports the some above options as @ref{commands}.
  22331. @section mandelbrot
  22332. Generate a Mandelbrot set fractal, and progressively zoom towards the
  22333. point specified with @var{start_x} and @var{start_y}.
  22334. This source accepts the following options:
  22335. @table @option
  22336. @item end_pts
  22337. Set the terminal pts value. Default value is 400.
  22338. @item end_scale
  22339. Set the terminal scale value.
  22340. Must be a floating point value. Default value is 0.3.
  22341. @item inner
  22342. Set the inner coloring mode, that is the algorithm used to draw the
  22343. Mandelbrot fractal internal region.
  22344. It shall assume one of the following values:
  22345. @table @option
  22346. @item black
  22347. Set black mode.
  22348. @item convergence
  22349. Show time until convergence.
  22350. @item mincol
  22351. Set color based on point closest to the origin of the iterations.
  22352. @item period
  22353. Set period mode.
  22354. @end table
  22355. Default value is @var{mincol}.
  22356. @item bailout
  22357. Set the bailout value. Default value is 10.0.
  22358. @item maxiter
  22359. Set the maximum of iterations performed by the rendering
  22360. algorithm. Default value is 7189.
  22361. @item outer
  22362. Set outer coloring mode.
  22363. It shall assume one of following values:
  22364. @table @option
  22365. @item iteration_count
  22366. Set iteration count mode.
  22367. @item normalized_iteration_count
  22368. set normalized iteration count mode.
  22369. @end table
  22370. Default value is @var{normalized_iteration_count}.
  22371. @item rate, r
  22372. Set frame rate, expressed as number of frames per second. Default
  22373. value is "25".
  22374. @item size, s
  22375. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22376. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22377. @item start_scale
  22378. Set the initial scale value. Default value is 3.0.
  22379. @item start_x
  22380. Set the initial x position. Must be a floating point value between
  22381. -100 and 100. Default value is -0.743643887037158704752191506114774.
  22382. @item start_y
  22383. Set the initial y position. Must be a floating point value between
  22384. -100 and 100. Default value is -0.131825904205311970493132056385139.
  22385. @end table
  22386. @section mptestsrc
  22387. Generate various test patterns, as generated by the MPlayer test filter.
  22388. The size of the generated video is fixed, and is 512x512.
  22389. This source is useful in particular for testing encoding features.
  22390. This source accepts the following options:
  22391. @table @option
  22392. @item rate, r
  22393. Specify the frame rate of the sourced video, as the number of frames
  22394. generated per second. It has to be a string in the format
  22395. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22396. number or a valid video frame rate abbreviation. The default value is
  22397. "25".
  22398. @item duration, d
  22399. Set the duration of the sourced video. See
  22400. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22401. for the accepted syntax.
  22402. If not specified, or the expressed duration is negative, the video is
  22403. supposed to be generated forever.
  22404. @item test, t
  22405. Set the number or the name of the test to perform. Supported tests are:
  22406. @table @option
  22407. @item dc_luma
  22408. @item dc_chroma
  22409. @item freq_luma
  22410. @item freq_chroma
  22411. @item amp_luma
  22412. @item amp_chroma
  22413. @item cbp
  22414. @item mv
  22415. @item ring1
  22416. @item ring2
  22417. @item all
  22418. @item max_frames, m
  22419. Set the maximum number of frames generated for each test, default value is 30.
  22420. @end table
  22421. Default value is "all", which will cycle through the list of all tests.
  22422. @end table
  22423. Some examples:
  22424. @example
  22425. mptestsrc=t=dc_luma
  22426. @end example
  22427. will generate a "dc_luma" test pattern.
  22428. @section frei0r_src
  22429. Provide a frei0r source.
  22430. To enable compilation of this filter you need to install the frei0r
  22431. header and configure FFmpeg with @code{--enable-frei0r}.
  22432. This source accepts the following parameters:
  22433. @table @option
  22434. @item size
  22435. The size of the video to generate. For the syntax of this option, check the
  22436. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22437. @item framerate
  22438. The framerate of the generated video. It may be a string of the form
  22439. @var{num}/@var{den} or a frame rate abbreviation.
  22440. @item filter_name
  22441. The name to the frei0r source to load. For more information regarding frei0r and
  22442. how to set the parameters, read the @ref{frei0r} section in the video filters
  22443. documentation.
  22444. @item filter_params
  22445. A '|'-separated list of parameters to pass to the frei0r source.
  22446. @end table
  22447. For example, to generate a frei0r partik0l source with size 200x200
  22448. and frame rate 10 which is overlaid on the overlay filter main input:
  22449. @example
  22450. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  22451. @end example
  22452. @section life
  22453. Generate a life pattern.
  22454. This source is based on a generalization of John Conway's life game.
  22455. The sourced input represents a life grid, each pixel represents a cell
  22456. which can be in one of two possible states, alive or dead. Every cell
  22457. interacts with its eight neighbours, which are the cells that are
  22458. horizontally, vertically, or diagonally adjacent.
  22459. At each interaction the grid evolves according to the adopted rule,
  22460. which specifies the number of neighbor alive cells which will make a
  22461. cell stay alive or born. The @option{rule} option allows one to specify
  22462. the rule to adopt.
  22463. This source accepts the following options:
  22464. @table @option
  22465. @item filename, f
  22466. Set the file from which to read the initial grid state. In the file,
  22467. each non-whitespace character is considered an alive cell, and newline
  22468. is used to delimit the end of each row.
  22469. If this option is not specified, the initial grid is generated
  22470. randomly.
  22471. @item rate, r
  22472. Set the video rate, that is the number of frames generated per second.
  22473. Default is 25.
  22474. @item random_fill_ratio, ratio
  22475. Set the random fill ratio for the initial random grid. It is a
  22476. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  22477. It is ignored when a file is specified.
  22478. @item random_seed, seed
  22479. Set the seed for filling the initial random grid, must be an integer
  22480. included between 0 and UINT32_MAX. If not specified, or if explicitly
  22481. set to -1, the filter will try to use a good random seed on a best
  22482. effort basis.
  22483. @item rule
  22484. Set the life rule.
  22485. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  22486. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  22487. @var{NS} specifies the number of alive neighbor cells which make a
  22488. live cell stay alive, and @var{NB} the number of alive neighbor cells
  22489. which make a dead cell to become alive (i.e. to "born").
  22490. "s" and "b" can be used in place of "S" and "B", respectively.
  22491. Alternatively a rule can be specified by an 18-bits integer. The 9
  22492. high order bits are used to encode the next cell state if it is alive
  22493. for each number of neighbor alive cells, the low order bits specify
  22494. the rule for "borning" new cells. Higher order bits encode for an
  22495. higher number of neighbor cells.
  22496. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  22497. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  22498. Default value is "S23/B3", which is the original Conway's game of life
  22499. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  22500. cells, and will born a new cell if there are three alive cells around
  22501. a dead cell.
  22502. @item size, s
  22503. Set the size of the output video. For the syntax of this option, check the
  22504. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22505. If @option{filename} is specified, the size is set by default to the
  22506. same size of the input file. If @option{size} is set, it must contain
  22507. the size specified in the input file, and the initial grid defined in
  22508. that file is centered in the larger resulting area.
  22509. If a filename is not specified, the size value defaults to "320x240"
  22510. (used for a randomly generated initial grid).
  22511. @item stitch
  22512. If set to 1, stitch the left and right grid edges together, and the
  22513. top and bottom edges also. Defaults to 1.
  22514. @item mold
  22515. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  22516. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  22517. value from 0 to 255.
  22518. @item life_color
  22519. Set the color of living (or new born) cells.
  22520. @item death_color
  22521. Set the color of dead cells. If @option{mold} is set, this is the first color
  22522. used to represent a dead cell.
  22523. @item mold_color
  22524. Set mold color, for definitely dead and moldy cells.
  22525. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  22526. ffmpeg-utils manual,ffmpeg-utils}.
  22527. @end table
  22528. @subsection Examples
  22529. @itemize
  22530. @item
  22531. Read a grid from @file{pattern}, and center it on a grid of size
  22532. 300x300 pixels:
  22533. @example
  22534. life=f=pattern:s=300x300
  22535. @end example
  22536. @item
  22537. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  22538. @example
  22539. life=ratio=2/3:s=200x200
  22540. @end example
  22541. @item
  22542. Specify a custom rule for evolving a randomly generated grid:
  22543. @example
  22544. life=rule=S14/B34
  22545. @end example
  22546. @item
  22547. Full example with slow death effect (mold) using @command{ffplay}:
  22548. @example
  22549. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  22550. @end example
  22551. @end itemize
  22552. @section perlin
  22553. Generate Perlin noise.
  22554. Perlin noise is a kind of noise with local continuity in space. This
  22555. can be used to generate patterns with continuity in space and time,
  22556. e.g. to simulate smoke, fluids, or terrain.
  22557. In case more than one octave is specified through the @option{octaves}
  22558. option, Perlin noise is generated as a sum of components, each one
  22559. with doubled frequency. In this case the @option{persistence} option
  22560. specify the ratio of the amplitude with respect to the previous
  22561. component. More octave components enable to specify more high
  22562. frequency details in the generated noise (e.g. small size variations
  22563. due to boulders in a generated terrain).
  22564. @subsection Options
  22565. @table @option
  22566. @item size, s
  22567. Specify the size (width and height) of the buffered video frames. For the
  22568. syntax of this option, check the
  22569. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22570. Default value is @code{320x240}.
  22571. @item rate, r
  22572. Specify the frame rate expected for the video stream, expressed as a
  22573. number of frames per second. Default value is @code{25}.
  22574. @item octaves
  22575. Specify the total number of components making up the noise, each one
  22576. with doubled frequency. Default value is @code{1}.
  22577. @item persistence
  22578. Set the ratio used to compute the amplitude of the next octave
  22579. component with respect to the previous component amplitude. Default
  22580. value is @code{1}.
  22581. @item xscale
  22582. @item yscale
  22583. Define a scale factor used to multiple the x, y coordinates. This can
  22584. be useful to define an effect with a pattern stretched along the x or
  22585. y axis. Default value is @code{1}.
  22586. @item tscale
  22587. Define a scale factor used to multiple the time coordinate. This can
  22588. be useful to change the time variation speed. Default value is @code{1}.
  22589. @item random_mode
  22590. Set random mode used to compute initial pattern.
  22591. Supported values are:
  22592. @table @option
  22593. @item random
  22594. Compute and use random seed.
  22595. @item ken
  22596. Use the predefined initial pattern defined by Ken Perlin in the
  22597. original article, can be useful to compare the output with other
  22598. sources.
  22599. @item seed
  22600. Use the value specified by @option{random_seed} option.
  22601. @end table
  22602. Default value is @code{random}.
  22603. @item random_seed, seed
  22604. When @option{random_mode} is set to @var{random_seed}, use this value
  22605. to compute the initial pattern. Default value is @code{0}.
  22606. @end table
  22607. @subsection Examples
  22608. @itemize
  22609. @item
  22610. Generate single component:
  22611. @example
  22612. perlin
  22613. @end example
  22614. @item
  22615. Use Perlin noise with 7 components, each one with a halved contribution
  22616. to total amplitude:
  22617. @example
  22618. perlin=octaves=7:persistence=0.5
  22619. @end example
  22620. @item
  22621. Chain Perlin noise with the @ref{lutyuv} to generate a black&white
  22622. effect:
  22623. @example
  22624. perlin=octaves=3:tscale=0.3,lutyuv=y='if(lt(val\,128)\,255\,0)'
  22625. @end example
  22626. @item
  22627. Stretch noise along the y axis, and convert gray level to red-only
  22628. signal:
  22629. @example
  22630. perlin=octaves=7:tscale=0.4:yscale=0.3,lutrgb=r=val:b=0:g=0
  22631. @end example
  22632. @end itemize
  22633. @section qrencodesrc
  22634. Generate a QR code using the libqrencode library (see
  22635. @url{https://fukuchi.org/works/qrencode/}).
  22636. To enable the compilation of this source, you need to configure FFmpeg with
  22637. @code{--enable-libqrencode}.
  22638. The QR code is generated from the provided text or text pattern. The
  22639. corresponding QR code is scaled and put in the video output according to the
  22640. specified output size options.
  22641. In case no text is specified, the QR code is not generated, but an empty colored
  22642. output is returned instead.
  22643. This source accepts the following options:
  22644. @table @option
  22645. @item qrcode_width, q
  22646. @item padded_qrcode_width, Q
  22647. Specify an expression for the width of the rendered QR code, with and without
  22648. padding. The @var{qrcode_width} expression can reference the value set by the
  22649. @var{padded_qrcode_width} expression, and vice versa.
  22650. By default @var{padded_qrcode_width} is set to @var{qrcode_width}, meaning that
  22651. there is no padding.
  22652. These expressions are evaluated only once, when initializing the source.
  22653. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  22654. Note that some of the constants are missing for the source (for example the
  22655. @var{x} or @var{t} or ¸@var{n}), since they only makes sense when evaluating the
  22656. expression for each frame rather than at initialization time.
  22657. @item rate, r
  22658. Specify the frame rate of the sourced video, as the number of frames
  22659. generated per second. It has to be a string in the format
  22660. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22661. number or a valid video frame rate abbreviation. The default value is
  22662. "25".
  22663. @item case_sensitive, cs
  22664. Instruct libqrencode to use case sensitive encoding. This is enabled by
  22665. default. This can be disabled to reduce the QR encoding size.
  22666. @item level, l
  22667. Specify the QR encoding error correction level. With an higher correction level,
  22668. the encoding size will increase but the code will be more robust to corruption.
  22669. Lower level is @var{L}.
  22670. It accepts the following values:
  22671. @table @samp
  22672. @item L
  22673. @item M
  22674. @item Q
  22675. @item H
  22676. @end table
  22677. @item expansion
  22678. Select how the input text is expanded. Can be either @code{none}, or
  22679. @code{normal} (default). See the @ref{qrencode_text_expansion,,qrencode Text expansion}
  22680. section for details.
  22681. @item text
  22682. @item textfile
  22683. Define the text to be rendered. In case neither is specified, no QR is encoded
  22684. (just an empty colored frame).
  22685. In case expansion is enabled, the text is treated as a text template, using the
  22686. qrencode expansion mechanism. See the @ref{qrencode_text_expansion,,qrencode
  22687. Text expansion} section for details.
  22688. @item background_color, bc
  22689. @item foreground_color, fc
  22690. Set the QR code and background color. The default value of
  22691. @var{foreground_color} is "black", the default value of @var{background_color}
  22692. is "white".
  22693. For the syntax of the color options, check the @ref{color syntax,,"Color"
  22694. section in the ffmpeg-utils manual,ffmpeg-utils}.
  22695. @end table
  22696. @subsection Examples
  22697. @itemize
  22698. @item
  22699. Generate a QR code encoding the specified text with the default size:
  22700. @example
  22701. qrencodesrc=text=www.ffmpeg.org
  22702. @end example
  22703. @item
  22704. Same as below, but select blue on pink colors:
  22705. @example
  22706. qrencodesrc=text=www.ffmpeg.org:bc=pink:fc=blue
  22707. @end example
  22708. @item
  22709. Generate a QR code with width of 200 pixels and padding, making the padded width
  22710. 4/3 of the QR code width:
  22711. @example
  22712. qrencodesrc=text=www.ffmpeg.org:q=200:Q=4/3*q
  22713. @end example
  22714. @item
  22715. Generate a QR code with padded width of 200 pixels and padding, making the QR
  22716. code width 3/4 of the padded width:
  22717. @example
  22718. qrencodesrc=text=www.ffmpeg.org:Q=200:q=3/4*Q
  22719. @end example
  22720. @item
  22721. Generate a QR code encoding the frame number:
  22722. @example
  22723. qrencodesrc=text=%@{n@}
  22724. @end example
  22725. @item
  22726. Generate a QR code encoding the GMT timestamp:
  22727. @example
  22728. qrencodesrc=text=%@{gmtime@}
  22729. @end example
  22730. @item
  22731. Generate a QR code encoding the timestamp expressed as a float:
  22732. @example
  22733. qrencodesrc=text=%@{pts@}
  22734. @end example
  22735. @end itemize
  22736. @anchor{allrgb}
  22737. @anchor{allyuv}
  22738. @anchor{color}
  22739. @anchor{colorchart}
  22740. @anchor{colorspectrum}
  22741. @anchor{haldclutsrc}
  22742. @anchor{nullsrc}
  22743. @anchor{pal75bars}
  22744. @anchor{pal100bars}
  22745. @anchor{rgbtestsrc}
  22746. @anchor{smptebars}
  22747. @anchor{smptehdbars}
  22748. @anchor{testsrc}
  22749. @anchor{testsrc2}
  22750. @anchor{yuvtestsrc}
  22751. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  22752. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  22753. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  22754. The @code{color} source provides an uniformly colored input.
  22755. The @code{colorchart} source provides a colors checker chart.
  22756. The @code{colorspectrum} source provides a color spectrum input.
  22757. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  22758. @ref{haldclut} filter.
  22759. The @code{nullsrc} source returns unprocessed video frames. It is
  22760. mainly useful to be employed in analysis / debugging tools, or as the
  22761. source for filters which ignore the input data.
  22762. The @code{pal75bars} source generates a color bars pattern, based on
  22763. EBU PAL recommendations with 75% color levels.
  22764. The @code{pal100bars} source generates a color bars pattern, based on
  22765. EBU PAL recommendations with 100% color levels.
  22766. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  22767. detecting RGB vs BGR issues. You should see a red, green and blue
  22768. stripe from top to bottom.
  22769. The @code{smptebars} source generates a color bars pattern, based on
  22770. the SMPTE Engineering Guideline EG 1-1990.
  22771. The @code{smptehdbars} source generates a color bars pattern, based on
  22772. the SMPTE RP 219-2002.
  22773. The @code{testsrc} source generates a test video pattern, showing a
  22774. color pattern, a scrolling gradient and a timestamp. This is mainly
  22775. intended for testing purposes.
  22776. The @code{testsrc2} source is similar to testsrc, but supports more
  22777. pixel formats instead of just @code{rgb24}. This allows using it as an
  22778. input for other tests without requiring a format conversion.
  22779. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  22780. see a y, cb and cr stripe from top to bottom.
  22781. The sources accept the following parameters:
  22782. @table @option
  22783. @item level
  22784. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  22785. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  22786. pixels to be used as identity matrix for 3D lookup tables. Each component is
  22787. coded on a @code{1/(N*N)} scale.
  22788. @item color, c
  22789. Specify the color of the source, only available in the @code{color}
  22790. source. For the syntax of this option, check the
  22791. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22792. @item size, s
  22793. Specify the size of the sourced video. For the syntax of this option, check the
  22794. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22795. The default value is @code{320x240}.
  22796. This option is not available with the @code{allrgb}, @code{allyuv}, and
  22797. @code{haldclutsrc} filters.
  22798. @item rate, r
  22799. Specify the frame rate of the sourced video, as the number of frames
  22800. generated per second. It has to be a string in the format
  22801. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22802. number or a valid video frame rate abbreviation. The default value is
  22803. "25".
  22804. @item duration, d
  22805. Set the duration of the sourced video. See
  22806. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22807. for the accepted syntax.
  22808. If not specified, or the expressed duration is negative, the video is
  22809. supposed to be generated forever.
  22810. Since the frame rate is used as time base, all frames including the last one
  22811. will have their full duration. If the specified duration is not a multiple
  22812. of the frame duration, it will be rounded up.
  22813. @item sar
  22814. Set the sample aspect ratio of the sourced video.
  22815. @item alpha
  22816. Specify the alpha (opacity) of the background, only available in the
  22817. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  22818. 255 (fully opaque, the default).
  22819. @item decimals, n
  22820. Set the number of decimals to show in the timestamp, only available in the
  22821. @code{testsrc} source.
  22822. The displayed timestamp value will correspond to the original
  22823. timestamp value multiplied by the power of 10 of the specified
  22824. value. Default value is 0.
  22825. @item type
  22826. Set the type of the color spectrum, only available in the
  22827. @code{colorspectrum} source. Can be one of the following:
  22828. @table @samp
  22829. @item black
  22830. @item white
  22831. @item all
  22832. @end table
  22833. @item patch_size
  22834. Set patch size of single color patch, only available in the
  22835. @code{colorchart} source. Default is @code{64x64}.
  22836. @item preset
  22837. Set colorchecker colors preset, only available in the
  22838. @code{colorchart} source.
  22839. Available values are:
  22840. @table @samp
  22841. @item reference
  22842. @item skintones
  22843. @end table
  22844. Default value is @code{reference}.
  22845. @end table
  22846. @subsection Examples
  22847. @itemize
  22848. @item
  22849. Generate a video with a duration of 5.3 seconds, with size
  22850. 176x144 and a frame rate of 10 frames per second:
  22851. @example
  22852. testsrc=duration=5.3:size=qcif:rate=10
  22853. @end example
  22854. @item
  22855. The following graph description will generate a red source
  22856. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  22857. frames per second:
  22858. @example
  22859. color=c=red@@0.2:s=qcif:r=10
  22860. @end example
  22861. @item
  22862. If the input content is to be ignored, @code{nullsrc} can be used. The
  22863. following command generates noise in the luma plane by employing
  22864. the @code{geq} filter:
  22865. @example
  22866. nullsrc=s=256x256, geq=random(1)*255:128:128
  22867. @end example
  22868. @end itemize
  22869. @subsection Commands
  22870. The @code{color} source supports the following commands:
  22871. @table @option
  22872. @item c, color
  22873. Set the color of the created image. Accepts the same syntax of the
  22874. corresponding @option{color} option.
  22875. @end table
  22876. @section openclsrc
  22877. Generate video using an OpenCL program.
  22878. @table @option
  22879. @item source
  22880. OpenCL program source file.
  22881. @item kernel
  22882. Kernel name in program.
  22883. @item size, s
  22884. Size of frames to generate. This must be set.
  22885. @item format
  22886. Pixel format to use for the generated frames. This must be set.
  22887. @item rate, r
  22888. Number of frames generated every second. Default value is '25'.
  22889. @end table
  22890. For details of how the program loading works, see the @ref{program_opencl}
  22891. filter.
  22892. Example programs:
  22893. @itemize
  22894. @item
  22895. Generate a colour ramp by setting pixel values from the position of the pixel
  22896. in the output image. (Note that this will work with all pixel formats, but
  22897. the generated output will not be the same.)
  22898. @verbatim
  22899. __kernel void ramp(__write_only image2d_t dst,
  22900. unsigned int index)
  22901. {
  22902. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  22903. float4 val;
  22904. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  22905. write_imagef(dst, loc, val);
  22906. }
  22907. @end verbatim
  22908. @item
  22909. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  22910. @verbatim
  22911. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  22912. unsigned int index)
  22913. {
  22914. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  22915. float4 value = 0.0f;
  22916. int x = loc.x + index;
  22917. int y = loc.y + index;
  22918. while (x > 0 || y > 0) {
  22919. if (x % 3 == 1 && y % 3 == 1) {
  22920. value = 1.0f;
  22921. break;
  22922. }
  22923. x /= 3;
  22924. y /= 3;
  22925. }
  22926. write_imagef(dst, loc, value);
  22927. }
  22928. @end verbatim
  22929. @end itemize
  22930. @section sierpinski
  22931. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  22932. This source accepts the following options:
  22933. @table @option
  22934. @item size, s
  22935. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22936. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22937. @item rate, r
  22938. Set frame rate, expressed as number of frames per second. Default
  22939. value is "25".
  22940. @item seed
  22941. Set seed which is used for random panning.
  22942. @item jump
  22943. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  22944. @item type
  22945. Set fractal type, can be default @code{carpet} or @code{triangle}.
  22946. @end table
  22947. @section zoneplate
  22948. Generate a zoneplate test video pattern.
  22949. This source accepts the following options:
  22950. @table @option
  22951. @item size, s
  22952. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22953. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "320x240".
  22954. @item rate, r
  22955. Set frame rate, expressed as number of frames per second. Default
  22956. value is "25".
  22957. @item duration, d
  22958. Set the duration of the sourced video. See
  22959. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22960. for the accepted syntax.
  22961. If not specified, or the expressed duration is negative, the video is
  22962. supposed to be generated forever.
  22963. @item sar
  22964. Set the sample aspect ratio of the sourced video.
  22965. @item precision
  22966. Set precision in bits for look-up table for sine calculations. Default value is 10.
  22967. Allowed range is from 4 to 16.
  22968. @item xo
  22969. Set horizontal axis offset for output signal. Default value is 0.
  22970. @item yo
  22971. Set vertical axis offset for output signal. Default value is 0.
  22972. @item to
  22973. Set time axis offset for output signal. Default value is 0.
  22974. @item k0
  22975. Set 0-order, constant added to signal phase. Default value is 0.
  22976. @item kx
  22977. Set 1-order, phase factor multiplier for horizontal axis. Default value is 0.
  22978. @item ky
  22979. Set 1-order, phase factor multiplier for vertical axis. Default value is 0.
  22980. @item kt
  22981. Set 1-order, phase factor multiplier for time axis. Default value is 0.
  22982. @item kxt, kyt, kxy
  22983. Set phase factor multipliers for combination of spatial and temporal axis.
  22984. Default value is 0.
  22985. @item kx2
  22986. Set 2-order, phase factor multiplier for horizontal axis. Default value is 0.
  22987. @item ky2
  22988. Set 2-order, phase factor multiplier for vertical axis. Default value is 0.
  22989. @item kt2
  22990. Set 2-order, phase factor multiplier for time axis. Default value is 0.
  22991. @item ku
  22992. Set the constant added to final phase to produce chroma-blue component of signal.
  22993. Default value is 0.
  22994. @item kv
  22995. Set the constant added to final phase to produce chroma-red component of signal.
  22996. Default value is 0.
  22997. @end table
  22998. @subsection Commands
  22999. This source supports the some above options as @ref{commands}.
  23000. @subsection Examples
  23001. @itemize
  23002. @item
  23003. Generate horizontal color sine sweep:
  23004. @example
  23005. zoneplate=ku=512:kv=0:kt2=0:kx2=256:s=wvga:xo=-426:kt=11
  23006. @end example
  23007. @item
  23008. Generate vertical color sine sweep:
  23009. @example
  23010. zoneplate=ku=512:kv=0:kt2=0:ky2=156:s=wvga:yo=-240:kt=11
  23011. @end example
  23012. @item
  23013. Generate circular zone-plate:
  23014. @example
  23015. zoneplate=ku=512:kv=100:kt2=0:ky2=256:kx2=556:s=wvga:yo=0:kt=11
  23016. @end example
  23017. @end itemize
  23018. @c man end VIDEO SOURCES
  23019. @chapter Video Sinks
  23020. @c man begin VIDEO SINKS
  23021. Below is a description of the currently available video sinks.
  23022. @section buffersink
  23023. Buffer video frames, and make them available to the end of the filter
  23024. graph.
  23025. This sink is mainly intended for programmatic use, in particular
  23026. through the interface defined in @file{libavfilter/buffersink.h}
  23027. or the options system.
  23028. It accepts a pointer to an AVBufferSinkContext structure, which
  23029. defines the incoming buffers' formats, to be passed as the opaque
  23030. parameter to @code{avfilter_init_filter} for initialization.
  23031. @section nullsink
  23032. Null video sink: do absolutely nothing with the input video. It is
  23033. mainly useful as a template and for use in analysis / debugging
  23034. tools.
  23035. @c man end VIDEO SINKS
  23036. @chapter Multimedia Filters
  23037. @c man begin MULTIMEDIA FILTERS
  23038. Below is a description of the currently available multimedia filters.
  23039. @section a3dscope
  23040. Convert input audio to 3d scope video output.
  23041. The filter accepts the following options:
  23042. @table @option
  23043. @item rate, r
  23044. Set frame rate, expressed as number of frames per second. Default
  23045. value is "25".
  23046. @item size, s
  23047. Specify the video size for the output. For the syntax of this option, check the
  23048. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23049. Default value is @code{hd720}.
  23050. @item fov
  23051. Set the camera field of view. Default is 90 degrees.
  23052. Allowed range is from 40 to 150.
  23053. @item roll
  23054. Set the camera roll.
  23055. @item pitch
  23056. Set the camera pitch.
  23057. @item yaw
  23058. Set the camera yaw.
  23059. @item xzoom
  23060. Set the camera zoom on X-axis.
  23061. @item yzoom
  23062. Set the camera zoom on Y-axis.
  23063. @item zzoom
  23064. Set the camera zoom on Z-axis.
  23065. @item xpos
  23066. Set the camera position on X-axis.
  23067. @item ypos
  23068. Set the camera position on Y-axis.
  23069. @item zpos
  23070. Set the camera position on Z-axis.
  23071. @item length
  23072. Set the length of displayed audio waves in number of frames.
  23073. @end table
  23074. @subsection Commands
  23075. Filter supports the some above options as @ref{commands}.
  23076. @section abitscope
  23077. Convert input audio to a video output, displaying the audio bit scope.
  23078. The filter accepts the following options:
  23079. @table @option
  23080. @item rate, r
  23081. Set frame rate, expressed as number of frames per second. Default
  23082. value is "25".
  23083. @item size, s
  23084. Specify the video size for the output. For the syntax of this option, check the
  23085. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23086. Default value is @code{1024x256}.
  23087. @item colors
  23088. Specify list of colors separated by space or by '|' which will be used to
  23089. draw channels. Unrecognized or missing colors will be replaced
  23090. by white color.
  23091. @item mode, m
  23092. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  23093. @end table
  23094. @section adrawgraph
  23095. Draw a graph using input audio metadata.
  23096. See @ref{drawgraph}
  23097. @section agraphmonitor
  23098. See @ref{graphmonitor}.
  23099. @section ahistogram
  23100. Convert input audio to a video output, displaying the volume histogram.
  23101. The filter accepts the following options:
  23102. @table @option
  23103. @item dmode
  23104. Specify how histogram is calculated.
  23105. It accepts the following values:
  23106. @table @samp
  23107. @item single
  23108. Use single histogram for all channels.
  23109. @item separate
  23110. Use separate histogram for each channel.
  23111. @end table
  23112. Default is @code{single}.
  23113. @item rate, r
  23114. Set frame rate, expressed as number of frames per second. Default
  23115. value is "25".
  23116. @item size, s
  23117. Specify the video size for the output. For the syntax of this option, check the
  23118. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23119. Default value is @code{hd720}.
  23120. @item scale
  23121. Set display scale.
  23122. It accepts the following values:
  23123. @table @samp
  23124. @item log
  23125. logarithmic
  23126. @item sqrt
  23127. square root
  23128. @item cbrt
  23129. cubic root
  23130. @item lin
  23131. linear
  23132. @item rlog
  23133. reverse logarithmic
  23134. @end table
  23135. Default is @code{log}.
  23136. @item ascale
  23137. Set amplitude scale.
  23138. It accepts the following values:
  23139. @table @samp
  23140. @item log
  23141. logarithmic
  23142. @item lin
  23143. linear
  23144. @end table
  23145. Default is @code{log}.
  23146. @item acount
  23147. Set how much frames to accumulate in histogram.
  23148. Default is 1. Setting this to -1 accumulates all frames.
  23149. @item rheight
  23150. Set histogram ratio of window height.
  23151. @item slide
  23152. Set sonogram sliding.
  23153. It accepts the following values:
  23154. @table @samp
  23155. @item replace
  23156. replace old rows with new ones.
  23157. @item scroll
  23158. scroll from top to bottom.
  23159. @end table
  23160. Default is @code{replace}.
  23161. @item hmode
  23162. Set histogram mode.
  23163. It accepts the following values:
  23164. @table @samp
  23165. @item abs
  23166. Use absolute values of samples.
  23167. @item sign
  23168. Use untouched values of samples.
  23169. @end table
  23170. Default is @code{abs}.
  23171. @end table
  23172. @section aphasemeter
  23173. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  23174. representing mean phase of current audio frame. A video output can also be produced and is
  23175. enabled by default. The audio is passed through as first output.
  23176. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  23177. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  23178. and @code{1} means channels are in phase.
  23179. The filter accepts the following options, all related to its video output:
  23180. @table @option
  23181. @item rate, r
  23182. Set the output frame rate. Default value is @code{25}.
  23183. @item size, s
  23184. Set the video size for the output. For the syntax of this option, check the
  23185. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23186. Default value is @code{800x400}.
  23187. @item rc
  23188. @item gc
  23189. @item bc
  23190. Specify the red, green, blue contrast. Default values are @code{2},
  23191. @code{7} and @code{1}.
  23192. Allowed range is @code{[0, 255]}.
  23193. @item mpc
  23194. Set color which will be used for drawing median phase. If color is
  23195. @code{none} which is default, no median phase value will be drawn.
  23196. @item video
  23197. Enable video output. Default is enabled.
  23198. @end table
  23199. @subsection phasing detection
  23200. The filter also detects out of phase and mono sequences in stereo streams.
  23201. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  23202. The filter accepts the following options for this detection:
  23203. @table @option
  23204. @item phasing
  23205. Enable mono and out of phase detection. Default is disabled.
  23206. @item tolerance, t
  23207. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  23208. Allowed range is @code{[0, 1]}.
  23209. @item angle, a
  23210. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  23211. Allowed range is @code{[90, 180]}.
  23212. @item duration, d
  23213. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  23214. @end table
  23215. @subsection Examples
  23216. @itemize
  23217. @item
  23218. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  23219. @example
  23220. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  23221. @end example
  23222. @end itemize
  23223. @section avectorscope
  23224. Convert input audio to a video output, representing the audio vector
  23225. scope.
  23226. The filter is used to measure the difference between channels of stereo
  23227. audio stream. A monaural signal, consisting of identical left and right
  23228. signal, results in straight vertical line. Any stereo separation is visible
  23229. as a deviation from this line, creating a Lissajous figure.
  23230. If the straight (or deviation from it) but horizontal line appears this
  23231. indicates that the left and right channels are out of phase.
  23232. The filter accepts the following options:
  23233. @table @option
  23234. @item mode, m
  23235. Set the vectorscope mode.
  23236. Available values are:
  23237. @table @samp
  23238. @item lissajous
  23239. Lissajous rotated by 45 degrees.
  23240. @item lissajous_xy
  23241. Same as above but not rotated.
  23242. @item polar
  23243. Shape resembling half of circle.
  23244. @end table
  23245. Default value is @samp{lissajous}.
  23246. @item size, s
  23247. Set the video size for the output. For the syntax of this option, check the
  23248. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23249. Default value is @code{400x400}.
  23250. @item rate, r
  23251. Set the output frame rate. Default value is @code{25}.
  23252. @item rc
  23253. @item gc
  23254. @item bc
  23255. @item ac
  23256. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  23257. @code{160}, @code{80} and @code{255}.
  23258. Allowed range is @code{[0, 255]}.
  23259. @item rf
  23260. @item gf
  23261. @item bf
  23262. @item af
  23263. Specify the red, green, blue and alpha fade. Default values are @code{15},
  23264. @code{10}, @code{5} and @code{5}.
  23265. Allowed range is @code{[0, 255]}.
  23266. @item zoom
  23267. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  23268. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  23269. @item draw
  23270. Set the vectorscope drawing mode.
  23271. Available values are:
  23272. @table @samp
  23273. @item dot
  23274. Draw dot for each sample.
  23275. @item line
  23276. Draw line between previous and current sample.
  23277. @item aaline
  23278. Draw anti-aliased line between previous and current sample.
  23279. @end table
  23280. Default value is @samp{dot}.
  23281. @item scale
  23282. Specify amplitude scale of audio samples.
  23283. Available values are:
  23284. @table @samp
  23285. @item lin
  23286. Linear.
  23287. @item sqrt
  23288. Square root.
  23289. @item cbrt
  23290. Cubic root.
  23291. @item log
  23292. Logarithmic.
  23293. @end table
  23294. @item swap
  23295. Swap left channel axis with right channel axis.
  23296. @item mirror
  23297. Mirror axis.
  23298. @table @samp
  23299. @item none
  23300. No mirror.
  23301. @item x
  23302. Mirror only x axis.
  23303. @item y
  23304. Mirror only y axis.
  23305. @item xy
  23306. Mirror both axis.
  23307. @end table
  23308. @end table
  23309. @subsection Examples
  23310. @itemize
  23311. @item
  23312. Complete example using @command{ffplay}:
  23313. @example
  23314. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  23315. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  23316. @end example
  23317. @end itemize
  23318. @subsection Commands
  23319. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  23320. @section bench, abench
  23321. Benchmark part of a filtergraph.
  23322. The filter accepts the following options:
  23323. @table @option
  23324. @item action
  23325. Start or stop a timer.
  23326. Available values are:
  23327. @table @samp
  23328. @item start
  23329. Get the current time, set it as frame metadata (using the key
  23330. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  23331. @item stop
  23332. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  23333. the input frame metadata to get the time difference. Time difference, average,
  23334. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  23335. @code{min}) are then printed. The timestamps are expressed in seconds.
  23336. @end table
  23337. @end table
  23338. @subsection Examples
  23339. @itemize
  23340. @item
  23341. Benchmark @ref{selectivecolor} filter:
  23342. @example
  23343. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  23344. @end example
  23345. @end itemize
  23346. @section concat
  23347. Concatenate audio and video streams, joining them together one after the
  23348. other.
  23349. The filter works on segments of synchronized video and audio streams. All
  23350. segments must have the same number of streams of each type, and that will
  23351. also be the number of streams at output.
  23352. The filter accepts the following options:
  23353. @table @option
  23354. @item n
  23355. Set the number of segments. Default is 2.
  23356. @item v
  23357. Set the number of output video streams, that is also the number of video
  23358. streams in each segment. Default is 1.
  23359. @item a
  23360. Set the number of output audio streams, that is also the number of audio
  23361. streams in each segment. Default is 0.
  23362. @item unsafe
  23363. Activate unsafe mode: do not fail if segments have a different format.
  23364. @end table
  23365. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  23366. @var{a} audio outputs.
  23367. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  23368. segment, in the same order as the outputs, then the inputs for the second
  23369. segment, etc.
  23370. Related streams do not always have exactly the same duration, for various
  23371. reasons including codec frame size or sloppy authoring. For that reason,
  23372. related synchronized streams (e.g. a video and its audio track) should be
  23373. concatenated at once. The concat filter will use the duration of the longest
  23374. stream in each segment (except the last one), and if necessary pad shorter
  23375. audio streams with silence.
  23376. For this filter to work correctly, all segments must start at timestamp 0.
  23377. All corresponding streams must have the same parameters in all segments; the
  23378. filtering system will automatically select a common pixel format for video
  23379. streams, and a common sample format, sample rate and channel layout for
  23380. audio streams, but other settings, such as resolution, must be converted
  23381. explicitly by the user.
  23382. Different frame rates are acceptable but will result in variable frame rate
  23383. at output; be sure to configure the output file to handle it.
  23384. @subsection Examples
  23385. @itemize
  23386. @item
  23387. Concatenate an opening, an episode and an ending, all in bilingual version
  23388. (video in stream 0, audio in streams 1 and 2):
  23389. @example
  23390. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  23391. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  23392. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  23393. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  23394. @end example
  23395. @item
  23396. Concatenate two parts, handling audio and video separately, using the
  23397. (a)movie sources, and adjusting the resolution:
  23398. @example
  23399. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  23400. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  23401. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  23402. @end example
  23403. Note that a desync will happen at the stitch if the audio and video streams
  23404. do not have exactly the same duration in the first file.
  23405. @end itemize
  23406. @subsection Commands
  23407. This filter supports the following commands:
  23408. @table @option
  23409. @item next
  23410. Close the current segment and step to the next one
  23411. @end table
  23412. @anchor{ebur128}
  23413. @section ebur128
  23414. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  23415. level. By default, it logs a message at a frequency of 10Hz with the
  23416. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  23417. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  23418. The filter can only analyze streams which have
  23419. sample format is double-precision floating point. The input stream will be converted to
  23420. this specification, if needed. Users may need to insert aformat and/or aresample filters
  23421. after this filter to obtain the original parameters.
  23422. The filter also has a video output (see the @var{video} option) with a real
  23423. time graph to observe the loudness evolution. The graphic contains the logged
  23424. message mentioned above, so it is not printed anymore when this option is set,
  23425. unless the verbose logging is set. The main graphing area contains the
  23426. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  23427. the momentary loudness (400 milliseconds), but can optionally be configured
  23428. to instead display short-term loudness (see @var{gauge}).
  23429. The green area marks a +/- 1LU target range around the target loudness
  23430. (-23LUFS by default, unless modified through @var{target}).
  23431. More information about the Loudness Recommendation EBU R128 on
  23432. @url{http://tech.ebu.ch/loudness}.
  23433. The filter accepts the following options:
  23434. @table @option
  23435. @item video
  23436. Activate the video output. The audio stream is passed unchanged whether this
  23437. option is set or no. The video stream will be the first output stream if
  23438. activated. Default is @code{0}.
  23439. @item size
  23440. Set the video size. This option is for video only. For the syntax of this
  23441. option, check the
  23442. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23443. Default and minimum resolution is @code{640x480}.
  23444. @item meter
  23445. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  23446. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  23447. other integer value between this range is allowed.
  23448. @item metadata
  23449. Set metadata injection. If set to @code{1}, the audio input will be segmented
  23450. into 100ms output frames, each of them containing various loudness information
  23451. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  23452. Default is @code{0}.
  23453. @item framelog
  23454. Force the frame logging level.
  23455. Available values are:
  23456. @table @samp
  23457. @item quiet
  23458. logging disabled
  23459. @item info
  23460. information logging level
  23461. @item verbose
  23462. verbose logging level
  23463. @end table
  23464. By default, the logging level is set to @var{info}. If the @option{video} or
  23465. the @option{metadata} options are set, it switches to @var{verbose}.
  23466. @item peak
  23467. Set peak mode(s).
  23468. Available modes can be cumulated (the option is a @code{flag} type). Possible
  23469. values are:
  23470. @table @samp
  23471. @item none
  23472. Disable any peak mode (default).
  23473. @item sample
  23474. Enable sample-peak mode.
  23475. Simple peak mode looking for the higher sample value. It logs a message
  23476. for sample-peak (identified by @code{SPK}).
  23477. @item true
  23478. Enable true-peak mode.
  23479. If enabled, the peak lookup is done on an over-sampled version of the input
  23480. stream for better peak accuracy. It logs a message for true-peak.
  23481. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  23482. This mode requires a build with @code{libswresample}.
  23483. @end table
  23484. @item dualmono
  23485. Treat mono input files as "dual mono". If a mono file is intended for playback
  23486. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  23487. If set to @code{true}, this option will compensate for this effect.
  23488. Multi-channel input files are not affected by this option.
  23489. @item panlaw
  23490. Set a specific pan law to be used for the measurement of dual mono files.
  23491. This parameter is optional, and has a default value of -3.01dB.
  23492. @item target
  23493. Set a specific target level (in LUFS) used as relative zero in the visualization.
  23494. This parameter is optional and has a default value of -23LUFS as specified
  23495. by EBU R128. However, material published online may prefer a level of -16LUFS
  23496. (e.g. for use with podcasts or video platforms).
  23497. @item gauge
  23498. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  23499. @code{shortterm}. By default the momentary value will be used, but in certain
  23500. scenarios it may be more useful to observe the short term value instead (e.g.
  23501. live mixing).
  23502. @item scale
  23503. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  23504. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  23505. video output, not the summary or continuous log output.
  23506. @item integrated
  23507. Read-only exported value for measured integrated loudness, in LUFS.
  23508. @item range
  23509. Read-only exported value for measured loudness range, in LU.
  23510. @item lra_low
  23511. Read-only exported value for measured LRA low, in LUFS.
  23512. @item lra_high
  23513. Read-only exported value for measured LRA high, in LUFS.
  23514. @item sample_peak
  23515. Read-only exported value for measured sample peak, in dBFS.
  23516. @item true_peak
  23517. Read-only exported value for measured true peak, in dBFS.
  23518. @end table
  23519. @subsection Examples
  23520. @itemize
  23521. @item
  23522. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  23523. @example
  23524. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  23525. @end example
  23526. @item
  23527. Run an analysis with @command{ffmpeg}:
  23528. @example
  23529. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  23530. @end example
  23531. @end itemize
  23532. @section interleave, ainterleave
  23533. Temporally interleave frames from several inputs.
  23534. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  23535. These filters read frames from several inputs and send the oldest
  23536. queued frame to the output.
  23537. Input streams must have well defined, monotonically increasing frame
  23538. timestamp values.
  23539. In order to submit one frame to output, these filters need to enqueue
  23540. at least one frame for each input, so they cannot work in case one
  23541. input is not yet terminated and will not receive incoming frames.
  23542. For example consider the case when one input is a @code{select} filter
  23543. which always drops input frames. The @code{interleave} filter will keep
  23544. reading from that input, but it will never be able to send new frames
  23545. to output until the input sends an end-of-stream signal.
  23546. Also, depending on inputs synchronization, the filters will drop
  23547. frames in case one input receives more frames than the other ones, and
  23548. the queue is already filled.
  23549. These filters accept the following options:
  23550. @table @option
  23551. @item nb_inputs, n
  23552. Set the number of different inputs, it is 2 by default.
  23553. @item duration
  23554. How to determine the end-of-stream.
  23555. @table @option
  23556. @item longest
  23557. The duration of the longest input. (default)
  23558. @item shortest
  23559. The duration of the shortest input.
  23560. @item first
  23561. The duration of the first input.
  23562. @end table
  23563. @end table
  23564. @subsection Examples
  23565. @itemize
  23566. @item
  23567. Interleave frames belonging to different streams using @command{ffmpeg}:
  23568. @example
  23569. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  23570. @end example
  23571. @item
  23572. Add flickering blur effect:
  23573. @example
  23574. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  23575. @end example
  23576. @end itemize
  23577. @section latency, alatency
  23578. Measure filtering latency.
  23579. Report previous filter filtering latency, delay in number of audio samples for audio filters
  23580. or number of video frames for video filters.
  23581. On end of input stream, filter will report min and max measured latency for previous running filter
  23582. in filtergraph.
  23583. @section metadata, ametadata
  23584. Manipulate frame metadata.
  23585. This filter accepts the following options:
  23586. @table @option
  23587. @item mode
  23588. Set mode of operation of the filter.
  23589. Can be one of the following:
  23590. @table @samp
  23591. @item select
  23592. If both @code{value} and @code{key} is set, select frames
  23593. which have such metadata. If only @code{key} is set, select
  23594. every frame that has such key in metadata.
  23595. @item add
  23596. Add new metadata @code{key} and @code{value}. If key is already available
  23597. do nothing.
  23598. @item modify
  23599. Modify value of already present key.
  23600. @item delete
  23601. If @code{value} is set, delete only keys that have such value.
  23602. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  23603. the frame.
  23604. @item print
  23605. Print key and its value if metadata was found. If @code{key} is not set print all
  23606. metadata values available in frame.
  23607. @end table
  23608. @item key
  23609. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  23610. @item value
  23611. Set metadata value which will be used. This option is mandatory for
  23612. @code{modify} and @code{add} mode.
  23613. @item function
  23614. Which function to use when comparing metadata value and @code{value}.
  23615. Can be one of following:
  23616. @table @samp
  23617. @item same_str
  23618. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  23619. @item starts_with
  23620. Values are interpreted as strings, returns true if metadata value starts with
  23621. the @code{value} option string.
  23622. @item less
  23623. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  23624. @item equal
  23625. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  23626. @item greater
  23627. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  23628. @item expr
  23629. Values are interpreted as floats, returns true if expression from option @code{expr}
  23630. evaluates to true.
  23631. @item ends_with
  23632. Values are interpreted as strings, returns true if metadata value ends with
  23633. the @code{value} option string.
  23634. @end table
  23635. @item expr
  23636. Set expression which is used when @code{function} is set to @code{expr}.
  23637. The expression is evaluated through the eval API and can contain the following
  23638. constants:
  23639. @table @option
  23640. @item VALUE1, FRAMEVAL
  23641. Float representation of @code{value} from metadata key.
  23642. @item VALUE2, USERVAL
  23643. Float representation of @code{value} as supplied by user in @code{value} option.
  23644. @end table
  23645. @item file
  23646. If specified in @code{print} mode, output is written to the named file. Instead of
  23647. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  23648. for standard output. If @code{file} option is not set, output is written to the log
  23649. with AV_LOG_INFO loglevel.
  23650. @item direct
  23651. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  23652. @end table
  23653. @subsection Examples
  23654. @itemize
  23655. @item
  23656. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  23657. between 0 and 1.
  23658. @example
  23659. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  23660. @end example
  23661. @item
  23662. Print silencedetect output to file @file{metadata.txt}.
  23663. @example
  23664. silencedetect,ametadata=mode=print:file=metadata.txt
  23665. @end example
  23666. @item
  23667. Direct all metadata to a pipe with file descriptor 4.
  23668. @example
  23669. metadata=mode=print:file='pipe\:4'
  23670. @end example
  23671. @end itemize
  23672. @section perms, aperms
  23673. Set read/write permissions for the output frames.
  23674. These filters are mainly aimed at developers to test direct path in the
  23675. following filter in the filtergraph.
  23676. The filters accept the following options:
  23677. @table @option
  23678. @item mode
  23679. Select the permissions mode.
  23680. It accepts the following values:
  23681. @table @samp
  23682. @item none
  23683. Do nothing. This is the default.
  23684. @item ro
  23685. Set all the output frames read-only.
  23686. @item rw
  23687. Set all the output frames directly writable.
  23688. @item toggle
  23689. Make the frame read-only if writable, and writable if read-only.
  23690. @item random
  23691. Set each output frame read-only or writable randomly.
  23692. @end table
  23693. @item seed
  23694. Set the seed for the @var{random} mode, must be an integer included between
  23695. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  23696. @code{-1}, the filter will try to use a good random seed on a best effort
  23697. basis.
  23698. @end table
  23699. Note: in case of auto-inserted filter between the permission filter and the
  23700. following one, the permission might not be received as expected in that
  23701. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  23702. perms/aperms filter can avoid this problem.
  23703. @section realtime, arealtime
  23704. Slow down filtering to match real time approximately.
  23705. These filters will pause the filtering for a variable amount of time to
  23706. match the output rate with the input timestamps.
  23707. They are similar to the @option{re} option to @code{ffmpeg}.
  23708. They accept the following options:
  23709. @table @option
  23710. @item limit
  23711. Time limit for the pauses. Any pause longer than that will be considered
  23712. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  23713. @item speed
  23714. Speed factor for processing. The value must be a float larger than zero.
  23715. Values larger than 1.0 will result in faster than realtime processing,
  23716. smaller will slow processing down. The @var{limit} is automatically adapted
  23717. accordingly. Default is 1.0.
  23718. A processing speed faster than what is possible without these filters cannot
  23719. be achieved.
  23720. @end table
  23721. @subsection Commands
  23722. Both filters supports the all above options as @ref{commands}.
  23723. @section segment, asegment
  23724. Split single input stream into multiple streams.
  23725. This filter does opposite of concat filters.
  23726. @code{segment} works on video frames, @code{asegment} on audio samples.
  23727. This filter accepts the following options:
  23728. @table @option
  23729. @item timestamps
  23730. Timestamps of output segments separated by '|'. The first segment will run
  23731. from the beginning of the input stream. The last segment will run until
  23732. the end of the input stream
  23733. @item frames, samples
  23734. Exact frame/sample count to split the segments.
  23735. @end table
  23736. In all cases, prefixing an each segment with '+' will make it relative to the
  23737. previous segment.
  23738. @subsection Examples
  23739. @itemize
  23740. @item
  23741. Split input audio stream into three output audio streams, starting at start of input audio stream
  23742. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  23743. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  23744. @example
  23745. asegment=timestamps="60|150"
  23746. @end example
  23747. @end itemize
  23748. @anchor{select}
  23749. @section select, aselect
  23750. Select frames to pass in output.
  23751. This filter accepts the following options:
  23752. @table @option
  23753. @item expr, e
  23754. Set expression, which is evaluated for each input frame.
  23755. If the expression is evaluated to zero, the frame is discarded.
  23756. If the evaluation result is negative or NaN, the frame is sent to the
  23757. first output; otherwise it is sent to the output with index
  23758. @code{ceil(val)-1}, assuming that the input index starts from 0.
  23759. For example a value of @code{1.2} corresponds to the output with index
  23760. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  23761. @item outputs, n
  23762. Set the number of outputs. The output to which to send the selected
  23763. frame is based on the result of the evaluation. Default value is 1.
  23764. @end table
  23765. The expression can contain the following constants:
  23766. @table @option
  23767. @item n
  23768. The (sequential) number of the filtered frame, starting from 0.
  23769. @item selected_n
  23770. The (sequential) number of the selected frame, starting from 0.
  23771. @item prev_selected_n
  23772. The sequential number of the last selected frame. It's NAN if undefined.
  23773. @item TB
  23774. The timebase of the input timestamps.
  23775. @item pts
  23776. The PTS (Presentation TimeStamp) of the filtered frame,
  23777. expressed in @var{TB} units. It's NAN if undefined.
  23778. @item t
  23779. The PTS of the filtered frame,
  23780. expressed in seconds. It's NAN if undefined.
  23781. @item prev_pts
  23782. The PTS of the previously filtered frame. It's NAN if undefined.
  23783. @item prev_selected_pts
  23784. The PTS of the last previously filtered frame. It's NAN if undefined.
  23785. @item prev_selected_t
  23786. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  23787. @item start_pts
  23788. The first PTS in the stream which is not NAN. It remains NAN if not found.
  23789. @item start_t
  23790. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  23791. @item pict_type @emph{(video only)}
  23792. The type of the filtered frame. It can assume one of the following
  23793. values:
  23794. @table @option
  23795. @item I
  23796. @item P
  23797. @item B
  23798. @item S
  23799. @item SI
  23800. @item SP
  23801. @item BI
  23802. @end table
  23803. @item interlace_type @emph{(video only)}
  23804. The frame interlace type. It can assume one of the following values:
  23805. @table @option
  23806. @item PROGRESSIVE
  23807. The frame is progressive (not interlaced).
  23808. @item TOPFIRST
  23809. The frame is top-field-first.
  23810. @item BOTTOMFIRST
  23811. The frame is bottom-field-first.
  23812. @end table
  23813. @item consumed_sample_n @emph{(audio only)}
  23814. the number of selected samples before the current frame
  23815. @item samples_n @emph{(audio only)}
  23816. the number of samples in the current frame
  23817. @item sample_rate @emph{(audio only)}
  23818. the input sample rate
  23819. @item key
  23820. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  23821. @item pos
  23822. the position in the file of the filtered frame, -1 if the information
  23823. is not available (e.g. for synthetic video); deprecated, do not use
  23824. @item scene @emph{(video only)}
  23825. value between 0 and 1 to indicate a new scene; a low value reflects a low
  23826. probability for the current frame to introduce a new scene, while a higher
  23827. value means the current frame is more likely to be one (see the example below)
  23828. @item concatdec_select
  23829. The concat demuxer can select only part of a concat input file by setting an
  23830. inpoint and an outpoint, but the output packets may not be entirely contained
  23831. in the selected interval. By using this variable, it is possible to skip frames
  23832. generated by the concat demuxer which are not exactly contained in the selected
  23833. interval.
  23834. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  23835. and the @var{lavf.concat.duration} packet metadata values which are also
  23836. present in the decoded frames.
  23837. The @var{concatdec_select} variable is -1 if the frame pts is at least
  23838. start_time and either the duration metadata is missing or the frame pts is less
  23839. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  23840. missing.
  23841. That basically means that an input frame is selected if its pts is within the
  23842. interval set by the concat demuxer.
  23843. @item iw @emph{(video only)}
  23844. Represents the width of the input video frame.
  23845. @item ih @emph{(video only)}
  23846. Represents the height of the input video frame.
  23847. @item view @emph{(video only)}
  23848. View ID for multi-view video.
  23849. @end table
  23850. The default value of the select expression is "1".
  23851. @subsection Examples
  23852. @itemize
  23853. @item
  23854. Select all frames in input:
  23855. @example
  23856. select
  23857. @end example
  23858. The example above is the same as:
  23859. @example
  23860. select=1
  23861. @end example
  23862. @item
  23863. Skip all frames:
  23864. @example
  23865. select=0
  23866. @end example
  23867. @item
  23868. Select only I-frames:
  23869. @example
  23870. select='eq(pict_type\,I)'
  23871. @end example
  23872. @item
  23873. Select one frame every 100:
  23874. @example
  23875. select='not(mod(n\,100))'
  23876. @end example
  23877. @item
  23878. Select only frames contained in the 10-20 time interval:
  23879. @example
  23880. select=between(t\,10\,20)
  23881. @end example
  23882. @item
  23883. Select only I-frames contained in the 10-20 time interval:
  23884. @example
  23885. select=between(t\,10\,20)*eq(pict_type\,I)
  23886. @end example
  23887. @item
  23888. Select frames with a minimum distance of 10 seconds:
  23889. @example
  23890. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  23891. @end example
  23892. @item
  23893. Use aselect to select only audio frames with samples number > 100:
  23894. @example
  23895. aselect='gt(samples_n\,100)'
  23896. @end example
  23897. @item
  23898. Create a mosaic of the first scenes:
  23899. @example
  23900. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  23901. @end example
  23902. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  23903. choice.
  23904. @item
  23905. Send even and odd frames to separate outputs, and compose them:
  23906. @example
  23907. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  23908. @end example
  23909. @item
  23910. Select useful frames from an ffconcat file which is using inpoints and
  23911. outpoints but where the source files are not intra frame only.
  23912. @example
  23913. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  23914. @end example
  23915. @end itemize
  23916. @section sendcmd, asendcmd
  23917. Send commands to filters in the filtergraph.
  23918. These filters read commands to be sent to other filters in the
  23919. filtergraph.
  23920. @code{sendcmd} must be inserted between two video filters,
  23921. @code{asendcmd} must be inserted between two audio filters, but apart
  23922. from that they act the same way.
  23923. The specification of commands can be provided in the filter arguments
  23924. with the @var{commands} option, or in a file specified by the
  23925. @var{filename} option.
  23926. These filters accept the following options:
  23927. @table @option
  23928. @item commands, c
  23929. Set the commands to be read and sent to the other filters.
  23930. @item filename, f
  23931. Set the filename of the commands to be read and sent to the other
  23932. filters.
  23933. @end table
  23934. @subsection Commands syntax
  23935. A commands description consists of a sequence of interval
  23936. specifications, comprising a list of commands to be executed when a
  23937. particular event related to that interval occurs. The occurring event
  23938. is typically the current frame time entering or leaving a given time
  23939. interval.
  23940. An interval is specified by the following syntax:
  23941. @example
  23942. @var{START}[-@var{END}] @var{COMMANDS};
  23943. @end example
  23944. The time interval is specified by the @var{START} and @var{END} times.
  23945. @var{END} is optional and defaults to the maximum time.
  23946. The current frame time is considered within the specified interval if
  23947. it is included in the interval [@var{START}, @var{END}), that is when
  23948. the time is greater or equal to @var{START} and is lesser than
  23949. @var{END}.
  23950. @var{COMMANDS} consists of a sequence of one or more command
  23951. specifications, separated by ",", relating to that interval. The
  23952. syntax of a command specification is given by:
  23953. @example
  23954. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  23955. @end example
  23956. @var{FLAGS} is optional and specifies the type of events relating to
  23957. the time interval which enable sending the specified command, and must
  23958. be a non-null sequence of identifier flags separated by "+" or "|" and
  23959. enclosed between "[" and "]".
  23960. The following flags are recognized:
  23961. @table @option
  23962. @item enter
  23963. The command is sent when the current frame timestamp enters the
  23964. specified interval. In other words, the command is sent when the
  23965. previous frame timestamp was not in the given interval, and the
  23966. current is.
  23967. @item leave
  23968. The command is sent when the current frame timestamp leaves the
  23969. specified interval. In other words, the command is sent when the
  23970. previous frame timestamp was in the given interval, and the
  23971. current is not.
  23972. @item expr
  23973. The command @var{ARG} is interpreted as expression and result of
  23974. expression is passed as @var{ARG}.
  23975. The expression is evaluated through the eval API and can contain the following
  23976. constants:
  23977. @table @option
  23978. @item POS
  23979. Original position in the file of the frame, or undefined if undefined
  23980. for the current frame. Deprecated, do not use.
  23981. @item PTS
  23982. The presentation timestamp in input.
  23983. @item N
  23984. The count of the input frame for video or audio, starting from 0.
  23985. @item T
  23986. The time in seconds of the current frame.
  23987. @item TS
  23988. The start time in seconds of the current command interval.
  23989. @item TE
  23990. The end time in seconds of the current command interval.
  23991. @item TI
  23992. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  23993. @item W
  23994. The video frame width.
  23995. @item H
  23996. The video frame height.
  23997. @end table
  23998. @end table
  23999. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  24000. assumed.
  24001. @var{TARGET} specifies the target of the command, usually the name of
  24002. the filter class or a specific filter instance name.
  24003. @var{COMMAND} specifies the name of the command for the target filter.
  24004. @var{ARG} is optional and specifies the optional list of argument for
  24005. the given @var{COMMAND}.
  24006. Between one interval specification and another, whitespaces, or
  24007. sequences of characters starting with @code{#} until the end of line,
  24008. are ignored and can be used to annotate comments.
  24009. A simplified BNF description of the commands specification syntax
  24010. follows:
  24011. @example
  24012. @var{COMMAND_FLAG} ::= "enter" | "leave"
  24013. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  24014. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  24015. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  24016. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  24017. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  24018. @end example
  24019. @subsection Examples
  24020. @itemize
  24021. @item
  24022. Specify audio tempo change at second 4:
  24023. @example
  24024. asendcmd=c='4.0 atempo tempo 1.5',atempo
  24025. @end example
  24026. @item
  24027. Target a specific filter instance:
  24028. @example
  24029. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  24030. @end example
  24031. @item
  24032. Specify a list of drawtext and hue commands in a file.
  24033. @example
  24034. # show text in the interval 5-10
  24035. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  24036. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  24037. # desaturate the image in the interval 15-20
  24038. 15.0-20.0 [enter] hue s 0,
  24039. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  24040. [leave] hue s 1,
  24041. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  24042. # apply an exponential saturation fade-out effect, starting from time 25
  24043. 25 [enter] hue s exp(25-t)
  24044. @end example
  24045. A filtergraph allowing to read and process the above command list
  24046. stored in a file @file{test.cmd}, can be specified with:
  24047. @example
  24048. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  24049. @end example
  24050. @end itemize
  24051. @anchor{setpts}
  24052. @section setpts, asetpts
  24053. Change the PTS (presentation timestamp) of the input frames.
  24054. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  24055. This filter accepts the following options:
  24056. @table @option
  24057. @item expr
  24058. The expression which is evaluated for each frame to construct its timestamp.
  24059. @item strip_fps (@emph{video only})
  24060. Boolean option which determines if the original framerate metadata is unset.
  24061. If set to true, be advised that a sane frame rate should be explicitly
  24062. specified if output is sent to a constant frame rate muxer.
  24063. Default is @code{false}.
  24064. @end table
  24065. The expression is evaluated through the eval API and can contain the following
  24066. constants:
  24067. @table @option
  24068. @item FRAME_RATE, FR
  24069. frame rate, only defined for constant frame-rate video
  24070. @item PTS
  24071. The presentation timestamp in input
  24072. @item N
  24073. The count of the input frame for video or the number of consumed samples,
  24074. not including the current frame for audio, starting from 0.
  24075. @item NB_CONSUMED_SAMPLES
  24076. The number of consumed samples, not including the current frame (only
  24077. audio)
  24078. @item NB_SAMPLES, S
  24079. The number of samples in the current frame (only audio)
  24080. @item SAMPLE_RATE, SR
  24081. The audio sample rate.
  24082. @item STARTPTS
  24083. The PTS of the first frame.
  24084. @item STARTT
  24085. the time in seconds of the first frame
  24086. @item INTERLACED
  24087. State whether the current frame is interlaced.
  24088. @item T
  24089. the time in seconds of the current frame
  24090. @item POS
  24091. original position in the file of the frame, or undefined if undefined
  24092. for the current frame; deprecated, do not use
  24093. @item PREV_INPTS
  24094. The previous input PTS.
  24095. @item PREV_INT
  24096. previous input time in seconds
  24097. @item PREV_OUTPTS
  24098. The previous output PTS.
  24099. @item PREV_OUTT
  24100. previous output time in seconds
  24101. @item RTCTIME
  24102. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  24103. instead.
  24104. @item RTCSTART
  24105. The wallclock (RTC) time at the start of the movie in microseconds.
  24106. @item TB
  24107. The timebase of the input timestamps.
  24108. @item T_CHANGE
  24109. Time of the first frame after command was applied or time of the first frame if no commands.
  24110. @end table
  24111. @subsection Examples
  24112. @itemize
  24113. @item
  24114. Start counting PTS from zero
  24115. @example
  24116. setpts=PTS-STARTPTS
  24117. @end example
  24118. @item
  24119. Apply fast motion effect:
  24120. @example
  24121. setpts=0.5*PTS
  24122. @end example
  24123. @item
  24124. Apply slow motion effect:
  24125. @example
  24126. setpts=2.0*PTS
  24127. @end example
  24128. @item
  24129. Set fixed rate of 25 frames per second:
  24130. @example
  24131. setpts=N/(25*TB)
  24132. @end example
  24133. @item
  24134. Apply a random jitter effect of +/-100 TB units:
  24135. @example
  24136. setpts=PTS+randomi(0, -100\,100)
  24137. @end example
  24138. @item
  24139. Set fixed rate 25 fps with some jitter:
  24140. @example
  24141. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  24142. @end example
  24143. @item
  24144. Apply an offset of 10 seconds to the input PTS:
  24145. @example
  24146. setpts=PTS+10/TB
  24147. @end example
  24148. @item
  24149. Generate timestamps from a "live source" and rebase onto the current timebase:
  24150. @example
  24151. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  24152. @end example
  24153. @item
  24154. Generate timestamps by counting samples:
  24155. @example
  24156. asetpts=N/SR/TB
  24157. @end example
  24158. @end itemize
  24159. @subsection Commands
  24160. Both filters support all above options as @ref{commands}.
  24161. @section setrange
  24162. Force color range for the output video frame.
  24163. The @code{setrange} filter marks the color range property for the
  24164. output frames. It does not change the input frame, but only sets the
  24165. corresponding property, which affects how the frame is treated by
  24166. following filters.
  24167. The filter accepts the following options:
  24168. @table @option
  24169. @item range
  24170. Available values are:
  24171. @table @samp
  24172. @item auto
  24173. Keep the same color range property.
  24174. @item unspecified, unknown
  24175. Set the color range as unspecified.
  24176. @item limited, tv, mpeg
  24177. Set the color range as limited.
  24178. @item full, pc, jpeg
  24179. Set the color range as full.
  24180. @end table
  24181. @end table
  24182. @section settb, asettb
  24183. Set the timebase to use for the output frames timestamps.
  24184. It is mainly useful for testing timebase configuration.
  24185. It accepts the following parameters:
  24186. @table @option
  24187. @item expr, tb
  24188. The expression which is evaluated into the output timebase.
  24189. @end table
  24190. The value for @option{tb} is an arithmetic expression representing a
  24191. rational. The expression can contain the constants "AVTB" (the default
  24192. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  24193. audio only). Default value is "intb".
  24194. @subsection Examples
  24195. @itemize
  24196. @item
  24197. Set the timebase to 1/25:
  24198. @example
  24199. settb=expr=1/25
  24200. @end example
  24201. @item
  24202. Set the timebase to 1/10:
  24203. @example
  24204. settb=expr=0.1
  24205. @end example
  24206. @item
  24207. Set the timebase to 1001/1000:
  24208. @example
  24209. settb=1+0.001
  24210. @end example
  24211. @item
  24212. Set the timebase to 2*intb:
  24213. @example
  24214. settb=2*intb
  24215. @end example
  24216. @item
  24217. Set the default timebase value:
  24218. @example
  24219. settb=AVTB
  24220. @end example
  24221. @end itemize
  24222. @section showcqt
  24223. Convert input audio to a video output representing frequency spectrum
  24224. logarithmically using Brown-Puckette constant Q transform algorithm with
  24225. direct frequency domain coefficient calculation (but the transform itself
  24226. is not really constant Q, instead the Q factor is actually variable/clamped),
  24227. with musical tone scale, from E0 to D#10.
  24228. The filter accepts the following options:
  24229. @table @option
  24230. @item size, s
  24231. Specify the video size for the output. It must be even. For the syntax of this option,
  24232. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24233. Default value is @code{1920x1080}.
  24234. @item fps, rate, r
  24235. Set the output frame rate. Default value is @code{25}.
  24236. @item bar_h
  24237. Set the bargraph height. It must be even. Default value is @code{-1} which
  24238. computes the bargraph height automatically.
  24239. @item axis_h
  24240. Set the axis height. It must be even. Default value is @code{-1} which computes
  24241. the axis height automatically.
  24242. @item sono_h
  24243. Set the sonogram height. It must be even. Default value is @code{-1} which
  24244. computes the sonogram height automatically.
  24245. @item fullhd
  24246. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  24247. instead. Default value is @code{1}.
  24248. @item sono_v, volume
  24249. Specify the sonogram volume expression. It can contain variables:
  24250. @table @option
  24251. @item bar_v
  24252. the @var{bar_v} evaluated expression
  24253. @item frequency, freq, f
  24254. the frequency where it is evaluated
  24255. @item timeclamp, tc
  24256. the value of @var{timeclamp} option
  24257. @end table
  24258. and functions:
  24259. @table @option
  24260. @item a_weighting(f)
  24261. A-weighting of equal loudness
  24262. @item b_weighting(f)
  24263. B-weighting of equal loudness
  24264. @item c_weighting(f)
  24265. C-weighting of equal loudness.
  24266. @end table
  24267. Default value is @code{16}.
  24268. @item bar_v, volume2
  24269. Specify the bargraph volume expression. It can contain variables:
  24270. @table @option
  24271. @item sono_v
  24272. the @var{sono_v} evaluated expression
  24273. @item frequency, freq, f
  24274. the frequency where it is evaluated
  24275. @item timeclamp, tc
  24276. the value of @var{timeclamp} option
  24277. @end table
  24278. and functions:
  24279. @table @option
  24280. @item a_weighting(f)
  24281. A-weighting of equal loudness
  24282. @item b_weighting(f)
  24283. B-weighting of equal loudness
  24284. @item c_weighting(f)
  24285. C-weighting of equal loudness.
  24286. @end table
  24287. Default value is @code{sono_v}.
  24288. @item sono_g, gamma
  24289. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  24290. higher gamma makes the spectrum having more range. Default value is @code{3}.
  24291. Acceptable range is @code{[1, 7]}.
  24292. @item bar_g, gamma2
  24293. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  24294. @code{[1, 7]}.
  24295. @item bar_t
  24296. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  24297. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  24298. @item timeclamp, tc
  24299. Specify the transform timeclamp. At low frequency, there is trade-off between
  24300. accuracy in time domain and frequency domain. If timeclamp is lower,
  24301. event in time domain is represented more accurately (such as fast bass drum),
  24302. otherwise event in frequency domain is represented more accurately
  24303. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  24304. @item attack
  24305. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  24306. limits future samples by applying asymmetric windowing in time domain, useful
  24307. when low latency is required. Accepted range is @code{[0, 1]}.
  24308. @item basefreq
  24309. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  24310. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  24311. @item endfreq
  24312. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  24313. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  24314. @item coeffclamp
  24315. This option is deprecated and ignored.
  24316. @item tlength
  24317. Specify the transform length in time domain. Use this option to control accuracy
  24318. trade-off between time domain and frequency domain at every frequency sample.
  24319. It can contain variables:
  24320. @table @option
  24321. @item frequency, freq, f
  24322. the frequency where it is evaluated
  24323. @item timeclamp, tc
  24324. the value of @var{timeclamp} option.
  24325. @end table
  24326. Default value is @code{384*tc/(384+tc*f)}.
  24327. @item count
  24328. Specify the transform count for every video frame. Default value is @code{6}.
  24329. Acceptable range is @code{[1, 30]}.
  24330. @item fcount
  24331. Specify the transform count for every single pixel. Default value is @code{0},
  24332. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  24333. @item fontfile
  24334. Specify font file for use with freetype to draw the axis. If not specified,
  24335. use embedded font. Note that drawing with font file or embedded font is not
  24336. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  24337. option instead.
  24338. @item font
  24339. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  24340. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  24341. escaping.
  24342. @item fontcolor
  24343. Specify font color expression. This is arithmetic expression that should return
  24344. integer value 0xRRGGBB. It can contain variables:
  24345. @table @option
  24346. @item frequency, freq, f
  24347. the frequency where it is evaluated
  24348. @item timeclamp, tc
  24349. the value of @var{timeclamp} option
  24350. @end table
  24351. and functions:
  24352. @table @option
  24353. @item midi(f)
  24354. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  24355. @item r(x), g(x), b(x)
  24356. red, green, and blue value of intensity x.
  24357. @end table
  24358. Default value is @code{st(0, (midi(f)-59.5)/12);
  24359. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  24360. r(1-ld(1)) + b(ld(1))}.
  24361. @item axisfile
  24362. Specify image file to draw the axis. This option override @var{fontfile} and
  24363. @var{fontcolor} option.
  24364. @item axis, text
  24365. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  24366. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  24367. Default value is @code{1}.
  24368. @item csp
  24369. Set colorspace. The accepted values are:
  24370. @table @samp
  24371. @item unspecified
  24372. Unspecified (default)
  24373. @item bt709
  24374. BT.709
  24375. @item fcc
  24376. FCC
  24377. @item bt470bg
  24378. BT.470BG or BT.601-6 625
  24379. @item smpte170m
  24380. SMPTE-170M or BT.601-6 525
  24381. @item smpte240m
  24382. SMPTE-240M
  24383. @item bt2020ncl
  24384. BT.2020 with non-constant luminance
  24385. @end table
  24386. @item cscheme
  24387. Set spectrogram color scheme. This is list of floating point values with format
  24388. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  24389. The default is @code{1|0.5|0|0|0.5|1}.
  24390. @end table
  24391. @subsection Examples
  24392. @itemize
  24393. @item
  24394. Playing audio while showing the spectrum:
  24395. @example
  24396. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  24397. @end example
  24398. @item
  24399. Same as above, but with frame rate 30 fps:
  24400. @example
  24401. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  24402. @end example
  24403. @item
  24404. Playing at 1280x720:
  24405. @example
  24406. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  24407. @end example
  24408. @item
  24409. Disable sonogram display:
  24410. @example
  24411. sono_h=0
  24412. @end example
  24413. @item
  24414. A1 and its harmonics: A1, A2, (near)E3, A3:
  24415. @example
  24416. 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),
  24417. asplit[a][out1]; [a] showcqt [out0]'
  24418. @end example
  24419. @item
  24420. Same as above, but with more accuracy in frequency domain:
  24421. @example
  24422. 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),
  24423. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  24424. @end example
  24425. @item
  24426. Custom volume:
  24427. @example
  24428. bar_v=10:sono_v=bar_v*a_weighting(f)
  24429. @end example
  24430. @item
  24431. Custom gamma, now spectrum is linear to the amplitude.
  24432. @example
  24433. bar_g=2:sono_g=2
  24434. @end example
  24435. @item
  24436. Custom tlength equation:
  24437. @example
  24438. 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)))'
  24439. @end example
  24440. @item
  24441. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  24442. @example
  24443. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  24444. @end example
  24445. @item
  24446. Custom font using fontconfig:
  24447. @example
  24448. font='Courier New,Monospace,mono|bold'
  24449. @end example
  24450. @item
  24451. Custom frequency range with custom axis using image file:
  24452. @example
  24453. axisfile=myaxis.png:basefreq=40:endfreq=10000
  24454. @end example
  24455. @end itemize
  24456. @section showcwt
  24457. Convert input audio to video output representing frequency spectrum
  24458. using Continuous Wavelet Transform and Morlet wavelet.
  24459. The filter accepts the following options:
  24460. @table @option
  24461. @item size, s
  24462. Specify the video size for the output. For the syntax of this option,
  24463. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24464. Default value is @code{640x512}.
  24465. @item rate, r
  24466. Set the output frame rate. Default value is @code{25}.
  24467. @item scale
  24468. Set the frequency scale used. Allowed values are:
  24469. @table @option
  24470. @item linear
  24471. @item log
  24472. @item bark
  24473. @item mel
  24474. @item erbs
  24475. @item sqrt
  24476. @item cbrt
  24477. @item qdrt
  24478. @item fm
  24479. @end table
  24480. Default value is @code{linear}.
  24481. @item iscale
  24482. Set the intensity scale used. Allowed values are:
  24483. @table @option
  24484. @item linear
  24485. @item log
  24486. @item sqrt
  24487. @item cbrt
  24488. @item qdrt
  24489. @end table
  24490. Default value is @code{log}.
  24491. @item min
  24492. Set the minimum frequency that will be used in output.
  24493. Default is @code{20} Hz.
  24494. @item max
  24495. Set the maximum frequency that will be used in output.
  24496. Default is @code{20000} Hz. The real frequency upper limit
  24497. depends on input audio's sample rate and such will be enforced
  24498. on this value when it is set to value greater than Nyquist frequency.
  24499. @item imin
  24500. Set the minimum intensity that will be used in output.
  24501. @item imax
  24502. Set the maximum intensity that will be used in output.
  24503. @item logb
  24504. Set the logarithmic basis for brightness strength when
  24505. mapping calculated magnitude values to pixel values.
  24506. Allowed range is from @code{0} to @code{1}.
  24507. Default value is @code{0.0001}.
  24508. @item deviation
  24509. Set the frequency deviation.
  24510. Lower values than @code{1} are more frequency oriented,
  24511. while higher values than @code{1} are more time oriented.
  24512. Allowed range is from @code{0} to @code{10}.
  24513. Default value is @code{1}.
  24514. @item pps
  24515. Set the number of pixel output per each second in one row.
  24516. Allowed range is from @code{1} to @code{1024}.
  24517. Default value is @code{64}.
  24518. @item mode
  24519. Set the output visual mode. Allowed values are:
  24520. @table @option
  24521. @item magnitude
  24522. Show magnitude.
  24523. @item phase
  24524. Show only phase.
  24525. @item magphase
  24526. Show combination of magnitude and phase.
  24527. Magnitude is mapped to brightness and phase to color.
  24528. @item channel
  24529. Show unique color per channel magnitude.
  24530. @item stereo
  24531. Show unique color per stereo difference.
  24532. @end table
  24533. Default value is @code{magnitude}.
  24534. @item slide
  24535. Set the output slide method. Allowed values are:
  24536. @table @option
  24537. @item replace
  24538. @item scroll
  24539. @item frame
  24540. @end table
  24541. @item direction
  24542. Set the direction method for output slide method. Allowed values are:
  24543. @table @option
  24544. @item lr
  24545. Direction from left to right.
  24546. @item rl
  24547. Direction from right to left.
  24548. @item ud
  24549. Direction from up to down.
  24550. @item du
  24551. Direction from down to up.
  24552. @end table
  24553. @item bar
  24554. Set the ratio of bargraph display to display size. Default is 0.
  24555. @item rotation
  24556. Set color rotation, must be in [-1.0, 1.0] range.
  24557. Default value is @code{0}.
  24558. @end table
  24559. @section showfreqs
  24560. Convert input audio to video output representing the audio power spectrum.
  24561. Audio amplitude is on Y-axis while frequency is on X-axis.
  24562. The filter accepts the following options:
  24563. @table @option
  24564. @item size, s
  24565. Specify size of video. For the syntax of this option, check the
  24566. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24567. Default is @code{1024x512}.
  24568. @item rate, r
  24569. Set video rate. Default is @code{25}.
  24570. @item mode
  24571. Set display mode.
  24572. This set how each frequency bin will be represented.
  24573. It accepts the following values:
  24574. @table @samp
  24575. @item line
  24576. @item bar
  24577. @item dot
  24578. @end table
  24579. Default is @code{bar}.
  24580. @item ascale
  24581. Set amplitude scale.
  24582. It accepts the following values:
  24583. @table @samp
  24584. @item lin
  24585. Linear scale.
  24586. @item sqrt
  24587. Square root scale.
  24588. @item cbrt
  24589. Cubic root scale.
  24590. @item log
  24591. Logarithmic scale.
  24592. @end table
  24593. Default is @code{log}.
  24594. @item fscale
  24595. Set frequency scale.
  24596. It accepts the following values:
  24597. @table @samp
  24598. @item lin
  24599. Linear scale.
  24600. @item log
  24601. Logarithmic scale.
  24602. @item rlog
  24603. Reverse logarithmic scale.
  24604. @end table
  24605. Default is @code{lin}.
  24606. @item win_size
  24607. Set window size. Allowed range is from 16 to 65536.
  24608. Default is @code{2048}
  24609. @item win_func
  24610. Set windowing function.
  24611. It accepts the following values:
  24612. @table @samp
  24613. @item rect
  24614. @item bartlett
  24615. @item hanning
  24616. @item hamming
  24617. @item blackman
  24618. @item welch
  24619. @item flattop
  24620. @item bharris
  24621. @item bnuttall
  24622. @item bhann
  24623. @item sine
  24624. @item nuttall
  24625. @item lanczos
  24626. @item gauss
  24627. @item tukey
  24628. @item dolph
  24629. @item cauchy
  24630. @item parzen
  24631. @item poisson
  24632. @item bohman
  24633. @item kaiser
  24634. @end table
  24635. Default is @code{hanning}.
  24636. @item overlap
  24637. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  24638. which means optimal overlap for selected window function will be picked.
  24639. @item averaging
  24640. Set time averaging. Setting this to 0 will display current maximal peaks.
  24641. Default is @code{1}, which means time averaging is disabled.
  24642. @item colors
  24643. Specify list of colors separated by space or by '|' which will be used to
  24644. draw channel frequencies. Unrecognized or missing colors will be replaced
  24645. by white color.
  24646. @item cmode
  24647. Set channel display mode.
  24648. It accepts the following values:
  24649. @table @samp
  24650. @item combined
  24651. @item separate
  24652. @end table
  24653. Default is @code{combined}.
  24654. @item minamp
  24655. Set minimum amplitude used in @code{log} amplitude scaler.
  24656. @item data
  24657. Set data display mode.
  24658. It accepts the following values:
  24659. @table @samp
  24660. @item magnitude
  24661. @item phase
  24662. @item delay
  24663. @end table
  24664. Default is @code{magnitude}.
  24665. @item channels
  24666. Set channels to use when processing audio. By default all are processed.
  24667. @end table
  24668. @section showspatial
  24669. Convert stereo input audio to a video output, representing the spatial relationship
  24670. between two channels.
  24671. The filter accepts the following options:
  24672. @table @option
  24673. @item size, s
  24674. Specify the video size for the output. For the syntax of this option, check the
  24675. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24676. Default value is @code{512x512}.
  24677. @item win_size
  24678. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  24679. @item win_func
  24680. Set window function.
  24681. It accepts the following values:
  24682. @table @samp
  24683. @item rect
  24684. @item bartlett
  24685. @item hann
  24686. @item hanning
  24687. @item hamming
  24688. @item blackman
  24689. @item welch
  24690. @item flattop
  24691. @item bharris
  24692. @item bnuttall
  24693. @item bhann
  24694. @item sine
  24695. @item nuttall
  24696. @item lanczos
  24697. @item gauss
  24698. @item tukey
  24699. @item dolph
  24700. @item cauchy
  24701. @item parzen
  24702. @item poisson
  24703. @item bohman
  24704. @item kaiser
  24705. @end table
  24706. Default value is @code{hann}.
  24707. @item rate, r
  24708. Set output framerate.
  24709. @end table
  24710. @anchor{showspectrum}
  24711. @section showspectrum
  24712. Convert input audio to a video output, representing the audio frequency
  24713. spectrum.
  24714. The filter accepts the following options:
  24715. @table @option
  24716. @item size, s
  24717. Specify the video size for the output. For the syntax of this option, check the
  24718. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24719. Default value is @code{640x512}.
  24720. @item slide
  24721. Specify how the spectrum should slide along the window.
  24722. It accepts the following values:
  24723. @table @samp
  24724. @item replace
  24725. the samples start again on the left when they reach the right
  24726. @item scroll
  24727. the samples scroll from right to left
  24728. @item fullframe
  24729. frames are only produced when the samples reach the right
  24730. @item rscroll
  24731. the samples scroll from left to right
  24732. @item lreplace
  24733. the samples start again on the right when they reach the left
  24734. @end table
  24735. Default value is @code{replace}.
  24736. @item mode
  24737. Specify display mode.
  24738. It accepts the following values:
  24739. @table @samp
  24740. @item combined
  24741. all channels are displayed in the same row
  24742. @item separate
  24743. all channels are displayed in separate rows
  24744. @end table
  24745. Default value is @samp{combined}.
  24746. @item color
  24747. Specify display color mode.
  24748. It accepts the following values:
  24749. @table @samp
  24750. @item channel
  24751. each channel is displayed in a separate color
  24752. @item intensity
  24753. each channel is displayed using the same color scheme
  24754. @item rainbow
  24755. each channel is displayed using the rainbow color scheme
  24756. @item moreland
  24757. each channel is displayed using the moreland color scheme
  24758. @item nebulae
  24759. each channel is displayed using the nebulae color scheme
  24760. @item fire
  24761. each channel is displayed using the fire color scheme
  24762. @item fiery
  24763. each channel is displayed using the fiery color scheme
  24764. @item fruit
  24765. each channel is displayed using the fruit color scheme
  24766. @item cool
  24767. each channel is displayed using the cool color scheme
  24768. @item magma
  24769. each channel is displayed using the magma color scheme
  24770. @item green
  24771. each channel is displayed using the green color scheme
  24772. @item viridis
  24773. each channel is displayed using the viridis color scheme
  24774. @item plasma
  24775. each channel is displayed using the plasma color scheme
  24776. @item cividis
  24777. each channel is displayed using the cividis color scheme
  24778. @item terrain
  24779. each channel is displayed using the terrain color scheme
  24780. @end table
  24781. Default value is @samp{channel}.
  24782. @item scale
  24783. Specify scale used for calculating intensity color values.
  24784. It accepts the following values:
  24785. @table @samp
  24786. @item lin
  24787. linear
  24788. @item sqrt
  24789. square root, default
  24790. @item cbrt
  24791. cubic root
  24792. @item log
  24793. logarithmic
  24794. @item 4thrt
  24795. 4th root
  24796. @item 5thrt
  24797. 5th root
  24798. @end table
  24799. Default value is @samp{sqrt}.
  24800. @item fscale
  24801. Specify frequency scale.
  24802. It accepts the following values:
  24803. @table @samp
  24804. @item lin
  24805. linear
  24806. @item log
  24807. logarithmic
  24808. @end table
  24809. Default value is @samp{lin}.
  24810. @item saturation
  24811. Set saturation modifier for displayed colors. Negative values provide
  24812. alternative color scheme. @code{0} is no saturation at all.
  24813. Saturation must be in [-10.0, 10.0] range.
  24814. Default value is @code{1}.
  24815. @item win_func
  24816. Set window function.
  24817. It accepts the following values:
  24818. @table @samp
  24819. @item rect
  24820. @item bartlett
  24821. @item hann
  24822. @item hanning
  24823. @item hamming
  24824. @item blackman
  24825. @item welch
  24826. @item flattop
  24827. @item bharris
  24828. @item bnuttall
  24829. @item bhann
  24830. @item sine
  24831. @item nuttall
  24832. @item lanczos
  24833. @item gauss
  24834. @item tukey
  24835. @item dolph
  24836. @item cauchy
  24837. @item parzen
  24838. @item poisson
  24839. @item bohman
  24840. @item kaiser
  24841. @end table
  24842. Default value is @code{hann}.
  24843. @item orientation
  24844. Set orientation of time vs frequency axis. Can be @code{vertical} or
  24845. @code{horizontal}. Default is @code{vertical}.
  24846. @item overlap
  24847. Set ratio of overlap window. Default value is @code{0}.
  24848. When value is @code{1} overlap is set to recommended size for specific
  24849. window function currently used.
  24850. @item gain
  24851. Set scale gain for calculating intensity color values.
  24852. Default value is @code{1}.
  24853. @item data
  24854. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  24855. or unwrapped phase: @code{uphase}.
  24856. @item rotation
  24857. Set color rotation, must be in [-1.0, 1.0] range.
  24858. Default value is @code{0}.
  24859. @item start
  24860. Set start frequency from which to display spectrogram. Default is @code{0}.
  24861. @item stop
  24862. Set stop frequency to which to display spectrogram. Default is @code{0}.
  24863. @item fps
  24864. Set upper frame rate limit. Default is @code{auto}, unlimited.
  24865. @item legend
  24866. Draw time and frequency axes and legends. Default is disabled.
  24867. @item drange
  24868. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  24869. Allowed range is from 10 to 200.
  24870. @item limit
  24871. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  24872. Allowed range is from -100 to 100.
  24873. @item opacity
  24874. Set opacity strength when using pixel format output with alpha component.
  24875. @end table
  24876. The usage is very similar to the showwaves filter; see the examples in that
  24877. section.
  24878. @subsection Examples
  24879. @itemize
  24880. @item
  24881. Large window with logarithmic color scaling:
  24882. @example
  24883. showspectrum=s=1280x480:scale=log
  24884. @end example
  24885. @item
  24886. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  24887. @example
  24888. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  24889. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  24890. @end example
  24891. @end itemize
  24892. @section showspectrumpic
  24893. Convert input audio to a single video frame, representing the audio frequency
  24894. spectrum.
  24895. The filter accepts the following options:
  24896. @table @option
  24897. @item size, s
  24898. Specify the video size for the output. For the syntax of this option, check the
  24899. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24900. Default value is @code{4096x2048}.
  24901. @item mode
  24902. Specify display mode.
  24903. It accepts the following values:
  24904. @table @samp
  24905. @item combined
  24906. all channels are displayed in the same row
  24907. @item separate
  24908. all channels are displayed in separate rows
  24909. @end table
  24910. Default value is @samp{combined}.
  24911. @item color
  24912. Specify display color mode.
  24913. It accepts the following values:
  24914. @table @samp
  24915. @item channel
  24916. each channel is displayed in a separate color
  24917. @item intensity
  24918. each channel is displayed using the same color scheme
  24919. @item rainbow
  24920. each channel is displayed using the rainbow color scheme
  24921. @item moreland
  24922. each channel is displayed using the moreland color scheme
  24923. @item nebulae
  24924. each channel is displayed using the nebulae color scheme
  24925. @item fire
  24926. each channel is displayed using the fire color scheme
  24927. @item fiery
  24928. each channel is displayed using the fiery color scheme
  24929. @item fruit
  24930. each channel is displayed using the fruit color scheme
  24931. @item cool
  24932. each channel is displayed using the cool color scheme
  24933. @item magma
  24934. each channel is displayed using the magma color scheme
  24935. @item green
  24936. each channel is displayed using the green color scheme
  24937. @item viridis
  24938. each channel is displayed using the viridis color scheme
  24939. @item plasma
  24940. each channel is displayed using the plasma color scheme
  24941. @item cividis
  24942. each channel is displayed using the cividis color scheme
  24943. @item terrain
  24944. each channel is displayed using the terrain color scheme
  24945. @end table
  24946. Default value is @samp{intensity}.
  24947. @item scale
  24948. Specify scale used for calculating intensity color values.
  24949. It accepts the following values:
  24950. @table @samp
  24951. @item lin
  24952. linear
  24953. @item sqrt
  24954. square root, default
  24955. @item cbrt
  24956. cubic root
  24957. @item log
  24958. logarithmic
  24959. @item 4thrt
  24960. 4th root
  24961. @item 5thrt
  24962. 5th root
  24963. @end table
  24964. Default value is @samp{log}.
  24965. @item fscale
  24966. Specify frequency scale.
  24967. It accepts the following values:
  24968. @table @samp
  24969. @item lin
  24970. linear
  24971. @item log
  24972. logarithmic
  24973. @end table
  24974. Default value is @samp{lin}.
  24975. @item saturation
  24976. Set saturation modifier for displayed colors. Negative values provide
  24977. alternative color scheme. @code{0} is no saturation at all.
  24978. Saturation must be in [-10.0, 10.0] range.
  24979. Default value is @code{1}.
  24980. @item win_func
  24981. Set window function.
  24982. It accepts the following values:
  24983. @table @samp
  24984. @item rect
  24985. @item bartlett
  24986. @item hann
  24987. @item hanning
  24988. @item hamming
  24989. @item blackman
  24990. @item welch
  24991. @item flattop
  24992. @item bharris
  24993. @item bnuttall
  24994. @item bhann
  24995. @item sine
  24996. @item nuttall
  24997. @item lanczos
  24998. @item gauss
  24999. @item tukey
  25000. @item dolph
  25001. @item cauchy
  25002. @item parzen
  25003. @item poisson
  25004. @item bohman
  25005. @item kaiser
  25006. @end table
  25007. Default value is @code{hann}.
  25008. @item orientation
  25009. Set orientation of time vs frequency axis. Can be @code{vertical} or
  25010. @code{horizontal}. Default is @code{vertical}.
  25011. @item gain
  25012. Set scale gain for calculating intensity color values.
  25013. Default value is @code{1}.
  25014. @item legend
  25015. Draw time and frequency axes and legends. Default is enabled.
  25016. @item rotation
  25017. Set color rotation, must be in [-1.0, 1.0] range.
  25018. Default value is @code{0}.
  25019. @item start
  25020. Set start frequency from which to display spectrogram. Default is @code{0}.
  25021. @item stop
  25022. Set stop frequency to which to display spectrogram. Default is @code{0}.
  25023. @item drange
  25024. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  25025. Allowed range is from 10 to 200.
  25026. @item limit
  25027. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  25028. Allowed range is from -100 to 100.
  25029. @item opacity
  25030. Set opacity strength when using pixel format output with alpha component.
  25031. @end table
  25032. @subsection Examples
  25033. @itemize
  25034. @item
  25035. Extract an audio spectrogram of a whole audio track
  25036. in a 1024x1024 picture using @command{ffmpeg}:
  25037. @example
  25038. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  25039. @end example
  25040. @end itemize
  25041. @section showvolume
  25042. Convert input audio volume to a video output.
  25043. The filter accepts the following options:
  25044. @table @option
  25045. @item rate, r
  25046. Set video rate.
  25047. @item b
  25048. Set border width, allowed range is [0, 5]. Default is 1.
  25049. @item w
  25050. Set channel width, allowed range is [80, 8192]. Default is 400.
  25051. @item h
  25052. Set channel height, allowed range is [1, 900]. Default is 20.
  25053. @item f
  25054. Set fade, allowed range is [0, 1]. Default is 0.95.
  25055. @item c
  25056. Set volume color expression.
  25057. The expression can use the following variables:
  25058. @table @option
  25059. @item VOLUME
  25060. Current max volume of channel in dB.
  25061. @item PEAK
  25062. Current peak.
  25063. @item CHANNEL
  25064. Current channel number, starting from 0.
  25065. @end table
  25066. @item t
  25067. If set, displays channel names. Default is enabled.
  25068. @item v
  25069. If set, displays volume values. Default is enabled.
  25070. @item o
  25071. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  25072. default is @code{h}.
  25073. @item s
  25074. Set step size, allowed range is [0, 5]. Default is 0, which means
  25075. step is disabled.
  25076. @item p
  25077. Set background opacity, allowed range is [0, 1]. Default is 0.
  25078. @item m
  25079. Set metering mode, can be peak: @code{p} or rms: @code{r},
  25080. default is @code{p}.
  25081. @item ds
  25082. Set display scale, can be linear: @code{lin} or log: @code{log},
  25083. default is @code{lin}.
  25084. @item dm
  25085. In second.
  25086. If set to > 0., display a line for the max level
  25087. in the previous seconds.
  25088. default is disabled: @code{0.}
  25089. @item dmc
  25090. The color of the max line. Use when @code{dm} option is set to > 0.
  25091. default is: @code{orange}
  25092. @end table
  25093. @section showwaves
  25094. Convert input audio to a video output, representing the samples waves.
  25095. The filter accepts the following options:
  25096. @table @option
  25097. @item size, s
  25098. Specify the video size for the output. For the syntax of this option, check the
  25099. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  25100. Default value is @code{600x240}.
  25101. @item mode
  25102. Set display mode.
  25103. Available values are:
  25104. @table @samp
  25105. @item point
  25106. Draw a point for each sample.
  25107. @item line
  25108. Draw a vertical line for each sample.
  25109. @item p2p
  25110. Draw a point for each sample and a line between them.
  25111. @item cline
  25112. Draw a centered vertical line for each sample.
  25113. @end table
  25114. Default value is @code{point}.
  25115. @item n
  25116. Set the number of samples which are printed on the same column. A
  25117. larger value will decrease the frame rate. Must be a positive
  25118. integer. This option can be set only if the value for @var{rate}
  25119. is not explicitly specified.
  25120. @item rate, r
  25121. Set the (approximate) output frame rate. This is done by setting the
  25122. option @var{n}. Default value is "25".
  25123. @item split_channels
  25124. Set if channels should be drawn separately or overlap. Default value is 0.
  25125. @item colors
  25126. Set colors separated by '|' which are going to be used for drawing of each channel.
  25127. @item scale
  25128. Set amplitude scale.
  25129. Available values are:
  25130. @table @samp
  25131. @item lin
  25132. Linear.
  25133. @item log
  25134. Logarithmic.
  25135. @item sqrt
  25136. Square root.
  25137. @item cbrt
  25138. Cubic root.
  25139. @end table
  25140. Default is linear.
  25141. @item draw
  25142. Set the draw mode. This is mostly useful to set for high @var{n}.
  25143. Available values are:
  25144. @table @samp
  25145. @item scale
  25146. Scale pixel values for each drawn sample.
  25147. @item full
  25148. Draw every sample directly.
  25149. @end table
  25150. Default value is @code{scale}.
  25151. @end table
  25152. @subsection Examples
  25153. @itemize
  25154. @item
  25155. Output the input file audio and the corresponding video representation
  25156. at the same time:
  25157. @example
  25158. amovie=a.mp3,asplit[out0],showwaves[out1]
  25159. @end example
  25160. @item
  25161. Create a synthetic signal and show it with showwaves, forcing a
  25162. frame rate of 30 frames per second:
  25163. @example
  25164. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  25165. @end example
  25166. @end itemize
  25167. @section showwavespic
  25168. Convert input audio to a single video frame, representing the samples waves.
  25169. The filter accepts the following options:
  25170. @table @option
  25171. @item size, s
  25172. Specify the video size for the output. For the syntax of this option, check the
  25173. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  25174. Default value is @code{600x240}.
  25175. @item split_channels
  25176. Set if channels should be drawn separately or overlap. Default value is 0.
  25177. @item colors
  25178. Set colors separated by '|' which are going to be used for drawing of each channel.
  25179. @item scale
  25180. Set amplitude scale.
  25181. Available values are:
  25182. @table @samp
  25183. @item lin
  25184. Linear.
  25185. @item log
  25186. Logarithmic.
  25187. @item sqrt
  25188. Square root.
  25189. @item cbrt
  25190. Cubic root.
  25191. @end table
  25192. Default is linear.
  25193. @item draw
  25194. Set the draw mode.
  25195. Available values are:
  25196. @table @samp
  25197. @item scale
  25198. Scale pixel values for each drawn sample.
  25199. @item full
  25200. Draw every sample directly.
  25201. @end table
  25202. Default value is @code{scale}.
  25203. @item filter
  25204. Set the filter mode.
  25205. Available values are:
  25206. @table @samp
  25207. @item average
  25208. Use average samples values for each drawn sample.
  25209. @item peak
  25210. Use peak samples values for each drawn sample.
  25211. @end table
  25212. Default value is @code{average}.
  25213. @end table
  25214. @subsection Examples
  25215. @itemize
  25216. @item
  25217. Extract a channel split representation of the wave form of a whole audio track
  25218. in a 1024x800 picture using @command{ffmpeg}:
  25219. @example
  25220. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  25221. @end example
  25222. @end itemize
  25223. @section sidedata, asidedata
  25224. Delete frame side data, or select frames based on it.
  25225. This filter accepts the following options:
  25226. @table @option
  25227. @item mode
  25228. Set mode of operation of the filter.
  25229. Can be one of the following:
  25230. @table @samp
  25231. @item select
  25232. Select every frame with side data of @code{type}.
  25233. @item delete
  25234. Delete side data of @code{type}. If @code{type} is not set, delete all side
  25235. data in the frame.
  25236. @end table
  25237. @item type
  25238. Set side data type used with all modes. Must be set for @code{select} mode. For
  25239. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  25240. in @file{libavutil/frame.h}. For example, to choose
  25241. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  25242. @end table
  25243. @section spectrumsynth
  25244. Synthesize audio from 2 input video spectrums, first input stream represents
  25245. magnitude across time and second represents phase across time.
  25246. The filter will transform from frequency domain as displayed in videos back
  25247. to time domain as presented in audio output.
  25248. This filter is primarily created for reversing processed @ref{showspectrum}
  25249. filter outputs, but can synthesize sound from other spectrograms too.
  25250. But in such case results are going to be poor if the phase data is not
  25251. available, because in such cases phase data need to be recreated, usually
  25252. it's just recreated from random noise.
  25253. For best results use gray only output (@code{channel} color mode in
  25254. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  25255. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  25256. @code{data} option. Inputs videos should generally use @code{fullframe}
  25257. slide mode as that saves resources needed for decoding video.
  25258. The filter accepts the following options:
  25259. @table @option
  25260. @item sample_rate
  25261. Specify sample rate of output audio, the sample rate of audio from which
  25262. spectrum was generated may differ.
  25263. @item channels
  25264. Set number of channels represented in input video spectrums.
  25265. @item scale
  25266. Set scale which was used when generating magnitude input spectrum.
  25267. Can be @code{lin} or @code{log}. Default is @code{log}.
  25268. @item slide
  25269. Set slide which was used when generating inputs spectrums.
  25270. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  25271. Default is @code{fullframe}.
  25272. @item win_func
  25273. Set window function used for resynthesis.
  25274. @item overlap
  25275. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  25276. which means optimal overlap for selected window function will be picked.
  25277. @item orientation
  25278. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  25279. Default is @code{vertical}.
  25280. @end table
  25281. @subsection Examples
  25282. @itemize
  25283. @item
  25284. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  25285. then resynthesize videos back to audio with spectrumsynth:
  25286. @example
  25287. 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
  25288. 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
  25289. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  25290. @end example
  25291. @end itemize
  25292. @section split, asplit
  25293. Split input into several identical outputs.
  25294. @code{asplit} works with audio input, @code{split} with video.
  25295. The filter accepts a single parameter which specifies the number of outputs. If
  25296. unspecified, it defaults to 2.
  25297. @subsection Examples
  25298. @itemize
  25299. @item
  25300. Create two separate outputs from the same input:
  25301. @example
  25302. [in] split [out0][out1]
  25303. @end example
  25304. @item
  25305. To create 3 or more outputs, you need to specify the number of
  25306. outputs, like in:
  25307. @example
  25308. [in] asplit=3 [out0][out1][out2]
  25309. @end example
  25310. @item
  25311. Create two separate outputs from the same input, one cropped and
  25312. one padded:
  25313. @example
  25314. [in] split [splitout1][splitout2];
  25315. [splitout1] crop=100:100:0:0 [cropout];
  25316. [splitout2] pad=200:200:100:100 [padout];
  25317. @end example
  25318. @item
  25319. Create 5 copies of the input audio with @command{ffmpeg}:
  25320. @example
  25321. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  25322. @end example
  25323. @end itemize
  25324. @section zmq, azmq
  25325. Receive commands sent through a libzmq client, and forward them to
  25326. filters in the filtergraph.
  25327. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  25328. must be inserted between two video filters, @code{azmq} between two
  25329. audio filters. Both are capable to send messages to any filter type.
  25330. To enable these filters you need to install the libzmq library and
  25331. headers and configure FFmpeg with @code{--enable-libzmq}.
  25332. For more information about libzmq see:
  25333. @url{http://www.zeromq.org/}
  25334. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  25335. receives messages sent through a network interface defined by the
  25336. @option{bind_address} (or the abbreviation "@option{b}") option.
  25337. Default value of this option is @file{tcp://localhost:5555}. You may
  25338. want to alter this value to your needs, but do not forget to escape any
  25339. ':' signs (see @ref{filtergraph escaping}).
  25340. The received message must be in the form:
  25341. @example
  25342. @var{TARGET} @var{COMMAND} [@var{ARG}]
  25343. @end example
  25344. @var{TARGET} specifies the target of the command, usually the name of
  25345. the filter class or a specific filter instance name. The default
  25346. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  25347. but you can override this by using the @samp{filter_name@@id} syntax
  25348. (see @ref{Filtergraph syntax}).
  25349. @var{COMMAND} specifies the name of the command for the target filter.
  25350. @var{ARG} is optional and specifies the optional argument list for the
  25351. given @var{COMMAND}.
  25352. Upon reception, the message is processed and the corresponding command
  25353. is injected into the filtergraph. Depending on the result, the filter
  25354. will send a reply to the client, adopting the format:
  25355. @example
  25356. @var{ERROR_CODE} @var{ERROR_REASON}
  25357. @var{MESSAGE}
  25358. @end example
  25359. @var{MESSAGE} is optional.
  25360. @subsection Examples
  25361. Look at @file{tools/zmqsend} for an example of a zmq client which can
  25362. be used to send commands processed by these filters.
  25363. Consider the following filtergraph generated by @command{ffplay}.
  25364. In this example the last overlay filter has an instance name. All other
  25365. filters will have default instance names.
  25366. @example
  25367. ffplay -dumpgraph 1 -f lavfi "
  25368. color=s=100x100:c=red [l];
  25369. color=s=100x100:c=blue [r];
  25370. nullsrc=s=200x100, zmq [bg];
  25371. [bg][l] overlay [bg+l];
  25372. [bg+l][r] overlay@@my=x=100 "
  25373. @end example
  25374. To change the color of the left side of the video, the following
  25375. command can be used:
  25376. @example
  25377. echo Parsed_color_0 c yellow | tools/zmqsend
  25378. @end example
  25379. To change the right side:
  25380. @example
  25381. echo Parsed_color_1 c pink | tools/zmqsend
  25382. @end example
  25383. To change the position of the right side:
  25384. @example
  25385. echo overlay@@my x 150 | tools/zmqsend
  25386. @end example
  25387. @c man end MULTIMEDIA FILTERS
  25388. @chapter Multimedia Sources
  25389. @c man begin MULTIMEDIA SOURCES
  25390. Below is a description of the currently available multimedia sources.
  25391. @section amovie
  25392. This is the same as @ref{movie} source, except it selects an audio
  25393. stream by default.
  25394. @section avsynctest
  25395. Generate an Audio/Video Sync Test.
  25396. Generated stream periodically shows flash video frame and emits beep in audio.
  25397. Useful to inspect A/V sync issues.
  25398. It accepts the following options:
  25399. @table @option
  25400. @item size, s
  25401. Set output video size. Default value is @code{hd720}.
  25402. @item framerate, fr
  25403. Set output video frame rate. Default value is @code{30}.
  25404. @item samplerate, sr
  25405. Set output audio sample rate. Default value is @code{44100}.
  25406. @item amplitude, a
  25407. Set output audio beep amplitude. Default value is @code{0.7}.
  25408. @item period, p
  25409. Set output audio beep period in seconds. Default value is @code{3}.
  25410. @item delay, dl
  25411. Set output video flash delay in number of frames. Default value is @code{0}.
  25412. @item cycle, c
  25413. Enable cycling of video delays, by default is disabled.
  25414. @item duration, d
  25415. Set stream output duration. By default duration is unlimited.
  25416. @item fg, bg, ag
  25417. Set foreground/background/additional color.
  25418. @end table
  25419. @subsection Commands
  25420. This source supports the some above options as @ref{commands}.
  25421. @anchor{movie}
  25422. @section movie
  25423. Read audio and/or video stream(s) from a movie container.
  25424. It accepts the following parameters:
  25425. @table @option
  25426. @item filename
  25427. The name of the resource to read (not necessarily a file; it can also be a
  25428. device or a stream accessed through some protocol).
  25429. @item format_name, f
  25430. Specifies the format assumed for the movie to read, and can be either
  25431. the name of a container or an input device. If not specified, the
  25432. format is guessed from @var{movie_name} or by probing.
  25433. @item seek_point, sp
  25434. Specifies the seek point in seconds. The frames will be output
  25435. starting from this seek point. The parameter is evaluated with
  25436. @code{av_strtod}, so the numerical value may be suffixed by an IS
  25437. postfix. The default value is "0".
  25438. @item streams, s
  25439. Specifies the streams to read. Several streams can be specified,
  25440. separated by "+". The source will then have as many outputs, in the
  25441. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  25442. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  25443. respectively the default (best suited) video and audio stream. Default
  25444. is "dv", or "da" if the filter is called as "amovie".
  25445. @item stream_index, si
  25446. Specifies the index of the video stream to read. If the value is -1,
  25447. the most suitable video stream will be automatically selected. The default
  25448. value is "-1". Deprecated. If the filter is called "amovie", it will select
  25449. audio instead of video.
  25450. @item loop
  25451. Specifies how many times to read the stream in sequence.
  25452. If the value is 0, the stream will be looped infinitely.
  25453. Default value is "1".
  25454. Note that when the movie is looped the source timestamps are not
  25455. changed, so it will generate non monotonically increasing timestamps.
  25456. @item discontinuity
  25457. Specifies the time difference between frames above which the point is
  25458. considered a timestamp discontinuity which is removed by adjusting the later
  25459. timestamps.
  25460. @item dec_threads
  25461. Specifies the number of threads for decoding
  25462. @item format_opts
  25463. Specify format options for the opened file. Format options can be specified
  25464. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  25465. shows how to add protocol_whitelist and protocol_blacklist options:
  25466. @example
  25467. ffplay -f lavfi
  25468. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  25469. @end example
  25470. @end table
  25471. It allows overlaying a second video on top of the main input of
  25472. a filtergraph, as shown in this graph:
  25473. @example
  25474. input -----------> deltapts0 --> overlay --> output
  25475. ^
  25476. |
  25477. movie --> scale--> deltapts1 -------+
  25478. @end example
  25479. @subsection Examples
  25480. @itemize
  25481. @item
  25482. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  25483. on top of the input labelled "in":
  25484. @example
  25485. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  25486. [in] setpts=PTS-STARTPTS [main];
  25487. [main][over] overlay=16:16 [out]
  25488. @end example
  25489. @item
  25490. Read from a video4linux2 device, and overlay it on top of the input
  25491. labelled "in":
  25492. @example
  25493. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  25494. [in] setpts=PTS-STARTPTS [main];
  25495. [main][over] overlay=16:16 [out]
  25496. @end example
  25497. @item
  25498. Read the first video stream and the audio stream with id 0x81 from
  25499. dvd.vob; the video is connected to the pad named "video" and the audio is
  25500. connected to the pad named "audio":
  25501. @example
  25502. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  25503. @end example
  25504. @end itemize
  25505. @subsection Commands
  25506. Both movie and amovie support the following commands:
  25507. @table @option
  25508. @item seek
  25509. Perform seek using "av_seek_frame".
  25510. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  25511. @itemize
  25512. @item
  25513. @var{stream_index}: If stream_index is -1, a default
  25514. stream is selected, and @var{timestamp} is automatically converted
  25515. from AV_TIME_BASE units to the stream specific time_base.
  25516. @item
  25517. @var{timestamp}: Timestamp in AVStream.time_base units
  25518. or, if no stream is specified, in AV_TIME_BASE units.
  25519. @item
  25520. @var{flags}: Flags which select direction and seeking mode.
  25521. @end itemize
  25522. @item get_duration
  25523. Get movie duration in AV_TIME_BASE units.
  25524. @end table
  25525. @c man end MULTIMEDIA SOURCES