filters.texi 821 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @item ts_sync_mode
  283. How strictly to sync streams based on secondary input timestamps; it accepts
  284. one of the following values:
  285. @table @option
  286. @item default
  287. Frame from secondary input with the nearest lower or equal timestamp to the
  288. primary input frame.
  289. @item nearest
  290. Frame from secondary input with the absolute nearest timestamp to the primary
  291. input frame.
  292. @end table
  293. @end table
  294. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  295. @chapter Audio Filters
  296. @c man begin AUDIO FILTERS
  297. When you configure your FFmpeg build, you can disable any of the
  298. existing filters using @code{--disable-filters}.
  299. The configure output will show the audio filters included in your
  300. build.
  301. Below is a description of the currently available audio filters.
  302. @section acompressor
  303. A compressor is mainly used to reduce the dynamic range of a signal.
  304. Especially modern music is mostly compressed at a high ratio to
  305. improve the overall loudness. It's done to get the highest attention
  306. of a listener, "fatten" the sound and bring more "power" to the track.
  307. If a signal is compressed too much it may sound dull or "dead"
  308. afterwards or it may start to "pump" (which could be a powerful effect
  309. but can also destroy a track completely).
  310. The right compression is the key to reach a professional sound and is
  311. the high art of mixing and mastering. Because of its complex settings
  312. it may take a long time to get the right feeling for this kind of effect.
  313. Compression is done by detecting the volume above a chosen level
  314. @code{threshold} and dividing it by the factor set with @code{ratio}.
  315. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  316. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  317. the signal would cause distortion of the waveform the reduction can be
  318. levelled over the time. This is done by setting "Attack" and "Release".
  319. @code{attack} determines how long the signal has to rise above the threshold
  320. before any reduction will occur and @code{release} sets the time the signal
  321. has to fall below the threshold to reduce the reduction again. Shorter signals
  322. than the chosen attack time will be left untouched.
  323. The overall reduction of the signal can be made up afterwards with the
  324. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  325. raising the makeup to this level results in a signal twice as loud than the
  326. source. To gain a softer entry in the compression the @code{knee} flattens the
  327. hard edge at the threshold in the range of the chosen decibels.
  328. The filter accepts the following options:
  329. @table @option
  330. @item level_in
  331. Set input gain. Default is 1. Range is between 0.015625 and 64.
  332. @item mode
  333. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  334. Default is @code{downward}.
  335. @item threshold
  336. If a signal of stream rises above this level it will affect the gain
  337. reduction.
  338. By default it is 0.125. Range is between 0.00097563 and 1.
  339. @item ratio
  340. Set a ratio by which the signal is reduced. 1:2 means that if the level
  341. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  342. Default is 2. Range is between 1 and 20.
  343. @item attack
  344. Amount of milliseconds the signal has to rise above the threshold before gain
  345. reduction starts. Default is 20. Range is between 0.01 and 2000.
  346. @item release
  347. Amount of milliseconds the signal has to fall below the threshold before
  348. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  349. @item makeup
  350. Set the amount by how much signal will be amplified after processing.
  351. Default is 1. Range is from 1 to 64.
  352. @item knee
  353. Curve the sharp knee around the threshold to enter gain reduction more softly.
  354. Default is 2.82843. Range is between 1 and 8.
  355. @item link
  356. Choose if the @code{average} level between all channels of input stream
  357. or the louder(@code{maximum}) channel of input stream affects the
  358. reduction. Default is @code{average}.
  359. @item detection
  360. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  361. of @code{rms}. Default is @code{rms} which is mostly smoother.
  362. @item mix
  363. How much to use compressed signal in output. Default is 1.
  364. Range is between 0 and 1.
  365. @end table
  366. @subsection Commands
  367. This filter supports the all above options as @ref{commands}.
  368. @section acontrast
  369. Simple audio dynamic range compression/expansion filter.
  370. The filter accepts the following options:
  371. @table @option
  372. @item contrast
  373. Set contrast. Default is 33. Allowed range is between 0 and 100.
  374. @end table
  375. @section acopy
  376. Copy the input audio source unchanged to the output. This is mainly useful for
  377. testing purposes.
  378. @section acrossfade
  379. Apply cross fade from one input audio stream to another input audio stream.
  380. The cross fade is applied for specified duration near the end of first stream.
  381. The filter accepts the following options:
  382. @table @option
  383. @item nb_samples, ns
  384. Specify the number of samples for which the cross fade effect has to last.
  385. At the end of the cross fade effect the first input audio will be completely
  386. silent. Default is 44100.
  387. @item duration, d
  388. Specify the duration of the cross fade effect. See
  389. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  390. for the accepted syntax.
  391. By default the duration is determined by @var{nb_samples}.
  392. If set this option is used instead of @var{nb_samples}.
  393. @item overlap, o
  394. Should first stream end overlap with second stream start. Default is enabled.
  395. @item curve1
  396. Set curve for cross fade transition for first stream.
  397. @item curve2
  398. Set curve for cross fade transition for second stream.
  399. For description of available curve types see @ref{afade} filter description.
  400. @end table
  401. @subsection Examples
  402. @itemize
  403. @item
  404. Cross fade from one input to another:
  405. @example
  406. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  407. @end example
  408. @item
  409. Cross fade from one input to another but without overlapping:
  410. @example
  411. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  412. @end example
  413. @end itemize
  414. @section acrossover
  415. Split audio stream into several bands.
  416. This filter splits audio stream into two or more frequency ranges.
  417. Summing all streams back will give flat output.
  418. The filter accepts the following options:
  419. @table @option
  420. @item split
  421. Set split frequencies. Those must be positive and increasing.
  422. @item order
  423. Set filter order for each band split. This controls filter roll-off or steepness
  424. of filter transfer function.
  425. Available values are:
  426. @table @samp
  427. @item 2nd
  428. 12 dB per octave.
  429. @item 4th
  430. 24 dB per octave.
  431. @item 6th
  432. 36 dB per octave.
  433. @item 8th
  434. 48 dB per octave.
  435. @item 10th
  436. 60 dB per octave.
  437. @item 12th
  438. 72 dB per octave.
  439. @item 14th
  440. 84 dB per octave.
  441. @item 16th
  442. 96 dB per octave.
  443. @item 18th
  444. 108 dB per octave.
  445. @item 20th
  446. 120 dB per octave.
  447. @end table
  448. Default is @var{4th}.
  449. @item level
  450. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  451. @item gains
  452. Set output gain for each band. Default value is 1 for all bands.
  453. @item precision
  454. Set which precision to use when processing samples.
  455. @table @option
  456. @item auto
  457. Auto pick internal sample format depending on other filters.
  458. @item float
  459. Always use single-floating point precision sample format.
  460. @item double
  461. Always use double-floating point precision sample format.
  462. @end table
  463. Default value is @code{auto}.
  464. @end table
  465. @subsection Examples
  466. @itemize
  467. @item
  468. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  469. each band will be in separate stream:
  470. @example
  471. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  472. @end example
  473. @item
  474. Same as above, but with higher filter order:
  475. @example
  476. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  477. @end example
  478. @item
  479. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  480. @example
  481. 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
  482. @end example
  483. @end itemize
  484. @section acrusher
  485. Reduce audio bit resolution.
  486. This filter is bit crusher with enhanced functionality. A bit crusher
  487. is used to audibly reduce number of bits an audio signal is sampled
  488. with. This doesn't change the bit depth at all, it just produces the
  489. effect. Material reduced in bit depth sounds more harsh and "digital".
  490. This filter is able to even round to continuous values instead of discrete
  491. bit depths.
  492. Additionally it has a D/C offset which results in different crushing of
  493. the lower and the upper half of the signal.
  494. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  495. Another feature of this filter is the logarithmic mode.
  496. This setting switches from linear distances between bits to logarithmic ones.
  497. The result is a much more "natural" sounding crusher which doesn't gate low
  498. signals for example. The human ear has a logarithmic perception,
  499. so this kind of crushing is much more pleasant.
  500. Logarithmic crushing is also able to get anti-aliased.
  501. The filter accepts the following options:
  502. @table @option
  503. @item level_in
  504. Set level in.
  505. @item level_out
  506. Set level out.
  507. @item bits
  508. Set bit reduction.
  509. @item mix
  510. Set mixing amount.
  511. @item mode
  512. Can be linear: @code{lin} or logarithmic: @code{log}.
  513. @item dc
  514. Set DC.
  515. @item aa
  516. Set anti-aliasing.
  517. @item samples
  518. Set sample reduction.
  519. @item lfo
  520. Enable LFO. By default disabled.
  521. @item lforange
  522. Set LFO range.
  523. @item lforate
  524. Set LFO rate.
  525. @end table
  526. @subsection Commands
  527. This filter supports the all above options as @ref{commands}.
  528. @section acue
  529. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  530. filter.
  531. @section adeclick
  532. Remove impulsive noise from input audio.
  533. Samples detected as impulsive noise are replaced by interpolated samples using
  534. autoregressive modelling.
  535. @table @option
  536. @item window, w
  537. Set window size, in milliseconds. Allowed range is from @code{10} to
  538. @code{100}. Default value is @code{55} milliseconds.
  539. This sets size of window which will be processed at once.
  540. @item overlap, o
  541. Set window overlap, in percentage of window size. Allowed range is from
  542. @code{50} to @code{95}. Default value is @code{75} percent.
  543. Setting this to a very high value increases impulsive noise removal but makes
  544. whole process much slower.
  545. @item arorder, a
  546. Set autoregression order, in percentage of window size. Allowed range is from
  547. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  548. controls quality of interpolated samples using neighbour good samples.
  549. @item threshold, t
  550. Set threshold value. Allowed range is from @code{1} to @code{100}.
  551. Default value is @code{2}.
  552. This controls the strength of impulsive noise which is going to be removed.
  553. The lower value, the more samples will be detected as impulsive noise.
  554. @item burst, b
  555. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  556. @code{10}. Default value is @code{2}.
  557. If any two samples detected as noise are spaced less than this value then any
  558. sample between those two samples will be also detected as noise.
  559. @item method, m
  560. Set overlap method.
  561. It accepts the following values:
  562. @table @option
  563. @item add, a
  564. Select overlap-add method. Even not interpolated samples are slightly
  565. changed with this method.
  566. @item save, s
  567. Select overlap-save method. Not interpolated samples remain unchanged.
  568. @end table
  569. Default value is @code{a}.
  570. @end table
  571. @section adeclip
  572. Remove clipped samples from input audio.
  573. Samples detected as clipped are replaced by interpolated samples using
  574. autoregressive modelling.
  575. @table @option
  576. @item window, w
  577. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  578. Default value is @code{55} milliseconds.
  579. This sets size of window which will be processed at once.
  580. @item overlap, o
  581. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  582. to @code{95}. Default value is @code{75} percent.
  583. @item arorder, a
  584. Set autoregression order, in percentage of window size. Allowed range is from
  585. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  586. quality of interpolated samples using neighbour good samples.
  587. @item threshold, t
  588. Set threshold value. Allowed range is from @code{1} to @code{100}.
  589. Default value is @code{10}. Higher values make clip detection less aggressive.
  590. @item hsize, n
  591. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  592. Default value is @code{1000}. Higher values make clip detection less aggressive.
  593. @item method, m
  594. Set overlap method.
  595. It accepts the following values:
  596. @table @option
  597. @item add, a
  598. Select overlap-add method. Even not interpolated samples are slightly changed
  599. with this method.
  600. @item save, s
  601. Select overlap-save method. Not interpolated samples remain unchanged.
  602. @end table
  603. Default value is @code{a}.
  604. @end table
  605. @section adecorrelate
  606. Apply decorrelation to input audio stream.
  607. The filter accepts the following options:
  608. @table @option
  609. @item stages
  610. Set decorrelation stages of filtering. Allowed
  611. range is from 1 to 16. Default value is 6.
  612. @item seed
  613. Set random seed used for setting delay in samples across channels.
  614. @end table
  615. @section adelay
  616. Delay one or more audio channels.
  617. Samples in delayed channel are filled with silence.
  618. The filter accepts the following option:
  619. @table @option
  620. @item delays
  621. Set list of delays in milliseconds for each channel separated by '|'.
  622. Unused delays will be silently ignored. If number of given delays is
  623. smaller than number of channels all remaining channels will not be delayed.
  624. If you want to delay exact number of samples, append 'S' to number.
  625. If you want instead to delay in seconds, append 's' to number.
  626. @item all
  627. Use last set delay for all remaining channels. By default is disabled.
  628. This option if enabled changes how option @code{delays} is interpreted.
  629. @end table
  630. @subsection Examples
  631. @itemize
  632. @item
  633. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  634. the second channel (and any other channels that may be present) unchanged.
  635. @example
  636. adelay=1500|0|500
  637. @end example
  638. @item
  639. Delay second channel by 500 samples, the third channel by 700 samples and leave
  640. the first channel (and any other channels that may be present) unchanged.
  641. @example
  642. adelay=0|500S|700S
  643. @end example
  644. @item
  645. Delay all channels by same number of samples:
  646. @example
  647. adelay=delays=64S:all=1
  648. @end example
  649. @end itemize
  650. @section adenorm
  651. Remedy denormals in audio by adding extremely low-level noise.
  652. This filter shall be placed before any filter that can produce denormals.
  653. A description of the accepted parameters follows.
  654. @table @option
  655. @item level
  656. Set level of added noise in dB. Default is @code{-351}.
  657. Allowed range is from -451 to -90.
  658. @item type
  659. Set type of added noise.
  660. @table @option
  661. @item dc
  662. Add DC signal.
  663. @item ac
  664. Add AC signal.
  665. @item square
  666. Add square signal.
  667. @item pulse
  668. Add pulse signal.
  669. @end table
  670. Default is @code{dc}.
  671. @end table
  672. @subsection Commands
  673. This filter supports the all above options as @ref{commands}.
  674. @section aderivative, aintegral
  675. Compute derivative/integral of audio stream.
  676. Applying both filters one after another produces original audio.
  677. @section adrc
  678. Apply spectral dynamic range controller filter to input audio stream.
  679. A description of the accepted options follows.
  680. @table @option
  681. @item transfer
  682. Set the transfer expression.
  683. The expression can contain the following constants:
  684. @table @option
  685. @item ch
  686. current channel number
  687. @item sn
  688. current sample number
  689. @item nb_channels
  690. number of channels
  691. @item t
  692. timestamp expressed in seconds
  693. @item sr
  694. sample rate
  695. @item p
  696. current frequency power value, in dB
  697. @item f
  698. current frequency in Hz
  699. @end table
  700. Default value is @code{p}.
  701. @item attack
  702. Set the attack in milliseconds. Default is @code{50} milliseconds.
  703. Allowed range is from 1 to 1000 milliseconds.
  704. @item release
  705. Set the release in milliseconds. Default is @code{100} milliseconds.
  706. Allowed range is from 5 to 2000 milliseconds.
  707. @item channels
  708. Set which channels to filter, by default @code{all} channels in audio stream are filtered.
  709. @end table
  710. @subsection Commands
  711. This filter supports the all above options as @ref{commands}.
  712. @subsection Examples
  713. @itemize
  714. @item
  715. Apply spectral compression to all frequencies with threshold of -50 dB and 1:6 ratio:
  716. @example
  717. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/6,p)':attack=50:release=100
  718. @end example
  719. @item
  720. Similar to above but with 1:2 ratio and filtering only front center channel:
  721. @example
  722. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/2,p)':attack=50:release=100:channels=FC
  723. @end example
  724. @item
  725. Apply spectral noise gate to all frequencies with threshold of -85 dB and with short attack time and short release time:
  726. @example
  727. adrc=transfer='if(lte(p,-85),p-800,p)':attack=1:release=5
  728. @end example
  729. @item
  730. Apply spectral expansion to all frequencies with threshold of -10 dB and 1:2 ratio:
  731. @example
  732. adrc=transfer='if(lt(p,-10),-10+(p-(-10))*2,p)':attack=50:release=100
  733. @end example
  734. @item
  735. Apply limiter to max -60 dB to all frequencies, with attack of 2 ms and release of 10 ms:
  736. @example
  737. adrc=transfer='min(p,-60)':attack=2:release=10
  738. @end example
  739. @end itemize
  740. @section adynamicequalizer
  741. Apply dynamic equalization to input audio stream.
  742. A description of the accepted options follows.
  743. @table @option
  744. @item threshold
  745. Set the detection threshold used to trigger equalization.
  746. Threshold detection is using bandpass filter.
  747. Default value is 0. Allowed range is from 0 to 100.
  748. @item dfrequency
  749. Set the detection frequency in Hz used for bandpass filter used to trigger equalization.
  750. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  751. @item dqfactor
  752. Set the detection resonance factor for bandpass filter used to trigger equalization.
  753. Default value is 1. Allowed range is from 0.001 to 1000.
  754. @item tfrequency
  755. Set the target frequency of equalization filter.
  756. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  757. @item tqfactor
  758. Set the target resonance factor for target equalization filter.
  759. Default value is 1. Allowed range is from 0.001 to 1000.
  760. @item attack
  761. Set the amount of milliseconds the signal from detection has to rise above
  762. the detection threshold before equalization starts.
  763. Default is 20. Allowed range is between 1 and 2000.
  764. @item release
  765. Set the amount of milliseconds the signal from detection has to fall below the
  766. detection threshold before equalization ends.
  767. Default is 200. Allowed range is between 1 and 2000.
  768. @item ratio
  769. Set the ratio by which the equalization gain is raised.
  770. Default is 1. Allowed range is between 0 and 30.
  771. @item makeup
  772. Set the makeup offset by which the equalization gain is raised.
  773. Default is 0. Allowed range is between 0 and 100.
  774. @item range
  775. Set the max allowed cut/boost amount. Default is 50.
  776. Allowed range is from 1 to 200.
  777. @item mode
  778. Set the mode of filter operation, can be one of the following:
  779. @table @samp
  780. @item listen
  781. Output only isolated bandpass signal.
  782. @item cut
  783. Cut frequencies above detection threshold.
  784. @item boost
  785. Boost frequencies bellow detection threshold.
  786. @end table
  787. Default mode is @samp{cut}.
  788. @item tftype
  789. Set the type of target filter, can be one of the following:
  790. @table @samp
  791. @item bell
  792. @item lowshelf
  793. @item highshelf
  794. @end table
  795. Default type is @samp{bell}.
  796. @item direction
  797. Set processing direction relative to threshold.
  798. @table @samp
  799. @item downward
  800. Boost or cut if threshhold is higher than detected volume.
  801. @item upward
  802. Boost or cut if threshhold is lower than detected volume.
  803. @end table
  804. Default direction is @samp{downward}.
  805. @end table
  806. @subsection Commands
  807. This filter supports the all above options as @ref{commands}.
  808. @section adynamicsmooth
  809. Apply dynamic smoothing to input audio stream.
  810. A description of the accepted options follows.
  811. @table @option
  812. @item sensitivity
  813. Set an amount of sensitivity to frequency fluctations. Default is 2.
  814. Allowed range is from 0 to 1e+06.
  815. @item basefreq
  816. Set a base frequency for smoothing. Default value is 22050.
  817. Allowed range is from 2 to 1e+06.
  818. @end table
  819. @subsection Commands
  820. This filter supports the all above options as @ref{commands}.
  821. @section aecho
  822. Apply echoing to the input audio.
  823. Echoes are reflected sound and can occur naturally amongst mountains
  824. (and sometimes large buildings) when talking or shouting; digital echo
  825. effects emulate this behaviour and are often used to help fill out the
  826. sound of a single instrument or vocal. The time difference between the
  827. original signal and the reflection is the @code{delay}, and the
  828. loudness of the reflected signal is the @code{decay}.
  829. Multiple echoes can have different delays and decays.
  830. A description of the accepted parameters follows.
  831. @table @option
  832. @item in_gain
  833. Set input gain of reflected signal. Default is @code{0.6}.
  834. @item out_gain
  835. Set output gain of reflected signal. Default is @code{0.3}.
  836. @item delays
  837. Set list of time intervals in milliseconds between original signal and reflections
  838. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  839. Default is @code{1000}.
  840. @item decays
  841. Set list of loudness of reflected signals separated by '|'.
  842. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  843. Default is @code{0.5}.
  844. @end table
  845. @subsection Examples
  846. @itemize
  847. @item
  848. Make it sound as if there are twice as many instruments as are actually playing:
  849. @example
  850. aecho=0.8:0.88:60:0.4
  851. @end example
  852. @item
  853. If delay is very short, then it sounds like a (metallic) robot playing music:
  854. @example
  855. aecho=0.8:0.88:6:0.4
  856. @end example
  857. @item
  858. A longer delay will sound like an open air concert in the mountains:
  859. @example
  860. aecho=0.8:0.9:1000:0.3
  861. @end example
  862. @item
  863. Same as above but with one more mountain:
  864. @example
  865. aecho=0.8:0.9:1000|1800:0.3|0.25
  866. @end example
  867. @end itemize
  868. @section aemphasis
  869. Audio emphasis filter creates or restores material directly taken from LPs or
  870. emphased CDs with different filter curves. E.g. to store music on vinyl the
  871. signal has to be altered by a filter first to even out the disadvantages of
  872. this recording medium.
  873. Once the material is played back the inverse filter has to be applied to
  874. restore the distortion of the frequency response.
  875. The filter accepts the following options:
  876. @table @option
  877. @item level_in
  878. Set input gain.
  879. @item level_out
  880. Set output gain.
  881. @item mode
  882. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  883. use @code{production} mode. Default is @code{reproduction} mode.
  884. @item type
  885. Set filter type. Selects medium. Can be one of the following:
  886. @table @option
  887. @item col
  888. select Columbia.
  889. @item emi
  890. select EMI.
  891. @item bsi
  892. select BSI (78RPM).
  893. @item riaa
  894. select RIAA.
  895. @item cd
  896. select Compact Disc (CD).
  897. @item 50fm
  898. select 50µs (FM).
  899. @item 75fm
  900. select 75µs (FM).
  901. @item 50kf
  902. select 50µs (FM-KF).
  903. @item 75kf
  904. select 75µs (FM-KF).
  905. @end table
  906. @end table
  907. @subsection Commands
  908. This filter supports the all above options as @ref{commands}.
  909. @section aeval
  910. Modify an audio signal according to the specified expressions.
  911. This filter accepts one or more expressions (one for each channel),
  912. which are evaluated and used to modify a corresponding audio signal.
  913. It accepts the following parameters:
  914. @table @option
  915. @item exprs
  916. Set the '|'-separated expressions list for each separate channel. If
  917. the number of input channels is greater than the number of
  918. expressions, the last specified expression is used for the remaining
  919. output channels.
  920. @item channel_layout, c
  921. Set output channel layout. If not specified, the channel layout is
  922. specified by the number of expressions. If set to @samp{same}, it will
  923. use by default the same input channel layout.
  924. @end table
  925. Each expression in @var{exprs} can contain the following constants and functions:
  926. @table @option
  927. @item ch
  928. channel number of the current expression
  929. @item n
  930. number of the evaluated sample, starting from 0
  931. @item s
  932. sample rate
  933. @item t
  934. time of the evaluated sample expressed in seconds
  935. @item nb_in_channels
  936. @item nb_out_channels
  937. input and output number of channels
  938. @item val(CH)
  939. the value of input channel with number @var{CH}
  940. @end table
  941. Note: this filter is slow. For faster processing you should use a
  942. dedicated filter.
  943. @subsection Examples
  944. @itemize
  945. @item
  946. Half volume:
  947. @example
  948. aeval=val(ch)/2:c=same
  949. @end example
  950. @item
  951. Invert phase of the second channel:
  952. @example
  953. aeval=val(0)|-val(1)
  954. @end example
  955. @end itemize
  956. @section aexciter
  957. An exciter is used to produce high sound that is not present in the
  958. original signal. This is done by creating harmonic distortions of the
  959. signal which are restricted in range and added to the original signal.
  960. An Exciter raises the upper end of an audio signal without simply raising
  961. the higher frequencies like an equalizer would do to create a more
  962. "crisp" or "brilliant" sound.
  963. The filter accepts the following options:
  964. @table @option
  965. @item level_in
  966. Set input level prior processing of signal.
  967. Allowed range is from 0 to 64.
  968. Default value is 1.
  969. @item level_out
  970. Set output level after processing of signal.
  971. Allowed range is from 0 to 64.
  972. Default value is 1.
  973. @item amount
  974. Set the amount of harmonics added to original signal.
  975. Allowed range is from 0 to 64.
  976. Default value is 1.
  977. @item drive
  978. Set the amount of newly created harmonics.
  979. Allowed range is from 0.1 to 10.
  980. Default value is 8.5.
  981. @item blend
  982. Set the octave of newly created harmonics.
  983. Allowed range is from -10 to 10.
  984. Default value is 0.
  985. @item freq
  986. Set the lower frequency limit of producing harmonics in Hz.
  987. Allowed range is from 2000 to 12000 Hz.
  988. Default is 7500 Hz.
  989. @item ceil
  990. Set the upper frequency limit of producing harmonics.
  991. Allowed range is from 9999 to 20000 Hz.
  992. If value is lower than 10000 Hz no limit is applied.
  993. @item listen
  994. Mute the original signal and output only added harmonics.
  995. By default is disabled.
  996. @end table
  997. @subsection Commands
  998. This filter supports the all above options as @ref{commands}.
  999. @anchor{afade}
  1000. @section afade
  1001. Apply fade-in/out effect to input audio.
  1002. A description of the accepted parameters follows.
  1003. @table @option
  1004. @item type, t
  1005. Specify the effect type, can be either @code{in} for fade-in, or
  1006. @code{out} for a fade-out effect. Default is @code{in}.
  1007. @item start_sample, ss
  1008. Specify the number of the start sample for starting to apply the fade
  1009. effect. Default is 0.
  1010. @item nb_samples, ns
  1011. Specify the number of samples for which the fade effect has to last. At
  1012. the end of the fade-in effect the output audio will have the same
  1013. volume as the input audio, at the end of the fade-out transition
  1014. the output audio will be silence. Default is 44100.
  1015. @item start_time, st
  1016. Specify the start time of the fade effect. Default is 0.
  1017. The value must be specified as a time duration; see
  1018. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1019. for the accepted syntax.
  1020. If set this option is used instead of @var{start_sample}.
  1021. @item duration, d
  1022. Specify the duration of the fade effect. See
  1023. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1024. for the accepted syntax.
  1025. At the end of the fade-in effect the output audio will have the same
  1026. volume as the input audio, at the end of the fade-out transition
  1027. the output audio will be silence.
  1028. By default the duration is determined by @var{nb_samples}.
  1029. If set this option is used instead of @var{nb_samples}.
  1030. @item curve
  1031. Set curve for fade transition.
  1032. It accepts the following values:
  1033. @table @option
  1034. @item tri
  1035. select triangular, linear slope (default)
  1036. @item qsin
  1037. select quarter of sine wave
  1038. @item hsin
  1039. select half of sine wave
  1040. @item esin
  1041. select exponential sine wave
  1042. @item log
  1043. select logarithmic
  1044. @item ipar
  1045. select inverted parabola
  1046. @item qua
  1047. select quadratic
  1048. @item cub
  1049. select cubic
  1050. @item squ
  1051. select square root
  1052. @item cbr
  1053. select cubic root
  1054. @item par
  1055. select parabola
  1056. @item exp
  1057. select exponential
  1058. @item iqsin
  1059. select inverted quarter of sine wave
  1060. @item ihsin
  1061. select inverted half of sine wave
  1062. @item dese
  1063. select double-exponential seat
  1064. @item desi
  1065. select double-exponential sigmoid
  1066. @item losi
  1067. select logistic sigmoid
  1068. @item sinc
  1069. select sine cardinal function
  1070. @item isinc
  1071. select inverted sine cardinal function
  1072. @item nofade
  1073. no fade applied
  1074. @end table
  1075. @item silence
  1076. Set the initial gain for fade-in or final gain for fade-out.
  1077. Default value is @code{0.0}.
  1078. @item unity
  1079. Set the initial gain for fade-out or final gain for fade-in.
  1080. Default value is @code{1.0}.
  1081. @end table
  1082. @subsection Commands
  1083. This filter supports the all above options as @ref{commands}.
  1084. @subsection Examples
  1085. @itemize
  1086. @item
  1087. Fade in first 15 seconds of audio:
  1088. @example
  1089. afade=t=in:ss=0:d=15
  1090. @end example
  1091. @item
  1092. Fade out last 25 seconds of a 900 seconds audio:
  1093. @example
  1094. afade=t=out:st=875:d=25
  1095. @end example
  1096. @end itemize
  1097. @section afftdn
  1098. Denoise audio samples with FFT.
  1099. A description of the accepted parameters follows.
  1100. @table @option
  1101. @item noise_reduction, nr
  1102. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1103. Default value is 12 dB.
  1104. @item noise_floor, nf
  1105. Set the noise floor in dB, allowed range is -80 to -20.
  1106. Default value is -50 dB.
  1107. @item noise_type, nt
  1108. Set the noise type.
  1109. It accepts the following values:
  1110. @table @option
  1111. @item white, w
  1112. Select white noise.
  1113. @item vinyl, v
  1114. Select vinyl noise.
  1115. @item shellac, s
  1116. Select shellac noise.
  1117. @item custom, c
  1118. Select custom noise, defined in @code{bn} option.
  1119. Default value is white noise.
  1120. @end table
  1121. @item band_noise, bn
  1122. Set custom band noise profile for every one of 15 bands.
  1123. Bands are separated by ' ' or '|'.
  1124. @item residual_floor, rf
  1125. Set the residual floor in dB, allowed range is -80 to -20.
  1126. Default value is -38 dB.
  1127. @item track_noise, tn
  1128. Enable noise floor tracking. By default is disabled.
  1129. With this enabled, noise floor is automatically adjusted.
  1130. @item track_residual, tr
  1131. Enable residual tracking. By default is disabled.
  1132. @item output_mode, om
  1133. Set the output mode.
  1134. It accepts the following values:
  1135. @table @option
  1136. @item input, i
  1137. Pass input unchanged.
  1138. @item output, o
  1139. Pass noise filtered out.
  1140. @item noise, n
  1141. Pass only noise.
  1142. Default value is @var{output}.
  1143. @end table
  1144. @item adaptivity, ad
  1145. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1146. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1147. react much slower.
  1148. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1149. @item floor_offset, fo
  1150. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1151. noise floor. It is only effective when noise floor tracking is enabled.
  1152. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1153. @item noise_link, nl
  1154. Set the noise link used for multichannel audio.
  1155. It accepts the following values:
  1156. @table @option
  1157. @item none
  1158. Use unchanged channel's noise floor.
  1159. @item min
  1160. Use measured min noise floor of all channels.
  1161. @item max
  1162. Use measured max noise floor of all channels.
  1163. @item average
  1164. Use measured average noise floor of all channels.
  1165. Default value is @var{min}.
  1166. @end table
  1167. @item band_multiplier, bm
  1168. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1169. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1170. @item sample_noise, sn
  1171. Toggle capturing and measurement of noise profile from input audio.
  1172. It accepts the following values:
  1173. @table @option
  1174. @item start, begin
  1175. Start sample noise capture.
  1176. @item stop, end
  1177. Stop sample noise capture and measure new noise band profile.
  1178. Default value is @code{none}.
  1179. @end table
  1180. @item gain_smooth, gs
  1181. Set gain smooth spatial radius, used to smooth gains applied to each frequency bin.
  1182. Useful to reduce random music noise artefacts.
  1183. Higher values increases smoothing of gains.
  1184. Allowed range is from @code{0} to @code{50}.
  1185. Default value is @code{0}.
  1186. @end table
  1187. @subsection Commands
  1188. This filter supports the some above mentioned options as @ref{commands}.
  1189. @subsection Examples
  1190. @itemize
  1191. @item
  1192. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1193. @example
  1194. afftdn=nr=10:nf=-40
  1195. @end example
  1196. @item
  1197. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1198. tracking of noise floor so noise floor will gradually change during processing:
  1199. @example
  1200. afftdn=nr=10:nf=-80:tn=1
  1201. @end example
  1202. @item
  1203. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1204. of first 0.4 seconds of input audio:
  1205. @example
  1206. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1207. @end example
  1208. @end itemize
  1209. @section afftfilt
  1210. Apply arbitrary expressions to samples in frequency domain.
  1211. @table @option
  1212. @item real
  1213. Set frequency domain real expression for each separate channel separated
  1214. by '|'. Default is "re".
  1215. If the number of input channels is greater than the number of
  1216. expressions, the last specified expression is used for the remaining
  1217. output channels.
  1218. @item imag
  1219. Set frequency domain imaginary expression for each separate channel
  1220. separated by '|'. Default is "im".
  1221. Each expression in @var{real} and @var{imag} can contain the following
  1222. constants and functions:
  1223. @table @option
  1224. @item sr
  1225. sample rate
  1226. @item b
  1227. current frequency bin number
  1228. @item nb
  1229. number of available bins
  1230. @item ch
  1231. channel number of the current expression
  1232. @item chs
  1233. number of channels
  1234. @item pts
  1235. current frame pts
  1236. @item re
  1237. current real part of frequency bin of current channel
  1238. @item im
  1239. current imaginary part of frequency bin of current channel
  1240. @item real(b, ch)
  1241. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1242. @item imag(b, ch)
  1243. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1244. @end table
  1245. @item win_size
  1246. Set window size. Allowed range is from 16 to 131072.
  1247. Default is @code{4096}
  1248. @item win_func
  1249. Set window function.
  1250. It accepts the following values:
  1251. @table @samp
  1252. @item rect
  1253. @item bartlett
  1254. @item hann, hanning
  1255. @item hamming
  1256. @item blackman
  1257. @item welch
  1258. @item flattop
  1259. @item bharris
  1260. @item bnuttall
  1261. @item bhann
  1262. @item sine
  1263. @item nuttall
  1264. @item lanczos
  1265. @item gauss
  1266. @item tukey
  1267. @item dolph
  1268. @item cauchy
  1269. @item parzen
  1270. @item poisson
  1271. @item bohman
  1272. @item kaiser
  1273. @end table
  1274. Default is @code{hann}.
  1275. @item overlap
  1276. Set window overlap. If set to 1, the recommended overlap for selected
  1277. window function will be picked. Default is @code{0.75}.
  1278. @end table
  1279. @subsection Examples
  1280. @itemize
  1281. @item
  1282. Leave almost only low frequencies in audio:
  1283. @example
  1284. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1285. @end example
  1286. @item
  1287. Apply robotize effect:
  1288. @example
  1289. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1290. @end example
  1291. @item
  1292. Apply whisper effect:
  1293. @example
  1294. 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"
  1295. @end example
  1296. @item
  1297. Apply phase shift:
  1298. @example
  1299. afftfilt="real=re*cos(1)-im*sin(1):imag=re*sin(1)+im*cos(1)"
  1300. @end example
  1301. @end itemize
  1302. @anchor{afir}
  1303. @section afir
  1304. Apply an arbitrary Finite Impulse Response filter.
  1305. This filter is designed for applying long FIR filters,
  1306. up to 60 seconds long.
  1307. It can be used as component for digital crossover filters,
  1308. room equalization, cross talk cancellation, wavefield synthesis,
  1309. auralization, ambiophonics, ambisonics and spatialization.
  1310. This filter uses the streams higher than first one as FIR coefficients.
  1311. If the non-first stream holds a single channel, it will be used
  1312. for all input channels in the first stream, otherwise
  1313. the number of channels in the non-first stream must be same as
  1314. the number of channels in the first stream.
  1315. It accepts the following parameters:
  1316. @table @option
  1317. @item dry
  1318. Set dry gain. This sets input gain.
  1319. @item wet
  1320. Set wet gain. This sets final output gain.
  1321. @item length
  1322. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1323. @item gtype
  1324. Enable applying gain measured from power of IR.
  1325. Set which approach to use for auto gain measurement.
  1326. @table @option
  1327. @item none
  1328. Do not apply any gain.
  1329. @item peak
  1330. select peak gain, very conservative approach. This is default value.
  1331. @item dc
  1332. select DC gain, limited application.
  1333. @item gn
  1334. select gain to noise approach, this is most popular one.
  1335. @item ac
  1336. select AC gain.
  1337. @item rms
  1338. select RMS gain.
  1339. @end table
  1340. @item irgain
  1341. Set gain to be applied to IR coefficients before filtering.
  1342. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1343. @item irfmt
  1344. Set format of IR stream. Can be @code{mono} or @code{input}.
  1345. Default is @code{input}.
  1346. @item maxir
  1347. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1348. Allowed range is 0.1 to 60 seconds.
  1349. @item response
  1350. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1351. By default it is disabled.
  1352. @item channel
  1353. Set for which IR channel to display frequency response. By default is first channel
  1354. displayed. This option is used only when @var{response} is enabled.
  1355. @item size
  1356. Set video stream size. This option is used only when @var{response} is enabled.
  1357. @item rate
  1358. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1359. @item minp
  1360. Set minimal partition size used for convolution. Default is @var{8192}.
  1361. Allowed range is from @var{1} to @var{65536}.
  1362. Lower values decreases latency at cost of higher CPU usage.
  1363. @item maxp
  1364. Set maximal partition size used for convolution. Default is @var{8192}.
  1365. Allowed range is from @var{8} to @var{65536}.
  1366. Lower values may increase CPU usage.
  1367. @item nbirs
  1368. Set number of input impulse responses streams which will be switchable at runtime.
  1369. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1370. @item ir
  1371. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1372. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1373. This option can be changed at runtime via @ref{commands}.
  1374. @item precision
  1375. Set which precision to use when processing samples.
  1376. @table @option
  1377. @item auto
  1378. Auto pick internal sample format depending on other filters.
  1379. @item float
  1380. Always use single-floating point precision sample format.
  1381. @item double
  1382. Always use double-floating point precision sample format.
  1383. @end table
  1384. Default value is auto.
  1385. @end table
  1386. @subsection Examples
  1387. @itemize
  1388. @item
  1389. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1390. @example
  1391. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1392. @end example
  1393. @item
  1394. Apply true stereo processing given input stereo stream, and two stereo impulse responses for left and right channel,
  1395. the impulse response files are files with names l_ir.wav and r_ir.wav:
  1396. @example
  1397. "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:gtype=gn:irgain=-5dB,pan=stereo|FL<c0+c2|FR<c1+c3"
  1398. @end example
  1399. @end itemize
  1400. @anchor{aformat}
  1401. @section aformat
  1402. Set output format constraints for the input audio. The framework will
  1403. negotiate the most appropriate format to minimize conversions.
  1404. It accepts the following parameters:
  1405. @table @option
  1406. @item sample_fmts, f
  1407. A '|'-separated list of requested sample formats.
  1408. @item sample_rates, r
  1409. A '|'-separated list of requested sample rates.
  1410. @item channel_layouts, cl
  1411. A '|'-separated list of requested channel layouts.
  1412. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1413. for the required syntax.
  1414. @end table
  1415. If a parameter is omitted, all values are allowed.
  1416. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1417. @example
  1418. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1419. @end example
  1420. @section afreqshift
  1421. Apply frequency shift to input audio samples.
  1422. The filter accepts the following options:
  1423. @table @option
  1424. @item shift
  1425. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1426. Default value is 0.0.
  1427. @item level
  1428. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1429. Default value is 1.0.
  1430. @item order
  1431. Set filter order used for filtering. Allowed range is from 1 to 16.
  1432. Default value is 8.
  1433. @end table
  1434. @subsection Commands
  1435. This filter supports the all above options as @ref{commands}.
  1436. @section afwtdn
  1437. Reduce broadband noise from input samples using Wavelets.
  1438. A description of the accepted options follows.
  1439. @table @option
  1440. @item sigma
  1441. Set the noise sigma, allowed range is from 0 to 1.
  1442. Default value is 0.
  1443. This option controls strength of denoising applied to input samples.
  1444. Most useful way to set this option is via decibels, eg. -45dB.
  1445. @item levels
  1446. Set the number of wavelet levels of decomposition.
  1447. Allowed range is from 1 to 12.
  1448. Default value is 10.
  1449. Setting this too low make denoising performance very poor.
  1450. @item wavet
  1451. Set wavelet type for decomposition of input frame.
  1452. They are sorted by number of coefficients, from lowest to highest.
  1453. More coefficients means worse filtering speed, but overall better quality.
  1454. Available wavelets are:
  1455. @table @samp
  1456. @item sym2
  1457. @item sym4
  1458. @item rbior68
  1459. @item deb10
  1460. @item sym10
  1461. @item coif5
  1462. @item bl3
  1463. @end table
  1464. @item percent
  1465. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1466. Default value is 85 percent or partial denoising.
  1467. @item profile
  1468. If enabled, first input frame will be used as noise profile.
  1469. If first frame samples contain non-noise performance will be very poor.
  1470. @item adaptive
  1471. If enabled, input frames are analyzed for presence of noise.
  1472. If noise is detected with high possibility then input frame profile will be
  1473. used for processing following frames, until new noise frame is detected.
  1474. @item samples
  1475. Set size of single frame in number of samples. Allowed range is from 512 to
  1476. 65536. Default frame size is 8192 samples.
  1477. @item softness
  1478. Set softness applied inside thresholding function. Allowed range is from 0 to
  1479. 10. Default softness is 1.
  1480. @end table
  1481. @subsection Commands
  1482. This filter supports the all above options as @ref{commands}.
  1483. @section agate
  1484. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1485. processing reduces disturbing noise between useful signals.
  1486. Gating is done by detecting the volume below a chosen level @var{threshold}
  1487. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1488. floor is set via @var{range}. Because an exact manipulation of the signal
  1489. would cause distortion of the waveform the reduction can be levelled over
  1490. time. This is done by setting @var{attack} and @var{release}.
  1491. @var{attack} determines how long the signal has to fall below the threshold
  1492. before any reduction will occur and @var{release} sets the time the signal
  1493. has to rise above the threshold to reduce the reduction again.
  1494. Shorter signals than the chosen attack time will be left untouched.
  1495. @table @option
  1496. @item level_in
  1497. Set input level before filtering.
  1498. Default is 1. Allowed range is from 0.015625 to 64.
  1499. @item mode
  1500. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1501. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1502. will be amplified, expanding dynamic range in upward direction.
  1503. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1504. @item range
  1505. Set the level of gain reduction when the signal is below the threshold.
  1506. Default is 0.06125. Allowed range is from 0 to 1.
  1507. Setting this to 0 disables reduction and then filter behaves like expander.
  1508. @item threshold
  1509. If a signal rises above this level the gain reduction is released.
  1510. Default is 0.125. Allowed range is from 0 to 1.
  1511. @item ratio
  1512. Set a ratio by which the signal is reduced.
  1513. Default is 2. Allowed range is from 1 to 9000.
  1514. @item attack
  1515. Amount of milliseconds the signal has to rise above the threshold before gain
  1516. reduction stops.
  1517. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1518. @item release
  1519. Amount of milliseconds the signal has to fall below the threshold before the
  1520. reduction is increased again. Default is 250 milliseconds.
  1521. Allowed range is from 0.01 to 9000.
  1522. @item makeup
  1523. Set amount of amplification of signal after processing.
  1524. Default is 1. Allowed range is from 1 to 64.
  1525. @item knee
  1526. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1527. Default is 2.828427125. Allowed range is from 1 to 8.
  1528. @item detection
  1529. Choose if exact signal should be taken for detection or an RMS like one.
  1530. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1531. @item link
  1532. Choose if the average level between all channels or the louder channel affects
  1533. the reduction.
  1534. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1535. @end table
  1536. @subsection Commands
  1537. This filter supports the all above options as @ref{commands}.
  1538. @section aiir
  1539. Apply an arbitrary Infinite Impulse Response filter.
  1540. It accepts the following parameters:
  1541. @table @option
  1542. @item zeros, z
  1543. Set B/numerator/zeros/reflection coefficients.
  1544. @item poles, p
  1545. Set A/denominator/poles/ladder coefficients.
  1546. @item gains, k
  1547. Set channels gains.
  1548. @item dry_gain
  1549. Set input gain.
  1550. @item wet_gain
  1551. Set output gain.
  1552. @item format, f
  1553. Set coefficients format.
  1554. @table @samp
  1555. @item ll
  1556. lattice-ladder function
  1557. @item sf
  1558. analog transfer function
  1559. @item tf
  1560. digital transfer function
  1561. @item zp
  1562. Z-plane zeros/poles, cartesian (default)
  1563. @item pr
  1564. Z-plane zeros/poles, polar radians
  1565. @item pd
  1566. Z-plane zeros/poles, polar degrees
  1567. @item sp
  1568. S-plane zeros/poles
  1569. @end table
  1570. @item process, r
  1571. Set type of processing.
  1572. @table @samp
  1573. @item d
  1574. direct processing
  1575. @item s
  1576. serial processing
  1577. @item p
  1578. parallel processing
  1579. @end table
  1580. @item precision, e
  1581. Set filtering precision.
  1582. @table @samp
  1583. @item dbl
  1584. double-precision floating-point (default)
  1585. @item flt
  1586. single-precision floating-point
  1587. @item i32
  1588. 32-bit integers
  1589. @item i16
  1590. 16-bit integers
  1591. @end table
  1592. @item normalize, n
  1593. Normalize filter coefficients, by default is enabled.
  1594. Enabling it will normalize magnitude response at DC to 0dB.
  1595. @item mix
  1596. How much to use filtered signal in output. Default is 1.
  1597. Range is between 0 and 1.
  1598. @item response
  1599. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1600. By default it is disabled.
  1601. @item channel
  1602. Set for which IR channel to display frequency response. By default is first channel
  1603. displayed. This option is used only when @var{response} is enabled.
  1604. @item size
  1605. Set video stream size. This option is used only when @var{response} is enabled.
  1606. @end table
  1607. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1608. order.
  1609. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1610. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1611. imaginary unit.
  1612. Different coefficients and gains can be provided for every channel, in such case
  1613. use '|' to separate coefficients or gains. Last provided coefficients will be
  1614. used for all remaining channels.
  1615. @subsection Examples
  1616. @itemize
  1617. @item
  1618. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1619. @example
  1620. 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
  1621. @end example
  1622. @item
  1623. Same as above but in @code{zp} format:
  1624. @example
  1625. 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
  1626. @end example
  1627. @item
  1628. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1629. @example
  1630. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1631. @end example
  1632. @end itemize
  1633. @section alimiter
  1634. The limiter prevents an input signal from rising over a desired threshold.
  1635. This limiter uses lookahead technology to prevent your signal from distorting.
  1636. It means that there is a small delay after the signal is processed. Keep in mind
  1637. that the delay it produces is the attack time you set.
  1638. The filter accepts the following options:
  1639. @table @option
  1640. @item level_in
  1641. Set input gain. Default is 1.
  1642. @item level_out
  1643. Set output gain. Default is 1.
  1644. @item limit
  1645. Don't let signals above this level pass the limiter. Default is 1.
  1646. @item attack
  1647. The limiter will reach its attenuation level in this amount of time in
  1648. milliseconds. Default is 5 milliseconds.
  1649. @item release
  1650. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1651. Default is 50 milliseconds.
  1652. @item asc
  1653. When gain reduction is always needed ASC takes care of releasing to an
  1654. average reduction level rather than reaching a reduction of 0 in the release
  1655. time.
  1656. @item asc_level
  1657. Select how much the release time is affected by ASC, 0 means nearly no changes
  1658. in release time while 1 produces higher release times.
  1659. @item level
  1660. Auto level output signal. Default is enabled.
  1661. This normalizes audio back to 0dB if enabled.
  1662. @item latency
  1663. Compensate the delay introduced by using the lookahead buffer set with attack
  1664. parameter. Also flush the valid audio data in the lookahead buffer when the
  1665. stream hits EOF.
  1666. @end table
  1667. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1668. with @ref{aresample} before applying this filter.
  1669. @section allpass
  1670. Apply a two-pole all-pass filter with central frequency (in Hz)
  1671. @var{frequency}, and filter-width @var{width}.
  1672. An all-pass filter changes the audio's frequency to phase relationship
  1673. without changing its frequency to amplitude relationship.
  1674. The filter accepts the following options:
  1675. @table @option
  1676. @item frequency, f
  1677. Set frequency in Hz.
  1678. @item width_type, t
  1679. Set method to specify band-width of filter.
  1680. @table @option
  1681. @item h
  1682. Hz
  1683. @item q
  1684. Q-Factor
  1685. @item o
  1686. octave
  1687. @item s
  1688. slope
  1689. @item k
  1690. kHz
  1691. @end table
  1692. @item width, w
  1693. Specify the band-width of a filter in width_type units.
  1694. @item mix, m
  1695. How much to use filtered signal in output. Default is 1.
  1696. Range is between 0 and 1.
  1697. @item channels, c
  1698. Specify which channels to filter, by default all available are filtered.
  1699. @item normalize, n
  1700. Normalize biquad coefficients, by default is disabled.
  1701. Enabling it will normalize magnitude response at DC to 0dB.
  1702. @item order, o
  1703. Set the filter order, can be 1 or 2. Default is 2.
  1704. @item transform, a
  1705. Set transform type of IIR filter.
  1706. @table @option
  1707. @item di
  1708. @item dii
  1709. @item tdi
  1710. @item tdii
  1711. @item latt
  1712. @item svf
  1713. @item zdf
  1714. @end table
  1715. @item precision, r
  1716. Set precison of filtering.
  1717. @table @option
  1718. @item auto
  1719. Pick automatic sample format depending on surround filters.
  1720. @item s16
  1721. Always use signed 16-bit.
  1722. @item s32
  1723. Always use signed 32-bit.
  1724. @item f32
  1725. Always use float 32-bit.
  1726. @item f64
  1727. Always use float 64-bit.
  1728. @end table
  1729. @end table
  1730. @subsection Commands
  1731. This filter supports the following commands:
  1732. @table @option
  1733. @item frequency, f
  1734. Change allpass frequency.
  1735. Syntax for the command is : "@var{frequency}"
  1736. @item width_type, t
  1737. Change allpass width_type.
  1738. Syntax for the command is : "@var{width_type}"
  1739. @item width, w
  1740. Change allpass width.
  1741. Syntax for the command is : "@var{width}"
  1742. @item mix, m
  1743. Change allpass mix.
  1744. Syntax for the command is : "@var{mix}"
  1745. @end table
  1746. @section aloop
  1747. Loop audio samples.
  1748. The filter accepts the following options:
  1749. @table @option
  1750. @item loop
  1751. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1752. Default is 0.
  1753. @item size
  1754. Set maximal number of samples. Default is 0.
  1755. @item start
  1756. Set first sample of loop. Default is 0.
  1757. @end table
  1758. @anchor{amerge}
  1759. @section amerge
  1760. Merge two or more audio streams into a single multi-channel stream.
  1761. The filter accepts the following options:
  1762. @table @option
  1763. @item inputs
  1764. Set the number of inputs. Default is 2.
  1765. @end table
  1766. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1767. the channel layout of the output will be set accordingly and the channels
  1768. will be reordered as necessary. If the channel layouts of the inputs are not
  1769. disjoint, the output will have all the channels of the first input then all
  1770. the channels of the second input, in that order, and the channel layout of
  1771. the output will be the default value corresponding to the total number of
  1772. channels.
  1773. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1774. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1775. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1776. first input, b1 is the first channel of the second input).
  1777. On the other hand, if both input are in stereo, the output channels will be
  1778. in the default order: a1, a2, b1, b2, and the channel layout will be
  1779. arbitrarily set to 4.0, which may or may not be the expected value.
  1780. All inputs must have the same sample rate, and format.
  1781. If inputs do not have the same duration, the output will stop with the
  1782. shortest.
  1783. @subsection Examples
  1784. @itemize
  1785. @item
  1786. Merge two mono files into a stereo stream:
  1787. @example
  1788. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1789. @end example
  1790. @item
  1791. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1792. @example
  1793. 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
  1794. @end example
  1795. @end itemize
  1796. @section amix
  1797. Mixes multiple audio inputs into a single output.
  1798. Note that this filter only supports float samples (the @var{amerge}
  1799. and @var{pan} audio filters support many formats). If the @var{amix}
  1800. input has integer samples then @ref{aresample} will be automatically
  1801. inserted to perform the conversion to float samples.
  1802. It accepts the following parameters:
  1803. @table @option
  1804. @item inputs
  1805. The number of inputs. If unspecified, it defaults to 2.
  1806. @item duration
  1807. How to determine the end-of-stream.
  1808. @table @option
  1809. @item longest
  1810. The duration of the longest input. (default)
  1811. @item shortest
  1812. The duration of the shortest input.
  1813. @item first
  1814. The duration of the first input.
  1815. @end table
  1816. @item dropout_transition
  1817. The transition time, in seconds, for volume renormalization when an input
  1818. stream ends. The default value is 2 seconds.
  1819. @item weights
  1820. Specify weight of each input audio stream as a sequence of numbers separated
  1821. by a space. If fewer weights are specified compared to number of inputs, the
  1822. last weight is assigned to the remaining inputs.
  1823. Default weight for each input is 1.
  1824. @item normalize
  1825. Always scale inputs instead of only doing summation of samples.
  1826. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1827. by this filter if this option is disabled. By default is enabled.
  1828. @end table
  1829. @subsection Examples
  1830. @itemize
  1831. @item
  1832. This will mix 3 input audio streams to a single output with the same duration as the
  1833. first input and a dropout transition time of 3 seconds:
  1834. @example
  1835. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1836. @end example
  1837. @item
  1838. This will mix one vocal and one music input audio stream to a single output with the same duration as the
  1839. longest input. The music will have quarter the weight as the vocals, and the inputs are not normalized:
  1840. @example
  1841. ffmpeg -i VOCALS -i MUSIC -filter_complex amix=inputs=2:duration=longest:dropout_transition=0:weights="1 0.25":normalize=0 OUTPUT
  1842. @end example
  1843. @end itemize
  1844. @subsection Commands
  1845. This filter supports the following commands:
  1846. @table @option
  1847. @item weights
  1848. @item normalize
  1849. Syntax is same as option with same name.
  1850. @end table
  1851. @section amultiply
  1852. Multiply first audio stream with second audio stream and store result
  1853. in output audio stream. Multiplication is done by multiplying each
  1854. sample from first stream with sample at same position from second stream.
  1855. With this element-wise multiplication one can create amplitude fades and
  1856. amplitude modulations.
  1857. @section anequalizer
  1858. High-order parametric multiband equalizer for each channel.
  1859. It accepts the following parameters:
  1860. @table @option
  1861. @item params
  1862. This option string is in format:
  1863. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1864. Each equalizer band is separated by '|'.
  1865. @table @option
  1866. @item chn
  1867. Set channel number to which equalization will be applied.
  1868. If input doesn't have that channel the entry is ignored.
  1869. @item f
  1870. Set central frequency for band.
  1871. If input doesn't have that frequency the entry is ignored.
  1872. @item w
  1873. Set band width in Hertz.
  1874. @item g
  1875. Set band gain in dB.
  1876. @item t
  1877. Set filter type for band, optional, can be:
  1878. @table @samp
  1879. @item 0
  1880. Butterworth, this is default.
  1881. @item 1
  1882. Chebyshev type 1.
  1883. @item 2
  1884. Chebyshev type 2.
  1885. @end table
  1886. @end table
  1887. @item curves
  1888. With this option activated frequency response of anequalizer is displayed
  1889. in video stream.
  1890. @item size
  1891. Set video stream size. Only useful if curves option is activated.
  1892. @item mgain
  1893. Set max gain that will be displayed. Only useful if curves option is activated.
  1894. Setting this to a reasonable value makes it possible to display gain which is derived from
  1895. neighbour bands which are too close to each other and thus produce higher gain
  1896. when both are activated.
  1897. @item fscale
  1898. Set frequency scale used to draw frequency response in video output.
  1899. Can be linear or logarithmic. Default is logarithmic.
  1900. @item colors
  1901. Set color for each channel curve which is going to be displayed in video stream.
  1902. This is list of color names separated by space or by '|'.
  1903. Unrecognised or missing colors will be replaced by white color.
  1904. @end table
  1905. @subsection Examples
  1906. @itemize
  1907. @item
  1908. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1909. for first 2 channels using Chebyshev type 1 filter:
  1910. @example
  1911. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1912. @end example
  1913. @end itemize
  1914. @subsection Commands
  1915. This filter supports the following commands:
  1916. @table @option
  1917. @item change
  1918. Alter existing filter parameters.
  1919. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1920. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1921. error is returned.
  1922. @var{freq} set new frequency parameter.
  1923. @var{width} set new width parameter in Hertz.
  1924. @var{gain} set new gain parameter in dB.
  1925. Full filter invocation with asendcmd may look like this:
  1926. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1927. @end table
  1928. @section anlmdn
  1929. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1930. Each sample is adjusted by looking for other samples with similar contexts. This
  1931. context similarity is defined by comparing their surrounding patches of size
  1932. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1933. The filter accepts the following options:
  1934. @table @option
  1935. @item strength, s
  1936. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  1937. @item patch, p
  1938. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1939. Default value is 2 milliseconds.
  1940. @item research, r
  1941. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1942. Default value is 6 milliseconds.
  1943. @item output, o
  1944. Set the output mode.
  1945. It accepts the following values:
  1946. @table @option
  1947. @item i
  1948. Pass input unchanged.
  1949. @item o
  1950. Pass noise filtered out.
  1951. @item n
  1952. Pass only noise.
  1953. Default value is @var{o}.
  1954. @end table
  1955. @item smooth, m
  1956. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  1957. @end table
  1958. @subsection Commands
  1959. This filter supports the all above options as @ref{commands}.
  1960. @section anlmf, anlms
  1961. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  1962. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1963. relate to producing the least mean square of the error signal (difference between the desired,
  1964. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1965. A description of the accepted options follows.
  1966. @table @option
  1967. @item order
  1968. Set filter order.
  1969. @item mu
  1970. Set filter mu.
  1971. @item eps
  1972. Set the filter eps.
  1973. @item leakage
  1974. Set the filter leakage.
  1975. @item out_mode
  1976. It accepts the following values:
  1977. @table @option
  1978. @item i
  1979. Pass the 1st input.
  1980. @item d
  1981. Pass the 2nd input.
  1982. @item o
  1983. Pass filtered samples.
  1984. @item n
  1985. Pass difference between desired and filtered samples.
  1986. Default value is @var{o}.
  1987. @end table
  1988. @end table
  1989. @subsection Examples
  1990. @itemize
  1991. @item
  1992. One of many usages of this filter is noise reduction, input audio is filtered
  1993. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1994. @example
  1995. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1996. @end example
  1997. @end itemize
  1998. @subsection Commands
  1999. This filter supports the same commands as options, excluding option @code{order}.
  2000. @section anull
  2001. Pass the audio source unchanged to the output.
  2002. @section apad
  2003. Pad the end of an audio stream with silence.
  2004. This can be used together with @command{ffmpeg} @option{-shortest} to
  2005. extend audio streams to the same length as the video stream.
  2006. A description of the accepted options follows.
  2007. @table @option
  2008. @item packet_size
  2009. Set silence packet size. Default value is 4096.
  2010. @item pad_len
  2011. Set the number of samples of silence to add to the end. After the
  2012. value is reached, the stream is terminated. This option is mutually
  2013. exclusive with @option{whole_len}.
  2014. @item whole_len
  2015. Set the minimum total number of samples in the output audio stream. If
  2016. the value is longer than the input audio length, silence is added to
  2017. the end, until the value is reached. This option is mutually exclusive
  2018. with @option{pad_len}.
  2019. @item pad_dur
  2020. Specify the duration of samples of silence to add. See
  2021. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2022. for the accepted syntax. Used only if set to non-negative value.
  2023. @item whole_dur
  2024. Specify the minimum total duration in the output audio stream. See
  2025. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2026. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  2027. the input audio length, silence is added to the end, until the value is reached.
  2028. This option is mutually exclusive with @option{pad_dur}
  2029. @end table
  2030. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  2031. nor @option{whole_dur} option is set, the filter will add silence to the end of
  2032. the input stream indefinitely.
  2033. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  2034. @option{whole_dur} also caused the filter to add silence indefinitely.
  2035. @subsection Examples
  2036. @itemize
  2037. @item
  2038. Add 1024 samples of silence to the end of the input:
  2039. @example
  2040. apad=pad_len=1024
  2041. @end example
  2042. @item
  2043. Make sure the audio output will contain at least 10000 samples, pad
  2044. the input with silence if required:
  2045. @example
  2046. apad=whole_len=10000
  2047. @end example
  2048. @item
  2049. Use @command{ffmpeg} to pad the audio input with silence, so that the
  2050. video stream will always result the shortest and will be converted
  2051. until the end in the output file when using the @option{shortest}
  2052. option:
  2053. @example
  2054. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  2055. @end example
  2056. @end itemize
  2057. @section aphaser
  2058. Add a phasing effect to the input audio.
  2059. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  2060. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  2061. A description of the accepted parameters follows.
  2062. @table @option
  2063. @item in_gain
  2064. Set input gain. Default is 0.4.
  2065. @item out_gain
  2066. Set output gain. Default is 0.74
  2067. @item delay
  2068. Set delay in milliseconds. Default is 3.0.
  2069. @item decay
  2070. Set decay. Default is 0.4.
  2071. @item speed
  2072. Set modulation speed in Hz. Default is 0.5.
  2073. @item type
  2074. Set modulation type. Default is triangular.
  2075. It accepts the following values:
  2076. @table @samp
  2077. @item triangular, t
  2078. @item sinusoidal, s
  2079. @end table
  2080. @end table
  2081. @section aphaseshift
  2082. Apply phase shift to input audio samples.
  2083. The filter accepts the following options:
  2084. @table @option
  2085. @item shift
  2086. Specify phase shift. Allowed range is from -1.0 to 1.0.
  2087. Default value is 0.0.
  2088. @item level
  2089. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  2090. Default value is 1.0.
  2091. @item order
  2092. Set filter order used for filtering. Allowed range is from 1 to 16.
  2093. Default value is 8.
  2094. @end table
  2095. @subsection Commands
  2096. This filter supports the all above options as @ref{commands}.
  2097. @section apsyclip
  2098. Apply Psychoacoustic clipper to input audio stream.
  2099. The filter accepts the following options:
  2100. @table @option
  2101. @item level_in
  2102. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2103. @item level_out
  2104. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2105. @item clip
  2106. Set the clipping start value. Default value is 0dBFS or 1.
  2107. @item diff
  2108. Output only difference samples, useful to hear introduced distortions.
  2109. By default is disabled.
  2110. @item adaptive
  2111. Set strength of adaptive distortion applied. Default value is 0.5.
  2112. Allowed range is from 0 to 1.
  2113. @item iterations
  2114. Set number of iterations of psychoacoustic clipper.
  2115. Allowed range is from 1 to 20. Default value is 10.
  2116. @item level
  2117. Auto level output signal. Default is disabled.
  2118. This normalizes audio back to 0dBFS if enabled.
  2119. @end table
  2120. @subsection Commands
  2121. This filter supports the all above options as @ref{commands}.
  2122. @section apulsator
  2123. Audio pulsator is something between an autopanner and a tremolo.
  2124. But it can produce funny stereo effects as well. Pulsator changes the volume
  2125. of the left and right channel based on a LFO (low frequency oscillator) with
  2126. different waveforms and shifted phases.
  2127. This filter have the ability to define an offset between left and right
  2128. channel. An offset of 0 means that both LFO shapes match each other.
  2129. The left and right channel are altered equally - a conventional tremolo.
  2130. An offset of 50% means that the shape of the right channel is exactly shifted
  2131. in phase (or moved backwards about half of the frequency) - pulsator acts as
  2132. an autopanner. At 1 both curves match again. Every setting in between moves the
  2133. phase shift gapless between all stages and produces some "bypassing" sounds with
  2134. sine and triangle waveforms. The more you set the offset near 1 (starting from
  2135. the 0.5) the faster the signal passes from the left to the right speaker.
  2136. The filter accepts the following options:
  2137. @table @option
  2138. @item level_in
  2139. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2140. @item level_out
  2141. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2142. @item mode
  2143. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  2144. sawup or sawdown. Default is sine.
  2145. @item amount
  2146. Set modulation. Define how much of original signal is affected by the LFO.
  2147. @item offset_l
  2148. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2149. @item offset_r
  2150. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2151. @item width
  2152. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2153. @item timing
  2154. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2155. @item bpm
  2156. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2157. is set to bpm.
  2158. @item ms
  2159. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2160. is set to ms.
  2161. @item hz
  2162. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2163. if timing is set to hz.
  2164. @end table
  2165. @anchor{aresample}
  2166. @section aresample
  2167. Resample the input audio to the specified parameters, using the
  2168. libswresample library. If none are specified then the filter will
  2169. automatically convert between its input and output.
  2170. This filter is also able to stretch/squeeze the audio data to make it match
  2171. the timestamps or to inject silence / cut out audio to make it match the
  2172. timestamps, do a combination of both or do neither.
  2173. The filter accepts the syntax
  2174. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2175. expresses a sample rate and @var{resampler_options} is a list of
  2176. @var{key}=@var{value} pairs, separated by ":". See the
  2177. @ref{Resampler Options,,"Resampler Options" section in the
  2178. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2179. for the complete list of supported options.
  2180. @subsection Examples
  2181. @itemize
  2182. @item
  2183. Resample the input audio to 44100Hz:
  2184. @example
  2185. aresample=44100
  2186. @end example
  2187. @item
  2188. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2189. samples per second compensation:
  2190. @example
  2191. aresample=async=1000
  2192. @end example
  2193. @end itemize
  2194. @section areverse
  2195. Reverse an audio clip.
  2196. Warning: This filter requires memory to buffer the entire clip, so trimming
  2197. is suggested.
  2198. @subsection Examples
  2199. @itemize
  2200. @item
  2201. Take the first 5 seconds of a clip, and reverse it.
  2202. @example
  2203. atrim=end=5,areverse
  2204. @end example
  2205. @end itemize
  2206. @section arnndn
  2207. Reduce noise from speech using Recurrent Neural Networks.
  2208. This filter accepts the following options:
  2209. @table @option
  2210. @item model, m
  2211. Set train model file to load. This option is always required.
  2212. @item mix
  2213. Set how much to mix filtered samples into final output.
  2214. Allowed range is from -1 to 1. Default value is 1.
  2215. Negative values are special, they set how much to keep filtered noise
  2216. in the final filter output. Set this option to -1 to hear actual
  2217. noise removed from input signal.
  2218. @end table
  2219. @subsection Commands
  2220. This filter supports the all above options as @ref{commands}.
  2221. @section asdr
  2222. Measure Audio Signal-to-Distortion Ratio.
  2223. This filter takes two audio streams for input, and outputs first
  2224. audio stream.
  2225. Results are in dB per channel at end of either input.
  2226. @section asetnsamples
  2227. Set the number of samples per each output audio frame.
  2228. The last output packet may contain a different number of samples, as
  2229. the filter will flush all the remaining samples when the input audio
  2230. signals its end.
  2231. The filter accepts the following options:
  2232. @table @option
  2233. @item nb_out_samples, n
  2234. Set the number of frames per each output audio frame. The number is
  2235. intended as the number of samples @emph{per each channel}.
  2236. Default value is 1024.
  2237. @item pad, p
  2238. If set to 1, the filter will pad the last audio frame with zeroes, so
  2239. that the last frame will contain the same number of samples as the
  2240. previous ones. Default value is 1.
  2241. @end table
  2242. For example, to set the number of per-frame samples to 1234 and
  2243. disable padding for the last frame, use:
  2244. @example
  2245. asetnsamples=n=1234:p=0
  2246. @end example
  2247. @section asetrate
  2248. Set the sample rate without altering the PCM data.
  2249. This will result in a change of speed and pitch.
  2250. The filter accepts the following options:
  2251. @table @option
  2252. @item sample_rate, r
  2253. Set the output sample rate. Default is 44100 Hz.
  2254. @end table
  2255. @section ashowinfo
  2256. Show a line containing various information for each input audio frame.
  2257. The input audio is not modified.
  2258. The shown line contains a sequence of key/value pairs of the form
  2259. @var{key}:@var{value}.
  2260. The following values are shown in the output:
  2261. @table @option
  2262. @item n
  2263. The (sequential) number of the input frame, starting from 0.
  2264. @item pts
  2265. The presentation timestamp of the input frame, in time base units; the time base
  2266. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2267. @item pts_time
  2268. The presentation timestamp of the input frame in seconds.
  2269. @item pos
  2270. position of the frame in the input stream, -1 if this information in
  2271. unavailable and/or meaningless (for example in case of synthetic audio)
  2272. @item fmt
  2273. The sample format.
  2274. @item chlayout
  2275. The channel layout.
  2276. @item rate
  2277. The sample rate for the audio frame.
  2278. @item nb_samples
  2279. The number of samples (per channel) in the frame.
  2280. @item checksum
  2281. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2282. audio, the data is treated as if all the planes were concatenated.
  2283. @item plane_checksums
  2284. A list of Adler-32 checksums for each data plane.
  2285. @end table
  2286. @section asoftclip
  2287. Apply audio soft clipping.
  2288. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2289. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2290. This filter accepts the following options:
  2291. @table @option
  2292. @item type
  2293. Set type of soft-clipping.
  2294. It accepts the following values:
  2295. @table @option
  2296. @item hard
  2297. @item tanh
  2298. @item atan
  2299. @item cubic
  2300. @item exp
  2301. @item alg
  2302. @item quintic
  2303. @item sin
  2304. @item erf
  2305. @end table
  2306. @item threshold
  2307. Set threshold from where to start clipping. Default value is 0dB or 1.
  2308. @item output
  2309. Set gain applied to output. Default value is 0dB or 1.
  2310. @item param
  2311. Set additional parameter which controls sigmoid function.
  2312. @item oversample
  2313. Set oversampling factor.
  2314. @end table
  2315. @subsection Commands
  2316. This filter supports the all above options as @ref{commands}.
  2317. @section aspectralstats
  2318. Display frequency domain statistical information about the audio channels.
  2319. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2320. It accepts the following option:
  2321. @table @option
  2322. @item win_size
  2323. Set the window length in samples. Default value is 2048.
  2324. Allowed range is from 32 to 65536.
  2325. @item win_func
  2326. Set window function.
  2327. It accepts the following values:
  2328. @table @samp
  2329. @item rect
  2330. @item bartlett
  2331. @item hann, hanning
  2332. @item hamming
  2333. @item blackman
  2334. @item welch
  2335. @item flattop
  2336. @item bharris
  2337. @item bnuttall
  2338. @item bhann
  2339. @item sine
  2340. @item nuttall
  2341. @item lanczos
  2342. @item gauss
  2343. @item tukey
  2344. @item dolph
  2345. @item cauchy
  2346. @item parzen
  2347. @item poisson
  2348. @item bohman
  2349. @item kaiser
  2350. @end table
  2351. Default is @code{hann}.
  2352. @item overlap
  2353. Set window overlap. Allowed range is from @code{0}
  2354. to @code{1}. Default value is @code{0.5}.
  2355. @item measure
  2356. Select the parameters which are measured. The metadata keys can
  2357. be used as flags, default is @option{all} which measures everything.
  2358. @option{none} disables all measurement.
  2359. @end table
  2360. A list of each metadata key follows:
  2361. @table @option
  2362. @item mean
  2363. @item variance
  2364. @item centroid
  2365. @item spread
  2366. @item skewness
  2367. @item kurtosis
  2368. @item entropy
  2369. @item flatness
  2370. @item crest
  2371. @item flux
  2372. @item slope
  2373. @item decrease
  2374. @item rolloff
  2375. @end table
  2376. @section asr
  2377. Automatic Speech Recognition
  2378. This filter uses PocketSphinx for speech recognition. To enable
  2379. compilation of this filter, you need to configure FFmpeg with
  2380. @code{--enable-pocketsphinx}.
  2381. It accepts the following options:
  2382. @table @option
  2383. @item rate
  2384. Set sampling rate of input audio. Defaults is @code{16000}.
  2385. This need to match speech models, otherwise one will get poor results.
  2386. @item hmm
  2387. Set dictionary containing acoustic model files.
  2388. @item dict
  2389. Set pronunciation dictionary.
  2390. @item lm
  2391. Set language model file.
  2392. @item lmctl
  2393. Set language model set.
  2394. @item lmname
  2395. Set which language model to use.
  2396. @item logfn
  2397. Set output for log messages.
  2398. @end table
  2399. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2400. @anchor{astats}
  2401. @section astats
  2402. Display time domain statistical information about the audio channels.
  2403. Statistics are calculated and displayed for each audio channel and,
  2404. where applicable, an overall figure is also given.
  2405. It accepts the following option:
  2406. @table @option
  2407. @item length
  2408. Short window length in seconds, used for peak and trough RMS measurement.
  2409. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2410. @item metadata
  2411. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2412. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2413. disabled.
  2414. Available keys for each channel are:
  2415. DC_offset
  2416. Min_level
  2417. Max_level
  2418. Min_difference
  2419. Max_difference
  2420. Mean_difference
  2421. RMS_difference
  2422. Peak_level
  2423. RMS_peak
  2424. RMS_trough
  2425. Crest_factor
  2426. Flat_factor
  2427. Peak_count
  2428. Noise_floor
  2429. Noise_floor_count
  2430. Entropy
  2431. Bit_depth
  2432. Dynamic_range
  2433. Zero_crossings
  2434. Zero_crossings_rate
  2435. Number_of_NaNs
  2436. Number_of_Infs
  2437. Number_of_denormals
  2438. and for Overall:
  2439. DC_offset
  2440. Min_level
  2441. Max_level
  2442. Min_difference
  2443. Max_difference
  2444. Mean_difference
  2445. RMS_difference
  2446. Peak_level
  2447. RMS_level
  2448. RMS_peak
  2449. RMS_trough
  2450. Flat_factor
  2451. Peak_count
  2452. Noise_floor
  2453. Noise_floor_count
  2454. Entropy
  2455. Bit_depth
  2456. Number_of_samples
  2457. Number_of_NaNs
  2458. Number_of_Infs
  2459. Number_of_denormals
  2460. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  2461. this @code{lavfi.astats.Overall.Peak_count}.
  2462. For description what each key means read below.
  2463. @item reset
  2464. Set the number of frames over which cumulative stats are calculated before
  2465. being reset
  2466. Default is disabled.
  2467. @item measure_perchannel
  2468. Select the parameters which are measured per channel. The metadata keys can
  2469. be used as flags, default is @option{all} which measures everything.
  2470. @option{none} disables all per channel measurement.
  2471. @item measure_overall
  2472. Select the parameters which are measured overall. The metadata keys can
  2473. be used as flags, default is @option{all} which measures everything.
  2474. @option{none} disables all overall measurement.
  2475. @end table
  2476. A description of each shown parameter follows:
  2477. @table @option
  2478. @item DC offset
  2479. Mean amplitude displacement from zero.
  2480. @item Min level
  2481. Minimal sample level.
  2482. @item Max level
  2483. Maximal sample level.
  2484. @item Min difference
  2485. Minimal difference between two consecutive samples.
  2486. @item Max difference
  2487. Maximal difference between two consecutive samples.
  2488. @item Mean difference
  2489. Mean difference between two consecutive samples.
  2490. The average of each difference between two consecutive samples.
  2491. @item RMS difference
  2492. Root Mean Square difference between two consecutive samples.
  2493. @item Peak level dB
  2494. @item RMS level dB
  2495. Standard peak and RMS level measured in dBFS.
  2496. @item RMS peak dB
  2497. @item RMS trough dB
  2498. Peak and trough values for RMS level measured over a short window.
  2499. @item Crest factor
  2500. Standard ratio of peak to RMS level (note: not in dB).
  2501. @item Flat factor
  2502. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2503. (i.e. either @var{Min level} or @var{Max level}).
  2504. @item Peak count
  2505. Number of occasions (not the number of samples) that the signal attained either
  2506. @var{Min level} or @var{Max level}.
  2507. @item Noise floor dB
  2508. Minimum local peak measured in dBFS over a short window.
  2509. @item Noise floor count
  2510. Number of occasions (not the number of samples) that the signal attained
  2511. @var{Noise floor}.
  2512. @item Entropy
  2513. Entropy measured across whole audio. Entropy of value near 1.0 is typically measured for white noise.
  2514. @item Bit depth
  2515. Overall bit depth of audio. Number of bits used for each sample.
  2516. @item Dynamic range
  2517. Measured dynamic range of audio in dB.
  2518. @item Zero crossings
  2519. Number of points where the waveform crosses the zero level axis.
  2520. @item Zero crossings rate
  2521. Rate of Zero crossings and number of audio samples.
  2522. @end table
  2523. @section asubboost
  2524. Boost subwoofer frequencies.
  2525. The filter accepts the following options:
  2526. @table @option
  2527. @item dry
  2528. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2529. Default value is 1.0.
  2530. @item wet
  2531. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2532. Default value is 1.0.
  2533. @item boost
  2534. Set max boost factor. Allowed range is from 1 to 12. Default value is 2.
  2535. @item decay
  2536. Set delay line decay gain value. Allowed range is from 0 to 1.
  2537. Default value is 0.0.
  2538. @item feedback
  2539. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2540. Default value is 0.9.
  2541. @item cutoff
  2542. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2543. Default value is 100.
  2544. @item slope
  2545. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2546. Default value is 0.5.
  2547. @item delay
  2548. Set delay. Allowed range is from 1 to 100.
  2549. Default value is 20.
  2550. @item channels
  2551. Set the channels to process. Default value is all available.
  2552. @end table
  2553. @subsection Commands
  2554. This filter supports the all above options as @ref{commands}.
  2555. @section asubcut
  2556. Cut subwoofer frequencies.
  2557. This filter allows to set custom, steeper
  2558. roll off than highpass filter, and thus is able to more attenuate
  2559. frequency content in stop-band.
  2560. The filter accepts the following options:
  2561. @table @option
  2562. @item cutoff
  2563. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2564. Default value is 20.
  2565. @item order
  2566. Set filter order. Available values are from 3 to 20.
  2567. Default value is 10.
  2568. @item level
  2569. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2570. @end table
  2571. @subsection Commands
  2572. This filter supports the all above options as @ref{commands}.
  2573. @section asupercut
  2574. Cut super frequencies.
  2575. The filter accepts the following options:
  2576. @table @option
  2577. @item cutoff
  2578. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2579. Default value is 20000.
  2580. @item order
  2581. Set filter order. Available values are from 3 to 20.
  2582. Default value is 10.
  2583. @item level
  2584. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2585. @end table
  2586. @subsection Commands
  2587. This filter supports the all above options as @ref{commands}.
  2588. @section asuperpass
  2589. Apply high order Butterworth band-pass filter.
  2590. The filter accepts the following options:
  2591. @table @option
  2592. @item centerf
  2593. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2594. Default value is 1000.
  2595. @item order
  2596. Set filter order. Available values are from 4 to 20.
  2597. Default value is 4.
  2598. @item qfactor
  2599. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2600. @item level
  2601. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2602. @end table
  2603. @subsection Commands
  2604. This filter supports the all above options as @ref{commands}.
  2605. @section asuperstop
  2606. Apply high order Butterworth band-stop filter.
  2607. The filter accepts the following options:
  2608. @table @option
  2609. @item centerf
  2610. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2611. Default value is 1000.
  2612. @item order
  2613. Set filter order. Available values are from 4 to 20.
  2614. Default value is 4.
  2615. @item qfactor
  2616. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2617. @item level
  2618. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2619. @end table
  2620. @subsection Commands
  2621. This filter supports the all above options as @ref{commands}.
  2622. @section atempo
  2623. Adjust audio tempo.
  2624. The filter accepts exactly one parameter, the audio tempo. If not
  2625. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2626. be in the [0.5, 100.0] range.
  2627. Note that tempo greater than 2 will skip some samples rather than
  2628. blend them in. If for any reason this is a concern it is always
  2629. possible to daisy-chain several instances of atempo to achieve the
  2630. desired product tempo.
  2631. @subsection Examples
  2632. @itemize
  2633. @item
  2634. Slow down audio to 80% tempo:
  2635. @example
  2636. atempo=0.8
  2637. @end example
  2638. @item
  2639. To speed up audio to 300% tempo:
  2640. @example
  2641. atempo=3
  2642. @end example
  2643. @item
  2644. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2645. @example
  2646. atempo=sqrt(3),atempo=sqrt(3)
  2647. @end example
  2648. @end itemize
  2649. @subsection Commands
  2650. This filter supports the following commands:
  2651. @table @option
  2652. @item tempo
  2653. Change filter tempo scale factor.
  2654. Syntax for the command is : "@var{tempo}"
  2655. @end table
  2656. @section atilt
  2657. Apply spectral tilt filter to audio stream.
  2658. This filter apply any spectral roll-off slope over any specified frequency band.
  2659. The filter accepts the following options:
  2660. @table @option
  2661. @item freq
  2662. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2663. @item slope
  2664. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2665. @item width
  2666. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2667. @item order
  2668. Set order of tilt filter.
  2669. @item level
  2670. Set input volume level. Allowed range is from 0 to 4.
  2671. Defalt is 1.
  2672. @end table
  2673. @subsection Commands
  2674. This filter supports the all above options as @ref{commands}.
  2675. @section atrim
  2676. Trim the input so that the output contains one continuous subpart of the input.
  2677. It accepts the following parameters:
  2678. @table @option
  2679. @item start
  2680. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2681. sample with the timestamp @var{start} will be the first sample in the output.
  2682. @item end
  2683. Specify time of the first audio sample that will be dropped, i.e. the
  2684. audio sample immediately preceding the one with the timestamp @var{end} will be
  2685. the last sample in the output.
  2686. @item start_pts
  2687. Same as @var{start}, except this option sets the start timestamp in samples
  2688. instead of seconds.
  2689. @item end_pts
  2690. Same as @var{end}, except this option sets the end timestamp in samples instead
  2691. of seconds.
  2692. @item duration
  2693. The maximum duration of the output in seconds.
  2694. @item start_sample
  2695. The number of the first sample that should be output.
  2696. @item end_sample
  2697. The number of the first sample that should be dropped.
  2698. @end table
  2699. @option{start}, @option{end}, and @option{duration} are expressed as time
  2700. duration specifications; see
  2701. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2702. Note that the first two sets of the start/end options and the @option{duration}
  2703. option look at the frame timestamp, while the _sample options simply count the
  2704. samples that pass through the filter. So start/end_pts and start/end_sample will
  2705. give different results when the timestamps are wrong, inexact or do not start at
  2706. zero. Also note that this filter does not modify the timestamps. If you wish
  2707. to have the output timestamps start at zero, insert the asetpts filter after the
  2708. atrim filter.
  2709. If multiple start or end options are set, this filter tries to be greedy and
  2710. keep all samples that match at least one of the specified constraints. To keep
  2711. only the part that matches all the constraints at once, chain multiple atrim
  2712. filters.
  2713. The defaults are such that all the input is kept. So it is possible to set e.g.
  2714. just the end values to keep everything before the specified time.
  2715. Examples:
  2716. @itemize
  2717. @item
  2718. Drop everything except the second minute of input:
  2719. @example
  2720. ffmpeg -i INPUT -af atrim=60:120
  2721. @end example
  2722. @item
  2723. Keep only the first 1000 samples:
  2724. @example
  2725. ffmpeg -i INPUT -af atrim=end_sample=1000
  2726. @end example
  2727. @end itemize
  2728. @section axcorrelate
  2729. Calculate normalized windowed cross-correlation between two input audio streams.
  2730. Resulted samples are always between -1 and 1 inclusive.
  2731. If result is 1 it means two input samples are highly correlated in that selected segment.
  2732. Result 0 means they are not correlated at all.
  2733. If result is -1 it means two input samples are out of phase, which means they cancel each
  2734. other.
  2735. The filter accepts the following options:
  2736. @table @option
  2737. @item size
  2738. Set size of segment over which cross-correlation is calculated.
  2739. Default is 256. Allowed range is from 2 to 131072.
  2740. @item algo
  2741. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2742. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2743. are always zero and thus need much less calculations to make.
  2744. This is generally not true, but is valid for typical audio streams.
  2745. @end table
  2746. @subsection Examples
  2747. @itemize
  2748. @item
  2749. Calculate correlation between channels in stereo audio stream:
  2750. @example
  2751. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2752. @end example
  2753. @end itemize
  2754. @section bandpass
  2755. Apply a two-pole Butterworth band-pass filter with central
  2756. frequency @var{frequency}, and (3dB-point) band-width width.
  2757. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2758. instead of the default: constant 0dB peak gain.
  2759. The filter roll off at 6dB per octave (20dB per decade).
  2760. The filter accepts the following options:
  2761. @table @option
  2762. @item frequency, f
  2763. Set the filter's central frequency. Default is @code{3000}.
  2764. @item csg
  2765. Constant skirt gain if set to 1. Defaults to 0.
  2766. @item width_type, t
  2767. Set method to specify band-width of filter.
  2768. @table @option
  2769. @item h
  2770. Hz
  2771. @item q
  2772. Q-Factor
  2773. @item o
  2774. octave
  2775. @item s
  2776. slope
  2777. @item k
  2778. kHz
  2779. @end table
  2780. @item width, w
  2781. Specify the band-width of a filter in width_type units.
  2782. @item mix, m
  2783. How much to use filtered signal in output. Default is 1.
  2784. Range is between 0 and 1.
  2785. @item channels, c
  2786. Specify which channels to filter, by default all available are filtered.
  2787. @item normalize, n
  2788. Normalize biquad coefficients, by default is disabled.
  2789. Enabling it will normalize magnitude response at DC to 0dB.
  2790. @item transform, a
  2791. Set transform type of IIR filter.
  2792. @table @option
  2793. @item di
  2794. @item dii
  2795. @item tdi
  2796. @item tdii
  2797. @item latt
  2798. @item svf
  2799. @item zdf
  2800. @end table
  2801. @item precision, r
  2802. Set precison of filtering.
  2803. @table @option
  2804. @item auto
  2805. Pick automatic sample format depending on surround filters.
  2806. @item s16
  2807. Always use signed 16-bit.
  2808. @item s32
  2809. Always use signed 32-bit.
  2810. @item f32
  2811. Always use float 32-bit.
  2812. @item f64
  2813. Always use float 64-bit.
  2814. @end table
  2815. @item block_size, b
  2816. Set block size used for reverse IIR processing. If this value is set to high enough
  2817. value (higher than impulse response length truncated when reaches near zero values) filtering
  2818. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2819. Note that filter delay will be exactly this many samples when set to non-zero value.
  2820. @end table
  2821. @subsection Commands
  2822. This filter supports the following commands:
  2823. @table @option
  2824. @item frequency, f
  2825. Change bandpass frequency.
  2826. Syntax for the command is : "@var{frequency}"
  2827. @item width_type, t
  2828. Change bandpass width_type.
  2829. Syntax for the command is : "@var{width_type}"
  2830. @item width, w
  2831. Change bandpass width.
  2832. Syntax for the command is : "@var{width}"
  2833. @item mix, m
  2834. Change bandpass mix.
  2835. Syntax for the command is : "@var{mix}"
  2836. @end table
  2837. @section bandreject
  2838. Apply a two-pole Butterworth band-reject filter with central
  2839. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2840. The filter roll off at 6dB per octave (20dB per decade).
  2841. The filter accepts the following options:
  2842. @table @option
  2843. @item frequency, f
  2844. Set the filter's central frequency. Default is @code{3000}.
  2845. @item width_type, t
  2846. Set method to specify band-width of filter.
  2847. @table @option
  2848. @item h
  2849. Hz
  2850. @item q
  2851. Q-Factor
  2852. @item o
  2853. octave
  2854. @item s
  2855. slope
  2856. @item k
  2857. kHz
  2858. @end table
  2859. @item width, w
  2860. Specify the band-width of a filter in width_type units.
  2861. @item mix, m
  2862. How much to use filtered signal in output. Default is 1.
  2863. Range is between 0 and 1.
  2864. @item channels, c
  2865. Specify which channels to filter, by default all available are filtered.
  2866. @item normalize, n
  2867. Normalize biquad coefficients, by default is disabled.
  2868. Enabling it will normalize magnitude response at DC to 0dB.
  2869. @item transform, a
  2870. Set transform type of IIR filter.
  2871. @table @option
  2872. @item di
  2873. @item dii
  2874. @item tdi
  2875. @item tdii
  2876. @item latt
  2877. @item svf
  2878. @item zdf
  2879. @end table
  2880. @item precision, r
  2881. Set precison of filtering.
  2882. @table @option
  2883. @item auto
  2884. Pick automatic sample format depending on surround filters.
  2885. @item s16
  2886. Always use signed 16-bit.
  2887. @item s32
  2888. Always use signed 32-bit.
  2889. @item f32
  2890. Always use float 32-bit.
  2891. @item f64
  2892. Always use float 64-bit.
  2893. @end table
  2894. @item block_size, b
  2895. Set block size used for reverse IIR processing. If this value is set to high enough
  2896. value (higher than impulse response length truncated when reaches near zero values) filtering
  2897. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2898. Note that filter delay will be exactly this many samples when set to non-zero value.
  2899. @end table
  2900. @subsection Commands
  2901. This filter supports the following commands:
  2902. @table @option
  2903. @item frequency, f
  2904. Change bandreject frequency.
  2905. Syntax for the command is : "@var{frequency}"
  2906. @item width_type, t
  2907. Change bandreject width_type.
  2908. Syntax for the command is : "@var{width_type}"
  2909. @item width, w
  2910. Change bandreject width.
  2911. Syntax for the command is : "@var{width}"
  2912. @item mix, m
  2913. Change bandreject mix.
  2914. Syntax for the command is : "@var{mix}"
  2915. @end table
  2916. @section bass, lowshelf
  2917. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2918. shelving filter with a response similar to that of a standard
  2919. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2920. The filter accepts the following options:
  2921. @table @option
  2922. @item gain, g
  2923. Give the gain at 0 Hz. Its useful range is about -20
  2924. (for a large cut) to +20 (for a large boost).
  2925. Beware of clipping when using a positive gain.
  2926. @item frequency, f
  2927. Set the filter's central frequency and so can be used
  2928. to extend or reduce the frequency range to be boosted or cut.
  2929. The default value is @code{100} Hz.
  2930. @item width_type, t
  2931. Set method to specify band-width of filter.
  2932. @table @option
  2933. @item h
  2934. Hz
  2935. @item q
  2936. Q-Factor
  2937. @item o
  2938. octave
  2939. @item s
  2940. slope
  2941. @item k
  2942. kHz
  2943. @end table
  2944. @item width, w
  2945. Determine how steep is the filter's shelf transition.
  2946. @item poles, p
  2947. Set number of poles. Default is 2.
  2948. @item mix, m
  2949. How much to use filtered signal in output. Default is 1.
  2950. Range is between 0 and 1.
  2951. @item channels, c
  2952. Specify which channels to filter, by default all available are filtered.
  2953. @item normalize, n
  2954. Normalize biquad coefficients, by default is disabled.
  2955. Enabling it will normalize magnitude response at DC to 0dB.
  2956. @item transform, a
  2957. Set transform type of IIR filter.
  2958. @table @option
  2959. @item di
  2960. @item dii
  2961. @item tdi
  2962. @item tdii
  2963. @item latt
  2964. @item svf
  2965. @item zdf
  2966. @end table
  2967. @item precision, r
  2968. Set precison of filtering.
  2969. @table @option
  2970. @item auto
  2971. Pick automatic sample format depending on surround filters.
  2972. @item s16
  2973. Always use signed 16-bit.
  2974. @item s32
  2975. Always use signed 32-bit.
  2976. @item f32
  2977. Always use float 32-bit.
  2978. @item f64
  2979. Always use float 64-bit.
  2980. @end table
  2981. @item block_size, b
  2982. Set block size used for reverse IIR processing. If this value is set to high enough
  2983. value (higher than impulse response length truncated when reaches near zero values) filtering
  2984. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2985. Note that filter delay will be exactly this many samples when set to non-zero value.
  2986. @end table
  2987. @subsection Commands
  2988. This filter supports the following commands:
  2989. @table @option
  2990. @item frequency, f
  2991. Change bass frequency.
  2992. Syntax for the command is : "@var{frequency}"
  2993. @item width_type, t
  2994. Change bass width_type.
  2995. Syntax for the command is : "@var{width_type}"
  2996. @item width, w
  2997. Change bass width.
  2998. Syntax for the command is : "@var{width}"
  2999. @item gain, g
  3000. Change bass gain.
  3001. Syntax for the command is : "@var{gain}"
  3002. @item mix, m
  3003. Change bass mix.
  3004. Syntax for the command is : "@var{mix}"
  3005. @end table
  3006. @section biquad
  3007. Apply a biquad IIR filter with the given coefficients.
  3008. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  3009. are the numerator and denominator coefficients respectively.
  3010. and @var{channels}, @var{c} specify which channels to filter, by default all
  3011. available are filtered.
  3012. @subsection Commands
  3013. This filter supports the following commands:
  3014. @table @option
  3015. @item a0
  3016. @item a1
  3017. @item a2
  3018. @item b0
  3019. @item b1
  3020. @item b2
  3021. Change biquad parameter.
  3022. Syntax for the command is : "@var{value}"
  3023. @item mix, m
  3024. How much to use filtered signal in output. Default is 1.
  3025. Range is between 0 and 1.
  3026. @item channels, c
  3027. Specify which channels to filter, by default all available are filtered.
  3028. @item normalize, n
  3029. Normalize biquad coefficients, by default is disabled.
  3030. Enabling it will normalize magnitude response at DC to 0dB.
  3031. @item transform, a
  3032. Set transform type of IIR filter.
  3033. @table @option
  3034. @item di
  3035. @item dii
  3036. @item tdi
  3037. @item tdii
  3038. @item latt
  3039. @item svf
  3040. @item zdf
  3041. @end table
  3042. @item precision, r
  3043. Set precison of filtering.
  3044. @table @option
  3045. @item auto
  3046. Pick automatic sample format depending on surround filters.
  3047. @item s16
  3048. Always use signed 16-bit.
  3049. @item s32
  3050. Always use signed 32-bit.
  3051. @item f32
  3052. Always use float 32-bit.
  3053. @item f64
  3054. Always use float 64-bit.
  3055. @end table
  3056. @item block_size, b
  3057. Set block size used for reverse IIR processing. If this value is set to high enough
  3058. value (higher than impulse response length truncated when reaches near zero values) filtering
  3059. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3060. Note that filter delay will be exactly this many samples when set to non-zero value.
  3061. @end table
  3062. @section bs2b
  3063. Bauer stereo to binaural transformation, which improves headphone listening of
  3064. stereo audio records.
  3065. To enable compilation of this filter you need to configure FFmpeg with
  3066. @code{--enable-libbs2b}.
  3067. It accepts the following parameters:
  3068. @table @option
  3069. @item profile
  3070. Pre-defined crossfeed level.
  3071. @table @option
  3072. @item default
  3073. Default level (fcut=700, feed=50).
  3074. @item cmoy
  3075. Chu Moy circuit (fcut=700, feed=60).
  3076. @item jmeier
  3077. Jan Meier circuit (fcut=650, feed=95).
  3078. @end table
  3079. @item fcut
  3080. Cut frequency (in Hz).
  3081. @item feed
  3082. Feed level (in Hz).
  3083. @end table
  3084. @section channelmap
  3085. Remap input channels to new locations.
  3086. It accepts the following parameters:
  3087. @table @option
  3088. @item map
  3089. Map channels from input to output. The argument is a '|'-separated list of
  3090. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  3091. @var{in_channel} form. @var{in_channel} can be either the name of the input
  3092. channel (e.g. FL for front left) or its index in the input channel layout.
  3093. @var{out_channel} is the name of the output channel or its index in the output
  3094. channel layout. If @var{out_channel} is not given then it is implicitly an
  3095. index, starting with zero and increasing by one for each mapping.
  3096. @item channel_layout
  3097. The channel layout of the output stream.
  3098. @end table
  3099. If no mapping is present, the filter will implicitly map input channels to
  3100. output channels, preserving indices.
  3101. @subsection Examples
  3102. @itemize
  3103. @item
  3104. For example, assuming a 5.1+downmix input MOV file,
  3105. @example
  3106. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  3107. @end example
  3108. will create an output WAV file tagged as stereo from the downmix channels of
  3109. the input.
  3110. @item
  3111. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  3112. @example
  3113. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  3114. @end example
  3115. @end itemize
  3116. @section channelsplit
  3117. Split each channel from an input audio stream into a separate output stream.
  3118. It accepts the following parameters:
  3119. @table @option
  3120. @item channel_layout
  3121. The channel layout of the input stream. The default is "stereo".
  3122. @item channels
  3123. A channel layout describing the channels to be extracted as separate output streams
  3124. or "all" to extract each input channel as a separate stream. The default is "all".
  3125. Choosing channels not present in channel layout in the input will result in an error.
  3126. @end table
  3127. @subsection Examples
  3128. @itemize
  3129. @item
  3130. For example, assuming a stereo input MP3 file,
  3131. @example
  3132. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  3133. @end example
  3134. will create an output Matroska file with two audio streams, one containing only
  3135. the left channel and the other the right channel.
  3136. @item
  3137. Split a 5.1 WAV file into per-channel files:
  3138. @example
  3139. ffmpeg -i in.wav -filter_complex
  3140. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  3141. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  3142. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  3143. side_right.wav
  3144. @end example
  3145. @item
  3146. Extract only LFE from a 5.1 WAV file:
  3147. @example
  3148. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  3149. -map '[LFE]' lfe.wav
  3150. @end example
  3151. @end itemize
  3152. @section chorus
  3153. Add a chorus effect to the audio.
  3154. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  3155. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  3156. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  3157. The modulation depth defines the range the modulated delay is played before or after
  3158. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  3159. sound tuned around the original one, like in a chorus where some vocals are slightly
  3160. off key.
  3161. It accepts the following parameters:
  3162. @table @option
  3163. @item in_gain
  3164. Set input gain. Default is 0.4.
  3165. @item out_gain
  3166. Set output gain. Default is 0.4.
  3167. @item delays
  3168. Set delays. A typical delay is around 40ms to 60ms.
  3169. @item decays
  3170. Set decays.
  3171. @item speeds
  3172. Set speeds.
  3173. @item depths
  3174. Set depths.
  3175. @end table
  3176. @subsection Examples
  3177. @itemize
  3178. @item
  3179. A single delay:
  3180. @example
  3181. chorus=0.7:0.9:55:0.4:0.25:2
  3182. @end example
  3183. @item
  3184. Two delays:
  3185. @example
  3186. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3187. @end example
  3188. @item
  3189. Fuller sounding chorus with three delays:
  3190. @example
  3191. 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
  3192. @end example
  3193. @end itemize
  3194. @section compand
  3195. Compress or expand the audio's dynamic range.
  3196. It accepts the following parameters:
  3197. @table @option
  3198. @item attacks
  3199. @item decays
  3200. A list of times in seconds for each channel over which the instantaneous level
  3201. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3202. increase of volume and @var{decays} refers to decrease of volume. For most
  3203. situations, the attack time (response to the audio getting louder) should be
  3204. shorter than the decay time, because the human ear is more sensitive to sudden
  3205. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3206. a typical value for decay is 0.8 seconds.
  3207. If specified number of attacks & decays is lower than number of channels, the last
  3208. set attack/decay will be used for all remaining channels.
  3209. @item points
  3210. A list of points for the transfer function, specified in dB relative to the
  3211. maximum possible signal amplitude. Each key points list must be defined using
  3212. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3213. @code{x0/y0 x1/y1 x2/y2 ....}
  3214. The input values must be in strictly increasing order but the transfer function
  3215. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3216. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3217. function are @code{-70/-70|-60/-20|1/0}.
  3218. @item soft-knee
  3219. Set the curve radius in dB for all joints. It defaults to 0.01.
  3220. @item gain
  3221. Set the additional gain in dB to be applied at all points on the transfer
  3222. function. This allows for easy adjustment of the overall gain.
  3223. It defaults to 0.
  3224. @item volume
  3225. Set an initial volume, in dB, to be assumed for each channel when filtering
  3226. starts. This permits the user to supply a nominal level initially, so that, for
  3227. example, a very large gain is not applied to initial signal levels before the
  3228. companding has begun to operate. A typical value for audio which is initially
  3229. quiet is -90 dB. It defaults to 0.
  3230. @item delay
  3231. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3232. delayed before being fed to the volume adjuster. Specifying a delay
  3233. approximately equal to the attack/decay times allows the filter to effectively
  3234. operate in predictive rather than reactive mode. It defaults to 0.
  3235. @end table
  3236. @subsection Examples
  3237. @itemize
  3238. @item
  3239. Make music with both quiet and loud passages suitable for listening to in a
  3240. noisy environment:
  3241. @example
  3242. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3243. @end example
  3244. Another example for audio with whisper and explosion parts:
  3245. @example
  3246. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3247. @end example
  3248. @item
  3249. A noise gate for when the noise is at a lower level than the signal:
  3250. @example
  3251. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3252. @end example
  3253. @item
  3254. Here is another noise gate, this time for when the noise is at a higher level
  3255. than the signal (making it, in some ways, similar to squelch):
  3256. @example
  3257. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3258. @end example
  3259. @item
  3260. 2:1 compression starting at -6dB:
  3261. @example
  3262. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3263. @end example
  3264. @item
  3265. 2:1 compression starting at -9dB:
  3266. @example
  3267. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3268. @end example
  3269. @item
  3270. 2:1 compression starting at -12dB:
  3271. @example
  3272. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3273. @end example
  3274. @item
  3275. 2:1 compression starting at -18dB:
  3276. @example
  3277. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3278. @end example
  3279. @item
  3280. 3:1 compression starting at -15dB:
  3281. @example
  3282. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3283. @end example
  3284. @item
  3285. Compressor/Gate:
  3286. @example
  3287. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3288. @end example
  3289. @item
  3290. Expander:
  3291. @example
  3292. 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
  3293. @end example
  3294. @item
  3295. Hard limiter at -6dB:
  3296. @example
  3297. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3298. @end example
  3299. @item
  3300. Hard limiter at -12dB:
  3301. @example
  3302. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3303. @end example
  3304. @item
  3305. Hard noise gate at -35 dB:
  3306. @example
  3307. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3308. @end example
  3309. @item
  3310. Soft limiter:
  3311. @example
  3312. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3313. @end example
  3314. @end itemize
  3315. @section compensationdelay
  3316. Compensation Delay Line is a metric based delay to compensate differing
  3317. positions of microphones or speakers.
  3318. For example, you have recorded guitar with two microphones placed in
  3319. different locations. Because the front of sound wave has fixed speed in
  3320. normal conditions, the phasing of microphones can vary and depends on
  3321. their location and interposition. The best sound mix can be achieved when
  3322. these microphones are in phase (synchronized). Note that a distance of
  3323. ~30 cm between microphones makes one microphone capture the signal in
  3324. antiphase to the other microphone. That makes the final mix sound moody.
  3325. This filter helps to solve phasing problems by adding different delays
  3326. to each microphone track and make them synchronized.
  3327. The best result can be reached when you take one track as base and
  3328. synchronize other tracks one by one with it.
  3329. Remember that synchronization/delay tolerance depends on sample rate, too.
  3330. Higher sample rates will give more tolerance.
  3331. The filter accepts the following parameters:
  3332. @table @option
  3333. @item mm
  3334. Set millimeters distance. This is compensation distance for fine tuning.
  3335. Default is 0.
  3336. @item cm
  3337. Set cm distance. This is compensation distance for tightening distance setup.
  3338. Default is 0.
  3339. @item m
  3340. Set meters distance. This is compensation distance for hard distance setup.
  3341. Default is 0.
  3342. @item dry
  3343. Set dry amount. Amount of unprocessed (dry) signal.
  3344. Default is 0.
  3345. @item wet
  3346. Set wet amount. Amount of processed (wet) signal.
  3347. Default is 1.
  3348. @item temp
  3349. Set temperature in degrees Celsius. This is the temperature of the environment.
  3350. Default is 20.
  3351. @end table
  3352. @subsection Commands
  3353. This filter supports the all above options as @ref{commands}.
  3354. @section crossfeed
  3355. Apply headphone crossfeed filter.
  3356. Crossfeed is the process of blending the left and right channels of stereo
  3357. audio recording.
  3358. It is mainly used to reduce extreme stereo separation of low frequencies.
  3359. The intent is to produce more speaker like sound to the listener.
  3360. The filter accepts the following options:
  3361. @table @option
  3362. @item strength
  3363. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3364. This sets gain of low shelf filter for side part of stereo image.
  3365. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3366. @item range
  3367. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3368. This sets cut off frequency of low shelf filter. Default is cut off near
  3369. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3370. @item slope
  3371. Set curve slope of low shelf filter. Default is 0.5.
  3372. Allowed range is from 0.01 to 1.
  3373. @item level_in
  3374. Set input gain. Default is 0.9.
  3375. @item level_out
  3376. Set output gain. Default is 1.
  3377. @item block_size
  3378. Set block size used for reverse IIR processing. If this value is set to high enough
  3379. value (higher than impulse response length truncated when reaches near zero values) filtering
  3380. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3381. Note that filter delay will be exactly this many samples when set to non-zero value.
  3382. @end table
  3383. @subsection Commands
  3384. This filter supports the all above options as @ref{commands}.
  3385. @section crystalizer
  3386. Simple algorithm for audio noise sharpening.
  3387. This filter linearly increases differences betweeen each audio sample.
  3388. The filter accepts the following options:
  3389. @table @option
  3390. @item i
  3391. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3392. (unchanged sound) to 10.0 (maximum effect).
  3393. To inverse filtering use negative value.
  3394. @item c
  3395. Enable clipping. By default is enabled.
  3396. @end table
  3397. @subsection Commands
  3398. This filter supports the all above options as @ref{commands}.
  3399. @section dcshift
  3400. Apply a DC shift to the audio.
  3401. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3402. in the recording chain) from the audio. The effect of a DC offset is reduced
  3403. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3404. a signal has a DC offset.
  3405. @table @option
  3406. @item shift
  3407. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3408. the audio.
  3409. @item limitergain
  3410. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3411. used to prevent clipping.
  3412. @end table
  3413. @section deesser
  3414. Apply de-essing to the audio samples.
  3415. @table @option
  3416. @item i
  3417. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3418. Default is 0.
  3419. @item m
  3420. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3421. Default is 0.5.
  3422. @item f
  3423. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3424. Default is 0.5.
  3425. @item s
  3426. Set the output mode.
  3427. It accepts the following values:
  3428. @table @option
  3429. @item i
  3430. Pass input unchanged.
  3431. @item o
  3432. Pass ess filtered out.
  3433. @item e
  3434. Pass only ess.
  3435. Default value is @var{o}.
  3436. @end table
  3437. @end table
  3438. @section dialoguenhance
  3439. Enhance dialogue in stereo audio.
  3440. This filter accepts stereo input and produce surround (3.0) channels output.
  3441. The newly produced front center channel have enhanced speech dialogue originally
  3442. available in both stereo channels.
  3443. This filter outputs front left and front right channels same as available in stereo input.
  3444. The filter accepts the following options:
  3445. @table @option
  3446. @item original
  3447. Set the original center factor to keep in front center channel output.
  3448. Allowed range is from 0 to 1. Default value is 1.
  3449. @item enhance
  3450. Set the dialogue enhance factor to put in front center channel output.
  3451. Allowed range is from 0 to 3. Default value is 1.
  3452. @item voice
  3453. Set the voice detection factor.
  3454. Allowed range is from 2 to 32. Default value is 2.
  3455. @end table
  3456. @subsection Commands
  3457. This filter supports the all above options as @ref{commands}.
  3458. @section drmeter
  3459. Measure audio dynamic range.
  3460. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3461. is found in transition material. And anything less that 8 have very poor dynamics
  3462. and is very compressed.
  3463. The filter accepts the following options:
  3464. @table @option
  3465. @item length
  3466. Set window length in seconds used to split audio into segments of equal length.
  3467. Default is 3 seconds.
  3468. @end table
  3469. @section dynaudnorm
  3470. Dynamic Audio Normalizer.
  3471. This filter applies a certain amount of gain to the input audio in order
  3472. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3473. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3474. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3475. This allows for applying extra gain to the "quiet" sections of the audio
  3476. while avoiding distortions or clipping the "loud" sections. In other words:
  3477. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3478. sections, in the sense that the volume of each section is brought to the
  3479. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3480. this goal *without* applying "dynamic range compressing". It will retain 100%
  3481. of the dynamic range *within* each section of the audio file.
  3482. @table @option
  3483. @item framelen, f
  3484. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3485. Default is 500 milliseconds.
  3486. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3487. referred to as frames. This is required, because a peak magnitude has no
  3488. meaning for just a single sample value. Instead, we need to determine the
  3489. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3490. normalizer would simply use the peak magnitude of the complete file, the
  3491. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3492. frame. The length of a frame is specified in milliseconds. By default, the
  3493. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3494. been found to give good results with most files.
  3495. Note that the exact frame length, in number of samples, will be determined
  3496. automatically, based on the sampling rate of the individual input audio file.
  3497. @item gausssize, g
  3498. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3499. number. Default is 31.
  3500. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3501. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3502. is specified in frames, centered around the current frame. For the sake of
  3503. simplicity, this must be an odd number. Consequently, the default value of 31
  3504. takes into account the current frame, as well as the 15 preceding frames and
  3505. the 15 subsequent frames. Using a larger window results in a stronger
  3506. smoothing effect and thus in less gain variation, i.e. slower gain
  3507. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3508. effect and thus in more gain variation, i.e. faster gain adaptation.
  3509. In other words, the more you increase this value, the more the Dynamic Audio
  3510. Normalizer will behave like a "traditional" normalization filter. On the
  3511. contrary, the more you decrease this value, the more the Dynamic Audio
  3512. Normalizer will behave like a dynamic range compressor.
  3513. @item peak, p
  3514. Set the target peak value. This specifies the highest permissible magnitude
  3515. level for the normalized audio input. This filter will try to approach the
  3516. target peak magnitude as closely as possible, but at the same time it also
  3517. makes sure that the normalized signal will never exceed the peak magnitude.
  3518. A frame's maximum local gain factor is imposed directly by the target peak
  3519. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3520. It is not recommended to go above this value.
  3521. @item maxgain, m
  3522. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3523. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3524. factor for each input frame, i.e. the maximum gain factor that does not
  3525. result in clipping or distortion. The maximum gain factor is determined by
  3526. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3527. additionally bounds the frame's maximum gain factor by a predetermined
  3528. (global) maximum gain factor. This is done in order to avoid excessive gain
  3529. factors in "silent" or almost silent frames. By default, the maximum gain
  3530. factor is 10.0, For most inputs the default value should be sufficient and
  3531. it usually is not recommended to increase this value. Though, for input
  3532. with an extremely low overall volume level, it may be necessary to allow even
  3533. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3534. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3535. Instead, a "sigmoid" threshold function will be applied. This way, the
  3536. gain factors will smoothly approach the threshold value, but never exceed that
  3537. value.
  3538. @item targetrms, r
  3539. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3540. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3541. This means that the maximum local gain factor for each frame is defined
  3542. (only) by the frame's highest magnitude sample. This way, the samples can
  3543. be amplified as much as possible without exceeding the maximum signal
  3544. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3545. Normalizer can also take into account the frame's root mean square,
  3546. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3547. determine the power of a time-varying signal. It is therefore considered
  3548. that the RMS is a better approximation of the "perceived loudness" than
  3549. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3550. frames to a constant RMS value, a uniform "perceived loudness" can be
  3551. established. If a target RMS value has been specified, a frame's local gain
  3552. factor is defined as the factor that would result in exactly that RMS value.
  3553. Note, however, that the maximum local gain factor is still restricted by the
  3554. frame's highest magnitude sample, in order to prevent clipping.
  3555. @item coupling, n
  3556. Enable channels coupling. By default is enabled.
  3557. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3558. amount. This means the same gain factor will be applied to all channels, i.e.
  3559. the maximum possible gain factor is determined by the "loudest" channel.
  3560. However, in some recordings, it may happen that the volume of the different
  3561. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3562. In this case, this option can be used to disable the channel coupling. This way,
  3563. the gain factor will be determined independently for each channel, depending
  3564. only on the individual channel's highest magnitude sample. This allows for
  3565. harmonizing the volume of the different channels.
  3566. @item correctdc, c
  3567. Enable DC bias correction. By default is disabled.
  3568. An audio signal (in the time domain) is a sequence of sample values.
  3569. In the Dynamic Audio Normalizer these sample values are represented in the
  3570. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3571. audio signal, or "waveform", should be centered around the zero point.
  3572. That means if we calculate the mean value of all samples in a file, or in a
  3573. single frame, then the result should be 0.0 or at least very close to that
  3574. value. If, however, there is a significant deviation of the mean value from
  3575. 0.0, in either positive or negative direction, this is referred to as a
  3576. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3577. Audio Normalizer provides optional DC bias correction.
  3578. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3579. the mean value, or "DC correction" offset, of each input frame and subtract
  3580. that value from all of the frame's sample values which ensures those samples
  3581. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3582. boundaries, the DC correction offset values will be interpolated smoothly
  3583. between neighbouring frames.
  3584. @item altboundary, b
  3585. Enable alternative boundary mode. By default is disabled.
  3586. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3587. around each frame. This includes the preceding frames as well as the
  3588. subsequent frames. However, for the "boundary" frames, located at the very
  3589. beginning and at the very end of the audio file, not all neighbouring
  3590. frames are available. In particular, for the first few frames in the audio
  3591. file, the preceding frames are not known. And, similarly, for the last few
  3592. frames in the audio file, the subsequent frames are not known. Thus, the
  3593. question arises which gain factors should be assumed for the missing frames
  3594. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3595. to deal with this situation. The default boundary mode assumes a gain factor
  3596. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3597. "fade out" at the beginning and at the end of the input, respectively.
  3598. @item compress, s
  3599. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3600. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3601. compression. This means that signal peaks will not be pruned and thus the
  3602. full dynamic range will be retained within each local neighbourhood. However,
  3603. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3604. normalization algorithm with a more "traditional" compression.
  3605. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3606. (thresholding) function. If (and only if) the compression feature is enabled,
  3607. all input frames will be processed by a soft knee thresholding function prior
  3608. to the actual normalization process. Put simply, the thresholding function is
  3609. going to prune all samples whose magnitude exceeds a certain threshold value.
  3610. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3611. value. Instead, the threshold value will be adjusted for each individual
  3612. frame.
  3613. In general, smaller parameters result in stronger compression, and vice versa.
  3614. Values below 3.0 are not recommended, because audible distortion may appear.
  3615. @item threshold, t
  3616. Set the target threshold value. This specifies the lowest permissible
  3617. magnitude level for the audio input which will be normalized.
  3618. If input frame volume is above this value frame will be normalized.
  3619. Otherwise frame may not be normalized at all. The default value is set
  3620. to 0, which means all input frames will be normalized.
  3621. This option is mostly useful if digital noise is not wanted to be amplified.
  3622. @item channels, h
  3623. Specify which channels to filter, by default all available channels are filtered.
  3624. @item overlap, o
  3625. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3626. Using >0 and <1 values will make less conservative gain adjustments, like
  3627. when framelen option is set to smaller value, if framelen option value is
  3628. compensated for non-zero overlap then gain adjustments will be smoother across time
  3629. compared to zero overlap case.
  3630. @item curve, v
  3631. Specify the peak mapping curve expression which is going to be used when calculating
  3632. gain applied to frames. The max output frame gain will still be limited by other
  3633. options mentioned previously for this filter.
  3634. The expression can contain the following constants:
  3635. @table @option
  3636. @item ch
  3637. current channel number
  3638. @item sn
  3639. current sample number
  3640. @item nb_channels
  3641. number of channels
  3642. @item t
  3643. timestamp expressed in seconds
  3644. @item sr
  3645. sample rate
  3646. @item p
  3647. current frame peak value
  3648. @end table
  3649. @end table
  3650. @subsection Commands
  3651. This filter supports the all above options as @ref{commands}.
  3652. @section earwax
  3653. Make audio easier to listen to on headphones.
  3654. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3655. so that when listened to on headphones the stereo image is moved from
  3656. inside your head (standard for headphones) to outside and in front of
  3657. the listener (standard for speakers).
  3658. Ported from SoX.
  3659. @section equalizer
  3660. Apply a two-pole peaking equalisation (EQ) filter. With this
  3661. filter, the signal-level at and around a selected frequency can
  3662. be increased or decreased, whilst (unlike bandpass and bandreject
  3663. filters) that at all other frequencies is unchanged.
  3664. In order to produce complex equalisation curves, this filter can
  3665. be given several times, each with a different central frequency.
  3666. The filter accepts the following options:
  3667. @table @option
  3668. @item frequency, f
  3669. Set the filter's central frequency in Hz.
  3670. @item width_type, t
  3671. Set method to specify band-width of filter.
  3672. @table @option
  3673. @item h
  3674. Hz
  3675. @item q
  3676. Q-Factor
  3677. @item o
  3678. octave
  3679. @item s
  3680. slope
  3681. @item k
  3682. kHz
  3683. @end table
  3684. @item width, w
  3685. Specify the band-width of a filter in width_type units.
  3686. @item gain, g
  3687. Set the required gain or attenuation in dB.
  3688. Beware of clipping when using a positive gain.
  3689. @item mix, m
  3690. How much to use filtered signal in output. Default is 1.
  3691. Range is between 0 and 1.
  3692. @item channels, c
  3693. Specify which channels to filter, by default all available are filtered.
  3694. @item normalize, n
  3695. Normalize biquad coefficients, by default is disabled.
  3696. Enabling it will normalize magnitude response at DC to 0dB.
  3697. @item transform, a
  3698. Set transform type of IIR filter.
  3699. @table @option
  3700. @item di
  3701. @item dii
  3702. @item tdi
  3703. @item tdii
  3704. @item latt
  3705. @item svf
  3706. @item zdf
  3707. @end table
  3708. @item precision, r
  3709. Set precison of filtering.
  3710. @table @option
  3711. @item auto
  3712. Pick automatic sample format depending on surround filters.
  3713. @item s16
  3714. Always use signed 16-bit.
  3715. @item s32
  3716. Always use signed 32-bit.
  3717. @item f32
  3718. Always use float 32-bit.
  3719. @item f64
  3720. Always use float 64-bit.
  3721. @end table
  3722. @item block_size, b
  3723. Set block size used for reverse IIR processing. If this value is set to high enough
  3724. value (higher than impulse response length truncated when reaches near zero values) filtering
  3725. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3726. Note that filter delay will be exactly this many samples when set to non-zero value.
  3727. @end table
  3728. @subsection Examples
  3729. @itemize
  3730. @item
  3731. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3732. @example
  3733. equalizer=f=1000:t=h:width=200:g=-10
  3734. @end example
  3735. @item
  3736. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3737. @example
  3738. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3739. @end example
  3740. @end itemize
  3741. @subsection Commands
  3742. This filter supports the following commands:
  3743. @table @option
  3744. @item frequency, f
  3745. Change equalizer frequency.
  3746. Syntax for the command is : "@var{frequency}"
  3747. @item width_type, t
  3748. Change equalizer width_type.
  3749. Syntax for the command is : "@var{width_type}"
  3750. @item width, w
  3751. Change equalizer width.
  3752. Syntax for the command is : "@var{width}"
  3753. @item gain, g
  3754. Change equalizer gain.
  3755. Syntax for the command is : "@var{gain}"
  3756. @item mix, m
  3757. Change equalizer mix.
  3758. Syntax for the command is : "@var{mix}"
  3759. @end table
  3760. @section extrastereo
  3761. Linearly increases the difference between left and right channels which
  3762. adds some sort of "live" effect to playback.
  3763. The filter accepts the following options:
  3764. @table @option
  3765. @item m
  3766. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3767. (average of both channels), with 1.0 sound will be unchanged, with
  3768. -1.0 left and right channels will be swapped.
  3769. @item c
  3770. Enable clipping. By default is enabled.
  3771. @end table
  3772. @subsection Commands
  3773. This filter supports the all above options as @ref{commands}.
  3774. @section firequalizer
  3775. Apply FIR Equalization using arbitrary frequency response.
  3776. The filter accepts the following option:
  3777. @table @option
  3778. @item gain
  3779. Set gain curve equation (in dB). The expression can contain variables:
  3780. @table @option
  3781. @item f
  3782. the evaluated frequency
  3783. @item sr
  3784. sample rate
  3785. @item ch
  3786. channel number, set to 0 when multichannels evaluation is disabled
  3787. @item chid
  3788. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3789. multichannels evaluation is disabled
  3790. @item chs
  3791. number of channels
  3792. @item chlayout
  3793. channel_layout, see libavutil/channel_layout.h
  3794. @end table
  3795. and functions:
  3796. @table @option
  3797. @item gain_interpolate(f)
  3798. interpolate gain on frequency f based on gain_entry
  3799. @item cubic_interpolate(f)
  3800. same as gain_interpolate, but smoother
  3801. @end table
  3802. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3803. @item gain_entry
  3804. Set gain entry for gain_interpolate function. The expression can
  3805. contain functions:
  3806. @table @option
  3807. @item entry(f, g)
  3808. store gain entry at frequency f with value g
  3809. @end table
  3810. This option is also available as command.
  3811. @item delay
  3812. Set filter delay in seconds. Higher value means more accurate.
  3813. Default is @code{0.01}.
  3814. @item accuracy
  3815. Set filter accuracy in Hz. Lower value means more accurate.
  3816. Default is @code{5}.
  3817. @item wfunc
  3818. Set window function. Acceptable values are:
  3819. @table @option
  3820. @item rectangular
  3821. rectangular window, useful when gain curve is already smooth
  3822. @item hann
  3823. hann window (default)
  3824. @item hamming
  3825. hamming window
  3826. @item blackman
  3827. blackman window
  3828. @item nuttall3
  3829. 3-terms continuous 1st derivative nuttall window
  3830. @item mnuttall3
  3831. minimum 3-terms discontinuous nuttall window
  3832. @item nuttall
  3833. 4-terms continuous 1st derivative nuttall window
  3834. @item bnuttall
  3835. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3836. @item bharris
  3837. blackman-harris window
  3838. @item tukey
  3839. tukey window
  3840. @end table
  3841. @item fixed
  3842. If enabled, use fixed number of audio samples. This improves speed when
  3843. filtering with large delay. Default is disabled.
  3844. @item multi
  3845. Enable multichannels evaluation on gain. Default is disabled.
  3846. @item zero_phase
  3847. Enable zero phase mode by subtracting timestamp to compensate delay.
  3848. Default is disabled.
  3849. @item scale
  3850. Set scale used by gain. Acceptable values are:
  3851. @table @option
  3852. @item linlin
  3853. linear frequency, linear gain
  3854. @item linlog
  3855. linear frequency, logarithmic (in dB) gain (default)
  3856. @item loglin
  3857. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3858. @item loglog
  3859. logarithmic frequency, logarithmic gain
  3860. @end table
  3861. @item dumpfile
  3862. Set file for dumping, suitable for gnuplot.
  3863. @item dumpscale
  3864. Set scale for dumpfile. Acceptable values are same with scale option.
  3865. Default is linlog.
  3866. @item fft2
  3867. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3868. Default is disabled.
  3869. @item min_phase
  3870. Enable minimum phase impulse response. Default is disabled.
  3871. @end table
  3872. @subsection Examples
  3873. @itemize
  3874. @item
  3875. lowpass at 1000 Hz:
  3876. @example
  3877. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3878. @end example
  3879. @item
  3880. lowpass at 1000 Hz with gain_entry:
  3881. @example
  3882. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3883. @end example
  3884. @item
  3885. custom equalization:
  3886. @example
  3887. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3888. @end example
  3889. @item
  3890. higher delay with zero phase to compensate delay:
  3891. @example
  3892. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3893. @end example
  3894. @item
  3895. lowpass on left channel, highpass on right channel:
  3896. @example
  3897. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3898. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3899. @end example
  3900. @end itemize
  3901. @section flanger
  3902. Apply a flanging effect to the audio.
  3903. The filter accepts the following options:
  3904. @table @option
  3905. @item delay
  3906. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3907. @item depth
  3908. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3909. @item regen
  3910. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3911. Default value is 0.
  3912. @item width
  3913. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3914. Default value is 71.
  3915. @item speed
  3916. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3917. @item shape
  3918. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3919. Default value is @var{sinusoidal}.
  3920. @item phase
  3921. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3922. Default value is 25.
  3923. @item interp
  3924. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3925. Default is @var{linear}.
  3926. @end table
  3927. @section haas
  3928. Apply Haas effect to audio.
  3929. Note that this makes most sense to apply on mono signals.
  3930. With this filter applied to mono signals it give some directionality and
  3931. stretches its stereo image.
  3932. The filter accepts the following options:
  3933. @table @option
  3934. @item level_in
  3935. Set input level. By default is @var{1}, or 0dB
  3936. @item level_out
  3937. Set output level. By default is @var{1}, or 0dB.
  3938. @item side_gain
  3939. Set gain applied to side part of signal. By default is @var{1}.
  3940. @item middle_source
  3941. Set kind of middle source. Can be one of the following:
  3942. @table @samp
  3943. @item left
  3944. Pick left channel.
  3945. @item right
  3946. Pick right channel.
  3947. @item mid
  3948. Pick middle part signal of stereo image.
  3949. @item side
  3950. Pick side part signal of stereo image.
  3951. @end table
  3952. @item middle_phase
  3953. Change middle phase. By default is disabled.
  3954. @item left_delay
  3955. Set left channel delay. By default is @var{2.05} milliseconds.
  3956. @item left_balance
  3957. Set left channel balance. By default is @var{-1}.
  3958. @item left_gain
  3959. Set left channel gain. By default is @var{1}.
  3960. @item left_phase
  3961. Change left phase. By default is disabled.
  3962. @item right_delay
  3963. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3964. @item right_balance
  3965. Set right channel balance. By default is @var{1}.
  3966. @item right_gain
  3967. Set right channel gain. By default is @var{1}.
  3968. @item right_phase
  3969. Change right phase. By default is enabled.
  3970. @end table
  3971. @section hdcd
  3972. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3973. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3974. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3975. of HDCD, and detects the Transient Filter flag.
  3976. @example
  3977. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3978. @end example
  3979. When using the filter with wav, note the default encoding for wav is 16-bit,
  3980. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3981. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3982. @example
  3983. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3984. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3985. @end example
  3986. The filter accepts the following options:
  3987. @table @option
  3988. @item disable_autoconvert
  3989. Disable any automatic format conversion or resampling in the filter graph.
  3990. @item process_stereo
  3991. Process the stereo channels together. If target_gain does not match between
  3992. channels, consider it invalid and use the last valid target_gain.
  3993. @item cdt_ms
  3994. Set the code detect timer period in ms.
  3995. @item force_pe
  3996. Always extend peaks above -3dBFS even if PE isn't signaled.
  3997. @item analyze_mode
  3998. Replace audio with a solid tone and adjust the amplitude to signal some
  3999. specific aspect of the decoding process. The output file can be loaded in
  4000. an audio editor alongside the original to aid analysis.
  4001. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  4002. Modes are:
  4003. @table @samp
  4004. @item 0, off
  4005. Disabled
  4006. @item 1, lle
  4007. Gain adjustment level at each sample
  4008. @item 2, pe
  4009. Samples where peak extend occurs
  4010. @item 3, cdt
  4011. Samples where the code detect timer is active
  4012. @item 4, tgm
  4013. Samples where the target gain does not match between channels
  4014. @end table
  4015. @end table
  4016. @section headphone
  4017. Apply head-related transfer functions (HRTFs) to create virtual
  4018. loudspeakers around the user for binaural listening via headphones.
  4019. The HRIRs are provided via additional streams, for each channel
  4020. one stereo input stream is needed.
  4021. The filter accepts the following options:
  4022. @table @option
  4023. @item map
  4024. Set mapping of input streams for convolution.
  4025. The argument is a '|'-separated list of channel names in order as they
  4026. are given as additional stream inputs for filter.
  4027. This also specify number of input streams. Number of input streams
  4028. must be not less than number of channels in first stream plus one.
  4029. @item gain
  4030. Set gain applied to audio. Value is in dB. Default is 0.
  4031. @item type
  4032. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4033. processing audio in time domain which is slow.
  4034. @var{freq} is processing audio in frequency domain which is fast.
  4035. Default is @var{freq}.
  4036. @item lfe
  4037. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4038. @item size
  4039. Set size of frame in number of samples which will be processed at once.
  4040. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  4041. @item hrir
  4042. Set format of hrir stream.
  4043. Default value is @var{stereo}. Alternative value is @var{multich}.
  4044. If value is set to @var{stereo}, number of additional streams should
  4045. be greater or equal to number of input channels in first input stream.
  4046. Also each additional stream should have stereo number of channels.
  4047. If value is set to @var{multich}, number of additional streams should
  4048. be exactly one. Also number of input channels of additional stream
  4049. should be equal or greater than twice number of channels of first input
  4050. stream.
  4051. @end table
  4052. @subsection Examples
  4053. @itemize
  4054. @item
  4055. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4056. each amovie filter use stereo file with IR coefficients as input.
  4057. The files give coefficients for each position of virtual loudspeaker:
  4058. @example
  4059. ffmpeg -i input.wav
  4060. -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"
  4061. output.wav
  4062. @end example
  4063. @item
  4064. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4065. but now in @var{multich} @var{hrir} format.
  4066. @example
  4067. 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"
  4068. output.wav
  4069. @end example
  4070. @end itemize
  4071. @section highpass
  4072. Apply a high-pass filter with 3dB point frequency.
  4073. The filter can be either single-pole, or double-pole (the default).
  4074. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4075. The filter accepts the following options:
  4076. @table @option
  4077. @item frequency, f
  4078. Set frequency in Hz. Default is 3000.
  4079. @item poles, p
  4080. Set number of poles. Default is 2.
  4081. @item width_type, t
  4082. Set method to specify band-width of filter.
  4083. @table @option
  4084. @item h
  4085. Hz
  4086. @item q
  4087. Q-Factor
  4088. @item o
  4089. octave
  4090. @item s
  4091. slope
  4092. @item k
  4093. kHz
  4094. @end table
  4095. @item width, w
  4096. Specify the band-width of a filter in width_type units.
  4097. Applies only to double-pole filter.
  4098. The default is 0.707q and gives a Butterworth response.
  4099. @item mix, m
  4100. How much to use filtered signal in output. Default is 1.
  4101. Range is between 0 and 1.
  4102. @item channels, c
  4103. Specify which channels to filter, by default all available are filtered.
  4104. @item normalize, n
  4105. Normalize biquad coefficients, by default is disabled.
  4106. Enabling it will normalize magnitude response at DC to 0dB.
  4107. @item transform, a
  4108. Set transform type of IIR filter.
  4109. @table @option
  4110. @item di
  4111. @item dii
  4112. @item tdi
  4113. @item tdii
  4114. @item latt
  4115. @item svf
  4116. @item zdf
  4117. @end table
  4118. @item precision, r
  4119. Set precison of filtering.
  4120. @table @option
  4121. @item auto
  4122. Pick automatic sample format depending on surround filters.
  4123. @item s16
  4124. Always use signed 16-bit.
  4125. @item s32
  4126. Always use signed 32-bit.
  4127. @item f32
  4128. Always use float 32-bit.
  4129. @item f64
  4130. Always use float 64-bit.
  4131. @end table
  4132. @item block_size, b
  4133. Set block size used for reverse IIR processing. If this value is set to high enough
  4134. value (higher than impulse response length truncated when reaches near zero values) filtering
  4135. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4136. Note that filter delay will be exactly this many samples when set to non-zero value.
  4137. @end table
  4138. @subsection Commands
  4139. This filter supports the following commands:
  4140. @table @option
  4141. @item frequency, f
  4142. Change highpass frequency.
  4143. Syntax for the command is : "@var{frequency}"
  4144. @item width_type, t
  4145. Change highpass width_type.
  4146. Syntax for the command is : "@var{width_type}"
  4147. @item width, w
  4148. Change highpass width.
  4149. Syntax for the command is : "@var{width}"
  4150. @item mix, m
  4151. Change highpass mix.
  4152. Syntax for the command is : "@var{mix}"
  4153. @end table
  4154. @section join
  4155. Join multiple input streams into one multi-channel stream.
  4156. It accepts the following parameters:
  4157. @table @option
  4158. @item inputs
  4159. The number of input streams. It defaults to 2.
  4160. @item channel_layout
  4161. The desired output channel layout. It defaults to stereo.
  4162. @item map
  4163. Map channels from inputs to output. The argument is a '|'-separated list of
  4164. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  4165. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  4166. can be either the name of the input channel (e.g. FL for front left) or its
  4167. index in the specified input stream. @var{out_channel} is the name of the output
  4168. channel.
  4169. @end table
  4170. The filter will attempt to guess the mappings when they are not specified
  4171. explicitly. It does so by first trying to find an unused matching input channel
  4172. and if that fails it picks the first unused input channel.
  4173. Join 3 inputs (with properly set channel layouts):
  4174. @example
  4175. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  4176. @end example
  4177. Build a 5.1 output from 6 single-channel streams:
  4178. @example
  4179. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  4180. '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'
  4181. out
  4182. @end example
  4183. @section ladspa
  4184. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  4185. To enable compilation of this filter you need to configure FFmpeg with
  4186. @code{--enable-ladspa}.
  4187. @table @option
  4188. @item file, f
  4189. Specifies the name of LADSPA plugin library to load. If the environment
  4190. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  4191. each one of the directories specified by the colon separated list in
  4192. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  4193. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  4194. @file{/usr/lib/ladspa/}.
  4195. @item plugin, p
  4196. Specifies the plugin within the library. Some libraries contain only
  4197. one plugin, but others contain many of them. If this is not set filter
  4198. will list all available plugins within the specified library.
  4199. @item controls, c
  4200. Set the '|' separated list of controls which are zero or more floating point
  4201. values that determine the behavior of the loaded plugin (for example delay,
  4202. threshold or gain).
  4203. Controls need to be defined using the following syntax:
  4204. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  4205. @var{valuei} is the value set on the @var{i}-th control.
  4206. Alternatively they can be also defined using the following syntax:
  4207. @var{value0}|@var{value1}|@var{value2}|..., where
  4208. @var{valuei} is the value set on the @var{i}-th control.
  4209. If @option{controls} is set to @code{help}, all available controls and
  4210. their valid ranges are printed.
  4211. @item sample_rate, s
  4212. Specify the sample rate, default to 44100. Only used if plugin have
  4213. zero inputs.
  4214. @item nb_samples, n
  4215. Set the number of samples per channel per each output frame, default
  4216. is 1024. Only used if plugin have zero inputs.
  4217. @item duration, d
  4218. Set the minimum duration of the sourced audio. See
  4219. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4220. for the accepted syntax.
  4221. Note that the resulting duration may be greater than the specified duration,
  4222. as the generated audio is always cut at the end of a complete frame.
  4223. If not specified, or the expressed duration is negative, the audio is
  4224. supposed to be generated forever.
  4225. Only used if plugin have zero inputs.
  4226. @item latency, l
  4227. Enable latency compensation, by default is disabled.
  4228. Only used if plugin have inputs.
  4229. @end table
  4230. @subsection Examples
  4231. @itemize
  4232. @item
  4233. List all available plugins within amp (LADSPA example plugin) library:
  4234. @example
  4235. ladspa=file=amp
  4236. @end example
  4237. @item
  4238. List all available controls and their valid ranges for @code{vcf_notch}
  4239. plugin from @code{VCF} library:
  4240. @example
  4241. ladspa=f=vcf:p=vcf_notch:c=help
  4242. @end example
  4243. @item
  4244. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4245. plugin library:
  4246. @example
  4247. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4248. @end example
  4249. @item
  4250. Add reverberation to the audio using TAP-plugins
  4251. (Tom's Audio Processing plugins):
  4252. @example
  4253. ladspa=file=tap_reverb:tap_reverb
  4254. @end example
  4255. @item
  4256. Generate white noise, with 0.2 amplitude:
  4257. @example
  4258. ladspa=file=cmt:noise_source_white:c=c0=.2
  4259. @end example
  4260. @item
  4261. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4262. @code{C* Audio Plugin Suite} (CAPS) library:
  4263. @example
  4264. ladspa=file=caps:Click:c=c1=20'
  4265. @end example
  4266. @item
  4267. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4268. @example
  4269. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4270. @end example
  4271. @item
  4272. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4273. @code{SWH Plugins} collection:
  4274. @example
  4275. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4276. @end example
  4277. @item
  4278. Attenuate low frequencies using Multiband EQ from Steve Harris
  4279. @code{SWH Plugins} collection:
  4280. @example
  4281. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4282. @end example
  4283. @item
  4284. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4285. (CAPS) library:
  4286. @example
  4287. ladspa=caps:Narrower
  4288. @end example
  4289. @item
  4290. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4291. @example
  4292. ladspa=caps:White:.2
  4293. @end example
  4294. @item
  4295. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4296. @example
  4297. ladspa=caps:Fractal:c=c1=1
  4298. @end example
  4299. @item
  4300. Dynamic volume normalization using @code{VLevel} plugin:
  4301. @example
  4302. ladspa=vlevel-ladspa:vlevel_mono
  4303. @end example
  4304. @end itemize
  4305. @subsection Commands
  4306. This filter supports the following commands:
  4307. @table @option
  4308. @item cN
  4309. Modify the @var{N}-th control value.
  4310. If the specified value is not valid, it is ignored and prior one is kept.
  4311. @end table
  4312. @section loudnorm
  4313. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4314. Support for both single pass (livestreams, files) and double pass (files) modes.
  4315. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4316. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4317. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4318. The filter accepts the following options:
  4319. @table @option
  4320. @item I, i
  4321. Set integrated loudness target.
  4322. Range is -70.0 - -5.0. Default value is -24.0.
  4323. @item LRA, lra
  4324. Set loudness range target.
  4325. Range is 1.0 - 50.0. Default value is 7.0.
  4326. @item TP, tp
  4327. Set maximum true peak.
  4328. Range is -9.0 - +0.0. Default value is -2.0.
  4329. @item measured_I, measured_i
  4330. Measured IL of input file.
  4331. Range is -99.0 - +0.0.
  4332. @item measured_LRA, measured_lra
  4333. Measured LRA of input file.
  4334. Range is 0.0 - 99.0.
  4335. @item measured_TP, measured_tp
  4336. Measured true peak of input file.
  4337. Range is -99.0 - +99.0.
  4338. @item measured_thresh
  4339. Measured threshold of input file.
  4340. Range is -99.0 - +0.0.
  4341. @item offset
  4342. Set offset gain. Gain is applied before the true-peak limiter.
  4343. Range is -99.0 - +99.0. Default is +0.0.
  4344. @item linear
  4345. Normalize by linearly scaling the source audio.
  4346. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4347. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4348. be lower than source LRA and the change in integrated loudness shouldn't
  4349. result in a true peak which exceeds the target TP. If any of these
  4350. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4351. Options are @code{true} or @code{false}. Default is @code{true}.
  4352. @item dual_mono
  4353. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4354. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4355. If set to @code{true}, this option will compensate for this effect.
  4356. Multi-channel input files are not affected by this option.
  4357. Options are true or false. Default is false.
  4358. @item print_format
  4359. Set print format for stats. Options are summary, json, or none.
  4360. Default value is none.
  4361. @end table
  4362. @section lowpass
  4363. Apply a low-pass filter with 3dB point frequency.
  4364. The filter can be either single-pole or double-pole (the default).
  4365. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4366. The filter accepts the following options:
  4367. @table @option
  4368. @item frequency, f
  4369. Set frequency in Hz. Default is 500.
  4370. @item poles, p
  4371. Set number of poles. Default is 2.
  4372. @item width_type, t
  4373. Set method to specify band-width of filter.
  4374. @table @option
  4375. @item h
  4376. Hz
  4377. @item q
  4378. Q-Factor
  4379. @item o
  4380. octave
  4381. @item s
  4382. slope
  4383. @item k
  4384. kHz
  4385. @end table
  4386. @item width, w
  4387. Specify the band-width of a filter in width_type units.
  4388. Applies only to double-pole filter.
  4389. The default is 0.707q and gives a Butterworth response.
  4390. @item mix, m
  4391. How much to use filtered signal in output. Default is 1.
  4392. Range is between 0 and 1.
  4393. @item channels, c
  4394. Specify which channels to filter, by default all available are filtered.
  4395. @item normalize, n
  4396. Normalize biquad coefficients, by default is disabled.
  4397. Enabling it will normalize magnitude response at DC to 0dB.
  4398. @item transform, a
  4399. Set transform type of IIR filter.
  4400. @table @option
  4401. @item di
  4402. @item dii
  4403. @item tdi
  4404. @item tdii
  4405. @item latt
  4406. @item svf
  4407. @item zdf
  4408. @end table
  4409. @item precision, r
  4410. Set precison of filtering.
  4411. @table @option
  4412. @item auto
  4413. Pick automatic sample format depending on surround filters.
  4414. @item s16
  4415. Always use signed 16-bit.
  4416. @item s32
  4417. Always use signed 32-bit.
  4418. @item f32
  4419. Always use float 32-bit.
  4420. @item f64
  4421. Always use float 64-bit.
  4422. @end table
  4423. @item block_size, b
  4424. Set block size used for reverse IIR processing. If this value is set to high enough
  4425. value (higher than impulse response length truncated when reaches near zero values) filtering
  4426. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4427. Note that filter delay will be exactly this many samples when set to non-zero value.
  4428. @end table
  4429. @subsection Examples
  4430. @itemize
  4431. @item
  4432. Lowpass only LFE channel, it LFE is not present it does nothing:
  4433. @example
  4434. lowpass=c=LFE
  4435. @end example
  4436. @end itemize
  4437. @subsection Commands
  4438. This filter supports the following commands:
  4439. @table @option
  4440. @item frequency, f
  4441. Change lowpass frequency.
  4442. Syntax for the command is : "@var{frequency}"
  4443. @item width_type, t
  4444. Change lowpass width_type.
  4445. Syntax for the command is : "@var{width_type}"
  4446. @item width, w
  4447. Change lowpass width.
  4448. Syntax for the command is : "@var{width}"
  4449. @item mix, m
  4450. Change lowpass mix.
  4451. Syntax for the command is : "@var{mix}"
  4452. @end table
  4453. @section lv2
  4454. Load a LV2 (LADSPA Version 2) plugin.
  4455. To enable compilation of this filter you need to configure FFmpeg with
  4456. @code{--enable-lv2}.
  4457. @table @option
  4458. @item plugin, p
  4459. Specifies the plugin URI. You may need to escape ':'.
  4460. @item controls, c
  4461. Set the '|' separated list of controls which are zero or more floating point
  4462. values that determine the behavior of the loaded plugin (for example delay,
  4463. threshold or gain).
  4464. If @option{controls} is set to @code{help}, all available controls and
  4465. their valid ranges are printed.
  4466. @item sample_rate, s
  4467. Specify the sample rate, default to 44100. Only used if plugin have
  4468. zero inputs.
  4469. @item nb_samples, n
  4470. Set the number of samples per channel per each output frame, default
  4471. is 1024. Only used if plugin have zero inputs.
  4472. @item duration, d
  4473. Set the minimum duration of the sourced audio. See
  4474. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4475. for the accepted syntax.
  4476. Note that the resulting duration may be greater than the specified duration,
  4477. as the generated audio is always cut at the end of a complete frame.
  4478. If not specified, or the expressed duration is negative, the audio is
  4479. supposed to be generated forever.
  4480. Only used if plugin have zero inputs.
  4481. @end table
  4482. @subsection Examples
  4483. @itemize
  4484. @item
  4485. Apply bass enhancer plugin from Calf:
  4486. @example
  4487. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4488. @end example
  4489. @item
  4490. Apply vinyl plugin from Calf:
  4491. @example
  4492. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4493. @end example
  4494. @item
  4495. Apply bit crusher plugin from ArtyFX:
  4496. @example
  4497. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4498. @end example
  4499. @end itemize
  4500. @subsection Commands
  4501. This filter supports all options that are exported by plugin as commands.
  4502. @section mcompand
  4503. Multiband Compress or expand the audio's dynamic range.
  4504. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4505. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4506. response when absent compander action.
  4507. It accepts the following parameters:
  4508. @table @option
  4509. @item args
  4510. This option syntax is:
  4511. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4512. For explanation of each item refer to compand filter documentation.
  4513. @end table
  4514. @anchor{pan}
  4515. @section pan
  4516. Mix channels with specific gain levels. The filter accepts the output
  4517. channel layout followed by a set of channels definitions.
  4518. This filter is also designed to efficiently remap the channels of an audio
  4519. stream.
  4520. The filter accepts parameters of the form:
  4521. "@var{l}|@var{outdef}|@var{outdef}|..."
  4522. @table @option
  4523. @item l
  4524. output channel layout or number of channels
  4525. @item outdef
  4526. output channel specification, of the form:
  4527. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4528. @item out_name
  4529. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4530. number (c0, c1, etc.)
  4531. @item gain
  4532. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4533. @item in_name
  4534. input channel to use, see out_name for details; it is not possible to mix
  4535. named and numbered input channels
  4536. @end table
  4537. If the `=' in a channel specification is replaced by `<', then the gains for
  4538. that specification will be renormalized so that the total is 1, thus
  4539. avoiding clipping noise.
  4540. @subsection Mixing examples
  4541. For example, if you want to down-mix from stereo to mono, but with a bigger
  4542. factor for the left channel:
  4543. @example
  4544. pan=1c|c0=0.9*c0+0.1*c1
  4545. @end example
  4546. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4547. 7-channels surround:
  4548. @example
  4549. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4550. @end example
  4551. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4552. that should be preferred (see "-ac" option) unless you have very specific
  4553. needs.
  4554. @subsection Remapping examples
  4555. The channel remapping will be effective if, and only if:
  4556. @itemize
  4557. @item gain coefficients are zeroes or ones,
  4558. @item only one input per channel output,
  4559. @end itemize
  4560. If all these conditions are satisfied, the filter will notify the user ("Pure
  4561. channel mapping detected"), and use an optimized and lossless method to do the
  4562. remapping.
  4563. For example, if you have a 5.1 source and want a stereo audio stream by
  4564. dropping the extra channels:
  4565. @example
  4566. pan="stereo| c0=FL | c1=FR"
  4567. @end example
  4568. Given the same source, you can also switch front left and front right channels
  4569. and keep the input channel layout:
  4570. @example
  4571. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4572. @end example
  4573. If the input is a stereo audio stream, you can mute the front left channel (and
  4574. still keep the stereo channel layout) with:
  4575. @example
  4576. pan="stereo|c1=c1"
  4577. @end example
  4578. Still with a stereo audio stream input, you can copy the right channel in both
  4579. front left and right:
  4580. @example
  4581. pan="stereo| c0=FR | c1=FR"
  4582. @end example
  4583. @section replaygain
  4584. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4585. outputs it unchanged.
  4586. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4587. @section resample
  4588. Convert the audio sample format, sample rate and channel layout. It is
  4589. not meant to be used directly.
  4590. @section rubberband
  4591. Apply time-stretching and pitch-shifting with librubberband.
  4592. To enable compilation of this filter, you need to configure FFmpeg with
  4593. @code{--enable-librubberband}.
  4594. The filter accepts the following options:
  4595. @table @option
  4596. @item tempo
  4597. Set tempo scale factor.
  4598. @item pitch
  4599. Set pitch scale factor.
  4600. @item transients
  4601. Set transients detector.
  4602. Possible values are:
  4603. @table @var
  4604. @item crisp
  4605. @item mixed
  4606. @item smooth
  4607. @end table
  4608. @item detector
  4609. Set detector.
  4610. Possible values are:
  4611. @table @var
  4612. @item compound
  4613. @item percussive
  4614. @item soft
  4615. @end table
  4616. @item phase
  4617. Set phase.
  4618. Possible values are:
  4619. @table @var
  4620. @item laminar
  4621. @item independent
  4622. @end table
  4623. @item window
  4624. Set processing window size.
  4625. Possible values are:
  4626. @table @var
  4627. @item standard
  4628. @item short
  4629. @item long
  4630. @end table
  4631. @item smoothing
  4632. Set smoothing.
  4633. Possible values are:
  4634. @table @var
  4635. @item off
  4636. @item on
  4637. @end table
  4638. @item formant
  4639. Enable formant preservation when shift pitching.
  4640. Possible values are:
  4641. @table @var
  4642. @item shifted
  4643. @item preserved
  4644. @end table
  4645. @item pitchq
  4646. Set pitch quality.
  4647. Possible values are:
  4648. @table @var
  4649. @item quality
  4650. @item speed
  4651. @item consistency
  4652. @end table
  4653. @item channels
  4654. Set channels.
  4655. Possible values are:
  4656. @table @var
  4657. @item apart
  4658. @item together
  4659. @end table
  4660. @end table
  4661. @subsection Commands
  4662. This filter supports the following commands:
  4663. @table @option
  4664. @item tempo
  4665. Change filter tempo scale factor.
  4666. Syntax for the command is : "@var{tempo}"
  4667. @item pitch
  4668. Change filter pitch scale factor.
  4669. Syntax for the command is : "@var{pitch}"
  4670. @end table
  4671. @section sidechaincompress
  4672. This filter acts like normal compressor but has the ability to compress
  4673. detected signal using second input signal.
  4674. It needs two input streams and returns one output stream.
  4675. First input stream will be processed depending on second stream signal.
  4676. The filtered signal then can be filtered with other filters in later stages of
  4677. processing. See @ref{pan} and @ref{amerge} filter.
  4678. The filter accepts the following options:
  4679. @table @option
  4680. @item level_in
  4681. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4682. @item mode
  4683. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4684. Default is @code{downward}.
  4685. @item threshold
  4686. If a signal of second stream raises above this level it will affect the gain
  4687. reduction of first stream.
  4688. By default is 0.125. Range is between 0.00097563 and 1.
  4689. @item ratio
  4690. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4691. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4692. Default is 2. Range is between 1 and 20.
  4693. @item attack
  4694. Amount of milliseconds the signal has to rise above the threshold before gain
  4695. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4696. @item release
  4697. Amount of milliseconds the signal has to fall below the threshold before
  4698. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4699. @item makeup
  4700. Set the amount by how much signal will be amplified after processing.
  4701. Default is 1. Range is from 1 to 64.
  4702. @item knee
  4703. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4704. Default is 2.82843. Range is between 1 and 8.
  4705. @item link
  4706. Choose if the @code{average} level between all channels of side-chain stream
  4707. or the louder(@code{maximum}) channel of side-chain stream affects the
  4708. reduction. Default is @code{average}.
  4709. @item detection
  4710. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4711. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4712. @item level_sc
  4713. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4714. @item mix
  4715. How much to use compressed signal in output. Default is 1.
  4716. Range is between 0 and 1.
  4717. @end table
  4718. @subsection Commands
  4719. This filter supports the all above options as @ref{commands}.
  4720. @subsection Examples
  4721. @itemize
  4722. @item
  4723. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4724. depending on the signal of 2nd input and later compressed signal to be
  4725. merged with 2nd input:
  4726. @example
  4727. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4728. @end example
  4729. @end itemize
  4730. @section sidechaingate
  4731. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4732. filter the detected signal before sending it to the gain reduction stage.
  4733. Normally a gate uses the full range signal to detect a level above the
  4734. threshold.
  4735. For example: If you cut all lower frequencies from your sidechain signal
  4736. the gate will decrease the volume of your track only if not enough highs
  4737. appear. With this technique you are able to reduce the resonation of a
  4738. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4739. guitar.
  4740. It needs two input streams and returns one output stream.
  4741. First input stream will be processed depending on second stream signal.
  4742. The filter accepts the following options:
  4743. @table @option
  4744. @item level_in
  4745. Set input level before filtering.
  4746. Default is 1. Allowed range is from 0.015625 to 64.
  4747. @item mode
  4748. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4749. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4750. will be amplified, expanding dynamic range in upward direction.
  4751. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4752. @item range
  4753. Set the level of gain reduction when the signal is below the threshold.
  4754. Default is 0.06125. Allowed range is from 0 to 1.
  4755. Setting this to 0 disables reduction and then filter behaves like expander.
  4756. @item threshold
  4757. If a signal rises above this level the gain reduction is released.
  4758. Default is 0.125. Allowed range is from 0 to 1.
  4759. @item ratio
  4760. Set a ratio about which the signal is reduced.
  4761. Default is 2. Allowed range is from 1 to 9000.
  4762. @item attack
  4763. Amount of milliseconds the signal has to rise above the threshold before gain
  4764. reduction stops.
  4765. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4766. @item release
  4767. Amount of milliseconds the signal has to fall below the threshold before the
  4768. reduction is increased again. Default is 250 milliseconds.
  4769. Allowed range is from 0.01 to 9000.
  4770. @item makeup
  4771. Set amount of amplification of signal after processing.
  4772. Default is 1. Allowed range is from 1 to 64.
  4773. @item knee
  4774. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4775. Default is 2.828427125. Allowed range is from 1 to 8.
  4776. @item detection
  4777. Choose if exact signal should be taken for detection or an RMS like one.
  4778. Default is rms. Can be peak or rms.
  4779. @item link
  4780. Choose if the average level between all channels or the louder channel affects
  4781. the reduction.
  4782. Default is average. Can be average or maximum.
  4783. @item level_sc
  4784. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4785. @end table
  4786. @subsection Commands
  4787. This filter supports the all above options as @ref{commands}.
  4788. @section silencedetect
  4789. Detect silence in an audio stream.
  4790. This filter logs a message when it detects that the input audio volume is less
  4791. or equal to a noise tolerance value for a duration greater or equal to the
  4792. minimum detected noise duration.
  4793. The printed times and duration are expressed in seconds. The
  4794. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4795. is set on the first frame whose timestamp equals or exceeds the detection
  4796. duration and it contains the timestamp of the first frame of the silence.
  4797. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4798. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4799. keys are set on the first frame after the silence. If @option{mono} is
  4800. enabled, and each channel is evaluated separately, the @code{.X}
  4801. suffixed keys are used, and @code{X} corresponds to the channel number.
  4802. The filter accepts the following options:
  4803. @table @option
  4804. @item noise, n
  4805. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4806. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4807. @item duration, d
  4808. Set silence duration until notification (default is 2 seconds). See
  4809. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4810. for the accepted syntax.
  4811. @item mono, m
  4812. Process each channel separately, instead of combined. By default is disabled.
  4813. @end table
  4814. @subsection Examples
  4815. @itemize
  4816. @item
  4817. Detect 5 seconds of silence with -50dB noise tolerance:
  4818. @example
  4819. silencedetect=n=-50dB:d=5
  4820. @end example
  4821. @item
  4822. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4823. tolerance in @file{silence.mp3}:
  4824. @example
  4825. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4826. @end example
  4827. @end itemize
  4828. @section silenceremove
  4829. Remove silence from the beginning, middle or end of the audio.
  4830. The filter accepts the following options:
  4831. @table @option
  4832. @item start_periods
  4833. This value is used to indicate if audio should be trimmed at beginning of
  4834. the audio. A value of zero indicates no silence should be trimmed from the
  4835. beginning. When specifying a non-zero value, it trims audio up until it
  4836. finds non-silence. Normally, when trimming silence from beginning of audio
  4837. the @var{start_periods} will be @code{1} but it can be increased to higher
  4838. values to trim all audio up to specific count of non-silence periods.
  4839. Default value is @code{0}.
  4840. @item start_duration
  4841. Specify the amount of time that non-silence must be detected before it stops
  4842. trimming audio. By increasing the duration, bursts of noises can be treated
  4843. as silence and trimmed off. Default value is @code{0}.
  4844. @item start_threshold
  4845. This indicates what sample value should be treated as silence. For digital
  4846. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4847. you may wish to increase the value to account for background noise.
  4848. Can be specified in dB (in case "dB" is appended to the specified value)
  4849. or amplitude ratio. Default value is @code{0}.
  4850. @item start_silence
  4851. Specify max duration of silence at beginning that will be kept after
  4852. trimming. Default is 0, which is equal to trimming all samples detected
  4853. as silence.
  4854. @item start_mode
  4855. Specify mode of detection of silence end in start of multi-channel audio.
  4856. Can be @var{any} or @var{all}. Default is @var{any}.
  4857. With @var{any}, any sample that is detected as non-silence will cause
  4858. stopped trimming of silence.
  4859. With @var{all}, only if all channels are detected as non-silence will cause
  4860. stopped trimming of silence.
  4861. @item stop_periods
  4862. Set the count for trimming silence from the end of audio.
  4863. To remove silence from the middle of a file, specify a @var{stop_periods}
  4864. that is negative. This value is then treated as a positive value and is
  4865. used to indicate the effect should restart processing as specified by
  4866. @var{start_periods}, making it suitable for removing periods of silence
  4867. in the middle of the audio.
  4868. Default value is @code{0}.
  4869. @item stop_duration
  4870. Specify a duration of silence that must exist before audio is not copied any
  4871. more. By specifying a higher duration, silence that is wanted can be left in
  4872. the audio.
  4873. Default value is @code{0}.
  4874. @item stop_threshold
  4875. This is the same as @option{start_threshold} but for trimming silence from
  4876. the end of audio.
  4877. Can be specified in dB (in case "dB" is appended to the specified value)
  4878. or amplitude ratio. Default value is @code{0}.
  4879. @item stop_silence
  4880. Specify max duration of silence at end that will be kept after
  4881. trimming. Default is 0, which is equal to trimming all samples detected
  4882. as silence.
  4883. @item stop_mode
  4884. Specify mode of detection of silence start in end of multi-channel audio.
  4885. Can be @var{any} or @var{all}. Default is @var{any}.
  4886. With @var{any}, any sample that is detected as non-silence will cause
  4887. stopped trimming of silence.
  4888. With @var{all}, only if all channels are detected as non-silence will cause
  4889. stopped trimming of silence.
  4890. @item detection
  4891. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4892. and works better with digital silence which is exactly 0.
  4893. Default value is @code{rms}.
  4894. @item window
  4895. Set duration in number of seconds used to calculate size of window in number
  4896. of samples for detecting silence.
  4897. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4898. @end table
  4899. @subsection Examples
  4900. @itemize
  4901. @item
  4902. The following example shows how this filter can be used to start a recording
  4903. that does not contain the delay at the start which usually occurs between
  4904. pressing the record button and the start of the performance:
  4905. @example
  4906. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4907. @end example
  4908. @item
  4909. Trim all silence encountered from beginning to end where there is more than 1
  4910. second of silence in audio:
  4911. @example
  4912. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4913. @end example
  4914. @item
  4915. Trim all digital silence samples, using peak detection, from beginning to end
  4916. where there is more than 0 samples of digital silence in audio and digital
  4917. silence is detected in all channels at same positions in stream:
  4918. @example
  4919. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4920. @end example
  4921. @end itemize
  4922. @section sofalizer
  4923. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4924. loudspeakers around the user for binaural listening via headphones (audio
  4925. formats up to 9 channels supported).
  4926. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4927. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4928. Austrian Academy of Sciences.
  4929. To enable compilation of this filter you need to configure FFmpeg with
  4930. @code{--enable-libmysofa}.
  4931. The filter accepts the following options:
  4932. @table @option
  4933. @item sofa
  4934. Set the SOFA file used for rendering.
  4935. @item gain
  4936. Set gain applied to audio. Value is in dB. Default is 0.
  4937. @item rotation
  4938. Set rotation of virtual loudspeakers in deg. Default is 0.
  4939. @item elevation
  4940. Set elevation of virtual speakers in deg. Default is 0.
  4941. @item radius
  4942. Set distance in meters between loudspeakers and the listener with near-field
  4943. HRTFs. Default is 1.
  4944. @item type
  4945. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4946. processing audio in time domain which is slow.
  4947. @var{freq} is processing audio in frequency domain which is fast.
  4948. Default is @var{freq}.
  4949. @item speakers
  4950. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4951. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4952. Each virtual loudspeaker is described with short channel name following with
  4953. azimuth and elevation in degrees.
  4954. Each virtual loudspeaker description is separated by '|'.
  4955. For example to override front left and front right channel positions use:
  4956. 'speakers=FL 45 15|FR 345 15'.
  4957. Descriptions with unrecognised channel names are ignored.
  4958. @item lfegain
  4959. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4960. @item framesize
  4961. Set custom frame size in number of samples. Default is 1024.
  4962. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4963. is set to @var{freq}.
  4964. @item normalize
  4965. Should all IRs be normalized upon importing SOFA file.
  4966. By default is enabled.
  4967. @item interpolate
  4968. Should nearest IRs be interpolated with neighbor IRs if exact position
  4969. does not match. By default is disabled.
  4970. @item minphase
  4971. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4972. @item anglestep
  4973. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4974. @item radstep
  4975. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4976. @end table
  4977. @subsection Examples
  4978. @itemize
  4979. @item
  4980. Using ClubFritz6 sofa file:
  4981. @example
  4982. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4983. @end example
  4984. @item
  4985. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4986. @example
  4987. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4988. @end example
  4989. @item
  4990. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4991. and also with custom gain:
  4992. @example
  4993. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4994. @end example
  4995. @end itemize
  4996. @section speechnorm
  4997. Speech Normalizer.
  4998. This filter expands or compresses each half-cycle of audio samples
  4999. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  5000. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  5001. The filter accepts the following options:
  5002. @table @option
  5003. @item peak, p
  5004. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  5005. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  5006. @item expansion, e
  5007. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5008. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  5009. would be such that local peak value reaches target peak value but never to surpass it and that
  5010. ratio between new and previous peak value does not surpass this option value.
  5011. @item compression, c
  5012. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5013. This option controls maximum local half-cycle of samples compression. This option is used
  5014. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  5015. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  5016. that peak's half-cycle will be compressed by current compression factor.
  5017. @item threshold, t
  5018. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  5019. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  5020. Any half-cycle samples with their local peak value below or same as this option value will be
  5021. compressed by current compression factor, otherwise, if greater than threshold value they will be
  5022. expanded with expansion factor so that it could reach peak target value but never surpass it.
  5023. @item raise, r
  5024. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  5025. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  5026. each new half-cycle until it reaches @option{expansion} value.
  5027. Setting this options too high may lead to distortions.
  5028. @item fall, f
  5029. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  5030. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  5031. each new half-cycle until it reaches @option{compression} value.
  5032. @item channels, h
  5033. Specify which channels to filter, by default all available channels are filtered.
  5034. @item invert, i
  5035. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  5036. option. When enabled any half-cycle of samples with their local peak value below or same as
  5037. @option{threshold} option will be expanded otherwise it will be compressed.
  5038. @item link, l
  5039. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  5040. When disabled each filtered channel gain calculation is independent, otherwise when this option
  5041. is enabled the minimum of all possible gains for each filtered channel is used.
  5042. @item rms, m
  5043. Set the expansion target RMS value. This specifies the highest allowed RMS level for the normalized
  5044. audio input. Default value is 0.0, thus disabled. Allowed range is from 0.0 to 1.0.
  5045. @end table
  5046. @subsection Commands
  5047. This filter supports the all above options as @ref{commands}.
  5048. @subsection Examples
  5049. @itemize
  5050. @item
  5051. Weak and slow amplification:
  5052. @example
  5053. speechnorm=e=3:r=0.00001:l=1
  5054. @end example
  5055. @item
  5056. Moderate and slow amplification:
  5057. @example
  5058. speechnorm=e=6.25:r=0.00001:l=1
  5059. @end example
  5060. @item
  5061. Strong and fast amplification:
  5062. @example
  5063. speechnorm=e=12.5:r=0.0001:l=1
  5064. @end example
  5065. @item
  5066. Very strong and fast amplification:
  5067. @example
  5068. speechnorm=e=25:r=0.0001:l=1
  5069. @end example
  5070. @item
  5071. Extreme and fast amplification:
  5072. @example
  5073. speechnorm=e=50:r=0.0001:l=1
  5074. @end example
  5075. @end itemize
  5076. @section stereotools
  5077. This filter has some handy utilities to manage stereo signals, for converting
  5078. M/S stereo recordings to L/R signal while having control over the parameters
  5079. or spreading the stereo image of master track.
  5080. The filter accepts the following options:
  5081. @table @option
  5082. @item level_in
  5083. Set input level before filtering for both channels. Defaults is 1.
  5084. Allowed range is from 0.015625 to 64.
  5085. @item level_out
  5086. Set output level after filtering for both channels. Defaults is 1.
  5087. Allowed range is from 0.015625 to 64.
  5088. @item balance_in
  5089. Set input balance between both channels. Default is 0.
  5090. Allowed range is from -1 to 1.
  5091. @item balance_out
  5092. Set output balance between both channels. Default is 0.
  5093. Allowed range is from -1 to 1.
  5094. @item softclip
  5095. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  5096. clipping. Disabled by default.
  5097. @item mutel
  5098. Mute the left channel. Disabled by default.
  5099. @item muter
  5100. Mute the right channel. Disabled by default.
  5101. @item phasel
  5102. Change the phase of the left channel. Disabled by default.
  5103. @item phaser
  5104. Change the phase of the right channel. Disabled by default.
  5105. @item mode
  5106. Set stereo mode. Available values are:
  5107. @table @samp
  5108. @item lr>lr
  5109. Left/Right to Left/Right, this is default.
  5110. @item lr>ms
  5111. Left/Right to Mid/Side.
  5112. @item ms>lr
  5113. Mid/Side to Left/Right.
  5114. @item lr>ll
  5115. Left/Right to Left/Left.
  5116. @item lr>rr
  5117. Left/Right to Right/Right.
  5118. @item lr>l+r
  5119. Left/Right to Left + Right.
  5120. @item lr>rl
  5121. Left/Right to Right/Left.
  5122. @item ms>ll
  5123. Mid/Side to Left/Left.
  5124. @item ms>rr
  5125. Mid/Side to Right/Right.
  5126. @item ms>rl
  5127. Mid/Side to Right/Left.
  5128. @item lr>l-r
  5129. Left/Right to Left - Right.
  5130. @end table
  5131. @item slev
  5132. Set level of side signal. Default is 1.
  5133. Allowed range is from 0.015625 to 64.
  5134. @item sbal
  5135. Set balance of side signal. Default is 0.
  5136. Allowed range is from -1 to 1.
  5137. @item mlev
  5138. Set level of the middle signal. Default is 1.
  5139. Allowed range is from 0.015625 to 64.
  5140. @item mpan
  5141. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  5142. @item base
  5143. Set stereo base between mono and inversed channels. Default is 0.
  5144. Allowed range is from -1 to 1.
  5145. @item delay
  5146. Set delay in milliseconds how much to delay left from right channel and
  5147. vice versa. Default is 0. Allowed range is from -20 to 20.
  5148. @item sclevel
  5149. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  5150. @item phase
  5151. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  5152. @item bmode_in, bmode_out
  5153. Set balance mode for balance_in/balance_out option.
  5154. Can be one of the following:
  5155. @table @samp
  5156. @item balance
  5157. Classic balance mode. Attenuate one channel at time.
  5158. Gain is raised up to 1.
  5159. @item amplitude
  5160. Similar as classic mode above but gain is raised up to 2.
  5161. @item power
  5162. Equal power distribution, from -6dB to +6dB range.
  5163. @end table
  5164. @end table
  5165. @subsection Commands
  5166. This filter supports the all above options as @ref{commands}.
  5167. @subsection Examples
  5168. @itemize
  5169. @item
  5170. Apply karaoke like effect:
  5171. @example
  5172. stereotools=mlev=0.015625
  5173. @end example
  5174. @item
  5175. Convert M/S signal to L/R:
  5176. @example
  5177. "stereotools=mode=ms>lr"
  5178. @end example
  5179. @end itemize
  5180. @section stereowiden
  5181. This filter enhance the stereo effect by suppressing signal common to both
  5182. channels and by delaying the signal of left into right and vice versa,
  5183. thereby widening the stereo effect.
  5184. The filter accepts the following options:
  5185. @table @option
  5186. @item delay
  5187. Time in milliseconds of the delay of left signal into right and vice versa.
  5188. Default is 20 milliseconds.
  5189. @item feedback
  5190. Amount of gain in delayed signal into right and vice versa. Gives a delay
  5191. effect of left signal in right output and vice versa which gives widening
  5192. effect. Default is 0.3.
  5193. @item crossfeed
  5194. Cross feed of left into right with inverted phase. This helps in suppressing
  5195. the mono. If the value is 1 it will cancel all the signal common to both
  5196. channels. Default is 0.3.
  5197. @item drymix
  5198. Set level of input signal of original channel. Default is 0.8.
  5199. @end table
  5200. @subsection Commands
  5201. This filter supports the all above options except @code{delay} as @ref{commands}.
  5202. @section superequalizer
  5203. Apply 18 band equalizer.
  5204. The filter accepts the following options:
  5205. @table @option
  5206. @item 1b
  5207. Set 65Hz band gain.
  5208. @item 2b
  5209. Set 92Hz band gain.
  5210. @item 3b
  5211. Set 131Hz band gain.
  5212. @item 4b
  5213. Set 185Hz band gain.
  5214. @item 5b
  5215. Set 262Hz band gain.
  5216. @item 6b
  5217. Set 370Hz band gain.
  5218. @item 7b
  5219. Set 523Hz band gain.
  5220. @item 8b
  5221. Set 740Hz band gain.
  5222. @item 9b
  5223. Set 1047Hz band gain.
  5224. @item 10b
  5225. Set 1480Hz band gain.
  5226. @item 11b
  5227. Set 2093Hz band gain.
  5228. @item 12b
  5229. Set 2960Hz band gain.
  5230. @item 13b
  5231. Set 4186Hz band gain.
  5232. @item 14b
  5233. Set 5920Hz band gain.
  5234. @item 15b
  5235. Set 8372Hz band gain.
  5236. @item 16b
  5237. Set 11840Hz band gain.
  5238. @item 17b
  5239. Set 16744Hz band gain.
  5240. @item 18b
  5241. Set 20000Hz band gain.
  5242. @end table
  5243. @section surround
  5244. Apply audio surround upmix filter.
  5245. This filter allows to produce multichannel output from audio stream.
  5246. The filter accepts the following options:
  5247. @table @option
  5248. @item chl_out
  5249. Set output channel layout. By default, this is @var{5.1}.
  5250. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5251. for the required syntax.
  5252. @item chl_in
  5253. Set input channel layout. By default, this is @var{stereo}.
  5254. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5255. for the required syntax.
  5256. @item level_in
  5257. Set input volume level. By default, this is @var{1}.
  5258. @item level_out
  5259. Set output volume level. By default, this is @var{1}.
  5260. @item lfe
  5261. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5262. @item lfe_low
  5263. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5264. @item lfe_high
  5265. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5266. @item lfe_mode
  5267. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5268. In @var{add} mode, LFE channel is created from input audio and added to output.
  5269. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5270. also all non-LFE output channels are subtracted with output LFE channel.
  5271. @item smooth
  5272. Set temporal smoothness strength, used to gradually change factors when transforming
  5273. stereo sound in time. Allowed range is from @var{0.0} to @var{1.0}.
  5274. Useful to improve output quality with @var{focus} option values greater than @var{0.0}.
  5275. Default is @var{0.0}. Only values inside this range and without edges are effective.
  5276. @item angle
  5277. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5278. Default is @var{90}.
  5279. @item focus
  5280. Set focus of stereo surround transform, Allowed range is from @var{-1} to @var{1}.
  5281. Default is @var{0}.
  5282. @item fc_in
  5283. Set front center input volume. By default, this is @var{1}.
  5284. @item fc_out
  5285. Set front center output volume. By default, this is @var{1}.
  5286. @item fl_in
  5287. Set front left input volume. By default, this is @var{1}.
  5288. @item fl_out
  5289. Set front left output volume. By default, this is @var{1}.
  5290. @item fr_in
  5291. Set front right input volume. By default, this is @var{1}.
  5292. @item fr_out
  5293. Set front right output volume. By default, this is @var{1}.
  5294. @item sl_in
  5295. Set side left input volume. By default, this is @var{1}.
  5296. @item sl_out
  5297. Set side left output volume. By default, this is @var{1}.
  5298. @item sr_in
  5299. Set side right input volume. By default, this is @var{1}.
  5300. @item sr_out
  5301. Set side right output volume. By default, this is @var{1}.
  5302. @item bl_in
  5303. Set back left input volume. By default, this is @var{1}.
  5304. @item bl_out
  5305. Set back left output volume. By default, this is @var{1}.
  5306. @item br_in
  5307. Set back right input volume. By default, this is @var{1}.
  5308. @item br_out
  5309. Set back right output volume. By default, this is @var{1}.
  5310. @item bc_in
  5311. Set back center input volume. By default, this is @var{1}.
  5312. @item bc_out
  5313. Set back center output volume. By default, this is @var{1}.
  5314. @item lfe_in
  5315. Set LFE input volume. By default, this is @var{1}.
  5316. @item lfe_out
  5317. Set LFE output volume. By default, this is @var{1}.
  5318. @item allx
  5319. Set spread usage of stereo image across X axis for all channels.
  5320. Allowed range is from @var{-1} to @var{15}.
  5321. By default this value is negative @var{-1}, and thus unused.
  5322. @item ally
  5323. Set spread usage of stereo image across Y axis for all channels.
  5324. Allowed range is from @var{-1} to @var{15}.
  5325. By default this value is negative @var{-1}, and thus unused.
  5326. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5327. Set spread usage of stereo image across X axis for each channel.
  5328. Allowed range is from @var{0.06} to @var{15}.
  5329. By default this value is @var{0.5}.
  5330. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5331. Set spread usage of stereo image across Y axis for each channel.
  5332. Allowed range is from @var{0.06} to @var{15}.
  5333. By default this value is @var{0.5}.
  5334. @item win_size
  5335. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5336. @item win_func
  5337. Set window function.
  5338. It accepts the following values:
  5339. @table @samp
  5340. @item rect
  5341. @item bartlett
  5342. @item hann, hanning
  5343. @item hamming
  5344. @item blackman
  5345. @item welch
  5346. @item flattop
  5347. @item bharris
  5348. @item bnuttall
  5349. @item bhann
  5350. @item sine
  5351. @item nuttall
  5352. @item lanczos
  5353. @item gauss
  5354. @item tukey
  5355. @item dolph
  5356. @item cauchy
  5357. @item parzen
  5358. @item poisson
  5359. @item bohman
  5360. @item kaiser
  5361. @end table
  5362. Default is @code{hann}.
  5363. @item overlap
  5364. Set window overlap. If set to 1, the recommended overlap for selected
  5365. window function will be picked. Default is @code{0.5}.
  5366. @end table
  5367. @section tiltshelf
  5368. Boost or cut the lower frequencies and cut or boost higher frequencies
  5369. of the audio using a two-pole shelving filter with a response similar to
  5370. that of a standard hi-fi's tone-controls.
  5371. This is also known as shelving equalisation (EQ).
  5372. The filter accepts the following options:
  5373. @table @option
  5374. @item gain, g
  5375. Give the gain at 0 Hz. Its useful range is about -20
  5376. (for a large cut) to +20 (for a large boost).
  5377. Beware of clipping when using a positive gain.
  5378. @item frequency, f
  5379. Set the filter's central frequency and so can be used
  5380. to extend or reduce the frequency range to be boosted or cut.
  5381. The default value is @code{3000} Hz.
  5382. @item width_type, t
  5383. Set method to specify band-width of filter.
  5384. @table @option
  5385. @item h
  5386. Hz
  5387. @item q
  5388. Q-Factor
  5389. @item o
  5390. octave
  5391. @item s
  5392. slope
  5393. @item k
  5394. kHz
  5395. @end table
  5396. @item width, w
  5397. Determine how steep is the filter's shelf transition.
  5398. @item poles, p
  5399. Set number of poles. Default is 2.
  5400. @item mix, m
  5401. How much to use filtered signal in output. Default is 1.
  5402. Range is between 0 and 1.
  5403. @item channels, c
  5404. Specify which channels to filter, by default all available are filtered.
  5405. @item normalize, n
  5406. Normalize biquad coefficients, by default is disabled.
  5407. Enabling it will normalize magnitude response at DC to 0dB.
  5408. @item transform, a
  5409. Set transform type of IIR filter.
  5410. @table @option
  5411. @item di
  5412. @item dii
  5413. @item tdi
  5414. @item tdii
  5415. @item latt
  5416. @item svf
  5417. @item zdf
  5418. @end table
  5419. @item precision, r
  5420. Set precison of filtering.
  5421. @table @option
  5422. @item auto
  5423. Pick automatic sample format depending on surround filters.
  5424. @item s16
  5425. Always use signed 16-bit.
  5426. @item s32
  5427. Always use signed 32-bit.
  5428. @item f32
  5429. Always use float 32-bit.
  5430. @item f64
  5431. Always use float 64-bit.
  5432. @end table
  5433. @item block_size, b
  5434. Set block size used for reverse IIR processing. If this value is set to high enough
  5435. value (higher than impulse response length truncated when reaches near zero values) filtering
  5436. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5437. Note that filter delay will be exactly this many samples when set to non-zero value.
  5438. @end table
  5439. @subsection Commands
  5440. This filter supports some options as @ref{commands}.
  5441. @section treble, highshelf
  5442. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5443. shelving filter with a response similar to that of a standard
  5444. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5445. The filter accepts the following options:
  5446. @table @option
  5447. @item gain, g
  5448. Give the gain at whichever is the lower of ~22 kHz and the
  5449. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5450. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5451. @item frequency, f
  5452. Set the filter's central frequency and so can be used
  5453. to extend or reduce the frequency range to be boosted or cut.
  5454. The default value is @code{3000} Hz.
  5455. @item width_type, t
  5456. Set method to specify band-width of filter.
  5457. @table @option
  5458. @item h
  5459. Hz
  5460. @item q
  5461. Q-Factor
  5462. @item o
  5463. octave
  5464. @item s
  5465. slope
  5466. @item k
  5467. kHz
  5468. @end table
  5469. @item width, w
  5470. Determine how steep is the filter's shelf transition.
  5471. @item poles, p
  5472. Set number of poles. Default is 2.
  5473. @item mix, m
  5474. How much to use filtered signal in output. Default is 1.
  5475. Range is between 0 and 1.
  5476. @item channels, c
  5477. Specify which channels to filter, by default all available are filtered.
  5478. @item normalize, n
  5479. Normalize biquad coefficients, by default is disabled.
  5480. Enabling it will normalize magnitude response at DC to 0dB.
  5481. @item transform, a
  5482. Set transform type of IIR filter.
  5483. @table @option
  5484. @item di
  5485. @item dii
  5486. @item tdi
  5487. @item tdii
  5488. @item latt
  5489. @item svf
  5490. @item zdf
  5491. @end table
  5492. @item precision, r
  5493. Set precison of filtering.
  5494. @table @option
  5495. @item auto
  5496. Pick automatic sample format depending on surround filters.
  5497. @item s16
  5498. Always use signed 16-bit.
  5499. @item s32
  5500. Always use signed 32-bit.
  5501. @item f32
  5502. Always use float 32-bit.
  5503. @item f64
  5504. Always use float 64-bit.
  5505. @end table
  5506. @item block_size, b
  5507. Set block size used for reverse IIR processing. If this value is set to high enough
  5508. value (higher than impulse response length truncated when reaches near zero values) filtering
  5509. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5510. Note that filter delay will be exactly this many samples when set to non-zero value.
  5511. @end table
  5512. @subsection Commands
  5513. This filter supports the following commands:
  5514. @table @option
  5515. @item frequency, f
  5516. Change treble frequency.
  5517. Syntax for the command is : "@var{frequency}"
  5518. @item width_type, t
  5519. Change treble width_type.
  5520. Syntax for the command is : "@var{width_type}"
  5521. @item width, w
  5522. Change treble width.
  5523. Syntax for the command is : "@var{width}"
  5524. @item gain, g
  5525. Change treble gain.
  5526. Syntax for the command is : "@var{gain}"
  5527. @item mix, m
  5528. Change treble mix.
  5529. Syntax for the command is : "@var{mix}"
  5530. @end table
  5531. @section tremolo
  5532. Sinusoidal amplitude modulation.
  5533. The filter accepts the following options:
  5534. @table @option
  5535. @item f
  5536. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5537. (20 Hz or lower) will result in a tremolo effect.
  5538. This filter may also be used as a ring modulator by specifying
  5539. a modulation frequency higher than 20 Hz.
  5540. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5541. @item d
  5542. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5543. Default value is 0.5.
  5544. @end table
  5545. @section vibrato
  5546. Sinusoidal phase modulation.
  5547. The filter accepts the following options:
  5548. @table @option
  5549. @item f
  5550. Modulation frequency in Hertz.
  5551. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5552. @item d
  5553. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5554. Default value is 0.5.
  5555. @end table
  5556. @section virtualbass
  5557. Apply audio Virtual Bass filter.
  5558. This filter accepts stereo input and produce stereo with LFE (2.1) channels output.
  5559. The newly produced LFE channel have enhanced virtual bass originally obtained from both stereo channels.
  5560. This filter outputs front left and front right channels unchanged as available in stereo input.
  5561. The filter accepts the following options:
  5562. @table @option
  5563. @item cutoff
  5564. Set the virtual bass cutoff frequency. Default value is 250 Hz.
  5565. Allowed range is from 100 to 500 Hz.
  5566. @item strength
  5567. Set the virtual bass strength. Allowed range is from 0.5 to 3.
  5568. Default value is 3.
  5569. @end table
  5570. @section volume
  5571. Adjust the input audio volume.
  5572. It accepts the following parameters:
  5573. @table @option
  5574. @item volume
  5575. Set audio volume expression.
  5576. Output values are clipped to the maximum value.
  5577. The output audio volume is given by the relation:
  5578. @example
  5579. @var{output_volume} = @var{volume} * @var{input_volume}
  5580. @end example
  5581. The default value for @var{volume} is "1.0".
  5582. @item precision
  5583. This parameter represents the mathematical precision.
  5584. It determines which input sample formats will be allowed, which affects the
  5585. precision of the volume scaling.
  5586. @table @option
  5587. @item fixed
  5588. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5589. @item float
  5590. 32-bit floating-point; this limits input sample format to FLT. (default)
  5591. @item double
  5592. 64-bit floating-point; this limits input sample format to DBL.
  5593. @end table
  5594. @item replaygain
  5595. Choose the behaviour on encountering ReplayGain side data in input frames.
  5596. @table @option
  5597. @item drop
  5598. Remove ReplayGain side data, ignoring its contents (the default).
  5599. @item ignore
  5600. Ignore ReplayGain side data, but leave it in the frame.
  5601. @item track
  5602. Prefer the track gain, if present.
  5603. @item album
  5604. Prefer the album gain, if present.
  5605. @end table
  5606. @item replaygain_preamp
  5607. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5608. Default value for @var{replaygain_preamp} is 0.0.
  5609. @item replaygain_noclip
  5610. Prevent clipping by limiting the gain applied.
  5611. Default value for @var{replaygain_noclip} is 1.
  5612. @item eval
  5613. Set when the volume expression is evaluated.
  5614. It accepts the following values:
  5615. @table @samp
  5616. @item once
  5617. only evaluate expression once during the filter initialization, or
  5618. when the @samp{volume} command is sent
  5619. @item frame
  5620. evaluate expression for each incoming frame
  5621. @end table
  5622. Default value is @samp{once}.
  5623. @end table
  5624. The volume expression can contain the following parameters.
  5625. @table @option
  5626. @item n
  5627. frame number (starting at zero)
  5628. @item nb_channels
  5629. number of channels
  5630. @item nb_consumed_samples
  5631. number of samples consumed by the filter
  5632. @item nb_samples
  5633. number of samples in the current frame
  5634. @item pos
  5635. original frame position in the file
  5636. @item pts
  5637. frame PTS
  5638. @item sample_rate
  5639. sample rate
  5640. @item startpts
  5641. PTS at start of stream
  5642. @item startt
  5643. time at start of stream
  5644. @item t
  5645. frame time
  5646. @item tb
  5647. timestamp timebase
  5648. @item volume
  5649. last set volume value
  5650. @end table
  5651. Note that when @option{eval} is set to @samp{once} only the
  5652. @var{sample_rate} and @var{tb} variables are available, all other
  5653. variables will evaluate to NAN.
  5654. @subsection Commands
  5655. This filter supports the following commands:
  5656. @table @option
  5657. @item volume
  5658. Modify the volume expression.
  5659. The command accepts the same syntax of the corresponding option.
  5660. If the specified expression is not valid, it is kept at its current
  5661. value.
  5662. @end table
  5663. @subsection Examples
  5664. @itemize
  5665. @item
  5666. Halve the input audio volume:
  5667. @example
  5668. volume=volume=0.5
  5669. volume=volume=1/2
  5670. volume=volume=-6.0206dB
  5671. @end example
  5672. In all the above example the named key for @option{volume} can be
  5673. omitted, for example like in:
  5674. @example
  5675. volume=0.5
  5676. @end example
  5677. @item
  5678. Increase input audio power by 6 decibels using fixed-point precision:
  5679. @example
  5680. volume=volume=6dB:precision=fixed
  5681. @end example
  5682. @item
  5683. Fade volume after time 10 with an annihilation period of 5 seconds:
  5684. @example
  5685. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5686. @end example
  5687. @end itemize
  5688. @section volumedetect
  5689. Detect the volume of the input video.
  5690. The filter has no parameters. It supports only 16-bit signed integer samples,
  5691. so the input will be converted when needed. Statistics about the volume will
  5692. be printed in the log when the input stream end is reached.
  5693. In particular it will show the mean volume (root mean square), maximum
  5694. volume (on a per-sample basis), and the beginning of a histogram of the
  5695. registered volume values (from the maximum value to a cumulated 1/1000 of
  5696. the samples).
  5697. All volumes are in decibels relative to the maximum PCM value.
  5698. @subsection Examples
  5699. Here is an excerpt of the output:
  5700. @example
  5701. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5702. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5703. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5704. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5705. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5706. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5707. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5708. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5709. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5710. @end example
  5711. It means that:
  5712. @itemize
  5713. @item
  5714. The mean square energy is approximately -27 dB, or 10^-2.7.
  5715. @item
  5716. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5717. @item
  5718. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5719. @end itemize
  5720. In other words, raising the volume by +4 dB does not cause any clipping,
  5721. raising it by +5 dB causes clipping for 6 samples, etc.
  5722. @c man end AUDIO FILTERS
  5723. @chapter Audio Sources
  5724. @c man begin AUDIO SOURCES
  5725. Below is a description of the currently available audio sources.
  5726. @section abuffer
  5727. Buffer audio frames, and make them available to the filter chain.
  5728. This source is mainly intended for a programmatic use, in particular
  5729. through the interface defined in @file{libavfilter/buffersrc.h}.
  5730. It accepts the following parameters:
  5731. @table @option
  5732. @item time_base
  5733. The timebase which will be used for timestamps of submitted frames. It must be
  5734. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5735. @item sample_rate
  5736. The sample rate of the incoming audio buffers.
  5737. @item sample_fmt
  5738. The sample format of the incoming audio buffers.
  5739. Either a sample format name or its corresponding integer representation from
  5740. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5741. @item channel_layout
  5742. The channel layout of the incoming audio buffers.
  5743. Either a channel layout name from channel_layout_map in
  5744. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5745. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5746. @item channels
  5747. The number of channels of the incoming audio buffers.
  5748. If both @var{channels} and @var{channel_layout} are specified, then they
  5749. must be consistent.
  5750. @end table
  5751. @subsection Examples
  5752. @example
  5753. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  5754. @end example
  5755. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  5756. Since the sample format with name "s16p" corresponds to the number
  5757. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  5758. equivalent to:
  5759. @example
  5760. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  5761. @end example
  5762. @section aevalsrc
  5763. Generate an audio signal specified by an expression.
  5764. This source accepts in input one or more expressions (one for each
  5765. channel), which are evaluated and used to generate a corresponding
  5766. audio signal.
  5767. This source accepts the following options:
  5768. @table @option
  5769. @item exprs
  5770. Set the '|'-separated expressions list for each separate channel. In case the
  5771. @option{channel_layout} option is not specified, the selected channel layout
  5772. depends on the number of provided expressions. Otherwise the last
  5773. specified expression is applied to the remaining output channels.
  5774. @item channel_layout, c
  5775. Set the channel layout. The number of channels in the specified layout
  5776. must be equal to the number of specified expressions.
  5777. @item duration, d
  5778. Set the minimum duration of the sourced audio. See
  5779. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5780. for the accepted syntax.
  5781. Note that the resulting duration may be greater than the specified
  5782. duration, as the generated audio is always cut at the end of a
  5783. complete frame.
  5784. If not specified, or the expressed duration is negative, the audio is
  5785. supposed to be generated forever.
  5786. @item nb_samples, n
  5787. Set the number of samples per channel per each output frame,
  5788. default to 1024.
  5789. @item sample_rate, s
  5790. Specify the sample rate, default to 44100.
  5791. @end table
  5792. Each expression in @var{exprs} can contain the following constants:
  5793. @table @option
  5794. @item n
  5795. number of the evaluated sample, starting from 0
  5796. @item t
  5797. time of the evaluated sample expressed in seconds, starting from 0
  5798. @item s
  5799. sample rate
  5800. @end table
  5801. @subsection Examples
  5802. @itemize
  5803. @item
  5804. Generate silence:
  5805. @example
  5806. aevalsrc=0
  5807. @end example
  5808. @item
  5809. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5810. 8000 Hz:
  5811. @example
  5812. aevalsrc="sin(440*2*PI*t):s=8000"
  5813. @end example
  5814. @item
  5815. Generate a two channels signal, specify the channel layout (Front
  5816. Center + Back Center) explicitly:
  5817. @example
  5818. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5819. @end example
  5820. @item
  5821. Generate white noise:
  5822. @example
  5823. aevalsrc="-2+random(0)"
  5824. @end example
  5825. @item
  5826. Generate an amplitude modulated signal:
  5827. @example
  5828. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5829. @end example
  5830. @item
  5831. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5832. @example
  5833. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5834. @end example
  5835. @end itemize
  5836. @section afirsrc
  5837. Generate a FIR coefficients using frequency sampling method.
  5838. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5839. The filter accepts the following options:
  5840. @table @option
  5841. @item taps, t
  5842. Set number of filter coefficents in output audio stream.
  5843. Default value is 1025.
  5844. @item frequency, f
  5845. Set frequency points from where magnitude and phase are set.
  5846. This must be in non decreasing order, and first element must be 0, while last element
  5847. must be 1. Elements are separated by white spaces.
  5848. @item magnitude, m
  5849. Set magnitude value for every frequency point set by @option{frequency}.
  5850. Number of values must be same as number of frequency points.
  5851. Values are separated by white spaces.
  5852. @item phase, p
  5853. Set phase value for every frequency point set by @option{frequency}.
  5854. Number of values must be same as number of frequency points.
  5855. Values are separated by white spaces.
  5856. @item sample_rate, r
  5857. Set sample rate, default is 44100.
  5858. @item nb_samples, n
  5859. Set number of samples per each frame. Default is 1024.
  5860. @item win_func, w
  5861. Set window function. Default is blackman.
  5862. @end table
  5863. @section anullsrc
  5864. The null audio source, return unprocessed audio frames. It is mainly useful
  5865. as a template and to be employed in analysis / debugging tools, or as
  5866. the source for filters which ignore the input data (for example the sox
  5867. synth filter).
  5868. This source accepts the following options:
  5869. @table @option
  5870. @item channel_layout, cl
  5871. Specifies the channel layout, and can be either an integer or a string
  5872. representing a channel layout. The default value of @var{channel_layout}
  5873. is "stereo".
  5874. Check the channel_layout_map definition in
  5875. @file{libavutil/channel_layout.c} for the mapping between strings and
  5876. channel layout values.
  5877. @item sample_rate, r
  5878. Specifies the sample rate, and defaults to 44100.
  5879. @item nb_samples, n
  5880. Set the number of samples per requested frames.
  5881. @item duration, d
  5882. Set the duration of the sourced audio. See
  5883. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5884. for the accepted syntax.
  5885. If not specified, or the expressed duration is negative, the audio is
  5886. supposed to be generated forever.
  5887. @end table
  5888. @subsection Examples
  5889. @itemize
  5890. @item
  5891. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5892. @example
  5893. anullsrc=r=48000:cl=4
  5894. @end example
  5895. @item
  5896. Do the same operation with a more obvious syntax:
  5897. @example
  5898. anullsrc=r=48000:cl=mono
  5899. @end example
  5900. @end itemize
  5901. All the parameters need to be explicitly defined.
  5902. @section flite
  5903. Synthesize a voice utterance using the libflite library.
  5904. To enable compilation of this filter you need to configure FFmpeg with
  5905. @code{--enable-libflite}.
  5906. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5907. The filter accepts the following options:
  5908. @table @option
  5909. @item list_voices
  5910. If set to 1, list the names of the available voices and exit
  5911. immediately. Default value is 0.
  5912. @item nb_samples, n
  5913. Set the maximum number of samples per frame. Default value is 512.
  5914. @item textfile
  5915. Set the filename containing the text to speak.
  5916. @item text
  5917. Set the text to speak.
  5918. @item voice, v
  5919. Set the voice to use for the speech synthesis. Default value is
  5920. @code{kal}. See also the @var{list_voices} option.
  5921. @end table
  5922. @subsection Examples
  5923. @itemize
  5924. @item
  5925. Read from file @file{speech.txt}, and synthesize the text using the
  5926. standard flite voice:
  5927. @example
  5928. flite=textfile=speech.txt
  5929. @end example
  5930. @item
  5931. Read the specified text selecting the @code{slt} voice:
  5932. @example
  5933. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5934. @end example
  5935. @item
  5936. Input text to ffmpeg:
  5937. @example
  5938. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5939. @end example
  5940. @item
  5941. Make @file{ffplay} speak the specified text, using @code{flite} and
  5942. the @code{lavfi} device:
  5943. @example
  5944. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5945. @end example
  5946. @end itemize
  5947. For more information about libflite, check:
  5948. @url{http://www.festvox.org/flite/}
  5949. @section anoisesrc
  5950. Generate a noise audio signal.
  5951. The filter accepts the following options:
  5952. @table @option
  5953. @item sample_rate, r
  5954. Specify the sample rate. Default value is 48000 Hz.
  5955. @item amplitude, a
  5956. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5957. is 1.0.
  5958. @item duration, d
  5959. Specify the duration of the generated audio stream. Not specifying this option
  5960. results in noise with an infinite length.
  5961. @item color, colour, c
  5962. Specify the color of noise. Available noise colors are white, pink, brown,
  5963. blue, violet and velvet. Default color is white.
  5964. @item seed, s
  5965. Specify a value used to seed the PRNG.
  5966. @item nb_samples, n
  5967. Set the number of samples per each output frame, default is 1024.
  5968. @end table
  5969. @subsection Examples
  5970. @itemize
  5971. @item
  5972. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5973. @example
  5974. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5975. @end example
  5976. @end itemize
  5977. @section hilbert
  5978. Generate odd-tap Hilbert transform FIR coefficients.
  5979. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5980. the signal by 90 degrees.
  5981. This is used in many matrix coding schemes and for analytic signal generation.
  5982. The process is often written as a multiplication by i (or j), the imaginary unit.
  5983. The filter accepts the following options:
  5984. @table @option
  5985. @item sample_rate, s
  5986. Set sample rate, default is 44100.
  5987. @item taps, t
  5988. Set length of FIR filter, default is 22051.
  5989. @item nb_samples, n
  5990. Set number of samples per each frame.
  5991. @item win_func, w
  5992. Set window function to be used when generating FIR coefficients.
  5993. @end table
  5994. @section sinc
  5995. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5996. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5997. The filter accepts the following options:
  5998. @table @option
  5999. @item sample_rate, r
  6000. Set sample rate, default is 44100.
  6001. @item nb_samples, n
  6002. Set number of samples per each frame. Default is 1024.
  6003. @item hp
  6004. Set high-pass frequency. Default is 0.
  6005. @item lp
  6006. Set low-pass frequency. Default is 0.
  6007. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  6008. is higher than 0 then filter will create band-pass filter coefficients,
  6009. otherwise band-reject filter coefficients.
  6010. @item phase
  6011. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  6012. @item beta
  6013. Set Kaiser window beta.
  6014. @item att
  6015. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  6016. @item round
  6017. Enable rounding, by default is disabled.
  6018. @item hptaps
  6019. Set number of taps for high-pass filter.
  6020. @item lptaps
  6021. Set number of taps for low-pass filter.
  6022. @end table
  6023. @section sine
  6024. Generate an audio signal made of a sine wave with amplitude 1/8.
  6025. The audio signal is bit-exact.
  6026. The filter accepts the following options:
  6027. @table @option
  6028. @item frequency, f
  6029. Set the carrier frequency. Default is 440 Hz.
  6030. @item beep_factor, b
  6031. Enable a periodic beep every second with frequency @var{beep_factor} times
  6032. the carrier frequency. Default is 0, meaning the beep is disabled.
  6033. @item sample_rate, r
  6034. Specify the sample rate, default is 44100.
  6035. @item duration, d
  6036. Specify the duration of the generated audio stream.
  6037. @item samples_per_frame
  6038. Set the number of samples per output frame.
  6039. The expression can contain the following constants:
  6040. @table @option
  6041. @item n
  6042. The (sequential) number of the output audio frame, starting from 0.
  6043. @item pts
  6044. The PTS (Presentation TimeStamp) of the output audio frame,
  6045. expressed in @var{TB} units.
  6046. @item t
  6047. The PTS of the output audio frame, expressed in seconds.
  6048. @item TB
  6049. The timebase of the output audio frames.
  6050. @end table
  6051. Default is @code{1024}.
  6052. @end table
  6053. @subsection Examples
  6054. @itemize
  6055. @item
  6056. Generate a simple 440 Hz sine wave:
  6057. @example
  6058. sine
  6059. @end example
  6060. @item
  6061. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  6062. @example
  6063. sine=220:4:d=5
  6064. sine=f=220:b=4:d=5
  6065. sine=frequency=220:beep_factor=4:duration=5
  6066. @end example
  6067. @item
  6068. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  6069. pattern:
  6070. @example
  6071. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  6072. @end example
  6073. @end itemize
  6074. @c man end AUDIO SOURCES
  6075. @chapter Audio Sinks
  6076. @c man begin AUDIO SINKS
  6077. Below is a description of the currently available audio sinks.
  6078. @section abuffersink
  6079. Buffer audio frames, and make them available to the end of filter chain.
  6080. This sink is mainly intended for programmatic use, in particular
  6081. through the interface defined in @file{libavfilter/buffersink.h}
  6082. or the options system.
  6083. It accepts a pointer to an AVABufferSinkContext structure, which
  6084. defines the incoming buffers' formats, to be passed as the opaque
  6085. parameter to @code{avfilter_init_filter} for initialization.
  6086. @section anullsink
  6087. Null audio sink; do absolutely nothing with the input audio. It is
  6088. mainly useful as a template and for use in analysis / debugging
  6089. tools.
  6090. @c man end AUDIO SINKS
  6091. @chapter Video Filters
  6092. @c man begin VIDEO FILTERS
  6093. When you configure your FFmpeg build, you can disable any of the
  6094. existing filters using @code{--disable-filters}.
  6095. The configure output will show the video filters included in your
  6096. build.
  6097. Below is a description of the currently available video filters.
  6098. @section addroi
  6099. Mark a region of interest in a video frame.
  6100. The frame data is passed through unchanged, but metadata is attached
  6101. to the frame indicating regions of interest which can affect the
  6102. behaviour of later encoding. Multiple regions can be marked by
  6103. applying the filter multiple times.
  6104. @table @option
  6105. @item x
  6106. Region distance in pixels from the left edge of the frame.
  6107. @item y
  6108. Region distance in pixels from the top edge of the frame.
  6109. @item w
  6110. Region width in pixels.
  6111. @item h
  6112. Region height in pixels.
  6113. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  6114. and may contain the following variables:
  6115. @table @option
  6116. @item iw
  6117. Width of the input frame.
  6118. @item ih
  6119. Height of the input frame.
  6120. @end table
  6121. @item qoffset
  6122. Quantisation offset to apply within the region.
  6123. This must be a real value in the range -1 to +1. A value of zero
  6124. indicates no quality change. A negative value asks for better quality
  6125. (less quantisation), while a positive value asks for worse quality
  6126. (greater quantisation).
  6127. The range is calibrated so that the extreme values indicate the
  6128. largest possible offset - if the rest of the frame is encoded with the
  6129. worst possible quality, an offset of -1 indicates that this region
  6130. should be encoded with the best possible quality anyway. Intermediate
  6131. values are then interpolated in some codec-dependent way.
  6132. For example, in 10-bit H.264 the quantisation parameter varies between
  6133. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  6134. this region should be encoded with a QP around one-tenth of the full
  6135. range better than the rest of the frame. So, if most of the frame
  6136. were to be encoded with a QP of around 30, this region would get a QP
  6137. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  6138. An extreme value of -1 would indicate that this region should be
  6139. encoded with the best possible quality regardless of the treatment of
  6140. the rest of the frame - that is, should be encoded at a QP of -12.
  6141. @item clear
  6142. If set to true, remove any existing regions of interest marked on the
  6143. frame before adding the new one.
  6144. @end table
  6145. @subsection Examples
  6146. @itemize
  6147. @item
  6148. Mark the centre quarter of the frame as interesting.
  6149. @example
  6150. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  6151. @end example
  6152. @item
  6153. Mark the 100-pixel-wide region on the left edge of the frame as very
  6154. uninteresting (to be encoded at much lower quality than the rest of
  6155. the frame).
  6156. @example
  6157. addroi=0:0:100:ih:+1/5
  6158. @end example
  6159. @end itemize
  6160. @section alphaextract
  6161. Extract the alpha component from the input as a grayscale video. This
  6162. is especially useful with the @var{alphamerge} filter.
  6163. @section alphamerge
  6164. Add or replace the alpha component of the primary input with the
  6165. grayscale value of a second input. This is intended for use with
  6166. @var{alphaextract} to allow the transmission or storage of frame
  6167. sequences that have alpha in a format that doesn't support an alpha
  6168. channel.
  6169. For example, to reconstruct full frames from a normal YUV-encoded video
  6170. and a separate video created with @var{alphaextract}, you might use:
  6171. @example
  6172. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  6173. @end example
  6174. @section amplify
  6175. Amplify differences between current pixel and pixels of adjacent frames in
  6176. same pixel location.
  6177. This filter accepts the following options:
  6178. @table @option
  6179. @item radius
  6180. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  6181. For example radius of 3 will instruct filter to calculate average of 7 frames.
  6182. @item factor
  6183. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  6184. @item threshold
  6185. Set threshold for difference amplification. Any difference greater or equal to
  6186. this value will not alter source pixel. Default is 10.
  6187. Allowed range is from 0 to 65535.
  6188. @item tolerance
  6189. Set tolerance for difference amplification. Any difference lower to
  6190. this value will not alter source pixel. Default is 0.
  6191. Allowed range is from 0 to 65535.
  6192. @item low
  6193. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6194. This option controls maximum possible value that will decrease source pixel value.
  6195. @item high
  6196. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6197. This option controls maximum possible value that will increase source pixel value.
  6198. @item planes
  6199. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  6200. @end table
  6201. @subsection Commands
  6202. This filter supports the following @ref{commands} that corresponds to option of same name:
  6203. @table @option
  6204. @item factor
  6205. @item threshold
  6206. @item tolerance
  6207. @item low
  6208. @item high
  6209. @item planes
  6210. @end table
  6211. @section ass
  6212. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  6213. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  6214. Substation Alpha) subtitles files.
  6215. This filter accepts the following option in addition to the common options from
  6216. the @ref{subtitles} filter:
  6217. @table @option
  6218. @item shaping
  6219. Set the shaping engine
  6220. Available values are:
  6221. @table @samp
  6222. @item auto
  6223. The default libass shaping engine, which is the best available.
  6224. @item simple
  6225. Fast, font-agnostic shaper that can do only substitutions
  6226. @item complex
  6227. Slower shaper using OpenType for substitutions and positioning
  6228. @end table
  6229. The default is @code{auto}.
  6230. @end table
  6231. @section atadenoise
  6232. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  6233. The filter accepts the following options:
  6234. @table @option
  6235. @item 0a
  6236. Set threshold A for 1st plane. Default is 0.02.
  6237. Valid range is 0 to 0.3.
  6238. @item 0b
  6239. Set threshold B for 1st plane. Default is 0.04.
  6240. Valid range is 0 to 5.
  6241. @item 1a
  6242. Set threshold A for 2nd plane. Default is 0.02.
  6243. Valid range is 0 to 0.3.
  6244. @item 1b
  6245. Set threshold B for 2nd plane. Default is 0.04.
  6246. Valid range is 0 to 5.
  6247. @item 2a
  6248. Set threshold A for 3rd plane. Default is 0.02.
  6249. Valid range is 0 to 0.3.
  6250. @item 2b
  6251. Set threshold B for 3rd plane. Default is 0.04.
  6252. Valid range is 0 to 5.
  6253. Threshold A is designed to react on abrupt changes in the input signal and
  6254. threshold B is designed to react on continuous changes in the input signal.
  6255. @item s
  6256. Set number of frames filter will use for averaging. Default is 9. Must be odd
  6257. number in range [5, 129].
  6258. @item p
  6259. Set what planes of frame filter will use for averaging. Default is all.
  6260. @item a
  6261. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  6262. Alternatively can be set to @code{s} serial.
  6263. Parallel can be faster then serial, while other way around is never true.
  6264. Parallel will abort early on first change being greater then thresholds, while serial
  6265. will continue processing other side of frames if they are equal or below thresholds.
  6266. @item 0s
  6267. @item 1s
  6268. @item 2s
  6269. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  6270. Valid range is from 0 to 32767.
  6271. This options controls weight for each pixel in radius defined by size.
  6272. Default value means every pixel have same weight.
  6273. Setting this option to 0 effectively disables filtering.
  6274. @end table
  6275. @subsection Commands
  6276. This filter supports same @ref{commands} as options except option @code{s}.
  6277. The command accepts the same syntax of the corresponding option.
  6278. @section avgblur
  6279. Apply average blur filter.
  6280. The filter accepts the following options:
  6281. @table @option
  6282. @item sizeX
  6283. Set horizontal radius size.
  6284. @item planes
  6285. Set which planes to filter. By default all planes are filtered.
  6286. @item sizeY
  6287. Set vertical radius size, if zero it will be same as @code{sizeX}.
  6288. Default is @code{0}.
  6289. @end table
  6290. @subsection Commands
  6291. This filter supports same commands as options.
  6292. The command accepts the same syntax of the corresponding option.
  6293. If the specified expression is not valid, it is kept at its current
  6294. value.
  6295. @section backgroundkey
  6296. Turns a static background into transparency.
  6297. The filter accepts the following option:
  6298. @table @option
  6299. @item threshold
  6300. Threshold for scene change detection.
  6301. @item similarity
  6302. Similarity percentage with the background.
  6303. @item blend
  6304. Set the blend amount for pixels that are not similar.
  6305. @end table
  6306. @subsection Commands
  6307. This filter supports the all above options as @ref{commands}.
  6308. @section bbox
  6309. Compute the bounding box for the non-black pixels in the input frame
  6310. luminance plane.
  6311. This filter computes the bounding box containing all the pixels with a
  6312. luminance value greater than the minimum allowed value.
  6313. The parameters describing the bounding box are printed on the filter
  6314. log.
  6315. The filter accepts the following option:
  6316. @table @option
  6317. @item min_val
  6318. Set the minimal luminance value. Default is @code{16}.
  6319. @end table
  6320. @subsection Commands
  6321. This filter supports the all above options as @ref{commands}.
  6322. @section bilateral
  6323. Apply bilateral filter, spatial smoothing while preserving edges.
  6324. The filter accepts the following options:
  6325. @table @option
  6326. @item sigmaS
  6327. Set sigma of gaussian function to calculate spatial weight.
  6328. Allowed range is 0 to 512. Default is 0.1.
  6329. @item sigmaR
  6330. Set sigma of gaussian function to calculate range weight.
  6331. Allowed range is 0 to 1. Default is 0.1.
  6332. @item planes
  6333. Set planes to filter. Default is first only.
  6334. @end table
  6335. @subsection Commands
  6336. This filter supports the all above options as @ref{commands}.
  6337. @section bilateral_cuda
  6338. CUDA accelerated bilateral filter, an edge preserving filter.
  6339. This filter is mathematically accurate thanks to the use of GPU acceleration.
  6340. For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
  6341. The filter accepts the following options:
  6342. @table @option
  6343. @item sigmaS
  6344. Set sigma of gaussian function to calculate spatial weight, also called sigma space.
  6345. Allowed range is 0.1 to 512. Default is 0.1.
  6346. @item sigmaR
  6347. Set sigma of gaussian function to calculate color range weight, also called sigma color.
  6348. Allowed range is 0.1 to 512. Default is 0.1.
  6349. @item window_size
  6350. Set window size of the bilateral function to determine the number of neighbours to loop on.
  6351. If the number entered is even, one will be added automatically.
  6352. Allowed range is 1 to 255. Default is 1.
  6353. @end table
  6354. @subsection Examples
  6355. @itemize
  6356. @item
  6357. Apply the bilateral filter on a video.
  6358. @example
  6359. ./ffmpeg -v verbose \
  6360. -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \
  6361. -init_hw_device cuda \
  6362. -filter_complex \
  6363. " \
  6364. [0:v]scale_cuda=format=yuv444p[scaled_video];
  6365. [scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  6366. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  6367. @end example
  6368. @end itemize
  6369. @section bitplanenoise
  6370. Show and measure bit plane noise.
  6371. The filter accepts the following options:
  6372. @table @option
  6373. @item bitplane
  6374. Set which plane to analyze. Default is @code{1}.
  6375. @item filter
  6376. Filter out noisy pixels from @code{bitplane} set above.
  6377. Default is disabled.
  6378. @end table
  6379. @section blackdetect
  6380. Detect video intervals that are (almost) completely black. Can be
  6381. useful to detect chapter transitions, commercials, or invalid
  6382. recordings.
  6383. The filter outputs its detection analysis to both the log as well as
  6384. frame metadata. If a black segment of at least the specified minimum
  6385. duration is found, a line with the start and end timestamps as well
  6386. as duration is printed to the log with level @code{info}. In addition,
  6387. a log line with level @code{debug} is printed per frame showing the
  6388. black amount detected for that frame.
  6389. The filter also attaches metadata to the first frame of a black
  6390. segment with key @code{lavfi.black_start} and to the first frame
  6391. after the black segment ends with key @code{lavfi.black_end}. The
  6392. value is the frame's timestamp. This metadata is added regardless
  6393. of the minimum duration specified.
  6394. The filter accepts the following options:
  6395. @table @option
  6396. @item black_min_duration, d
  6397. Set the minimum detected black duration expressed in seconds. It must
  6398. be a non-negative floating point number.
  6399. Default value is 2.0.
  6400. @item picture_black_ratio_th, pic_th
  6401. Set the threshold for considering a picture "black".
  6402. Express the minimum value for the ratio:
  6403. @example
  6404. @var{nb_black_pixels} / @var{nb_pixels}
  6405. @end example
  6406. for which a picture is considered black.
  6407. Default value is 0.98.
  6408. @item pixel_black_th, pix_th
  6409. Set the threshold for considering a pixel "black".
  6410. The threshold expresses the maximum pixel luminance value for which a
  6411. pixel is considered "black". The provided value is scaled according to
  6412. the following equation:
  6413. @example
  6414. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  6415. @end example
  6416. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  6417. the input video format, the range is [0-255] for YUV full-range
  6418. formats and [16-235] for YUV non full-range formats.
  6419. Default value is 0.10.
  6420. @end table
  6421. The following example sets the maximum pixel threshold to the minimum
  6422. value, and detects only black intervals of 2 or more seconds:
  6423. @example
  6424. blackdetect=d=2:pix_th=0.00
  6425. @end example
  6426. @section blackframe
  6427. Detect frames that are (almost) completely black. Can be useful to
  6428. detect chapter transitions or commercials. Output lines consist of
  6429. the frame number of the detected frame, the percentage of blackness,
  6430. the position in the file if known or -1 and the timestamp in seconds.
  6431. In order to display the output lines, you need to set the loglevel at
  6432. least to the AV_LOG_INFO value.
  6433. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6434. The value represents the percentage of pixels in the picture that
  6435. are below the threshold value.
  6436. It accepts the following parameters:
  6437. @table @option
  6438. @item amount
  6439. The percentage of the pixels that have to be below the threshold; it defaults to
  6440. @code{98}.
  6441. @item threshold, thresh
  6442. The threshold below which a pixel value is considered black; it defaults to
  6443. @code{32}.
  6444. @end table
  6445. @anchor{blend}
  6446. @section blend
  6447. Blend two video frames into each other.
  6448. The @code{blend} filter takes two input streams and outputs one
  6449. stream, the first input is the "top" layer and second input is
  6450. "bottom" layer. By default, the output terminates when the longest input terminates.
  6451. The @code{tblend} (time blend) filter takes two consecutive frames
  6452. from one single stream, and outputs the result obtained by blending
  6453. the new frame on top of the old frame.
  6454. A description of the accepted options follows.
  6455. @table @option
  6456. @item c0_mode
  6457. @item c1_mode
  6458. @item c2_mode
  6459. @item c3_mode
  6460. @item all_mode
  6461. Set blend mode for specific pixel component or all pixel components in case
  6462. of @var{all_mode}. Default value is @code{normal}.
  6463. Available values for component modes are:
  6464. @table @samp
  6465. @item addition
  6466. @item and
  6467. @item average
  6468. @item bleach
  6469. @item burn
  6470. @item darken
  6471. @item difference
  6472. @item divide
  6473. @item dodge
  6474. @item exclusion
  6475. @item extremity
  6476. @item freeze
  6477. @item geometric
  6478. @item glow
  6479. @item grainextract
  6480. @item grainmerge
  6481. @item hardlight
  6482. @item hardmix
  6483. @item hardoverlay
  6484. @item harmonic
  6485. @item heat
  6486. @item interpolate
  6487. @item lighten
  6488. @item linearlight
  6489. @item multiply
  6490. @item multiply128
  6491. @item negation
  6492. @item normal
  6493. @item or
  6494. @item overlay
  6495. @item phoenix
  6496. @item pinlight
  6497. @item reflect
  6498. @item screen
  6499. @item softdifference
  6500. @item softlight
  6501. @item stain
  6502. @item subtract
  6503. @item vividlight
  6504. @item xor
  6505. @end table
  6506. @item c0_opacity
  6507. @item c1_opacity
  6508. @item c2_opacity
  6509. @item c3_opacity
  6510. @item all_opacity
  6511. Set blend opacity for specific pixel component or all pixel components in case
  6512. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6513. @item c0_expr
  6514. @item c1_expr
  6515. @item c2_expr
  6516. @item c3_expr
  6517. @item all_expr
  6518. Set blend expression for specific pixel component or all pixel components in case
  6519. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6520. The expressions can use the following variables:
  6521. @table @option
  6522. @item N
  6523. The sequential number of the filtered frame, starting from @code{0}.
  6524. @item X
  6525. @item Y
  6526. the coordinates of the current sample
  6527. @item W
  6528. @item H
  6529. the width and height of currently filtered plane
  6530. @item SW
  6531. @item SH
  6532. Width and height scale for the plane being filtered. It is the
  6533. ratio between the dimensions of the current plane to the luma plane,
  6534. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6535. the luma plane and @code{0.5,0.5} for the chroma planes.
  6536. @item T
  6537. Time of the current frame, expressed in seconds.
  6538. @item TOP, A
  6539. Value of pixel component at current location for first video frame (top layer).
  6540. @item BOTTOM, B
  6541. Value of pixel component at current location for second video frame (bottom layer).
  6542. @end table
  6543. @end table
  6544. The @code{blend} filter also supports the @ref{framesync} options.
  6545. @subsection Examples
  6546. @itemize
  6547. @item
  6548. Apply transition from bottom layer to top layer in first 10 seconds:
  6549. @example
  6550. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6551. @end example
  6552. @item
  6553. Apply linear horizontal transition from top layer to bottom layer:
  6554. @example
  6555. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6556. @end example
  6557. @item
  6558. Apply 1x1 checkerboard effect:
  6559. @example
  6560. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6561. @end example
  6562. @item
  6563. Apply uncover left effect:
  6564. @example
  6565. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6566. @end example
  6567. @item
  6568. Apply uncover down effect:
  6569. @example
  6570. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6571. @end example
  6572. @item
  6573. Apply uncover up-left effect:
  6574. @example
  6575. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6576. @end example
  6577. @item
  6578. Split diagonally video and shows top and bottom layer on each side:
  6579. @example
  6580. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6581. @end example
  6582. @item
  6583. Display differences between the current and the previous frame:
  6584. @example
  6585. tblend=all_mode=grainextract
  6586. @end example
  6587. @end itemize
  6588. @subsection Commands
  6589. This filter supports same @ref{commands} as options.
  6590. @anchor{blockdetect}
  6591. @section blockdetect
  6592. Determines blockiness of frames without altering the input frames.
  6593. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference.
  6594. The filter accepts the following options:
  6595. @table @option
  6596. @item period_min
  6597. @item period_max
  6598. Set minimum and maximum values for determining pixel grids (periods).
  6599. Default values are [3,24].
  6600. @item planes
  6601. Set planes to filter. Default is first only.
  6602. @end table
  6603. @subsection Examples
  6604. @itemize
  6605. @item
  6606. Determine blockiness for the first plane and search for periods within [8,32]:
  6607. @example
  6608. blockdetect=period_min=8:period_max=32:planes=1
  6609. @end example
  6610. @end itemize
  6611. @anchor{blurdetect}
  6612. @section blurdetect
  6613. Determines blurriness of frames without altering the input frames.
  6614. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6615. Allows for a block-based abbreviation.
  6616. The filter accepts the following options:
  6617. @table @option
  6618. @item low
  6619. @item high
  6620. Set low and high threshold values used by the Canny thresholding
  6621. algorithm.
  6622. The high threshold selects the "strong" edge pixels, which are then
  6623. connected through 8-connectivity with the "weak" edge pixels selected
  6624. by the low threshold.
  6625. @var{low} and @var{high} threshold values must be chosen in the range
  6626. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6627. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6628. is @code{50/255}.
  6629. @item radius
  6630. Define the radius to search around an edge pixel for local maxima.
  6631. @item block_pct
  6632. Determine blurriness only for the most significant blocks, given in percentage.
  6633. @item block_width
  6634. 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}.
  6635. @item block_height
  6636. 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}.
  6637. @item planes
  6638. Set planes to filter. Default is first only.
  6639. @end table
  6640. @subsection Examples
  6641. @itemize
  6642. @item
  6643. Determine blur for 80% of most significant 32x32 blocks:
  6644. @example
  6645. blurdetect=block_width=32:block_height=32:block_pct=80
  6646. @end example
  6647. @end itemize
  6648. @section bm3d
  6649. Denoise frames using Block-Matching 3D algorithm.
  6650. The filter accepts the following options.
  6651. @table @option
  6652. @item sigma
  6653. Set denoising strength. Default value is 1.
  6654. Allowed range is from 0 to 999.9.
  6655. The denoising algorithm is very sensitive to sigma, so adjust it
  6656. according to the source.
  6657. @item block
  6658. Set local patch size. This sets dimensions in 2D.
  6659. @item bstep
  6660. Set sliding step for processing blocks. Default value is 4.
  6661. Allowed range is from 1 to 64.
  6662. Smaller values allows processing more reference blocks and is slower.
  6663. @item group
  6664. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6665. When set to 1, no block matching is done. Larger values allows more blocks
  6666. in single group.
  6667. Allowed range is from 1 to 256.
  6668. @item range
  6669. Set radius for search block matching. Default is 9.
  6670. Allowed range is from 1 to INT32_MAX.
  6671. @item mstep
  6672. Set step between two search locations for block matching. Default is 1.
  6673. Allowed range is from 1 to 64. Smaller is slower.
  6674. @item thmse
  6675. Set threshold of mean square error for block matching. Valid range is 0 to
  6676. INT32_MAX.
  6677. @item hdthr
  6678. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6679. Larger values results in stronger hard-thresholding filtering in frequency
  6680. domain.
  6681. @item estim
  6682. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6683. Default is @code{basic}.
  6684. @item ref
  6685. If enabled, filter will use 2nd stream for block matching.
  6686. Default is disabled for @code{basic} value of @var{estim} option,
  6687. and always enabled if value of @var{estim} is @code{final}.
  6688. @item planes
  6689. Set planes to filter. Default is all available except alpha.
  6690. @end table
  6691. @subsection Examples
  6692. @itemize
  6693. @item
  6694. Basic filtering with bm3d:
  6695. @example
  6696. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6697. @end example
  6698. @item
  6699. Same as above, but filtering only luma:
  6700. @example
  6701. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6702. @end example
  6703. @item
  6704. Same as above, but with both estimation modes:
  6705. @example
  6706. 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
  6707. @end example
  6708. @item
  6709. Same as above, but prefilter with @ref{nlmeans} filter instead:
  6710. @example
  6711. 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
  6712. @end example
  6713. @end itemize
  6714. @section boxblur
  6715. Apply a boxblur algorithm to the input video.
  6716. It accepts the following parameters:
  6717. @table @option
  6718. @item luma_radius, lr
  6719. @item luma_power, lp
  6720. @item chroma_radius, cr
  6721. @item chroma_power, cp
  6722. @item alpha_radius, ar
  6723. @item alpha_power, ap
  6724. @end table
  6725. A description of the accepted options follows.
  6726. @table @option
  6727. @item luma_radius, lr
  6728. @item chroma_radius, cr
  6729. @item alpha_radius, ar
  6730. Set an expression for the box radius in pixels used for blurring the
  6731. corresponding input plane.
  6732. The radius value must be a non-negative number, and must not be
  6733. greater than the value of the expression @code{min(w,h)/2} for the
  6734. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  6735. planes.
  6736. Default value for @option{luma_radius} is "2". If not specified,
  6737. @option{chroma_radius} and @option{alpha_radius} default to the
  6738. corresponding value set for @option{luma_radius}.
  6739. The expressions can contain the following constants:
  6740. @table @option
  6741. @item w
  6742. @item h
  6743. The input width and height in pixels.
  6744. @item cw
  6745. @item ch
  6746. The input chroma image width and height in pixels.
  6747. @item hsub
  6748. @item vsub
  6749. The horizontal and vertical chroma subsample values. For example, for the
  6750. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  6751. @end table
  6752. @item luma_power, lp
  6753. @item chroma_power, cp
  6754. @item alpha_power, ap
  6755. Specify how many times the boxblur filter is applied to the
  6756. corresponding plane.
  6757. Default value for @option{luma_power} is 2. If not specified,
  6758. @option{chroma_power} and @option{alpha_power} default to the
  6759. corresponding value set for @option{luma_power}.
  6760. A value of 0 will disable the effect.
  6761. @end table
  6762. @subsection Examples
  6763. @itemize
  6764. @item
  6765. Apply a boxblur filter with the luma, chroma, and alpha radii
  6766. set to 2:
  6767. @example
  6768. boxblur=luma_radius=2:luma_power=1
  6769. boxblur=2:1
  6770. @end example
  6771. @item
  6772. Set the luma radius to 2, and alpha and chroma radius to 0:
  6773. @example
  6774. boxblur=2:1:cr=0:ar=0
  6775. @end example
  6776. @item
  6777. Set the luma and chroma radii to a fraction of the video dimension:
  6778. @example
  6779. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  6780. @end example
  6781. @end itemize
  6782. @section bwdif
  6783. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  6784. Deinterlacing Filter").
  6785. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  6786. interpolation algorithms.
  6787. It accepts the following parameters:
  6788. @table @option
  6789. @item mode
  6790. The interlacing mode to adopt. It accepts one of the following values:
  6791. @table @option
  6792. @item 0, send_frame
  6793. Output one frame for each frame.
  6794. @item 1, send_field
  6795. Output one frame for each field.
  6796. @end table
  6797. The default value is @code{send_field}.
  6798. @item parity
  6799. The picture field parity assumed for the input interlaced video. It accepts one
  6800. of the following values:
  6801. @table @option
  6802. @item 0, tff
  6803. Assume the top field is first.
  6804. @item 1, bff
  6805. Assume the bottom field is first.
  6806. @item -1, auto
  6807. Enable automatic detection of field parity.
  6808. @end table
  6809. The default value is @code{auto}.
  6810. If the interlacing is unknown or the decoder does not export this information,
  6811. top field first will be assumed.
  6812. @item deint
  6813. Specify which frames to deinterlace. Accepts one of the following
  6814. values:
  6815. @table @option
  6816. @item 0, all
  6817. Deinterlace all frames.
  6818. @item 1, interlaced
  6819. Only deinterlace frames marked as interlaced.
  6820. @end table
  6821. The default value is @code{all}.
  6822. @end table
  6823. @section cas
  6824. Apply Contrast Adaptive Sharpen filter to video stream.
  6825. The filter accepts the following options:
  6826. @table @option
  6827. @item strength
  6828. Set the sharpening strength. Default value is 0.
  6829. @item planes
  6830. Set planes to filter. Default value is to filter all
  6831. planes except alpha plane.
  6832. @end table
  6833. @subsection Commands
  6834. This filter supports same @ref{commands} as options.
  6835. @section chromahold
  6836. Remove all color information for all colors except for certain one.
  6837. The filter accepts the following options:
  6838. @table @option
  6839. @item color
  6840. The color which will not be replaced with neutral chroma.
  6841. @item similarity
  6842. Similarity percentage with the above color.
  6843. 0.01 matches only the exact key color, while 1.0 matches everything.
  6844. @item blend
  6845. Blend percentage.
  6846. 0.0 makes pixels either fully gray, or not gray at all.
  6847. Higher values result in more preserved color.
  6848. @item yuv
  6849. Signals that the color passed is already in YUV instead of RGB.
  6850. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6851. This can be used to pass exact YUV values as hexadecimal numbers.
  6852. @end table
  6853. @subsection Commands
  6854. This filter supports same @ref{commands} as options.
  6855. The command accepts the same syntax of the corresponding option.
  6856. If the specified expression is not valid, it is kept at its current
  6857. value.
  6858. @anchor{chromakey}
  6859. @section chromakey
  6860. YUV colorspace color/chroma keying.
  6861. The filter accepts the following options:
  6862. @table @option
  6863. @item color
  6864. The color which will be replaced with transparency.
  6865. @item similarity
  6866. Similarity percentage with the key color.
  6867. 0.01 matches only the exact key color, while 1.0 matches everything.
  6868. @item blend
  6869. Blend percentage.
  6870. 0.0 makes pixels either fully transparent, or not transparent at all.
  6871. Higher values result in semi-transparent pixels, with a higher transparency
  6872. the more similar the pixels color is to the key color.
  6873. @item yuv
  6874. Signals that the color passed is already in YUV instead of RGB.
  6875. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6876. This can be used to pass exact YUV values as hexadecimal numbers.
  6877. @end table
  6878. @subsection Commands
  6879. This filter supports same @ref{commands} as options.
  6880. The command accepts the same syntax of the corresponding option.
  6881. If the specified expression is not valid, it is kept at its current
  6882. value.
  6883. @subsection Examples
  6884. @itemize
  6885. @item
  6886. Make every green pixel in the input image transparent:
  6887. @example
  6888. ffmpeg -i input.png -vf chromakey=green out.png
  6889. @end example
  6890. @item
  6891. Overlay a greenscreen-video on top of a static black background.
  6892. @example
  6893. 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
  6894. @end example
  6895. @end itemize
  6896. @section chromakey_cuda
  6897. CUDA accelerated YUV colorspace color/chroma keying.
  6898. This filter works like normal chromakey filter but operates on CUDA frames.
  6899. for more details and parameters see @ref{chromakey}.
  6900. @subsection Examples
  6901. @itemize
  6902. @item
  6903. Make all the green pixels in the input video transparent and use it as an overlay for another video:
  6904. @example
  6905. ./ffmpeg \
  6906. -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
  6907. -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
  6908. -init_hw_device cuda \
  6909. -filter_complex \
  6910. " \
  6911. [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
  6912. [1:v]scale_cuda=format=yuv420p[base]; \
  6913. [base][overlay_video]overlay_cuda" \
  6914. -an -sn -c:v h264_nvenc -cq 20 output.mp4
  6915. @end example
  6916. @item
  6917. Process two software sources, explicitly uploading the frames:
  6918. @example
  6919. ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
  6920. -f lavfi -i color=size=800x600:color=white,format=yuv420p \
  6921. -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
  6922. -filter_complex \
  6923. " \
  6924. [0]hwupload[under]; \
  6925. [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
  6926. [under][over]overlay_cuda" \
  6927. -c:v hevc_nvenc -cq 18 -preset slow output.mp4
  6928. @end example
  6929. @end itemize
  6930. @section chromanr
  6931. Reduce chrominance noise.
  6932. The filter accepts the following options:
  6933. @table @option
  6934. @item thres
  6935. Set threshold for averaging chrominance values.
  6936. Sum of absolute difference of Y, U and V pixel components of current
  6937. pixel and neighbour pixels lower than this threshold will be used in
  6938. averaging. Luma component is left unchanged and is copied to output.
  6939. Default value is 30. Allowed range is from 1 to 200.
  6940. @item sizew
  6941. Set horizontal radius of rectangle used for averaging.
  6942. Allowed range is from 1 to 100. Default value is 5.
  6943. @item sizeh
  6944. Set vertical radius of rectangle used for averaging.
  6945. Allowed range is from 1 to 100. Default value is 5.
  6946. @item stepw
  6947. Set horizontal step when averaging. Default value is 1.
  6948. Allowed range is from 1 to 50.
  6949. Mostly useful to speed-up filtering.
  6950. @item steph
  6951. Set vertical step when averaging. Default value is 1.
  6952. Allowed range is from 1 to 50.
  6953. Mostly useful to speed-up filtering.
  6954. @item threy
  6955. Set Y threshold for averaging chrominance values.
  6956. Set finer control for max allowed difference between Y components
  6957. of current pixel and neigbour pixels.
  6958. Default value is 200. Allowed range is from 1 to 200.
  6959. @item threu
  6960. Set U threshold for averaging chrominance values.
  6961. Set finer control for max allowed difference between U components
  6962. of current pixel and neigbour pixels.
  6963. Default value is 200. Allowed range is from 1 to 200.
  6964. @item threv
  6965. Set V threshold for averaging chrominance values.
  6966. Set finer control for max allowed difference between V components
  6967. of current pixel and neigbour pixels.
  6968. Default value is 200. Allowed range is from 1 to 200.
  6969. @item distance
  6970. Set distance type used in calculations.
  6971. @table @samp
  6972. @item manhattan
  6973. Absolute difference.
  6974. @item euclidean
  6975. Difference squared.
  6976. @end table
  6977. Default distance type is manhattan.
  6978. @end table
  6979. @subsection Commands
  6980. This filter supports same @ref{commands} as options.
  6981. The command accepts the same syntax of the corresponding option.
  6982. @section chromashift
  6983. Shift chroma pixels horizontally and/or vertically.
  6984. The filter accepts the following options:
  6985. @table @option
  6986. @item cbh
  6987. Set amount to shift chroma-blue horizontally.
  6988. @item cbv
  6989. Set amount to shift chroma-blue vertically.
  6990. @item crh
  6991. Set amount to shift chroma-red horizontally.
  6992. @item crv
  6993. Set amount to shift chroma-red vertically.
  6994. @item edge
  6995. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6996. @end table
  6997. @subsection Commands
  6998. This filter supports the all above options as @ref{commands}.
  6999. @section ciescope
  7000. Display CIE color diagram with pixels overlaid onto it.
  7001. The filter accepts the following options:
  7002. @table @option
  7003. @item system
  7004. Set color system.
  7005. @table @samp
  7006. @item ntsc, 470m
  7007. @item ebu, 470bg
  7008. @item smpte
  7009. @item 240m
  7010. @item apple
  7011. @item widergb
  7012. @item cie1931
  7013. @item rec709, hdtv
  7014. @item uhdtv, rec2020
  7015. @item dcip3
  7016. @end table
  7017. @item cie
  7018. Set CIE system.
  7019. @table @samp
  7020. @item xyy
  7021. @item ucs
  7022. @item luv
  7023. @end table
  7024. @item gamuts
  7025. Set what gamuts to draw.
  7026. See @code{system} option for available values.
  7027. @item size, s
  7028. Set ciescope size, by default set to 512.
  7029. @item intensity, i
  7030. Set intensity used to map input pixel values to CIE diagram.
  7031. @item contrast
  7032. Set contrast used to draw tongue colors that are out of active color system gamut.
  7033. @item corrgamma
  7034. Correct gamma displayed on scope, by default enabled.
  7035. @item showwhite
  7036. Show white point on CIE diagram, by default disabled.
  7037. @item gamma
  7038. Set input gamma. Used only with XYZ input color space.
  7039. @item fill
  7040. Fill with CIE colors. By default is enabled.
  7041. @end table
  7042. @section codecview
  7043. Visualize information exported by some codecs.
  7044. Some codecs can export information through frames using side-data or other
  7045. means. For example, some MPEG based codecs export motion vectors through the
  7046. @var{export_mvs} flag in the codec @option{flags2} option.
  7047. The filter accepts the following option:
  7048. @table @option
  7049. @item block
  7050. Display block partition structure using the luma plane.
  7051. @item mv
  7052. Set motion vectors to visualize.
  7053. Available flags for @var{mv} are:
  7054. @table @samp
  7055. @item pf
  7056. forward predicted MVs of P-frames
  7057. @item bf
  7058. forward predicted MVs of B-frames
  7059. @item bb
  7060. backward predicted MVs of B-frames
  7061. @end table
  7062. @item qp
  7063. Display quantization parameters using the chroma planes.
  7064. @item mv_type, mvt
  7065. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  7066. Available flags for @var{mv_type} are:
  7067. @table @samp
  7068. @item fp
  7069. forward predicted MVs
  7070. @item bp
  7071. backward predicted MVs
  7072. @end table
  7073. @item frame_type, ft
  7074. Set frame type to visualize motion vectors of.
  7075. Available flags for @var{frame_type} are:
  7076. @table @samp
  7077. @item if
  7078. intra-coded frames (I-frames)
  7079. @item pf
  7080. predicted frames (P-frames)
  7081. @item bf
  7082. bi-directionally predicted frames (B-frames)
  7083. @end table
  7084. @end table
  7085. @subsection Examples
  7086. @itemize
  7087. @item
  7088. Visualize forward predicted MVs of all frames using @command{ffplay}:
  7089. @example
  7090. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  7091. @end example
  7092. @item
  7093. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  7094. @example
  7095. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  7096. @end example
  7097. @end itemize
  7098. @section colorbalance
  7099. Modify intensity of primary colors (red, green and blue) of input frames.
  7100. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  7101. regions for the red-cyan, green-magenta or blue-yellow balance.
  7102. A positive adjustment value shifts the balance towards the primary color, a negative
  7103. value towards the complementary color.
  7104. The filter accepts the following options:
  7105. @table @option
  7106. @item rs
  7107. @item gs
  7108. @item bs
  7109. Adjust red, green and blue shadows (darkest pixels).
  7110. @item rm
  7111. @item gm
  7112. @item bm
  7113. Adjust red, green and blue midtones (medium pixels).
  7114. @item rh
  7115. @item gh
  7116. @item bh
  7117. Adjust red, green and blue highlights (brightest pixels).
  7118. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7119. @item pl
  7120. Preserve lightness when changing color balance. Default is disabled.
  7121. @end table
  7122. @subsection Examples
  7123. @itemize
  7124. @item
  7125. Add red color cast to shadows:
  7126. @example
  7127. colorbalance=rs=.3
  7128. @end example
  7129. @end itemize
  7130. @subsection Commands
  7131. This filter supports the all above options as @ref{commands}.
  7132. @section colorcontrast
  7133. Adjust color contrast between RGB components.
  7134. The filter accepts the following options:
  7135. @table @option
  7136. @item rc
  7137. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7138. @item gm
  7139. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7140. @item by
  7141. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7142. @item rcw
  7143. @item gmw
  7144. @item byw
  7145. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  7146. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  7147. @item pl
  7148. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  7149. @end table
  7150. @subsection Commands
  7151. This filter supports the all above options as @ref{commands}.
  7152. @section colorcorrect
  7153. Adjust color white balance selectively for blacks and whites.
  7154. This filter operates in YUV colorspace.
  7155. The filter accepts the following options:
  7156. @table @option
  7157. @item rl
  7158. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  7159. Default value is 0.
  7160. @item bl
  7161. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  7162. Default value is 0.
  7163. @item rh
  7164. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7165. Default value is 0.
  7166. @item bh
  7167. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7168. Default value is 0.
  7169. @item saturation
  7170. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  7171. Default value is 1.
  7172. @item analyze
  7173. If set to anything other than @code{manual} it will analyze every frame and use derived
  7174. parameters for filtering output frame.
  7175. Possible values are:
  7176. @table @samp
  7177. @item manual
  7178. @item average
  7179. @item minmax
  7180. @item median
  7181. @end table
  7182. Default value is @code{manual}.
  7183. @end table
  7184. @subsection Commands
  7185. This filter supports the all above options as @ref{commands}.
  7186. @section colorchannelmixer
  7187. Adjust video input frames by re-mixing color channels.
  7188. This filter modifies a color channel by adding the values associated to
  7189. the other channels of the same pixels. For example if the value to
  7190. modify is red, the output value will be:
  7191. @example
  7192. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  7193. @end example
  7194. The filter accepts the following options:
  7195. @table @option
  7196. @item rr
  7197. @item rg
  7198. @item rb
  7199. @item ra
  7200. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  7201. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  7202. @item gr
  7203. @item gg
  7204. @item gb
  7205. @item ga
  7206. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  7207. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  7208. @item br
  7209. @item bg
  7210. @item bb
  7211. @item ba
  7212. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  7213. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  7214. @item ar
  7215. @item ag
  7216. @item ab
  7217. @item aa
  7218. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  7219. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  7220. Allowed ranges for options are @code{[-2.0, 2.0]}.
  7221. @item pc
  7222. Set preserve color mode. The accepted values are:
  7223. @table @samp
  7224. @item none
  7225. Disable color preserving, this is default.
  7226. @item lum
  7227. Preserve luminance.
  7228. @item max
  7229. Preserve max value of RGB triplet.
  7230. @item avg
  7231. Preserve average value of RGB triplet.
  7232. @item sum
  7233. Preserve sum value of RGB triplet.
  7234. @item nrm
  7235. Preserve normalized value of RGB triplet.
  7236. @item pwr
  7237. Preserve power value of RGB triplet.
  7238. @end table
  7239. @item pa
  7240. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  7241. Default is @code{0.0}, thus disabled.
  7242. @end table
  7243. @subsection Examples
  7244. @itemize
  7245. @item
  7246. Convert source to grayscale:
  7247. @example
  7248. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  7249. @end example
  7250. @item
  7251. Simulate sepia tones:
  7252. @example
  7253. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  7254. @end example
  7255. @end itemize
  7256. @subsection Commands
  7257. This filter supports the all above options as @ref{commands}.
  7258. @section colorize
  7259. Overlay a solid color on the video stream.
  7260. The filter accepts the following options:
  7261. @table @option
  7262. @item hue
  7263. Set the color hue. Allowed range is from 0 to 360.
  7264. Default value is 0.
  7265. @item saturation
  7266. Set the color saturation. Allowed range is from 0 to 1.
  7267. Default value is 0.5.
  7268. @item lightness
  7269. Set the color lightness. Allowed range is from 0 to 1.
  7270. Default value is 0.5.
  7271. @item mix
  7272. Set the mix of source lightness. By default is set to 1.0.
  7273. Allowed range is from 0.0 to 1.0.
  7274. @end table
  7275. @subsection Commands
  7276. This filter supports the all above options as @ref{commands}.
  7277. @section colorkey
  7278. RGB colorspace color keying.
  7279. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  7280. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  7281. the similarity radius depends on the value of the blend option.
  7282. The filter accepts the following options:
  7283. @table @option
  7284. @item color
  7285. Set the color for which alpha will be set to 0 (full transparency).
  7286. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7287. Default is @code{black}.
  7288. @item similarity
  7289. Set the radius from the key color within which other colors also have full transparency.
  7290. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  7291. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  7292. around the exact key color, while 1.0 matches everything.
  7293. Default is @code{0.01}.
  7294. @item blend
  7295. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  7296. 0.0 makes pixels either fully transparent or fully opaque.
  7297. Higher values result in semi-transparent pixels, with greater transparency
  7298. the more similar the pixel color is to the key color.
  7299. Range is 0.0 to 1.0. Default is @code{0.0}.
  7300. @end table
  7301. @subsection Examples
  7302. @itemize
  7303. @item
  7304. Make every green pixel in the input image transparent:
  7305. @example
  7306. ffmpeg -i input.png -vf colorkey=green out.png
  7307. @end example
  7308. @item
  7309. Overlay a greenscreen-video on top of a static background image.
  7310. @example
  7311. 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
  7312. @end example
  7313. @end itemize
  7314. @subsection Commands
  7315. This filter supports same @ref{commands} as options.
  7316. The command accepts the same syntax of the corresponding option.
  7317. If the specified expression is not valid, it is kept at its current
  7318. value.
  7319. @section colorhold
  7320. Remove all color information for all RGB colors except for certain one.
  7321. The filter accepts the following options:
  7322. @table @option
  7323. @item color
  7324. The color which will not be replaced with neutral gray.
  7325. @item similarity
  7326. Similarity percentage with the above color.
  7327. 0.01 matches only the exact key color, while 1.0 matches everything.
  7328. @item blend
  7329. Blend percentage. 0.0 makes pixels fully gray.
  7330. Higher values result in more preserved color.
  7331. @end table
  7332. @subsection Commands
  7333. This filter supports same @ref{commands} as options.
  7334. The command accepts the same syntax of the corresponding option.
  7335. If the specified expression is not valid, it is kept at its current
  7336. value.
  7337. @section colorlevels
  7338. Adjust video input frames using levels.
  7339. The filter accepts the following options:
  7340. @table @option
  7341. @item rimin
  7342. @item gimin
  7343. @item bimin
  7344. @item aimin
  7345. Adjust red, green, blue and alpha input black point.
  7346. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7347. @item rimax
  7348. @item gimax
  7349. @item bimax
  7350. @item aimax
  7351. Adjust red, green, blue and alpha input white point.
  7352. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  7353. Input levels are used to lighten highlights (bright tones), darken shadows
  7354. (dark tones), change the balance of bright and dark tones.
  7355. @item romin
  7356. @item gomin
  7357. @item bomin
  7358. @item aomin
  7359. Adjust red, green, blue and alpha output black point.
  7360. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  7361. @item romax
  7362. @item gomax
  7363. @item bomax
  7364. @item aomax
  7365. Adjust red, green, blue and alpha output white point.
  7366. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  7367. Output levels allows manual selection of a constrained output level range.
  7368. @item preserve
  7369. Set preserve color mode. The accepted values are:
  7370. @table @samp
  7371. @item none
  7372. Disable color preserving, this is default.
  7373. @item lum
  7374. Preserve luminance.
  7375. @item max
  7376. Preserve max value of RGB triplet.
  7377. @item avg
  7378. Preserve average value of RGB triplet.
  7379. @item sum
  7380. Preserve sum value of RGB triplet.
  7381. @item nrm
  7382. Preserve normalized value of RGB triplet.
  7383. @item pwr
  7384. Preserve power value of RGB triplet.
  7385. @end table
  7386. @end table
  7387. @subsection Examples
  7388. @itemize
  7389. @item
  7390. Make video output darker:
  7391. @example
  7392. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  7393. @end example
  7394. @item
  7395. Increase contrast:
  7396. @example
  7397. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  7398. @end example
  7399. @item
  7400. Make video output lighter:
  7401. @example
  7402. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  7403. @end example
  7404. @item
  7405. Increase brightness:
  7406. @example
  7407. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  7408. @end example
  7409. @end itemize
  7410. @subsection Commands
  7411. This filter supports the all above options as @ref{commands}.
  7412. @section colormap
  7413. Apply custom color maps to video stream.
  7414. This filter needs three input video streams.
  7415. First stream is video stream that is going to be filtered out.
  7416. Second and third video stream specify color patches for source
  7417. color to target color mapping.
  7418. The filter accepts the following options:
  7419. @table @option
  7420. @item patch_size
  7421. Set the source and target video stream patch size in pixels.
  7422. @item nb_patches
  7423. Set the max number of used patches from source and target video stream.
  7424. Default value is number of patches available in additional video streams.
  7425. Max allowed number of patches is @code{64}.
  7426. @item type
  7427. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  7428. Defaults is @code{absolute}.
  7429. @item kernel
  7430. Set the kernel used to measure color differences between mapped colors.
  7431. The accepted values are:
  7432. @table @samp
  7433. @item euclidean
  7434. @item weuclidean
  7435. @end table
  7436. Default is @code{euclidean}.
  7437. @end table
  7438. @section colormatrix
  7439. Convert color matrix.
  7440. The filter accepts the following options:
  7441. @table @option
  7442. @item src
  7443. @item dst
  7444. Specify the source and destination color matrix. Both values must be
  7445. specified.
  7446. The accepted values are:
  7447. @table @samp
  7448. @item bt709
  7449. BT.709
  7450. @item fcc
  7451. FCC
  7452. @item bt601
  7453. BT.601
  7454. @item bt470
  7455. BT.470
  7456. @item bt470bg
  7457. BT.470BG
  7458. @item smpte170m
  7459. SMPTE-170M
  7460. @item smpte240m
  7461. SMPTE-240M
  7462. @item bt2020
  7463. BT.2020
  7464. @end table
  7465. @end table
  7466. For example to convert from BT.601 to SMPTE-240M, use the command:
  7467. @example
  7468. colormatrix=bt601:smpte240m
  7469. @end example
  7470. @section colorspace
  7471. Convert colorspace, transfer characteristics or color primaries.
  7472. Input video needs to have an even size.
  7473. The filter accepts the following options:
  7474. @table @option
  7475. @anchor{all}
  7476. @item all
  7477. Specify all color properties at once.
  7478. The accepted values are:
  7479. @table @samp
  7480. @item bt470m
  7481. BT.470M
  7482. @item bt470bg
  7483. BT.470BG
  7484. @item bt601-6-525
  7485. BT.601-6 525
  7486. @item bt601-6-625
  7487. BT.601-6 625
  7488. @item bt709
  7489. BT.709
  7490. @item smpte170m
  7491. SMPTE-170M
  7492. @item smpte240m
  7493. SMPTE-240M
  7494. @item bt2020
  7495. BT.2020
  7496. @end table
  7497. @anchor{space}
  7498. @item space
  7499. Specify output colorspace.
  7500. The accepted values are:
  7501. @table @samp
  7502. @item bt709
  7503. BT.709
  7504. @item fcc
  7505. FCC
  7506. @item bt470bg
  7507. BT.470BG or BT.601-6 625
  7508. @item smpte170m
  7509. SMPTE-170M or BT.601-6 525
  7510. @item smpte240m
  7511. SMPTE-240M
  7512. @item ycgco
  7513. YCgCo
  7514. @item bt2020ncl
  7515. BT.2020 with non-constant luminance
  7516. @end table
  7517. @anchor{trc}
  7518. @item trc
  7519. Specify output transfer characteristics.
  7520. The accepted values are:
  7521. @table @samp
  7522. @item bt709
  7523. BT.709
  7524. @item bt470m
  7525. BT.470M
  7526. @item bt470bg
  7527. BT.470BG
  7528. @item gamma22
  7529. Constant gamma of 2.2
  7530. @item gamma28
  7531. Constant gamma of 2.8
  7532. @item smpte170m
  7533. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7534. @item smpte240m
  7535. SMPTE-240M
  7536. @item srgb
  7537. SRGB
  7538. @item iec61966-2-1
  7539. iec61966-2-1
  7540. @item iec61966-2-4
  7541. iec61966-2-4
  7542. @item xvycc
  7543. xvycc
  7544. @item bt2020-10
  7545. BT.2020 for 10-bits content
  7546. @item bt2020-12
  7547. BT.2020 for 12-bits content
  7548. @end table
  7549. @anchor{primaries}
  7550. @item primaries
  7551. Specify output color primaries.
  7552. The accepted values are:
  7553. @table @samp
  7554. @item bt709
  7555. BT.709
  7556. @item bt470m
  7557. BT.470M
  7558. @item bt470bg
  7559. BT.470BG or BT.601-6 625
  7560. @item smpte170m
  7561. SMPTE-170M or BT.601-6 525
  7562. @item smpte240m
  7563. SMPTE-240M
  7564. @item film
  7565. film
  7566. @item smpte431
  7567. SMPTE-431
  7568. @item smpte432
  7569. SMPTE-432
  7570. @item bt2020
  7571. BT.2020
  7572. @item jedec-p22
  7573. JEDEC P22 phosphors
  7574. @end table
  7575. @anchor{range}
  7576. @item range
  7577. Specify output color range.
  7578. The accepted values are:
  7579. @table @samp
  7580. @item tv
  7581. TV (restricted) range
  7582. @item mpeg
  7583. MPEG (restricted) range
  7584. @item pc
  7585. PC (full) range
  7586. @item jpeg
  7587. JPEG (full) range
  7588. @end table
  7589. @item format
  7590. Specify output color format.
  7591. The accepted values are:
  7592. @table @samp
  7593. @item yuv420p
  7594. YUV 4:2:0 planar 8-bits
  7595. @item yuv420p10
  7596. YUV 4:2:0 planar 10-bits
  7597. @item yuv420p12
  7598. YUV 4:2:0 planar 12-bits
  7599. @item yuv422p
  7600. YUV 4:2:2 planar 8-bits
  7601. @item yuv422p10
  7602. YUV 4:2:2 planar 10-bits
  7603. @item yuv422p12
  7604. YUV 4:2:2 planar 12-bits
  7605. @item yuv444p
  7606. YUV 4:4:4 planar 8-bits
  7607. @item yuv444p10
  7608. YUV 4:4:4 planar 10-bits
  7609. @item yuv444p12
  7610. YUV 4:4:4 planar 12-bits
  7611. @end table
  7612. @item fast
  7613. Do a fast conversion, which skips gamma/primary correction. This will take
  7614. significantly less CPU, but will be mathematically incorrect. To get output
  7615. compatible with that produced by the colormatrix filter, use fast=1.
  7616. @item dither
  7617. Specify dithering mode.
  7618. The accepted values are:
  7619. @table @samp
  7620. @item none
  7621. No dithering
  7622. @item fsb
  7623. Floyd-Steinberg dithering
  7624. @end table
  7625. @item wpadapt
  7626. Whitepoint adaptation mode.
  7627. The accepted values are:
  7628. @table @samp
  7629. @item bradford
  7630. Bradford whitepoint adaptation
  7631. @item vonkries
  7632. von Kries whitepoint adaptation
  7633. @item identity
  7634. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7635. @end table
  7636. @item iall
  7637. Override all input properties at once. Same accepted values as @ref{all}.
  7638. @item ispace
  7639. Override input colorspace. Same accepted values as @ref{space}.
  7640. @item iprimaries
  7641. Override input color primaries. Same accepted values as @ref{primaries}.
  7642. @item itrc
  7643. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7644. @item irange
  7645. Override input color range. Same accepted values as @ref{range}.
  7646. @end table
  7647. The filter converts the transfer characteristics, color space and color
  7648. primaries to the specified user values. The output value, if not specified,
  7649. is set to a default value based on the "all" property. If that property is
  7650. also not specified, the filter will log an error. The output color range and
  7651. format default to the same value as the input color range and format. The
  7652. input transfer characteristics, color space, color primaries and color range
  7653. should be set on the input data. If any of these are missing, the filter will
  7654. log an error and no conversion will take place.
  7655. For example to convert the input to SMPTE-240M, use the command:
  7656. @example
  7657. colorspace=smpte240m
  7658. @end example
  7659. @section colorspace_cuda
  7660. CUDA accelerated implementation of the colorspace filter.
  7661. It is by no means feature complete compared to the software colorspace filter,
  7662. and at the current time only supports color range conversion between jpeg/full
  7663. and mpeg/limited range.
  7664. The filter accepts the following options:
  7665. @table @option
  7666. @item range
  7667. Specify output color range.
  7668. The accepted values are:
  7669. @table @samp
  7670. @item tv
  7671. TV (restricted) range
  7672. @item mpeg
  7673. MPEG (restricted) range
  7674. @item pc
  7675. PC (full) range
  7676. @item jpeg
  7677. JPEG (full) range
  7678. @end table
  7679. @end table
  7680. @section colortemperature
  7681. Adjust color temperature in video to simulate variations in ambient color temperature.
  7682. The filter accepts the following options:
  7683. @table @option
  7684. @item temperature
  7685. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7686. Default value is 6500 K.
  7687. @item mix
  7688. Set mixing with filtered output. Allowed range is from 0 to 1.
  7689. Default value is 1.
  7690. @item pl
  7691. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  7692. Default value is 0.
  7693. @end table
  7694. @subsection Commands
  7695. This filter supports same @ref{commands} as options.
  7696. @section convolution
  7697. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  7698. The filter accepts the following options:
  7699. @table @option
  7700. @item 0m
  7701. @item 1m
  7702. @item 2m
  7703. @item 3m
  7704. Set matrix for each plane.
  7705. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  7706. and from 1 to 49 odd number of signed integers in @var{row} mode.
  7707. @item 0rdiv
  7708. @item 1rdiv
  7709. @item 2rdiv
  7710. @item 3rdiv
  7711. Set multiplier for calculated value for each plane.
  7712. If unset or 0, it will be sum of all matrix elements.
  7713. @item 0bias
  7714. @item 1bias
  7715. @item 2bias
  7716. @item 3bias
  7717. Set bias for each plane. This value is added to the result of the multiplication.
  7718. Useful for making the overall image brighter or darker. Default is 0.0.
  7719. @item 0mode
  7720. @item 1mode
  7721. @item 2mode
  7722. @item 3mode
  7723. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  7724. Default is @var{square}.
  7725. @end table
  7726. @subsection Commands
  7727. This filter supports the all above options as @ref{commands}.
  7728. @subsection Examples
  7729. @itemize
  7730. @item
  7731. Apply sharpen:
  7732. @example
  7733. 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"
  7734. @end example
  7735. @item
  7736. Apply blur:
  7737. @example
  7738. 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"
  7739. @end example
  7740. @item
  7741. Apply edge enhance:
  7742. @example
  7743. 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"
  7744. @end example
  7745. @item
  7746. Apply edge detect:
  7747. @example
  7748. 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"
  7749. @end example
  7750. @item
  7751. Apply laplacian edge detector which includes diagonals:
  7752. @example
  7753. 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"
  7754. @end example
  7755. @item
  7756. Apply emboss:
  7757. @example
  7758. 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"
  7759. @end example
  7760. @end itemize
  7761. @section convolve
  7762. Apply 2D convolution of video stream in frequency domain using second stream
  7763. as impulse.
  7764. The filter accepts the following options:
  7765. @table @option
  7766. @item planes
  7767. Set which planes to process.
  7768. @item impulse
  7769. Set which impulse video frames will be processed, can be @var{first}
  7770. or @var{all}. Default is @var{all}.
  7771. @end table
  7772. The @code{convolve} filter also supports the @ref{framesync} options.
  7773. @section copy
  7774. Copy the input video source unchanged to the output. This is mainly useful for
  7775. testing purposes.
  7776. @anchor{coreimage}
  7777. @section coreimage
  7778. Video filtering on GPU using Apple's CoreImage API on OSX.
  7779. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  7780. processed by video hardware. However, software-based OpenGL implementations
  7781. exist which means there is no guarantee for hardware processing. It depends on
  7782. the respective OSX.
  7783. There are many filters and image generators provided by Apple that come with a
  7784. large variety of options. The filter has to be referenced by its name along
  7785. with its options.
  7786. The coreimage filter accepts the following options:
  7787. @table @option
  7788. @item list_filters
  7789. List all available filters and generators along with all their respective
  7790. options as well as possible minimum and maximum values along with the default
  7791. values.
  7792. @example
  7793. list_filters=true
  7794. @end example
  7795. @item filter
  7796. Specify all filters by their respective name and options.
  7797. Use @var{list_filters} to determine all valid filter names and options.
  7798. Numerical options are specified by a float value and are automatically clamped
  7799. to their respective value range. Vector and color options have to be specified
  7800. by a list of space separated float values. Character escaping has to be done.
  7801. A special option name @code{default} is available to use default options for a
  7802. filter.
  7803. It is required to specify either @code{default} or at least one of the filter options.
  7804. All omitted options are used with their default values.
  7805. The syntax of the filter string is as follows:
  7806. @example
  7807. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  7808. @end example
  7809. @item output_rect
  7810. Specify a rectangle where the output of the filter chain is copied into the
  7811. input image. It is given by a list of space separated float values:
  7812. @example
  7813. output_rect=x\ y\ width\ height
  7814. @end example
  7815. If not given, the output rectangle equals the dimensions of the input image.
  7816. The output rectangle is automatically cropped at the borders of the input
  7817. image. Negative values are valid for each component.
  7818. @example
  7819. output_rect=25\ 25\ 100\ 100
  7820. @end example
  7821. @end table
  7822. Several filters can be chained for successive processing without GPU-HOST
  7823. transfers allowing for fast processing of complex filter chains.
  7824. Currently, only filters with zero (generators) or exactly one (filters) input
  7825. image and one output image are supported. Also, transition filters are not yet
  7826. usable as intended.
  7827. Some filters generate output images with additional padding depending on the
  7828. respective filter kernel. The padding is automatically removed to ensure the
  7829. filter output has the same size as the input image.
  7830. For image generators, the size of the output image is determined by the
  7831. previous output image of the filter chain or the input image of the whole
  7832. filterchain, respectively. The generators do not use the pixel information of
  7833. this image to generate their output. However, the generated output is
  7834. blended onto this image, resulting in partial or complete coverage of the
  7835. output image.
  7836. The @ref{coreimagesrc} video source can be used for generating input images
  7837. which are directly fed into the filter chain. By using it, providing input
  7838. images by another video source or an input video is not required.
  7839. @subsection Examples
  7840. @itemize
  7841. @item
  7842. List all filters available:
  7843. @example
  7844. coreimage=list_filters=true
  7845. @end example
  7846. @item
  7847. Use the CIBoxBlur filter with default options to blur an image:
  7848. @example
  7849. coreimage=filter=CIBoxBlur@@default
  7850. @end example
  7851. @item
  7852. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  7853. its center at 100x100 and a radius of 50 pixels:
  7854. @example
  7855. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  7856. @end example
  7857. @item
  7858. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  7859. given as complete and escaped command-line for Apple's standard bash shell:
  7860. @example
  7861. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  7862. @end example
  7863. @end itemize
  7864. @section corr
  7865. Obtain the correlation between two input videos.
  7866. This filter takes two input videos.
  7867. Both input videos must have the same resolution and pixel format for
  7868. this filter to work correctly. Also it assumes that both inputs
  7869. have the same number of frames, which are compared one by one.
  7870. The obtained per component, average, min and max correlation is printed through
  7871. the logging system.
  7872. The filter stores the calculated correlation of each frame in frame metadata.
  7873. This filter also supports the @ref{framesync} options.
  7874. In the below example the input file @file{main.mpg} being processed is compared
  7875. with the reference file @file{ref.mpg}.
  7876. @example
  7877. ffmpeg -i main.mpg -i ref.mpg -lavfi corr -f null -
  7878. @end example
  7879. @section cover_rect
  7880. Cover a rectangular object
  7881. It accepts the following options:
  7882. @table @option
  7883. @item cover
  7884. Filepath of the optional cover image, needs to be in yuv420.
  7885. @item mode
  7886. Set covering mode.
  7887. It accepts the following values:
  7888. @table @samp
  7889. @item cover
  7890. cover it by the supplied image
  7891. @item blur
  7892. cover it by interpolating the surrounding pixels
  7893. @end table
  7894. Default value is @var{blur}.
  7895. @end table
  7896. @subsection Examples
  7897. @itemize
  7898. @item
  7899. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7900. @example
  7901. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7902. @end example
  7903. @end itemize
  7904. @section crop
  7905. Crop the input video to given dimensions.
  7906. It accepts the following parameters:
  7907. @table @option
  7908. @item w, out_w
  7909. The width of the output video. It defaults to @code{iw}.
  7910. This expression is evaluated only once during the filter
  7911. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  7912. @item h, out_h
  7913. The height of the output video. It defaults to @code{ih}.
  7914. This expression is evaluated only once during the filter
  7915. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  7916. @item x
  7917. The horizontal position, in the input video, of the left edge of the output
  7918. video. It defaults to @code{(in_w-out_w)/2}.
  7919. This expression is evaluated per-frame.
  7920. @item y
  7921. The vertical position, in the input video, of the top edge of the output video.
  7922. It defaults to @code{(in_h-out_h)/2}.
  7923. This expression is evaluated per-frame.
  7924. @item keep_aspect
  7925. If set to 1 will force the output display aspect ratio
  7926. to be the same of the input, by changing the output sample aspect
  7927. ratio. It defaults to 0.
  7928. @item exact
  7929. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  7930. width/height/x/y as specified and will not be rounded to nearest smaller value.
  7931. It defaults to 0.
  7932. @end table
  7933. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  7934. expressions containing the following constants:
  7935. @table @option
  7936. @item x
  7937. @item y
  7938. The computed values for @var{x} and @var{y}. They are evaluated for
  7939. each new frame.
  7940. @item in_w
  7941. @item in_h
  7942. The input width and height.
  7943. @item iw
  7944. @item ih
  7945. These are the same as @var{in_w} and @var{in_h}.
  7946. @item out_w
  7947. @item out_h
  7948. The output (cropped) width and height.
  7949. @item ow
  7950. @item oh
  7951. These are the same as @var{out_w} and @var{out_h}.
  7952. @item a
  7953. same as @var{iw} / @var{ih}
  7954. @item sar
  7955. input sample aspect ratio
  7956. @item dar
  7957. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7958. @item hsub
  7959. @item vsub
  7960. horizontal and vertical chroma subsample values. For example for the
  7961. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7962. @item n
  7963. The number of the input frame, starting from 0.
  7964. @item pos
  7965. the position in the file of the input frame, NAN if unknown
  7966. @item t
  7967. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  7968. @end table
  7969. The expression for @var{out_w} may depend on the value of @var{out_h},
  7970. and the expression for @var{out_h} may depend on @var{out_w}, but they
  7971. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  7972. evaluated after @var{out_w} and @var{out_h}.
  7973. The @var{x} and @var{y} parameters specify the expressions for the
  7974. position of the top-left corner of the output (non-cropped) area. They
  7975. are evaluated for each frame. If the evaluated value is not valid, it
  7976. is approximated to the nearest valid value.
  7977. The expression for @var{x} may depend on @var{y}, and the expression
  7978. for @var{y} may depend on @var{x}.
  7979. @subsection Examples
  7980. @itemize
  7981. @item
  7982. Crop area with size 100x100 at position (12,34).
  7983. @example
  7984. crop=100:100:12:34
  7985. @end example
  7986. Using named options, the example above becomes:
  7987. @example
  7988. crop=w=100:h=100:x=12:y=34
  7989. @end example
  7990. @item
  7991. Crop the central input area with size 100x100:
  7992. @example
  7993. crop=100:100
  7994. @end example
  7995. @item
  7996. Crop the central input area with size 2/3 of the input video:
  7997. @example
  7998. crop=2/3*in_w:2/3*in_h
  7999. @end example
  8000. @item
  8001. Crop the input video central square:
  8002. @example
  8003. crop=out_w=in_h
  8004. crop=in_h
  8005. @end example
  8006. @item
  8007. Delimit the rectangle with the top-left corner placed at position
  8008. 100:100 and the right-bottom corner corresponding to the right-bottom
  8009. corner of the input image.
  8010. @example
  8011. crop=in_w-100:in_h-100:100:100
  8012. @end example
  8013. @item
  8014. Crop 10 pixels from the left and right borders, and 20 pixels from
  8015. the top and bottom borders
  8016. @example
  8017. crop=in_w-2*10:in_h-2*20
  8018. @end example
  8019. @item
  8020. Keep only the bottom right quarter of the input image:
  8021. @example
  8022. crop=in_w/2:in_h/2:in_w/2:in_h/2
  8023. @end example
  8024. @item
  8025. Crop height for getting Greek harmony:
  8026. @example
  8027. crop=in_w:1/PHI*in_w
  8028. @end example
  8029. @item
  8030. Apply trembling effect:
  8031. @example
  8032. 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)
  8033. @end example
  8034. @item
  8035. Apply erratic camera effect depending on timestamp:
  8036. @example
  8037. 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)"
  8038. @end example
  8039. @item
  8040. Set x depending on the value of y:
  8041. @example
  8042. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  8043. @end example
  8044. @end itemize
  8045. @subsection Commands
  8046. This filter supports the following commands:
  8047. @table @option
  8048. @item w, out_w
  8049. @item h, out_h
  8050. @item x
  8051. @item y
  8052. Set width/height of the output video and the horizontal/vertical position
  8053. in the input video.
  8054. The command accepts the same syntax of the corresponding option.
  8055. If the specified expression is not valid, it is kept at its current
  8056. value.
  8057. @end table
  8058. @section cropdetect
  8059. Auto-detect the crop size.
  8060. It calculates the necessary cropping parameters and prints the
  8061. recommended parameters via the logging system. The detected dimensions
  8062. correspond to the non-black or video area of the input video according to @var{mode}.
  8063. It accepts the following parameters:
  8064. @table @option
  8065. @item mode
  8066. 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.
  8067. @table @samp
  8068. @item black
  8069. Detect black pixels surrounding the playing video. For fine control use option @var{limit}.
  8070. @item mvedges
  8071. Detect the playing video by the motion vectors inside the video and scanning for edge pixels typically forming the border of a playing video.
  8072. @end table
  8073. @item limit
  8074. Set higher black value threshold, which can be optionally specified
  8075. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  8076. value greater to the set value is considered non-black. It defaults to 24.
  8077. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  8078. on the bitdepth of the pixel format.
  8079. @item round
  8080. The value which the width/height should be divisible by. It defaults to
  8081. 16. The offset is automatically adjusted to center the video. Use 2 to
  8082. get only even dimensions (needed for 4:2:2 video). 16 is best when
  8083. encoding to most video codecs.
  8084. @item skip
  8085. Set the number of initial frames for which evaluation is skipped.
  8086. Default is 2. Range is 0 to INT_MAX.
  8087. @item reset_count, reset
  8088. Set the counter that determines after how many frames cropdetect will
  8089. reset the previously detected largest video area and start over to
  8090. detect the current optimal crop area. Default value is 0.
  8091. This can be useful when channel logos distort the video area. 0
  8092. indicates 'never reset', and returns the largest area encountered during
  8093. playback.
  8094. @item mv_threshold
  8095. Set motion in pixel units as threshold for motion detection. It defaults to 8.
  8096. @item low
  8097. @item high
  8098. Set low and high threshold values used by the Canny thresholding
  8099. algorithm.
  8100. The high threshold selects the "strong" edge pixels, which are then
  8101. connected through 8-connectivity with the "weak" edge pixels selected
  8102. by the low threshold.
  8103. @var{low} and @var{high} threshold values must be chosen in the range
  8104. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8105. Default value for @var{low} is @code{5/255}, and default value for @var{high}
  8106. is @code{15/255}.
  8107. @end table
  8108. @subsection Examples
  8109. @itemize
  8110. @item
  8111. Find video area surrounded by black borders:
  8112. @example
  8113. ffmpeg -i file.mp4 -vf cropdetect,metadata=mode=print -f null -
  8114. @end example
  8115. @item
  8116. Find an embedded video area, generate motion vectors beforehand:
  8117. @example
  8118. ffmpeg -i file.mp4 -vf mestimate,cropdetect=mode=mvedges,metadata=mode=print -f null -
  8119. @end example
  8120. @item
  8121. Find an embedded video area, use motion vectors from decoder:
  8122. @example
  8123. ffmpeg -flags2 +export_mvs -i file.mp4 -vf cropdetect=mode=mvedges,metadata=mode=print -f null -
  8124. @end example
  8125. @end itemize
  8126. @anchor{cue}
  8127. @section cue
  8128. Delay video filtering until a given wallclock timestamp. The filter first
  8129. passes on @option{preroll} amount of frames, then it buffers at most
  8130. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  8131. it forwards the buffered frames and also any subsequent frames coming in its
  8132. input.
  8133. The filter can be used synchronize the output of multiple ffmpeg processes for
  8134. realtime output devices like decklink. By putting the delay in the filtering
  8135. chain and pre-buffering frames the process can pass on data to output almost
  8136. immediately after the target wallclock timestamp is reached.
  8137. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  8138. some use cases.
  8139. @table @option
  8140. @item cue
  8141. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  8142. @item preroll
  8143. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  8144. @item buffer
  8145. The maximum duration of content to buffer before waiting for the cue expressed
  8146. in seconds. Default is 0.
  8147. @end table
  8148. @anchor{curves}
  8149. @section curves
  8150. Apply color adjustments using curves.
  8151. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  8152. component (red, green and blue) has its values defined by @var{N} key points
  8153. tied from each other using a smooth curve. The x-axis represents the pixel
  8154. values from the input frame, and the y-axis the new pixel values to be set for
  8155. the output frame.
  8156. By default, a component curve is defined by the two points @var{(0;0)} and
  8157. @var{(1;1)}. This creates a straight line where each original pixel value is
  8158. "adjusted" to its own value, which means no change to the image.
  8159. The filter allows you to redefine these two points and add some more. A new
  8160. curve will be define to pass smoothly through all these new coordinates. The
  8161. new defined points needs to be strictly increasing over the x-axis, and their
  8162. @var{x} and @var{y} values must be in the @var{[0;1]} interval. The curve is
  8163. formed by using a natural or monotonic cubic spline interpolation, depending
  8164. on the @var{interp} option (default: @code{natural}). The @code{natural}
  8165. spline produces a smoother curve in general while the monotonic (@code{pchip})
  8166. spline guarantees the transitions between the specified points to be
  8167. monotonic. If the computed curves happened to go outside the vector spaces,
  8168. the values will be clipped accordingly.
  8169. The filter accepts the following options:
  8170. @table @option
  8171. @item preset
  8172. Select one of the available color presets. This option can be used in addition
  8173. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  8174. options takes priority on the preset values.
  8175. Available presets are:
  8176. @table @samp
  8177. @item none
  8178. @item color_negative
  8179. @item cross_process
  8180. @item darker
  8181. @item increase_contrast
  8182. @item lighter
  8183. @item linear_contrast
  8184. @item medium_contrast
  8185. @item negative
  8186. @item strong_contrast
  8187. @item vintage
  8188. @end table
  8189. Default is @code{none}.
  8190. @item master, m
  8191. Set the master key points. These points will define a second pass mapping. It
  8192. is sometimes called a "luminance" or "value" mapping. It can be used with
  8193. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  8194. post-processing LUT.
  8195. @item red, r
  8196. Set the key points for the red component.
  8197. @item green, g
  8198. Set the key points for the green component.
  8199. @item blue, b
  8200. Set the key points for the blue component.
  8201. @item all
  8202. Set the key points for all components (not including master).
  8203. Can be used in addition to the other key points component
  8204. options. In this case, the unset component(s) will fallback on this
  8205. @option{all} setting.
  8206. @item psfile
  8207. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  8208. @item plot
  8209. Save Gnuplot script of the curves in specified file.
  8210. @item interp
  8211. Specify the kind of interpolation. Available algorithms are:
  8212. @table @samp
  8213. @item natural
  8214. Natural cubic spline using a piece-wise cubic polynomial that is twice continuously differentiable.
  8215. @item pchip
  8216. Monotonic cubic spline using a piecewise cubic Hermite interpolating polynomial (PCHIP).
  8217. @end table
  8218. @end table
  8219. To avoid some filtergraph syntax conflicts, each key points list need to be
  8220. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  8221. @subsection Commands
  8222. This filter supports same @ref{commands} as options.
  8223. @subsection Examples
  8224. @itemize
  8225. @item
  8226. Increase slightly the middle level of blue:
  8227. @example
  8228. curves=blue='0/0 0.5/0.58 1/1'
  8229. @end example
  8230. @item
  8231. Vintage effect:
  8232. @example
  8233. 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'
  8234. @end example
  8235. Here we obtain the following coordinates for each components:
  8236. @table @var
  8237. @item red
  8238. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  8239. @item green
  8240. @code{(0;0) (0.50;0.48) (1;1)}
  8241. @item blue
  8242. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  8243. @end table
  8244. @item
  8245. The previous example can also be achieved with the associated built-in preset:
  8246. @example
  8247. curves=preset=vintage
  8248. @end example
  8249. @item
  8250. Or simply:
  8251. @example
  8252. curves=vintage
  8253. @end example
  8254. @item
  8255. Use a Photoshop preset and redefine the points of the green component:
  8256. @example
  8257. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  8258. @end example
  8259. @item
  8260. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  8261. and @command{gnuplot}:
  8262. @example
  8263. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  8264. gnuplot -p /tmp/curves.plt
  8265. @end example
  8266. @end itemize
  8267. @section datascope
  8268. Video data analysis filter.
  8269. This filter shows hexadecimal pixel values of part of video.
  8270. The filter accepts the following options:
  8271. @table @option
  8272. @item size, s
  8273. Set output video size.
  8274. @item x
  8275. Set x offset from where to pick pixels.
  8276. @item y
  8277. Set y offset from where to pick pixels.
  8278. @item mode
  8279. Set scope mode, can be one of the following:
  8280. @table @samp
  8281. @item mono
  8282. Draw hexadecimal pixel values with white color on black background.
  8283. @item color
  8284. Draw hexadecimal pixel values with input video pixel color on black
  8285. background.
  8286. @item color2
  8287. Draw hexadecimal pixel values on color background picked from input video,
  8288. the text color is picked in such way so its always visible.
  8289. @end table
  8290. @item axis
  8291. Draw rows and columns numbers on left and top of video.
  8292. @item opacity
  8293. Set background opacity.
  8294. @item format
  8295. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  8296. @item components
  8297. Set pixel components to display. By default all pixel components are displayed.
  8298. @end table
  8299. @subsection Commands
  8300. This filter supports same @ref{commands} as options excluding @code{size} option.
  8301. @section dblur
  8302. Apply Directional blur filter.
  8303. The filter accepts the following options:
  8304. @table @option
  8305. @item angle
  8306. Set angle of directional blur. Default is @code{45}.
  8307. @item radius
  8308. Set radius of directional blur. Default is @code{5}.
  8309. @item planes
  8310. Set which planes to filter. By default all planes are filtered.
  8311. @end table
  8312. @subsection Commands
  8313. This filter supports same @ref{commands} as options.
  8314. The command accepts the same syntax of the corresponding option.
  8315. If the specified expression is not valid, it is kept at its current
  8316. value.
  8317. @section dctdnoiz
  8318. Denoise frames using 2D DCT (frequency domain filtering).
  8319. This filter is not designed for real time.
  8320. The filter accepts the following options:
  8321. @table @option
  8322. @item sigma, s
  8323. Set the noise sigma constant.
  8324. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  8325. coefficient (absolute value) below this threshold with be dropped.
  8326. If you need a more advanced filtering, see @option{expr}.
  8327. Default is @code{0}.
  8328. @item overlap
  8329. Set number overlapping pixels for each block. Since the filter can be slow, you
  8330. may want to reduce this value, at the cost of a less effective filter and the
  8331. risk of various artefacts.
  8332. If the overlapping value doesn't permit processing the whole input width or
  8333. height, a warning will be displayed and according borders won't be denoised.
  8334. Default value is @var{blocksize}-1, which is the best possible setting.
  8335. @item expr, e
  8336. Set the coefficient factor expression.
  8337. For each coefficient of a DCT block, this expression will be evaluated as a
  8338. multiplier value for the coefficient.
  8339. If this is option is set, the @option{sigma} option will be ignored.
  8340. The absolute value of the coefficient can be accessed through the @var{c}
  8341. variable.
  8342. @item n
  8343. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  8344. @var{blocksize}, which is the width and height of the processed blocks.
  8345. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  8346. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  8347. on the speed processing. Also, a larger block size does not necessarily means a
  8348. better de-noising.
  8349. @end table
  8350. @subsection Examples
  8351. Apply a denoise with a @option{sigma} of @code{4.5}:
  8352. @example
  8353. dctdnoiz=4.5
  8354. @end example
  8355. The same operation can be achieved using the expression system:
  8356. @example
  8357. dctdnoiz=e='gte(c, 4.5*3)'
  8358. @end example
  8359. Violent denoise using a block size of @code{16x16}:
  8360. @example
  8361. dctdnoiz=15:n=4
  8362. @end example
  8363. @section deband
  8364. Remove banding artifacts from input video.
  8365. It works by replacing banded pixels with average value of referenced pixels.
  8366. The filter accepts the following options:
  8367. @table @option
  8368. @item 1thr
  8369. @item 2thr
  8370. @item 3thr
  8371. @item 4thr
  8372. Set banding detection threshold for each plane. Default is 0.02.
  8373. Valid range is 0.00003 to 0.5.
  8374. If difference between current pixel and reference pixel is less than threshold,
  8375. it will be considered as banded.
  8376. @item range, r
  8377. Banding detection range in pixels. Default is 16. If positive, random number
  8378. in range 0 to set value will be used. If negative, exact absolute value
  8379. will be used.
  8380. The range defines square of four pixels around current pixel.
  8381. @item direction, d
  8382. Set direction in radians from which four pixel will be compared. If positive,
  8383. random direction from 0 to set direction will be picked. If negative, exact of
  8384. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  8385. will pick only pixels on same row and -PI/2 will pick only pixels on same
  8386. column.
  8387. @item blur, b
  8388. If enabled, current pixel is compared with average value of all four
  8389. surrounding pixels. The default is enabled. If disabled current pixel is
  8390. compared with all four surrounding pixels. The pixel is considered banded
  8391. if only all four differences with surrounding pixels are less than threshold.
  8392. @item coupling, c
  8393. If enabled, current pixel is changed if and only if all pixel components are banded,
  8394. e.g. banding detection threshold is triggered for all color components.
  8395. The default is disabled.
  8396. @end table
  8397. @subsection Commands
  8398. This filter supports the all above options as @ref{commands}.
  8399. @section deblock
  8400. Remove blocking artifacts from input video.
  8401. The filter accepts the following options:
  8402. @table @option
  8403. @item filter
  8404. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  8405. This controls what kind of deblocking is applied.
  8406. @item block
  8407. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  8408. @item alpha
  8409. @item beta
  8410. @item gamma
  8411. @item delta
  8412. Set blocking detection thresholds. Allowed range is 0 to 1.
  8413. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  8414. Using higher threshold gives more deblocking strength.
  8415. Setting @var{alpha} controls threshold detection at exact edge of block.
  8416. Remaining options controls threshold detection near the edge. Each one for
  8417. below/above or left/right. Setting any of those to @var{0} disables
  8418. deblocking.
  8419. @item planes
  8420. Set planes to filter. Default is to filter all available planes.
  8421. @end table
  8422. @subsection Examples
  8423. @itemize
  8424. @item
  8425. Deblock using weak filter and block size of 4 pixels.
  8426. @example
  8427. deblock=filter=weak:block=4
  8428. @end example
  8429. @item
  8430. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  8431. deblocking more edges.
  8432. @example
  8433. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  8434. @end example
  8435. @item
  8436. Similar as above, but filter only first plane.
  8437. @example
  8438. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  8439. @end example
  8440. @item
  8441. Similar as above, but filter only second and third plane.
  8442. @example
  8443. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  8444. @end example
  8445. @end itemize
  8446. @subsection Commands
  8447. This filter supports the all above options as @ref{commands}.
  8448. @anchor{decimate}
  8449. @section decimate
  8450. Drop duplicated frames at regular intervals.
  8451. The filter accepts the following options:
  8452. @table @option
  8453. @item cycle
  8454. Set the number of frames from which one will be dropped. Setting this to
  8455. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  8456. Default is @code{5}.
  8457. @item dupthresh
  8458. Set the threshold for duplicate detection. If the difference metric for a frame
  8459. is less than or equal to this value, then it is declared as duplicate. Default
  8460. is @code{1.1}
  8461. @item scthresh
  8462. Set scene change threshold. Default is @code{15}.
  8463. @item blockx
  8464. @item blocky
  8465. Set the size of the x and y-axis blocks used during metric calculations.
  8466. Larger blocks give better noise suppression, but also give worse detection of
  8467. small movements. Must be a power of two. Default is @code{32}.
  8468. @item ppsrc
  8469. Mark main input as a pre-processed input and activate clean source input
  8470. stream. This allows the input to be pre-processed with various filters to help
  8471. the metrics calculation while keeping the frame selection lossless. When set to
  8472. @code{1}, the first stream is for the pre-processed input, and the second
  8473. stream is the clean source from where the kept frames are chosen. Default is
  8474. @code{0}.
  8475. @item chroma
  8476. Set whether or not chroma is considered in the metric calculations. Default is
  8477. @code{1}.
  8478. @item mixed
  8479. Set whether or not the input only partially contains content to be decimated.
  8480. Default is @code{false}.
  8481. If enabled video output stream will be in variable frame rate.
  8482. @end table
  8483. @section deconvolve
  8484. Apply 2D deconvolution of video stream in frequency domain using second stream
  8485. as impulse.
  8486. The filter accepts the following options:
  8487. @table @option
  8488. @item planes
  8489. Set which planes to process.
  8490. @item impulse
  8491. Set which impulse video frames will be processed, can be @var{first}
  8492. or @var{all}. Default is @var{all}.
  8493. @item noise
  8494. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  8495. and height are not same and not power of 2 or if stream prior to convolving
  8496. had noise.
  8497. @end table
  8498. The @code{deconvolve} filter also supports the @ref{framesync} options.
  8499. @section dedot
  8500. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  8501. It accepts the following options:
  8502. @table @option
  8503. @item m
  8504. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  8505. @var{rainbows} for cross-color reduction.
  8506. @item lt
  8507. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  8508. @item tl
  8509. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  8510. @item tc
  8511. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  8512. @item ct
  8513. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  8514. @end table
  8515. @section deflate
  8516. Apply deflate effect to the video.
  8517. This filter replaces the pixel by the local(3x3) average by taking into account
  8518. only values lower than the pixel.
  8519. It accepts the following options:
  8520. @table @option
  8521. @item threshold0
  8522. @item threshold1
  8523. @item threshold2
  8524. @item threshold3
  8525. Limit the maximum change for each plane, default is 65535.
  8526. If 0, plane will remain unchanged.
  8527. @end table
  8528. @subsection Commands
  8529. This filter supports the all above options as @ref{commands}.
  8530. @section deflicker
  8531. Remove temporal frame luminance variations.
  8532. It accepts the following options:
  8533. @table @option
  8534. @item size, s
  8535. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  8536. @item mode, m
  8537. Set averaging mode to smooth temporal luminance variations.
  8538. Available values are:
  8539. @table @samp
  8540. @item am
  8541. Arithmetic mean
  8542. @item gm
  8543. Geometric mean
  8544. @item hm
  8545. Harmonic mean
  8546. @item qm
  8547. Quadratic mean
  8548. @item cm
  8549. Cubic mean
  8550. @item pm
  8551. Power mean
  8552. @item median
  8553. Median
  8554. @end table
  8555. @item bypass
  8556. Do not actually modify frame. Useful when one only wants metadata.
  8557. @end table
  8558. @section dejudder
  8559. Remove judder produced by partially interlaced telecined content.
  8560. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8561. source was partially telecined content then the output of @code{pullup,dejudder}
  8562. will have a variable frame rate. May change the recorded frame rate of the
  8563. container. Aside from that change, this filter will not affect constant frame
  8564. rate video.
  8565. The option available in this filter is:
  8566. @table @option
  8567. @item cycle
  8568. Specify the length of the window over which the judder repeats.
  8569. Accepts any integer greater than 1. Useful values are:
  8570. @table @samp
  8571. @item 4
  8572. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8573. @item 5
  8574. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8575. @item 20
  8576. If a mixture of the two.
  8577. @end table
  8578. The default is @samp{4}.
  8579. @end table
  8580. @section delogo
  8581. Suppress a TV station logo by a simple interpolation of the surrounding
  8582. pixels. Just set a rectangle covering the logo and watch it disappear
  8583. (and sometimes something even uglier appear - your mileage may vary).
  8584. It accepts the following parameters:
  8585. @table @option
  8586. @item x
  8587. @item y
  8588. Specify the top left corner coordinates of the logo. They must be
  8589. specified.
  8590. @item w
  8591. @item h
  8592. Specify the width and height of the logo to clear. They must be
  8593. specified.
  8594. @item show
  8595. When set to 1, a green rectangle is drawn on the screen to simplify
  8596. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8597. The default value is 0.
  8598. The rectangle is drawn on the outermost pixels which will be (partly)
  8599. replaced with interpolated values. The values of the next pixels
  8600. immediately outside this rectangle in each direction will be used to
  8601. compute the interpolated pixel values inside the rectangle.
  8602. @end table
  8603. @subsection Examples
  8604. @itemize
  8605. @item
  8606. Set a rectangle covering the area with top left corner coordinates 0,0
  8607. and size 100x77:
  8608. @example
  8609. delogo=x=0:y=0:w=100:h=77
  8610. @end example
  8611. @end itemize
  8612. @anchor{derain}
  8613. @section derain
  8614. Remove the rain in the input image/video by applying the derain methods based on
  8615. convolutional neural networks. Supported models:
  8616. @itemize
  8617. @item
  8618. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8619. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8620. @end itemize
  8621. Training as well as model generation scripts are provided in
  8622. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8623. Native model files (.model) can be generated from TensorFlow model
  8624. files (.pb) by using tools/python/convert.py
  8625. The filter accepts the following options:
  8626. @table @option
  8627. @item filter_type
  8628. Specify which filter to use. This option accepts the following values:
  8629. @table @samp
  8630. @item derain
  8631. Derain filter. To conduct derain filter, you need to use a derain model.
  8632. @item dehaze
  8633. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  8634. @end table
  8635. Default value is @samp{derain}.
  8636. @item dnn_backend
  8637. Specify which DNN backend to use for model loading and execution. This option accepts
  8638. the following values:
  8639. @table @samp
  8640. @item native
  8641. Native implementation of DNN loading and execution.
  8642. @item tensorflow
  8643. TensorFlow backend. To enable this backend you
  8644. need to install the TensorFlow for C library (see
  8645. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8646. @code{--enable-libtensorflow}
  8647. @end table
  8648. Default value is @samp{native}.
  8649. @item model
  8650. Set path to model file specifying network architecture and its parameters.
  8651. Note that different backends use different file formats. TensorFlow and native
  8652. backend can load files for only its format.
  8653. @end table
  8654. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  8655. @section deshake
  8656. Attempt to fix small changes in horizontal and/or vertical shift. This
  8657. filter helps remove camera shake from hand-holding a camera, bumping a
  8658. tripod, moving on a vehicle, etc.
  8659. The filter accepts the following options:
  8660. @table @option
  8661. @item x
  8662. @item y
  8663. @item w
  8664. @item h
  8665. Specify a rectangular area where to limit the search for motion
  8666. vectors.
  8667. If desired the search for motion vectors can be limited to a
  8668. rectangular area of the frame defined by its top left corner, width
  8669. and height. These parameters have the same meaning as the drawbox
  8670. filter which can be used to visualise the position of the bounding
  8671. box.
  8672. This is useful when simultaneous movement of subjects within the frame
  8673. might be confused for camera motion by the motion vector search.
  8674. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  8675. then the full frame is used. This allows later options to be set
  8676. without specifying the bounding box for the motion vector search.
  8677. Default - search the whole frame.
  8678. @item rx
  8679. @item ry
  8680. Specify the maximum extent of movement in x and y directions in the
  8681. range 0-64 pixels. Default 16.
  8682. @item edge
  8683. Specify how to generate pixels to fill blanks at the edge of the
  8684. frame. Available values are:
  8685. @table @samp
  8686. @item blank, 0
  8687. Fill zeroes at blank locations
  8688. @item original, 1
  8689. Original image at blank locations
  8690. @item clamp, 2
  8691. Extruded edge value at blank locations
  8692. @item mirror, 3
  8693. Mirrored edge at blank locations
  8694. @end table
  8695. Default value is @samp{mirror}.
  8696. @item blocksize
  8697. Specify the blocksize to use for motion search. Range 4-128 pixels,
  8698. default 8.
  8699. @item contrast
  8700. Specify the contrast threshold for blocks. Only blocks with more than
  8701. the specified contrast (difference between darkest and lightest
  8702. pixels) will be considered. Range 1-255, default 125.
  8703. @item search
  8704. Specify the search strategy. Available values are:
  8705. @table @samp
  8706. @item exhaustive, 0
  8707. Set exhaustive search
  8708. @item less, 1
  8709. Set less exhaustive search.
  8710. @end table
  8711. Default value is @samp{exhaustive}.
  8712. @item filename
  8713. If set then a detailed log of the motion search is written to the
  8714. specified file.
  8715. @end table
  8716. @section despill
  8717. Remove unwanted contamination of foreground colors, caused by reflected color of
  8718. greenscreen or bluescreen.
  8719. This filter accepts the following options:
  8720. @table @option
  8721. @item type
  8722. Set what type of despill to use.
  8723. @item mix
  8724. Set how spillmap will be generated.
  8725. @item expand
  8726. Set how much to get rid of still remaining spill.
  8727. @item red
  8728. Controls amount of red in spill area.
  8729. @item green
  8730. Controls amount of green in spill area.
  8731. Should be -1 for greenscreen.
  8732. @item blue
  8733. Controls amount of blue in spill area.
  8734. Should be -1 for bluescreen.
  8735. @item brightness
  8736. Controls brightness of spill area, preserving colors.
  8737. @item alpha
  8738. Modify alpha from generated spillmap.
  8739. @end table
  8740. @subsection Commands
  8741. This filter supports the all above options as @ref{commands}.
  8742. @section detelecine
  8743. Apply an exact inverse of the telecine operation. It requires a predefined
  8744. pattern specified using the pattern option which must be the same as that passed
  8745. to the telecine filter.
  8746. This filter accepts the following options:
  8747. @table @option
  8748. @item first_field
  8749. @table @samp
  8750. @item top, t
  8751. top field first
  8752. @item bottom, b
  8753. bottom field first
  8754. The default value is @code{top}.
  8755. @end table
  8756. @item pattern
  8757. A string of numbers representing the pulldown pattern you wish to apply.
  8758. The default value is @code{23}.
  8759. @item start_frame
  8760. A number representing position of the first frame with respect to the telecine
  8761. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  8762. @end table
  8763. @anchor{dilation}
  8764. @section dilation
  8765. Apply dilation effect to the video.
  8766. This filter replaces the pixel by the local(3x3) maximum.
  8767. It accepts the following options:
  8768. @table @option
  8769. @item threshold0
  8770. @item threshold1
  8771. @item threshold2
  8772. @item threshold3
  8773. Limit the maximum change for each plane, default is 65535.
  8774. If 0, plane will remain unchanged.
  8775. @item coordinates
  8776. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8777. pixels are used.
  8778. Flags to local 3x3 coordinates maps like this:
  8779. 1 2 3
  8780. 4 5
  8781. 6 7 8
  8782. @end table
  8783. @subsection Commands
  8784. This filter supports the all above options as @ref{commands}.
  8785. @section displace
  8786. Displace pixels as indicated by second and third input stream.
  8787. It takes three input streams and outputs one stream, the first input is the
  8788. source, and second and third input are displacement maps.
  8789. The second input specifies how much to displace pixels along the
  8790. x-axis, while the third input specifies how much to displace pixels
  8791. along the y-axis.
  8792. If one of displacement map streams terminates, last frame from that
  8793. displacement map will be used.
  8794. Note that once generated, displacements maps can be reused over and over again.
  8795. A description of the accepted options follows.
  8796. @table @option
  8797. @item edge
  8798. Set displace behavior for pixels that are out of range.
  8799. Available values are:
  8800. @table @samp
  8801. @item blank
  8802. Missing pixels are replaced by black pixels.
  8803. @item smear
  8804. Adjacent pixels will spread out to replace missing pixels.
  8805. @item wrap
  8806. Out of range pixels are wrapped so they point to pixels of other side.
  8807. @item mirror
  8808. Out of range pixels will be replaced with mirrored pixels.
  8809. @end table
  8810. Default is @samp{smear}.
  8811. @end table
  8812. @subsection Examples
  8813. @itemize
  8814. @item
  8815. Add ripple effect to rgb input of video size hd720:
  8816. @example
  8817. 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
  8818. @end example
  8819. @item
  8820. Add wave effect to rgb input of video size hd720:
  8821. @example
  8822. 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
  8823. @end example
  8824. @end itemize
  8825. @section dnn_classify
  8826. Do classification with deep neural networks based on bounding boxes.
  8827. The filter accepts the following options:
  8828. @table @option
  8829. @item dnn_backend
  8830. Specify which DNN backend to use for model loading and execution. This option accepts
  8831. only openvino now, tensorflow backends will be added.
  8832. @item model
  8833. Set path to model file specifying network architecture and its parameters.
  8834. Note that different backends use different file formats.
  8835. @item input
  8836. Set the input name of the dnn network.
  8837. @item output
  8838. Set the output name of the dnn network.
  8839. @item confidence
  8840. Set the confidence threshold (default: 0.5).
  8841. @item labels
  8842. Set path to label file specifying the mapping between label id and name.
  8843. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8844. The first line is the name of label id 0,
  8845. and the second line is the name of label id 1, etc.
  8846. The label id is considered as name if the label file is not provided.
  8847. @item backend_configs
  8848. Set the configs to be passed into backend
  8849. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8850. please use tools/python/tf_sess_config.py to get the configs for your system.
  8851. @end table
  8852. @section dnn_detect
  8853. Do object detection with deep neural networks.
  8854. The filter accepts the following options:
  8855. @table @option
  8856. @item dnn_backend
  8857. Specify which DNN backend to use for model loading and execution. This option accepts
  8858. only openvino now, tensorflow backends will be added.
  8859. @item model
  8860. Set path to model file specifying network architecture and its parameters.
  8861. Note that different backends use different file formats.
  8862. @item input
  8863. Set the input name of the dnn network.
  8864. @item output
  8865. Set the output name of the dnn network.
  8866. @item confidence
  8867. Set the confidence threshold (default: 0.5).
  8868. @item labels
  8869. Set path to label file specifying the mapping between label id and name.
  8870. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8871. The first line is the name of label id 0 (usually it is 'background'),
  8872. and the second line is the name of label id 1, etc.
  8873. The label id is considered as name if the label file is not provided.
  8874. @item backend_configs
  8875. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8876. Roll back to sync execution if the backend does not support async.
  8877. @end table
  8878. @anchor{dnn_processing}
  8879. @section dnn_processing
  8880. Do image processing with deep neural networks. It works together with another filter
  8881. which converts the pixel format of the Frame to what the dnn network requires.
  8882. The filter accepts the following options:
  8883. @table @option
  8884. @item dnn_backend
  8885. Specify which DNN backend to use for model loading and execution. This option accepts
  8886. the following values:
  8887. @table @samp
  8888. @item native
  8889. Native implementation of DNN loading and execution.
  8890. @item tensorflow
  8891. TensorFlow backend. To enable this backend you
  8892. need to install the TensorFlow for C library (see
  8893. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8894. @code{--enable-libtensorflow}
  8895. @item openvino
  8896. OpenVINO backend. To enable this backend you
  8897. need to build and install the OpenVINO for C library (see
  8898. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  8899. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  8900. be needed if the header files and libraries are not installed into system path)
  8901. @end table
  8902. Default value is @samp{native}.
  8903. @item model
  8904. Set path to model file specifying network architecture and its parameters.
  8905. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  8906. backend can load files for only its format.
  8907. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  8908. @item input
  8909. Set the input name of the dnn network.
  8910. @item output
  8911. Set the output name of the dnn network.
  8912. @item backend_configs
  8913. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8914. Roll back to sync execution if the backend does not support async.
  8915. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8916. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8917. @end table
  8918. @subsection Examples
  8919. @itemize
  8920. @item
  8921. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  8922. @example
  8923. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  8924. @end example
  8925. @item
  8926. Halve the pixel value of the frame with format gray32f:
  8927. @example
  8928. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  8929. @end example
  8930. @item
  8931. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  8932. @example
  8933. ./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
  8934. @end example
  8935. @item
  8936. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  8937. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8938. @example
  8939. ./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
  8940. @end example
  8941. @end itemize
  8942. @section drawbox
  8943. Draw a colored box on the input image.
  8944. It accepts the following parameters:
  8945. @table @option
  8946. @item x
  8947. @item y
  8948. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  8949. @item width, w
  8950. @item height, h
  8951. The expressions which specify the width and height of the box; if 0 they are interpreted as
  8952. the input width and height. It defaults to 0.
  8953. @item color, c
  8954. Specify the color of the box to write. For the general syntax of this option,
  8955. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8956. value @code{invert} is used, the box edge color is the same as the
  8957. video with inverted luma.
  8958. @item thickness, t
  8959. The expression which sets the thickness of the box edge.
  8960. A value of @code{fill} will create a filled box. Default value is @code{3}.
  8961. See below for the list of accepted constants.
  8962. @item replace
  8963. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  8964. will overwrite the video's color and alpha pixels.
  8965. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  8966. @end table
  8967. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8968. following constants:
  8969. @table @option
  8970. @item dar
  8971. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8972. @item hsub
  8973. @item vsub
  8974. horizontal and vertical chroma subsample values. For example for the
  8975. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8976. @item in_h, ih
  8977. @item in_w, iw
  8978. The input width and height.
  8979. @item sar
  8980. The input sample aspect ratio.
  8981. @item x
  8982. @item y
  8983. The x and y offset coordinates where the box is drawn.
  8984. @item w
  8985. @item h
  8986. The width and height of the drawn box.
  8987. @item box_source
  8988. Box source can be set as side_data_detection_bboxes if you want to use box data in
  8989. detection bboxes of side data.
  8990. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  8991. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  8992. not sure about the box source.
  8993. @item t
  8994. The thickness of the drawn box.
  8995. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  8996. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  8997. @end table
  8998. @subsection Examples
  8999. @itemize
  9000. @item
  9001. Draw a black box around the edge of the input image:
  9002. @example
  9003. drawbox
  9004. @end example
  9005. @item
  9006. Draw a box with color red and an opacity of 50%:
  9007. @example
  9008. drawbox=10:20:200:60:red@@0.5
  9009. @end example
  9010. The previous example can be specified as:
  9011. @example
  9012. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  9013. @end example
  9014. @item
  9015. Fill the box with pink color:
  9016. @example
  9017. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  9018. @end example
  9019. @item
  9020. Draw a 2-pixel red 2.40:1 mask:
  9021. @example
  9022. 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
  9023. @end example
  9024. @end itemize
  9025. @subsection Commands
  9026. This filter supports same commands as options.
  9027. The command accepts the same syntax of the corresponding option.
  9028. If the specified expression is not valid, it is kept at its current
  9029. value.
  9030. @anchor{drawgraph}
  9031. @section drawgraph
  9032. Draw a graph using input video metadata.
  9033. It accepts the following parameters:
  9034. @table @option
  9035. @item m1
  9036. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  9037. @item fg1
  9038. Set 1st foreground color expression.
  9039. @item m2
  9040. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  9041. @item fg2
  9042. Set 2nd foreground color expression.
  9043. @item m3
  9044. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  9045. @item fg3
  9046. Set 3rd foreground color expression.
  9047. @item m4
  9048. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  9049. @item fg4
  9050. Set 4th foreground color expression.
  9051. @item min
  9052. Set minimal value of metadata value.
  9053. @item max
  9054. Set maximal value of metadata value.
  9055. @item bg
  9056. Set graph background color. Default is white.
  9057. @item mode
  9058. Set graph mode.
  9059. Available values for mode is:
  9060. @table @samp
  9061. @item bar
  9062. @item dot
  9063. @item line
  9064. @end table
  9065. Default is @code{line}.
  9066. @item slide
  9067. Set slide mode.
  9068. Available values for slide is:
  9069. @table @samp
  9070. @item frame
  9071. Draw new frame when right border is reached.
  9072. @item replace
  9073. Replace old columns with new ones.
  9074. @item scroll
  9075. Scroll from right to left.
  9076. @item rscroll
  9077. Scroll from left to right.
  9078. @item picture
  9079. Draw single picture.
  9080. @end table
  9081. Default is @code{frame}.
  9082. @item size
  9083. Set size of graph video. For the syntax of this option, check the
  9084. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9085. The default value is @code{900x256}.
  9086. @item rate, r
  9087. Set the output frame rate. Default value is @code{25}.
  9088. The foreground color expressions can use the following variables:
  9089. @table @option
  9090. @item MIN
  9091. Minimal value of metadata value.
  9092. @item MAX
  9093. Maximal value of metadata value.
  9094. @item VAL
  9095. Current metadata key value.
  9096. @end table
  9097. The color is defined as 0xAABBGGRR.
  9098. @end table
  9099. Example using metadata from @ref{signalstats} filter:
  9100. @example
  9101. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  9102. @end example
  9103. Example using metadata from @ref{ebur128} filter:
  9104. @example
  9105. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  9106. @end example
  9107. @section drawgrid
  9108. Draw a grid on the input image.
  9109. It accepts the following parameters:
  9110. @table @option
  9111. @item x
  9112. @item y
  9113. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  9114. @item width, w
  9115. @item height, h
  9116. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  9117. input width and height, respectively, minus @code{thickness}, so image gets
  9118. framed. Default to 0.
  9119. @item color, c
  9120. Specify the color of the grid. For the general syntax of this option,
  9121. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9122. value @code{invert} is used, the grid color is the same as the
  9123. video with inverted luma.
  9124. @item thickness, t
  9125. The expression which sets the thickness of the grid line. Default value is @code{1}.
  9126. See below for the list of accepted constants.
  9127. @item replace
  9128. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  9129. will overwrite the video's color and alpha pixels.
  9130. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  9131. @end table
  9132. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9133. following constants:
  9134. @table @option
  9135. @item dar
  9136. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9137. @item hsub
  9138. @item vsub
  9139. horizontal and vertical chroma subsample values. For example for the
  9140. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9141. @item in_h, ih
  9142. @item in_w, iw
  9143. The input grid cell width and height.
  9144. @item sar
  9145. The input sample aspect ratio.
  9146. @item x
  9147. @item y
  9148. The x and y coordinates of some point of grid intersection (meant to configure offset).
  9149. @item w
  9150. @item h
  9151. The width and height of the drawn cell.
  9152. @item t
  9153. The thickness of the drawn cell.
  9154. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9155. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9156. @end table
  9157. @subsection Examples
  9158. @itemize
  9159. @item
  9160. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  9161. @example
  9162. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  9163. @end example
  9164. @item
  9165. Draw a white 3x3 grid with an opacity of 50%:
  9166. @example
  9167. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  9168. @end example
  9169. @end itemize
  9170. @subsection Commands
  9171. This filter supports same commands as options.
  9172. The command accepts the same syntax of the corresponding option.
  9173. If the specified expression is not valid, it is kept at its current
  9174. value.
  9175. @anchor{drawtext}
  9176. @section drawtext
  9177. Draw a text string or text from a specified file on top of a video, using the
  9178. libfreetype library.
  9179. To enable compilation of this filter, you need to configure FFmpeg with
  9180. @code{--enable-libfreetype}.
  9181. To enable default font fallback and the @var{font} option you need to
  9182. configure FFmpeg with @code{--enable-libfontconfig}.
  9183. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  9184. @code{--enable-libfribidi}.
  9185. @subsection Syntax
  9186. It accepts the following parameters:
  9187. @table @option
  9188. @item box
  9189. Used to draw a box around text using the background color.
  9190. The value must be either 1 (enable) or 0 (disable).
  9191. The default value of @var{box} is 0.
  9192. @item boxborderw
  9193. Set the width of the border to be drawn around the box using @var{boxcolor}.
  9194. The default value of @var{boxborderw} is 0.
  9195. @item boxcolor
  9196. The color to be used for drawing box around text. For the syntax of this
  9197. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9198. The default value of @var{boxcolor} is "white".
  9199. @item line_spacing
  9200. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  9201. The default value of @var{line_spacing} is 0.
  9202. @item borderw
  9203. Set the width of the border to be drawn around the text using @var{bordercolor}.
  9204. The default value of @var{borderw} is 0.
  9205. @item bordercolor
  9206. Set the color to be used for drawing border around text. For the syntax of this
  9207. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9208. The default value of @var{bordercolor} is "black".
  9209. @item expansion
  9210. Select how the @var{text} is expanded. Can be either @code{none},
  9211. @code{strftime} (deprecated) or
  9212. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  9213. below for details.
  9214. @item basetime
  9215. Set a start time for the count. Value is in microseconds. Only applied
  9216. in the deprecated strftime expansion mode. To emulate in normal expansion
  9217. mode use the @code{pts} function, supplying the start time (in seconds)
  9218. as the second argument.
  9219. @item fix_bounds
  9220. If true, check and fix text coords to avoid clipping.
  9221. @item fontcolor
  9222. The color to be used for drawing fonts. For the syntax of this option, check
  9223. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9224. The default value of @var{fontcolor} is "black".
  9225. @item fontcolor_expr
  9226. String which is expanded the same way as @var{text} to obtain dynamic
  9227. @var{fontcolor} value. By default this option has empty value and is not
  9228. processed. When this option is set, it overrides @var{fontcolor} option.
  9229. @item font
  9230. The font family to be used for drawing text. By default Sans.
  9231. @item fontfile
  9232. The font file to be used for drawing text. The path must be included.
  9233. This parameter is mandatory if the fontconfig support is disabled.
  9234. @item alpha
  9235. Draw the text applying alpha blending. The value can
  9236. be a number between 0.0 and 1.0.
  9237. The expression accepts the same variables @var{x, y} as well.
  9238. The default value is 1.
  9239. Please see @var{fontcolor_expr}.
  9240. @item fontsize
  9241. The font size to be used for drawing text.
  9242. The default value of @var{fontsize} is 16.
  9243. @item text_shaping
  9244. If set to 1, attempt to shape the text (for example, reverse the order of
  9245. right-to-left text and join Arabic characters) before drawing it.
  9246. Otherwise, just draw the text exactly as given.
  9247. By default 1 (if supported).
  9248. @item ft_load_flags
  9249. The flags to be used for loading the fonts.
  9250. The flags map the corresponding flags supported by libfreetype, and are
  9251. a combination of the following values:
  9252. @table @var
  9253. @item default
  9254. @item no_scale
  9255. @item no_hinting
  9256. @item render
  9257. @item no_bitmap
  9258. @item vertical_layout
  9259. @item force_autohint
  9260. @item crop_bitmap
  9261. @item pedantic
  9262. @item ignore_global_advance_width
  9263. @item no_recurse
  9264. @item ignore_transform
  9265. @item monochrome
  9266. @item linear_design
  9267. @item no_autohint
  9268. @end table
  9269. Default value is "default".
  9270. For more information consult the documentation for the FT_LOAD_*
  9271. libfreetype flags.
  9272. @item shadowcolor
  9273. The color to be used for drawing a shadow behind the drawn text. For the
  9274. syntax of this option, check the @ref{color syntax,,"Color" section in the
  9275. ffmpeg-utils manual,ffmpeg-utils}.
  9276. The default value of @var{shadowcolor} is "black".
  9277. @item shadowx
  9278. @item shadowy
  9279. The x and y offsets for the text shadow position with respect to the
  9280. position of the text. They can be either positive or negative
  9281. values. The default value for both is "0".
  9282. @item start_number
  9283. The starting frame number for the n/frame_num variable. The default value
  9284. is "0".
  9285. @item tabsize
  9286. The size in number of spaces to use for rendering the tab.
  9287. Default value is 4.
  9288. @item timecode
  9289. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  9290. format. It can be used with or without text parameter. @var{timecode_rate}
  9291. option must be specified.
  9292. @item timecode_rate, rate, r
  9293. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  9294. integer. Minimum value is "1".
  9295. Drop-frame timecode is supported for frame rates 30 & 60.
  9296. @item tc24hmax
  9297. If set to 1, the output of the timecode option will wrap around at 24 hours.
  9298. Default is 0 (disabled).
  9299. @item text
  9300. The text string to be drawn. The text must be a sequence of UTF-8
  9301. encoded characters.
  9302. This parameter is mandatory if no file is specified with the parameter
  9303. @var{textfile}.
  9304. @item textfile
  9305. A text file containing text to be drawn. The text must be a sequence
  9306. of UTF-8 encoded characters.
  9307. This parameter is mandatory if no text string is specified with the
  9308. parameter @var{text}.
  9309. If both @var{text} and @var{textfile} are specified, an error is thrown.
  9310. @item text_source
  9311. Text source should be set as side_data_detection_bboxes if you want to use text data in
  9312. detection bboxes of side data.
  9313. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  9314. text data in detection bboxes of side data. So please do not use this parameter
  9315. if you are not sure about the text source.
  9316. @item reload
  9317. The @var{textfile} will be reloaded at specified frame interval.
  9318. Be sure to update @var{textfile} atomically, or it may be read partially,
  9319. or even fail.
  9320. Range is 0 to INT_MAX. Default is 0.
  9321. @item x
  9322. @item y
  9323. The expressions which specify the offsets where text will be drawn
  9324. within the video frame. They are relative to the top/left border of the
  9325. output image.
  9326. The default value of @var{x} and @var{y} is "0".
  9327. See below for the list of accepted constants and functions.
  9328. @end table
  9329. The parameters for @var{x} and @var{y} are expressions containing the
  9330. following constants and functions:
  9331. @table @option
  9332. @item dar
  9333. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9334. @item hsub
  9335. @item vsub
  9336. horizontal and vertical chroma subsample values. For example for the
  9337. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9338. @item line_h, lh
  9339. the height of each text line
  9340. @item main_h, h, H
  9341. the input height
  9342. @item main_w, w, W
  9343. the input width
  9344. @item max_glyph_a, ascent
  9345. the maximum distance from the baseline to the highest/upper grid
  9346. coordinate used to place a glyph outline point, for all the rendered
  9347. glyphs.
  9348. It is a positive value, due to the grid's orientation with the Y axis
  9349. upwards.
  9350. @item max_glyph_d, descent
  9351. the maximum distance from the baseline to the lowest grid coordinate
  9352. used to place a glyph outline point, for all the rendered glyphs.
  9353. This is a negative value, due to the grid's orientation, with the Y axis
  9354. upwards.
  9355. @item max_glyph_h
  9356. maximum glyph height, that is the maximum height for all the glyphs
  9357. contained in the rendered text, it is equivalent to @var{ascent} -
  9358. @var{descent}.
  9359. @item max_glyph_w
  9360. maximum glyph width, that is the maximum width for all the glyphs
  9361. contained in the rendered text
  9362. @item n
  9363. the number of input frame, starting from 0
  9364. @item rand(min, max)
  9365. return a random number included between @var{min} and @var{max}
  9366. @item sar
  9367. The input sample aspect ratio.
  9368. @item t
  9369. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9370. @item text_h, th
  9371. the height of the rendered text
  9372. @item text_w, tw
  9373. the width of the rendered text
  9374. @item x
  9375. @item y
  9376. the x and y offset coordinates where the text is drawn.
  9377. These parameters allow the @var{x} and @var{y} expressions to refer
  9378. to each other, so you can for example specify @code{y=x/dar}.
  9379. @item pict_type
  9380. A one character description of the current frame's picture type.
  9381. @item pkt_pos
  9382. The current packet's position in the input file or stream
  9383. (in bytes, from the start of the input). A value of -1 indicates
  9384. this info is not available.
  9385. @item duration
  9386. The current packet's duration, in seconds.
  9387. @item pkt_size
  9388. The current packet's size (in bytes).
  9389. @end table
  9390. @anchor{drawtext_expansion}
  9391. @subsection Text expansion
  9392. If @option{expansion} is set to @code{strftime},
  9393. the filter recognizes strftime() sequences in the provided text and
  9394. expands them accordingly. Check the documentation of strftime(). This
  9395. feature is deprecated.
  9396. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  9397. If @option{expansion} is set to @code{normal} (which is the default),
  9398. the following expansion mechanism is used.
  9399. The backslash character @samp{\}, followed by any character, always expands to
  9400. the second character.
  9401. Sequences of the form @code{%@{...@}} are expanded. The text between the
  9402. braces is a function name, possibly followed by arguments separated by ':'.
  9403. If the arguments contain special characters or delimiters (':' or '@}'),
  9404. they should be escaped.
  9405. Note that they probably must also be escaped as the value for the
  9406. @option{text} option in the filter argument string and as the filter
  9407. argument in the filtergraph description, and possibly also for the shell,
  9408. that makes up to four levels of escaping; using a text file avoids these
  9409. problems.
  9410. The following functions are available:
  9411. @table @command
  9412. @item expr, e
  9413. The expression evaluation result.
  9414. It must take one argument specifying the expression to be evaluated,
  9415. which accepts the same constants and functions as the @var{x} and
  9416. @var{y} values. Note that not all constants should be used, for
  9417. example the text size is not known when evaluating the expression, so
  9418. the constants @var{text_w} and @var{text_h} will have an undefined
  9419. value.
  9420. @item expr_int_format, eif
  9421. Evaluate the expression's value and output as formatted integer.
  9422. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  9423. The second argument specifies the output format. Allowed values are @samp{x},
  9424. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  9425. @code{printf} function.
  9426. The third parameter is optional and sets the number of positions taken by the output.
  9427. It can be used to add padding with zeros from the left.
  9428. @item gmtime
  9429. The time at which the filter is running, expressed in UTC.
  9430. It can accept an argument: a strftime() format string.
  9431. The format string is extended to support the variable @var{%[1-6]N}
  9432. which prints fractions of the second with optionally specified number of digits.
  9433. @item localtime
  9434. The time at which the filter is running, expressed in the local time zone.
  9435. It can accept an argument: a strftime() format string.
  9436. The format string is extended to support the variable @var{%[1-6]N}
  9437. which prints fractions of the second with optionally specified number of digits.
  9438. @item metadata
  9439. Frame metadata. Takes one or two arguments.
  9440. The first argument is mandatory and specifies the metadata key.
  9441. The second argument is optional and specifies a default value, used when the
  9442. metadata key is not found or empty.
  9443. Available metadata can be identified by inspecting entries
  9444. starting with TAG included within each frame section
  9445. printed by running @code{ffprobe -show_frames}.
  9446. String metadata generated in filters leading to
  9447. the drawtext filter are also available.
  9448. @item n, frame_num
  9449. The frame number, starting from 0.
  9450. @item pict_type
  9451. A one character description of the current picture type.
  9452. @item pts
  9453. The timestamp of the current frame.
  9454. It can take up to three arguments.
  9455. The first argument is the format of the timestamp; it defaults to @code{flt}
  9456. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  9457. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  9458. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  9459. @code{localtime} stands for the timestamp of the frame formatted as
  9460. local time zone time.
  9461. The second argument is an offset added to the timestamp.
  9462. If the format is set to @code{hms}, a third argument @code{24HH} may be
  9463. supplied to present the hour part of the formatted timestamp in 24h format
  9464. (00-23).
  9465. If the format is set to @code{localtime} or @code{gmtime},
  9466. a third argument may be supplied: a strftime() format string.
  9467. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  9468. @end table
  9469. @subsection Commands
  9470. This filter supports altering parameters via commands:
  9471. @table @option
  9472. @item reinit
  9473. Alter existing filter parameters.
  9474. Syntax for the argument is the same as for filter invocation, e.g.
  9475. @example
  9476. fontsize=56:fontcolor=green:text='Hello World'
  9477. @end example
  9478. Full filter invocation with sendcmd would look like this:
  9479. @example
  9480. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  9481. @end example
  9482. @end table
  9483. If the entire argument can't be parsed or applied as valid values then the filter will
  9484. continue with its existing parameters.
  9485. @subsection Examples
  9486. @itemize
  9487. @item
  9488. Draw "Test Text" with font FreeSerif, using the default values for the
  9489. optional parameters.
  9490. @example
  9491. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  9492. @end example
  9493. @item
  9494. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  9495. and y=50 (counting from the top-left corner of the screen), text is
  9496. yellow with a red box around it. Both the text and the box have an
  9497. opacity of 20%.
  9498. @example
  9499. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  9500. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  9501. @end example
  9502. Note that the double quotes are not necessary if spaces are not used
  9503. within the parameter list.
  9504. @item
  9505. Show the text at the center of the video frame:
  9506. @example
  9507. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  9508. @end example
  9509. @item
  9510. Show the text at a random position, switching to a new position every 30 seconds:
  9511. @example
  9512. 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)"
  9513. @end example
  9514. @item
  9515. Show a text line sliding from right to left in the last row of the video
  9516. frame. The file @file{LONG_LINE} is assumed to contain a single line
  9517. with no newlines.
  9518. @example
  9519. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  9520. @end example
  9521. @item
  9522. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  9523. @example
  9524. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  9525. @end example
  9526. @item
  9527. Draw a single green letter "g", at the center of the input video.
  9528. The glyph baseline is placed at half screen height.
  9529. @example
  9530. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  9531. @end example
  9532. @item
  9533. Show text for 1 second every 3 seconds:
  9534. @example
  9535. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  9536. @end example
  9537. @item
  9538. Use fontconfig to set the font. Note that the colons need to be escaped.
  9539. @example
  9540. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  9541. @end example
  9542. @item
  9543. Draw "Test Text" with font size dependent on height of the video.
  9544. @example
  9545. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  9546. @end example
  9547. @item
  9548. Print the date of a real-time encoding (see strftime(3)):
  9549. @example
  9550. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  9551. @end example
  9552. @item
  9553. Show text fading in and out (appearing/disappearing):
  9554. @example
  9555. #!/bin/sh
  9556. DS=1.0 # display start
  9557. DE=10.0 # display end
  9558. FID=1.5 # fade in duration
  9559. FOD=5 # fade out duration
  9560. 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 @}"
  9561. @end example
  9562. @item
  9563. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9564. and the @option{fontsize} value are included in the @option{y} offset.
  9565. @example
  9566. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9567. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9568. @end example
  9569. @item
  9570. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9571. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9572. must have option @option{-export_path_metadata 1} for the special metadata fields
  9573. to be available for filters.
  9574. @example
  9575. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  9576. @end example
  9577. @end itemize
  9578. For more information about libfreetype, check:
  9579. @url{http://www.freetype.org/}.
  9580. For more information about fontconfig, check:
  9581. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  9582. For more information about libfribidi, check:
  9583. @url{http://fribidi.org/}.
  9584. @section edgedetect
  9585. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  9586. The filter accepts the following options:
  9587. @table @option
  9588. @item low
  9589. @item high
  9590. Set low and high threshold values used by the Canny thresholding
  9591. algorithm.
  9592. The high threshold selects the "strong" edge pixels, which are then
  9593. connected through 8-connectivity with the "weak" edge pixels selected
  9594. by the low threshold.
  9595. @var{low} and @var{high} threshold values must be chosen in the range
  9596. [0,1], and @var{low} should be lesser or equal to @var{high}.
  9597. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  9598. is @code{50/255}.
  9599. @item mode
  9600. Define the drawing mode.
  9601. @table @samp
  9602. @item wires
  9603. Draw white/gray wires on black background.
  9604. @item colormix
  9605. Mix the colors to create a paint/cartoon effect.
  9606. @item canny
  9607. Apply Canny edge detector on all selected planes.
  9608. @end table
  9609. Default value is @var{wires}.
  9610. @item planes
  9611. Select planes for filtering. By default all available planes are filtered.
  9612. @end table
  9613. @subsection Examples
  9614. @itemize
  9615. @item
  9616. Standard edge detection with custom values for the hysteresis thresholding:
  9617. @example
  9618. edgedetect=low=0.1:high=0.4
  9619. @end example
  9620. @item
  9621. Painting effect without thresholding:
  9622. @example
  9623. edgedetect=mode=colormix:high=0
  9624. @end example
  9625. @end itemize
  9626. @section elbg
  9627. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  9628. For each input image, the filter will compute the optimal mapping from
  9629. the input to the output given the codebook length, that is the number
  9630. of distinct output colors.
  9631. This filter accepts the following options.
  9632. @table @option
  9633. @item codebook_length, l
  9634. Set codebook length. The value must be a positive integer, and
  9635. represents the number of distinct output colors. Default value is 256.
  9636. @item nb_steps, n
  9637. Set the maximum number of iterations to apply for computing the optimal
  9638. mapping. The higher the value the better the result and the higher the
  9639. computation time. Default value is 1.
  9640. @item seed, s
  9641. Set a random seed, must be an integer included between 0 and
  9642. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  9643. will try to use a good random seed on a best effort basis.
  9644. @item pal8
  9645. Set pal8 output pixel format. This option does not work with codebook
  9646. length greater than 256. Default is disabled.
  9647. @item use_alpha
  9648. Include alpha values in the quantization calculation. Allows creating
  9649. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  9650. @end table
  9651. @section entropy
  9652. Measure graylevel entropy in histogram of color channels of video frames.
  9653. It accepts the following parameters:
  9654. @table @option
  9655. @item mode
  9656. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  9657. @var{diff} mode measures entropy of histogram delta values, absolute differences
  9658. between neighbour histogram values.
  9659. @end table
  9660. @section epx
  9661. Apply the EPX magnification filter which is designed for pixel art.
  9662. It accepts the following option:
  9663. @table @option
  9664. @item n
  9665. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  9666. @code{3xEPX}.
  9667. Default is @code{3}.
  9668. @end table
  9669. @section eq
  9670. Set brightness, contrast, saturation and approximate gamma adjustment.
  9671. The filter accepts the following options:
  9672. @table @option
  9673. @item contrast
  9674. Set the contrast expression. The value must be a float value in range
  9675. @code{-1000.0} to @code{1000.0}. The default value is "1".
  9676. @item brightness
  9677. Set the brightness expression. The value must be a float value in
  9678. range @code{-1.0} to @code{1.0}. The default value is "0".
  9679. @item saturation
  9680. Set the saturation expression. The value must be a float in
  9681. range @code{0.0} to @code{3.0}. The default value is "1".
  9682. @item gamma
  9683. Set the gamma expression. The value must be a float in range
  9684. @code{0.1} to @code{10.0}. The default value is "1".
  9685. @item gamma_r
  9686. Set the gamma expression for red. The value must be a float in
  9687. range @code{0.1} to @code{10.0}. The default value is "1".
  9688. @item gamma_g
  9689. Set the gamma expression for green. The value must be a float in range
  9690. @code{0.1} to @code{10.0}. The default value is "1".
  9691. @item gamma_b
  9692. Set the gamma expression for blue. The value must be a float in range
  9693. @code{0.1} to @code{10.0}. The default value is "1".
  9694. @item gamma_weight
  9695. Set the gamma weight expression. It can be used to reduce the effect
  9696. of a high gamma value on bright image areas, e.g. keep them from
  9697. getting overamplified and just plain white. The value must be a float
  9698. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  9699. gamma correction all the way down while @code{1.0} leaves it at its
  9700. full strength. Default is "1".
  9701. @item eval
  9702. Set when the expressions for brightness, contrast, saturation and
  9703. gamma expressions are evaluated.
  9704. It accepts the following values:
  9705. @table @samp
  9706. @item init
  9707. only evaluate expressions once during the filter initialization or
  9708. when a command is processed
  9709. @item frame
  9710. evaluate expressions for each incoming frame
  9711. @end table
  9712. Default value is @samp{init}.
  9713. @end table
  9714. The expressions accept the following parameters:
  9715. @table @option
  9716. @item n
  9717. frame count of the input frame starting from 0
  9718. @item pos
  9719. byte position of the corresponding packet in the input file, NAN if
  9720. unspecified
  9721. @item r
  9722. frame rate of the input video, NAN if the input frame rate is unknown
  9723. @item t
  9724. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9725. @end table
  9726. @subsection Commands
  9727. The filter supports the following commands:
  9728. @table @option
  9729. @item contrast
  9730. Set the contrast expression.
  9731. @item brightness
  9732. Set the brightness expression.
  9733. @item saturation
  9734. Set the saturation expression.
  9735. @item gamma
  9736. Set the gamma expression.
  9737. @item gamma_r
  9738. Set the gamma_r expression.
  9739. @item gamma_g
  9740. Set gamma_g expression.
  9741. @item gamma_b
  9742. Set gamma_b expression.
  9743. @item gamma_weight
  9744. Set gamma_weight expression.
  9745. The command accepts the same syntax of the corresponding option.
  9746. If the specified expression is not valid, it is kept at its current
  9747. value.
  9748. @end table
  9749. @anchor{erosion}
  9750. @section erosion
  9751. Apply erosion effect to the video.
  9752. This filter replaces the pixel by the local(3x3) minimum.
  9753. It accepts the following options:
  9754. @table @option
  9755. @item threshold0
  9756. @item threshold1
  9757. @item threshold2
  9758. @item threshold3
  9759. Limit the maximum change for each plane, default is 65535.
  9760. If 0, plane will remain unchanged.
  9761. @item coordinates
  9762. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9763. pixels are used.
  9764. Flags to local 3x3 coordinates maps like this:
  9765. 1 2 3
  9766. 4 5
  9767. 6 7 8
  9768. @end table
  9769. @subsection Commands
  9770. This filter supports the all above options as @ref{commands}.
  9771. @section estdif
  9772. Deinterlace the input video ("estdif" stands for "Edge Slope
  9773. Tracing Deinterlacing Filter").
  9774. Spatial only filter that uses edge slope tracing algorithm
  9775. to interpolate missing lines.
  9776. It accepts the following parameters:
  9777. @table @option
  9778. @item mode
  9779. The interlacing mode to adopt. It accepts one of the following values:
  9780. @table @option
  9781. @item frame
  9782. Output one frame for each frame.
  9783. @item field
  9784. Output one frame for each field.
  9785. @end table
  9786. The default value is @code{field}.
  9787. @item parity
  9788. The picture field parity assumed for the input interlaced video. It accepts one
  9789. of the following values:
  9790. @table @option
  9791. @item tff
  9792. Assume the top field is first.
  9793. @item bff
  9794. Assume the bottom field is first.
  9795. @item auto
  9796. Enable automatic detection of field parity.
  9797. @end table
  9798. The default value is @code{auto}.
  9799. If the interlacing is unknown or the decoder does not export this information,
  9800. top field first will be assumed.
  9801. @item deint
  9802. Specify which frames to deinterlace. Accepts one of the following
  9803. values:
  9804. @table @option
  9805. @item all
  9806. Deinterlace all frames.
  9807. @item interlaced
  9808. Only deinterlace frames marked as interlaced.
  9809. @end table
  9810. The default value is @code{all}.
  9811. @item rslope
  9812. Specify the search radius for edge slope tracing. Default value is 1.
  9813. Allowed range is from 1 to 15.
  9814. @item redge
  9815. Specify the search radius for best edge matching. Default value is 2.
  9816. Allowed range is from 0 to 15.
  9817. @item ecost
  9818. Specify the edge cost for edge matching. Default value is 1.0.
  9819. Allowed range is from 0 to 9.
  9820. @item mcost
  9821. Specify the middle cost for edge matching. Default value is 0.5.
  9822. Allowed range is from 0 to 1.
  9823. @item dcost
  9824. Specify the distance cost for edge matching. Default value is 0.5.
  9825. Allowed range is from 0 to 1.
  9826. @item interp
  9827. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  9828. of the following values:
  9829. @table @option
  9830. @item 2p
  9831. Two-point interpolation.
  9832. @item 4p
  9833. Four-point interpolation.
  9834. @item 6p
  9835. Six-point interpolation.
  9836. @end table
  9837. @end table
  9838. @subsection Commands
  9839. This filter supports same @ref{commands} as options.
  9840. @section exposure
  9841. Adjust exposure of the video stream.
  9842. The filter accepts the following options:
  9843. @table @option
  9844. @item exposure
  9845. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  9846. Default value is 0 EV.
  9847. @item black
  9848. Set the black level correction. Allowed range is from -1.0 to 1.0.
  9849. Default value is 0.
  9850. @end table
  9851. @subsection Commands
  9852. This filter supports same @ref{commands} as options.
  9853. @section extractplanes
  9854. Extract color channel components from input video stream into
  9855. separate grayscale video streams.
  9856. The filter accepts the following option:
  9857. @table @option
  9858. @item planes
  9859. Set plane(s) to extract.
  9860. Available values for planes are:
  9861. @table @samp
  9862. @item y
  9863. @item u
  9864. @item v
  9865. @item a
  9866. @item r
  9867. @item g
  9868. @item b
  9869. @end table
  9870. Choosing planes not available in the input will result in an error.
  9871. That means you cannot select @code{r}, @code{g}, @code{b} planes
  9872. with @code{y}, @code{u}, @code{v} planes at same time.
  9873. @end table
  9874. @subsection Examples
  9875. @itemize
  9876. @item
  9877. Extract luma, u and v color channel component from input video frame
  9878. into 3 grayscale outputs:
  9879. @example
  9880. 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
  9881. @end example
  9882. @end itemize
  9883. @section fade
  9884. Apply a fade-in/out effect to the input video.
  9885. It accepts the following parameters:
  9886. @table @option
  9887. @item type, t
  9888. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  9889. effect.
  9890. Default is @code{in}.
  9891. @item start_frame, s
  9892. Specify the number of the frame to start applying the fade
  9893. effect at. Default is 0.
  9894. @item nb_frames, n
  9895. The number of frames that the fade effect lasts. At the end of the
  9896. fade-in effect, the output video will have the same intensity as the input video.
  9897. At the end of the fade-out transition, the output video will be filled with the
  9898. selected @option{color}.
  9899. Default is 25.
  9900. @item alpha
  9901. If set to 1, fade only alpha channel, if one exists on the input.
  9902. Default value is 0.
  9903. @item start_time, st
  9904. Specify the timestamp (in seconds) of the frame to start to apply the fade
  9905. effect. If both start_frame and start_time are specified, the fade will start at
  9906. whichever comes last. Default is 0.
  9907. @item duration, d
  9908. The number of seconds for which the fade effect has to last. At the end of the
  9909. fade-in effect the output video will have the same intensity as the input video,
  9910. at the end of the fade-out transition the output video will be filled with the
  9911. selected @option{color}.
  9912. If both duration and nb_frames are specified, duration is used. Default is 0
  9913. (nb_frames is used by default).
  9914. @item color, c
  9915. Specify the color of the fade. Default is "black".
  9916. @end table
  9917. @subsection Examples
  9918. @itemize
  9919. @item
  9920. Fade in the first 30 frames of video:
  9921. @example
  9922. fade=in:0:30
  9923. @end example
  9924. The command above is equivalent to:
  9925. @example
  9926. fade=t=in:s=0:n=30
  9927. @end example
  9928. @item
  9929. Fade out the last 45 frames of a 200-frame video:
  9930. @example
  9931. fade=out:155:45
  9932. fade=type=out:start_frame=155:nb_frames=45
  9933. @end example
  9934. @item
  9935. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  9936. @example
  9937. fade=in:0:25, fade=out:975:25
  9938. @end example
  9939. @item
  9940. Make the first 5 frames yellow, then fade in from frame 5-24:
  9941. @example
  9942. fade=in:5:20:color=yellow
  9943. @end example
  9944. @item
  9945. Fade in alpha over first 25 frames of video:
  9946. @example
  9947. fade=in:0:25:alpha=1
  9948. @end example
  9949. @item
  9950. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  9951. @example
  9952. fade=t=in:st=5.5:d=0.5
  9953. @end example
  9954. @end itemize
  9955. @section feedback
  9956. Apply feedback video filter.
  9957. This filter pass cropped input frames to 2nd output.
  9958. From there it can be filtered with other video filters.
  9959. After filter receives frame from 2nd input, that frame
  9960. is combined on top of original frame from 1st input and passed
  9961. to 1st output.
  9962. The typical usage is filter only part of frame.
  9963. The filter accepts the following options:
  9964. @table @option
  9965. @item x
  9966. @item y
  9967. Set the top left crop position.
  9968. @item w
  9969. @item h
  9970. Set the crop size.
  9971. @end table
  9972. @subsection Examples
  9973. @itemize
  9974. @item
  9975. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  9976. @example
  9977. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  9978. @end example
  9979. @item
  9980. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  9981. @example
  9982. [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]
  9983. @end example
  9984. @end itemize
  9985. @section fftdnoiz
  9986. Denoise frames using 3D FFT (frequency domain filtering).
  9987. The filter accepts the following options:
  9988. @table @option
  9989. @item sigma
  9990. Set the noise sigma constant. This sets denoising strength.
  9991. Default value is 1. Allowed range is from 0 to 30.
  9992. Using very high sigma with low overlap may give blocking artifacts.
  9993. @item amount
  9994. Set amount of denoising. By default all detected noise is reduced.
  9995. Default value is 1. Allowed range is from 0 to 1.
  9996. @item block
  9997. Set size of block in pixels, Default is 32, can be 8 to 256.
  9998. @item overlap
  9999. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  10000. @item method
  10001. Set denoising method. Default is @code{wiener}, can also be @code{hard}.
  10002. @item prev
  10003. Set number of previous frames to use for denoising. By default is set to 0.
  10004. @item next
  10005. Set number of next frames to to use for denoising. By default is set to 0.
  10006. @item planes
  10007. Set planes which will be filtered, by default are all available filtered
  10008. except alpha.
  10009. @end table
  10010. @section fftfilt
  10011. Apply arbitrary expressions to samples in frequency domain
  10012. @table @option
  10013. @item dc_Y
  10014. Adjust the dc value (gain) of the luma plane of the image. The filter
  10015. accepts an integer value in range @code{0} to @code{1000}. The default
  10016. value is set to @code{0}.
  10017. @item dc_U
  10018. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  10019. filter accepts an integer value in range @code{0} to @code{1000}. The
  10020. default value is set to @code{0}.
  10021. @item dc_V
  10022. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  10023. filter accepts an integer value in range @code{0} to @code{1000}. The
  10024. default value is set to @code{0}.
  10025. @item weight_Y
  10026. Set the frequency domain weight expression for the luma plane.
  10027. @item weight_U
  10028. Set the frequency domain weight expression for the 1st chroma plane.
  10029. @item weight_V
  10030. Set the frequency domain weight expression for the 2nd chroma plane.
  10031. @item eval
  10032. Set when the expressions are evaluated.
  10033. It accepts the following values:
  10034. @table @samp
  10035. @item init
  10036. Only evaluate expressions once during the filter initialization.
  10037. @item frame
  10038. Evaluate expressions for each incoming frame.
  10039. @end table
  10040. Default value is @samp{init}.
  10041. The filter accepts the following variables:
  10042. @item X
  10043. @item Y
  10044. The coordinates of the current sample.
  10045. @item W
  10046. @item H
  10047. The width and height of the image.
  10048. @item N
  10049. The number of input frame, starting from 0.
  10050. @item WS
  10051. @item HS
  10052. The size of FFT array for horizontal and vertical processing.
  10053. @end table
  10054. @subsection Examples
  10055. @itemize
  10056. @item
  10057. High-pass:
  10058. @example
  10059. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  10060. @end example
  10061. @item
  10062. Low-pass:
  10063. @example
  10064. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  10065. @end example
  10066. @item
  10067. Sharpen:
  10068. @example
  10069. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  10070. @end example
  10071. @item
  10072. Blur:
  10073. @example
  10074. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  10075. @end example
  10076. @end itemize
  10077. @section field
  10078. Extract a single field from an interlaced image using stride
  10079. arithmetic to avoid wasting CPU time. The output frames are marked as
  10080. non-interlaced.
  10081. The filter accepts the following options:
  10082. @table @option
  10083. @item type
  10084. Specify whether to extract the top (if the value is @code{0} or
  10085. @code{top}) or the bottom field (if the value is @code{1} or
  10086. @code{bottom}).
  10087. @end table
  10088. @section fieldhint
  10089. Create new frames by copying the top and bottom fields from surrounding frames
  10090. supplied as numbers by the hint file.
  10091. @table @option
  10092. @item hint
  10093. Set file containing hints: absolute/relative frame numbers.
  10094. There must be one line for each frame in a clip. Each line must contain two
  10095. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  10096. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  10097. is current frame number for @code{absolute} mode or out of [-1, 1] range
  10098. for @code{relative} mode. First number tells from which frame to pick up top
  10099. field and second number tells from which frame to pick up bottom field.
  10100. If optionally followed by @code{+} output frame will be marked as interlaced,
  10101. else if followed by @code{-} output frame will be marked as progressive, else
  10102. it will be marked same as input frame.
  10103. If optionally followed by @code{t} output frame will use only top field, or in
  10104. case of @code{b} it will use only bottom field.
  10105. If line starts with @code{#} or @code{;} that line is skipped.
  10106. @item mode
  10107. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  10108. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  10109. are more frames to process than @code{hint} file is seek back to start.
  10110. @end table
  10111. Example of first several lines of @code{hint} file for @code{relative} mode:
  10112. @example
  10113. 0,0 - # first frame
  10114. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  10115. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  10116. 1,0 -
  10117. 0,0 -
  10118. 0,0 -
  10119. 1,0 -
  10120. 1,0 -
  10121. 1,0 -
  10122. 0,0 -
  10123. 0,0 -
  10124. 1,0 -
  10125. 1,0 -
  10126. 1,0 -
  10127. 0,0 -
  10128. @end example
  10129. @section fieldmatch
  10130. Field matching filter for inverse telecine. It is meant to reconstruct the
  10131. progressive frames from a telecined stream. The filter does not drop duplicated
  10132. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  10133. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  10134. The separation of the field matching and the decimation is notably motivated by
  10135. the possibility of inserting a de-interlacing filter fallback between the two.
  10136. If the source has mixed telecined and real interlaced content,
  10137. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  10138. But these remaining combed frames will be marked as interlaced, and thus can be
  10139. de-interlaced by a later filter such as @ref{yadif} before decimation.
  10140. In addition to the various configuration options, @code{fieldmatch} can take an
  10141. optional second stream, activated through the @option{ppsrc} option. If
  10142. enabled, the frames reconstruction will be based on the fields and frames from
  10143. this second stream. This allows the first input to be pre-processed in order to
  10144. help the various algorithms of the filter, while keeping the output lossless
  10145. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  10146. or brightness/contrast adjustments can help.
  10147. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  10148. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  10149. which @code{fieldmatch} is based on. While the semantic and usage are very
  10150. close, some behaviour and options names can differ.
  10151. The @ref{decimate} filter currently only works for constant frame rate input.
  10152. If your input has mixed telecined (30fps) and progressive content with a lower
  10153. framerate like 24fps use the following filterchain to produce the necessary cfr
  10154. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  10155. The filter accepts the following options:
  10156. @table @option
  10157. @item order
  10158. Specify the assumed field order of the input stream. Available values are:
  10159. @table @samp
  10160. @item auto
  10161. Auto detect parity (use FFmpeg's internal parity value).
  10162. @item bff
  10163. Assume bottom field first.
  10164. @item tff
  10165. Assume top field first.
  10166. @end table
  10167. Note that it is sometimes recommended not to trust the parity announced by the
  10168. stream.
  10169. Default value is @var{auto}.
  10170. @item mode
  10171. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  10172. sense that it won't risk creating jerkiness due to duplicate frames when
  10173. possible, but if there are bad edits or blended fields it will end up
  10174. outputting combed frames when a good match might actually exist. On the other
  10175. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  10176. but will almost always find a good frame if there is one. The other values are
  10177. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  10178. jerkiness and creating duplicate frames versus finding good matches in sections
  10179. with bad edits, orphaned fields, blended fields, etc.
  10180. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  10181. Available values are:
  10182. @table @samp
  10183. @item pc
  10184. 2-way matching (p/c)
  10185. @item pc_n
  10186. 2-way matching, and trying 3rd match if still combed (p/c + n)
  10187. @item pc_u
  10188. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  10189. @item pc_n_ub
  10190. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  10191. still combed (p/c + n + u/b)
  10192. @item pcn
  10193. 3-way matching (p/c/n)
  10194. @item pcn_ub
  10195. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  10196. detected as combed (p/c/n + u/b)
  10197. @end table
  10198. The parenthesis at the end indicate the matches that would be used for that
  10199. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  10200. @var{top}).
  10201. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  10202. the slowest.
  10203. Default value is @var{pc_n}.
  10204. @item ppsrc
  10205. Mark the main input stream as a pre-processed input, and enable the secondary
  10206. input stream as the clean source to pick the fields from. See the filter
  10207. introduction for more details. It is similar to the @option{clip2} feature from
  10208. VFM/TFM.
  10209. Default value is @code{0} (disabled).
  10210. @item field
  10211. Set the field to match from. It is recommended to set this to the same value as
  10212. @option{order} unless you experience matching failures with that setting. In
  10213. certain circumstances changing the field that is used to match from can have a
  10214. large impact on matching performance. Available values are:
  10215. @table @samp
  10216. @item auto
  10217. Automatic (same value as @option{order}).
  10218. @item bottom
  10219. Match from the bottom field.
  10220. @item top
  10221. Match from the top field.
  10222. @end table
  10223. Default value is @var{auto}.
  10224. @item mchroma
  10225. Set whether or not chroma is included during the match comparisons. In most
  10226. cases it is recommended to leave this enabled. You should set this to @code{0}
  10227. only if your clip has bad chroma problems such as heavy rainbowing or other
  10228. artifacts. Setting this to @code{0} could also be used to speed things up at
  10229. the cost of some accuracy.
  10230. Default value is @code{1}.
  10231. @item y0
  10232. @item y1
  10233. These define an exclusion band which excludes the lines between @option{y0} and
  10234. @option{y1} from being included in the field matching decision. An exclusion
  10235. band can be used to ignore subtitles, a logo, or other things that may
  10236. interfere with the matching. @option{y0} sets the starting scan line and
  10237. @option{y1} sets the ending line; all lines in between @option{y0} and
  10238. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  10239. @option{y0} and @option{y1} to the same value will disable the feature.
  10240. @option{y0} and @option{y1} defaults to @code{0}.
  10241. @item scthresh
  10242. Set the scene change detection threshold as a percentage of maximum change on
  10243. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  10244. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  10245. @option{scthresh} is @code{[0.0, 100.0]}.
  10246. Default value is @code{12.0}.
  10247. @item combmatch
  10248. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  10249. account the combed scores of matches when deciding what match to use as the
  10250. final match. Available values are:
  10251. @table @samp
  10252. @item none
  10253. No final matching based on combed scores.
  10254. @item sc
  10255. Combed scores are only used when a scene change is detected.
  10256. @item full
  10257. Use combed scores all the time.
  10258. @end table
  10259. Default is @var{sc}.
  10260. @item combdbg
  10261. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  10262. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  10263. Available values are:
  10264. @table @samp
  10265. @item none
  10266. No forced calculation.
  10267. @item pcn
  10268. Force p/c/n calculations.
  10269. @item pcnub
  10270. Force p/c/n/u/b calculations.
  10271. @end table
  10272. Default value is @var{none}.
  10273. @item cthresh
  10274. This is the area combing threshold used for combed frame detection. This
  10275. essentially controls how "strong" or "visible" combing must be to be detected.
  10276. Larger values mean combing must be more visible and smaller values mean combing
  10277. can be less visible or strong and still be detected. Valid settings are from
  10278. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  10279. be detected as combed). This is basically a pixel difference value. A good
  10280. range is @code{[8, 12]}.
  10281. Default value is @code{9}.
  10282. @item chroma
  10283. Sets whether or not chroma is considered in the combed frame decision. Only
  10284. disable this if your source has chroma problems (rainbowing, etc.) that are
  10285. causing problems for the combed frame detection with chroma enabled. Actually,
  10286. using @option{chroma}=@var{0} is usually more reliable, except for the case
  10287. where there is chroma only combing in the source.
  10288. Default value is @code{0}.
  10289. @item blockx
  10290. @item blocky
  10291. Respectively set the x-axis and y-axis size of the window used during combed
  10292. frame detection. This has to do with the size of the area in which
  10293. @option{combpel} pixels are required to be detected as combed for a frame to be
  10294. declared combed. See the @option{combpel} parameter description for more info.
  10295. Possible values are any number that is a power of 2 starting at 4 and going up
  10296. to 512.
  10297. Default value is @code{16}.
  10298. @item combpel
  10299. The number of combed pixels inside any of the @option{blocky} by
  10300. @option{blockx} size blocks on the frame for the frame to be detected as
  10301. combed. While @option{cthresh} controls how "visible" the combing must be, this
  10302. setting controls "how much" combing there must be in any localized area (a
  10303. window defined by the @option{blockx} and @option{blocky} settings) on the
  10304. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  10305. which point no frames will ever be detected as combed). This setting is known
  10306. as @option{MI} in TFM/VFM vocabulary.
  10307. Default value is @code{80}.
  10308. @end table
  10309. @anchor{p/c/n/u/b meaning}
  10310. @subsection p/c/n/u/b meaning
  10311. @subsubsection p/c/n
  10312. We assume the following telecined stream:
  10313. @example
  10314. Top fields: 1 2 2 3 4
  10315. Bottom fields: 1 2 3 4 4
  10316. @end example
  10317. The numbers correspond to the progressive frame the fields relate to. Here, the
  10318. first two frames are progressive, the 3rd and 4th are combed, and so on.
  10319. When @code{fieldmatch} is configured to run a matching from bottom
  10320. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  10321. @example
  10322. Input stream:
  10323. T 1 2 2 3 4
  10324. B 1 2 3 4 4 <-- matching reference
  10325. Matches: c c n n c
  10326. Output stream:
  10327. T 1 2 3 4 4
  10328. B 1 2 3 4 4
  10329. @end example
  10330. As a result of the field matching, we can see that some frames get duplicated.
  10331. To perform a complete inverse telecine, you need to rely on a decimation filter
  10332. after this operation. See for instance the @ref{decimate} filter.
  10333. The same operation now matching from top fields (@option{field}=@var{top})
  10334. looks like this:
  10335. @example
  10336. Input stream:
  10337. T 1 2 2 3 4 <-- matching reference
  10338. B 1 2 3 4 4
  10339. Matches: c c p p c
  10340. Output stream:
  10341. T 1 2 2 3 4
  10342. B 1 2 2 3 4
  10343. @end example
  10344. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  10345. basically, they refer to the frame and field of the opposite parity:
  10346. @itemize
  10347. @item @var{p} matches the field of the opposite parity in the previous frame
  10348. @item @var{c} matches the field of the opposite parity in the current frame
  10349. @item @var{n} matches the field of the opposite parity in the next frame
  10350. @end itemize
  10351. @subsubsection u/b
  10352. The @var{u} and @var{b} matching are a bit special in the sense that they match
  10353. from the opposite parity flag. In the following examples, we assume that we are
  10354. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  10355. 'x' is placed above and below each matched fields.
  10356. With bottom matching (@option{field}=@var{bottom}):
  10357. @example
  10358. Match: c p n b u
  10359. x x x x x
  10360. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10361. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10362. x x x x x
  10363. Output frames:
  10364. 2 1 2 2 2
  10365. 2 2 2 1 3
  10366. @end example
  10367. With top matching (@option{field}=@var{top}):
  10368. @example
  10369. Match: c p n b u
  10370. x x x x x
  10371. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10372. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10373. x x x x x
  10374. Output frames:
  10375. 2 2 2 1 2
  10376. 2 1 3 2 2
  10377. @end example
  10378. @subsection Examples
  10379. Simple IVTC of a top field first telecined stream:
  10380. @example
  10381. fieldmatch=order=tff:combmatch=none, decimate
  10382. @end example
  10383. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  10384. @example
  10385. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  10386. @end example
  10387. @section fieldorder
  10388. Transform the field order of the input video.
  10389. It accepts the following parameters:
  10390. @table @option
  10391. @item order
  10392. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  10393. for bottom field first.
  10394. @end table
  10395. The default value is @samp{tff}.
  10396. The transformation is done by shifting the picture content up or down
  10397. by one line, and filling the remaining line with appropriate picture content.
  10398. This method is consistent with most broadcast field order converters.
  10399. If the input video is not flagged as being interlaced, or it is already
  10400. flagged as being of the required output field order, then this filter does
  10401. not alter the incoming video.
  10402. It is very useful when converting to or from PAL DV material,
  10403. which is bottom field first.
  10404. For example:
  10405. @example
  10406. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  10407. @end example
  10408. @section fifo, afifo
  10409. Buffer input images and send them when they are requested.
  10410. It is mainly useful when auto-inserted by the libavfilter
  10411. framework.
  10412. It does not take parameters.
  10413. @section fillborders
  10414. Fill borders of the input video, without changing video stream dimensions.
  10415. Sometimes video can have garbage at the four edges and you may not want to
  10416. crop video input to keep size multiple of some number.
  10417. This filter accepts the following options:
  10418. @table @option
  10419. @item left
  10420. Number of pixels to fill from left border.
  10421. @item right
  10422. Number of pixels to fill from right border.
  10423. @item top
  10424. Number of pixels to fill from top border.
  10425. @item bottom
  10426. Number of pixels to fill from bottom border.
  10427. @item mode
  10428. Set fill mode.
  10429. It accepts the following values:
  10430. @table @samp
  10431. @item smear
  10432. fill pixels using outermost pixels
  10433. @item mirror
  10434. fill pixels using mirroring (half sample symmetric)
  10435. @item fixed
  10436. fill pixels with constant value
  10437. @item reflect
  10438. fill pixels using reflecting (whole sample symmetric)
  10439. @item wrap
  10440. fill pixels using wrapping
  10441. @item fade
  10442. fade pixels to constant value
  10443. @item margins
  10444. fill pixels at top and bottom with weighted averages pixels near borders
  10445. @end table
  10446. Default is @var{smear}.
  10447. @item color
  10448. Set color for pixels in fixed or fade mode. Default is @var{black}.
  10449. @end table
  10450. @subsection Commands
  10451. This filter supports same @ref{commands} as options.
  10452. The command accepts the same syntax of the corresponding option.
  10453. If the specified expression is not valid, it is kept at its current
  10454. value.
  10455. @section find_rect
  10456. Find a rectangular object
  10457. It accepts the following options:
  10458. @table @option
  10459. @item object
  10460. Filepath of the object image, needs to be in gray8.
  10461. @item threshold
  10462. Detection threshold, default is 0.5.
  10463. @item mipmaps
  10464. Number of mipmaps, default is 3.
  10465. @item xmin, ymin, xmax, ymax
  10466. Specifies the rectangle in which to search.
  10467. @item discard
  10468. Discard frames where object is not detected. Default is disabled.
  10469. @end table
  10470. @subsection Examples
  10471. @itemize
  10472. @item
  10473. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  10474. @example
  10475. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  10476. @end example
  10477. @end itemize
  10478. @section floodfill
  10479. Flood area with values of same pixel components with another values.
  10480. It accepts the following options:
  10481. @table @option
  10482. @item x
  10483. Set pixel x coordinate.
  10484. @item y
  10485. Set pixel y coordinate.
  10486. @item s0
  10487. Set source #0 component value.
  10488. @item s1
  10489. Set source #1 component value.
  10490. @item s2
  10491. Set source #2 component value.
  10492. @item s3
  10493. Set source #3 component value.
  10494. @item d0
  10495. Set destination #0 component value.
  10496. @item d1
  10497. Set destination #1 component value.
  10498. @item d2
  10499. Set destination #2 component value.
  10500. @item d3
  10501. Set destination #3 component value.
  10502. @end table
  10503. @anchor{format}
  10504. @section format
  10505. Convert the input video to one of the specified pixel formats.
  10506. Libavfilter will try to pick one that is suitable as input to
  10507. the next filter.
  10508. It accepts the following parameters:
  10509. @table @option
  10510. @item pix_fmts
  10511. A '|'-separated list of pixel format names, such as
  10512. "pix_fmts=yuv420p|monow|rgb24".
  10513. @end table
  10514. @subsection Examples
  10515. @itemize
  10516. @item
  10517. Convert the input video to the @var{yuv420p} format
  10518. @example
  10519. format=pix_fmts=yuv420p
  10520. @end example
  10521. Convert the input video to any of the formats in the list
  10522. @example
  10523. format=pix_fmts=yuv420p|yuv444p|yuv410p
  10524. @end example
  10525. @end itemize
  10526. @anchor{fps}
  10527. @section fps
  10528. Convert the video to specified constant frame rate by duplicating or dropping
  10529. frames as necessary.
  10530. It accepts the following parameters:
  10531. @table @option
  10532. @item fps
  10533. The desired output frame rate. It accepts expressions containing the following
  10534. constants:
  10535. @table @samp
  10536. @item source_fps
  10537. The input's frame rate
  10538. @item ntsc
  10539. NTSC frame rate of @code{30000/1001}
  10540. @item pal
  10541. PAL frame rate of @code{25.0}
  10542. @item film
  10543. Film frame rate of @code{24.0}
  10544. @item ntsc_film
  10545. NTSC-film frame rate of @code{24000/1001}
  10546. @end table
  10547. The default is @code{25}.
  10548. @item start_time
  10549. Assume the first PTS should be the given value, in seconds. This allows for
  10550. padding/trimming at the start of stream. By default, no assumption is made
  10551. about the first frame's expected PTS, so no padding or trimming is done.
  10552. For example, this could be set to 0 to pad the beginning with duplicates of
  10553. the first frame if a video stream starts after the audio stream or to trim any
  10554. frames with a negative PTS.
  10555. @item round
  10556. Timestamp (PTS) rounding method.
  10557. Possible values are:
  10558. @table @option
  10559. @item zero
  10560. round towards 0
  10561. @item inf
  10562. round away from 0
  10563. @item down
  10564. round towards -infinity
  10565. @item up
  10566. round towards +infinity
  10567. @item near
  10568. round to nearest
  10569. @end table
  10570. The default is @code{near}.
  10571. @item eof_action
  10572. Action performed when reading the last frame.
  10573. Possible values are:
  10574. @table @option
  10575. @item round
  10576. Use same timestamp rounding method as used for other frames.
  10577. @item pass
  10578. Pass through last frame if input duration has not been reached yet.
  10579. @end table
  10580. The default is @code{round}.
  10581. @end table
  10582. Alternatively, the options can be specified as a flat string:
  10583. @var{fps}[:@var{start_time}[:@var{round}]].
  10584. See also the @ref{setpts} filter.
  10585. @subsection Examples
  10586. @itemize
  10587. @item
  10588. A typical usage in order to set the fps to 25:
  10589. @example
  10590. fps=fps=25
  10591. @end example
  10592. @item
  10593. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  10594. @example
  10595. fps=fps=film:round=near
  10596. @end example
  10597. @end itemize
  10598. @section framepack
  10599. Pack two different video streams into a stereoscopic video, setting proper
  10600. metadata on supported codecs. The two views should have the same size and
  10601. framerate and processing will stop when the shorter video ends. Please note
  10602. that you may conveniently adjust view properties with the @ref{scale} and
  10603. @ref{fps} filters.
  10604. It accepts the following parameters:
  10605. @table @option
  10606. @item format
  10607. The desired packing format. Supported values are:
  10608. @table @option
  10609. @item sbs
  10610. The views are next to each other (default).
  10611. @item tab
  10612. The views are on top of each other.
  10613. @item lines
  10614. The views are packed by line.
  10615. @item columns
  10616. The views are packed by column.
  10617. @item frameseq
  10618. The views are temporally interleaved.
  10619. @end table
  10620. @end table
  10621. Some examples:
  10622. @example
  10623. # Convert left and right views into a frame-sequential video
  10624. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  10625. # Convert views into a side-by-side video with the same output resolution as the input
  10626. 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
  10627. @end example
  10628. @section framerate
  10629. Change the frame rate by interpolating new video output frames from the source
  10630. frames.
  10631. This filter is not designed to function correctly with interlaced media. If
  10632. you wish to change the frame rate of interlaced media then you are required
  10633. to deinterlace before this filter and re-interlace after this filter.
  10634. A description of the accepted options follows.
  10635. @table @option
  10636. @item fps
  10637. Specify the output frames per second. This option can also be specified
  10638. as a value alone. The default is @code{50}.
  10639. @item interp_start
  10640. Specify the start of a range where the output frame will be created as a
  10641. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10642. the default is @code{15}.
  10643. @item interp_end
  10644. Specify the end of a range where the output frame will be created as a
  10645. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10646. the default is @code{240}.
  10647. @item scene
  10648. Specify the level at which a scene change is detected as a value between
  10649. 0 and 100 to indicate a new scene; a low value reflects a low
  10650. probability for the current frame to introduce a new scene, while a higher
  10651. value means the current frame is more likely to be one.
  10652. The default is @code{8.2}.
  10653. @item flags
  10654. Specify flags influencing the filter process.
  10655. Available value for @var{flags} is:
  10656. @table @option
  10657. @item scene_change_detect, scd
  10658. Enable scene change detection using the value of the option @var{scene}.
  10659. This flag is enabled by default.
  10660. @end table
  10661. @end table
  10662. @section framestep
  10663. Select one frame every N-th frame.
  10664. This filter accepts the following option:
  10665. @table @option
  10666. @item step
  10667. Select frame after every @code{step} frames.
  10668. Allowed values are positive integers higher than 0. Default value is @code{1}.
  10669. @end table
  10670. @section freezedetect
  10671. Detect frozen video.
  10672. This filter logs a message and sets frame metadata when it detects that the
  10673. input video has no significant change in content during a specified duration.
  10674. Video freeze detection calculates the mean average absolute difference of all
  10675. the components of video frames and compares it to a noise floor.
  10676. The printed times and duration are expressed in seconds. The
  10677. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  10678. whose timestamp equals or exceeds the detection duration and it contains the
  10679. timestamp of the first frame of the freeze. The
  10680. @code{lavfi.freezedetect.freeze_duration} and
  10681. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  10682. after the freeze.
  10683. The filter accepts the following options:
  10684. @table @option
  10685. @item noise, n
  10686. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  10687. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  10688. 0.001.
  10689. @item duration, d
  10690. Set freeze duration until notification (default is 2 seconds).
  10691. @end table
  10692. @section freezeframes
  10693. Freeze video frames.
  10694. This filter freezes video frames using frame from 2nd input.
  10695. The filter accepts the following options:
  10696. @table @option
  10697. @item first
  10698. Set number of first frame from which to start freeze.
  10699. @item last
  10700. Set number of last frame from which to end freeze.
  10701. @item replace
  10702. Set number of frame from 2nd input which will be used instead of replaced frames.
  10703. @end table
  10704. @anchor{frei0r}
  10705. @section frei0r
  10706. Apply a frei0r effect to the input video.
  10707. To enable the compilation of this filter, you need to install the frei0r
  10708. header and configure FFmpeg with @code{--enable-frei0r}.
  10709. It accepts the following parameters:
  10710. @table @option
  10711. @item filter_name
  10712. The name of the frei0r effect to load. If the environment variable
  10713. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  10714. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  10715. Otherwise, the standard frei0r paths are searched, in this order:
  10716. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  10717. @file{/usr/lib/frei0r-1/}.
  10718. @item filter_params
  10719. A '|'-separated list of parameters to pass to the frei0r effect.
  10720. @end table
  10721. A frei0r effect parameter can be a boolean (its value is either
  10722. "y" or "n"), a double, a color (specified as
  10723. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  10724. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  10725. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  10726. a position (specified as @var{X}/@var{Y}, where
  10727. @var{X} and @var{Y} are floating point numbers) and/or a string.
  10728. The number and types of parameters depend on the loaded effect. If an
  10729. effect parameter is not specified, the default value is set.
  10730. @subsection Examples
  10731. @itemize
  10732. @item
  10733. Apply the distort0r effect, setting the first two double parameters:
  10734. @example
  10735. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  10736. @end example
  10737. @item
  10738. Apply the colordistance effect, taking a color as the first parameter:
  10739. @example
  10740. frei0r=colordistance:0.2/0.3/0.4
  10741. frei0r=colordistance:violet
  10742. frei0r=colordistance:0x112233
  10743. @end example
  10744. @item
  10745. Apply the perspective effect, specifying the top left and top right image
  10746. positions:
  10747. @example
  10748. frei0r=perspective:0.2/0.2|0.8/0.2
  10749. @end example
  10750. @end itemize
  10751. For more information, see
  10752. @url{http://frei0r.dyne.org}
  10753. @subsection Commands
  10754. This filter supports the @option{filter_params} option as @ref{commands}.
  10755. @section fspp
  10756. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  10757. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  10758. processing filter, one of them is performed once per block, not per pixel.
  10759. This allows for much higher speed.
  10760. The filter accepts the following options:
  10761. @table @option
  10762. @item quality
  10763. Set quality. This option defines the number of levels for averaging. It accepts
  10764. an integer in the range 4-5. Default value is @code{4}.
  10765. @item qp
  10766. Force a constant quantization parameter. It accepts an integer in range 0-63.
  10767. If not set, the filter will use the QP from the video stream (if available).
  10768. @item strength
  10769. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  10770. more details but also more artifacts, while higher values make the image smoother
  10771. but also blurrier. Default value is @code{0} − PSNR optimal.
  10772. @item use_bframe_qp
  10773. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10774. option may cause flicker since the B-Frames have often larger QP. Default is
  10775. @code{0} (not enabled).
  10776. @end table
  10777. @section gblur
  10778. Apply Gaussian blur filter.
  10779. The filter accepts the following options:
  10780. @table @option
  10781. @item sigma
  10782. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  10783. @item steps
  10784. Set number of steps for Gaussian approximation. Default is @code{1}.
  10785. @item planes
  10786. Set which planes to filter. By default all planes are filtered.
  10787. @item sigmaV
  10788. Set vertical sigma, if negative it will be same as @code{sigma}.
  10789. Default is @code{-1}.
  10790. @end table
  10791. @subsection Commands
  10792. This filter supports same commands as options.
  10793. The command accepts the same syntax of the corresponding option.
  10794. If the specified expression is not valid, it is kept at its current
  10795. value.
  10796. @section geq
  10797. Apply generic equation to each pixel.
  10798. The filter accepts the following options:
  10799. @table @option
  10800. @item lum_expr, lum
  10801. Set the luminance expression.
  10802. @item cb_expr, cb
  10803. Set the chrominance blue expression.
  10804. @item cr_expr, cr
  10805. Set the chrominance red expression.
  10806. @item alpha_expr, a
  10807. Set the alpha expression.
  10808. @item red_expr, r
  10809. Set the red expression.
  10810. @item green_expr, g
  10811. Set the green expression.
  10812. @item blue_expr, b
  10813. Set the blue expression.
  10814. @end table
  10815. The colorspace is selected according to the specified options. If one
  10816. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  10817. options is specified, the filter will automatically select a YCbCr
  10818. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  10819. @option{blue_expr} options is specified, it will select an RGB
  10820. colorspace.
  10821. If one of the chrominance expression is not defined, it falls back on the other
  10822. one. If no alpha expression is specified it will evaluate to opaque value.
  10823. If none of chrominance expressions are specified, they will evaluate
  10824. to the luminance expression.
  10825. The expressions can use the following variables and functions:
  10826. @table @option
  10827. @item N
  10828. The sequential number of the filtered frame, starting from @code{0}.
  10829. @item X
  10830. @item Y
  10831. The coordinates of the current sample.
  10832. @item W
  10833. @item H
  10834. The width and height of the image.
  10835. @item SW
  10836. @item SH
  10837. Width and height scale depending on the currently filtered plane. It is the
  10838. ratio between the corresponding luma plane number of pixels and the current
  10839. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  10840. @code{0.5,0.5} for chroma planes.
  10841. @item T
  10842. Time of the current frame, expressed in seconds.
  10843. @item p(x, y)
  10844. Return the value of the pixel at location (@var{x},@var{y}) of the current
  10845. plane.
  10846. @item lum(x, y)
  10847. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  10848. plane.
  10849. @item cb(x, y)
  10850. Return the value of the pixel at location (@var{x},@var{y}) of the
  10851. blue-difference chroma plane. Return 0 if there is no such plane.
  10852. @item cr(x, y)
  10853. Return the value of the pixel at location (@var{x},@var{y}) of the
  10854. red-difference chroma plane. Return 0 if there is no such plane.
  10855. @item r(x, y)
  10856. @item g(x, y)
  10857. @item b(x, y)
  10858. Return the value of the pixel at location (@var{x},@var{y}) of the
  10859. red/green/blue component. Return 0 if there is no such component.
  10860. @item alpha(x, y)
  10861. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  10862. plane. Return 0 if there is no such plane.
  10863. @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)
  10864. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  10865. sums of samples within a rectangle. See the functions without the sum postfix.
  10866. @item interpolation
  10867. Set one of interpolation methods:
  10868. @table @option
  10869. @item nearest, n
  10870. @item bilinear, b
  10871. @end table
  10872. Default is bilinear.
  10873. @end table
  10874. For functions, if @var{x} and @var{y} are outside the area, the value will be
  10875. automatically clipped to the closer edge.
  10876. Please note that this filter can use multiple threads in which case each slice
  10877. will have its own expression state. If you want to use only a single expression
  10878. state because your expressions depend on previous state then you should limit
  10879. the number of filter threads to 1.
  10880. @subsection Examples
  10881. @itemize
  10882. @item
  10883. Flip the image horizontally:
  10884. @example
  10885. geq=p(W-X\,Y)
  10886. @end example
  10887. @item
  10888. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  10889. wavelength of 100 pixels:
  10890. @example
  10891. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  10892. @end example
  10893. @item
  10894. Generate a fancy enigmatic moving light:
  10895. @example
  10896. 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
  10897. @end example
  10898. @item
  10899. Generate a quick emboss effect:
  10900. @example
  10901. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  10902. @end example
  10903. @item
  10904. Modify RGB components depending on pixel position:
  10905. @example
  10906. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  10907. @end example
  10908. @item
  10909. Create a radial gradient that is the same size as the input (also see
  10910. the @ref{vignette} filter):
  10911. @example
  10912. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  10913. @end example
  10914. @end itemize
  10915. @section gradfun
  10916. Fix the banding artifacts that are sometimes introduced into nearly flat
  10917. regions by truncation to 8-bit color depth.
  10918. Interpolate the gradients that should go where the bands are, and
  10919. dither them.
  10920. It is designed for playback only. Do not use it prior to
  10921. lossy compression, because compression tends to lose the dither and
  10922. bring back the bands.
  10923. It accepts the following parameters:
  10924. @table @option
  10925. @item strength
  10926. The maximum amount by which the filter will change any one pixel. This is also
  10927. the threshold for detecting nearly flat regions. Acceptable values range from
  10928. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  10929. valid range.
  10930. @item radius
  10931. The neighborhood to fit the gradient to. A larger radius makes for smoother
  10932. gradients, but also prevents the filter from modifying the pixels near detailed
  10933. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  10934. values will be clipped to the valid range.
  10935. @end table
  10936. Alternatively, the options can be specified as a flat string:
  10937. @var{strength}[:@var{radius}]
  10938. @subsection Examples
  10939. @itemize
  10940. @item
  10941. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  10942. @example
  10943. gradfun=3.5:8
  10944. @end example
  10945. @item
  10946. Specify radius, omitting the strength (which will fall-back to the default
  10947. value):
  10948. @example
  10949. gradfun=radius=8
  10950. @end example
  10951. @end itemize
  10952. @anchor{graphmonitor}
  10953. @section graphmonitor
  10954. Show various filtergraph stats.
  10955. With this filter one can debug complete filtergraph.
  10956. Especially issues with links filling with queued frames.
  10957. The filter accepts the following options:
  10958. @table @option
  10959. @item size, s
  10960. Set video output size. Default is @var{hd720}.
  10961. @item opacity, o
  10962. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  10963. @item mode, m
  10964. Set output mode, can be @var{fulll} or @var{compact}.
  10965. In @var{compact} mode only filters with some queued frames have displayed stats.
  10966. @item flags, f
  10967. Set flags which enable which stats are shown in video.
  10968. Available values for flags are:
  10969. @table @samp
  10970. @item queue
  10971. Display number of queued frames in each link.
  10972. @item frame_count_in
  10973. Display number of frames taken from filter.
  10974. @item frame_count_out
  10975. Display number of frames given out from filter.
  10976. @item frame_count_delta
  10977. Display delta number of frames between above two values.
  10978. @item pts
  10979. Display current filtered frame pts.
  10980. @item pts_delta
  10981. Display pts delta between current and previous frame.
  10982. @item time
  10983. Display current filtered frame time.
  10984. @item time_delta
  10985. Display time delta between current and previous frame.
  10986. @item timebase
  10987. Display time base for filter link.
  10988. @item format
  10989. Display used format for filter link.
  10990. @item size
  10991. Display video size or number of audio channels in case of audio used by filter link.
  10992. @item rate
  10993. Display video frame rate or sample rate in case of audio used by filter link.
  10994. @item eof
  10995. Display link output status.
  10996. @item sample_count_in
  10997. Display number of samples taken from filter.
  10998. @item sample_count_out
  10999. Display number of samples given out from filter.
  11000. @item sample_count_delta
  11001. Display delta number of samples between above two values.
  11002. @end table
  11003. @item rate, r
  11004. Set upper limit for video rate of output stream, Default value is @var{25}.
  11005. This guarantee that output video frame rate will not be higher than this value.
  11006. @end table
  11007. @section grayworld
  11008. A color constancy filter that applies color correction based on the grayworld assumption
  11009. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  11010. The algorithm uses linear light, so input
  11011. data should be linearized beforehand (and possibly correctly tagged).
  11012. @example
  11013. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  11014. @end example
  11015. @section greyedge
  11016. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  11017. and corrects the scene colors accordingly.
  11018. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  11019. The filter accepts the following options:
  11020. @table @option
  11021. @item difford
  11022. The order of differentiation to be applied on the scene. Must be chosen in the range
  11023. [0,2] and default value is 1.
  11024. @item minknorm
  11025. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  11026. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  11027. max value instead of calculating Minkowski distance.
  11028. @item sigma
  11029. The standard deviation of Gaussian blur to be applied on the scene. Must be
  11030. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  11031. can't be equal to 0 if @var{difford} is greater than 0.
  11032. @end table
  11033. @subsection Examples
  11034. @itemize
  11035. @item
  11036. Grey Edge:
  11037. @example
  11038. greyedge=difford=1:minknorm=5:sigma=2
  11039. @end example
  11040. @item
  11041. Max Edge:
  11042. @example
  11043. greyedge=difford=1:minknorm=0:sigma=2
  11044. @end example
  11045. @end itemize
  11046. @section guided
  11047. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  11048. The filter accepts the following options:
  11049. @table @option
  11050. @item radius
  11051. Set the box radius in pixels.
  11052. Allowed range is 1 to 20. Default is 3.
  11053. @item eps
  11054. Set regularization parameter (with square).
  11055. Allowed range is 0 to 1. Default is 0.01.
  11056. @item mode
  11057. Set filter mode. Can be @code{basic} or @code{fast}.
  11058. Default is @code{basic}.
  11059. @item sub
  11060. Set subsampling ratio for @code{fast} mode.
  11061. Range is 2 to 64. Default is 4.
  11062. No subsampling occurs in @code{basic} mode.
  11063. @item guidance
  11064. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  11065. If @code{off}, single input is required.
  11066. If @code{on}, two inputs of the same resolution and pixel format are required.
  11067. The second input serves as the guidance.
  11068. @item planes
  11069. Set planes to filter. Default is first only.
  11070. @end table
  11071. @subsection Commands
  11072. This filter supports the all above options as @ref{commands}.
  11073. @subsection Examples
  11074. @itemize
  11075. @item
  11076. Edge-preserving smoothing with guided filter:
  11077. @example
  11078. ffmpeg -i in.png -vf guided out.png
  11079. @end example
  11080. @item
  11081. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  11082. For the generation of guidance image, refer to paper "Guided Image Filtering".
  11083. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  11084. @example
  11085. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  11086. @end example
  11087. @end itemize
  11088. @anchor{haldclut}
  11089. @section haldclut
  11090. Apply a Hald CLUT to a video stream.
  11091. First input is the video stream to process, and second one is the Hald CLUT.
  11092. The Hald CLUT input can be a simple picture or a complete video stream.
  11093. The filter accepts the following options:
  11094. @table @option
  11095. @item clut
  11096. Set which CLUT video frames will be processed from second input stream,
  11097. can be @var{first} or @var{all}. Default is @var{all}.
  11098. @item shortest
  11099. Force termination when the shortest input terminates. Default is @code{0}.
  11100. @item repeatlast
  11101. Continue applying the last CLUT after the end of the stream. A value of
  11102. @code{0} disable the filter after the last frame of the CLUT is reached.
  11103. Default is @code{1}.
  11104. @end table
  11105. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  11106. filters share the same internals).
  11107. This filter also supports the @ref{framesync} options.
  11108. More information about the Hald CLUT can be found on Eskil Steenberg's website
  11109. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  11110. @subsection Commands
  11111. This filter supports the @code{interp} option as @ref{commands}.
  11112. @subsection Workflow examples
  11113. @subsubsection Hald CLUT video stream
  11114. Generate an identity Hald CLUT stream altered with various effects:
  11115. @example
  11116. 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
  11117. @end example
  11118. Note: make sure you use a lossless codec.
  11119. Then use it with @code{haldclut} to apply it on some random stream:
  11120. @example
  11121. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  11122. @end example
  11123. The Hald CLUT will be applied to the 10 first seconds (duration of
  11124. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  11125. to the remaining frames of the @code{mandelbrot} stream.
  11126. @subsubsection Hald CLUT with preview
  11127. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  11128. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  11129. biggest possible square starting at the top left of the picture. The remaining
  11130. padding pixels (bottom or right) will be ignored. This area can be used to add
  11131. a preview of the Hald CLUT.
  11132. Typically, the following generated Hald CLUT will be supported by the
  11133. @code{haldclut} filter:
  11134. @example
  11135. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  11136. pad=iw+320 [padded_clut];
  11137. smptebars=s=320x256, split [a][b];
  11138. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  11139. [main][b] overlay=W-320" -frames:v 1 clut.png
  11140. @end example
  11141. It contains the original and a preview of the effect of the CLUT: SMPTE color
  11142. bars are displayed on the right-top, and below the same color bars processed by
  11143. the color changes.
  11144. Then, the effect of this Hald CLUT can be visualized with:
  11145. @example
  11146. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  11147. @end example
  11148. @section hflip
  11149. Flip the input video horizontally.
  11150. For example, to horizontally flip the input video with @command{ffmpeg}:
  11151. @example
  11152. ffmpeg -i in.avi -vf "hflip" out.avi
  11153. @end example
  11154. @section histeq
  11155. This filter applies a global color histogram equalization on a
  11156. per-frame basis.
  11157. It can be used to correct video that has a compressed range of pixel
  11158. intensities. The filter redistributes the pixel intensities to
  11159. equalize their distribution across the intensity range. It may be
  11160. viewed as an "automatically adjusting contrast filter". This filter is
  11161. useful only for correcting degraded or poorly captured source
  11162. video.
  11163. The filter accepts the following options:
  11164. @table @option
  11165. @item strength
  11166. Determine the amount of equalization to be applied. As the strength
  11167. is reduced, the distribution of pixel intensities more-and-more
  11168. approaches that of the input frame. The value must be a float number
  11169. in the range [0,1] and defaults to 0.200.
  11170. @item intensity
  11171. Set the maximum intensity that can generated and scale the output
  11172. values appropriately. The strength should be set as desired and then
  11173. the intensity can be limited if needed to avoid washing-out. The value
  11174. must be a float number in the range [0,1] and defaults to 0.210.
  11175. @item antibanding
  11176. Set the antibanding level. If enabled the filter will randomly vary
  11177. the luminance of output pixels by a small amount to avoid banding of
  11178. the histogram. Possible values are @code{none}, @code{weak} or
  11179. @code{strong}. It defaults to @code{none}.
  11180. @end table
  11181. @anchor{histogram}
  11182. @section histogram
  11183. Compute and draw a color distribution histogram for the input video.
  11184. The computed histogram is a representation of the color component
  11185. distribution in an image.
  11186. Standard histogram displays the color components distribution in an image.
  11187. Displays color graph for each color component. Shows distribution of
  11188. the Y, U, V, A or R, G, B components, depending on input format, in the
  11189. current frame. Below each graph a color component scale meter is shown.
  11190. The filter accepts the following options:
  11191. @table @option
  11192. @item level_height
  11193. Set height of level. Default value is @code{200}.
  11194. Allowed range is [50, 2048].
  11195. @item scale_height
  11196. Set height of color scale. Default value is @code{12}.
  11197. Allowed range is [0, 40].
  11198. @item display_mode
  11199. Set display mode.
  11200. It accepts the following values:
  11201. @table @samp
  11202. @item stack
  11203. Per color component graphs are placed below each other.
  11204. @item parade
  11205. Per color component graphs are placed side by side.
  11206. @item overlay
  11207. Presents information identical to that in the @code{parade}, except
  11208. that the graphs representing color components are superimposed directly
  11209. over one another.
  11210. @end table
  11211. Default is @code{stack}.
  11212. @item levels_mode
  11213. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  11214. Default is @code{linear}.
  11215. @item components
  11216. Set what color components to display.
  11217. Default is @code{7}.
  11218. @item fgopacity
  11219. Set foreground opacity. Default is @code{0.7}.
  11220. @item bgopacity
  11221. Set background opacity. Default is @code{0.5}.
  11222. @item colors_mode
  11223. Set colors mode.
  11224. It accepts the following values:
  11225. @table @samp
  11226. @item whiteonblack
  11227. @item blackonwhite
  11228. @item whiteongray
  11229. @item blackongray
  11230. @item coloronblack
  11231. @item coloronwhite
  11232. @item colorongray
  11233. @item blackoncolor
  11234. @item whiteoncolor
  11235. @item grayoncolor
  11236. @end table
  11237. Default is @code{whiteonblack}.
  11238. @end table
  11239. @subsection Examples
  11240. @itemize
  11241. @item
  11242. Calculate and draw histogram:
  11243. @example
  11244. ffplay -i input -vf histogram
  11245. @end example
  11246. @end itemize
  11247. @anchor{hqdn3d}
  11248. @section hqdn3d
  11249. This is a high precision/quality 3d denoise filter. It aims to reduce
  11250. image noise, producing smooth images and making still images really
  11251. still. It should enhance compressibility.
  11252. It accepts the following optional parameters:
  11253. @table @option
  11254. @item luma_spatial
  11255. A non-negative floating point number which specifies spatial luma strength.
  11256. It defaults to 4.0.
  11257. @item chroma_spatial
  11258. A non-negative floating point number which specifies spatial chroma strength.
  11259. It defaults to 3.0*@var{luma_spatial}/4.0.
  11260. @item luma_tmp
  11261. A floating point number which specifies luma temporal strength. It defaults to
  11262. 6.0*@var{luma_spatial}/4.0.
  11263. @item chroma_tmp
  11264. A floating point number which specifies chroma temporal strength. It defaults to
  11265. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  11266. @end table
  11267. @subsection Commands
  11268. This filter supports same @ref{commands} as options.
  11269. The command accepts the same syntax of the corresponding option.
  11270. If the specified expression is not valid, it is kept at its current
  11271. value.
  11272. @anchor{hwdownload}
  11273. @section hwdownload
  11274. Download hardware frames to system memory.
  11275. The input must be in hardware frames, and the output a non-hardware format.
  11276. Not all formats will be supported on the output - it may be necessary to insert
  11277. an additional @option{format} filter immediately following in the graph to get
  11278. the output in a supported format.
  11279. @section hwmap
  11280. Map hardware frames to system memory or to another device.
  11281. This filter has several different modes of operation; which one is used depends
  11282. on the input and output formats:
  11283. @itemize
  11284. @item
  11285. Hardware frame input, normal frame output
  11286. Map the input frames to system memory and pass them to the output. If the
  11287. original hardware frame is later required (for example, after overlaying
  11288. something else on part of it), the @option{hwmap} filter can be used again
  11289. in the next mode to retrieve it.
  11290. @item
  11291. Normal frame input, hardware frame output
  11292. If the input is actually a software-mapped hardware frame, then unmap it -
  11293. that is, return the original hardware frame.
  11294. Otherwise, a device must be provided. Create new hardware surfaces on that
  11295. device for the output, then map them back to the software format at the input
  11296. and give those frames to the preceding filter. This will then act like the
  11297. @option{hwupload} filter, but may be able to avoid an additional copy when
  11298. the input is already in a compatible format.
  11299. @item
  11300. Hardware frame input and output
  11301. A device must be supplied for the output, either directly or with the
  11302. @option{derive_device} option. The input and output devices must be of
  11303. different types and compatible - the exact meaning of this is
  11304. system-dependent, but typically it means that they must refer to the same
  11305. underlying hardware context (for example, refer to the same graphics card).
  11306. If the input frames were originally created on the output device, then unmap
  11307. to retrieve the original frames.
  11308. Otherwise, map the frames to the output device - create new hardware frames
  11309. on the output corresponding to the frames on the input.
  11310. @end itemize
  11311. The following additional parameters are accepted:
  11312. @table @option
  11313. @item mode
  11314. Set the frame mapping mode. Some combination of:
  11315. @table @var
  11316. @item read
  11317. The mapped frame should be readable.
  11318. @item write
  11319. The mapped frame should be writeable.
  11320. @item overwrite
  11321. The mapping will always overwrite the entire frame.
  11322. This may improve performance in some cases, as the original contents of the
  11323. frame need not be loaded.
  11324. @item direct
  11325. The mapping must not involve any copying.
  11326. Indirect mappings to copies of frames are created in some cases where either
  11327. direct mapping is not possible or it would have unexpected properties.
  11328. Setting this flag ensures that the mapping is direct and will fail if that is
  11329. not possible.
  11330. @end table
  11331. Defaults to @var{read+write} if not specified.
  11332. @item derive_device @var{type}
  11333. Rather than using the device supplied at initialisation, instead derive a new
  11334. device of type @var{type} from the device the input frames exist on.
  11335. @item reverse
  11336. In a hardware to hardware mapping, map in reverse - create frames in the sink
  11337. and map them back to the source. This may be necessary in some cases where
  11338. a mapping in one direction is required but only the opposite direction is
  11339. supported by the devices being used.
  11340. This option is dangerous - it may break the preceding filter in undefined
  11341. ways if there are any additional constraints on that filter's output.
  11342. Do not use it without fully understanding the implications of its use.
  11343. @end table
  11344. @anchor{hwupload}
  11345. @section hwupload
  11346. Upload system memory frames to hardware surfaces.
  11347. The device to upload to must be supplied when the filter is initialised. If
  11348. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  11349. option or with the @option{derive_device} option. The input and output devices
  11350. must be of different types and compatible - the exact meaning of this is
  11351. system-dependent, but typically it means that they must refer to the same
  11352. underlying hardware context (for example, refer to the same graphics card).
  11353. The following additional parameters are accepted:
  11354. @table @option
  11355. @item derive_device @var{type}
  11356. Rather than using the device supplied at initialisation, instead derive a new
  11357. device of type @var{type} from the device the input frames exist on.
  11358. @end table
  11359. @anchor{hwupload_cuda}
  11360. @section hwupload_cuda
  11361. Upload system memory frames to a CUDA device.
  11362. It accepts the following optional parameters:
  11363. @table @option
  11364. @item device
  11365. The number of the CUDA device to use
  11366. @end table
  11367. @section hqx
  11368. Apply a high-quality magnification filter designed for pixel art. This filter
  11369. was originally created by Maxim Stepin.
  11370. It accepts the following option:
  11371. @table @option
  11372. @item n
  11373. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  11374. @code{hq3x} and @code{4} for @code{hq4x}.
  11375. Default is @code{3}.
  11376. @end table
  11377. @section hstack
  11378. Stack input videos horizontally.
  11379. All streams must be of same pixel format and of same height.
  11380. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11381. to create same output.
  11382. The filter accepts the following option:
  11383. @table @option
  11384. @item inputs
  11385. Set number of input streams. Default is 2.
  11386. @item shortest
  11387. If set to 1, force the output to terminate when the shortest input
  11388. terminates. Default value is 0.
  11389. @end table
  11390. @section hsvhold
  11391. Turns a certain HSV range into gray values.
  11392. This filter measures color difference between set HSV color in options
  11393. and ones measured in video stream. Depending on options, output
  11394. colors can be changed to be gray or not.
  11395. The filter accepts the following options:
  11396. @table @option
  11397. @item hue
  11398. Set the hue value which will be used in color difference calculation.
  11399. Allowed range is from -360 to 360. Default value is 0.
  11400. @item sat
  11401. Set the saturation value which will be used in color difference calculation.
  11402. Allowed range is from -1 to 1. Default value is 0.
  11403. @item val
  11404. Set the value which will be used in color difference calculation.
  11405. Allowed range is from -1 to 1. Default value is 0.
  11406. @item similarity
  11407. Set similarity percentage with the key color.
  11408. Allowed range is from 0 to 1. Default value is 0.01.
  11409. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11410. @item blend
  11411. Blend percentage.
  11412. Allowed range is from 0 to 1. Default value is 0.
  11413. 0.0 makes pixels either fully gray, or not gray at all.
  11414. Higher values result in more gray pixels, with a higher gray pixel
  11415. the more similar the pixels color is to the key color.
  11416. @end table
  11417. @section hsvkey
  11418. Turns a certain HSV range into transparency.
  11419. This filter measures color difference between set HSV color in options
  11420. and ones measured in video stream. Depending on options, output
  11421. colors can be changed to transparent by adding alpha channel.
  11422. The filter accepts the following options:
  11423. @table @option
  11424. @item hue
  11425. Set the hue value which will be used in color difference calculation.
  11426. Allowed range is from -360 to 360. Default value is 0.
  11427. @item sat
  11428. Set the saturation value which will be used in color difference calculation.
  11429. Allowed range is from -1 to 1. Default value is 0.
  11430. @item val
  11431. Set the value which will be used in color difference calculation.
  11432. Allowed range is from -1 to 1. Default value is 0.
  11433. @item similarity
  11434. Set similarity percentage with the key color.
  11435. Allowed range is from 0 to 1. Default value is 0.01.
  11436. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11437. @item blend
  11438. Blend percentage.
  11439. Allowed range is from 0 to 1. Default value is 0.
  11440. 0.0 makes pixels either fully transparent, or not transparent at all.
  11441. Higher values result in semi-transparent pixels, with a higher transparency
  11442. the more similar the pixels color is to the key color.
  11443. @end table
  11444. @section hue
  11445. Modify the hue and/or the saturation of the input.
  11446. It accepts the following parameters:
  11447. @table @option
  11448. @item h
  11449. Specify the hue angle as a number of degrees. It accepts an expression,
  11450. and defaults to "0".
  11451. @item s
  11452. Specify the saturation in the [-10,10] range. It accepts an expression and
  11453. defaults to "1".
  11454. @item H
  11455. Specify the hue angle as a number of radians. It accepts an
  11456. expression, and defaults to "0".
  11457. @item b
  11458. Specify the brightness in the [-10,10] range. It accepts an expression and
  11459. defaults to "0".
  11460. @end table
  11461. @option{h} and @option{H} are mutually exclusive, and can't be
  11462. specified at the same time.
  11463. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  11464. expressions containing the following constants:
  11465. @table @option
  11466. @item n
  11467. frame count of the input frame starting from 0
  11468. @item pts
  11469. presentation timestamp of the input frame expressed in time base units
  11470. @item r
  11471. frame rate of the input video, NAN if the input frame rate is unknown
  11472. @item t
  11473. timestamp expressed in seconds, NAN if the input timestamp is unknown
  11474. @item tb
  11475. time base of the input video
  11476. @end table
  11477. @subsection Examples
  11478. @itemize
  11479. @item
  11480. Set the hue to 90 degrees and the saturation to 1.0:
  11481. @example
  11482. hue=h=90:s=1
  11483. @end example
  11484. @item
  11485. Same command but expressing the hue in radians:
  11486. @example
  11487. hue=H=PI/2:s=1
  11488. @end example
  11489. @item
  11490. Rotate hue and make the saturation swing between 0
  11491. and 2 over a period of 1 second:
  11492. @example
  11493. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  11494. @end example
  11495. @item
  11496. Apply a 3 seconds saturation fade-in effect starting at 0:
  11497. @example
  11498. hue="s=min(t/3\,1)"
  11499. @end example
  11500. The general fade-in expression can be written as:
  11501. @example
  11502. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  11503. @end example
  11504. @item
  11505. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  11506. @example
  11507. hue="s=max(0\, min(1\, (8-t)/3))"
  11508. @end example
  11509. The general fade-out expression can be written as:
  11510. @example
  11511. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  11512. @end example
  11513. @end itemize
  11514. @subsection Commands
  11515. This filter supports the following commands:
  11516. @table @option
  11517. @item b
  11518. @item s
  11519. @item h
  11520. @item H
  11521. Modify the hue and/or the saturation and/or brightness of the input video.
  11522. The command accepts the same syntax of the corresponding option.
  11523. If the specified expression is not valid, it is kept at its current
  11524. value.
  11525. @end table
  11526. @section huesaturation
  11527. Apply hue-saturation-intensity adjustments to input video stream.
  11528. This filter operates in RGB colorspace.
  11529. This filter accepts the following options:
  11530. @table @option
  11531. @item hue
  11532. Set the hue shift in degrees to apply. Default is 0.
  11533. Allowed range is from -180 to 180.
  11534. @item saturation
  11535. Set the saturation shift. Default is 0.
  11536. Allowed range is from -1 to 1.
  11537. @item intensity
  11538. Set the intensity shift. Default is 0.
  11539. Allowed range is from -1 to 1.
  11540. @item colors
  11541. Set which primary and complementary colors are going to be adjusted.
  11542. This options is set by providing one or multiple values.
  11543. This can select multiple colors at once. By default all colors are selected.
  11544. @table @samp
  11545. @item r
  11546. Adjust reds.
  11547. @item y
  11548. Adjust yellows.
  11549. @item g
  11550. Adjust greens.
  11551. @item c
  11552. Adjust cyans.
  11553. @item b
  11554. Adjust blues.
  11555. @item m
  11556. Adjust magentas.
  11557. @item a
  11558. Adjust all colors.
  11559. @end table
  11560. @item strength
  11561. Set strength of filtering. Allowed range is from 0 to 100.
  11562. Default value is 1.
  11563. @item rw, gw, bw
  11564. Set weight for each RGB component. Allowed range is from 0 to 1.
  11565. By default is set to 0.333, 0.334, 0.333.
  11566. Those options are used in saturation and lightess processing.
  11567. @item lightness
  11568. Set preserving lightness, by default is disabled.
  11569. Adjusting hues can change lightness from original RGB triplet,
  11570. with this option enabled lightness is kept at same value.
  11571. @end table
  11572. @section hysteresis
  11573. Grow first stream into second stream by connecting components.
  11574. This makes it possible to build more robust edge masks.
  11575. This filter accepts the following options:
  11576. @table @option
  11577. @item planes
  11578. Set which planes will be processed as bitmap, unprocessed planes will be
  11579. copied from first stream.
  11580. By default value 0xf, all planes will be processed.
  11581. @item threshold
  11582. Set threshold which is used in filtering. If pixel component value is higher than
  11583. this value filter algorithm for connecting components is activated.
  11584. By default value is 0.
  11585. @end table
  11586. The @code{hysteresis} filter also supports the @ref{framesync} options.
  11587. @section iccdetect
  11588. Detect the colorspace from an embedded ICC profile (if present), and update
  11589. the frame's tags accordingly.
  11590. This filter accepts the following options:
  11591. @table @option
  11592. @item force
  11593. If true, the frame's existing colorspace tags will always be overridden by
  11594. values detected from an ICC profile. Otherwise, they will only be assigned if
  11595. they contain @code{unknown}. Enabled by default.
  11596. @end table
  11597. @section iccgen
  11598. Generate ICC profiles and attach them to frames.
  11599. This filter accepts the following options:
  11600. @table @option
  11601. @item color_primaries
  11602. @item color_trc
  11603. Configure the colorspace that the ICC profile will be generated for. The
  11604. default value of @code{auto} infers the value from the input frame's metadata,
  11605. defaulting to BT.709/sRGB as appropriate.
  11606. See the @ref{setparams} filter for a list of possible values, but note that
  11607. @code{unknown} are not valid values for this filter.
  11608. @item force
  11609. If true, an ICC profile will be generated even if it would overwrite an
  11610. already existing ICC profile. Disabled by default.
  11611. @end table
  11612. @section identity
  11613. Obtain the identity score between two input videos.
  11614. This filter takes two input videos.
  11615. Both input videos must have the same resolution and pixel format for
  11616. this filter to work correctly. Also it assumes that both inputs
  11617. have the same number of frames, which are compared one by one.
  11618. The obtained per component, average, min and max identity score is printed through
  11619. the logging system.
  11620. The filter stores the calculated identity scores of each frame in frame metadata.
  11621. This filter also supports the @ref{framesync} options.
  11622. In the below example the input file @file{main.mpg} being processed is compared
  11623. with the reference file @file{ref.mpg}.
  11624. @example
  11625. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  11626. @end example
  11627. @section idet
  11628. Detect video interlacing type.
  11629. This filter tries to detect if the input frames are interlaced, progressive,
  11630. top or bottom field first. It will also try to detect fields that are
  11631. repeated between adjacent frames (a sign of telecine).
  11632. Single frame detection considers only immediately adjacent frames when classifying each frame.
  11633. Multiple frame detection incorporates the classification history of previous frames.
  11634. The filter will log these metadata values:
  11635. @table @option
  11636. @item single.current_frame
  11637. Detected type of current frame using single-frame detection. One of:
  11638. ``tff'' (top field first), ``bff'' (bottom field first),
  11639. ``progressive'', or ``undetermined''
  11640. @item single.tff
  11641. Cumulative number of frames detected as top field first using single-frame detection.
  11642. @item multiple.tff
  11643. Cumulative number of frames detected as top field first using multiple-frame detection.
  11644. @item single.bff
  11645. Cumulative number of frames detected as bottom field first using single-frame detection.
  11646. @item multiple.current_frame
  11647. Detected type of current frame using multiple-frame detection. One of:
  11648. ``tff'' (top field first), ``bff'' (bottom field first),
  11649. ``progressive'', or ``undetermined''
  11650. @item multiple.bff
  11651. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  11652. @item single.progressive
  11653. Cumulative number of frames detected as progressive using single-frame detection.
  11654. @item multiple.progressive
  11655. Cumulative number of frames detected as progressive using multiple-frame detection.
  11656. @item single.undetermined
  11657. Cumulative number of frames that could not be classified using single-frame detection.
  11658. @item multiple.undetermined
  11659. Cumulative number of frames that could not be classified using multiple-frame detection.
  11660. @item repeated.current_frame
  11661. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  11662. @item repeated.neither
  11663. Cumulative number of frames with no repeated field.
  11664. @item repeated.top
  11665. Cumulative number of frames with the top field repeated from the previous frame's top field.
  11666. @item repeated.bottom
  11667. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  11668. @end table
  11669. The filter accepts the following options:
  11670. @table @option
  11671. @item intl_thres
  11672. Set interlacing threshold.
  11673. @item prog_thres
  11674. Set progressive threshold.
  11675. @item rep_thres
  11676. Threshold for repeated field detection.
  11677. @item half_life
  11678. Number of frames after which a given frame's contribution to the
  11679. statistics is halved (i.e., it contributes only 0.5 to its
  11680. classification). The default of 0 means that all frames seen are given
  11681. full weight of 1.0 forever.
  11682. @item analyze_interlaced_flag
  11683. When this is not 0 then idet will use the specified number of frames to determine
  11684. if the interlaced flag is accurate, it will not count undetermined frames.
  11685. If the flag is found to be accurate it will be used without any further
  11686. computations, if it is found to be inaccurate it will be cleared without any
  11687. further computations. This allows inserting the idet filter as a low computational
  11688. method to clean up the interlaced flag
  11689. @end table
  11690. @section il
  11691. Deinterleave or interleave fields.
  11692. This filter allows one to process interlaced images fields without
  11693. deinterlacing them. Deinterleaving splits the input frame into 2
  11694. fields (so called half pictures). Odd lines are moved to the top
  11695. half of the output image, even lines to the bottom half.
  11696. You can process (filter) them independently and then re-interleave them.
  11697. The filter accepts the following options:
  11698. @table @option
  11699. @item luma_mode, l
  11700. @item chroma_mode, c
  11701. @item alpha_mode, a
  11702. Available values for @var{luma_mode}, @var{chroma_mode} and
  11703. @var{alpha_mode} are:
  11704. @table @samp
  11705. @item none
  11706. Do nothing.
  11707. @item deinterleave, d
  11708. Deinterleave fields, placing one above the other.
  11709. @item interleave, i
  11710. Interleave fields. Reverse the effect of deinterleaving.
  11711. @end table
  11712. Default value is @code{none}.
  11713. @item luma_swap, ls
  11714. @item chroma_swap, cs
  11715. @item alpha_swap, as
  11716. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  11717. @end table
  11718. @subsection Commands
  11719. This filter supports the all above options as @ref{commands}.
  11720. @section inflate
  11721. Apply inflate effect to the video.
  11722. This filter replaces the pixel by the local(3x3) average by taking into account
  11723. only values higher than the pixel.
  11724. It accepts the following options:
  11725. @table @option
  11726. @item threshold0
  11727. @item threshold1
  11728. @item threshold2
  11729. @item threshold3
  11730. Limit the maximum change for each plane, default is 65535.
  11731. If 0, plane will remain unchanged.
  11732. @end table
  11733. @subsection Commands
  11734. This filter supports the all above options as @ref{commands}.
  11735. @section interlace
  11736. Simple interlacing filter from progressive contents. This interleaves upper (or
  11737. lower) lines from odd frames with lower (or upper) lines from even frames,
  11738. halving the frame rate and preserving image height.
  11739. @example
  11740. Original Original New Frame
  11741. Frame 'j' Frame 'j+1' (tff)
  11742. ========== =========== ==================
  11743. Line 0 --------------------> Frame 'j' Line 0
  11744. Line 1 Line 1 ----> Frame 'j+1' Line 1
  11745. Line 2 ---------------------> Frame 'j' Line 2
  11746. Line 3 Line 3 ----> Frame 'j+1' Line 3
  11747. ... ... ...
  11748. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  11749. @end example
  11750. It accepts the following optional parameters:
  11751. @table @option
  11752. @item scan
  11753. This determines whether the interlaced frame is taken from the even
  11754. (tff - default) or odd (bff) lines of the progressive frame.
  11755. @item lowpass
  11756. Vertical lowpass filter to avoid twitter interlacing and
  11757. reduce moire patterns.
  11758. @table @samp
  11759. @item 0, off
  11760. Disable vertical lowpass filter
  11761. @item 1, linear
  11762. Enable linear filter (default)
  11763. @item 2, complex
  11764. Enable complex filter. This will slightly less reduce twitter and moire
  11765. but better retain detail and subjective sharpness impression.
  11766. @end table
  11767. @end table
  11768. @section kerndeint
  11769. Deinterlace input video by applying Donald Graft's adaptive kernel
  11770. deinterling. Work on interlaced parts of a video to produce
  11771. progressive frames.
  11772. The description of the accepted parameters follows.
  11773. @table @option
  11774. @item thresh
  11775. Set the threshold which affects the filter's tolerance when
  11776. determining if a pixel line must be processed. It must be an integer
  11777. in the range [0,255] and defaults to 10. A value of 0 will result in
  11778. applying the process on every pixels.
  11779. @item map
  11780. Paint pixels exceeding the threshold value to white if set to 1.
  11781. Default is 0.
  11782. @item order
  11783. Set the fields order. Swap fields if set to 1, leave fields alone if
  11784. 0. Default is 0.
  11785. @item sharp
  11786. Enable additional sharpening if set to 1. Default is 0.
  11787. @item twoway
  11788. Enable twoway sharpening if set to 1. Default is 0.
  11789. @end table
  11790. @subsection Examples
  11791. @itemize
  11792. @item
  11793. Apply default values:
  11794. @example
  11795. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  11796. @end example
  11797. @item
  11798. Enable additional sharpening:
  11799. @example
  11800. kerndeint=sharp=1
  11801. @end example
  11802. @item
  11803. Paint processed pixels in white:
  11804. @example
  11805. kerndeint=map=1
  11806. @end example
  11807. @end itemize
  11808. @section kirsch
  11809. Apply kirsch operator to input video stream.
  11810. The filter accepts the following option:
  11811. @table @option
  11812. @item planes
  11813. Set which planes will be processed, unprocessed planes will be copied.
  11814. By default value 0xf, all planes will be processed.
  11815. @item scale
  11816. Set value which will be multiplied with filtered result.
  11817. @item delta
  11818. Set value which will be added to filtered result.
  11819. @end table
  11820. @subsection Commands
  11821. This filter supports the all above options as @ref{commands}.
  11822. @section lagfun
  11823. Slowly update darker pixels.
  11824. This filter makes short flashes of light appear longer.
  11825. This filter accepts the following options:
  11826. @table @option
  11827. @item decay
  11828. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  11829. @item planes
  11830. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  11831. @end table
  11832. @subsection Commands
  11833. This filter supports the all above options as @ref{commands}.
  11834. @section lenscorrection
  11835. Correct radial lens distortion
  11836. This filter can be used to correct for radial distortion as can result from the use
  11837. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  11838. one can use tools available for example as part of opencv or simply trial-and-error.
  11839. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  11840. and extract the k1 and k2 coefficients from the resulting matrix.
  11841. Note that effectively the same filter is available in the open-source tools Krita and
  11842. Digikam from the KDE project.
  11843. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  11844. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  11845. brightness distribution, so you may want to use both filters together in certain
  11846. cases, though you will have to take care of ordering, i.e. whether vignetting should
  11847. be applied before or after lens correction.
  11848. @subsection Options
  11849. The filter accepts the following options:
  11850. @table @option
  11851. @item cx
  11852. Relative x-coordinate of the focal point of the image, and thereby the center of the
  11853. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11854. width. Default is 0.5.
  11855. @item cy
  11856. Relative y-coordinate of the focal point of the image, and thereby the center of the
  11857. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11858. height. Default is 0.5.
  11859. @item k1
  11860. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  11861. no correction. Default is 0.
  11862. @item k2
  11863. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  11864. 0 means no correction. Default is 0.
  11865. @item i
  11866. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  11867. Default is @code{nearest}.
  11868. @item fc
  11869. Specify the color of the unmapped pixels. For the syntax of this option,
  11870. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11871. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  11872. @end table
  11873. The formula that generates the correction is:
  11874. @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)
  11875. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  11876. distances from the focal point in the source and target images, respectively.
  11877. @subsection Commands
  11878. This filter supports the all above options as @ref{commands}.
  11879. @section lensfun
  11880. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  11881. The @code{lensfun} filter requires the camera make, camera model, and lens model
  11882. to apply the lens correction. The filter will load the lensfun database and
  11883. query it to find the corresponding camera and lens entries in the database. As
  11884. long as these entries can be found with the given options, the filter can
  11885. perform corrections on frames. Note that incomplete strings will result in the
  11886. filter choosing the best match with the given options, and the filter will
  11887. output the chosen camera and lens models (logged with level "info"). You must
  11888. provide the make, camera model, and lens model as they are required.
  11889. To obtain a list of available makes and models, leave out one or both of @code{make} and
  11890. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  11891. The first column is the make and the second column is the model.
  11892. To obtain a list of available lenses, set any values for make and model and leave out the
  11893. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  11894. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  11895. The filter accepts the following options:
  11896. @table @option
  11897. @item make
  11898. The make of the camera (for example, "Canon"). This option is required.
  11899. @item model
  11900. The model of the camera (for example, "Canon EOS 100D"). This option is
  11901. required.
  11902. @item lens_model
  11903. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  11904. option is required.
  11905. @item db_path
  11906. The full path to the lens database folder. If not set, the filter will attempt to
  11907. load the database from the install path when the library was built. Default is unset.
  11908. @item mode
  11909. The type of correction to apply. The following values are valid options:
  11910. @table @samp
  11911. @item vignetting
  11912. Enables fixing lens vignetting.
  11913. @item geometry
  11914. Enables fixing lens geometry. This is the default.
  11915. @item subpixel
  11916. Enables fixing chromatic aberrations.
  11917. @item vig_geo
  11918. Enables fixing lens vignetting and lens geometry.
  11919. @item vig_subpixel
  11920. Enables fixing lens vignetting and chromatic aberrations.
  11921. @item distortion
  11922. Enables fixing both lens geometry and chromatic aberrations.
  11923. @item all
  11924. Enables all possible corrections.
  11925. @end table
  11926. @item focal_length
  11927. The focal length of the image/video (zoom; expected constant for video). For
  11928. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  11929. range should be chosen when using that lens. Default 18.
  11930. @item aperture
  11931. The aperture of the image/video (expected constant for video). Note that
  11932. aperture is only used for vignetting correction. Default 3.5.
  11933. @item focus_distance
  11934. The focus distance of the image/video (expected constant for video). Note that
  11935. focus distance is only used for vignetting and only slightly affects the
  11936. vignetting correction process. If unknown, leave it at the default value (which
  11937. is 1000).
  11938. @item scale
  11939. The scale factor which is applied after transformation. After correction the
  11940. video is no longer necessarily rectangular. This parameter controls how much of
  11941. the resulting image is visible. The value 0 means that a value will be chosen
  11942. automatically such that there is little or no unmapped area in the output
  11943. image. 1.0 means that no additional scaling is done. Lower values may result
  11944. in more of the corrected image being visible, while higher values may avoid
  11945. unmapped areas in the output.
  11946. @item target_geometry
  11947. The target geometry of the output image/video. The following values are valid
  11948. options:
  11949. @table @samp
  11950. @item rectilinear (default)
  11951. @item fisheye
  11952. @item panoramic
  11953. @item equirectangular
  11954. @item fisheye_orthographic
  11955. @item fisheye_stereographic
  11956. @item fisheye_equisolid
  11957. @item fisheye_thoby
  11958. @end table
  11959. @item reverse
  11960. Apply the reverse of image correction (instead of correcting distortion, apply
  11961. it).
  11962. @item interpolation
  11963. The type of interpolation used when correcting distortion. The following values
  11964. are valid options:
  11965. @table @samp
  11966. @item nearest
  11967. @item linear (default)
  11968. @item lanczos
  11969. @end table
  11970. @end table
  11971. @subsection Examples
  11972. @itemize
  11973. @item
  11974. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  11975. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  11976. aperture of "8.0".
  11977. @example
  11978. 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
  11979. @end example
  11980. @item
  11981. Apply the same as before, but only for the first 5 seconds of video.
  11982. @example
  11983. 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
  11984. @end example
  11985. @end itemize
  11986. @section libplacebo
  11987. Flexible GPU-accelerated processing filter based on libplacebo
  11988. (@url{https://code.videolan.org/videolan/libplacebo}). Note that this filter
  11989. currently only accepts Vulkan input frames.
  11990. @subsection Options
  11991. The options for this filter are divided into the following sections:
  11992. @subsubsection Output mode
  11993. These options control the overall output mode. By default, libplacebo will try
  11994. to preserve the source colorimetry and size as best as it can, but it will
  11995. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  11996. in source frames.
  11997. @table @option
  11998. @item w
  11999. @item h
  12000. Set the output video dimension expression. Default value is the input dimension.
  12001. Allows for the same expressions as the @ref{scale} filter.
  12002. @item format
  12003. Set the output format override. If unset (the default), frames will be output
  12004. in the same format as the respective input frames. Otherwise, format conversion
  12005. will be performed.
  12006. @item force_original_aspect_ratio
  12007. @item force_divisible_by
  12008. Work the same as the identical @ref{scale} filter options.
  12009. @item normalize_sar
  12010. If enabled, output frames will always have a pixel aspect ratio of 1:1. This
  12011. will introduce padding/cropping as necessary. If disabled (the default), any
  12012. aspect ratio mismatches, including those from e.g. anamorphic video sources,
  12013. are forwarded to the output pixel aspect ratio.
  12014. @item pad_crop_ratio
  12015. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  12016. cropping when the input aspect ratio does not match the output aspect ratio and
  12017. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  12018. content with black borders, while a value of @code{1.0} always crops off parts
  12019. of the content. Intermediate values are possible, leading to a mix of the two
  12020. approaches.
  12021. @item colorspace
  12022. @item color_primaries
  12023. @item color_trc
  12024. @item range
  12025. Configure the colorspace that output frames will be delivered in. The default
  12026. value of @code{auto} outputs frames in the same format as the input frames,
  12027. leading to no change. For any other value, conversion will be performed.
  12028. See the @ref{setparams} filter for a list of possible values.
  12029. @item apply_filmgrain
  12030. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  12031. it from the output. Enabled by default.
  12032. @item apply_dolbyvision
  12033. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  12034. the output. Enabled by default. Note that Dolby Vision will always output
  12035. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  12036. picked as the values of @code{auto} for the respective frame output options.
  12037. @end table
  12038. @subsubsection Scaling
  12039. The options in this section control how libplacebo performs upscaling and (if
  12040. necessary) downscaling. Note that libplacebo will always internally operate on
  12041. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  12042. necessarily be upsampled and downsampled as part of the rendering process. That
  12043. means scaling might be in effect even if the source and destination resolution
  12044. are the same.
  12045. @table @option
  12046. @item upscaler
  12047. @item downscaler
  12048. Configure the filter kernel used for upscaling and downscaling. The respective
  12049. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  12050. values, pass @code{help} to these options. The most important values are:
  12051. @table @samp
  12052. @item none
  12053. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  12054. fast but poor quality, especially when downscaling.
  12055. @item bilinear
  12056. Bilinear interpolation. Can generally be done for free on GPUs, except when
  12057. doing so would lead to aliasing. Fast and low quality.
  12058. @item nearest
  12059. Nearest-neighbour interpolation. Sharp but highly aliasing.
  12060. @item oversample
  12061. Algorithm that looks visually similar to nearest-neighbour interpolation but
  12062. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  12063. minimal distortion of the artistic appearance.
  12064. @item lanczos
  12065. Standard sinc-sinc interpolation kernel.
  12066. @item spline36
  12067. Cubic spline approximation of lanczos. No difference in performance, but has
  12068. very slightly less ringing.
  12069. @item ewa_lanczos
  12070. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  12071. This is also popularly referred to as just "Jinc scaling". Slow but very high
  12072. quality.
  12073. @item gaussian
  12074. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  12075. very blurry.
  12076. @item mitchell
  12077. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  12078. little ringing.
  12079. @end table
  12080. @item lut_entries
  12081. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  12082. default of @code{0} will pick libplacebo's internal default, typically
  12083. @code{64}.
  12084. @item antiringing
  12085. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  12086. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  12087. aliasing if set too high. Disabled by default.
  12088. @item sigmoid
  12089. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  12090. Enabled by default.
  12091. @end table
  12092. @subsubsection Debanding
  12093. Libplacebo comes with a built-in debanding filter that is good at counteracting
  12094. many common sources of banding and blocking. Turning this on is highly
  12095. recommended whenever quality is desired.
  12096. @table @option
  12097. @item deband
  12098. Enable (fast) debanding algorithm. Disabled by default.
  12099. @item deband_iterations
  12100. Number of deband iterations of the debanding algorithm. Each iteration is
  12101. performed with progressively increased radius (and diminished threshold).
  12102. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  12103. @item deband_threshold
  12104. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  12105. Defaults to @code{4.0}.
  12106. @item deband_radius
  12107. Debanding filter radius. A higher radius is better for slow gradients, while
  12108. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  12109. @item deband_grain
  12110. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  12111. @code{6.0}.
  12112. @end table
  12113. @subsubsection Color adjustment
  12114. A collection of subjective color controls. Not very rigorous, so the exact
  12115. effect will vary somewhat depending on the input primaries and colorspace.
  12116. @table @option
  12117. @item brightness
  12118. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  12119. @item contrast
  12120. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12121. @item saturation
  12122. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12123. @item hue
  12124. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  12125. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  12126. coefficients for RGB inputs.
  12127. @item gamma
  12128. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12129. @item cones
  12130. Cone model to use for color blindness simulation. Accepts any combination of
  12131. @code{l}, @code{m} and @code{s}. Here are some examples:
  12132. @table @samp
  12133. @item m
  12134. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  12135. @item l
  12136. Protanomaly / protanopia (affecting 1%-2% of the population)
  12137. @item l+m
  12138. Monochromacy (very rare)
  12139. @item l+m+s
  12140. Achromatopsy (complete loss of daytime vision, extremely rare)
  12141. @end table
  12142. @item cone-strength
  12143. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  12144. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  12145. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  12146. above @code{1.0} result in exaggerating the differences between cones, which
  12147. may help compensate for reduced color vision.
  12148. @end table
  12149. @subsubsection Peak detection
  12150. To help deal with sources that only have static HDR10 metadata (or no tagging
  12151. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  12152. analyze source frames and adapt the tone mapping function in realtime. If this
  12153. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  12154. recommended to turn this feature off.
  12155. @table @option
  12156. @item peak_detect
  12157. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  12158. dynamic detection from the input. Note that the detected values do not get
  12159. written back to the output frames, they merely guide the internal tone mapping
  12160. process. Enabled by default.
  12161. @item smoothing_period
  12162. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  12163. values result in peak detection becoming less responsive to changes in the
  12164. input. Defaults to @code{100.0}.
  12165. @item minimum_peak
  12166. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  12167. and @code{100.0}. Defaults to @code{1.0}.
  12168. @item scene_threshold_low
  12169. @item scene_threshold_high
  12170. Lower and upper thresholds for scene change detection. Expressed in a
  12171. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  12172. and @code{10.0}, respectively. Setting either to a negative value disables
  12173. this functionality.
  12174. @item overshoot
  12175. Peak smoothing overshoot margin, between @code{0.0} and @code{1.0}. Provides a
  12176. safety margin to prevent clipping as a result of peak smoothing. Defaults to
  12177. @code{0.05}, corresponding to a margin of 5%.
  12178. @end table
  12179. @subsubsection Tone mapping
  12180. The options in this section control how libplacebo performs tone-mapping and
  12181. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  12182. In general, libplacebo relies on accurate source tagging and mastering display
  12183. gamut information to produce the best results.
  12184. @table @option
  12185. @item intent
  12186. Rendering intent to use when adapting between different primary color gamuts
  12187. (after tone-mapping).
  12188. @table @samp
  12189. @item perceptual
  12190. Perceptual gamut mapping. Currently equivalent to relative colorimetric.
  12191. @item relative
  12192. Relative colorimetric. This is the default.
  12193. @item absolute
  12194. Absolute colorimetric.
  12195. @item saturation
  12196. Saturation mapping. Forcibly stretches the source gamut to the target gamut.
  12197. @end table
  12198. @item gamut_mode
  12199. How to handle out-of-gamut colors that can occur as a result of colorimetric
  12200. gamut mapping.
  12201. @table @samp
  12202. @item clip
  12203. Do nothing, simply clip out-of-range colors to the RGB volume. This is the
  12204. default.
  12205. @item warn
  12206. Highlight out-of-gamut pixels (by coloring them pink).
  12207. @item darken
  12208. Linearly reduces content brightness to preserves saturated details, followed by
  12209. clipping the remaining out-of-gamut colors. As the name implies, this makes
  12210. everything darker, but provides a good balance between preserving details and
  12211. colors.
  12212. @item desaturate
  12213. Hard-desaturates out-of-gamut colors towards white, while preserving the
  12214. luminance. Has a tendency to shift colors.
  12215. @end table
  12216. @item tonemapping
  12217. Tone-mapping algorithm to use. Available values are:
  12218. @table @samp
  12219. @item auto
  12220. Automatic selection based on internal heuristics. This is the default.
  12221. @item clip
  12222. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  12223. accuracy for in-range colors but completely destroys out-of-range information.
  12224. Does not perform any black point adaptation. Not configurable.
  12225. @item bt.2390
  12226. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  12227. segment. The knee point offset is configurable. Note that this parameter
  12228. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  12229. spec.
  12230. @item bt.2446a
  12231. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  12232. sources. Can be used for both forward and inverse tone mapping. Not
  12233. configurable.
  12234. @item spline
  12235. Simple spline consisting of two polynomials, joined by a single pivot point.
  12236. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  12237. Can be used for both forward and inverse tone mapping.
  12238. @item reinhard
  12239. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  12240. local contrast coefficient at the display peak. Essentially, a parameter of
  12241. @code{0.5} implies that the reference white will be about half as bright as
  12242. when clipping. Defaults to @code{0.5}, which results in the simplest
  12243. formulation of this function.
  12244. @item mobius
  12245. Generalization of the reinhard tone mapping algorithm to support an additional
  12246. linear slope near black. The tone mapping parameter indicates the trade-off
  12247. between the linear section and the non-linear section. Essentially, for a given
  12248. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  12249. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  12250. this curve behave like @code{clip}, while values near @code{0.0} make this
  12251. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  12252. provides a good balance between colorimetric accuracy and preserving
  12253. out-of-gamut details.
  12254. @item hable
  12255. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  12256. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  12257. Popularized by its use in video games with HDR rendering. Preserves both dark
  12258. and bright details very well, but comes with the drawback of changing the
  12259. average brightness quite significantly. This is sort of similar to
  12260. @code{reinhard} with parameter @code{0.24}.
  12261. @item gamma
  12262. Fits a gamma (power) function to transfer between the source and target color
  12263. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  12264. linear sections. This preserves details at all scales fairly accurately, but
  12265. can result in an image with a muted or dull appearance. The parameter is used
  12266. as the cutoff point, defaulting to @code{0.5}.
  12267. @item linear
  12268. Linearly stretches the input range to the output range, in PQ space. This will
  12269. preserve all details accurately, but results in a significantly different
  12270. average brightness. Can be used for inverse tone-mapping in addition to regular
  12271. tone-mapping. The parameter can be used as an additional linear gain
  12272. coefficient (defaulting to @code{1.0}).
  12273. @end table
  12274. @item tonemapping_param
  12275. For tunable tone mapping functions, this parameter can be used to fine-tune the
  12276. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  12277. value of @code{0.0} is replaced by the curve's preferred default setting.
  12278. @item tonemapping_mode
  12279. This option determines how the tone mapping function specified by
  12280. @code{tonemapping} is applied to the colors in a scene. Possible values are:
  12281. @table @samp
  12282. @item auto
  12283. Automatic selection based on internal heuristics. This is the default.
  12284. @item rgb
  12285. Apply the function per-channel in the RGB colorspace.
  12286. Per-channel tone-mapping in RGB. Guarantees no clipping and heavily desaturates
  12287. the output, but distorts the colors quite significantly. Very similar to the
  12288. "Hollywood" look and feel.
  12289. @item max
  12290. Tone-mapping is performed on the brightest component found in the signal. Good
  12291. at preserving details in highlights, but has a tendency to crush blacks.
  12292. @item hybrid
  12293. Tone-map per-channel for highlights and linearly (luma-based) for
  12294. midtones/shadows, based on a fixed gamma @code{2.4} coefficient curve.
  12295. @item luma
  12296. Tone-map linearly on the luma component (CIE Y), and adjust (desaturate) the
  12297. chromaticities to compensate using a simple constant factor. This is
  12298. essentially the mode used in ITU-R BT.2446 method A.
  12299. @end table
  12300. @item inverse_tonemapping
  12301. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  12302. output color volumes. Disabled by default.
  12303. @item tonemapping_crosstalk
  12304. Extra tone-mapping crosstalk factor, between @code{0.0} and @code{0.3}. This
  12305. can help reduce issues tone-mapping certain bright spectral colors. Defaults to
  12306. @code{0.04}.
  12307. @item tonemapping_lut_size
  12308. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  12309. @code{256}. Note that this figure is squared when combined with
  12310. @code{peak_detect}.
  12311. @end table
  12312. @subsubsection Dithering
  12313. By default, libplacebo will dither whenever necessary, which includes rendering
  12314. to any integer format below 16-bit precision. It's recommended to always leave
  12315. this on, since not doing so may result in visible banding in the output, even
  12316. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12317. use @code{ordered_fixed} instead of disabling dithering.
  12318. @table @option
  12319. @item dithering
  12320. Dithering method to use. Accepts the following values:
  12321. @table @samp
  12322. @item none
  12323. Disables dithering completely. May result in visible banding.
  12324. @item blue
  12325. Dither with pseudo-blue noise. This is the default.
  12326. @item ordered
  12327. Tunable ordered dither pattern.
  12328. @item ordered_fixed
  12329. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12330. @item white
  12331. Dither with white noise. Texture-less.
  12332. @end table
  12333. @item dither_lut_size
  12334. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12335. @code{6}, corresponding to a LUT size of @code{64x64}.
  12336. @item dither_temporal
  12337. Enables temporal dithering. Disabled by default.
  12338. @end table
  12339. @subsubsection Custom shaders
  12340. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12341. syntax. A collection of such shaders can be found here:
  12342. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12343. A full description of the mpv shader format is beyond the scope of this
  12344. section, but a summary can be found here:
  12345. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12346. @table @option
  12347. @item custom_shader_path
  12348. Specifies a path to a custom shader file to load at runtime.
  12349. @item custom_shader_bin
  12350. Specifies a complete custom shader as a raw string.
  12351. @end table
  12352. @subsubsection Debugging / performance
  12353. All of the options in this section default off. They may be of assistance when
  12354. attempting to squeeze the maximum performance at the cost of quality.
  12355. @table @option
  12356. @item skip_aa
  12357. Disable anti-aliasing when downscaling.
  12358. @item polar_cutoff
  12359. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  12360. @code{0.0} and @code{1.0}.
  12361. @item disable_linear
  12362. Disable linear light scaling.
  12363. @item disable_builtin
  12364. Disable built-in GPU sampling (forces LUT).
  12365. @item force_icc_lut
  12366. Force the use of a full ICC 3DLUT for gamut mapping.
  12367. @item disable_fbos
  12368. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12369. offering the maximum possible speed.
  12370. @end table
  12371. @subsection Commands
  12372. This filter supports almost all of the above options as @ref{commands}.
  12373. @subsection Examples
  12374. @itemize
  12375. @item
  12376. Complete example for how to initialize the Vulkan device, upload frames to the
  12377. GPU, perform filter conversion to yuv420p, and download frames back to the CPU
  12378. for output. Note that in specific cases you can get around the need to perform
  12379. format conversion by specifying the correct @code{format} filter option
  12380. corresponding to the input frames.
  12381. @example
  12382. ffmpeg -i $INPUT -init_hw_device vulkan -vf hwupload,libplacebo=format=yuv420p,hwdownload,format=yuv420p $OUTPUT
  12383. @end example
  12384. @item
  12385. Tone-map input to standard gamut BT.709 output:
  12386. @example
  12387. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12388. @end example
  12389. @item
  12390. Rescale input to fit into standard 1080p, with high quality scaling:
  12391. @example
  12392. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12393. @end example
  12394. @item
  12395. Convert input to standard sRGB JPEG:
  12396. @example
  12397. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12398. @end example
  12399. @item
  12400. Use higher quality debanding settings:
  12401. @example
  12402. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  12403. @end example
  12404. @item
  12405. Run this filter on the CPU, on systems with Mesa installed (and with the most
  12406. expensive options disabled):
  12407. @example
  12408. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  12409. @end example
  12410. @item
  12411. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  12412. doing it with this filter. Note that this is only a gain if the frames are
  12413. either already on the GPU, or if you're using libplacebo for other purposes,
  12414. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  12415. @example
  12416. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  12417. @end example
  12418. @end itemize
  12419. @section libvmaf
  12420. Calulate the VMAF (Video Multi-Method Assessment Fusion) score for a
  12421. reference/distorted pair of input videos.
  12422. The first input is the distorted video, and the second input is the reference video.
  12423. The obtained VMAF score is printed through the logging system.
  12424. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12425. After installing the library it can be enabled using:
  12426. @code{./configure --enable-libvmaf}.
  12427. The filter has following options:
  12428. @table @option
  12429. @item model
  12430. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  12431. Default value: @code{"version=vmaf_v0.6.1"}
  12432. @item model_path
  12433. Deprecated, use model='path=...'.
  12434. @item enable_transform
  12435. Deprecated, use model='enable_transform=true'.
  12436. @item phone_model
  12437. Deprecated, use model='enable_transform=true'.
  12438. @item enable_conf_interval
  12439. Deprecated, use model='enable_conf_interval=true'.
  12440. @item feature
  12441. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  12442. @item psnr
  12443. Deprecated, use feature='name=psnr'.
  12444. @item ssim
  12445. Deprecated, use feature='name=ssim'.
  12446. @item ms_ssim
  12447. Deprecated, use feature='name=ms_ssim'.
  12448. @item log_path
  12449. Set the file path to be used to store log files.
  12450. @item log_fmt
  12451. Set the format of the log file (xml, json, csv, or sub).
  12452. @item n_threads
  12453. Set number of threads to be used when initializing libvmaf.
  12454. Default value: @code{0}, no threads.
  12455. @item n_subsample
  12456. Set frame subsampling interval to be used.
  12457. @end table
  12458. This filter also supports the @ref{framesync} options.
  12459. @subsection Examples
  12460. @itemize
  12461. @item
  12462. In the examples below, a distorted video @file{distorted.mpg} is
  12463. compared with a reference file @file{reference.mpg}.
  12464. @item
  12465. Basic usage:
  12466. @example
  12467. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  12468. @end example
  12469. @item
  12470. Example with multiple models:
  12471. @example
  12472. 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 -
  12473. @end example
  12474. @item
  12475. Example with multiple addtional features:
  12476. @example
  12477. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  12478. @end example
  12479. @item
  12480. Example with options and different containers:
  12481. @example
  12482. 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 -
  12483. @end example
  12484. @end itemize
  12485. @section limitdiff
  12486. Apply limited difference filter using second and optionally third video stream.
  12487. The filter accepts the following options:
  12488. @table @option
  12489. @item threshold
  12490. Set the threshold to use when allowing certain differences between video streams.
  12491. Any absolute difference value lower or exact than this threshold will pick pixel components from
  12492. first video stream.
  12493. @item elasticity
  12494. Set the elasticity of soft thresholding when processing video streams.
  12495. This value multiplied with first one sets second threshold.
  12496. Any absolute difference value greater or exact than second threshold will pick pixel components
  12497. from second video stream. For values between those two threshold
  12498. linear interpolation between first and second video stream will be used.
  12499. @item reference
  12500. Enable the reference (third) video stream processing. By default is disabled.
  12501. If set, this video stream will be used for calculating absolute difference with first video
  12502. stream.
  12503. @item planes
  12504. Specify which planes will be processed. Defaults to all available.
  12505. @end table
  12506. @subsection Commands
  12507. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  12508. @section limiter
  12509. Limits the pixel components values to the specified range [min, max].
  12510. The filter accepts the following options:
  12511. @table @option
  12512. @item min
  12513. Lower bound. Defaults to the lowest allowed value for the input.
  12514. @item max
  12515. Upper bound. Defaults to the highest allowed value for the input.
  12516. @item planes
  12517. Specify which planes will be processed. Defaults to all available.
  12518. @end table
  12519. @subsection Commands
  12520. This filter supports the all above options as @ref{commands}.
  12521. @section loop
  12522. Loop video frames.
  12523. The filter accepts the following options:
  12524. @table @option
  12525. @item loop
  12526. Set the number of loops. Setting this value to -1 will result in infinite loops.
  12527. Default is 0.
  12528. @item size
  12529. Set maximal size in number of frames. Default is 0.
  12530. @item start
  12531. Set first frame of loop. Default is 0.
  12532. @end table
  12533. @subsection Examples
  12534. @itemize
  12535. @item
  12536. Loop single first frame infinitely:
  12537. @example
  12538. loop=loop=-1:size=1:start=0
  12539. @end example
  12540. @item
  12541. Loop single first frame 10 times:
  12542. @example
  12543. loop=loop=10:size=1:start=0
  12544. @end example
  12545. @item
  12546. Loop 10 first frames 5 times:
  12547. @example
  12548. loop=loop=5:size=10:start=0
  12549. @end example
  12550. @end itemize
  12551. @section lut1d
  12552. Apply a 1D LUT to an input video.
  12553. The filter accepts the following options:
  12554. @table @option
  12555. @item file
  12556. Set the 1D LUT file name.
  12557. Currently supported formats:
  12558. @table @samp
  12559. @item cube
  12560. Iridas
  12561. @item csp
  12562. cineSpace
  12563. @end table
  12564. @item interp
  12565. Select interpolation mode.
  12566. Available values are:
  12567. @table @samp
  12568. @item nearest
  12569. Use values from the nearest defined point.
  12570. @item linear
  12571. Interpolate values using the linear interpolation.
  12572. @item cosine
  12573. Interpolate values using the cosine interpolation.
  12574. @item cubic
  12575. Interpolate values using the cubic interpolation.
  12576. @item spline
  12577. Interpolate values using the spline interpolation.
  12578. @end table
  12579. @end table
  12580. @subsection Commands
  12581. This filter supports the all above options as @ref{commands}.
  12582. @anchor{lut3d}
  12583. @section lut3d
  12584. Apply a 3D LUT to an input video.
  12585. The filter accepts the following options:
  12586. @table @option
  12587. @item file
  12588. Set the 3D LUT file name.
  12589. Currently supported formats:
  12590. @table @samp
  12591. @item 3dl
  12592. AfterEffects
  12593. @item cube
  12594. Iridas
  12595. @item dat
  12596. DaVinci
  12597. @item m3d
  12598. Pandora
  12599. @item csp
  12600. cineSpace
  12601. @end table
  12602. @item interp
  12603. Select interpolation mode.
  12604. Available values are:
  12605. @table @samp
  12606. @item nearest
  12607. Use values from the nearest defined point.
  12608. @item trilinear
  12609. Interpolate values using the 8 points defining a cube.
  12610. @item tetrahedral
  12611. Interpolate values using a tetrahedron.
  12612. @item pyramid
  12613. Interpolate values using a pyramid.
  12614. @item prism
  12615. Interpolate values using a prism.
  12616. @end table
  12617. @end table
  12618. @subsection Commands
  12619. This filter supports the @code{interp} option as @ref{commands}.
  12620. @section lumakey
  12621. Turn certain luma values into transparency.
  12622. The filter accepts the following options:
  12623. @table @option
  12624. @item threshold
  12625. Set the luma which will be used as base for transparency.
  12626. Default value is @code{0}.
  12627. @item tolerance
  12628. Set the range of luma values to be keyed out.
  12629. Default value is @code{0.01}.
  12630. @item softness
  12631. Set the range of softness. Default value is @code{0}.
  12632. Use this to control gradual transition from zero to full transparency.
  12633. @end table
  12634. @subsection Commands
  12635. This filter supports same @ref{commands} as options.
  12636. The command accepts the same syntax of the corresponding option.
  12637. If the specified expression is not valid, it is kept at its current
  12638. value.
  12639. @section lut, lutrgb, lutyuv
  12640. Compute a look-up table for binding each pixel component input value
  12641. to an output value, and apply it to the input video.
  12642. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  12643. to an RGB input video.
  12644. These filters accept the following parameters:
  12645. @table @option
  12646. @item c0
  12647. set first pixel component expression
  12648. @item c1
  12649. set second pixel component expression
  12650. @item c2
  12651. set third pixel component expression
  12652. @item c3
  12653. set fourth pixel component expression, corresponds to the alpha component
  12654. @item r
  12655. set red component expression
  12656. @item g
  12657. set green component expression
  12658. @item b
  12659. set blue component expression
  12660. @item a
  12661. alpha component expression
  12662. @item y
  12663. set Y/luminance component expression
  12664. @item u
  12665. set U/Cb component expression
  12666. @item v
  12667. set V/Cr component expression
  12668. @end table
  12669. Each of them specifies the expression to use for computing the lookup table for
  12670. the corresponding pixel component values.
  12671. The exact component associated to each of the @var{c*} options depends on the
  12672. format in input.
  12673. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  12674. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  12675. The expressions can contain the following constants and functions:
  12676. @table @option
  12677. @item w
  12678. @item h
  12679. The input width and height.
  12680. @item val
  12681. The input value for the pixel component.
  12682. @item clipval
  12683. The input value, clipped to the @var{minval}-@var{maxval} range.
  12684. @item maxval
  12685. The maximum value for the pixel component.
  12686. @item minval
  12687. The minimum value for the pixel component.
  12688. @item negval
  12689. The negated value for the pixel component value, clipped to the
  12690. @var{minval}-@var{maxval} range; it corresponds to the expression
  12691. "maxval-clipval+minval".
  12692. @item clip(val)
  12693. The computed value in @var{val}, clipped to the
  12694. @var{minval}-@var{maxval} range.
  12695. @item gammaval(gamma)
  12696. The computed gamma correction value of the pixel component value,
  12697. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  12698. expression
  12699. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  12700. @end table
  12701. All expressions default to "clipval".
  12702. @subsection Commands
  12703. This filter supports same @ref{commands} as options.
  12704. @subsection Examples
  12705. @itemize
  12706. @item
  12707. Negate input video:
  12708. @example
  12709. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  12710. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  12711. @end example
  12712. The above is the same as:
  12713. @example
  12714. lutrgb="r=negval:g=negval:b=negval"
  12715. lutyuv="y=negval:u=negval:v=negval"
  12716. @end example
  12717. @item
  12718. Negate luminance:
  12719. @example
  12720. lutyuv=y=negval
  12721. @end example
  12722. @item
  12723. Remove chroma components, turning the video into a graytone image:
  12724. @example
  12725. lutyuv="u=128:v=128"
  12726. @end example
  12727. @item
  12728. Apply a luma burning effect:
  12729. @example
  12730. lutyuv="y=2*val"
  12731. @end example
  12732. @item
  12733. Remove green and blue components:
  12734. @example
  12735. lutrgb="g=0:b=0"
  12736. @end example
  12737. @item
  12738. Set a constant alpha channel value on input:
  12739. @example
  12740. format=rgba,lutrgb=a="maxval-minval/2"
  12741. @end example
  12742. @item
  12743. Correct luminance gamma by a factor of 0.5:
  12744. @example
  12745. lutyuv=y=gammaval(0.5)
  12746. @end example
  12747. @item
  12748. Discard least significant bits of luma:
  12749. @example
  12750. lutyuv=y='bitand(val, 128+64+32)'
  12751. @end example
  12752. @item
  12753. Technicolor like effect:
  12754. @example
  12755. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  12756. @end example
  12757. @end itemize
  12758. @section lut2, tlut2
  12759. The @code{lut2} filter takes two input streams and outputs one
  12760. stream.
  12761. The @code{tlut2} (time lut2) filter takes two consecutive frames
  12762. from one single stream.
  12763. This filter accepts the following parameters:
  12764. @table @option
  12765. @item c0
  12766. set first pixel component expression
  12767. @item c1
  12768. set second pixel component expression
  12769. @item c2
  12770. set third pixel component expression
  12771. @item c3
  12772. set fourth pixel component expression, corresponds to the alpha component
  12773. @item d
  12774. set output bit depth, only available for @code{lut2} filter. By default is 0,
  12775. which means bit depth is automatically picked from first input format.
  12776. @end table
  12777. The @code{lut2} filter also supports the @ref{framesync} options.
  12778. Each of them specifies the expression to use for computing the lookup table for
  12779. the corresponding pixel component values.
  12780. The exact component associated to each of the @var{c*} options depends on the
  12781. format in inputs.
  12782. The expressions can contain the following constants:
  12783. @table @option
  12784. @item w
  12785. @item h
  12786. The input width and height.
  12787. @item x
  12788. The first input value for the pixel component.
  12789. @item y
  12790. The second input value for the pixel component.
  12791. @item bdx
  12792. The first input video bit depth.
  12793. @item bdy
  12794. The second input video bit depth.
  12795. @end table
  12796. All expressions default to "x".
  12797. @subsection Commands
  12798. This filter supports the all above options as @ref{commands} except option @code{d}.
  12799. @subsection Examples
  12800. @itemize
  12801. @item
  12802. Highlight differences between two RGB video streams:
  12803. @example
  12804. 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)'
  12805. @end example
  12806. @item
  12807. Highlight differences between two YUV video streams:
  12808. @example
  12809. 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)'
  12810. @end example
  12811. @item
  12812. Show max difference between two video streams:
  12813. @example
  12814. 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)))'
  12815. @end example
  12816. @end itemize
  12817. @section maskedclamp
  12818. Clamp the first input stream with the second input and third input stream.
  12819. Returns the value of first stream to be between second input
  12820. stream - @code{undershoot} and third input stream + @code{overshoot}.
  12821. This filter accepts the following options:
  12822. @table @option
  12823. @item undershoot
  12824. Default value is @code{0}.
  12825. @item overshoot
  12826. Default value is @code{0}.
  12827. @item planes
  12828. Set which planes will be processed as bitmap, unprocessed planes will be
  12829. copied from first stream.
  12830. By default value 0xf, all planes will be processed.
  12831. @end table
  12832. @subsection Commands
  12833. This filter supports the all above options as @ref{commands}.
  12834. @section maskedmax
  12835. Merge the second and third input stream into output stream using absolute differences
  12836. between second input stream and first input stream and absolute difference between
  12837. third input stream and first input stream. The picked value will be from second input
  12838. stream if second absolute difference is greater than first one or from third input stream
  12839. otherwise.
  12840. This filter accepts the following options:
  12841. @table @option
  12842. @item planes
  12843. Set which planes will be processed as bitmap, unprocessed planes will be
  12844. copied from first stream.
  12845. By default value 0xf, all planes will be processed.
  12846. @end table
  12847. @subsection Commands
  12848. This filter supports the all above options as @ref{commands}.
  12849. @section maskedmerge
  12850. Merge the first input stream with the second input stream using per pixel
  12851. weights in the third input stream.
  12852. A value of 0 in the third stream pixel component means that pixel component
  12853. from first stream is returned unchanged, while maximum value (eg. 255 for
  12854. 8-bit videos) means that pixel component from second stream is returned
  12855. unchanged. Intermediate values define the amount of merging between both
  12856. input stream's pixel components.
  12857. This filter accepts the following options:
  12858. @table @option
  12859. @item planes
  12860. Set which planes will be processed as bitmap, unprocessed planes will be
  12861. copied from first stream.
  12862. By default value 0xf, all planes will be processed.
  12863. @end table
  12864. @subsection Commands
  12865. This filter supports the all above options as @ref{commands}.
  12866. @section maskedmin
  12867. Merge the second and third input stream into output stream using absolute differences
  12868. between second input stream and first input stream and absolute difference between
  12869. third input stream and first input stream. The picked value will be from second input
  12870. stream if second absolute difference is less than first one or from third input stream
  12871. otherwise.
  12872. This filter accepts the following options:
  12873. @table @option
  12874. @item planes
  12875. Set which planes will be processed as bitmap, unprocessed planes will be
  12876. copied from first stream.
  12877. By default value 0xf, all planes will be processed.
  12878. @end table
  12879. @subsection Commands
  12880. This filter supports the all above options as @ref{commands}.
  12881. @section maskedthreshold
  12882. Pick pixels comparing absolute difference of two video streams with fixed
  12883. threshold.
  12884. If absolute difference between pixel component of first and second video
  12885. stream is equal or lower than user supplied threshold than pixel component
  12886. from first video stream is picked, otherwise pixel component from second
  12887. video stream is picked.
  12888. This filter accepts the following options:
  12889. @table @option
  12890. @item threshold
  12891. Set threshold used when picking pixels from absolute difference from two input
  12892. video streams.
  12893. @item planes
  12894. Set which planes will be processed as bitmap, unprocessed planes will be
  12895. copied from second stream.
  12896. By default value 0xf, all planes will be processed.
  12897. @item mode
  12898. Set mode of filter operation. Can be @code{abs} or @code{diff}.
  12899. Default is @code{abs}.
  12900. @end table
  12901. @subsection Commands
  12902. This filter supports the all above options as @ref{commands}.
  12903. @section maskfun
  12904. Create mask from input video.
  12905. For example it is useful to create motion masks after @code{tblend} filter.
  12906. This filter accepts the following options:
  12907. @table @option
  12908. @item low
  12909. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  12910. @item high
  12911. Set high threshold. Any pixel component higher than this value will be set to max value
  12912. allowed for current pixel format.
  12913. @item planes
  12914. Set planes to filter, by default all available planes are filtered.
  12915. @item fill
  12916. Fill all frame pixels with this value.
  12917. @item sum
  12918. Set max average pixel value for frame. If sum of all pixel components is higher that this
  12919. average, output frame will be completely filled with value set by @var{fill} option.
  12920. Typically useful for scene changes when used in combination with @code{tblend} filter.
  12921. @end table
  12922. @subsection Commands
  12923. This filter supports the all above options as @ref{commands}.
  12924. @section mcdeint
  12925. Apply motion-compensation deinterlacing.
  12926. It needs one field per frame as input and must thus be used together
  12927. with yadif=1/3 or equivalent.
  12928. This filter is only available in ffmpeg version 4.4 or earlier.
  12929. This filter accepts the following options:
  12930. @table @option
  12931. @item mode
  12932. Set the deinterlacing mode.
  12933. It accepts one of the following values:
  12934. @table @samp
  12935. @item fast
  12936. @item medium
  12937. @item slow
  12938. use iterative motion estimation
  12939. @item extra_slow
  12940. like @samp{slow}, but use multiple reference frames.
  12941. @end table
  12942. Default value is @samp{fast}.
  12943. @item parity
  12944. Set the picture field parity assumed for the input video. It must be
  12945. one of the following values:
  12946. @table @samp
  12947. @item 0, tff
  12948. assume top field first
  12949. @item 1, bff
  12950. assume bottom field first
  12951. @end table
  12952. Default value is @samp{bff}.
  12953. @item qp
  12954. Set per-block quantization parameter (QP) used by the internal
  12955. encoder.
  12956. Higher values should result in a smoother motion vector field but less
  12957. optimal individual vectors. Default value is 1.
  12958. @end table
  12959. @section median
  12960. Pick median pixel from certain rectangle defined by radius.
  12961. This filter accepts the following options:
  12962. @table @option
  12963. @item radius
  12964. Set horizontal radius size. Default value is @code{1}.
  12965. Allowed range is integer from 1 to 127.
  12966. @item planes
  12967. Set which planes to process. Default is @code{15}, which is all available planes.
  12968. @item radiusV
  12969. Set vertical radius size. Default value is @code{0}.
  12970. Allowed range is integer from 0 to 127.
  12971. If it is 0, value will be picked from horizontal @code{radius} option.
  12972. @item percentile
  12973. Set median percentile. Default value is @code{0.5}.
  12974. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  12975. minimum values, and @code{1} maximum values.
  12976. @end table
  12977. @subsection Commands
  12978. This filter supports same @ref{commands} as options.
  12979. The command accepts the same syntax of the corresponding option.
  12980. If the specified expression is not valid, it is kept at its current
  12981. value.
  12982. @section mergeplanes
  12983. Merge color channel components from several video streams.
  12984. The filter accepts up to 4 input streams, and merge selected input
  12985. planes to the output video.
  12986. This filter accepts the following options:
  12987. @table @option
  12988. @item mapping
  12989. Set input to output plane mapping. Default is @code{0}.
  12990. The mappings is specified as a bitmap. It should be specified as a
  12991. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  12992. mapping for the first plane of the output stream. 'A' sets the number of
  12993. the input stream to use (from 0 to 3), and 'a' the plane number of the
  12994. corresponding input to use (from 0 to 3). The rest of the mappings is
  12995. similar, 'Bb' describes the mapping for the output stream second
  12996. plane, 'Cc' describes the mapping for the output stream third plane and
  12997. 'Dd' describes the mapping for the output stream fourth plane.
  12998. @item format
  12999. Set output pixel format. Default is @code{yuva444p}.
  13000. @item map0s
  13001. @item map1s
  13002. @item map2s
  13003. @item map3s
  13004. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  13005. @item map0p
  13006. @item map1p
  13007. @item map2p
  13008. @item map3p
  13009. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  13010. @end table
  13011. @subsection Examples
  13012. @itemize
  13013. @item
  13014. Merge three gray video streams of same width and height into single video stream:
  13015. @example
  13016. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  13017. @end example
  13018. @item
  13019. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  13020. @example
  13021. [a0][a1]mergeplanes=0x00010210:yuva444p
  13022. @end example
  13023. @item
  13024. Swap Y and A plane in yuva444p stream:
  13025. @example
  13026. format=yuva444p,mergeplanes=0x03010200:yuva444p
  13027. @end example
  13028. @item
  13029. Swap U and V plane in yuv420p stream:
  13030. @example
  13031. format=yuv420p,mergeplanes=0x000201:yuv420p
  13032. @end example
  13033. @item
  13034. Cast a rgb24 clip to yuv444p:
  13035. @example
  13036. format=rgb24,mergeplanes=0x000102:yuv444p
  13037. @end example
  13038. @end itemize
  13039. @section mestimate
  13040. Estimate and export motion vectors using block matching algorithms.
  13041. Motion vectors are stored in frame side data to be used by other filters.
  13042. This filter accepts the following options:
  13043. @table @option
  13044. @item method
  13045. Specify the motion estimation method. Accepts one of the following values:
  13046. @table @samp
  13047. @item esa
  13048. Exhaustive search algorithm.
  13049. @item tss
  13050. Three step search algorithm.
  13051. @item tdls
  13052. Two dimensional logarithmic search algorithm.
  13053. @item ntss
  13054. New three step search algorithm.
  13055. @item fss
  13056. Four step search algorithm.
  13057. @item ds
  13058. Diamond search algorithm.
  13059. @item hexbs
  13060. Hexagon-based search algorithm.
  13061. @item epzs
  13062. Enhanced predictive zonal search algorithm.
  13063. @item umh
  13064. Uneven multi-hexagon search algorithm.
  13065. @end table
  13066. Default value is @samp{esa}.
  13067. @item mb_size
  13068. Macroblock size. Default @code{16}.
  13069. @item search_param
  13070. Search parameter. Default @code{7}.
  13071. @end table
  13072. @section midequalizer
  13073. Apply Midway Image Equalization effect using two video streams.
  13074. Midway Image Equalization adjusts a pair of images to have the same
  13075. histogram, while maintaining their dynamics as much as possible. It's
  13076. useful for e.g. matching exposures from a pair of stereo cameras.
  13077. This filter has two inputs and one output, which must be of same pixel format, but
  13078. may be of different sizes. The output of filter is first input adjusted with
  13079. midway histogram of both inputs.
  13080. This filter accepts the following option:
  13081. @table @option
  13082. @item planes
  13083. Set which planes to process. Default is @code{15}, which is all available planes.
  13084. @end table
  13085. @section minterpolate
  13086. Convert the video to specified frame rate using motion interpolation.
  13087. This filter accepts the following options:
  13088. @table @option
  13089. @item fps
  13090. 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}.
  13091. @item mi_mode
  13092. Motion interpolation mode. Following values are accepted:
  13093. @table @samp
  13094. @item dup
  13095. Duplicate previous or next frame for interpolating new ones.
  13096. @item blend
  13097. Blend source frames. Interpolated frame is mean of previous and next frames.
  13098. @item mci
  13099. Motion compensated interpolation. Following options are effective when this mode is selected:
  13100. @table @samp
  13101. @item mc_mode
  13102. Motion compensation mode. Following values are accepted:
  13103. @table @samp
  13104. @item obmc
  13105. Overlapped block motion compensation.
  13106. @item aobmc
  13107. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  13108. @end table
  13109. Default mode is @samp{obmc}.
  13110. @item me_mode
  13111. Motion estimation mode. Following values are accepted:
  13112. @table @samp
  13113. @item bidir
  13114. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  13115. @item bilat
  13116. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  13117. @end table
  13118. Default mode is @samp{bilat}.
  13119. @item me
  13120. The algorithm to be used for motion estimation. Following values are accepted:
  13121. @table @samp
  13122. @item esa
  13123. Exhaustive search algorithm.
  13124. @item tss
  13125. Three step search algorithm.
  13126. @item tdls
  13127. Two dimensional logarithmic search algorithm.
  13128. @item ntss
  13129. New three step search algorithm.
  13130. @item fss
  13131. Four step search algorithm.
  13132. @item ds
  13133. Diamond search algorithm.
  13134. @item hexbs
  13135. Hexagon-based search algorithm.
  13136. @item epzs
  13137. Enhanced predictive zonal search algorithm.
  13138. @item umh
  13139. Uneven multi-hexagon search algorithm.
  13140. @end table
  13141. Default algorithm is @samp{epzs}.
  13142. @item mb_size
  13143. Macroblock size. Default @code{16}.
  13144. @item search_param
  13145. Motion estimation search parameter. Default @code{32}.
  13146. @item vsbmc
  13147. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
  13148. @end table
  13149. @end table
  13150. @item scd
  13151. 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:
  13152. @table @samp
  13153. @item none
  13154. Disable scene change detection.
  13155. @item fdiff
  13156. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  13157. @end table
  13158. Default method is @samp{fdiff}.
  13159. @item scd_threshold
  13160. Scene change detection threshold. Default is @code{10.}.
  13161. @end table
  13162. @section mix
  13163. Mix several video input streams into one video stream.
  13164. A description of the accepted options follows.
  13165. @table @option
  13166. @item inputs
  13167. The number of inputs. If unspecified, it defaults to 2.
  13168. @item weights
  13169. Specify weight of each input video stream as sequence.
  13170. Each weight is separated by space. If number of weights
  13171. is smaller than number of @var{frames} last specified
  13172. weight will be used for all remaining unset weights.
  13173. @item scale
  13174. Specify scale, if it is set it will be multiplied with sum
  13175. of each weight multiplied with pixel values to give final destination
  13176. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13177. @item planes
  13178. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  13179. @item duration
  13180. Specify how end of stream is determined.
  13181. @table @samp
  13182. @item longest
  13183. The duration of the longest input. (default)
  13184. @item shortest
  13185. The duration of the shortest input.
  13186. @item first
  13187. The duration of the first input.
  13188. @end table
  13189. @end table
  13190. @subsection Commands
  13191. This filter supports the following commands:
  13192. @table @option
  13193. @item weights
  13194. @item scale
  13195. @item planes
  13196. Syntax is same as option with same name.
  13197. @end table
  13198. @section monochrome
  13199. Convert video to gray using custom color filter.
  13200. A description of the accepted options follows.
  13201. @table @option
  13202. @item cb
  13203. Set the chroma blue spot. Allowed range is from -1 to 1.
  13204. Default value is 0.
  13205. @item cr
  13206. Set the chroma red spot. Allowed range is from -1 to 1.
  13207. Default value is 0.
  13208. @item size
  13209. Set the color filter size. Allowed range is from .1 to 10.
  13210. Default value is 1.
  13211. @item high
  13212. Set the highlights strength. Allowed range is from 0 to 1.
  13213. Default value is 0.
  13214. @end table
  13215. @subsection Commands
  13216. This filter supports the all above options as @ref{commands}.
  13217. @section morpho
  13218. This filter allows to apply main morphological grayscale transforms,
  13219. erode and dilate with arbitrary structures set in second input stream.
  13220. Unlike naive implementation and much slower performance in @ref{erosion}
  13221. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  13222. should be used instead.
  13223. A description of accepted options follows,
  13224. @table @option
  13225. @item mode
  13226. Set morphological transform to apply, can be:
  13227. @table @samp
  13228. @item erode
  13229. @item dilate
  13230. @item open
  13231. @item close
  13232. @item gradient
  13233. @item tophat
  13234. @item blackhat
  13235. @end table
  13236. Default is @code{erode}.
  13237. @item planes
  13238. Set planes to filter, by default all planes except alpha are filtered.
  13239. @item structure
  13240. Set which structure video frames will be processed from second input stream,
  13241. can be @var{first} or @var{all}. Default is @var{all}.
  13242. @end table
  13243. The @code{morpho} filter also supports the @ref{framesync} options.
  13244. @subsection Commands
  13245. This filter supports same @ref{commands} as options.
  13246. @section mpdecimate
  13247. Drop frames that do not differ greatly from the previous frame in
  13248. order to reduce frame rate.
  13249. The main use of this filter is for very-low-bitrate encoding
  13250. (e.g. streaming over dialup modem), but it could in theory be used for
  13251. fixing movies that were inverse-telecined incorrectly.
  13252. A description of the accepted options follows.
  13253. @table @option
  13254. @item max
  13255. Set the maximum number of consecutive frames which can be dropped (if
  13256. positive), or the minimum interval between dropped frames (if
  13257. negative). If the value is 0, the frame is dropped disregarding the
  13258. number of previous sequentially dropped frames.
  13259. Default value is 0.
  13260. @item hi
  13261. @item lo
  13262. @item frac
  13263. Set the dropping threshold values.
  13264. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  13265. represent actual pixel value differences, so a threshold of 64
  13266. corresponds to 1 unit of difference for each pixel, or the same spread
  13267. out differently over the block.
  13268. A frame is a candidate for dropping if no 8x8 blocks differ by more
  13269. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  13270. meaning the whole image) differ by more than a threshold of @option{lo}.
  13271. Default value for @option{hi} is 64*12, default value for @option{lo} is
  13272. 64*5, and default value for @option{frac} is 0.33.
  13273. @end table
  13274. @section msad
  13275. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  13276. This filter takes two input videos.
  13277. Both input videos must have the same resolution and pixel format for
  13278. this filter to work correctly. Also it assumes that both inputs
  13279. have the same number of frames, which are compared one by one.
  13280. The obtained per component, average, min and max MSAD is printed through
  13281. the logging system.
  13282. The filter stores the calculated MSAD of each frame in frame metadata.
  13283. This filter also supports the @ref{framesync} options.
  13284. In the below example the input file @file{main.mpg} being processed is compared
  13285. with the reference file @file{ref.mpg}.
  13286. @example
  13287. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  13288. @end example
  13289. @section multiply
  13290. Multiply first video stream pixels values with second video stream pixels values.
  13291. The filter accepts the following options:
  13292. @table @option
  13293. @item scale
  13294. Set the scale applied to second video stream. By default is @code{1}.
  13295. Allowed range is from @code{0} to @code{9}.
  13296. @item offset
  13297. Set the offset applied to second video stream. By default is @code{0.5}.
  13298. Allowed range is from @code{-1} to @code{1}.
  13299. @item planes
  13300. Specify planes from input video stream that will be processed.
  13301. By default all planes are processed.
  13302. @end table
  13303. @subsection Commands
  13304. This filter supports same @ref{commands} as options.
  13305. @section negate
  13306. Negate (invert) the input video.
  13307. It accepts the following option:
  13308. @table @option
  13309. @item components
  13310. Set components to negate.
  13311. Available values for components are:
  13312. @table @samp
  13313. @item y
  13314. @item u
  13315. @item v
  13316. @item a
  13317. @item r
  13318. @item g
  13319. @item b
  13320. @end table
  13321. @item negate_alpha
  13322. With value 1, it negates the alpha component, if present. Default value is 0.
  13323. @end table
  13324. @subsection Commands
  13325. This filter supports same @ref{commands} as options.
  13326. @anchor{nlmeans}
  13327. @section nlmeans
  13328. Denoise frames using Non-Local Means algorithm.
  13329. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13330. context similarity is defined by comparing their surrounding patches of size
  13331. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13332. around the pixel.
  13333. Note that the research area defines centers for patches, which means some
  13334. patches will be made of pixels outside that research area.
  13335. The filter accepts the following options.
  13336. @table @option
  13337. @item s
  13338. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13339. @item p
  13340. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13341. @item pc
  13342. Same as @option{p} but for chroma planes.
  13343. The default value is @var{0} and means automatic.
  13344. @item r
  13345. Set research size. Default is 15. Must be odd number in range [0, 99].
  13346. @item rc
  13347. Same as @option{r} but for chroma planes.
  13348. The default value is @var{0} and means automatic.
  13349. @end table
  13350. @section nnedi
  13351. Deinterlace video using neural network edge directed interpolation.
  13352. This filter accepts the following options:
  13353. @table @option
  13354. @item weights
  13355. Mandatory option, without binary file filter can not work.
  13356. Currently file can be found here:
  13357. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13358. @item deint
  13359. Set which frames to deinterlace, by default it is @code{all}.
  13360. Can be @code{all} or @code{interlaced}.
  13361. @item field
  13362. Set mode of operation.
  13363. Can be one of the following:
  13364. @table @samp
  13365. @item af
  13366. Use frame flags, both fields.
  13367. @item a
  13368. Use frame flags, single field.
  13369. @item t
  13370. Use top field only.
  13371. @item b
  13372. Use bottom field only.
  13373. @item tf
  13374. Use both fields, top first.
  13375. @item bf
  13376. Use both fields, bottom first.
  13377. @end table
  13378. @item planes
  13379. Set which planes to process, by default filter process all frames.
  13380. @item nsize
  13381. Set size of local neighborhood around each pixel, used by the predictor neural
  13382. network.
  13383. Can be one of the following:
  13384. @table @samp
  13385. @item s8x6
  13386. @item s16x6
  13387. @item s32x6
  13388. @item s48x6
  13389. @item s8x4
  13390. @item s16x4
  13391. @item s32x4
  13392. @end table
  13393. @item nns
  13394. Set the number of neurons in predictor neural network.
  13395. Can be one of the following:
  13396. @table @samp
  13397. @item n16
  13398. @item n32
  13399. @item n64
  13400. @item n128
  13401. @item n256
  13402. @end table
  13403. @item qual
  13404. Controls the number of different neural network predictions that are blended
  13405. together to compute the final output value. Can be @code{fast}, default or
  13406. @code{slow}.
  13407. @item etype
  13408. Set which set of weights to use in the predictor.
  13409. Can be one of the following:
  13410. @table @samp
  13411. @item a, abs
  13412. weights trained to minimize absolute error
  13413. @item s, mse
  13414. weights trained to minimize squared error
  13415. @end table
  13416. @item pscrn
  13417. Controls whether or not the prescreener neural network is used to decide
  13418. which pixels should be processed by the predictor neural network and which
  13419. can be handled by simple cubic interpolation.
  13420. The prescreener is trained to know whether cubic interpolation will be
  13421. sufficient for a pixel or whether it should be predicted by the predictor nn.
  13422. The computational complexity of the prescreener nn is much less than that of
  13423. the predictor nn. Since most pixels can be handled by cubic interpolation,
  13424. using the prescreener generally results in much faster processing.
  13425. The prescreener is pretty accurate, so the difference between using it and not
  13426. using it is almost always unnoticeable.
  13427. Can be one of the following:
  13428. @table @samp
  13429. @item none
  13430. @item original
  13431. @item new
  13432. @item new2
  13433. @item new3
  13434. @end table
  13435. Default is @code{new}.
  13436. @end table
  13437. @subsection Commands
  13438. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  13439. @section noformat
  13440. Force libavfilter not to use any of the specified pixel formats for the
  13441. input to the next filter.
  13442. It accepts the following parameters:
  13443. @table @option
  13444. @item pix_fmts
  13445. A '|'-separated list of pixel format names, such as
  13446. pix_fmts=yuv420p|monow|rgb24".
  13447. @end table
  13448. @subsection Examples
  13449. @itemize
  13450. @item
  13451. Force libavfilter to use a format different from @var{yuv420p} for the
  13452. input to the vflip filter:
  13453. @example
  13454. noformat=pix_fmts=yuv420p,vflip
  13455. @end example
  13456. @item
  13457. Convert the input video to any of the formats not contained in the list:
  13458. @example
  13459. noformat=yuv420p|yuv444p|yuv410p
  13460. @end example
  13461. @end itemize
  13462. @section noise
  13463. Add noise on video input frame.
  13464. The filter accepts the following options:
  13465. @table @option
  13466. @item all_seed
  13467. @item c0_seed
  13468. @item c1_seed
  13469. @item c2_seed
  13470. @item c3_seed
  13471. Set noise seed for specific pixel component or all pixel components in case
  13472. of @var{all_seed}. Default value is @code{123457}.
  13473. @item all_strength, alls
  13474. @item c0_strength, c0s
  13475. @item c1_strength, c1s
  13476. @item c2_strength, c2s
  13477. @item c3_strength, c3s
  13478. Set noise strength for specific pixel component or all pixel components in case
  13479. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  13480. @item all_flags, allf
  13481. @item c0_flags, c0f
  13482. @item c1_flags, c1f
  13483. @item c2_flags, c2f
  13484. @item c3_flags, c3f
  13485. Set pixel component flags or set flags for all components if @var{all_flags}.
  13486. Available values for component flags are:
  13487. @table @samp
  13488. @item a
  13489. averaged temporal noise (smoother)
  13490. @item p
  13491. mix random noise with a (semi)regular pattern
  13492. @item t
  13493. temporal noise (noise pattern changes between frames)
  13494. @item u
  13495. uniform noise (gaussian otherwise)
  13496. @end table
  13497. @end table
  13498. @subsection Examples
  13499. Add temporal and uniform noise to input video:
  13500. @example
  13501. noise=alls=20:allf=t+u
  13502. @end example
  13503. @section normalize
  13504. Normalize RGB video (aka histogram stretching, contrast stretching).
  13505. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  13506. For each channel of each frame, the filter computes the input range and maps
  13507. it linearly to the user-specified output range. The output range defaults
  13508. to the full dynamic range from pure black to pure white.
  13509. Temporal smoothing can be used on the input range to reduce flickering (rapid
  13510. changes in brightness) caused when small dark or bright objects enter or leave
  13511. the scene. This is similar to the auto-exposure (automatic gain control) on a
  13512. video camera, and, like a video camera, it may cause a period of over- or
  13513. under-exposure of the video.
  13514. The R,G,B channels can be normalized independently, which may cause some
  13515. color shifting, or linked together as a single channel, which prevents
  13516. color shifting. Linked normalization preserves hue. Independent normalization
  13517. does not, so it can be used to remove some color casts. Independent and linked
  13518. normalization can be combined in any ratio.
  13519. The normalize filter accepts the following options:
  13520. @table @option
  13521. @item blackpt
  13522. @item whitept
  13523. Colors which define the output range. The minimum input value is mapped to
  13524. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  13525. The defaults are black and white respectively. Specifying white for
  13526. @var{blackpt} and black for @var{whitept} will give color-inverted,
  13527. normalized video. Shades of grey can be used to reduce the dynamic range
  13528. (contrast). Specifying saturated colors here can create some interesting
  13529. effects.
  13530. @item smoothing
  13531. The number of previous frames to use for temporal smoothing. The input range
  13532. of each channel is smoothed using a rolling average over the current frame
  13533. and the @var{smoothing} previous frames. The default is 0 (no temporal
  13534. smoothing).
  13535. @item independence
  13536. Controls the ratio of independent (color shifting) channel normalization to
  13537. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  13538. independent. Defaults to 1.0 (fully independent).
  13539. @item strength
  13540. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  13541. expensive no-op. Defaults to 1.0 (full strength).
  13542. @end table
  13543. @subsection Commands
  13544. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  13545. The command accepts the same syntax of the corresponding option.
  13546. If the specified expression is not valid, it is kept at its current
  13547. value.
  13548. @subsection Examples
  13549. Stretch video contrast to use the full dynamic range, with no temporal
  13550. smoothing; may flicker depending on the source content:
  13551. @example
  13552. normalize=blackpt=black:whitept=white:smoothing=0
  13553. @end example
  13554. As above, but with 50 frames of temporal smoothing; flicker should be
  13555. reduced, depending on the source content:
  13556. @example
  13557. normalize=blackpt=black:whitept=white:smoothing=50
  13558. @end example
  13559. As above, but with hue-preserving linked channel normalization:
  13560. @example
  13561. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  13562. @end example
  13563. As above, but with half strength:
  13564. @example
  13565. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  13566. @end example
  13567. Map the darkest input color to red, the brightest input color to cyan:
  13568. @example
  13569. normalize=blackpt=red:whitept=cyan
  13570. @end example
  13571. @section null
  13572. Pass the video source unchanged to the output.
  13573. @section ocr
  13574. Optical Character Recognition
  13575. This filter uses Tesseract for optical character recognition. To enable
  13576. compilation of this filter, you need to configure FFmpeg with
  13577. @code{--enable-libtesseract}.
  13578. It accepts the following options:
  13579. @table @option
  13580. @item datapath
  13581. Set datapath to tesseract data. Default is to use whatever was
  13582. set at installation.
  13583. @item language
  13584. Set language, default is "eng".
  13585. @item whitelist
  13586. Set character whitelist.
  13587. @item blacklist
  13588. Set character blacklist.
  13589. @end table
  13590. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  13591. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  13592. @section ocv
  13593. Apply a video transform using libopencv.
  13594. To enable this filter, install the libopencv library and headers and
  13595. configure FFmpeg with @code{--enable-libopencv}.
  13596. It accepts the following parameters:
  13597. @table @option
  13598. @item filter_name
  13599. The name of the libopencv filter to apply.
  13600. @item filter_params
  13601. The parameters to pass to the libopencv filter. If not specified, the default
  13602. values are assumed.
  13603. @end table
  13604. Refer to the official libopencv documentation for more precise
  13605. information:
  13606. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  13607. Several libopencv filters are supported; see the following subsections.
  13608. @anchor{dilate}
  13609. @subsection dilate
  13610. Dilate an image by using a specific structuring element.
  13611. It corresponds to the libopencv function @code{cvDilate}.
  13612. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  13613. @var{struct_el} represents a structuring element, and has the syntax:
  13614. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  13615. @var{cols} and @var{rows} represent the number of columns and rows of
  13616. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  13617. point, and @var{shape} the shape for the structuring element. @var{shape}
  13618. must be "rect", "cross", "ellipse", or "custom".
  13619. If the value for @var{shape} is "custom", it must be followed by a
  13620. string of the form "=@var{filename}". The file with name
  13621. @var{filename} is assumed to represent a binary image, with each
  13622. printable character corresponding to a bright pixel. When a custom
  13623. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  13624. or columns and rows of the read file are assumed instead.
  13625. The default value for @var{struct_el} is "3x3+0x0/rect".
  13626. @var{nb_iterations} specifies the number of times the transform is
  13627. applied to the image, and defaults to 1.
  13628. Some examples:
  13629. @example
  13630. # Use the default values
  13631. ocv=dilate
  13632. # Dilate using a structuring element with a 5x5 cross, iterating two times
  13633. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  13634. # Read the shape from the file diamond.shape, iterating two times.
  13635. # The file diamond.shape may contain a pattern of characters like this
  13636. # *
  13637. # ***
  13638. # *****
  13639. # ***
  13640. # *
  13641. # The specified columns and rows are ignored
  13642. # but the anchor point coordinates are not
  13643. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  13644. @end example
  13645. @subsection erode
  13646. Erode an image by using a specific structuring element.
  13647. It corresponds to the libopencv function @code{cvErode}.
  13648. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  13649. with the same syntax and semantics as the @ref{dilate} filter.
  13650. @subsection smooth
  13651. Smooth the input video.
  13652. The filter takes the following parameters:
  13653. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  13654. @var{type} is the type of smooth filter to apply, and must be one of
  13655. the following values: "blur", "blur_no_scale", "median", "gaussian",
  13656. or "bilateral". The default value is "gaussian".
  13657. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  13658. depends on the smooth type. @var{param1} and
  13659. @var{param2} accept integer positive values or 0. @var{param3} and
  13660. @var{param4} accept floating point values.
  13661. The default value for @var{param1} is 3. The default value for the
  13662. other parameters is 0.
  13663. These parameters correspond to the parameters assigned to the
  13664. libopencv function @code{cvSmooth}.
  13665. @section oscilloscope
  13666. 2D Video Oscilloscope.
  13667. Useful to measure spatial impulse, step responses, chroma delays, etc.
  13668. It accepts the following parameters:
  13669. @table @option
  13670. @item x
  13671. Set scope center x position.
  13672. @item y
  13673. Set scope center y position.
  13674. @item s
  13675. Set scope size, relative to frame diagonal.
  13676. @item t
  13677. Set scope tilt/rotation.
  13678. @item o
  13679. Set trace opacity.
  13680. @item tx
  13681. Set trace center x position.
  13682. @item ty
  13683. Set trace center y position.
  13684. @item tw
  13685. Set trace width, relative to width of frame.
  13686. @item th
  13687. Set trace height, relative to height of frame.
  13688. @item c
  13689. Set which components to trace. By default it traces first three components.
  13690. @item g
  13691. Draw trace grid. By default is enabled.
  13692. @item st
  13693. Draw some statistics. By default is enabled.
  13694. @item sc
  13695. Draw scope. By default is enabled.
  13696. @end table
  13697. @subsection Commands
  13698. This filter supports same @ref{commands} as options.
  13699. The command accepts the same syntax of the corresponding option.
  13700. If the specified expression is not valid, it is kept at its current
  13701. value.
  13702. @subsection Examples
  13703. @itemize
  13704. @item
  13705. Inspect full first row of video frame.
  13706. @example
  13707. oscilloscope=x=0.5:y=0:s=1
  13708. @end example
  13709. @item
  13710. Inspect full last row of video frame.
  13711. @example
  13712. oscilloscope=x=0.5:y=1:s=1
  13713. @end example
  13714. @item
  13715. Inspect full 5th line of video frame of height 1080.
  13716. @example
  13717. oscilloscope=x=0.5:y=5/1080:s=1
  13718. @end example
  13719. @item
  13720. Inspect full last column of video frame.
  13721. @example
  13722. oscilloscope=x=1:y=0.5:s=1:t=1
  13723. @end example
  13724. @end itemize
  13725. @anchor{overlay}
  13726. @section overlay
  13727. Overlay one video on top of another.
  13728. It takes two inputs and has one output. The first input is the "main"
  13729. video on which the second input is overlaid.
  13730. It accepts the following parameters:
  13731. A description of the accepted options follows.
  13732. @table @option
  13733. @item x
  13734. @item y
  13735. Set the expression for the x and y coordinates of the overlaid video
  13736. on the main video. Default value is "0" for both expressions. In case
  13737. the expression is invalid, it is set to a huge value (meaning that the
  13738. overlay will not be displayed within the output visible area).
  13739. @item eof_action
  13740. See @ref{framesync}.
  13741. @item eval
  13742. Set when the expressions for @option{x}, and @option{y} are evaluated.
  13743. It accepts the following values:
  13744. @table @samp
  13745. @item init
  13746. only evaluate expressions once during the filter initialization or
  13747. when a command is processed
  13748. @item frame
  13749. evaluate expressions for each incoming frame
  13750. @end table
  13751. Default value is @samp{frame}.
  13752. @item shortest
  13753. See @ref{framesync}.
  13754. @item format
  13755. Set the format for the output video.
  13756. It accepts the following values:
  13757. @table @samp
  13758. @item yuv420
  13759. force YUV420 output
  13760. @item yuv420p10
  13761. force YUV420p10 output
  13762. @item yuv422
  13763. force YUV422 output
  13764. @item yuv422p10
  13765. force YUV422p10 output
  13766. @item yuv444
  13767. force YUV444 output
  13768. @item rgb
  13769. force packed RGB output
  13770. @item gbrp
  13771. force planar RGB output
  13772. @item auto
  13773. automatically pick format
  13774. @end table
  13775. Default value is @samp{yuv420}.
  13776. @item repeatlast
  13777. See @ref{framesync}.
  13778. @item alpha
  13779. Set format of alpha of the overlaid video, it can be @var{straight} or
  13780. @var{premultiplied}. Default is @var{straight}.
  13781. @end table
  13782. The @option{x}, and @option{y} expressions can contain the following
  13783. parameters.
  13784. @table @option
  13785. @item main_w, W
  13786. @item main_h, H
  13787. The main input width and height.
  13788. @item overlay_w, w
  13789. @item overlay_h, h
  13790. The overlay input width and height.
  13791. @item x
  13792. @item y
  13793. The computed values for @var{x} and @var{y}. They are evaluated for
  13794. each new frame.
  13795. @item hsub
  13796. @item vsub
  13797. horizontal and vertical chroma subsample values of the output
  13798. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  13799. @var{vsub} is 1.
  13800. @item n
  13801. the number of input frame, starting from 0
  13802. @item pos
  13803. the position in the file of the input frame, NAN if unknown
  13804. @item t
  13805. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  13806. @end table
  13807. This filter also supports the @ref{framesync} options.
  13808. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  13809. when evaluation is done @emph{per frame}, and will evaluate to NAN
  13810. when @option{eval} is set to @samp{init}.
  13811. Be aware that frames are taken from each input video in timestamp
  13812. order, hence, if their initial timestamps differ, it is a good idea
  13813. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  13814. have them begin in the same zero timestamp, as the example for
  13815. the @var{movie} filter does.
  13816. You can chain together more overlays but you should test the
  13817. efficiency of such approach.
  13818. @subsection Commands
  13819. This filter supports the following commands:
  13820. @table @option
  13821. @item x
  13822. @item y
  13823. Modify the x and y of the overlay input.
  13824. The command accepts the same syntax of the corresponding option.
  13825. If the specified expression is not valid, it is kept at its current
  13826. value.
  13827. @end table
  13828. @subsection Examples
  13829. @itemize
  13830. @item
  13831. Draw the overlay at 10 pixels from the bottom right corner of the main
  13832. video:
  13833. @example
  13834. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  13835. @end example
  13836. Using named options the example above becomes:
  13837. @example
  13838. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  13839. @end example
  13840. @item
  13841. Insert a transparent PNG logo in the bottom left corner of the input,
  13842. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  13843. @example
  13844. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  13845. @end example
  13846. @item
  13847. Insert 2 different transparent PNG logos (second logo on bottom
  13848. right corner) using the @command{ffmpeg} tool:
  13849. @example
  13850. 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
  13851. @end example
  13852. @item
  13853. Add a transparent color layer on top of the main video; @code{WxH}
  13854. must specify the size of the main input to the overlay filter:
  13855. @example
  13856. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  13857. @end example
  13858. @item
  13859. Play an original video and a filtered version (here with the deshake
  13860. filter) side by side using the @command{ffplay} tool:
  13861. @example
  13862. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  13863. @end example
  13864. The above command is the same as:
  13865. @example
  13866. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  13867. @end example
  13868. @item
  13869. Make a sliding overlay appearing from the left to the right top part of the
  13870. screen starting since time 2:
  13871. @example
  13872. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  13873. @end example
  13874. @item
  13875. Compose output by putting two input videos side to side:
  13876. @example
  13877. ffmpeg -i left.avi -i right.avi -filter_complex "
  13878. nullsrc=size=200x100 [background];
  13879. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  13880. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  13881. [background][left] overlay=shortest=1 [background+left];
  13882. [background+left][right] overlay=shortest=1:x=100 [left+right]
  13883. "
  13884. @end example
  13885. @item
  13886. Mask 10-20 seconds of a video by applying the delogo filter to a section
  13887. @example
  13888. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  13889. -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]'
  13890. masked.avi
  13891. @end example
  13892. @item
  13893. Chain several overlays in cascade:
  13894. @example
  13895. nullsrc=s=200x200 [bg];
  13896. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  13897. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  13898. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  13899. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  13900. [in3] null, [mid2] overlay=100:100 [out0]
  13901. @end example
  13902. @end itemize
  13903. @anchor{overlay_cuda}
  13904. @section overlay_cuda
  13905. Overlay one video on top of another.
  13906. This is the CUDA variant of the @ref{overlay} filter.
  13907. It only accepts CUDA frames. The underlying input pixel formats have to match.
  13908. It takes two inputs and has one output. The first input is the "main"
  13909. video on which the second input is overlaid.
  13910. It accepts the following parameters:
  13911. @table @option
  13912. @item x
  13913. @item y
  13914. Set expressions for the x and y coordinates of the overlaid video
  13915. on the main video.
  13916. They can contain the following parameters:
  13917. @table @option
  13918. @item main_w, W
  13919. @item main_h, H
  13920. The main input width and height.
  13921. @item overlay_w, w
  13922. @item overlay_h, h
  13923. The overlay input width and height.
  13924. @item x
  13925. @item y
  13926. The computed values for @var{x} and @var{y}. They are evaluated for
  13927. each new frame.
  13928. @item n
  13929. The ordinal index of the main input frame, starting from 0.
  13930. @item pos
  13931. The byte offset position in the file of the main input frame, NAN if unknown.
  13932. @item t
  13933. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  13934. @end table
  13935. Default value is "0" for both expressions.
  13936. @item eval
  13937. Set when the expressions for @option{x} and @option{y} are evaluated.
  13938. It accepts the following values:
  13939. @table @option
  13940. @item init
  13941. Evaluate expressions once during filter initialization or
  13942. when a command is processed.
  13943. @item frame
  13944. Evaluate expressions for each incoming frame
  13945. @end table
  13946. Default value is @option{frame}.
  13947. @item eof_action
  13948. See @ref{framesync}.
  13949. @item shortest
  13950. See @ref{framesync}.
  13951. @item repeatlast
  13952. See @ref{framesync}.
  13953. @end table
  13954. This filter also supports the @ref{framesync} options.
  13955. @section owdenoise
  13956. Apply Overcomplete Wavelet denoiser.
  13957. The filter accepts the following options:
  13958. @table @option
  13959. @item depth
  13960. Set depth.
  13961. Larger depth values will denoise lower frequency components more, but
  13962. slow down filtering.
  13963. Must be an int in the range 8-16, default is @code{8}.
  13964. @item luma_strength, ls
  13965. Set luma strength.
  13966. Must be a double value in the range 0-1000, default is @code{1.0}.
  13967. @item chroma_strength, cs
  13968. Set chroma strength.
  13969. Must be a double value in the range 0-1000, default is @code{1.0}.
  13970. @end table
  13971. @anchor{pad}
  13972. @section pad
  13973. Add paddings to the input image, and place the original input at the
  13974. provided @var{x}, @var{y} coordinates.
  13975. It accepts the following parameters:
  13976. @table @option
  13977. @item width, w
  13978. @item height, h
  13979. Specify an expression for the size of the output image with the
  13980. paddings added. If the value for @var{width} or @var{height} is 0, the
  13981. corresponding input size is used for the output.
  13982. The @var{width} expression can reference the value set by the
  13983. @var{height} expression, and vice versa.
  13984. The default value of @var{width} and @var{height} is 0.
  13985. @item x
  13986. @item y
  13987. Specify the offsets to place the input image at within the padded area,
  13988. with respect to the top/left border of the output image.
  13989. The @var{x} expression can reference the value set by the @var{y}
  13990. expression, and vice versa.
  13991. The default value of @var{x} and @var{y} is 0.
  13992. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  13993. so the input image is centered on the padded area.
  13994. @item color
  13995. Specify the color of the padded area. For the syntax of this option,
  13996. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13997. manual,ffmpeg-utils}.
  13998. The default value of @var{color} is "black".
  13999. @item eval
  14000. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  14001. It accepts the following values:
  14002. @table @samp
  14003. @item init
  14004. Only evaluate expressions once during the filter initialization or when
  14005. a command is processed.
  14006. @item frame
  14007. Evaluate expressions for each incoming frame.
  14008. @end table
  14009. Default value is @samp{init}.
  14010. @item aspect
  14011. Pad to aspect instead to a resolution.
  14012. @end table
  14013. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  14014. options are expressions containing the following constants:
  14015. @table @option
  14016. @item in_w
  14017. @item in_h
  14018. The input video width and height.
  14019. @item iw
  14020. @item ih
  14021. These are the same as @var{in_w} and @var{in_h}.
  14022. @item out_w
  14023. @item out_h
  14024. The output width and height (the size of the padded area), as
  14025. specified by the @var{width} and @var{height} expressions.
  14026. @item ow
  14027. @item oh
  14028. These are the same as @var{out_w} and @var{out_h}.
  14029. @item x
  14030. @item y
  14031. The x and y offsets as specified by the @var{x} and @var{y}
  14032. expressions, or NAN if not yet specified.
  14033. @item a
  14034. same as @var{iw} / @var{ih}
  14035. @item sar
  14036. input sample aspect ratio
  14037. @item dar
  14038. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  14039. @item hsub
  14040. @item vsub
  14041. The horizontal and vertical chroma subsample values. For example for the
  14042. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14043. @end table
  14044. @subsection Examples
  14045. @itemize
  14046. @item
  14047. Add paddings with the color "violet" to the input video. The output video
  14048. size is 640x480, and the top-left corner of the input video is placed at
  14049. column 0, row 40
  14050. @example
  14051. pad=640:480:0:40:violet
  14052. @end example
  14053. The example above is equivalent to the following command:
  14054. @example
  14055. pad=width=640:height=480:x=0:y=40:color=violet
  14056. @end example
  14057. @item
  14058. Pad the input to get an output with dimensions increased by 3/2,
  14059. and put the input video at the center of the padded area:
  14060. @example
  14061. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  14062. @end example
  14063. @item
  14064. Pad the input to get a squared output with size equal to the maximum
  14065. value between the input width and height, and put the input video at
  14066. the center of the padded area:
  14067. @example
  14068. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  14069. @end example
  14070. @item
  14071. Pad the input to get a final w/h ratio of 16:9:
  14072. @example
  14073. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  14074. @end example
  14075. @item
  14076. In case of anamorphic video, in order to set the output display aspect
  14077. correctly, it is necessary to use @var{sar} in the expression,
  14078. according to the relation:
  14079. @example
  14080. (ih * X / ih) * sar = output_dar
  14081. X = output_dar / sar
  14082. @end example
  14083. Thus the previous example needs to be modified to:
  14084. @example
  14085. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  14086. @end example
  14087. @item
  14088. Double the output size and put the input video in the bottom-right
  14089. corner of the output padded area:
  14090. @example
  14091. pad="2*iw:2*ih:ow-iw:oh-ih"
  14092. @end example
  14093. @end itemize
  14094. @anchor{palettegen}
  14095. @section palettegen
  14096. Generate one palette for a whole video stream.
  14097. It accepts the following options:
  14098. @table @option
  14099. @item max_colors
  14100. Set the maximum number of colors to quantize in the palette.
  14101. Note: the palette will still contain 256 colors; the unused palette entries
  14102. will be black.
  14103. @item reserve_transparent
  14104. Create a palette of 255 colors maximum and reserve the last one for
  14105. transparency. Reserving the transparency color is useful for GIF optimization.
  14106. If not set, the maximum of colors in the palette will be 256. You probably want
  14107. to disable this option for a standalone image.
  14108. Set by default.
  14109. @item transparency_color
  14110. Set the color that will be used as background for transparency.
  14111. @item stats_mode
  14112. Set statistics mode.
  14113. It accepts the following values:
  14114. @table @samp
  14115. @item full
  14116. Compute full frame histograms.
  14117. @item diff
  14118. Compute histograms only for the part that differs from previous frame. This
  14119. might be relevant to give more importance to the moving part of your input if
  14120. the background is static.
  14121. @item single
  14122. Compute new histogram for each frame.
  14123. @end table
  14124. Default value is @var{full}.
  14125. @end table
  14126. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  14127. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  14128. color quantization of the palette. This information is also visible at
  14129. @var{info} logging level.
  14130. @subsection Examples
  14131. @itemize
  14132. @item
  14133. Generate a representative palette of a given video using @command{ffmpeg}:
  14134. @example
  14135. ffmpeg -i input.mkv -vf palettegen palette.png
  14136. @end example
  14137. @end itemize
  14138. @section paletteuse
  14139. Use a palette to downsample an input video stream.
  14140. The filter takes two inputs: one video stream and a palette. The palette must
  14141. be a 256 pixels image.
  14142. It accepts the following options:
  14143. @table @option
  14144. @item dither
  14145. Select dithering mode. Available algorithms are:
  14146. @table @samp
  14147. @item bayer
  14148. Ordered 8x8 bayer dithering (deterministic)
  14149. @item heckbert
  14150. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  14151. Note: this dithering is sometimes considered "wrong" and is included as a
  14152. reference.
  14153. @item floyd_steinberg
  14154. Floyd and Steingberg dithering (error diffusion)
  14155. @item sierra2
  14156. Frankie Sierra dithering v2 (error diffusion)
  14157. @item sierra2_4a
  14158. Frankie Sierra dithering v2 "Lite" (error diffusion)
  14159. @item sierra3
  14160. Frankie Sierra dithering v3 (error diffusion)
  14161. @item burkes
  14162. Burkes dithering (error diffusion)
  14163. @item atkinson
  14164. Atkinson dithering by Bill Atkinson at Apple Computer (error diffusion)
  14165. @end table
  14166. Default is @var{sierra2_4a}.
  14167. @item bayer_scale
  14168. When @var{bayer} dithering is selected, this option defines the scale of the
  14169. pattern (how much the crosshatch pattern is visible). A low value means more
  14170. visible pattern for less banding, and higher value means less visible pattern
  14171. at the cost of more banding.
  14172. The option must be an integer value in the range [0,5]. Default is @var{2}.
  14173. @item diff_mode
  14174. If set, define the zone to process
  14175. @table @samp
  14176. @item rectangle
  14177. Only the changing rectangle will be reprocessed. This is similar to GIF
  14178. cropping/offsetting compression mechanism. This option can be useful for speed
  14179. if only a part of the image is changing, and has use cases such as limiting the
  14180. scope of the error diffusal @option{dither} to the rectangle that bounds the
  14181. moving scene (it leads to more deterministic output if the scene doesn't change
  14182. much, and as a result less moving noise and better GIF compression).
  14183. @end table
  14184. Default is @var{none}.
  14185. @item new
  14186. Take new palette for each output frame.
  14187. @item alpha_threshold
  14188. Sets the alpha threshold for transparency. Alpha values above this threshold
  14189. will be treated as completely opaque, and values below this threshold will be
  14190. treated as completely transparent.
  14191. The option must be an integer value in the range [0,255]. Default is @var{128}.
  14192. @end table
  14193. @subsection Examples
  14194. @itemize
  14195. @item
  14196. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  14197. using @command{ffmpeg}:
  14198. @example
  14199. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  14200. @end example
  14201. @end itemize
  14202. @section perspective
  14203. Correct perspective of video not recorded perpendicular to the screen.
  14204. A description of the accepted parameters follows.
  14205. @table @option
  14206. @item x0
  14207. @item y0
  14208. @item x1
  14209. @item y1
  14210. @item x2
  14211. @item y2
  14212. @item x3
  14213. @item y3
  14214. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  14215. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  14216. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  14217. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  14218. then the corners of the source will be sent to the specified coordinates.
  14219. The expressions can use the following variables:
  14220. @table @option
  14221. @item W
  14222. @item H
  14223. the width and height of video frame.
  14224. @item in
  14225. Input frame count.
  14226. @item on
  14227. Output frame count.
  14228. @end table
  14229. @item interpolation
  14230. Set interpolation for perspective correction.
  14231. It accepts the following values:
  14232. @table @samp
  14233. @item linear
  14234. @item cubic
  14235. @end table
  14236. Default value is @samp{linear}.
  14237. @item sense
  14238. Set interpretation of coordinate options.
  14239. It accepts the following values:
  14240. @table @samp
  14241. @item 0, source
  14242. Send point in the source specified by the given coordinates to
  14243. the corners of the destination.
  14244. @item 1, destination
  14245. Send the corners of the source to the point in the destination specified
  14246. by the given coordinates.
  14247. Default value is @samp{source}.
  14248. @end table
  14249. @item eval
  14250. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  14251. It accepts the following values:
  14252. @table @samp
  14253. @item init
  14254. only evaluate expressions once during the filter initialization or
  14255. when a command is processed
  14256. @item frame
  14257. evaluate expressions for each incoming frame
  14258. @end table
  14259. Default value is @samp{init}.
  14260. @end table
  14261. @section phase
  14262. Delay interlaced video by one field time so that the field order changes.
  14263. The intended use is to fix PAL movies that have been captured with the
  14264. opposite field order to the film-to-video transfer.
  14265. A description of the accepted parameters follows.
  14266. @table @option
  14267. @item mode
  14268. Set phase mode.
  14269. It accepts the following values:
  14270. @table @samp
  14271. @item t
  14272. Capture field order top-first, transfer bottom-first.
  14273. Filter will delay the bottom field.
  14274. @item b
  14275. Capture field order bottom-first, transfer top-first.
  14276. Filter will delay the top field.
  14277. @item p
  14278. Capture and transfer with the same field order. This mode only exists
  14279. for the documentation of the other options to refer to, but if you
  14280. actually select it, the filter will faithfully do nothing.
  14281. @item a
  14282. Capture field order determined automatically by field flags, transfer
  14283. opposite.
  14284. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  14285. basis using field flags. If no field information is available,
  14286. then this works just like @samp{u}.
  14287. @item u
  14288. Capture unknown or varying, transfer opposite.
  14289. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  14290. analyzing the images and selecting the alternative that produces best
  14291. match between the fields.
  14292. @item T
  14293. Capture top-first, transfer unknown or varying.
  14294. Filter selects among @samp{t} and @samp{p} using image analysis.
  14295. @item B
  14296. Capture bottom-first, transfer unknown or varying.
  14297. Filter selects among @samp{b} and @samp{p} using image analysis.
  14298. @item A
  14299. Capture determined by field flags, transfer unknown or varying.
  14300. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  14301. image analysis. If no field information is available, then this works just
  14302. like @samp{U}. This is the default mode.
  14303. @item U
  14304. Both capture and transfer unknown or varying.
  14305. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  14306. @end table
  14307. @end table
  14308. @subsection Commands
  14309. This filter supports the all above options as @ref{commands}.
  14310. @section photosensitivity
  14311. Reduce various flashes in video, so to help users with epilepsy.
  14312. It accepts the following options:
  14313. @table @option
  14314. @item frames, f
  14315. Set how many frames to use when filtering. Default is 30.
  14316. @item threshold, t
  14317. Set detection threshold factor. Default is 1.
  14318. Lower is stricter.
  14319. @item skip
  14320. Set how many pixels to skip when sampling frames. Default is 1.
  14321. Allowed range is from 1 to 1024.
  14322. @item bypass
  14323. Leave frames unchanged. Default is disabled.
  14324. @end table
  14325. @section pixdesctest
  14326. Pixel format descriptor test filter, mainly useful for internal
  14327. testing. The output video should be equal to the input video.
  14328. For example:
  14329. @example
  14330. format=monow, pixdesctest
  14331. @end example
  14332. can be used to test the monowhite pixel format descriptor definition.
  14333. @section pixelize
  14334. Apply pixelization to video stream.
  14335. The filter accepts the following options:
  14336. @table @option
  14337. @item width, w
  14338. @item height, h
  14339. Set block dimensions that will be used for pixelization.
  14340. Default value is @code{16}.
  14341. @item mode, m
  14342. Set the mode of pixelization used.
  14343. Possible values are:
  14344. @table @samp
  14345. @item avg
  14346. @item min
  14347. @item max
  14348. @end table
  14349. Default value is @code{avg}.
  14350. @item planes, p
  14351. Set what planes to filter. Default is to filter all planes.
  14352. @end table
  14353. @subsection Commands
  14354. This filter supports all options as @ref{commands}.
  14355. @section pixscope
  14356. Display sample values of color channels. Mainly useful for checking color
  14357. and levels. Minimum supported resolution is 640x480.
  14358. The filters accept the following options:
  14359. @table @option
  14360. @item x
  14361. Set scope X position, relative offset on X axis.
  14362. @item y
  14363. Set scope Y position, relative offset on Y axis.
  14364. @item w
  14365. Set scope width.
  14366. @item h
  14367. Set scope height.
  14368. @item o
  14369. Set window opacity. This window also holds statistics about pixel area.
  14370. @item wx
  14371. Set window X position, relative offset on X axis.
  14372. @item wy
  14373. Set window Y position, relative offset on Y axis.
  14374. @end table
  14375. @subsection Commands
  14376. This filter supports same @ref{commands} as options.
  14377. @section pp
  14378. Enable the specified chain of postprocessing subfilters using libpostproc. This
  14379. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  14380. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  14381. Each subfilter and some options have a short and a long name that can be used
  14382. interchangeably, i.e. dr/dering are the same.
  14383. The filters accept the following options:
  14384. @table @option
  14385. @item subfilters
  14386. Set postprocessing subfilters string.
  14387. @end table
  14388. All subfilters share common options to determine their scope:
  14389. @table @option
  14390. @item a/autoq
  14391. Honor the quality commands for this subfilter.
  14392. @item c/chrom
  14393. Do chrominance filtering, too (default).
  14394. @item y/nochrom
  14395. Do luminance filtering only (no chrominance).
  14396. @item n/noluma
  14397. Do chrominance filtering only (no luminance).
  14398. @end table
  14399. These options can be appended after the subfilter name, separated by a '|'.
  14400. Available subfilters are:
  14401. @table @option
  14402. @item hb/hdeblock[|difference[|flatness]]
  14403. Horizontal deblocking filter
  14404. @table @option
  14405. @item difference
  14406. Difference factor where higher values mean more deblocking (default: @code{32}).
  14407. @item flatness
  14408. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14409. @end table
  14410. @item vb/vdeblock[|difference[|flatness]]
  14411. Vertical deblocking filter
  14412. @table @option
  14413. @item difference
  14414. Difference factor where higher values mean more deblocking (default: @code{32}).
  14415. @item flatness
  14416. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14417. @end table
  14418. @item ha/hadeblock[|difference[|flatness]]
  14419. Accurate horizontal deblocking filter
  14420. @table @option
  14421. @item difference
  14422. Difference factor where higher values mean more deblocking (default: @code{32}).
  14423. @item flatness
  14424. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14425. @end table
  14426. @item va/vadeblock[|difference[|flatness]]
  14427. Accurate vertical deblocking filter
  14428. @table @option
  14429. @item difference
  14430. Difference factor where higher values mean more deblocking (default: @code{32}).
  14431. @item flatness
  14432. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14433. @end table
  14434. @end table
  14435. The horizontal and vertical deblocking filters share the difference and
  14436. flatness values so you cannot set different horizontal and vertical
  14437. thresholds.
  14438. @table @option
  14439. @item h1/x1hdeblock
  14440. Experimental horizontal deblocking filter
  14441. @item v1/x1vdeblock
  14442. Experimental vertical deblocking filter
  14443. @item dr/dering
  14444. Deringing filter
  14445. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  14446. @table @option
  14447. @item threshold1
  14448. larger -> stronger filtering
  14449. @item threshold2
  14450. larger -> stronger filtering
  14451. @item threshold3
  14452. larger -> stronger filtering
  14453. @end table
  14454. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  14455. @table @option
  14456. @item f/fullyrange
  14457. Stretch luminance to @code{0-255}.
  14458. @end table
  14459. @item lb/linblenddeint
  14460. Linear blend deinterlacing filter that deinterlaces the given block by
  14461. filtering all lines with a @code{(1 2 1)} filter.
  14462. @item li/linipoldeint
  14463. Linear interpolating deinterlacing filter that deinterlaces the given block by
  14464. linearly interpolating every second line.
  14465. @item ci/cubicipoldeint
  14466. Cubic interpolating deinterlacing filter deinterlaces the given block by
  14467. cubically interpolating every second line.
  14468. @item md/mediandeint
  14469. Median deinterlacing filter that deinterlaces the given block by applying a
  14470. median filter to every second line.
  14471. @item fd/ffmpegdeint
  14472. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  14473. second line with a @code{(-1 4 2 4 -1)} filter.
  14474. @item l5/lowpass5
  14475. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  14476. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  14477. @item fq/forceQuant[|quantizer]
  14478. Overrides the quantizer table from the input with the constant quantizer you
  14479. specify.
  14480. @table @option
  14481. @item quantizer
  14482. Quantizer to use
  14483. @end table
  14484. @item de/default
  14485. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  14486. @item fa/fast
  14487. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  14488. @item ac
  14489. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  14490. @end table
  14491. @subsection Examples
  14492. @itemize
  14493. @item
  14494. Apply horizontal and vertical deblocking, deringing and automatic
  14495. brightness/contrast:
  14496. @example
  14497. pp=hb/vb/dr/al
  14498. @end example
  14499. @item
  14500. Apply default filters without brightness/contrast correction:
  14501. @example
  14502. pp=de/-al
  14503. @end example
  14504. @item
  14505. Apply default filters and temporal denoiser:
  14506. @example
  14507. pp=default/tmpnoise|1|2|3
  14508. @end example
  14509. @item
  14510. Apply deblocking on luminance only, and switch vertical deblocking on or off
  14511. automatically depending on available CPU time:
  14512. @example
  14513. pp=hb|y/vb|a
  14514. @end example
  14515. @end itemize
  14516. @section pp7
  14517. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  14518. similar to spp = 6 with 7 point DCT, where only the center sample is
  14519. used after IDCT.
  14520. The filter accepts the following options:
  14521. @table @option
  14522. @item qp
  14523. Force a constant quantization parameter. It accepts an integer in range
  14524. 0 to 63. If not set, the filter will use the QP from the video stream
  14525. (if available).
  14526. @item mode
  14527. Set thresholding mode. Available modes are:
  14528. @table @samp
  14529. @item hard
  14530. Set hard thresholding.
  14531. @item soft
  14532. Set soft thresholding (better de-ringing effect, but likely blurrier).
  14533. @item medium
  14534. Set medium thresholding (good results, default).
  14535. @end table
  14536. @end table
  14537. @section premultiply
  14538. Apply alpha premultiply effect to input video stream using first plane
  14539. of second stream as alpha.
  14540. Both streams must have same dimensions and same pixel format.
  14541. The filter accepts the following option:
  14542. @table @option
  14543. @item planes
  14544. Set which planes will be processed, unprocessed planes will be copied.
  14545. By default value 0xf, all planes will be processed.
  14546. @item inplace
  14547. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14548. @end table
  14549. @section prewitt
  14550. Apply prewitt operator to input video stream.
  14551. The filter accepts the following option:
  14552. @table @option
  14553. @item planes
  14554. Set which planes will be processed, unprocessed planes will be copied.
  14555. By default value 0xf, all planes will be processed.
  14556. @item scale
  14557. Set value which will be multiplied with filtered result.
  14558. @item delta
  14559. Set value which will be added to filtered result.
  14560. @end table
  14561. @subsection Commands
  14562. This filter supports the all above options as @ref{commands}.
  14563. @section pseudocolor
  14564. Alter frame colors in video with pseudocolors.
  14565. This filter accepts the following options:
  14566. @table @option
  14567. @item c0
  14568. set pixel first component expression
  14569. @item c1
  14570. set pixel second component expression
  14571. @item c2
  14572. set pixel third component expression
  14573. @item c3
  14574. set pixel fourth component expression, corresponds to the alpha component
  14575. @item index, i
  14576. set component to use as base for altering colors
  14577. @item preset, p
  14578. Pick one of built-in LUTs. By default is set to none.
  14579. Available LUTs:
  14580. @table @samp
  14581. @item magma
  14582. @item inferno
  14583. @item plasma
  14584. @item viridis
  14585. @item turbo
  14586. @item cividis
  14587. @item range1
  14588. @item range2
  14589. @item shadows
  14590. @item highlights
  14591. @item solar
  14592. @item nominal
  14593. @item preferred
  14594. @item total
  14595. @item spectral
  14596. @end table
  14597. @item opacity
  14598. Set opacity of output colors. Allowed range is from 0 to 1.
  14599. Default value is set to 1.
  14600. @end table
  14601. Each of the expression options specifies the expression to use for computing
  14602. the lookup table for the corresponding pixel component values.
  14603. The expressions can contain the following constants and functions:
  14604. @table @option
  14605. @item w
  14606. @item h
  14607. The input width and height.
  14608. @item val
  14609. The input value for the pixel component.
  14610. @item ymin, umin, vmin, amin
  14611. The minimum allowed component value.
  14612. @item ymax, umax, vmax, amax
  14613. The maximum allowed component value.
  14614. @end table
  14615. All expressions default to "val".
  14616. @subsection Commands
  14617. This filter supports the all above options as @ref{commands}.
  14618. @subsection Examples
  14619. @itemize
  14620. @item
  14621. Change too high luma values to gradient:
  14622. @example
  14623. 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'"
  14624. @end example
  14625. @end itemize
  14626. @section psnr
  14627. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  14628. Ratio) between two input videos.
  14629. This filter takes in input two input videos, the first input is
  14630. considered the "main" source and is passed unchanged to the
  14631. output. The second input is used as a "reference" video for computing
  14632. the PSNR.
  14633. Both video inputs must have the same resolution and pixel format for
  14634. this filter to work correctly. Also it assumes that both inputs
  14635. have the same number of frames, which are compared one by one.
  14636. The obtained average PSNR is printed through the logging system.
  14637. The filter stores the accumulated MSE (mean squared error) of each
  14638. frame, and at the end of the processing it is averaged across all frames
  14639. equally, and the following formula is applied to obtain the PSNR:
  14640. @example
  14641. PSNR = 10*log10(MAX^2/MSE)
  14642. @end example
  14643. Where MAX is the average of the maximum values of each component of the
  14644. image.
  14645. The description of the accepted parameters follows.
  14646. @table @option
  14647. @item stats_file, f
  14648. If specified the filter will use the named file to save the PSNR of
  14649. each individual frame. When filename equals "-" the data is sent to
  14650. standard output.
  14651. @item stats_version
  14652. Specifies which version of the stats file format to use. Details of
  14653. each format are written below.
  14654. Default value is 1.
  14655. @item stats_add_max
  14656. Determines whether the max value is output to the stats log.
  14657. Default value is 0.
  14658. Requires stats_version >= 2. If this is set and stats_version < 2,
  14659. the filter will return an error.
  14660. @end table
  14661. This filter also supports the @ref{framesync} options.
  14662. The file printed if @var{stats_file} is selected, contains a sequence of
  14663. key/value pairs of the form @var{key}:@var{value} for each compared
  14664. couple of frames.
  14665. If a @var{stats_version} greater than 1 is specified, a header line precedes
  14666. the list of per-frame-pair stats, with key value pairs following the frame
  14667. format with the following parameters:
  14668. @table @option
  14669. @item psnr_log_version
  14670. The version of the log file format. Will match @var{stats_version}.
  14671. @item fields
  14672. A comma separated list of the per-frame-pair parameters included in
  14673. the log.
  14674. @end table
  14675. A description of each shown per-frame-pair parameter follows:
  14676. @table @option
  14677. @item n
  14678. sequential number of the input frame, starting from 1
  14679. @item mse_avg
  14680. Mean Square Error pixel-by-pixel average difference of the compared
  14681. frames, averaged over all the image components.
  14682. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  14683. Mean Square Error pixel-by-pixel average difference of the compared
  14684. frames for the component specified by the suffix.
  14685. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  14686. Peak Signal to Noise ratio of the compared frames for the component
  14687. specified by the suffix.
  14688. @item max_avg, max_y, max_u, max_v
  14689. Maximum allowed value for each channel, and average over all
  14690. channels.
  14691. @end table
  14692. @subsection Examples
  14693. @itemize
  14694. @item
  14695. For example:
  14696. @example
  14697. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14698. [main][ref] psnr="stats_file=stats.log" [out]
  14699. @end example
  14700. On this example the input file being processed is compared with the
  14701. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  14702. is stored in @file{stats.log}.
  14703. @item
  14704. Another example with different containers:
  14705. @example
  14706. 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 -
  14707. @end example
  14708. @end itemize
  14709. @anchor{pullup}
  14710. @section pullup
  14711. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  14712. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  14713. content.
  14714. The pullup filter is designed to take advantage of future context in making
  14715. its decisions. This filter is stateless in the sense that it does not lock
  14716. onto a pattern to follow, but it instead looks forward to the following
  14717. fields in order to identify matches and rebuild progressive frames.
  14718. To produce content with an even framerate, insert the fps filter after
  14719. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  14720. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  14721. The filter accepts the following options:
  14722. @table @option
  14723. @item jl
  14724. @item jr
  14725. @item jt
  14726. @item jb
  14727. These options set the amount of "junk" to ignore at the left, right, top, and
  14728. bottom of the image, respectively. Left and right are in units of 8 pixels,
  14729. while top and bottom are in units of 2 lines.
  14730. The default is 8 pixels on each side.
  14731. @item sb
  14732. Set the strict breaks. Setting this option to 1 will reduce the chances of
  14733. filter generating an occasional mismatched frame, but it may also cause an
  14734. excessive number of frames to be dropped during high motion sequences.
  14735. Conversely, setting it to -1 will make filter match fields more easily.
  14736. This may help processing of video where there is slight blurring between
  14737. the fields, but may also cause there to be interlaced frames in the output.
  14738. Default value is @code{0}.
  14739. @item mp
  14740. Set the metric plane to use. It accepts the following values:
  14741. @table @samp
  14742. @item l
  14743. Use luma plane.
  14744. @item u
  14745. Use chroma blue plane.
  14746. @item v
  14747. Use chroma red plane.
  14748. @end table
  14749. This option may be set to use chroma plane instead of the default luma plane
  14750. for doing filter's computations. This may improve accuracy on very clean
  14751. source material, but more likely will decrease accuracy, especially if there
  14752. is chroma noise (rainbow effect) or any grayscale video.
  14753. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  14754. load and make pullup usable in realtime on slow machines.
  14755. @end table
  14756. For best results (without duplicated frames in the output file) it is
  14757. necessary to change the output frame rate. For example, to inverse
  14758. telecine NTSC input:
  14759. @example
  14760. ffmpeg -i input -vf pullup -r 24000/1001 ...
  14761. @end example
  14762. @section qp
  14763. Change video quantization parameters (QP).
  14764. The filter accepts the following option:
  14765. @table @option
  14766. @item qp
  14767. Set expression for quantization parameter.
  14768. @end table
  14769. The expression is evaluated through the eval API and can contain, among others,
  14770. the following constants:
  14771. @table @var
  14772. @item known
  14773. 1 if index is not 129, 0 otherwise.
  14774. @item qp
  14775. Sequential index starting from -129 to 128.
  14776. @end table
  14777. @subsection Examples
  14778. @itemize
  14779. @item
  14780. Some equation like:
  14781. @example
  14782. qp=2+2*sin(PI*qp)
  14783. @end example
  14784. @end itemize
  14785. @section random
  14786. Flush video frames from internal cache of frames into a random order.
  14787. No frame is discarded.
  14788. Inspired by @ref{frei0r} nervous filter.
  14789. @table @option
  14790. @item frames
  14791. Set size in number of frames of internal cache, in range from @code{2} to
  14792. @code{512}. Default is @code{30}.
  14793. @item seed
  14794. Set seed for random number generator, must be an integer included between
  14795. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14796. less than @code{0}, the filter will try to use a good random seed on a
  14797. best effort basis.
  14798. @end table
  14799. @section readeia608
  14800. Read closed captioning (EIA-608) information from the top lines of a video frame.
  14801. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  14802. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  14803. with EIA-608 data (starting from 0). A description of each metadata value follows:
  14804. @table @option
  14805. @item lavfi.readeia608.X.cc
  14806. The two bytes stored as EIA-608 data (printed in hexadecimal).
  14807. @item lavfi.readeia608.X.line
  14808. The number of the line on which the EIA-608 data was identified and read.
  14809. @end table
  14810. This filter accepts the following options:
  14811. @table @option
  14812. @item scan_min
  14813. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  14814. @item scan_max
  14815. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  14816. @item spw
  14817. Set the ratio of width reserved for sync code detection.
  14818. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  14819. @item chp
  14820. Enable checking the parity bit. In the event of a parity error, the filter will output
  14821. @code{0x00} for that character. Default is false.
  14822. @item lp
  14823. Lowpass lines prior to further processing. Default is enabled.
  14824. @end table
  14825. @subsection Commands
  14826. This filter supports the all above options as @ref{commands}.
  14827. @subsection Examples
  14828. @itemize
  14829. @item
  14830. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  14831. @example
  14832. 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
  14833. @end example
  14834. @end itemize
  14835. @section readvitc
  14836. Read vertical interval timecode (VITC) information from the top lines of a
  14837. video frame.
  14838. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  14839. timecode value, if a valid timecode has been detected. Further metadata key
  14840. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  14841. timecode data has been found or not.
  14842. This filter accepts the following options:
  14843. @table @option
  14844. @item scan_max
  14845. Set the maximum number of lines to scan for VITC data. If the value is set to
  14846. @code{-1} the full video frame is scanned. Default is @code{45}.
  14847. @item thr_b
  14848. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  14849. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  14850. @item thr_w
  14851. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  14852. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  14853. @end table
  14854. @subsection Examples
  14855. @itemize
  14856. @item
  14857. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  14858. draw @code{--:--:--:--} as a placeholder:
  14859. @example
  14860. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  14861. @end example
  14862. @end itemize
  14863. @section remap
  14864. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  14865. Destination pixel at position (X, Y) will be picked from source (x, y) position
  14866. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  14867. value for pixel will be used for destination pixel.
  14868. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  14869. will have Xmap/Ymap video stream dimensions.
  14870. Xmap and Ymap input video streams are 16bit depth, single channel.
  14871. @table @option
  14872. @item format
  14873. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  14874. Default is @code{color}.
  14875. @item fill
  14876. Specify the color of the unmapped pixels. For the syntax of this option,
  14877. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14878. manual,ffmpeg-utils}. Default color is @code{black}.
  14879. @end table
  14880. @section removegrain
  14881. The removegrain filter is a spatial denoiser for progressive video.
  14882. @table @option
  14883. @item m0
  14884. Set mode for the first plane.
  14885. @item m1
  14886. Set mode for the second plane.
  14887. @item m2
  14888. Set mode for the third plane.
  14889. @item m3
  14890. Set mode for the fourth plane.
  14891. @end table
  14892. Range of mode is from 0 to 24. Description of each mode follows:
  14893. @table @var
  14894. @item 0
  14895. Leave input plane unchanged. Default.
  14896. @item 1
  14897. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  14898. @item 2
  14899. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  14900. @item 3
  14901. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  14902. @item 4
  14903. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  14904. This is equivalent to a median filter.
  14905. @item 5
  14906. Line-sensitive clipping giving the minimal change.
  14907. @item 6
  14908. Line-sensitive clipping, intermediate.
  14909. @item 7
  14910. Line-sensitive clipping, intermediate.
  14911. @item 8
  14912. Line-sensitive clipping, intermediate.
  14913. @item 9
  14914. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  14915. @item 10
  14916. Replaces the target pixel with the closest neighbour.
  14917. @item 11
  14918. [1 2 1] horizontal and vertical kernel blur.
  14919. @item 12
  14920. Same as mode 11.
  14921. @item 13
  14922. Bob mode, interpolates top field from the line where the neighbours
  14923. pixels are the closest.
  14924. @item 14
  14925. Bob mode, interpolates bottom field from the line where the neighbours
  14926. pixels are the closest.
  14927. @item 15
  14928. Bob mode, interpolates top field. Same as 13 but with a more complicated
  14929. interpolation formula.
  14930. @item 16
  14931. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  14932. interpolation formula.
  14933. @item 17
  14934. Clips the pixel with the minimum and maximum of respectively the maximum and
  14935. minimum of each pair of opposite neighbour pixels.
  14936. @item 18
  14937. Line-sensitive clipping using opposite neighbours whose greatest distance from
  14938. the current pixel is minimal.
  14939. @item 19
  14940. Replaces the pixel with the average of its 8 neighbours.
  14941. @item 20
  14942. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  14943. @item 21
  14944. Clips pixels using the averages of opposite neighbour.
  14945. @item 22
  14946. Same as mode 21 but simpler and faster.
  14947. @item 23
  14948. Small edge and halo removal, but reputed useless.
  14949. @item 24
  14950. Similar as 23.
  14951. @end table
  14952. @section removelogo
  14953. Suppress a TV station logo, using an image file to determine which
  14954. pixels comprise the logo. It works by filling in the pixels that
  14955. comprise the logo with neighboring pixels.
  14956. The filter accepts the following options:
  14957. @table @option
  14958. @item filename, f
  14959. Set the filter bitmap file, which can be any image format supported by
  14960. libavformat. The width and height of the image file must match those of the
  14961. video stream being processed.
  14962. @end table
  14963. Pixels in the provided bitmap image with a value of zero are not
  14964. considered part of the logo, non-zero pixels are considered part of
  14965. the logo. If you use white (255) for the logo and black (0) for the
  14966. rest, you will be safe. For making the filter bitmap, it is
  14967. recommended to take a screen capture of a black frame with the logo
  14968. visible, and then using a threshold filter followed by the erode
  14969. filter once or twice.
  14970. If needed, little splotches can be fixed manually. Remember that if
  14971. logo pixels are not covered, the filter quality will be much
  14972. reduced. Marking too many pixels as part of the logo does not hurt as
  14973. much, but it will increase the amount of blurring needed to cover over
  14974. the image and will destroy more information than necessary, and extra
  14975. pixels will slow things down on a large logo.
  14976. @section repeatfields
  14977. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  14978. fields based on its value.
  14979. @section reverse
  14980. Reverse a video clip.
  14981. Warning: This filter requires memory to buffer the entire clip, so trimming
  14982. is suggested.
  14983. @subsection Examples
  14984. @itemize
  14985. @item
  14986. Take the first 5 seconds of a clip, and reverse it.
  14987. @example
  14988. trim=end=5,reverse
  14989. @end example
  14990. @end itemize
  14991. @section rgbashift
  14992. Shift R/G/B/A pixels horizontally and/or vertically.
  14993. The filter accepts the following options:
  14994. @table @option
  14995. @item rh
  14996. Set amount to shift red horizontally.
  14997. @item rv
  14998. Set amount to shift red vertically.
  14999. @item gh
  15000. Set amount to shift green horizontally.
  15001. @item gv
  15002. Set amount to shift green vertically.
  15003. @item bh
  15004. Set amount to shift blue horizontally.
  15005. @item bv
  15006. Set amount to shift blue vertically.
  15007. @item ah
  15008. Set amount to shift alpha horizontally.
  15009. @item av
  15010. Set amount to shift alpha vertically.
  15011. @item edge
  15012. Set edge mode, can be @var{smear}, default, or @var{warp}.
  15013. @end table
  15014. @subsection Commands
  15015. This filter supports the all above options as @ref{commands}.
  15016. @section roberts
  15017. Apply roberts cross operator to input video stream.
  15018. The filter accepts the following option:
  15019. @table @option
  15020. @item planes
  15021. Set which planes will be processed, unprocessed planes will be copied.
  15022. By default value 0xf, all planes will be processed.
  15023. @item scale
  15024. Set value which will be multiplied with filtered result.
  15025. @item delta
  15026. Set value which will be added to filtered result.
  15027. @end table
  15028. @subsection Commands
  15029. This filter supports the all above options as @ref{commands}.
  15030. @section rotate
  15031. Rotate video by an arbitrary angle expressed in radians.
  15032. The filter accepts the following options:
  15033. A description of the optional parameters follows.
  15034. @table @option
  15035. @item angle, a
  15036. Set an expression for the angle by which to rotate the input video
  15037. clockwise, expressed as a number of radians. A negative value will
  15038. result in a counter-clockwise rotation. By default it is set to "0".
  15039. This expression is evaluated for each frame.
  15040. @item out_w, ow
  15041. Set the output width expression, default value is "iw".
  15042. This expression is evaluated just once during configuration.
  15043. @item out_h, oh
  15044. Set the output height expression, default value is "ih".
  15045. This expression is evaluated just once during configuration.
  15046. @item bilinear
  15047. Enable bilinear interpolation if set to 1, a value of 0 disables
  15048. it. Default value is 1.
  15049. @item fillcolor, c
  15050. Set the color used to fill the output area not covered by the rotated
  15051. image. For the general syntax of this option, check the
  15052. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15053. If the special value "none" is selected then no
  15054. background is printed (useful for example if the background is never shown).
  15055. Default value is "black".
  15056. @end table
  15057. The expressions for the angle and the output size can contain the
  15058. following constants and functions:
  15059. @table @option
  15060. @item n
  15061. sequential number of the input frame, starting from 0. It is always NAN
  15062. before the first frame is filtered.
  15063. @item t
  15064. time in seconds of the input frame, it is set to 0 when the filter is
  15065. configured. It is always NAN before the first frame is filtered.
  15066. @item hsub
  15067. @item vsub
  15068. horizontal and vertical chroma subsample values. For example for the
  15069. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15070. @item in_w, iw
  15071. @item in_h, ih
  15072. the input video width and height
  15073. @item out_w, ow
  15074. @item out_h, oh
  15075. the output width and height, that is the size of the padded area as
  15076. specified by the @var{width} and @var{height} expressions
  15077. @item rotw(a)
  15078. @item roth(a)
  15079. the minimal width/height required for completely containing the input
  15080. video rotated by @var{a} radians.
  15081. These are only available when computing the @option{out_w} and
  15082. @option{out_h} expressions.
  15083. @end table
  15084. @subsection Examples
  15085. @itemize
  15086. @item
  15087. Rotate the input by PI/6 radians clockwise:
  15088. @example
  15089. rotate=PI/6
  15090. @end example
  15091. @item
  15092. Rotate the input by PI/6 radians counter-clockwise:
  15093. @example
  15094. rotate=-PI/6
  15095. @end example
  15096. @item
  15097. Rotate the input by 45 degrees clockwise:
  15098. @example
  15099. rotate=45*PI/180
  15100. @end example
  15101. @item
  15102. Apply a constant rotation with period T, starting from an angle of PI/3:
  15103. @example
  15104. rotate=PI/3+2*PI*t/T
  15105. @end example
  15106. @item
  15107. Make the input video rotation oscillating with a period of T
  15108. seconds and an amplitude of A radians:
  15109. @example
  15110. rotate=A*sin(2*PI/T*t)
  15111. @end example
  15112. @item
  15113. Rotate the video, output size is chosen so that the whole rotating
  15114. input video is always completely contained in the output:
  15115. @example
  15116. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  15117. @end example
  15118. @item
  15119. Rotate the video, reduce the output size so that no background is ever
  15120. shown:
  15121. @example
  15122. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  15123. @end example
  15124. @end itemize
  15125. @subsection Commands
  15126. The filter supports the following commands:
  15127. @table @option
  15128. @item a, angle
  15129. Set the angle expression.
  15130. The command accepts the same syntax of the corresponding option.
  15131. If the specified expression is not valid, it is kept at its current
  15132. value.
  15133. @end table
  15134. @section sab
  15135. Apply Shape Adaptive Blur.
  15136. The filter accepts the following options:
  15137. @table @option
  15138. @item luma_radius, lr
  15139. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  15140. value is 1.0. A greater value will result in a more blurred image, and
  15141. in slower processing.
  15142. @item luma_pre_filter_radius, lpfr
  15143. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  15144. value is 1.0.
  15145. @item luma_strength, ls
  15146. Set luma maximum difference between pixels to still be considered, must
  15147. be a value in the 0.1-100.0 range, default value is 1.0.
  15148. @item chroma_radius, cr
  15149. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  15150. greater value will result in a more blurred image, and in slower
  15151. processing.
  15152. @item chroma_pre_filter_radius, cpfr
  15153. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  15154. @item chroma_strength, cs
  15155. Set chroma maximum difference between pixels to still be considered,
  15156. must be a value in the -0.9-100.0 range.
  15157. @end table
  15158. Each chroma option value, if not explicitly specified, is set to the
  15159. corresponding luma option value.
  15160. @anchor{scale}
  15161. @section scale
  15162. Scale (resize) the input video, using the libswscale library.
  15163. The scale filter forces the output display aspect ratio to be the same
  15164. of the input, by changing the output sample aspect ratio.
  15165. If the input image format is different from the format requested by
  15166. the next filter, the scale filter will convert the input to the
  15167. requested format.
  15168. @subsection Options
  15169. The filter accepts the following options, or any of the options
  15170. supported by the libswscale scaler.
  15171. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  15172. the complete list of scaler options.
  15173. @table @option
  15174. @item width, w
  15175. @item height, h
  15176. Set the output video dimension expression. Default value is the input
  15177. dimension.
  15178. If the @var{width} or @var{w} value is 0, the input width is used for
  15179. the output. If the @var{height} or @var{h} value is 0, the input height
  15180. is used for the output.
  15181. If one and only one of the values is -n with n >= 1, the scale filter
  15182. will use a value that maintains the aspect ratio of the input image,
  15183. calculated from the other specified dimension. After that it will,
  15184. however, make sure that the calculated dimension is divisible by n and
  15185. adjust the value if necessary.
  15186. If both values are -n with n >= 1, the behavior will be identical to
  15187. both values being set to 0 as previously detailed.
  15188. See below for the list of accepted constants for use in the dimension
  15189. expression.
  15190. @item eval
  15191. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15192. @table @samp
  15193. @item init
  15194. Only evaluate expressions once during the filter initialization or when a command is processed.
  15195. @item frame
  15196. Evaluate expressions for each incoming frame.
  15197. @end table
  15198. Default value is @samp{init}.
  15199. @item interl
  15200. Set the interlacing mode. It accepts the following values:
  15201. @table @samp
  15202. @item 1
  15203. Force interlaced aware scaling.
  15204. @item 0
  15205. Do not apply interlaced scaling.
  15206. @item -1
  15207. Select interlaced aware scaling depending on whether the source frames
  15208. are flagged as interlaced or not.
  15209. @end table
  15210. Default value is @samp{0}.
  15211. @item flags
  15212. Set libswscale scaling flags. See
  15213. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15214. complete list of values. If not explicitly specified the filter applies
  15215. the default flags.
  15216. @item param0, param1
  15217. Set libswscale input parameters for scaling algorithms that need them. See
  15218. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15219. complete documentation. If not explicitly specified the filter applies
  15220. empty parameters.
  15221. @item size, s
  15222. Set the video size. For the syntax of this option, check the
  15223. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15224. @item in_color_matrix
  15225. @item out_color_matrix
  15226. Set in/output YCbCr color space type.
  15227. This allows the autodetected value to be overridden as well as allows forcing
  15228. a specific value used for the output and encoder.
  15229. If not specified, the color space type depends on the pixel format.
  15230. Possible values:
  15231. @table @samp
  15232. @item auto
  15233. Choose automatically.
  15234. @item bt709
  15235. Format conforming to International Telecommunication Union (ITU)
  15236. Recommendation BT.709.
  15237. @item fcc
  15238. Set color space conforming to the United States Federal Communications
  15239. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  15240. @item bt601
  15241. @item bt470
  15242. @item smpte170m
  15243. Set color space conforming to:
  15244. @itemize
  15245. @item
  15246. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  15247. @item
  15248. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  15249. @item
  15250. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  15251. @end itemize
  15252. @item smpte240m
  15253. Set color space conforming to SMPTE ST 240:1999.
  15254. @item bt2020
  15255. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  15256. @end table
  15257. @item in_range
  15258. @item out_range
  15259. Set in/output YCbCr sample range.
  15260. This allows the autodetected value to be overridden as well as allows forcing
  15261. a specific value used for the output and encoder. If not specified, the
  15262. range depends on the pixel format. Possible values:
  15263. @table @samp
  15264. @item auto/unknown
  15265. Choose automatically.
  15266. @item jpeg/full/pc
  15267. Set full range (0-255 in case of 8-bit luma).
  15268. @item mpeg/limited/tv
  15269. Set "MPEG" range (16-235 in case of 8-bit luma).
  15270. @end table
  15271. @item force_original_aspect_ratio
  15272. Enable decreasing or increasing output video width or height if necessary to
  15273. keep the original aspect ratio. Possible values:
  15274. @table @samp
  15275. @item disable
  15276. Scale the video as specified and disable this feature.
  15277. @item decrease
  15278. The output video dimensions will automatically be decreased if needed.
  15279. @item increase
  15280. The output video dimensions will automatically be increased if needed.
  15281. @end table
  15282. One useful instance of this option is that when you know a specific device's
  15283. maximum allowed resolution, you can use this to limit the output video to
  15284. that, while retaining the aspect ratio. For example, device A allows
  15285. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15286. decrease) and specifying 1280x720 to the command line makes the output
  15287. 1280x533.
  15288. Please note that this is a different thing than specifying -1 for @option{w}
  15289. or @option{h}, you still need to specify the output resolution for this option
  15290. to work.
  15291. @item force_divisible_by
  15292. Ensures that both the output dimensions, width and height, are divisible by the
  15293. given integer when used together with @option{force_original_aspect_ratio}. This
  15294. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15295. This option respects the value set for @option{force_original_aspect_ratio},
  15296. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15297. may be slightly modified.
  15298. This option can be handy if you need to have a video fit within or exceed
  15299. a defined resolution using @option{force_original_aspect_ratio} but also have
  15300. encoder restrictions on width or height divisibility.
  15301. @end table
  15302. The values of the @option{w} and @option{h} options are expressions
  15303. containing the following constants:
  15304. @table @var
  15305. @item in_w
  15306. @item in_h
  15307. The input width and height
  15308. @item iw
  15309. @item ih
  15310. These are the same as @var{in_w} and @var{in_h}.
  15311. @item out_w
  15312. @item out_h
  15313. The output (scaled) width and height
  15314. @item ow
  15315. @item oh
  15316. These are the same as @var{out_w} and @var{out_h}
  15317. @item a
  15318. The same as @var{iw} / @var{ih}
  15319. @item sar
  15320. input sample aspect ratio
  15321. @item dar
  15322. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15323. @item hsub
  15324. @item vsub
  15325. horizontal and vertical input chroma subsample values. For example for the
  15326. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15327. @item ohsub
  15328. @item ovsub
  15329. horizontal and vertical output chroma subsample values. For example for the
  15330. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15331. @item n
  15332. The (sequential) number of the input frame, starting from 0.
  15333. Only available with @code{eval=frame}.
  15334. @item t
  15335. The presentation timestamp of the input frame, expressed as a number of
  15336. seconds. Only available with @code{eval=frame}.
  15337. @item pos
  15338. The position (byte offset) of the frame in the input stream, or NaN if
  15339. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15340. Only available with @code{eval=frame}.
  15341. @end table
  15342. @subsection Examples
  15343. @itemize
  15344. @item
  15345. Scale the input video to a size of 200x100
  15346. @example
  15347. scale=w=200:h=100
  15348. @end example
  15349. This is equivalent to:
  15350. @example
  15351. scale=200:100
  15352. @end example
  15353. or:
  15354. @example
  15355. scale=200x100
  15356. @end example
  15357. @item
  15358. Specify a size abbreviation for the output size:
  15359. @example
  15360. scale=qcif
  15361. @end example
  15362. which can also be written as:
  15363. @example
  15364. scale=size=qcif
  15365. @end example
  15366. @item
  15367. Scale the input to 2x:
  15368. @example
  15369. scale=w=2*iw:h=2*ih
  15370. @end example
  15371. @item
  15372. The above is the same as:
  15373. @example
  15374. scale=2*in_w:2*in_h
  15375. @end example
  15376. @item
  15377. Scale the input to 2x with forced interlaced scaling:
  15378. @example
  15379. scale=2*iw:2*ih:interl=1
  15380. @end example
  15381. @item
  15382. Scale the input to half size:
  15383. @example
  15384. scale=w=iw/2:h=ih/2
  15385. @end example
  15386. @item
  15387. Increase the width, and set the height to the same size:
  15388. @example
  15389. scale=3/2*iw:ow
  15390. @end example
  15391. @item
  15392. Seek Greek harmony:
  15393. @example
  15394. scale=iw:1/PHI*iw
  15395. scale=ih*PHI:ih
  15396. @end example
  15397. @item
  15398. Increase the height, and set the width to 3/2 of the height:
  15399. @example
  15400. scale=w=3/2*oh:h=3/5*ih
  15401. @end example
  15402. @item
  15403. Increase the size, making the size a multiple of the chroma
  15404. subsample values:
  15405. @example
  15406. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  15407. @end example
  15408. @item
  15409. Increase the width to a maximum of 500 pixels,
  15410. keeping the same aspect ratio as the input:
  15411. @example
  15412. scale=w='min(500\, iw*3/2):h=-1'
  15413. @end example
  15414. @item
  15415. Make pixels square by combining scale and setsar:
  15416. @example
  15417. scale='trunc(ih*dar):ih',setsar=1/1
  15418. @end example
  15419. @item
  15420. Make pixels square by combining scale and setsar,
  15421. making sure the resulting resolution is even (required by some codecs):
  15422. @example
  15423. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  15424. @end example
  15425. @end itemize
  15426. @subsection Commands
  15427. This filter supports the following commands:
  15428. @table @option
  15429. @item width, w
  15430. @item height, h
  15431. Set the output video dimension expression.
  15432. The command accepts the same syntax of the corresponding option.
  15433. If the specified expression is not valid, it is kept at its current
  15434. value.
  15435. @end table
  15436. @section scale_cuda
  15437. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  15438. Setting the output width and height works in the same way as for the @ref{scale} filter.
  15439. The filter accepts the following options:
  15440. @table @option
  15441. @item w
  15442. @item h
  15443. Set the output video dimension expression. Default value is the input dimension.
  15444. Allows for the same expressions as the @ref{scale} filter.
  15445. @item interp_algo
  15446. Sets the algorithm used for scaling:
  15447. @table @var
  15448. @item nearest
  15449. Nearest neighbour
  15450. Used by default if input parameters match the desired output.
  15451. @item bilinear
  15452. Bilinear
  15453. @item bicubic
  15454. Bicubic
  15455. This is the default.
  15456. @item lanczos
  15457. Lanczos
  15458. @end table
  15459. @item format
  15460. Controls the output pixel format. By default, or if none is specified, the input
  15461. pixel format is used.
  15462. The filter does not support converting between YUV and RGB pixel formats.
  15463. @item passthrough
  15464. If set to 0, every frame is processed, even if no conversion is neccesary.
  15465. This mode can be useful to use the filter as a buffer for a downstream
  15466. frame-consumer that exhausts the limited decoder frame pool.
  15467. If set to 1, frames are passed through as-is if they match the desired output
  15468. parameters. This is the default behaviour.
  15469. @item param
  15470. Algorithm-Specific parameter.
  15471. Affects the curves of the bicubic algorithm.
  15472. @item force_original_aspect_ratio
  15473. @item force_divisible_by
  15474. Work the same as the identical @ref{scale} filter options.
  15475. @end table
  15476. @subsection Examples
  15477. @itemize
  15478. @item
  15479. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  15480. @example
  15481. scale_cuda=-2:720:format=yuv420p
  15482. @end example
  15483. @item
  15484. Upscale to 4K using nearest neighbour algorithm.
  15485. @example
  15486. scale_cuda=4096:2160:interp_algo=nearest
  15487. @end example
  15488. @item
  15489. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  15490. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  15491. decoders frame pool.
  15492. @example
  15493. scale_cuda=passthrough=0
  15494. @end example
  15495. @end itemize
  15496. @anchor{scale_npp}
  15497. @section scale_npp
  15498. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  15499. format conversion on CUDA video frames. Setting the output width and height
  15500. works in the same way as for the @var{scale} filter.
  15501. The following additional options are accepted:
  15502. @table @option
  15503. @item format
  15504. The pixel format of the output CUDA frames. If set to the string "same" (the
  15505. default), the input format will be kept. Note that automatic format negotiation
  15506. and conversion is not yet supported for hardware frames
  15507. @item interp_algo
  15508. The interpolation algorithm used for resizing. One of the following:
  15509. @table @option
  15510. @item nn
  15511. Nearest neighbour.
  15512. @item linear
  15513. @item cubic
  15514. @item cubic2p_bspline
  15515. 2-parameter cubic (B=1, C=0)
  15516. @item cubic2p_catmullrom
  15517. 2-parameter cubic (B=0, C=1/2)
  15518. @item cubic2p_b05c03
  15519. 2-parameter cubic (B=1/2, C=3/10)
  15520. @item super
  15521. Supersampling
  15522. @item lanczos
  15523. @end table
  15524. @item force_original_aspect_ratio
  15525. Enable decreasing or increasing output video width or height if necessary to
  15526. keep the original aspect ratio. Possible values:
  15527. @table @samp
  15528. @item disable
  15529. Scale the video as specified and disable this feature.
  15530. @item decrease
  15531. The output video dimensions will automatically be decreased if needed.
  15532. @item increase
  15533. The output video dimensions will automatically be increased if needed.
  15534. @end table
  15535. One useful instance of this option is that when you know a specific device's
  15536. maximum allowed resolution, you can use this to limit the output video to
  15537. that, while retaining the aspect ratio. For example, device A allows
  15538. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15539. decrease) and specifying 1280x720 to the command line makes the output
  15540. 1280x533.
  15541. Please note that this is a different thing than specifying -1 for @option{w}
  15542. or @option{h}, you still need to specify the output resolution for this option
  15543. to work.
  15544. @item force_divisible_by
  15545. Ensures that both the output dimensions, width and height, are divisible by the
  15546. given integer when used together with @option{force_original_aspect_ratio}. This
  15547. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15548. This option respects the value set for @option{force_original_aspect_ratio},
  15549. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15550. may be slightly modified.
  15551. This option can be handy if you need to have a video fit within or exceed
  15552. a defined resolution using @option{force_original_aspect_ratio} but also have
  15553. encoder restrictions on width or height divisibility.
  15554. @item eval
  15555. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15556. @table @samp
  15557. @item init
  15558. Only evaluate expressions once during the filter initialization or when a command is processed.
  15559. @item frame
  15560. Evaluate expressions for each incoming frame.
  15561. @end table
  15562. @end table
  15563. The values of the @option{w} and @option{h} options are expressions
  15564. containing the following constants:
  15565. @table @var
  15566. @item in_w
  15567. @item in_h
  15568. The input width and height
  15569. @item iw
  15570. @item ih
  15571. These are the same as @var{in_w} and @var{in_h}.
  15572. @item out_w
  15573. @item out_h
  15574. The output (scaled) width and height
  15575. @item ow
  15576. @item oh
  15577. These are the same as @var{out_w} and @var{out_h}
  15578. @item a
  15579. The same as @var{iw} / @var{ih}
  15580. @item sar
  15581. input sample aspect ratio
  15582. @item dar
  15583. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15584. @item n
  15585. The (sequential) number of the input frame, starting from 0.
  15586. Only available with @code{eval=frame}.
  15587. @item t
  15588. The presentation timestamp of the input frame, expressed as a number of
  15589. seconds. Only available with @code{eval=frame}.
  15590. @item pos
  15591. The position (byte offset) of the frame in the input stream, or NaN if
  15592. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15593. Only available with @code{eval=frame}.
  15594. @end table
  15595. @section scale2ref
  15596. Scale (resize) the input video, based on a reference video.
  15597. See the scale filter for available options, scale2ref supports the same but
  15598. uses the reference video instead of the main input as basis. scale2ref also
  15599. supports the following additional constants for the @option{w} and
  15600. @option{h} options:
  15601. @table @var
  15602. @item main_w
  15603. @item main_h
  15604. The main input video's width and height
  15605. @item main_a
  15606. The same as @var{main_w} / @var{main_h}
  15607. @item main_sar
  15608. The main input video's sample aspect ratio
  15609. @item main_dar, mdar
  15610. The main input video's display aspect ratio. Calculated from
  15611. @code{(main_w / main_h) * main_sar}.
  15612. @item main_hsub
  15613. @item main_vsub
  15614. The main input video's horizontal and vertical chroma subsample values.
  15615. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  15616. is 1.
  15617. @item main_n
  15618. The (sequential) number of the main input frame, starting from 0.
  15619. Only available with @code{eval=frame}.
  15620. @item main_t
  15621. The presentation timestamp of the main input frame, expressed as a number of
  15622. seconds. Only available with @code{eval=frame}.
  15623. @item main_pos
  15624. The position (byte offset) of the frame in the main input stream, or NaN if
  15625. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15626. Only available with @code{eval=frame}.
  15627. @end table
  15628. @subsection Examples
  15629. @itemize
  15630. @item
  15631. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15632. @example
  15633. 'scale2ref[b][a];[a][b]overlay'
  15634. @end example
  15635. @item
  15636. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15637. @example
  15638. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  15639. @end example
  15640. @end itemize
  15641. @subsection Commands
  15642. This filter supports the following commands:
  15643. @table @option
  15644. @item width, w
  15645. @item height, h
  15646. Set the output video dimension expression.
  15647. The command accepts the same syntax of the corresponding option.
  15648. If the specified expression is not valid, it is kept at its current
  15649. value.
  15650. @end table
  15651. @section scale2ref_npp
  15652. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  15653. video, based on a reference video.
  15654. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  15655. but uses the reference video instead of the main input as basis. scale2ref_npp
  15656. also supports the following additional constants for the @option{w} and
  15657. @option{h} options:
  15658. @table @var
  15659. @item main_w
  15660. @item main_h
  15661. The main input video's width and height
  15662. @item main_a
  15663. The same as @var{main_w} / @var{main_h}
  15664. @item main_sar
  15665. The main input video's sample aspect ratio
  15666. @item main_dar, mdar
  15667. The main input video's display aspect ratio. Calculated from
  15668. @code{(main_w / main_h) * main_sar}.
  15669. @item main_n
  15670. The (sequential) number of the main input frame, starting from 0.
  15671. Only available with @code{eval=frame}.
  15672. @item main_t
  15673. The presentation timestamp of the main input frame, expressed as a number of
  15674. seconds. Only available with @code{eval=frame}.
  15675. @item main_pos
  15676. The position (byte offset) of the frame in the main input stream, or NaN if
  15677. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15678. Only available with @code{eval=frame}.
  15679. @end table
  15680. @subsection Examples
  15681. @itemize
  15682. @item
  15683. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15684. @example
  15685. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  15686. @end example
  15687. @item
  15688. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15689. @example
  15690. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  15691. @end example
  15692. @end itemize
  15693. @section scharr
  15694. Apply scharr operator to input video stream.
  15695. The filter accepts the following option:
  15696. @table @option
  15697. @item planes
  15698. Set which planes will be processed, unprocessed planes will be copied.
  15699. By default value 0xf, all planes will be processed.
  15700. @item scale
  15701. Set value which will be multiplied with filtered result.
  15702. @item delta
  15703. Set value which will be added to filtered result.
  15704. @end table
  15705. @subsection Commands
  15706. This filter supports the all above options as @ref{commands}.
  15707. @section scroll
  15708. Scroll input video horizontally and/or vertically by constant speed.
  15709. The filter accepts the following options:
  15710. @table @option
  15711. @item horizontal, h
  15712. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15713. Negative values changes scrolling direction.
  15714. @item vertical, v
  15715. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15716. Negative values changes scrolling direction.
  15717. @item hpos
  15718. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  15719. @item vpos
  15720. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  15721. @end table
  15722. @subsection Commands
  15723. This filter supports the following @ref{commands}:
  15724. @table @option
  15725. @item horizontal, h
  15726. Set the horizontal scrolling speed.
  15727. @item vertical, v
  15728. Set the vertical scrolling speed.
  15729. @end table
  15730. @anchor{scdet}
  15731. @section scdet
  15732. Detect video scene change.
  15733. This filter sets frame metadata with mafd between frame, the scene score, and
  15734. forward the frame to the next filter, so they can use these metadata to detect
  15735. scene change or others.
  15736. In addition, this filter logs a message and sets frame metadata when it detects
  15737. a scene change by @option{threshold}.
  15738. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  15739. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  15740. to detect scene change.
  15741. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  15742. detect scene change with @option{threshold}.
  15743. The filter accepts the following options:
  15744. @table @option
  15745. @item threshold, t
  15746. Set the scene change detection threshold as a percentage of maximum change. Good
  15747. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  15748. @code{[0., 100.]}.
  15749. Default value is @code{10.}.
  15750. @item sc_pass, s
  15751. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  15752. You can enable it if you want to get snapshot of scene change frames only.
  15753. @end table
  15754. @anchor{selectivecolor}
  15755. @section selectivecolor
  15756. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  15757. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  15758. by the "purity" of the color (that is, how saturated it already is).
  15759. This filter is similar to the Adobe Photoshop Selective Color tool.
  15760. The filter accepts the following options:
  15761. @table @option
  15762. @item correction_method
  15763. Select color correction method.
  15764. Available values are:
  15765. @table @samp
  15766. @item absolute
  15767. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  15768. component value).
  15769. @item relative
  15770. Specified adjustments are relative to the original component value.
  15771. @end table
  15772. Default is @code{absolute}.
  15773. @item reds
  15774. Adjustments for red pixels (pixels where the red component is the maximum)
  15775. @item yellows
  15776. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  15777. @item greens
  15778. Adjustments for green pixels (pixels where the green component is the maximum)
  15779. @item cyans
  15780. Adjustments for cyan pixels (pixels where the red component is the minimum)
  15781. @item blues
  15782. Adjustments for blue pixels (pixels where the blue component is the maximum)
  15783. @item magentas
  15784. Adjustments for magenta pixels (pixels where the green component is the minimum)
  15785. @item whites
  15786. Adjustments for white pixels (pixels where all components are greater than 128)
  15787. @item neutrals
  15788. Adjustments for all pixels except pure black and pure white
  15789. @item blacks
  15790. Adjustments for black pixels (pixels where all components are lesser than 128)
  15791. @item psfile
  15792. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  15793. @end table
  15794. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  15795. 4 space separated floating point adjustment values in the [-1,1] range,
  15796. respectively to adjust the amount of cyan, magenta, yellow and black for the
  15797. pixels of its range.
  15798. @subsection Examples
  15799. @itemize
  15800. @item
  15801. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  15802. increase magenta by 27% in blue areas:
  15803. @example
  15804. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  15805. @end example
  15806. @item
  15807. Use a Photoshop selective color preset:
  15808. @example
  15809. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  15810. @end example
  15811. @end itemize
  15812. @anchor{separatefields}
  15813. @section separatefields
  15814. The @code{separatefields} takes a frame-based video input and splits
  15815. each frame into its components fields, producing a new half height clip
  15816. with twice the frame rate and twice the frame count.
  15817. This filter use field-dominance information in frame to decide which
  15818. of each pair of fields to place first in the output.
  15819. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  15820. @section setdar, setsar
  15821. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  15822. output video.
  15823. This is done by changing the specified Sample (aka Pixel) Aspect
  15824. Ratio, according to the following equation:
  15825. @example
  15826. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  15827. @end example
  15828. Keep in mind that the @code{setdar} filter does not modify the pixel
  15829. dimensions of the video frame. Also, the display aspect ratio set by
  15830. this filter may be changed by later filters in the filterchain,
  15831. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  15832. applied.
  15833. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  15834. the filter output video.
  15835. Note that as a consequence of the application of this filter, the
  15836. output display aspect ratio will change according to the equation
  15837. above.
  15838. Keep in mind that the sample aspect ratio set by the @code{setsar}
  15839. filter may be changed by later filters in the filterchain, e.g. if
  15840. another "setsar" or a "setdar" filter is applied.
  15841. It accepts the following parameters:
  15842. @table @option
  15843. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  15844. Set the aspect ratio used by the filter.
  15845. The parameter can be a floating point number string, an expression, or
  15846. a string of the form @var{num}:@var{den}, where @var{num} and
  15847. @var{den} are the numerator and denominator of the aspect ratio. If
  15848. the parameter is not specified, it is assumed the value "0".
  15849. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  15850. should be escaped.
  15851. @item max
  15852. Set the maximum integer value to use for expressing numerator and
  15853. denominator when reducing the expressed aspect ratio to a rational.
  15854. Default value is @code{100}.
  15855. @end table
  15856. The parameter @var{sar} is an expression containing
  15857. the following constants:
  15858. @table @option
  15859. @item E, PI, PHI
  15860. These are approximated values for the mathematical constants e
  15861. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  15862. @item w, h
  15863. The input width and height.
  15864. @item a
  15865. These are the same as @var{w} / @var{h}.
  15866. @item sar
  15867. The input sample aspect ratio.
  15868. @item dar
  15869. The input display aspect ratio. It is the same as
  15870. (@var{w} / @var{h}) * @var{sar}.
  15871. @item hsub, vsub
  15872. Horizontal and vertical chroma subsample values. For example, for the
  15873. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15874. @end table
  15875. @subsection Examples
  15876. @itemize
  15877. @item
  15878. To change the display aspect ratio to 16:9, specify one of the following:
  15879. @example
  15880. setdar=dar=1.77777
  15881. setdar=dar=16/9
  15882. @end example
  15883. @item
  15884. To change the sample aspect ratio to 10:11, specify:
  15885. @example
  15886. setsar=sar=10/11
  15887. @end example
  15888. @item
  15889. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  15890. 1000 in the aspect ratio reduction, use the command:
  15891. @example
  15892. setdar=ratio=16/9:max=1000
  15893. @end example
  15894. @end itemize
  15895. @anchor{setfield}
  15896. @section setfield
  15897. Force field for the output video frame.
  15898. The @code{setfield} filter marks the interlace type field for the
  15899. output frames. It does not change the input frame, but only sets the
  15900. corresponding property, which affects how the frame is treated by
  15901. following filters (e.g. @code{fieldorder} or @code{yadif}).
  15902. The filter accepts the following options:
  15903. @table @option
  15904. @item mode
  15905. Available values are:
  15906. @table @samp
  15907. @item auto
  15908. Keep the same field property.
  15909. @item bff
  15910. Mark the frame as bottom-field-first.
  15911. @item tff
  15912. Mark the frame as top-field-first.
  15913. @item prog
  15914. Mark the frame as progressive.
  15915. @end table
  15916. @end table
  15917. @anchor{setparams}
  15918. @section setparams
  15919. Force frame parameter for the output video frame.
  15920. The @code{setparams} filter marks interlace and color range for the
  15921. output frames. It does not change the input frame, but only sets the
  15922. corresponding property, which affects how the frame is treated by
  15923. filters/encoders.
  15924. @table @option
  15925. @item field_mode
  15926. Available values are:
  15927. @table @samp
  15928. @item auto
  15929. Keep the same field property (default).
  15930. @item bff
  15931. Mark the frame as bottom-field-first.
  15932. @item tff
  15933. Mark the frame as top-field-first.
  15934. @item prog
  15935. Mark the frame as progressive.
  15936. @end table
  15937. @item range
  15938. Available values are:
  15939. @table @samp
  15940. @item auto
  15941. Keep the same color range property (default).
  15942. @item unspecified, unknown
  15943. Mark the frame as unspecified color range.
  15944. @item limited, tv, mpeg
  15945. Mark the frame as limited range.
  15946. @item full, pc, jpeg
  15947. Mark the frame as full range.
  15948. @end table
  15949. @item color_primaries
  15950. Set the color primaries.
  15951. Available values are:
  15952. @table @samp
  15953. @item auto
  15954. Keep the same color primaries property (default).
  15955. @item bt709
  15956. @item unknown
  15957. @item bt470m
  15958. @item bt470bg
  15959. @item smpte170m
  15960. @item smpte240m
  15961. @item film
  15962. @item bt2020
  15963. @item smpte428
  15964. @item smpte431
  15965. @item smpte432
  15966. @item jedec-p22
  15967. @end table
  15968. @item color_trc
  15969. Set the color transfer.
  15970. Available values are:
  15971. @table @samp
  15972. @item auto
  15973. Keep the same color trc property (default).
  15974. @item bt709
  15975. @item unknown
  15976. @item bt470m
  15977. @item bt470bg
  15978. @item smpte170m
  15979. @item smpte240m
  15980. @item linear
  15981. @item log100
  15982. @item log316
  15983. @item iec61966-2-4
  15984. @item bt1361e
  15985. @item iec61966-2-1
  15986. @item bt2020-10
  15987. @item bt2020-12
  15988. @item smpte2084
  15989. @item smpte428
  15990. @item arib-std-b67
  15991. @end table
  15992. @item colorspace
  15993. Set the colorspace.
  15994. Available values are:
  15995. @table @samp
  15996. @item auto
  15997. Keep the same colorspace property (default).
  15998. @item gbr
  15999. @item bt709
  16000. @item unknown
  16001. @item fcc
  16002. @item bt470bg
  16003. @item smpte170m
  16004. @item smpte240m
  16005. @item ycgco
  16006. @item bt2020nc
  16007. @item bt2020c
  16008. @item smpte2085
  16009. @item chroma-derived-nc
  16010. @item chroma-derived-c
  16011. @item ictcp
  16012. @end table
  16013. @end table
  16014. @section sharpen_npp
  16015. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  16016. border control.
  16017. The following additional options are accepted:
  16018. @table @option
  16019. @item border_type
  16020. Type of sampling to be used ad frame borders. One of the following:
  16021. @table @option
  16022. @item replicate
  16023. Replicate pixel values.
  16024. @end table
  16025. @end table
  16026. @section shear
  16027. Apply shear transform to input video.
  16028. This filter supports the following options:
  16029. @table @option
  16030. @item shx
  16031. Shear factor in X-direction. Default value is 0.
  16032. Allowed range is from -2 to 2.
  16033. @item shy
  16034. Shear factor in Y-direction. Default value is 0.
  16035. Allowed range is from -2 to 2.
  16036. @item fillcolor, c
  16037. Set the color used to fill the output area not covered by the transformed
  16038. video. For the general syntax of this option, check the
  16039. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16040. If the special value "none" is selected then no
  16041. background is printed (useful for example if the background is never shown).
  16042. Default value is "black".
  16043. @item interp
  16044. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  16045. @end table
  16046. @subsection Commands
  16047. This filter supports the all above options as @ref{commands}.
  16048. @section showinfo
  16049. Show a line containing various information for each input video frame.
  16050. The input video is not modified.
  16051. This filter supports the following options:
  16052. @table @option
  16053. @item checksum
  16054. Calculate checksums of each plane. By default enabled.
  16055. @end table
  16056. The shown line contains a sequence of key/value pairs of the form
  16057. @var{key}:@var{value}.
  16058. The following values are shown in the output:
  16059. @table @option
  16060. @item n
  16061. The (sequential) number of the input frame, starting from 0.
  16062. @item pts
  16063. The Presentation TimeStamp of the input frame, expressed as a number of
  16064. time base units. The time base unit depends on the filter input pad.
  16065. @item pts_time
  16066. The Presentation TimeStamp of the input frame, expressed as a number of
  16067. seconds.
  16068. @item pos
  16069. The position of the frame in the input stream, or -1 if this information is
  16070. unavailable and/or meaningless (for example in case of synthetic video).
  16071. @item fmt
  16072. The pixel format name.
  16073. @item sar
  16074. The sample aspect ratio of the input frame, expressed in the form
  16075. @var{num}/@var{den}.
  16076. @item s
  16077. The size of the input frame. For the syntax of this option, check the
  16078. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16079. @item i
  16080. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  16081. for bottom field first).
  16082. @item iskey
  16083. This is 1 if the frame is a key frame, 0 otherwise.
  16084. @item type
  16085. The picture type of the input frame ("I" for an I-frame, "P" for a
  16086. P-frame, "B" for a B-frame, or "?" for an unknown type).
  16087. Also refer to the documentation of the @code{AVPictureType} enum and of
  16088. the @code{av_get_picture_type_char} function defined in
  16089. @file{libavutil/avutil.h}.
  16090. @item checksum
  16091. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  16092. @item plane_checksum
  16093. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  16094. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  16095. @item mean
  16096. The mean value of pixels in each plane of the input frame, expressed in the form
  16097. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  16098. @item stdev
  16099. The standard deviation of pixel values in each plane of the input frame, expressed
  16100. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  16101. @end table
  16102. @section showpalette
  16103. Displays the 256 colors palette of each frame. This filter is only relevant for
  16104. @var{pal8} pixel format frames.
  16105. It accepts the following option:
  16106. @table @option
  16107. @item s
  16108. Set the size of the box used to represent one palette color entry. Default is
  16109. @code{30} (for a @code{30x30} pixel box).
  16110. @end table
  16111. @section shuffleframes
  16112. Reorder and/or duplicate and/or drop video frames.
  16113. It accepts the following parameters:
  16114. @table @option
  16115. @item mapping
  16116. Set the destination indexes of input frames.
  16117. This is space or '|' separated list of indexes that maps input frames to output
  16118. frames. Number of indexes also sets maximal value that each index may have.
  16119. '-1' index have special meaning and that is to drop frame.
  16120. @end table
  16121. The first frame has the index 0. The default is to keep the input unchanged.
  16122. @subsection Examples
  16123. @itemize
  16124. @item
  16125. Swap second and third frame of every three frames of the input:
  16126. @example
  16127. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  16128. @end example
  16129. @item
  16130. Swap 10th and 1st frame of every ten frames of the input:
  16131. @example
  16132. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  16133. @end example
  16134. @end itemize
  16135. @section shufflepixels
  16136. Reorder pixels in video frames.
  16137. This filter accepts the following options:
  16138. @table @option
  16139. @item direction, d
  16140. Set shuffle direction. Can be forward or inverse direction.
  16141. Default direction is forward.
  16142. @item mode, m
  16143. Set shuffle mode. Can be horizontal, vertical or block mode.
  16144. @item width, w
  16145. @item height, h
  16146. Set shuffle block_size. In case of horizontal shuffle mode only width
  16147. part of size is used, and in case of vertical shuffle mode only height
  16148. part of size is used.
  16149. @item seed, s
  16150. Set random seed used with shuffling pixels. Mainly useful to set to be able
  16151. to reverse filtering process to get original input.
  16152. For example, to reverse forward shuffle you need to use same parameters
  16153. and exact same seed and to set direction to inverse.
  16154. @end table
  16155. @section shuffleplanes
  16156. Reorder and/or duplicate video planes.
  16157. It accepts the following parameters:
  16158. @table @option
  16159. @item map0
  16160. The index of the input plane to be used as the first output plane.
  16161. @item map1
  16162. The index of the input plane to be used as the second output plane.
  16163. @item map2
  16164. The index of the input plane to be used as the third output plane.
  16165. @item map3
  16166. The index of the input plane to be used as the fourth output plane.
  16167. @end table
  16168. The first plane has the index 0. The default is to keep the input unchanged.
  16169. @subsection Examples
  16170. @itemize
  16171. @item
  16172. Swap the second and third planes of the input:
  16173. @example
  16174. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  16175. @end example
  16176. @end itemize
  16177. @anchor{signalstats}
  16178. @section signalstats
  16179. Evaluate various visual metrics that assist in determining issues associated
  16180. with the digitization of analog video media.
  16181. By default the filter will log these metadata values:
  16182. @table @option
  16183. @item YMIN
  16184. Display the minimal Y value contained within the input frame. Expressed in
  16185. range of [0-255].
  16186. @item YLOW
  16187. Display the Y value at the 10% percentile within the input frame. Expressed in
  16188. range of [0-255].
  16189. @item YAVG
  16190. Display the average Y value within the input frame. Expressed in range of
  16191. [0-255].
  16192. @item YHIGH
  16193. Display the Y value at the 90% percentile within the input frame. Expressed in
  16194. range of [0-255].
  16195. @item YMAX
  16196. Display the maximum Y value contained within the input frame. Expressed in
  16197. range of [0-255].
  16198. @item UMIN
  16199. Display the minimal U value contained within the input frame. Expressed in
  16200. range of [0-255].
  16201. @item ULOW
  16202. Display the U value at the 10% percentile within the input frame. Expressed in
  16203. range of [0-255].
  16204. @item UAVG
  16205. Display the average U value within the input frame. Expressed in range of
  16206. [0-255].
  16207. @item UHIGH
  16208. Display the U value at the 90% percentile within the input frame. Expressed in
  16209. range of [0-255].
  16210. @item UMAX
  16211. Display the maximum U value contained within the input frame. Expressed in
  16212. range of [0-255].
  16213. @item VMIN
  16214. Display the minimal V value contained within the input frame. Expressed in
  16215. range of [0-255].
  16216. @item VLOW
  16217. Display the V value at the 10% percentile within the input frame. Expressed in
  16218. range of [0-255].
  16219. @item VAVG
  16220. Display the average V value within the input frame. Expressed in range of
  16221. [0-255].
  16222. @item VHIGH
  16223. Display the V value at the 90% percentile within the input frame. Expressed in
  16224. range of [0-255].
  16225. @item VMAX
  16226. Display the maximum V value contained within the input frame. Expressed in
  16227. range of [0-255].
  16228. @item SATMIN
  16229. Display the minimal saturation value contained within the input frame.
  16230. Expressed in range of [0-~181.02].
  16231. @item SATLOW
  16232. Display the saturation value at the 10% percentile within the input frame.
  16233. Expressed in range of [0-~181.02].
  16234. @item SATAVG
  16235. Display the average saturation value within the input frame. Expressed in range
  16236. of [0-~181.02].
  16237. @item SATHIGH
  16238. Display the saturation value at the 90% percentile within the input frame.
  16239. Expressed in range of [0-~181.02].
  16240. @item SATMAX
  16241. Display the maximum saturation value contained within the input frame.
  16242. Expressed in range of [0-~181.02].
  16243. @item HUEMED
  16244. Display the median value for hue within the input frame. Expressed in range of
  16245. [0-360].
  16246. @item HUEAVG
  16247. Display the average value for hue within the input frame. Expressed in range of
  16248. [0-360].
  16249. @item YDIF
  16250. Display the average of sample value difference between all values of the Y
  16251. plane in the current frame and corresponding values of the previous input frame.
  16252. Expressed in range of [0-255].
  16253. @item UDIF
  16254. Display the average of sample value difference between all values of the U
  16255. plane in the current frame and corresponding values of the previous input frame.
  16256. Expressed in range of [0-255].
  16257. @item VDIF
  16258. Display the average of sample value difference between all values of the V
  16259. plane in the current frame and corresponding values of the previous input frame.
  16260. Expressed in range of [0-255].
  16261. @item YBITDEPTH
  16262. Display bit depth of Y plane in current frame.
  16263. Expressed in range of [0-16].
  16264. @item UBITDEPTH
  16265. Display bit depth of U plane in current frame.
  16266. Expressed in range of [0-16].
  16267. @item VBITDEPTH
  16268. Display bit depth of V plane in current frame.
  16269. Expressed in range of [0-16].
  16270. @end table
  16271. The filter accepts the following options:
  16272. @table @option
  16273. @item stat
  16274. @item out
  16275. @option{stat} specify an additional form of image analysis.
  16276. @option{out} output video with the specified type of pixel highlighted.
  16277. Both options accept the following values:
  16278. @table @samp
  16279. @item tout
  16280. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  16281. unlike the neighboring pixels of the same field. Examples of temporal outliers
  16282. include the results of video dropouts, head clogs, or tape tracking issues.
  16283. @item vrep
  16284. Identify @var{vertical line repetition}. Vertical line repetition includes
  16285. similar rows of pixels within a frame. In born-digital video vertical line
  16286. repetition is common, but this pattern is uncommon in video digitized from an
  16287. analog source. When it occurs in video that results from the digitization of an
  16288. analog source it can indicate concealment from a dropout compensator.
  16289. @item brng
  16290. Identify pixels that fall outside of legal broadcast range.
  16291. @end table
  16292. @item color, c
  16293. Set the highlight color for the @option{out} option. The default color is
  16294. yellow.
  16295. @end table
  16296. @subsection Examples
  16297. @itemize
  16298. @item
  16299. Output data of various video metrics:
  16300. @example
  16301. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  16302. @end example
  16303. @item
  16304. Output specific data about the minimum and maximum values of the Y plane per frame:
  16305. @example
  16306. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  16307. @end example
  16308. @item
  16309. Playback video while highlighting pixels that are outside of broadcast range in red.
  16310. @example
  16311. ffplay example.mov -vf signalstats="out=brng:color=red"
  16312. @end example
  16313. @item
  16314. Playback video with signalstats metadata drawn over the frame.
  16315. @example
  16316. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  16317. @end example
  16318. The contents of signalstat_drawtext.txt used in the command are:
  16319. @example
  16320. time %@{pts:hms@}
  16321. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  16322. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  16323. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  16324. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  16325. @end example
  16326. @end itemize
  16327. @anchor{signature}
  16328. @section signature
  16329. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  16330. input. In this case the matching between the inputs can be calculated additionally.
  16331. The filter always passes through the first input. The signature of each stream can
  16332. be written into a file.
  16333. It accepts the following options:
  16334. @table @option
  16335. @item detectmode
  16336. Enable or disable the matching process.
  16337. Available values are:
  16338. @table @samp
  16339. @item off
  16340. Disable the calculation of a matching (default).
  16341. @item full
  16342. Calculate the matching for the whole video and output whether the whole video
  16343. matches or only parts.
  16344. @item fast
  16345. Calculate only until a matching is found or the video ends. Should be faster in
  16346. some cases.
  16347. @end table
  16348. @item nb_inputs
  16349. Set the number of inputs. The option value must be a non negative integer.
  16350. Default value is 1.
  16351. @item filename
  16352. Set the path to which the output is written. If there is more than one input,
  16353. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  16354. integer), that will be replaced with the input number. If no filename is
  16355. specified, no output will be written. This is the default.
  16356. @item format
  16357. Choose the output format.
  16358. Available values are:
  16359. @table @samp
  16360. @item binary
  16361. Use the specified binary representation (default).
  16362. @item xml
  16363. Use the specified xml representation.
  16364. @end table
  16365. @item th_d
  16366. Set threshold to detect one word as similar. The option value must be an integer
  16367. greater than zero. The default value is 9000.
  16368. @item th_dc
  16369. Set threshold to detect all words as similar. The option value must be an integer
  16370. greater than zero. The default value is 60000.
  16371. @item th_xh
  16372. Set threshold to detect frames as similar. The option value must be an integer
  16373. greater than zero. The default value is 116.
  16374. @item th_di
  16375. Set the minimum length of a sequence in frames to recognize it as matching
  16376. sequence. The option value must be a non negative integer value.
  16377. The default value is 0.
  16378. @item th_it
  16379. Set the minimum relation, that matching frames to all frames must have.
  16380. The option value must be a double value between 0 and 1. The default value is 0.5.
  16381. @end table
  16382. @subsection Examples
  16383. @itemize
  16384. @item
  16385. To calculate the signature of an input video and store it in signature.bin:
  16386. @example
  16387. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  16388. @end example
  16389. @item
  16390. To detect whether two videos match and store the signatures in XML format in
  16391. signature0.xml and signature1.xml:
  16392. @example
  16393. 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 -
  16394. @end example
  16395. @end itemize
  16396. @anchor{siti}
  16397. @section siti
  16398. Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as defined
  16399. in ITU-T P.910: Subjective video quality assessment methods for multimedia
  16400. applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
  16401. It accepts the following option:
  16402. @table @option
  16403. @item print_summary
  16404. If set to 1, Summary statistics will be printed to the console. Default 0.
  16405. @end table
  16406. @subsection Examples
  16407. @itemize
  16408. @item
  16409. To calculate SI/TI metrics and print summary:
  16410. @example
  16411. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  16412. @end example
  16413. @end itemize
  16414. @anchor{smartblur}
  16415. @section smartblur
  16416. Blur the input video without impacting the outlines.
  16417. It accepts the following options:
  16418. @table @option
  16419. @item luma_radius, lr
  16420. Set the luma radius. The option value must be a float number in
  16421. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16422. used to blur the image (slower if larger). Default value is 1.0.
  16423. @item luma_strength, ls
  16424. Set the luma strength. The option value must be a float number
  16425. in the range [-1.0,1.0] that configures the blurring. A value included
  16426. in [0.0,1.0] will blur the image whereas a value included in
  16427. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  16428. @item luma_threshold, lt
  16429. Set the luma threshold used as a coefficient to determine
  16430. whether a pixel should be blurred or not. The option value must be an
  16431. integer in the range [-30,30]. A value of 0 will filter all the image,
  16432. a value included in [0,30] will filter flat areas and a value included
  16433. in [-30,0] will filter edges. Default value is 0.
  16434. @item chroma_radius, cr
  16435. Set the chroma radius. The option value must be a float number in
  16436. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16437. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  16438. @item chroma_strength, cs
  16439. Set the chroma strength. The option value must be a float number
  16440. in the range [-1.0,1.0] that configures the blurring. A value included
  16441. in [0.0,1.0] will blur the image whereas a value included in
  16442. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  16443. @item chroma_threshold, ct
  16444. Set the chroma threshold used as a coefficient to determine
  16445. whether a pixel should be blurred or not. The option value must be an
  16446. integer in the range [-30,30]. A value of 0 will filter all the image,
  16447. a value included in [0,30] will filter flat areas and a value included
  16448. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  16449. @end table
  16450. If a chroma option is not explicitly set, the corresponding luma value
  16451. is set.
  16452. @section sobel
  16453. Apply sobel operator to input video stream.
  16454. The filter accepts the following option:
  16455. @table @option
  16456. @item planes
  16457. Set which planes will be processed, unprocessed planes will be copied.
  16458. By default value 0xf, all planes will be processed.
  16459. @item scale
  16460. Set value which will be multiplied with filtered result.
  16461. @item delta
  16462. Set value which will be added to filtered result.
  16463. @end table
  16464. @subsection Commands
  16465. This filter supports the all above options as @ref{commands}.
  16466. @anchor{spp}
  16467. @section spp
  16468. Apply a simple postprocessing filter that compresses and decompresses the image
  16469. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  16470. and average the results.
  16471. The filter accepts the following options:
  16472. @table @option
  16473. @item quality
  16474. Set quality. This option defines the number of levels for averaging. It accepts
  16475. an integer in the range 0-6. If set to @code{0}, the filter will have no
  16476. effect. A value of @code{6} means the higher quality. For each increment of
  16477. that value the speed drops by a factor of approximately 2. Default value is
  16478. @code{3}.
  16479. @item qp
  16480. Force a constant quantization parameter. If not set, the filter will use the QP
  16481. from the video stream (if available).
  16482. @item mode
  16483. Set thresholding mode. Available modes are:
  16484. @table @samp
  16485. @item hard
  16486. Set hard thresholding (default).
  16487. @item soft
  16488. Set soft thresholding (better de-ringing effect, but likely blurrier).
  16489. @end table
  16490. @item use_bframe_qp
  16491. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  16492. option may cause flicker since the B-Frames have often larger QP. Default is
  16493. @code{0} (not enabled).
  16494. @end table
  16495. @subsection Commands
  16496. This filter supports the following commands:
  16497. @table @option
  16498. @item quality, level
  16499. Set quality level. The value @code{max} can be used to set the maximum level,
  16500. currently @code{6}.
  16501. @end table
  16502. @anchor{sr}
  16503. @section sr
  16504. Scale the input by applying one of the super-resolution methods based on
  16505. convolutional neural networks. Supported models:
  16506. @itemize
  16507. @item
  16508. Super-Resolution Convolutional Neural Network model (SRCNN).
  16509. See @url{https://arxiv.org/abs/1501.00092}.
  16510. @item
  16511. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  16512. See @url{https://arxiv.org/abs/1609.05158}.
  16513. @end itemize
  16514. Training scripts as well as scripts for model file (.pb) saving can be found at
  16515. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  16516. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  16517. Native model files (.model) can be generated from TensorFlow model
  16518. files (.pb) by using tools/python/convert.py
  16519. The filter accepts the following options:
  16520. @table @option
  16521. @item dnn_backend
  16522. Specify which DNN backend to use for model loading and execution. This option accepts
  16523. the following values:
  16524. @table @samp
  16525. @item native
  16526. Native implementation of DNN loading and execution.
  16527. @item tensorflow
  16528. TensorFlow backend. To enable this backend you
  16529. need to install the TensorFlow for C library (see
  16530. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  16531. @code{--enable-libtensorflow}
  16532. @end table
  16533. Default value is @samp{native}.
  16534. @item model
  16535. Set path to model file specifying network architecture and its parameters.
  16536. Note that different backends use different file formats. TensorFlow backend
  16537. can load files for both formats, while native backend can load files for only
  16538. its format.
  16539. @item scale_factor
  16540. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  16541. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  16542. input upscaled using bicubic upscaling with proper scale factor.
  16543. @end table
  16544. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  16545. @section ssim
  16546. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  16547. This filter takes in input two input videos, the first input is
  16548. considered the "main" source and is passed unchanged to the
  16549. output. The second input is used as a "reference" video for computing
  16550. the SSIM.
  16551. Both video inputs must have the same resolution and pixel format for
  16552. this filter to work correctly. Also it assumes that both inputs
  16553. have the same number of frames, which are compared one by one.
  16554. The filter stores the calculated SSIM of each frame.
  16555. The description of the accepted parameters follows.
  16556. @table @option
  16557. @item stats_file, f
  16558. If specified the filter will use the named file to save the SSIM of
  16559. each individual frame. When filename equals "-" the data is sent to
  16560. standard output.
  16561. @end table
  16562. The file printed if @var{stats_file} is selected, contains a sequence of
  16563. key/value pairs of the form @var{key}:@var{value} for each compared
  16564. couple of frames.
  16565. A description of each shown parameter follows:
  16566. @table @option
  16567. @item n
  16568. sequential number of the input frame, starting from 1
  16569. @item Y, U, V, R, G, B
  16570. SSIM of the compared frames for the component specified by the suffix.
  16571. @item All
  16572. SSIM of the compared frames for the whole frame.
  16573. @item dB
  16574. Same as above but in dB representation.
  16575. @end table
  16576. This filter also supports the @ref{framesync} options.
  16577. @subsection Examples
  16578. @itemize
  16579. @item
  16580. For example:
  16581. @example
  16582. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  16583. [main][ref] ssim="stats_file=stats.log" [out]
  16584. @end example
  16585. On this example the input file being processed is compared with the
  16586. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  16587. is stored in @file{stats.log}.
  16588. @item
  16589. Another example with both psnr and ssim at same time:
  16590. @example
  16591. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  16592. @end example
  16593. @item
  16594. Another example with different containers:
  16595. @example
  16596. 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 -
  16597. @end example
  16598. @end itemize
  16599. @section stereo3d
  16600. Convert between different stereoscopic image formats.
  16601. The filters accept the following options:
  16602. @table @option
  16603. @item in
  16604. Set stereoscopic image format of input.
  16605. Available values for input image formats are:
  16606. @table @samp
  16607. @item sbsl
  16608. side by side parallel (left eye left, right eye right)
  16609. @item sbsr
  16610. side by side crosseye (right eye left, left eye right)
  16611. @item sbs2l
  16612. side by side parallel with half width resolution
  16613. (left eye left, right eye right)
  16614. @item sbs2r
  16615. side by side crosseye with half width resolution
  16616. (right eye left, left eye right)
  16617. @item abl
  16618. @item tbl
  16619. above-below (left eye above, right eye below)
  16620. @item abr
  16621. @item tbr
  16622. above-below (right eye above, left eye below)
  16623. @item ab2l
  16624. @item tb2l
  16625. above-below with half height resolution
  16626. (left eye above, right eye below)
  16627. @item ab2r
  16628. @item tb2r
  16629. above-below with half height resolution
  16630. (right eye above, left eye below)
  16631. @item al
  16632. alternating frames (left eye first, right eye second)
  16633. @item ar
  16634. alternating frames (right eye first, left eye second)
  16635. @item irl
  16636. interleaved rows (left eye has top row, right eye starts on next row)
  16637. @item irr
  16638. interleaved rows (right eye has top row, left eye starts on next row)
  16639. @item icl
  16640. interleaved columns, left eye first
  16641. @item icr
  16642. interleaved columns, right eye first
  16643. Default value is @samp{sbsl}.
  16644. @end table
  16645. @item out
  16646. Set stereoscopic image format of output.
  16647. @table @samp
  16648. @item sbsl
  16649. side by side parallel (left eye left, right eye right)
  16650. @item sbsr
  16651. side by side crosseye (right eye left, left eye right)
  16652. @item sbs2l
  16653. side by side parallel with half width resolution
  16654. (left eye left, right eye right)
  16655. @item sbs2r
  16656. side by side crosseye with half width resolution
  16657. (right eye left, left eye right)
  16658. @item abl
  16659. @item tbl
  16660. above-below (left eye above, right eye below)
  16661. @item abr
  16662. @item tbr
  16663. above-below (right eye above, left eye below)
  16664. @item ab2l
  16665. @item tb2l
  16666. above-below with half height resolution
  16667. (left eye above, right eye below)
  16668. @item ab2r
  16669. @item tb2r
  16670. above-below with half height resolution
  16671. (right eye above, left eye below)
  16672. @item al
  16673. alternating frames (left eye first, right eye second)
  16674. @item ar
  16675. alternating frames (right eye first, left eye second)
  16676. @item irl
  16677. interleaved rows (left eye has top row, right eye starts on next row)
  16678. @item irr
  16679. interleaved rows (right eye has top row, left eye starts on next row)
  16680. @item arbg
  16681. anaglyph red/blue gray
  16682. (red filter on left eye, blue filter on right eye)
  16683. @item argg
  16684. anaglyph red/green gray
  16685. (red filter on left eye, green filter on right eye)
  16686. @item arcg
  16687. anaglyph red/cyan gray
  16688. (red filter on left eye, cyan filter on right eye)
  16689. @item arch
  16690. anaglyph red/cyan half colored
  16691. (red filter on left eye, cyan filter on right eye)
  16692. @item arcc
  16693. anaglyph red/cyan color
  16694. (red filter on left eye, cyan filter on right eye)
  16695. @item arcd
  16696. anaglyph red/cyan color optimized with the least squares projection of dubois
  16697. (red filter on left eye, cyan filter on right eye)
  16698. @item agmg
  16699. anaglyph green/magenta gray
  16700. (green filter on left eye, magenta filter on right eye)
  16701. @item agmh
  16702. anaglyph green/magenta half colored
  16703. (green filter on left eye, magenta filter on right eye)
  16704. @item agmc
  16705. anaglyph green/magenta colored
  16706. (green filter on left eye, magenta filter on right eye)
  16707. @item agmd
  16708. anaglyph green/magenta color optimized with the least squares projection of dubois
  16709. (green filter on left eye, magenta filter on right eye)
  16710. @item aybg
  16711. anaglyph yellow/blue gray
  16712. (yellow filter on left eye, blue filter on right eye)
  16713. @item aybh
  16714. anaglyph yellow/blue half colored
  16715. (yellow filter on left eye, blue filter on right eye)
  16716. @item aybc
  16717. anaglyph yellow/blue colored
  16718. (yellow filter on left eye, blue filter on right eye)
  16719. @item aybd
  16720. anaglyph yellow/blue color optimized with the least squares projection of dubois
  16721. (yellow filter on left eye, blue filter on right eye)
  16722. @item ml
  16723. mono output (left eye only)
  16724. @item mr
  16725. mono output (right eye only)
  16726. @item chl
  16727. checkerboard, left eye first
  16728. @item chr
  16729. checkerboard, right eye first
  16730. @item icl
  16731. interleaved columns, left eye first
  16732. @item icr
  16733. interleaved columns, right eye first
  16734. @item hdmi
  16735. HDMI frame pack
  16736. @end table
  16737. Default value is @samp{arcd}.
  16738. @end table
  16739. @subsection Examples
  16740. @itemize
  16741. @item
  16742. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  16743. @example
  16744. stereo3d=sbsl:aybd
  16745. @end example
  16746. @item
  16747. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  16748. @example
  16749. stereo3d=abl:sbsr
  16750. @end example
  16751. @end itemize
  16752. @section streamselect, astreamselect
  16753. Select video or audio streams.
  16754. The filter accepts the following options:
  16755. @table @option
  16756. @item inputs
  16757. Set number of inputs. Default is 2.
  16758. @item map
  16759. Set input indexes to remap to outputs.
  16760. @end table
  16761. @subsection Commands
  16762. The @code{streamselect} and @code{astreamselect} filter supports the following
  16763. commands:
  16764. @table @option
  16765. @item map
  16766. Set input indexes to remap to outputs.
  16767. @end table
  16768. @subsection Examples
  16769. @itemize
  16770. @item
  16771. Select first 5 seconds 1st stream and rest of time 2nd stream:
  16772. @example
  16773. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  16774. @end example
  16775. @item
  16776. Same as above, but for audio:
  16777. @example
  16778. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  16779. @end example
  16780. @end itemize
  16781. @anchor{subtitles}
  16782. @section subtitles
  16783. Draw subtitles on top of input video using the libass library.
  16784. To enable compilation of this filter you need to configure FFmpeg with
  16785. @code{--enable-libass}. This filter also requires a build with libavcodec and
  16786. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  16787. Alpha) subtitles format.
  16788. The filter accepts the following options:
  16789. @table @option
  16790. @item filename, f
  16791. Set the filename of the subtitle file to read. It must be specified.
  16792. @item original_size
  16793. Specify the size of the original video, the video for which the ASS file
  16794. was composed. For the syntax of this option, check the
  16795. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16796. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  16797. correctly scale the fonts if the aspect ratio has been changed.
  16798. @item fontsdir
  16799. Set a directory path containing fonts that can be used by the filter.
  16800. These fonts will be used in addition to whatever the font provider uses.
  16801. @item alpha
  16802. Process alpha channel, by default alpha channel is untouched.
  16803. @item charenc
  16804. Set subtitles input character encoding. @code{subtitles} filter only. Only
  16805. useful if not UTF-8.
  16806. @item stream_index, si
  16807. Set subtitles stream index. @code{subtitles} filter only.
  16808. @item force_style
  16809. Override default style or script info parameters of the subtitles. It accepts a
  16810. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  16811. @end table
  16812. If the first key is not specified, it is assumed that the first value
  16813. specifies the @option{filename}.
  16814. For example, to render the file @file{sub.srt} on top of the input
  16815. video, use the command:
  16816. @example
  16817. subtitles=sub.srt
  16818. @end example
  16819. which is equivalent to:
  16820. @example
  16821. subtitles=filename=sub.srt
  16822. @end example
  16823. To render the default subtitles stream from file @file{video.mkv}, use:
  16824. @example
  16825. subtitles=video.mkv
  16826. @end example
  16827. To render the second subtitles stream from that file, use:
  16828. @example
  16829. subtitles=video.mkv:si=1
  16830. @end example
  16831. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  16832. @code{DejaVu Serif}, use:
  16833. @example
  16834. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  16835. @end example
  16836. @section super2xsai
  16837. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  16838. Interpolate) pixel art scaling algorithm.
  16839. Useful for enlarging pixel art images without reducing sharpness.
  16840. @section swaprect
  16841. Swap two rectangular objects in video.
  16842. This filter accepts the following options:
  16843. @table @option
  16844. @item w
  16845. Set object width.
  16846. @item h
  16847. Set object height.
  16848. @item x1
  16849. Set 1st rect x coordinate.
  16850. @item y1
  16851. Set 1st rect y coordinate.
  16852. @item x2
  16853. Set 2nd rect x coordinate.
  16854. @item y2
  16855. Set 2nd rect y coordinate.
  16856. All expressions are evaluated once for each frame.
  16857. @end table
  16858. The all options are expressions containing the following constants:
  16859. @table @option
  16860. @item w
  16861. @item h
  16862. The input width and height.
  16863. @item a
  16864. same as @var{w} / @var{h}
  16865. @item sar
  16866. input sample aspect ratio
  16867. @item dar
  16868. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  16869. @item n
  16870. The number of the input frame, starting from 0.
  16871. @item t
  16872. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16873. @item pos
  16874. the position in the file of the input frame, NAN if unknown
  16875. @end table
  16876. @subsection Commands
  16877. This filter supports the all above options as @ref{commands}.
  16878. @section swapuv
  16879. Swap U & V plane.
  16880. @section tblend
  16881. Blend successive video frames.
  16882. See @ref{blend}
  16883. @section telecine
  16884. Apply telecine process to the video.
  16885. This filter accepts the following options:
  16886. @table @option
  16887. @item first_field
  16888. @table @samp
  16889. @item top, t
  16890. top field first
  16891. @item bottom, b
  16892. bottom field first
  16893. The default value is @code{top}.
  16894. @end table
  16895. @item pattern
  16896. A string of numbers representing the pulldown pattern you wish to apply.
  16897. The default value is @code{23}.
  16898. @end table
  16899. @example
  16900. Some typical patterns:
  16901. NTSC output (30i):
  16902. 27.5p: 32222
  16903. 24p: 23 (classic)
  16904. 24p: 2332 (preferred)
  16905. 20p: 33
  16906. 18p: 334
  16907. 16p: 3444
  16908. PAL output (25i):
  16909. 27.5p: 12222
  16910. 24p: 222222222223 ("Euro pulldown")
  16911. 16.67p: 33
  16912. 16p: 33333334
  16913. @end example
  16914. @section thistogram
  16915. Compute and draw a color distribution histogram for the input video across time.
  16916. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  16917. at certain time, this filter shows also past histograms of number of frames defined
  16918. by @code{width} option.
  16919. The computed histogram is a representation of the color component
  16920. distribution in an image.
  16921. The filter accepts the following options:
  16922. @table @option
  16923. @item width, w
  16924. Set width of single color component output. Default value is @code{0}.
  16925. Value of @code{0} means width will be picked from input video.
  16926. This also set number of passed histograms to keep.
  16927. Allowed range is [0, 8192].
  16928. @item display_mode, d
  16929. Set display mode.
  16930. It accepts the following values:
  16931. @table @samp
  16932. @item stack
  16933. Per color component graphs are placed below each other.
  16934. @item parade
  16935. Per color component graphs are placed side by side.
  16936. @item overlay
  16937. Presents information identical to that in the @code{parade}, except
  16938. that the graphs representing color components are superimposed directly
  16939. over one another.
  16940. @end table
  16941. Default is @code{stack}.
  16942. @item levels_mode, m
  16943. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  16944. Default is @code{linear}.
  16945. @item components, c
  16946. Set what color components to display.
  16947. Default is @code{7}.
  16948. @item bgopacity, b
  16949. Set background opacity. Default is @code{0.9}.
  16950. @item envelope, e
  16951. Show envelope. Default is disabled.
  16952. @item ecolor, ec
  16953. Set envelope color. Default is @code{gold}.
  16954. @item slide
  16955. Set slide mode.
  16956. Available values for slide is:
  16957. @table @samp
  16958. @item frame
  16959. Draw new frame when right border is reached.
  16960. @item replace
  16961. Replace old columns with new ones.
  16962. @item scroll
  16963. Scroll from right to left.
  16964. @item rscroll
  16965. Scroll from left to right.
  16966. @item picture
  16967. Draw single picture.
  16968. @end table
  16969. Default is @code{replace}.
  16970. @end table
  16971. @section threshold
  16972. Apply threshold effect to video stream.
  16973. This filter needs four video streams to perform thresholding.
  16974. First stream is stream we are filtering.
  16975. Second stream is holding threshold values, third stream is holding min values,
  16976. and last, fourth stream is holding max values.
  16977. The filter accepts the following option:
  16978. @table @option
  16979. @item planes
  16980. Set which planes will be processed, unprocessed planes will be copied.
  16981. By default value 0xf, all planes will be processed.
  16982. @end table
  16983. For example if first stream pixel's component value is less then threshold value
  16984. of pixel component from 2nd threshold stream, third stream value will picked,
  16985. otherwise fourth stream pixel component value will be picked.
  16986. Using color source filter one can perform various types of thresholding:
  16987. @subsection Commands
  16988. This filter supports the all options as @ref{commands}.
  16989. @subsection Examples
  16990. @itemize
  16991. @item
  16992. Binary threshold, using gray color as threshold:
  16993. @example
  16994. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  16995. @end example
  16996. @item
  16997. Inverted binary threshold, using gray color as threshold:
  16998. @example
  16999. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  17000. @end example
  17001. @item
  17002. Truncate binary threshold, using gray color as threshold:
  17003. @example
  17004. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  17005. @end example
  17006. @item
  17007. Threshold to zero, using gray color as threshold:
  17008. @example
  17009. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  17010. @end example
  17011. @item
  17012. Inverted threshold to zero, using gray color as threshold:
  17013. @example
  17014. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  17015. @end example
  17016. @end itemize
  17017. @section thumbnail
  17018. Select the most representative frame in a given sequence of consecutive frames.
  17019. The filter accepts the following options:
  17020. @table @option
  17021. @item n
  17022. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  17023. will pick one of them, and then handle the next batch of @var{n} frames until
  17024. the end. Default is @code{100}.
  17025. @item log
  17026. Set the log level to display picked frame stats.
  17027. Default is @code{info}.
  17028. @end table
  17029. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  17030. value will result in a higher memory usage, so a high value is not recommended.
  17031. @subsection Examples
  17032. @itemize
  17033. @item
  17034. Extract one picture each 50 frames:
  17035. @example
  17036. thumbnail=50
  17037. @end example
  17038. @item
  17039. Complete example of a thumbnail creation with @command{ffmpeg}:
  17040. @example
  17041. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  17042. @end example
  17043. @end itemize
  17044. @anchor{tile}
  17045. @section tile
  17046. Tile several successive frames together.
  17047. The @ref{untile} filter can do the reverse.
  17048. The filter accepts the following options:
  17049. @table @option
  17050. @item layout
  17051. Set the grid size in the form @code{COLUMNSxROWS}. Range is upto UINT_MAX cells.
  17052. Default is @code{6x5}.
  17053. @item nb_frames
  17054. Set the maximum number of frames to render in the given area. It must be less
  17055. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  17056. the area will be used.
  17057. @item margin
  17058. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  17059. @item padding
  17060. Set the inner border thickness (i.e. the number of pixels between frames). For
  17061. more advanced padding options (such as having different values for the edges),
  17062. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  17063. @item color
  17064. Specify the color of the unused area. For the syntax of this option, check the
  17065. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17066. The default value of @var{color} is "black".
  17067. @item overlap
  17068. Set the number of frames to overlap when tiling several successive frames together.
  17069. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17070. @item init_padding
  17071. Set the number of frames to initially be empty before displaying first output frame.
  17072. This controls how soon will one get first output frame.
  17073. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17074. @end table
  17075. @subsection Examples
  17076. @itemize
  17077. @item
  17078. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  17079. @example
  17080. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  17081. @end example
  17082. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  17083. duplicating each output frame to accommodate the originally detected frame
  17084. rate.
  17085. @item
  17086. Display @code{5} pictures in an area of @code{3x2} frames,
  17087. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  17088. mixed flat and named options:
  17089. @example
  17090. tile=3x2:nb_frames=5:padding=7:margin=2
  17091. @end example
  17092. @end itemize
  17093. @section tinterlace
  17094. Perform various types of temporal field interlacing.
  17095. Frames are counted starting from 1, so the first input frame is
  17096. considered odd.
  17097. The filter accepts the following options:
  17098. @table @option
  17099. @item mode
  17100. Specify the mode of the interlacing. This option can also be specified
  17101. as a value alone. See below for a list of values for this option.
  17102. Available values are:
  17103. @table @samp
  17104. @item merge, 0
  17105. Move odd frames into the upper field, even into the lower field,
  17106. generating a double height frame at half frame rate.
  17107. @example
  17108. ------> time
  17109. Input:
  17110. Frame 1 Frame 2 Frame 3 Frame 4
  17111. 11111 22222 33333 44444
  17112. 11111 22222 33333 44444
  17113. 11111 22222 33333 44444
  17114. 11111 22222 33333 44444
  17115. Output:
  17116. 11111 33333
  17117. 22222 44444
  17118. 11111 33333
  17119. 22222 44444
  17120. 11111 33333
  17121. 22222 44444
  17122. 11111 33333
  17123. 22222 44444
  17124. @end example
  17125. @item drop_even, 1
  17126. Only output odd frames, even frames are dropped, generating a frame with
  17127. unchanged height at half frame rate.
  17128. @example
  17129. ------> time
  17130. Input:
  17131. Frame 1 Frame 2 Frame 3 Frame 4
  17132. 11111 22222 33333 44444
  17133. 11111 22222 33333 44444
  17134. 11111 22222 33333 44444
  17135. 11111 22222 33333 44444
  17136. Output:
  17137. 11111 33333
  17138. 11111 33333
  17139. 11111 33333
  17140. 11111 33333
  17141. @end example
  17142. @item drop_odd, 2
  17143. Only output even frames, odd frames are dropped, generating a frame with
  17144. unchanged height at half frame rate.
  17145. @example
  17146. ------> time
  17147. Input:
  17148. Frame 1 Frame 2 Frame 3 Frame 4
  17149. 11111 22222 33333 44444
  17150. 11111 22222 33333 44444
  17151. 11111 22222 33333 44444
  17152. 11111 22222 33333 44444
  17153. Output:
  17154. 22222 44444
  17155. 22222 44444
  17156. 22222 44444
  17157. 22222 44444
  17158. @end example
  17159. @item pad, 3
  17160. Expand each frame to full height, but pad alternate lines with black,
  17161. generating a frame with double height at the same input frame rate.
  17162. @example
  17163. ------> time
  17164. Input:
  17165. Frame 1 Frame 2 Frame 3 Frame 4
  17166. 11111 22222 33333 44444
  17167. 11111 22222 33333 44444
  17168. 11111 22222 33333 44444
  17169. 11111 22222 33333 44444
  17170. Output:
  17171. 11111 ..... 33333 .....
  17172. ..... 22222 ..... 44444
  17173. 11111 ..... 33333 .....
  17174. ..... 22222 ..... 44444
  17175. 11111 ..... 33333 .....
  17176. ..... 22222 ..... 44444
  17177. 11111 ..... 33333 .....
  17178. ..... 22222 ..... 44444
  17179. @end example
  17180. @item interleave_top, 4
  17181. Interleave the upper field from odd frames with the lower field from
  17182. even frames, generating a frame with unchanged height at half frame rate.
  17183. @example
  17184. ------> time
  17185. Input:
  17186. Frame 1 Frame 2 Frame 3 Frame 4
  17187. 11111<- 22222 33333<- 44444
  17188. 11111 22222<- 33333 44444<-
  17189. 11111<- 22222 33333<- 44444
  17190. 11111 22222<- 33333 44444<-
  17191. Output:
  17192. 11111 33333
  17193. 22222 44444
  17194. 11111 33333
  17195. 22222 44444
  17196. @end example
  17197. @item interleave_bottom, 5
  17198. Interleave the lower field from odd frames with the upper field from
  17199. even frames, generating a frame with unchanged height at half frame rate.
  17200. @example
  17201. ------> time
  17202. Input:
  17203. Frame 1 Frame 2 Frame 3 Frame 4
  17204. 11111 22222<- 33333 44444<-
  17205. 11111<- 22222 33333<- 44444
  17206. 11111 22222<- 33333 44444<-
  17207. 11111<- 22222 33333<- 44444
  17208. Output:
  17209. 22222 44444
  17210. 11111 33333
  17211. 22222 44444
  17212. 11111 33333
  17213. @end example
  17214. @item interlacex2, 6
  17215. Double frame rate with unchanged height. Frames are inserted each
  17216. containing the second temporal field from the previous input frame and
  17217. the first temporal field from the next input frame. This mode relies on
  17218. the top_field_first flag. Useful for interlaced video displays with no
  17219. field synchronisation.
  17220. @example
  17221. ------> time
  17222. Input:
  17223. Frame 1 Frame 2 Frame 3 Frame 4
  17224. 11111 22222 33333 44444
  17225. 11111 22222 33333 44444
  17226. 11111 22222 33333 44444
  17227. 11111 22222 33333 44444
  17228. Output:
  17229. 11111 22222 22222 33333 33333 44444 44444
  17230. 11111 11111 22222 22222 33333 33333 44444
  17231. 11111 22222 22222 33333 33333 44444 44444
  17232. 11111 11111 22222 22222 33333 33333 44444
  17233. @end example
  17234. @item mergex2, 7
  17235. Move odd frames into the upper field, even into the lower field,
  17236. generating a double height frame at same frame rate.
  17237. @example
  17238. ------> time
  17239. Input:
  17240. Frame 1 Frame 2 Frame 3 Frame 4
  17241. 11111 22222 33333 44444
  17242. 11111 22222 33333 44444
  17243. 11111 22222 33333 44444
  17244. 11111 22222 33333 44444
  17245. Output:
  17246. 11111 33333 33333 55555
  17247. 22222 22222 44444 44444
  17248. 11111 33333 33333 55555
  17249. 22222 22222 44444 44444
  17250. 11111 33333 33333 55555
  17251. 22222 22222 44444 44444
  17252. 11111 33333 33333 55555
  17253. 22222 22222 44444 44444
  17254. @end example
  17255. @end table
  17256. Numeric values are deprecated but are accepted for backward
  17257. compatibility reasons.
  17258. Default mode is @code{merge}.
  17259. @item flags
  17260. Specify flags influencing the filter process.
  17261. Available value for @var{flags} is:
  17262. @table @option
  17263. @item low_pass_filter, vlpf
  17264. Enable linear vertical low-pass filtering in the filter.
  17265. Vertical low-pass filtering is required when creating an interlaced
  17266. destination from a progressive source which contains high-frequency
  17267. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  17268. patterning.
  17269. @item complex_filter, cvlpf
  17270. Enable complex vertical low-pass filtering.
  17271. This will slightly less reduce interlace 'twitter' and Moire
  17272. patterning but better retain detail and subjective sharpness impression.
  17273. @item bypass_il
  17274. Bypass already interlaced frames, only adjust the frame rate.
  17275. @end table
  17276. Vertical low-pass filtering and bypassing already interlaced frames can only be
  17277. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  17278. @end table
  17279. @section tmedian
  17280. Pick median pixels from several successive input video frames.
  17281. The filter accepts the following options:
  17282. @table @option
  17283. @item radius
  17284. Set radius of median filter.
  17285. Default is 1. Allowed range is from 1 to 127.
  17286. @item planes
  17287. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  17288. @item percentile
  17289. Set median percentile. Default value is @code{0.5}.
  17290. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  17291. minimum values, and @code{1} maximum values.
  17292. @end table
  17293. @subsection Commands
  17294. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  17295. @section tmidequalizer
  17296. Apply Temporal Midway Video Equalization effect.
  17297. Midway Video Equalization adjusts a sequence of video frames to have the same
  17298. histograms, while maintaining their dynamics as much as possible. It's
  17299. useful for e.g. matching exposures from a video frames sequence.
  17300. This filter accepts the following option:
  17301. @table @option
  17302. @item radius
  17303. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  17304. @item sigma
  17305. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  17306. Setting this option to 0 effectively does nothing.
  17307. @item planes
  17308. Set which planes to process. Default is @code{15}, which is all available planes.
  17309. @end table
  17310. @section tmix
  17311. Mix successive video frames.
  17312. A description of the accepted options follows.
  17313. @table @option
  17314. @item frames
  17315. The number of successive frames to mix. If unspecified, it defaults to 3.
  17316. @item weights
  17317. Specify weight of each input video frame.
  17318. Each weight is separated by space. If number of weights is smaller than
  17319. number of @var{frames} last specified weight will be used for all remaining
  17320. unset weights.
  17321. @item scale
  17322. Specify scale, if it is set it will be multiplied with sum
  17323. of each weight multiplied with pixel values to give final destination
  17324. pixel value. By default @var{scale} is auto scaled to sum of weights.
  17325. @item planes
  17326. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  17327. @end table
  17328. @subsection Examples
  17329. @itemize
  17330. @item
  17331. Average 7 successive frames:
  17332. @example
  17333. tmix=frames=7:weights="1 1 1 1 1 1 1"
  17334. @end example
  17335. @item
  17336. Apply simple temporal convolution:
  17337. @example
  17338. tmix=frames=3:weights="-1 3 -1"
  17339. @end example
  17340. @item
  17341. Similar as above but only showing temporal differences:
  17342. @example
  17343. tmix=frames=3:weights="-1 2 -1":scale=1
  17344. @end example
  17345. @end itemize
  17346. @subsection Commands
  17347. This filter supports the following commands:
  17348. @table @option
  17349. @item weights
  17350. @item scale
  17351. @item planes
  17352. Syntax is same as option with same name.
  17353. @end table
  17354. @anchor{tonemap}
  17355. @section tonemap
  17356. Tone map colors from different dynamic ranges.
  17357. This filter expects data in single precision floating point, as it needs to
  17358. operate on (and can output) out-of-range values. Another filter, such as
  17359. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  17360. The tonemapping algorithms implemented only work on linear light, so input
  17361. data should be linearized beforehand (and possibly correctly tagged).
  17362. @example
  17363. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  17364. @end example
  17365. @subsection Options
  17366. The filter accepts the following options.
  17367. @table @option
  17368. @item tonemap
  17369. Set the tone map algorithm to use.
  17370. Possible values are:
  17371. @table @var
  17372. @item none
  17373. Do not apply any tone map, only desaturate overbright pixels.
  17374. @item clip
  17375. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  17376. in-range values, while distorting out-of-range values.
  17377. @item linear
  17378. Stretch the entire reference gamut to a linear multiple of the display.
  17379. @item gamma
  17380. Fit a logarithmic transfer between the tone curves.
  17381. @item reinhard
  17382. Preserve overall image brightness with a simple curve, using nonlinear
  17383. contrast, which results in flattening details and degrading color accuracy.
  17384. @item hable
  17385. Preserve both dark and bright details better than @var{reinhard}, at the cost
  17386. of slightly darkening everything. Use it when detail preservation is more
  17387. important than color and brightness accuracy.
  17388. @item mobius
  17389. Smoothly map out-of-range values, while retaining contrast and colors for
  17390. in-range material as much as possible. Use it when color accuracy is more
  17391. important than detail preservation.
  17392. @end table
  17393. Default is none.
  17394. @item param
  17395. Tune the tone mapping algorithm.
  17396. This affects the following algorithms:
  17397. @table @var
  17398. @item none
  17399. Ignored.
  17400. @item linear
  17401. Specifies the scale factor to use while stretching.
  17402. Default to 1.0.
  17403. @item gamma
  17404. Specifies the exponent of the function.
  17405. Default to 1.8.
  17406. @item clip
  17407. Specify an extra linear coefficient to multiply into the signal before clipping.
  17408. Default to 1.0.
  17409. @item reinhard
  17410. Specify the local contrast coefficient at the display peak.
  17411. Default to 0.5, which means that in-gamut values will be about half as bright
  17412. as when clipping.
  17413. @item hable
  17414. Ignored.
  17415. @item mobius
  17416. Specify the transition point from linear to mobius transform. Every value
  17417. below this point is guaranteed to be mapped 1:1. The higher the value, the
  17418. more accurate the result will be, at the cost of losing bright details.
  17419. Default to 0.3, which due to the steep initial slope still preserves in-range
  17420. colors fairly accurately.
  17421. @end table
  17422. @item desat
  17423. Apply desaturation for highlights that exceed this level of brightness. The
  17424. higher the parameter, the more color information will be preserved. This
  17425. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17426. (smoothly) turning into white instead. This makes images feel more natural,
  17427. at the cost of reducing information about out-of-range colors.
  17428. The default of 2.0 is somewhat conservative and will mostly just apply to
  17429. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  17430. This option works only if the input frame has a supported color tag.
  17431. @item peak
  17432. Override signal/nominal/reference peak with this value. Useful when the
  17433. embedded peak information in display metadata is not reliable or when tone
  17434. mapping from a lower range to a higher range.
  17435. @end table
  17436. @section tpad
  17437. Temporarily pad video frames.
  17438. The filter accepts the following options:
  17439. @table @option
  17440. @item start
  17441. Specify number of delay frames before input video stream. Default is 0.
  17442. @item stop
  17443. Specify number of padding frames after input video stream.
  17444. Set to -1 to pad indefinitely. Default is 0.
  17445. @item start_mode
  17446. Set kind of frames added to beginning of stream.
  17447. Can be either @var{add} or @var{clone}.
  17448. With @var{add} frames of solid-color are added.
  17449. With @var{clone} frames are clones of first frame.
  17450. Default is @var{add}.
  17451. @item stop_mode
  17452. Set kind of frames added to end of stream.
  17453. Can be either @var{add} or @var{clone}.
  17454. With @var{add} frames of solid-color are added.
  17455. With @var{clone} frames are clones of last frame.
  17456. Default is @var{add}.
  17457. @item start_duration, stop_duration
  17458. Specify the duration of the start/stop delay. See
  17459. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17460. for the accepted syntax.
  17461. These options override @var{start} and @var{stop}. Default is 0.
  17462. @item color
  17463. Specify the color of the padded area. For the syntax of this option,
  17464. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17465. manual,ffmpeg-utils}.
  17466. The default value of @var{color} is "black".
  17467. @end table
  17468. @anchor{transpose}
  17469. @section transpose
  17470. Transpose rows with columns in the input video and optionally flip it.
  17471. It accepts the following parameters:
  17472. @table @option
  17473. @item dir
  17474. Specify the transposition direction.
  17475. Can assume the following values:
  17476. @table @samp
  17477. @item 0, 4, cclock_flip
  17478. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  17479. @example
  17480. L.R L.l
  17481. . . -> . .
  17482. l.r R.r
  17483. @end example
  17484. @item 1, 5, clock
  17485. Rotate by 90 degrees clockwise, that is:
  17486. @example
  17487. L.R l.L
  17488. . . -> . .
  17489. l.r r.R
  17490. @end example
  17491. @item 2, 6, cclock
  17492. Rotate by 90 degrees counterclockwise, that is:
  17493. @example
  17494. L.R R.r
  17495. . . -> . .
  17496. l.r L.l
  17497. @end example
  17498. @item 3, 7, clock_flip
  17499. Rotate by 90 degrees clockwise and vertically flip, that is:
  17500. @example
  17501. L.R r.R
  17502. . . -> . .
  17503. l.r l.L
  17504. @end example
  17505. @end table
  17506. For values between 4-7, the transposition is only done if the input
  17507. video geometry is portrait and not landscape. These values are
  17508. deprecated, the @code{passthrough} option should be used instead.
  17509. Numerical values are deprecated, and should be dropped in favor of
  17510. symbolic constants.
  17511. @item passthrough
  17512. Do not apply the transposition if the input geometry matches the one
  17513. specified by the specified value. It accepts the following values:
  17514. @table @samp
  17515. @item none
  17516. Always apply transposition.
  17517. @item portrait
  17518. Preserve portrait geometry (when @var{height} >= @var{width}).
  17519. @item landscape
  17520. Preserve landscape geometry (when @var{width} >= @var{height}).
  17521. @end table
  17522. Default value is @code{none}.
  17523. @end table
  17524. For example to rotate by 90 degrees clockwise and preserve portrait
  17525. layout:
  17526. @example
  17527. transpose=dir=1:passthrough=portrait
  17528. @end example
  17529. The command above can also be specified as:
  17530. @example
  17531. transpose=1:portrait
  17532. @end example
  17533. @section transpose_npp
  17534. Transpose rows with columns in the input video and optionally flip it.
  17535. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  17536. It accepts the following parameters:
  17537. @table @option
  17538. @item dir
  17539. Specify the transposition direction.
  17540. Can assume the following values:
  17541. @table @samp
  17542. @item cclock_flip
  17543. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  17544. @item clock
  17545. Rotate by 90 degrees clockwise.
  17546. @item cclock
  17547. Rotate by 90 degrees counterclockwise.
  17548. @item clock_flip
  17549. Rotate by 90 degrees clockwise and vertically flip.
  17550. @end table
  17551. @item passthrough
  17552. Do not apply the transposition if the input geometry matches the one
  17553. specified by the specified value. It accepts the following values:
  17554. @table @samp
  17555. @item none
  17556. Always apply transposition. (default)
  17557. @item portrait
  17558. Preserve portrait geometry (when @var{height} >= @var{width}).
  17559. @item landscape
  17560. Preserve landscape geometry (when @var{width} >= @var{height}).
  17561. @end table
  17562. @end table
  17563. @section trim
  17564. Trim the input so that the output contains one continuous subpart of the input.
  17565. It accepts the following parameters:
  17566. @table @option
  17567. @item start
  17568. Specify the time of the start of the kept section, i.e. the frame with the
  17569. timestamp @var{start} will be the first frame in the output.
  17570. @item end
  17571. Specify the time of the first frame that will be dropped, i.e. the frame
  17572. immediately preceding the one with the timestamp @var{end} will be the last
  17573. frame in the output.
  17574. @item start_pts
  17575. This is the same as @var{start}, except this option sets the start timestamp
  17576. in timebase units instead of seconds.
  17577. @item end_pts
  17578. This is the same as @var{end}, except this option sets the end timestamp
  17579. in timebase units instead of seconds.
  17580. @item duration
  17581. The maximum duration of the output in seconds.
  17582. @item start_frame
  17583. The number of the first frame that should be passed to the output.
  17584. @item end_frame
  17585. The number of the first frame that should be dropped.
  17586. @end table
  17587. @option{start}, @option{end}, and @option{duration} are expressed as time
  17588. duration specifications; see
  17589. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17590. for the accepted syntax.
  17591. Note that the first two sets of the start/end options and the @option{duration}
  17592. option look at the frame timestamp, while the _frame variants simply count the
  17593. frames that pass through the filter. Also note that this filter does not modify
  17594. the timestamps. If you wish for the output timestamps to start at zero, insert a
  17595. setpts filter after the trim filter.
  17596. If multiple start or end options are set, this filter tries to be greedy and
  17597. keep all the frames that match at least one of the specified constraints. To keep
  17598. only the part that matches all the constraints at once, chain multiple trim
  17599. filters.
  17600. The defaults are such that all the input is kept. So it is possible to set e.g.
  17601. just the end values to keep everything before the specified time.
  17602. Examples:
  17603. @itemize
  17604. @item
  17605. Drop everything except the second minute of input:
  17606. @example
  17607. ffmpeg -i INPUT -vf trim=60:120
  17608. @end example
  17609. @item
  17610. Keep only the first second:
  17611. @example
  17612. ffmpeg -i INPUT -vf trim=duration=1
  17613. @end example
  17614. @end itemize
  17615. @section unpremultiply
  17616. Apply alpha unpremultiply effect to input video stream using first plane
  17617. of second stream as alpha.
  17618. Both streams must have same dimensions and same pixel format.
  17619. The filter accepts the following option:
  17620. @table @option
  17621. @item planes
  17622. Set which planes will be processed, unprocessed planes will be copied.
  17623. By default value 0xf, all planes will be processed.
  17624. If the format has 1 or 2 components, then luma is bit 0.
  17625. If the format has 3 or 4 components:
  17626. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  17627. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  17628. If present, the alpha channel is always the last bit.
  17629. @item inplace
  17630. Do not require 2nd input for processing, instead use alpha plane from input stream.
  17631. @end table
  17632. @anchor{unsharp}
  17633. @section unsharp
  17634. Sharpen or blur the input video.
  17635. It accepts the following parameters:
  17636. @table @option
  17637. @item luma_msize_x, lx
  17638. Set the luma matrix horizontal size. It must be an odd integer between
  17639. 3 and 23. The default value is 5.
  17640. @item luma_msize_y, ly
  17641. Set the luma matrix vertical size. It must be an odd integer between 3
  17642. and 23. The default value is 5.
  17643. @item luma_amount, la
  17644. Set the luma effect strength. It must be a floating point number, reasonable
  17645. values lay between -1.5 and 1.5.
  17646. Negative values will blur the input video, while positive values will
  17647. sharpen it, a value of zero will disable the effect.
  17648. Default value is 1.0.
  17649. @item chroma_msize_x, cx
  17650. Set the chroma matrix horizontal size. It must be an odd integer
  17651. between 3 and 23. The default value is 5.
  17652. @item chroma_msize_y, cy
  17653. Set the chroma matrix vertical size. It must be an odd integer
  17654. between 3 and 23. The default value is 5.
  17655. @item chroma_amount, ca
  17656. Set the chroma effect strength. It must be a floating point number, reasonable
  17657. values lay between -1.5 and 1.5.
  17658. Negative values will blur the input video, while positive values will
  17659. sharpen it, a value of zero will disable the effect.
  17660. Default value is 0.0.
  17661. @item alpha_msize_x, ax
  17662. Set the alpha matrix horizontal size. It must be an odd integer
  17663. between 3 and 23. The default value is 5.
  17664. @item alpha_msize_y, ay
  17665. Set the alpha matrix vertical size. It must be an odd integer
  17666. between 3 and 23. The default value is 5.
  17667. @item alpha_amount, aa
  17668. Set the alpha effect strength. It must be a floating point number, reasonable
  17669. values lay between -1.5 and 1.5.
  17670. Negative values will blur the input video, while positive values will
  17671. sharpen it, a value of zero will disable the effect.
  17672. Default value is 0.0.
  17673. @end table
  17674. All parameters are optional and default to the equivalent of the
  17675. string '5:5:1.0:5:5:0.0'.
  17676. @subsection Examples
  17677. @itemize
  17678. @item
  17679. Apply strong luma sharpen effect:
  17680. @example
  17681. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  17682. @end example
  17683. @item
  17684. Apply a strong blur of both luma and chroma parameters:
  17685. @example
  17686. unsharp=7:7:-2:7:7:-2
  17687. @end example
  17688. @end itemize
  17689. @anchor{untile}
  17690. @section untile
  17691. Decompose a video made of tiled images into the individual images.
  17692. The frame rate of the output video is the frame rate of the input video
  17693. multiplied by the number of tiles.
  17694. This filter does the reverse of @ref{tile}.
  17695. The filter accepts the following options:
  17696. @table @option
  17697. @item layout
  17698. Set the grid size (i.e. the number of lines and columns). For the syntax of
  17699. this option, check the
  17700. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17701. @end table
  17702. @subsection Examples
  17703. @itemize
  17704. @item
  17705. Produce a 1-second video from a still image file made of 25 frames stacked
  17706. vertically, like an analogic film reel:
  17707. @example
  17708. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  17709. @end example
  17710. @end itemize
  17711. @section uspp
  17712. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  17713. the image at several (or - in the case of @option{quality} level @code{8} - all)
  17714. shifts and average the results.
  17715. The way this differs from the behavior of spp is that uspp actually encodes &
  17716. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  17717. DCT similar to MJPEG.
  17718. This filter is only available in ffmpeg version 4.4 or earlier.
  17719. The filter accepts the following options:
  17720. @table @option
  17721. @item quality
  17722. Set quality. This option defines the number of levels for averaging. It accepts
  17723. an integer in the range 0-8. If set to @code{0}, the filter will have no
  17724. effect. A value of @code{8} means the higher quality. For each increment of
  17725. that value the speed drops by a factor of approximately 2. Default value is
  17726. @code{3}.
  17727. @item qp
  17728. Force a constant quantization parameter. If not set, the filter will use the QP
  17729. from the video stream (if available).
  17730. @end table
  17731. @section v360
  17732. Convert 360 videos between various formats.
  17733. The filter accepts the following options:
  17734. @table @option
  17735. @item input
  17736. @item output
  17737. Set format of the input/output video.
  17738. Available formats:
  17739. @table @samp
  17740. @item e
  17741. @item equirect
  17742. Equirectangular projection.
  17743. @item c3x2
  17744. @item c6x1
  17745. @item c1x6
  17746. Cubemap with 3x2/6x1/1x6 layout.
  17747. Format specific options:
  17748. @table @option
  17749. @item in_pad
  17750. @item out_pad
  17751. Set padding proportion for the input/output cubemap. Values in decimals.
  17752. Example values:
  17753. @table @samp
  17754. @item 0
  17755. No padding.
  17756. @item 0.01
  17757. 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)
  17758. @end table
  17759. Default value is @b{@samp{0}}.
  17760. Maximum value is @b{@samp{0.1}}.
  17761. @item fin_pad
  17762. @item fout_pad
  17763. Set fixed padding for the input/output cubemap. Values in pixels.
  17764. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  17765. @item in_forder
  17766. @item out_forder
  17767. Set order of faces for the input/output cubemap. Choose one direction for each position.
  17768. Designation of directions:
  17769. @table @samp
  17770. @item r
  17771. right
  17772. @item l
  17773. left
  17774. @item u
  17775. up
  17776. @item d
  17777. down
  17778. @item f
  17779. forward
  17780. @item b
  17781. back
  17782. @end table
  17783. Default value is @b{@samp{rludfb}}.
  17784. @item in_frot
  17785. @item out_frot
  17786. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  17787. Designation of angles:
  17788. @table @samp
  17789. @item 0
  17790. 0 degrees clockwise
  17791. @item 1
  17792. 90 degrees clockwise
  17793. @item 2
  17794. 180 degrees clockwise
  17795. @item 3
  17796. 270 degrees clockwise
  17797. @end table
  17798. Default value is @b{@samp{000000}}.
  17799. @end table
  17800. @item eac
  17801. Equi-Angular Cubemap.
  17802. @item flat
  17803. @item gnomonic
  17804. @item rectilinear
  17805. Regular video.
  17806. Format specific options:
  17807. @table @option
  17808. @item h_fov
  17809. @item v_fov
  17810. @item d_fov
  17811. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17812. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17813. @item ih_fov
  17814. @item iv_fov
  17815. @item id_fov
  17816. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17817. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17818. @end table
  17819. @item dfisheye
  17820. Dual fisheye.
  17821. Format specific options:
  17822. @table @option
  17823. @item h_fov
  17824. @item v_fov
  17825. @item d_fov
  17826. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17827. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17828. @item ih_fov
  17829. @item iv_fov
  17830. @item id_fov
  17831. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17832. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17833. @end table
  17834. @item barrel
  17835. @item fb
  17836. @item barrelsplit
  17837. Facebook's 360 formats.
  17838. @item sg
  17839. Stereographic format.
  17840. Format specific options:
  17841. @table @option
  17842. @item h_fov
  17843. @item v_fov
  17844. @item d_fov
  17845. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17846. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17847. @item ih_fov
  17848. @item iv_fov
  17849. @item id_fov
  17850. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17851. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17852. @end table
  17853. @item mercator
  17854. Mercator format.
  17855. @item ball
  17856. Ball format, gives significant distortion toward the back.
  17857. @item hammer
  17858. Hammer-Aitoff map projection format.
  17859. @item sinusoidal
  17860. Sinusoidal map projection format.
  17861. @item fisheye
  17862. Fisheye projection.
  17863. Format specific options:
  17864. @table @option
  17865. @item h_fov
  17866. @item v_fov
  17867. @item d_fov
  17868. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17869. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17870. @item ih_fov
  17871. @item iv_fov
  17872. @item id_fov
  17873. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17874. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17875. @end table
  17876. @item pannini
  17877. Pannini projection.
  17878. Format specific options:
  17879. @table @option
  17880. @item h_fov
  17881. Set output pannini parameter.
  17882. @item ih_fov
  17883. Set input pannini parameter.
  17884. @end table
  17885. @item cylindrical
  17886. Cylindrical projection.
  17887. Format specific options:
  17888. @table @option
  17889. @item h_fov
  17890. @item v_fov
  17891. @item d_fov
  17892. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17893. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17894. @item ih_fov
  17895. @item iv_fov
  17896. @item id_fov
  17897. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17898. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17899. @end table
  17900. @item perspective
  17901. Perspective projection. @i{(output only)}
  17902. Format specific options:
  17903. @table @option
  17904. @item v_fov
  17905. Set perspective parameter.
  17906. @end table
  17907. @item tetrahedron
  17908. Tetrahedron projection.
  17909. @item tsp
  17910. Truncated square pyramid projection.
  17911. @item he
  17912. @item hequirect
  17913. Half equirectangular projection.
  17914. @item equisolid
  17915. Equisolid format.
  17916. Format specific options:
  17917. @table @option
  17918. @item h_fov
  17919. @item v_fov
  17920. @item d_fov
  17921. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17922. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17923. @item ih_fov
  17924. @item iv_fov
  17925. @item id_fov
  17926. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17927. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17928. @end table
  17929. @item og
  17930. Orthographic format.
  17931. Format specific options:
  17932. @table @option
  17933. @item h_fov
  17934. @item v_fov
  17935. @item d_fov
  17936. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17937. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17938. @item ih_fov
  17939. @item iv_fov
  17940. @item id_fov
  17941. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17942. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17943. @end table
  17944. @item octahedron
  17945. Octahedron projection.
  17946. @item cylindricalea
  17947. Cylindrical Equal Area projection.
  17948. @end table
  17949. @item interp
  17950. Set interpolation method.@*
  17951. @i{Note: more complex interpolation methods require much more memory to run.}
  17952. Available methods:
  17953. @table @samp
  17954. @item near
  17955. @item nearest
  17956. Nearest neighbour.
  17957. @item line
  17958. @item linear
  17959. Bilinear interpolation.
  17960. @item lagrange9
  17961. Lagrange9 interpolation.
  17962. @item cube
  17963. @item cubic
  17964. Bicubic interpolation.
  17965. @item lanc
  17966. @item lanczos
  17967. Lanczos interpolation.
  17968. @item sp16
  17969. @item spline16
  17970. Spline16 interpolation.
  17971. @item gauss
  17972. @item gaussian
  17973. Gaussian interpolation.
  17974. @item mitchell
  17975. Mitchell interpolation.
  17976. @end table
  17977. Default value is @b{@samp{line}}.
  17978. @item w
  17979. @item h
  17980. Set the output video resolution.
  17981. Default resolution depends on formats.
  17982. @item in_stereo
  17983. @item out_stereo
  17984. Set the input/output stereo format.
  17985. @table @samp
  17986. @item 2d
  17987. 2D mono
  17988. @item sbs
  17989. Side by side
  17990. @item tb
  17991. Top bottom
  17992. @end table
  17993. Default value is @b{@samp{2d}} for input and output format.
  17994. @item yaw
  17995. @item pitch
  17996. @item roll
  17997. Set rotation for the output video. Values in degrees.
  17998. @item rorder
  17999. Set rotation order for the output video. Choose one item for each position.
  18000. @table @samp
  18001. @item y, Y
  18002. yaw
  18003. @item p, P
  18004. pitch
  18005. @item r, R
  18006. roll
  18007. @end table
  18008. Default value is @b{@samp{ypr}}.
  18009. @item h_flip
  18010. @item v_flip
  18011. @item d_flip
  18012. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  18013. @item ih_flip
  18014. @item iv_flip
  18015. Set if input video is flipped horizontally/vertically. Boolean values.
  18016. @item in_trans
  18017. Set if input video is transposed. Boolean value, by default disabled.
  18018. @item out_trans
  18019. Set if output video needs to be transposed. Boolean value, by default disabled.
  18020. @item h_offset
  18021. @item v_offset
  18022. Set output horizontal/vertical off-axis offset. Default is set to 0.
  18023. Allowed range is from -1 to 1.
  18024. @item alpha_mask
  18025. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  18026. @item reset_rot
  18027. Reset rotation of output video. Boolean value, by default disabled.
  18028. @end table
  18029. @subsection Examples
  18030. @itemize
  18031. @item
  18032. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  18033. @example
  18034. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  18035. @end example
  18036. @item
  18037. Extract back view of Equi-Angular Cubemap:
  18038. @example
  18039. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  18040. @end example
  18041. @item
  18042. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  18043. @example
  18044. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  18045. @end example
  18046. @end itemize
  18047. @subsection Commands
  18048. This filter supports subset of above options as @ref{commands}.
  18049. @section vaguedenoiser
  18050. Apply a wavelet based denoiser.
  18051. It transforms each frame from the video input into the wavelet domain,
  18052. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  18053. the obtained coefficients. It does an inverse wavelet transform after.
  18054. Due to wavelet properties, it should give a nice smoothed result, and
  18055. reduced noise, without blurring picture features.
  18056. This filter accepts the following options:
  18057. @table @option
  18058. @item threshold
  18059. The filtering strength. The higher, the more filtered the video will be.
  18060. Hard thresholding can use a higher threshold than soft thresholding
  18061. before the video looks overfiltered. Default value is 2.
  18062. @item method
  18063. The filtering method the filter will use.
  18064. It accepts the following values:
  18065. @table @samp
  18066. @item hard
  18067. All values under the threshold will be zeroed.
  18068. @item soft
  18069. All values under the threshold will be zeroed. All values above will be
  18070. reduced by the threshold.
  18071. @item garrote
  18072. Scales or nullifies coefficients - intermediary between (more) soft and
  18073. (less) hard thresholding.
  18074. @end table
  18075. Default is garrote.
  18076. @item nsteps
  18077. Number of times, the wavelet will decompose the picture. Picture can't
  18078. be decomposed beyond a particular point (typically, 8 for a 640x480
  18079. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  18080. @item percent
  18081. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  18082. @item planes
  18083. A list of the planes to process. By default all planes are processed.
  18084. @item type
  18085. The threshold type the filter will use.
  18086. It accepts the following values:
  18087. @table @samp
  18088. @item universal
  18089. Threshold used is same for all decompositions.
  18090. @item bayes
  18091. Threshold used depends also on each decomposition coefficients.
  18092. @end table
  18093. Default is universal.
  18094. @end table
  18095. @section varblur
  18096. Apply variable blur filter by using 2nd video stream to set blur radius.
  18097. The 2nd stream must have the same dimensions.
  18098. This filter accepts the following options:
  18099. @table @option
  18100. @item min_r
  18101. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  18102. @item max_r
  18103. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  18104. @item planes
  18105. Set which planes to process. By default, all are used.
  18106. @end table
  18107. The @code{varblur} filter also supports the @ref{framesync} options.
  18108. @subsection Commands
  18109. This filter supports all the above options as @ref{commands}.
  18110. @section vectorscope
  18111. Display 2 color component values in the two dimensional graph (which is called
  18112. a vectorscope).
  18113. This filter accepts the following options:
  18114. @table @option
  18115. @item mode, m
  18116. Set vectorscope mode.
  18117. It accepts the following values:
  18118. @table @samp
  18119. @item gray
  18120. @item tint
  18121. Gray values are displayed on graph, higher brightness means more pixels have
  18122. same component color value on location in graph. This is the default mode.
  18123. @item color
  18124. Gray values are displayed on graph. Surrounding pixels values which are not
  18125. present in video frame are drawn in gradient of 2 color components which are
  18126. set by option @code{x} and @code{y}. The 3rd color component is static.
  18127. @item color2
  18128. Actual color components values present in video frame are displayed on graph.
  18129. @item color3
  18130. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  18131. on graph increases value of another color component, which is luminance by
  18132. default values of @code{x} and @code{y}.
  18133. @item color4
  18134. Actual colors present in video frame are displayed on graph. If two different
  18135. colors map to same position on graph then color with higher value of component
  18136. not present in graph is picked.
  18137. @item color5
  18138. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  18139. component picked from radial gradient.
  18140. @end table
  18141. @item x
  18142. Set which color component will be represented on X-axis. Default is @code{1}.
  18143. @item y
  18144. Set which color component will be represented on Y-axis. Default is @code{2}.
  18145. @item intensity, i
  18146. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  18147. of color component which represents frequency of (X, Y) location in graph.
  18148. @item envelope, e
  18149. @table @samp
  18150. @item none
  18151. No envelope, this is default.
  18152. @item instant
  18153. Instant envelope, even darkest single pixel will be clearly highlighted.
  18154. @item peak
  18155. Hold maximum and minimum values presented in graph over time. This way you
  18156. can still spot out of range values without constantly looking at vectorscope.
  18157. @item peak+instant
  18158. Peak and instant envelope combined together.
  18159. @end table
  18160. @item graticule, g
  18161. Set what kind of graticule to draw.
  18162. @table @samp
  18163. @item none
  18164. @item green
  18165. @item color
  18166. @item invert
  18167. @end table
  18168. @item opacity, o
  18169. Set graticule opacity.
  18170. @item flags, f
  18171. Set graticule flags.
  18172. @table @samp
  18173. @item white
  18174. Draw graticule for white point.
  18175. @item black
  18176. Draw graticule for black point.
  18177. @item name
  18178. Draw color points short names.
  18179. @end table
  18180. @item bgopacity, b
  18181. Set background opacity.
  18182. @item lthreshold, l
  18183. Set low threshold for color component not represented on X or Y axis.
  18184. Values lower than this value will be ignored. Default is 0.
  18185. Note this value is multiplied with actual max possible value one pixel component
  18186. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  18187. is 0.1 * 255 = 25.
  18188. @item hthreshold, h
  18189. Set high threshold for color component not represented on X or Y axis.
  18190. Values higher than this value will be ignored. Default is 1.
  18191. Note this value is multiplied with actual max possible value one pixel component
  18192. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  18193. is 0.9 * 255 = 230.
  18194. @item colorspace, c
  18195. Set what kind of colorspace to use when drawing graticule.
  18196. @table @samp
  18197. @item auto
  18198. @item 601
  18199. @item 709
  18200. @end table
  18201. Default is auto.
  18202. @item tint0, t0
  18203. @item tint1, t1
  18204. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  18205. This means no tint, and output will remain gray.
  18206. @end table
  18207. @anchor{vidstabdetect}
  18208. @section vidstabdetect
  18209. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  18210. @ref{vidstabtransform} for pass 2.
  18211. This filter generates a file with relative translation and rotation
  18212. transform information about subsequent frames, which is then used by
  18213. the @ref{vidstabtransform} filter.
  18214. To enable compilation of this filter you need to configure FFmpeg with
  18215. @code{--enable-libvidstab}.
  18216. This filter accepts the following options:
  18217. @table @option
  18218. @item result
  18219. Set the path to the file used to write the transforms information.
  18220. Default value is @file{transforms.trf}.
  18221. @item shakiness
  18222. Set how shaky the video is and how quick the camera is. It accepts an
  18223. integer in the range 1-10, a value of 1 means little shakiness, a
  18224. value of 10 means strong shakiness. Default value is 5.
  18225. @item accuracy
  18226. Set the accuracy of the detection process. It must be a value in the
  18227. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  18228. accuracy. Default value is 15.
  18229. @item stepsize
  18230. Set stepsize of the search process. The region around minimum is
  18231. scanned with 1 pixel resolution. Default value is 6.
  18232. @item mincontrast
  18233. Set minimum contrast. Below this value a local measurement field is
  18234. discarded. Must be a floating point value in the range 0-1. Default
  18235. value is 0.3.
  18236. @item tripod
  18237. Set reference frame number for tripod mode.
  18238. If enabled, the motion of the frames is compared to a reference frame
  18239. in the filtered stream, identified by the specified number. The idea
  18240. is to compensate all movements in a more-or-less static scene and keep
  18241. the camera view absolutely still.
  18242. If set to 0, it is disabled. The frames are counted starting from 1.
  18243. @item show
  18244. Show fields and transforms in the resulting frames. It accepts an
  18245. integer in the range 0-2. Default value is 0, which disables any
  18246. visualization.
  18247. @end table
  18248. @subsection Examples
  18249. @itemize
  18250. @item
  18251. Use default values:
  18252. @example
  18253. vidstabdetect
  18254. @end example
  18255. @item
  18256. Analyze strongly shaky movie and put the results in file
  18257. @file{mytransforms.trf}:
  18258. @example
  18259. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  18260. @end example
  18261. @item
  18262. Visualize the result of internal transformations in the resulting
  18263. video:
  18264. @example
  18265. vidstabdetect=show=1
  18266. @end example
  18267. @item
  18268. Analyze a video with medium shakiness using @command{ffmpeg}:
  18269. @example
  18270. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  18271. @end example
  18272. @end itemize
  18273. @anchor{vidstabtransform}
  18274. @section vidstabtransform
  18275. Video stabilization/deshaking: pass 2 of 2,
  18276. see @ref{vidstabdetect} for pass 1.
  18277. Read a file with transform information for each frame and
  18278. apply/compensate them. Together with the @ref{vidstabdetect}
  18279. filter this can be used to deshake videos. See also
  18280. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  18281. the @ref{unsharp} filter, see below.
  18282. To enable compilation of this filter you need to configure FFmpeg with
  18283. @code{--enable-libvidstab}.
  18284. @subsection Options
  18285. @table @option
  18286. @item input
  18287. Set path to the file used to read the transforms. Default value is
  18288. @file{transforms.trf}.
  18289. @item smoothing
  18290. Set the number of frames (value*2 + 1) used for lowpass filtering the
  18291. camera movements. Default value is 10.
  18292. For example a number of 10 means that 21 frames are used (10 in the
  18293. past and 10 in the future) to smoothen the motion in the video. A
  18294. larger value leads to a smoother video, but limits the acceleration of
  18295. the camera (pan/tilt movements). 0 is a special case where a static
  18296. camera is simulated.
  18297. @item optalgo
  18298. Set the camera path optimization algorithm.
  18299. Accepted values are:
  18300. @table @samp
  18301. @item gauss
  18302. gaussian kernel low-pass filter on camera motion (default)
  18303. @item avg
  18304. averaging on transformations
  18305. @end table
  18306. @item maxshift
  18307. Set maximal number of pixels to translate frames. Default value is -1,
  18308. meaning no limit.
  18309. @item maxangle
  18310. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  18311. value is -1, meaning no limit.
  18312. @item crop
  18313. Specify how to deal with borders that may be visible due to movement
  18314. compensation.
  18315. Available values are:
  18316. @table @samp
  18317. @item keep
  18318. keep image information from previous frame (default)
  18319. @item black
  18320. fill the border black
  18321. @end table
  18322. @item invert
  18323. Invert transforms if set to 1. Default value is 0.
  18324. @item relative
  18325. Consider transforms as relative to previous frame if set to 1,
  18326. absolute if set to 0. Default value is 0.
  18327. @item zoom
  18328. Set percentage to zoom. A positive value will result in a zoom-in
  18329. effect, a negative value in a zoom-out effect. Default value is 0 (no
  18330. zoom).
  18331. @item optzoom
  18332. Set optimal zooming to avoid borders.
  18333. Accepted values are:
  18334. @table @samp
  18335. @item 0
  18336. disabled
  18337. @item 1
  18338. optimal static zoom value is determined (only very strong movements
  18339. will lead to visible borders) (default)
  18340. @item 2
  18341. optimal adaptive zoom value is determined (no borders will be
  18342. visible), see @option{zoomspeed}
  18343. @end table
  18344. Note that the value given at zoom is added to the one calculated here.
  18345. @item zoomspeed
  18346. Set percent to zoom maximally each frame (enabled when
  18347. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  18348. 0.25.
  18349. @item interpol
  18350. Specify type of interpolation.
  18351. Available values are:
  18352. @table @samp
  18353. @item no
  18354. no interpolation
  18355. @item linear
  18356. linear only horizontal
  18357. @item bilinear
  18358. linear in both directions (default)
  18359. @item bicubic
  18360. cubic in both directions (slow)
  18361. @end table
  18362. @item tripod
  18363. Enable virtual tripod mode if set to 1, which is equivalent to
  18364. @code{relative=0:smoothing=0}. Default value is 0.
  18365. Use also @code{tripod} option of @ref{vidstabdetect}.
  18366. @item debug
  18367. Increase log verbosity if set to 1. Also the detected global motions
  18368. are written to the temporary file @file{global_motions.trf}. Default
  18369. value is 0.
  18370. @end table
  18371. @subsection Examples
  18372. @itemize
  18373. @item
  18374. Use @command{ffmpeg} for a typical stabilization with default values:
  18375. @example
  18376. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  18377. @end example
  18378. Note the use of the @ref{unsharp} filter which is always recommended.
  18379. @item
  18380. Zoom in a bit more and load transform data from a given file:
  18381. @example
  18382. vidstabtransform=zoom=5:input="mytransforms.trf"
  18383. @end example
  18384. @item
  18385. Smoothen the video even more:
  18386. @example
  18387. vidstabtransform=smoothing=30
  18388. @end example
  18389. @end itemize
  18390. @section vflip
  18391. Flip the input video vertically.
  18392. For example, to vertically flip a video with @command{ffmpeg}:
  18393. @example
  18394. ffmpeg -i in.avi -vf "vflip" out.avi
  18395. @end example
  18396. @section vfrdet
  18397. Detect variable frame rate video.
  18398. This filter tries to detect if the input is variable or constant frame rate.
  18399. At end it will output number of frames detected as having variable delta pts,
  18400. and ones with constant delta pts.
  18401. If there was frames with variable delta, than it will also show min, max and
  18402. average delta encountered.
  18403. @section vibrance
  18404. Boost or alter saturation.
  18405. The filter accepts the following options:
  18406. @table @option
  18407. @item intensity
  18408. Set strength of boost if positive value or strength of alter if negative value.
  18409. Default is 0. Allowed range is from -2 to 2.
  18410. @item rbal
  18411. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  18412. @item gbal
  18413. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  18414. @item bbal
  18415. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  18416. @item rlum
  18417. Set the red luma coefficient.
  18418. @item glum
  18419. Set the green luma coefficient.
  18420. @item blum
  18421. Set the blue luma coefficient.
  18422. @item alternate
  18423. If @code{intensity} is negative and this is set to 1, colors will change,
  18424. otherwise colors will be less saturated, more towards gray.
  18425. @end table
  18426. @subsection Commands
  18427. This filter supports the all above options as @ref{commands}.
  18428. @section vif
  18429. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  18430. This filter takes two input videos.
  18431. Both input videos must have the same resolution and pixel format for
  18432. this filter to work correctly. Also it assumes that both inputs
  18433. have the same number of frames, which are compared one by one.
  18434. The obtained average VIF score is printed through the logging system.
  18435. The filter stores the calculated VIF score of each frame.
  18436. This filter also supports the @ref{framesync} options.
  18437. In the below example the input file @file{main.mpg} being processed is compared
  18438. with the reference file @file{ref.mpg}.
  18439. @example
  18440. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  18441. @end example
  18442. @anchor{vignette}
  18443. @section vignette
  18444. Make or reverse a natural vignetting effect.
  18445. The filter accepts the following options:
  18446. @table @option
  18447. @item angle, a
  18448. Set lens angle expression as a number of radians.
  18449. The value is clipped in the @code{[0,PI/2]} range.
  18450. Default value: @code{"PI/5"}
  18451. @item x0
  18452. @item y0
  18453. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  18454. by default.
  18455. @item mode
  18456. Set forward/backward mode.
  18457. Available modes are:
  18458. @table @samp
  18459. @item forward
  18460. The larger the distance from the central point, the darker the image becomes.
  18461. @item backward
  18462. The larger the distance from the central point, the brighter the image becomes.
  18463. This can be used to reverse a vignette effect, though there is no automatic
  18464. detection to extract the lens @option{angle} and other settings (yet). It can
  18465. also be used to create a burning effect.
  18466. @end table
  18467. Default value is @samp{forward}.
  18468. @item eval
  18469. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  18470. It accepts the following values:
  18471. @table @samp
  18472. @item init
  18473. Evaluate expressions only once during the filter initialization.
  18474. @item frame
  18475. Evaluate expressions for each incoming frame. This is way slower than the
  18476. @samp{init} mode since it requires all the scalers to be re-computed, but it
  18477. allows advanced dynamic expressions.
  18478. @end table
  18479. Default value is @samp{init}.
  18480. @item dither
  18481. Set dithering to reduce the circular banding effects. Default is @code{1}
  18482. (enabled).
  18483. @item aspect
  18484. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  18485. Setting this value to the SAR of the input will make a rectangular vignetting
  18486. following the dimensions of the video.
  18487. Default is @code{1/1}.
  18488. @end table
  18489. @subsection Expressions
  18490. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  18491. following parameters.
  18492. @table @option
  18493. @item w
  18494. @item h
  18495. input width and height
  18496. @item n
  18497. the number of input frame, starting from 0
  18498. @item pts
  18499. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  18500. @var{TB} units, NAN if undefined
  18501. @item r
  18502. frame rate of the input video, NAN if the input frame rate is unknown
  18503. @item t
  18504. the PTS (Presentation TimeStamp) of the filtered video frame,
  18505. expressed in seconds, NAN if undefined
  18506. @item tb
  18507. time base of the input video
  18508. @end table
  18509. @subsection Examples
  18510. @itemize
  18511. @item
  18512. Apply simple strong vignetting effect:
  18513. @example
  18514. vignette=PI/4
  18515. @end example
  18516. @item
  18517. Make a flickering vignetting:
  18518. @example
  18519. vignette='PI/4+random(1)*PI/50':eval=frame
  18520. @end example
  18521. @end itemize
  18522. @section vmafmotion
  18523. Obtain the average VMAF motion score of a video.
  18524. It is one of the component metrics of VMAF.
  18525. The obtained average motion score is printed through the logging system.
  18526. The filter accepts the following options:
  18527. @table @option
  18528. @item stats_file
  18529. If specified, the filter will use the named file to save the motion score of
  18530. each frame with respect to the previous frame.
  18531. When filename equals "-" the data is sent to standard output.
  18532. @end table
  18533. Example:
  18534. @example
  18535. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  18536. @end example
  18537. @section vstack
  18538. Stack input videos vertically.
  18539. All streams must be of same pixel format and of same width.
  18540. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  18541. to create same output.
  18542. The filter accepts the following options:
  18543. @table @option
  18544. @item inputs
  18545. Set number of input streams. Default is 2.
  18546. @item shortest
  18547. If set to 1, force the output to terminate when the shortest input
  18548. terminates. Default value is 0.
  18549. @end table
  18550. @section w3fdif
  18551. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  18552. Deinterlacing Filter").
  18553. Based on the process described by Martin Weston for BBC R&D, and
  18554. implemented based on the de-interlace algorithm written by Jim
  18555. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  18556. uses filter coefficients calculated by BBC R&D.
  18557. This filter uses field-dominance information in frame to decide which
  18558. of each pair of fields to place first in the output.
  18559. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  18560. There are two sets of filter coefficients, so called "simple"
  18561. and "complex". Which set of filter coefficients is used can
  18562. be set by passing an optional parameter:
  18563. @table @option
  18564. @item filter
  18565. Set the interlacing filter coefficients. Accepts one of the following values:
  18566. @table @samp
  18567. @item simple
  18568. Simple filter coefficient set.
  18569. @item complex
  18570. More-complex filter coefficient set.
  18571. @end table
  18572. Default value is @samp{complex}.
  18573. @item mode
  18574. The interlacing mode to adopt. It accepts one of the following values:
  18575. @table @option
  18576. @item frame
  18577. Output one frame for each frame.
  18578. @item field
  18579. Output one frame for each field.
  18580. @end table
  18581. The default value is @code{field}.
  18582. @item parity
  18583. The picture field parity assumed for the input interlaced video. It accepts one
  18584. of the following values:
  18585. @table @option
  18586. @item tff
  18587. Assume the top field is first.
  18588. @item bff
  18589. Assume the bottom field is first.
  18590. @item auto
  18591. Enable automatic detection of field parity.
  18592. @end table
  18593. The default value is @code{auto}.
  18594. If the interlacing is unknown or the decoder does not export this information,
  18595. top field first will be assumed.
  18596. @item deint
  18597. Specify which frames to deinterlace. Accepts one of the following values:
  18598. @table @samp
  18599. @item all
  18600. Deinterlace all frames,
  18601. @item interlaced
  18602. Only deinterlace frames marked as interlaced.
  18603. @end table
  18604. Default value is @samp{all}.
  18605. @end table
  18606. @subsection Commands
  18607. This filter supports same @ref{commands} as options.
  18608. @section waveform
  18609. Video waveform monitor.
  18610. The waveform monitor plots color component intensity. By default luminance
  18611. only. Each column of the waveform corresponds to a column of pixels in the
  18612. source video.
  18613. It accepts the following options:
  18614. @table @option
  18615. @item mode, m
  18616. Can be either @code{row}, or @code{column}. Default is @code{column}.
  18617. In row mode, the graph on the left side represents color component value 0 and
  18618. the right side represents value = 255. In column mode, the top side represents
  18619. color component value = 0 and bottom side represents value = 255.
  18620. @item intensity, i
  18621. Set intensity. Smaller values are useful to find out how many values of the same
  18622. luminance are distributed across input rows/columns.
  18623. Default value is @code{0.04}. Allowed range is [0, 1].
  18624. @item mirror, r
  18625. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  18626. In mirrored mode, higher values will be represented on the left
  18627. side for @code{row} mode and at the top for @code{column} mode. Default is
  18628. @code{1} (mirrored).
  18629. @item display, d
  18630. Set display mode.
  18631. It accepts the following values:
  18632. @table @samp
  18633. @item overlay
  18634. Presents information identical to that in the @code{parade}, except
  18635. that the graphs representing color components are superimposed directly
  18636. over one another.
  18637. This display mode makes it easier to spot relative differences or similarities
  18638. in overlapping areas of the color components that are supposed to be identical,
  18639. such as neutral whites, grays, or blacks.
  18640. @item stack
  18641. Display separate graph for the color components side by side in
  18642. @code{row} mode or one below the other in @code{column} mode.
  18643. @item parade
  18644. Display separate graph for the color components side by side in
  18645. @code{column} mode or one below the other in @code{row} mode.
  18646. Using this display mode makes it easy to spot color casts in the highlights
  18647. and shadows of an image, by comparing the contours of the top and the bottom
  18648. graphs of each waveform. Since whites, grays, and blacks are characterized
  18649. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  18650. should display three waveforms of roughly equal width/height. If not, the
  18651. correction is easy to perform by making level adjustments the three waveforms.
  18652. @end table
  18653. Default is @code{stack}.
  18654. @item components, c
  18655. Set which color components to display. Default is 1, which means only luminance
  18656. or red color component if input is in RGB colorspace. If is set for example to
  18657. 7 it will display all 3 (if) available color components.
  18658. @item envelope, e
  18659. @table @samp
  18660. @item none
  18661. No envelope, this is default.
  18662. @item instant
  18663. Instant envelope, minimum and maximum values presented in graph will be easily
  18664. visible even with small @code{step} value.
  18665. @item peak
  18666. Hold minimum and maximum values presented in graph across time. This way you
  18667. can still spot out of range values without constantly looking at waveforms.
  18668. @item peak+instant
  18669. Peak and instant envelope combined together.
  18670. @end table
  18671. @item filter, f
  18672. @table @samp
  18673. @item lowpass
  18674. No filtering, this is default.
  18675. @item flat
  18676. Luma and chroma combined together.
  18677. @item aflat
  18678. Similar as above, but shows difference between blue and red chroma.
  18679. @item xflat
  18680. Similar as above, but use different colors.
  18681. @item yflat
  18682. Similar as above, but again with different colors.
  18683. @item chroma
  18684. Displays only chroma.
  18685. @item color
  18686. Displays actual color value on waveform.
  18687. @item acolor
  18688. Similar as above, but with luma showing frequency of chroma values.
  18689. @end table
  18690. @item graticule, g
  18691. Set which graticule to display.
  18692. @table @samp
  18693. @item none
  18694. Do not display graticule.
  18695. @item green
  18696. Display green graticule showing legal broadcast ranges.
  18697. @item orange
  18698. Display orange graticule showing legal broadcast ranges.
  18699. @item invert
  18700. Display invert graticule showing legal broadcast ranges.
  18701. @end table
  18702. @item opacity, o
  18703. Set graticule opacity.
  18704. @item flags, fl
  18705. Set graticule flags.
  18706. @table @samp
  18707. @item numbers
  18708. Draw numbers above lines. By default enabled.
  18709. @item dots
  18710. Draw dots instead of lines.
  18711. @end table
  18712. @item scale, s
  18713. Set scale used for displaying graticule.
  18714. @table @samp
  18715. @item digital
  18716. @item millivolts
  18717. @item ire
  18718. @end table
  18719. Default is digital.
  18720. @item bgopacity, b
  18721. Set background opacity.
  18722. @item tint0, t0
  18723. @item tint1, t1
  18724. Set tint for output.
  18725. Only used with lowpass filter and when display is not overlay and input
  18726. pixel formats are not RGB.
  18727. @item fitmode, fm
  18728. Set sample aspect ratio of video output frames.
  18729. Can be used to configure waveform so it is not
  18730. streched too much in one of directions.
  18731. @table @samp
  18732. @item none
  18733. Set sample aspect ration to 1/1.
  18734. @item size
  18735. Set sample aspect ratio to match input size of video
  18736. @end table
  18737. Default is @samp{none}.
  18738. @end table
  18739. @section weave, doubleweave
  18740. The @code{weave} takes a field-based video input and join
  18741. each two sequential fields into single frame, producing a new double
  18742. height clip with half the frame rate and half the frame count.
  18743. The @code{doubleweave} works same as @code{weave} but without
  18744. halving frame rate and frame count.
  18745. It accepts the following option:
  18746. @table @option
  18747. @item first_field
  18748. Set first field. Available values are:
  18749. @table @samp
  18750. @item top, t
  18751. Set the frame as top-field-first.
  18752. @item bottom, b
  18753. Set the frame as bottom-field-first.
  18754. @end table
  18755. @end table
  18756. @subsection Examples
  18757. @itemize
  18758. @item
  18759. Interlace video using @ref{select} and @ref{separatefields} filter:
  18760. @example
  18761. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  18762. @end example
  18763. @end itemize
  18764. @section xbr
  18765. Apply the xBR high-quality magnification filter which is designed for pixel
  18766. art. It follows a set of edge-detection rules, see
  18767. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  18768. It accepts the following option:
  18769. @table @option
  18770. @item n
  18771. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  18772. @code{3xBR} and @code{4} for @code{4xBR}.
  18773. Default is @code{3}.
  18774. @end table
  18775. @section xcorrelate
  18776. Apply normalized cross-correlation between first and second input video stream.
  18777. Second input video stream dimensions must be lower than first input video stream.
  18778. The filter accepts the following options:
  18779. @table @option
  18780. @item planes
  18781. Set which planes to process.
  18782. @item secondary
  18783. Set which secondary video frames will be processed from second input video stream,
  18784. can be @var{first} or @var{all}. Default is @var{all}.
  18785. @end table
  18786. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  18787. @section xfade
  18788. Apply cross fade from one input video stream to another input video stream.
  18789. The cross fade is applied for specified duration.
  18790. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  18791. frame rate and timebase.
  18792. The filter accepts the following options:
  18793. @table @option
  18794. @item transition
  18795. Set one of available transition effects:
  18796. @table @samp
  18797. @item custom
  18798. @item fade
  18799. @item wipeleft
  18800. @item wiperight
  18801. @item wipeup
  18802. @item wipedown
  18803. @item slideleft
  18804. @item slideright
  18805. @item slideup
  18806. @item slidedown
  18807. @item circlecrop
  18808. @item rectcrop
  18809. @item distance
  18810. @item fadeblack
  18811. @item fadewhite
  18812. @item radial
  18813. @item smoothleft
  18814. @item smoothright
  18815. @item smoothup
  18816. @item smoothdown
  18817. @item circleopen
  18818. @item circleclose
  18819. @item vertopen
  18820. @item vertclose
  18821. @item horzopen
  18822. @item horzclose
  18823. @item dissolve
  18824. @item pixelize
  18825. @item diagtl
  18826. @item diagtr
  18827. @item diagbl
  18828. @item diagbr
  18829. @item hlslice
  18830. @item hrslice
  18831. @item vuslice
  18832. @item vdslice
  18833. @item hblur
  18834. @item fadegrays
  18835. @item wipetl
  18836. @item wipetr
  18837. @item wipebl
  18838. @item wipebr
  18839. @item squeezeh
  18840. @item squeezev
  18841. @item zoomin
  18842. @item fadefast
  18843. @item fadeslow
  18844. @end table
  18845. Default transition effect is fade.
  18846. @item duration
  18847. Set cross fade duration in seconds.
  18848. Range is 0 to 60 seconds.
  18849. Default duration is 1 second.
  18850. @item offset
  18851. Set cross fade start relative to first input stream in seconds.
  18852. Default offset is 0.
  18853. @item expr
  18854. Set expression for custom transition effect.
  18855. The expressions can use the following variables and functions:
  18856. @table @option
  18857. @item X
  18858. @item Y
  18859. The coordinates of the current sample.
  18860. @item W
  18861. @item H
  18862. The width and height of the image.
  18863. @item P
  18864. Progress of transition effect.
  18865. @item PLANE
  18866. Currently processed plane.
  18867. @item A
  18868. Return value of first input at current location and plane.
  18869. @item B
  18870. Return value of second input at current location and plane.
  18871. @item a0(x, y)
  18872. @item a1(x, y)
  18873. @item a2(x, y)
  18874. @item a3(x, y)
  18875. Return the value of the pixel at location (@var{x},@var{y}) of the
  18876. first/second/third/fourth component of first input.
  18877. @item b0(x, y)
  18878. @item b1(x, y)
  18879. @item b2(x, y)
  18880. @item b3(x, y)
  18881. Return the value of the pixel at location (@var{x},@var{y}) of the
  18882. first/second/third/fourth component of second input.
  18883. @end table
  18884. @end table
  18885. @subsection Examples
  18886. @itemize
  18887. @item
  18888. Cross fade from one input video to another input video, with fade transition and duration of transition
  18889. of 2 seconds starting at offset of 5 seconds:
  18890. @example
  18891. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  18892. @end example
  18893. @end itemize
  18894. @section xmedian
  18895. Pick median pixels from several input videos.
  18896. The filter accepts the following options:
  18897. @table @option
  18898. @item inputs
  18899. Set number of inputs.
  18900. Default is 3. Allowed range is from 3 to 255.
  18901. If number of inputs is even number, than result will be mean value between two median values.
  18902. @item planes
  18903. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  18904. @item percentile
  18905. Set median percentile. Default value is @code{0.5}.
  18906. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  18907. minimum values, and @code{1} maximum values.
  18908. @end table
  18909. @subsection Commands
  18910. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  18911. @section xstack
  18912. Stack video inputs into custom layout.
  18913. All streams must be of same pixel format.
  18914. The filter accepts the following options:
  18915. @table @option
  18916. @item inputs
  18917. Set number of input streams. Default is 2.
  18918. @item layout
  18919. Specify layout of inputs.
  18920. This option requires the desired layout configuration to be explicitly set by the user.
  18921. This sets position of each video input in output. Each input
  18922. is separated by '|'.
  18923. The first number represents the column, and the second number represents the row.
  18924. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  18925. where X is video input from which to take width or height.
  18926. Multiple values can be used when separated by '+'. In such
  18927. case values are summed together.
  18928. Note that if inputs are of different sizes gaps may appear, as not all of
  18929. the output video frame will be filled. Similarly, videos can overlap each
  18930. other if their position doesn't leave enough space for the full frame of
  18931. adjoining videos.
  18932. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  18933. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  18934. the user. Either @code{grid} or @code{layout} can be specified at a time.
  18935. Specifying both will result in an error.
  18936. @item grid
  18937. Specify a fixed size grid of inputs.
  18938. This option is used to create a fixed size grid of the input streams. Set the
  18939. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  18940. input streams and they will be arranged as a grid with @code{ROWS} rows and
  18941. @code{COLUMNS} columns. When using this option, each input stream within a row
  18942. must have the same height and all the rows must have the same width.
  18943. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  18944. set to @code{ROWS * COLUMNS}.
  18945. For 2 inputs, a default grid of @code{2x1} (equivalent to
  18946. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  18947. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  18948. Specifying both will result in an error.
  18949. @item shortest
  18950. If set to 1, force the output to terminate when the shortest input
  18951. terminates. Default value is 0.
  18952. @item fill
  18953. If set to valid color, all unused pixels will be filled with that color.
  18954. By default fill is set to none, so it is disabled.
  18955. @end table
  18956. @subsection Examples
  18957. @itemize
  18958. @item
  18959. Display 4 inputs into 2x2 grid.
  18960. Layout:
  18961. @example
  18962. input1(0, 0) | input3(w0, 0)
  18963. input2(0, h0) | input4(w0, h0)
  18964. @end example
  18965. @example
  18966. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  18967. @end example
  18968. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18969. @item
  18970. Display 4 inputs into 1x4 grid.
  18971. Layout:
  18972. @example
  18973. input1(0, 0)
  18974. input2(0, h0)
  18975. input3(0, h0+h1)
  18976. input4(0, h0+h1+h2)
  18977. @end example
  18978. @example
  18979. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  18980. @end example
  18981. Note that if inputs are of different widths, unused space will appear.
  18982. @item
  18983. Display 9 inputs into 3x3 grid.
  18984. Layout:
  18985. @example
  18986. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  18987. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  18988. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  18989. @end example
  18990. @example
  18991. 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
  18992. @end example
  18993. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18994. @item
  18995. Display 16 inputs into 4x4 grid.
  18996. Layout:
  18997. @example
  18998. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  18999. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  19000. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  19001. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  19002. @end example
  19003. @example
  19004. 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|
  19005. 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
  19006. @end example
  19007. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19008. @end itemize
  19009. @anchor{yadif}
  19010. @section yadif
  19011. Deinterlace the input video ("yadif" means "yet another deinterlacing
  19012. filter").
  19013. It accepts the following parameters:
  19014. @table @option
  19015. @item mode
  19016. The interlacing mode to adopt. It accepts one of the following values:
  19017. @table @option
  19018. @item 0, send_frame
  19019. Output one frame for each frame.
  19020. @item 1, send_field
  19021. Output one frame for each field.
  19022. @item 2, send_frame_nospatial
  19023. Like @code{send_frame}, but it skips the spatial interlacing check.
  19024. @item 3, send_field_nospatial
  19025. Like @code{send_field}, but it skips the spatial interlacing check.
  19026. @end table
  19027. The default value is @code{send_frame}.
  19028. @item parity
  19029. The picture field parity assumed for the input interlaced video. It accepts one
  19030. of the following values:
  19031. @table @option
  19032. @item 0, tff
  19033. Assume the top field is first.
  19034. @item 1, bff
  19035. Assume the bottom field is first.
  19036. @item -1, auto
  19037. Enable automatic detection of field parity.
  19038. @end table
  19039. The default value is @code{auto}.
  19040. If the interlacing is unknown or the decoder does not export this information,
  19041. top field first will be assumed.
  19042. @item deint
  19043. Specify which frames to deinterlace. Accepts one of the following
  19044. values:
  19045. @table @option
  19046. @item 0, all
  19047. Deinterlace all frames.
  19048. @item 1, interlaced
  19049. Only deinterlace frames marked as interlaced.
  19050. @end table
  19051. The default value is @code{all}.
  19052. @end table
  19053. @section yadif_cuda
  19054. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  19055. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  19056. and/or nvenc.
  19057. It accepts the following parameters:
  19058. @table @option
  19059. @item mode
  19060. The interlacing mode to adopt. It accepts one of the following values:
  19061. @table @option
  19062. @item 0, send_frame
  19063. Output one frame for each frame.
  19064. @item 1, send_field
  19065. Output one frame for each field.
  19066. @item 2, send_frame_nospatial
  19067. Like @code{send_frame}, but it skips the spatial interlacing check.
  19068. @item 3, send_field_nospatial
  19069. Like @code{send_field}, but it skips the spatial interlacing check.
  19070. @end table
  19071. The default value is @code{send_frame}.
  19072. @item parity
  19073. The picture field parity assumed for the input interlaced video. It accepts one
  19074. of the following values:
  19075. @table @option
  19076. @item 0, tff
  19077. Assume the top field is first.
  19078. @item 1, bff
  19079. Assume the bottom field is first.
  19080. @item -1, auto
  19081. Enable automatic detection of field parity.
  19082. @end table
  19083. The default value is @code{auto}.
  19084. If the interlacing is unknown or the decoder does not export this information,
  19085. top field first will be assumed.
  19086. @item deint
  19087. Specify which frames to deinterlace. Accepts one of the following
  19088. values:
  19089. @table @option
  19090. @item 0, all
  19091. Deinterlace all frames.
  19092. @item 1, interlaced
  19093. Only deinterlace frames marked as interlaced.
  19094. @end table
  19095. The default value is @code{all}.
  19096. @end table
  19097. @section yaepblur
  19098. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  19099. The algorithm is described in
  19100. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  19101. It accepts the following parameters:
  19102. @table @option
  19103. @item radius, r
  19104. Set the window radius. Default value is 3.
  19105. @item planes, p
  19106. Set which planes to filter. Default is only the first plane.
  19107. @item sigma, s
  19108. Set blur strength. Default value is 128.
  19109. @end table
  19110. @subsection Commands
  19111. This filter supports same @ref{commands} as options.
  19112. @section zoompan
  19113. Apply Zoom & Pan effect.
  19114. This filter accepts the following options:
  19115. @table @option
  19116. @item zoom, z
  19117. Set the zoom expression. Range is 1-10. Default is 1.
  19118. @item x
  19119. @item y
  19120. Set the x and y expression. Default is 0.
  19121. @item d
  19122. Set the duration expression in number of frames.
  19123. This sets for how many number of frames effect will last for
  19124. single input image. Default is 90.
  19125. @item s
  19126. Set the output image size, default is 'hd720'.
  19127. @item fps
  19128. Set the output frame rate, default is '25'.
  19129. @end table
  19130. Each expression can contain the following constants:
  19131. @table @option
  19132. @item in_w, iw
  19133. Input width.
  19134. @item in_h, ih
  19135. Input height.
  19136. @item out_w, ow
  19137. Output width.
  19138. @item out_h, oh
  19139. Output height.
  19140. @item in
  19141. Input frame count.
  19142. @item on
  19143. Output frame count.
  19144. @item in_time, it
  19145. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  19146. @item out_time, time, ot
  19147. The output timestamp expressed in seconds.
  19148. @item x
  19149. @item y
  19150. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  19151. for current input frame.
  19152. @item px
  19153. @item py
  19154. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  19155. not yet such frame (first input frame).
  19156. @item zoom
  19157. Last calculated zoom from 'z' expression for current input frame.
  19158. @item pzoom
  19159. Last calculated zoom of last output frame of previous input frame.
  19160. @item duration
  19161. Number of output frames for current input frame. Calculated from 'd' expression
  19162. for each input frame.
  19163. @item pduration
  19164. number of output frames created for previous input frame
  19165. @item a
  19166. Rational number: input width / input height
  19167. @item sar
  19168. sample aspect ratio
  19169. @item dar
  19170. display aspect ratio
  19171. @end table
  19172. @subsection Examples
  19173. @itemize
  19174. @item
  19175. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  19176. @example
  19177. 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
  19178. @end example
  19179. @item
  19180. Zoom in up to 1.5x and pan always at center of picture:
  19181. @example
  19182. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19183. @end example
  19184. @item
  19185. Same as above but without pausing:
  19186. @example
  19187. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19188. @end example
  19189. @item
  19190. Zoom in 2x into center of picture only for the first second of the input video:
  19191. @example
  19192. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19193. @end example
  19194. @end itemize
  19195. @anchor{zscale}
  19196. @section zscale
  19197. Scale (resize) the input video, using the z.lib library:
  19198. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  19199. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  19200. The zscale filter forces the output display aspect ratio to be the same
  19201. as the input, by changing the output sample aspect ratio.
  19202. If the input image format is different from the format requested by
  19203. the next filter, the zscale filter will convert the input to the
  19204. requested format.
  19205. @subsection Options
  19206. The filter accepts the following options.
  19207. @table @option
  19208. @item width, w
  19209. @item height, h
  19210. Set the output video dimension expression. Default value is the input
  19211. dimension.
  19212. If the @var{width} or @var{w} value is 0, the input width is used for
  19213. the output. If the @var{height} or @var{h} value is 0, the input height
  19214. is used for the output.
  19215. If one and only one of the values is -n with n >= 1, the zscale filter
  19216. will use a value that maintains the aspect ratio of the input image,
  19217. calculated from the other specified dimension. After that it will,
  19218. however, make sure that the calculated dimension is divisible by n and
  19219. adjust the value if necessary.
  19220. If both values are -n with n >= 1, the behavior will be identical to
  19221. both values being set to 0 as previously detailed.
  19222. See below for the list of accepted constants for use in the dimension
  19223. expression.
  19224. @item size, s
  19225. Set the video size. For the syntax of this option, check the
  19226. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19227. @item dither, d
  19228. Set the dither type.
  19229. Possible values are:
  19230. @table @var
  19231. @item none
  19232. @item ordered
  19233. @item random
  19234. @item error_diffusion
  19235. @end table
  19236. Default is none.
  19237. @item filter, f
  19238. Set the resize filter type.
  19239. Possible values are:
  19240. @table @var
  19241. @item point
  19242. @item bilinear
  19243. @item bicubic
  19244. @item spline16
  19245. @item spline36
  19246. @item lanczos
  19247. @end table
  19248. Default is bilinear.
  19249. @item range, r
  19250. Set the color range.
  19251. Possible values are:
  19252. @table @var
  19253. @item input
  19254. @item limited
  19255. @item full
  19256. @end table
  19257. Default is same as input.
  19258. @item primaries, p
  19259. Set the color primaries.
  19260. Possible values are:
  19261. @table @var
  19262. @item input
  19263. @item 709
  19264. @item unspecified
  19265. @item 170m
  19266. @item 240m
  19267. @item 2020
  19268. @end table
  19269. Default is same as input.
  19270. @item transfer, t
  19271. Set the transfer characteristics.
  19272. Possible values are:
  19273. @table @var
  19274. @item input
  19275. @item 709
  19276. @item unspecified
  19277. @item 601
  19278. @item linear
  19279. @item 2020_10
  19280. @item 2020_12
  19281. @item smpte2084
  19282. @item iec61966-2-1
  19283. @item arib-std-b67
  19284. @end table
  19285. Default is same as input.
  19286. @item matrix, m
  19287. Set the colorspace matrix.
  19288. Possible value are:
  19289. @table @var
  19290. @item input
  19291. @item 709
  19292. @item unspecified
  19293. @item 470bg
  19294. @item 170m
  19295. @item 2020_ncl
  19296. @item 2020_cl
  19297. @end table
  19298. Default is same as input.
  19299. @item rangein, rin
  19300. Set the input color range.
  19301. Possible values are:
  19302. @table @var
  19303. @item input
  19304. @item limited
  19305. @item full
  19306. @end table
  19307. Default is same as input.
  19308. @item primariesin, pin
  19309. Set the input color primaries.
  19310. Possible values are:
  19311. @table @var
  19312. @item input
  19313. @item 709
  19314. @item unspecified
  19315. @item 170m
  19316. @item 240m
  19317. @item 2020
  19318. @end table
  19319. Default is same as input.
  19320. @item transferin, tin
  19321. Set the input transfer characteristics.
  19322. Possible values are:
  19323. @table @var
  19324. @item input
  19325. @item 709
  19326. @item unspecified
  19327. @item 601
  19328. @item linear
  19329. @item 2020_10
  19330. @item 2020_12
  19331. @end table
  19332. Default is same as input.
  19333. @item matrixin, min
  19334. Set the input colorspace matrix.
  19335. Possible value are:
  19336. @table @var
  19337. @item input
  19338. @item 709
  19339. @item unspecified
  19340. @item 470bg
  19341. @item 170m
  19342. @item 2020_ncl
  19343. @item 2020_cl
  19344. @end table
  19345. @item chromal, c
  19346. Set the output chroma location.
  19347. Possible values are:
  19348. @table @var
  19349. @item input
  19350. @item left
  19351. @item center
  19352. @item topleft
  19353. @item top
  19354. @item bottomleft
  19355. @item bottom
  19356. @end table
  19357. @item chromalin, cin
  19358. Set the input chroma location.
  19359. Possible values are:
  19360. @table @var
  19361. @item input
  19362. @item left
  19363. @item center
  19364. @item topleft
  19365. @item top
  19366. @item bottomleft
  19367. @item bottom
  19368. @end table
  19369. @item npl
  19370. Set the nominal peak luminance.
  19371. @item param_a
  19372. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  19373. filter taps for lanczos.
  19374. @item param_b
  19375. Parameter B for scaling filters. Parameter "c" for bicubic.
  19376. @end table
  19377. The values of the @option{w} and @option{h} options are expressions
  19378. containing the following constants:
  19379. @table @var
  19380. @item in_w
  19381. @item in_h
  19382. The input width and height
  19383. @item iw
  19384. @item ih
  19385. These are the same as @var{in_w} and @var{in_h}.
  19386. @item out_w
  19387. @item out_h
  19388. The output (scaled) width and height
  19389. @item ow
  19390. @item oh
  19391. These are the same as @var{out_w} and @var{out_h}
  19392. @item a
  19393. The same as @var{iw} / @var{ih}
  19394. @item sar
  19395. input sample aspect ratio
  19396. @item dar
  19397. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  19398. @item hsub
  19399. @item vsub
  19400. horizontal and vertical input chroma subsample values. For example for the
  19401. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19402. @item ohsub
  19403. @item ovsub
  19404. horizontal and vertical output chroma subsample values. For example for the
  19405. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19406. @end table
  19407. @subsection Commands
  19408. This filter supports the following commands:
  19409. @table @option
  19410. @item width, w
  19411. @item height, h
  19412. Set the output video dimension expression.
  19413. The command accepts the same syntax of the corresponding option.
  19414. If the specified expression is not valid, it is kept at its current
  19415. value.
  19416. @end table
  19417. @c man end VIDEO FILTERS
  19418. @chapter OpenCL Video Filters
  19419. @c man begin OPENCL VIDEO FILTERS
  19420. Below is a description of the currently available OpenCL video filters.
  19421. To enable compilation of these filters you need to configure FFmpeg with
  19422. @code{--enable-opencl}.
  19423. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  19424. @table @option
  19425. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  19426. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  19427. given device parameters.
  19428. @item -filter_hw_device @var{name}
  19429. Pass the hardware device called @var{name} to all filters in any filter graph.
  19430. @end table
  19431. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  19432. @itemize
  19433. @item
  19434. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  19435. @example
  19436. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  19437. @end example
  19438. @end itemize
  19439. 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.
  19440. @section avgblur_opencl
  19441. Apply average blur filter.
  19442. The filter accepts the following options:
  19443. @table @option
  19444. @item sizeX
  19445. Set horizontal radius size.
  19446. Range is @code{[1, 1024]} and default value is @code{1}.
  19447. @item planes
  19448. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19449. @item sizeY
  19450. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  19451. @end table
  19452. @subsection Example
  19453. @itemize
  19454. @item
  19455. 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.
  19456. @example
  19457. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  19458. @end example
  19459. @end itemize
  19460. @section boxblur_opencl
  19461. Apply a boxblur algorithm to the input video.
  19462. It accepts the following parameters:
  19463. @table @option
  19464. @item luma_radius, lr
  19465. @item luma_power, lp
  19466. @item chroma_radius, cr
  19467. @item chroma_power, cp
  19468. @item alpha_radius, ar
  19469. @item alpha_power, ap
  19470. @end table
  19471. A description of the accepted options follows.
  19472. @table @option
  19473. @item luma_radius, lr
  19474. @item chroma_radius, cr
  19475. @item alpha_radius, ar
  19476. Set an expression for the box radius in pixels used for blurring the
  19477. corresponding input plane.
  19478. The radius value must be a non-negative number, and must not be
  19479. greater than the value of the expression @code{min(w,h)/2} for the
  19480. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  19481. planes.
  19482. Default value for @option{luma_radius} is "2". If not specified,
  19483. @option{chroma_radius} and @option{alpha_radius} default to the
  19484. corresponding value set for @option{luma_radius}.
  19485. The expressions can contain the following constants:
  19486. @table @option
  19487. @item w
  19488. @item h
  19489. The input width and height in pixels.
  19490. @item cw
  19491. @item ch
  19492. The input chroma image width and height in pixels.
  19493. @item hsub
  19494. @item vsub
  19495. The horizontal and vertical chroma subsample values. For example, for the
  19496. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  19497. @end table
  19498. @item luma_power, lp
  19499. @item chroma_power, cp
  19500. @item alpha_power, ap
  19501. Specify how many times the boxblur filter is applied to the
  19502. corresponding plane.
  19503. Default value for @option{luma_power} is 2. If not specified,
  19504. @option{chroma_power} and @option{alpha_power} default to the
  19505. corresponding value set for @option{luma_power}.
  19506. A value of 0 will disable the effect.
  19507. @end table
  19508. @subsection Examples
  19509. 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.
  19510. @itemize
  19511. @item
  19512. Apply a boxblur filter with the luma, chroma, and alpha radius
  19513. 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.
  19514. @example
  19515. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  19516. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  19517. @end example
  19518. @item
  19519. 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.
  19520. For the luma plane, a 2x2 box radius will be run once.
  19521. For the chroma plane, a 4x4 box radius will be run 5 times.
  19522. For the alpha plane, a 3x3 box radius will be run 7 times.
  19523. @example
  19524. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  19525. @end example
  19526. @end itemize
  19527. @section colorkey_opencl
  19528. RGB colorspace color keying.
  19529. The filter accepts the following options:
  19530. @table @option
  19531. @item color
  19532. The color which will be replaced with transparency.
  19533. @item similarity
  19534. Similarity percentage with the key color.
  19535. 0.01 matches only the exact key color, while 1.0 matches everything.
  19536. @item blend
  19537. Blend percentage.
  19538. 0.0 makes pixels either fully transparent, or not transparent at all.
  19539. Higher values result in semi-transparent pixels, with a higher transparency
  19540. the more similar the pixels color is to the key color.
  19541. @end table
  19542. @subsection Examples
  19543. @itemize
  19544. @item
  19545. Make every semi-green pixel in the input transparent with some slight blending:
  19546. @example
  19547. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  19548. @end example
  19549. @end itemize
  19550. @section convolution_opencl
  19551. Apply convolution of 3x3, 5x5, 7x7 matrix.
  19552. The filter accepts the following options:
  19553. @table @option
  19554. @item 0m
  19555. @item 1m
  19556. @item 2m
  19557. @item 3m
  19558. Set matrix for each plane.
  19559. Matrix is sequence of 9, 25 or 49 signed numbers.
  19560. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  19561. @item 0rdiv
  19562. @item 1rdiv
  19563. @item 2rdiv
  19564. @item 3rdiv
  19565. Set multiplier for calculated value for each plane.
  19566. If unset or 0, it will be sum of all matrix elements.
  19567. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  19568. @item 0bias
  19569. @item 1bias
  19570. @item 2bias
  19571. @item 3bias
  19572. Set bias for each plane. This value is added to the result of the multiplication.
  19573. Useful for making the overall image brighter or darker.
  19574. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  19575. @end table
  19576. @subsection Examples
  19577. @itemize
  19578. @item
  19579. Apply sharpen:
  19580. @example
  19581. -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
  19582. @end example
  19583. @item
  19584. Apply blur:
  19585. @example
  19586. -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
  19587. @end example
  19588. @item
  19589. Apply edge enhance:
  19590. @example
  19591. -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
  19592. @end example
  19593. @item
  19594. Apply edge detect:
  19595. @example
  19596. -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
  19597. @end example
  19598. @item
  19599. Apply laplacian edge detector which includes diagonals:
  19600. @example
  19601. -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
  19602. @end example
  19603. @item
  19604. Apply emboss:
  19605. @example
  19606. -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
  19607. @end example
  19608. @end itemize
  19609. @section erosion_opencl
  19610. Apply erosion effect to the video.
  19611. This filter replaces the pixel by the local(3x3) minimum.
  19612. It accepts the following options:
  19613. @table @option
  19614. @item threshold0
  19615. @item threshold1
  19616. @item threshold2
  19617. @item threshold3
  19618. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19619. If @code{0}, plane will remain unchanged.
  19620. @item coordinates
  19621. Flag which specifies the pixel to refer to.
  19622. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19623. Flags to local 3x3 coordinates region centered on @code{x}:
  19624. 1 2 3
  19625. 4 x 5
  19626. 6 7 8
  19627. @end table
  19628. @subsection Example
  19629. @itemize
  19630. @item
  19631. 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.
  19632. @example
  19633. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19634. @end example
  19635. @end itemize
  19636. @section deshake_opencl
  19637. Feature-point based video stabilization filter.
  19638. The filter accepts the following options:
  19639. @table @option
  19640. @item tripod
  19641. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  19642. @item debug
  19643. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  19644. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  19645. Viewing point matches in the output video is only supported for RGB input.
  19646. Defaults to @code{0}.
  19647. @item adaptive_crop
  19648. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  19649. Defaults to @code{1}.
  19650. @item refine_features
  19651. Whether or not feature points should be refined at a sub-pixel level.
  19652. This can be turned off for a slight performance gain at the cost of precision.
  19653. Defaults to @code{1}.
  19654. @item smooth_strength
  19655. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  19656. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  19657. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  19658. Defaults to @code{0.0}.
  19659. @item smooth_window_multiplier
  19660. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  19661. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  19662. Acceptable values range from @code{0.1} to @code{10.0}.
  19663. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  19664. potentially improving smoothness, but also increase latency and memory usage.
  19665. Defaults to @code{2.0}.
  19666. @end table
  19667. @subsection Examples
  19668. @itemize
  19669. @item
  19670. Stabilize a video with a fixed, medium smoothing strength:
  19671. @example
  19672. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  19673. @end example
  19674. @item
  19675. Stabilize a video with debugging (both in console and in rendered video):
  19676. @example
  19677. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  19678. @end example
  19679. @end itemize
  19680. @section dilation_opencl
  19681. Apply dilation effect to the video.
  19682. This filter replaces the pixel by the local(3x3) maximum.
  19683. It accepts the following options:
  19684. @table @option
  19685. @item threshold0
  19686. @item threshold1
  19687. @item threshold2
  19688. @item threshold3
  19689. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19690. If @code{0}, plane will remain unchanged.
  19691. @item coordinates
  19692. Flag which specifies the pixel to refer to.
  19693. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19694. Flags to local 3x3 coordinates region centered on @code{x}:
  19695. 1 2 3
  19696. 4 x 5
  19697. 6 7 8
  19698. @end table
  19699. @subsection Example
  19700. @itemize
  19701. @item
  19702. 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.
  19703. @example
  19704. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19705. @end example
  19706. @end itemize
  19707. @section nlmeans_opencl
  19708. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  19709. @section overlay_opencl
  19710. Overlay one video on top of another.
  19711. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  19712. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  19713. The filter accepts the following options:
  19714. @table @option
  19715. @item x
  19716. Set the x coordinate of the overlaid video on the main video.
  19717. Default value is @code{0}.
  19718. @item y
  19719. Set the y coordinate of the overlaid video on the main video.
  19720. Default value is @code{0}.
  19721. @end table
  19722. @subsection Examples
  19723. @itemize
  19724. @item
  19725. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  19726. @example
  19727. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19728. @end example
  19729. @item
  19730. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  19731. @example
  19732. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19733. @end example
  19734. @end itemize
  19735. @section pad_opencl
  19736. Add paddings to the input image, and place the original input at the
  19737. provided @var{x}, @var{y} coordinates.
  19738. It accepts the following options:
  19739. @table @option
  19740. @item width, w
  19741. @item height, h
  19742. Specify an expression for the size of the output image with the
  19743. paddings added. If the value for @var{width} or @var{height} is 0, the
  19744. corresponding input size is used for the output.
  19745. The @var{width} expression can reference the value set by the
  19746. @var{height} expression, and vice versa.
  19747. The default value of @var{width} and @var{height} is 0.
  19748. @item x
  19749. @item y
  19750. Specify the offsets to place the input image at within the padded area,
  19751. with respect to the top/left border of the output image.
  19752. The @var{x} expression can reference the value set by the @var{y}
  19753. expression, and vice versa.
  19754. The default value of @var{x} and @var{y} is 0.
  19755. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  19756. so the input image is centered on the padded area.
  19757. @item color
  19758. Specify the color of the padded area. For the syntax of this option,
  19759. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  19760. manual,ffmpeg-utils}.
  19761. @item aspect
  19762. Pad to an aspect instead to a resolution.
  19763. @end table
  19764. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  19765. options are expressions containing the following constants:
  19766. @table @option
  19767. @item in_w
  19768. @item in_h
  19769. The input video width and height.
  19770. @item iw
  19771. @item ih
  19772. These are the same as @var{in_w} and @var{in_h}.
  19773. @item out_w
  19774. @item out_h
  19775. The output width and height (the size of the padded area), as
  19776. specified by the @var{width} and @var{height} expressions.
  19777. @item ow
  19778. @item oh
  19779. These are the same as @var{out_w} and @var{out_h}.
  19780. @item x
  19781. @item y
  19782. The x and y offsets as specified by the @var{x} and @var{y}
  19783. expressions, or NAN if not yet specified.
  19784. @item a
  19785. same as @var{iw} / @var{ih}
  19786. @item sar
  19787. input sample aspect ratio
  19788. @item dar
  19789. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  19790. @end table
  19791. @section prewitt_opencl
  19792. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  19793. The filter accepts the following option:
  19794. @table @option
  19795. @item planes
  19796. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19797. @item scale
  19798. Set value which will be multiplied with filtered result.
  19799. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19800. @item delta
  19801. Set value which will be added to filtered result.
  19802. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19803. @end table
  19804. @subsection Example
  19805. @itemize
  19806. @item
  19807. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  19808. @example
  19809. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19810. @end example
  19811. @end itemize
  19812. @anchor{program_opencl}
  19813. @section program_opencl
  19814. Filter video using an OpenCL program.
  19815. @table @option
  19816. @item source
  19817. OpenCL program source file.
  19818. @item kernel
  19819. Kernel name in program.
  19820. @item inputs
  19821. Number of inputs to the filter. Defaults to 1.
  19822. @item size, s
  19823. Size of output frames. Defaults to the same as the first input.
  19824. @end table
  19825. The @code{program_opencl} filter also supports the @ref{framesync} options.
  19826. The program source file must contain a kernel function with the given name,
  19827. which will be run once for each plane of the output. Each run on a plane
  19828. gets enqueued as a separate 2D global NDRange with one work-item for each
  19829. pixel to be generated. The global ID offset for each work-item is therefore
  19830. the coordinates of a pixel in the destination image.
  19831. The kernel function needs to take the following arguments:
  19832. @itemize
  19833. @item
  19834. Destination image, @var{__write_only image2d_t}.
  19835. This image will become the output; the kernel should write all of it.
  19836. @item
  19837. Frame index, @var{unsigned int}.
  19838. This is a counter starting from zero and increasing by one for each frame.
  19839. @item
  19840. Source images, @var{__read_only image2d_t}.
  19841. These are the most recent images on each input. The kernel may read from
  19842. them to generate the output, but they can't be written to.
  19843. @end itemize
  19844. Example programs:
  19845. @itemize
  19846. @item
  19847. Copy the input to the output (output must be the same size as the input).
  19848. @verbatim
  19849. __kernel void copy(__write_only image2d_t destination,
  19850. unsigned int index,
  19851. __read_only image2d_t source)
  19852. {
  19853. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  19854. int2 location = (int2)(get_global_id(0), get_global_id(1));
  19855. float4 value = read_imagef(source, sampler, location);
  19856. write_imagef(destination, location, value);
  19857. }
  19858. @end verbatim
  19859. @item
  19860. Apply a simple transformation, rotating the input by an amount increasing
  19861. with the index counter. Pixel values are linearly interpolated by the
  19862. sampler, and the output need not have the same dimensions as the input.
  19863. @verbatim
  19864. __kernel void rotate_image(__write_only image2d_t dst,
  19865. unsigned int index,
  19866. __read_only image2d_t src)
  19867. {
  19868. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19869. CLK_FILTER_LINEAR);
  19870. float angle = (float)index / 100.0f;
  19871. float2 dst_dim = convert_float2(get_image_dim(dst));
  19872. float2 src_dim = convert_float2(get_image_dim(src));
  19873. float2 dst_cen = dst_dim / 2.0f;
  19874. float2 src_cen = src_dim / 2.0f;
  19875. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19876. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  19877. float2 src_pos = {
  19878. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  19879. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  19880. };
  19881. src_pos = src_pos * src_dim / dst_dim;
  19882. float2 src_loc = src_pos + src_cen;
  19883. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  19884. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  19885. write_imagef(dst, dst_loc, 0.5f);
  19886. else
  19887. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  19888. }
  19889. @end verbatim
  19890. @item
  19891. Blend two inputs together, with the amount of each input used varying
  19892. with the index counter.
  19893. @verbatim
  19894. __kernel void blend_images(__write_only image2d_t dst,
  19895. unsigned int index,
  19896. __read_only image2d_t src1,
  19897. __read_only image2d_t src2)
  19898. {
  19899. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19900. CLK_FILTER_LINEAR);
  19901. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  19902. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19903. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  19904. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  19905. float4 val1 = read_imagef(src1, sampler, src1_loc);
  19906. float4 val2 = read_imagef(src2, sampler, src2_loc);
  19907. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  19908. }
  19909. @end verbatim
  19910. @end itemize
  19911. @section remap_opencl
  19912. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  19913. Destination pixel at position (X, Y) will be picked from source (x, y) position
  19914. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  19915. value for pixel will be used for destination pixel.
  19916. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  19917. will have Xmap/Ymap video stream dimensions.
  19918. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  19919. @table @option
  19920. @item interp
  19921. Specify interpolation used for remapping of pixels.
  19922. Allowed values are @code{near} and @code{linear}.
  19923. Default value is @code{linear}.
  19924. @item fill
  19925. Specify the color of the unmapped pixels. For the syntax of this option,
  19926. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  19927. manual,ffmpeg-utils}. Default color is @code{black}.
  19928. @end table
  19929. @section roberts_opencl
  19930. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  19931. The filter accepts the following option:
  19932. @table @option
  19933. @item planes
  19934. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19935. @item scale
  19936. Set value which will be multiplied with filtered result.
  19937. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19938. @item delta
  19939. Set value which will be added to filtered result.
  19940. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19941. @end table
  19942. @subsection Example
  19943. @itemize
  19944. @item
  19945. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  19946. @example
  19947. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19948. @end example
  19949. @end itemize
  19950. @section sobel_opencl
  19951. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  19952. The filter accepts the following option:
  19953. @table @option
  19954. @item planes
  19955. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19956. @item scale
  19957. Set value which will be multiplied with filtered result.
  19958. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19959. @item delta
  19960. Set value which will be added to filtered result.
  19961. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19962. @end table
  19963. @subsection Example
  19964. @itemize
  19965. @item
  19966. Apply sobel operator with scale set to 2 and delta set to 10
  19967. @example
  19968. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19969. @end example
  19970. @end itemize
  19971. @section tonemap_opencl
  19972. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  19973. It accepts the following parameters:
  19974. @table @option
  19975. @item tonemap
  19976. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  19977. @item param
  19978. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  19979. @item desat
  19980. Apply desaturation for highlights that exceed this level of brightness. The
  19981. higher the parameter, the more color information will be preserved. This
  19982. setting helps prevent unnaturally blown-out colors for super-highlights, by
  19983. (smoothly) turning into white instead. This makes images feel more natural,
  19984. at the cost of reducing information about out-of-range colors.
  19985. The default value is 0.5, and the algorithm here is a little different from
  19986. the cpu version tonemap currently. A setting of 0.0 disables this option.
  19987. @item threshold
  19988. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  19989. is used to detect whether the scene has changed or not. If the distance between
  19990. the current frame average brightness and the current running average exceeds
  19991. a threshold value, we would re-calculate scene average and peak brightness.
  19992. The default value is 0.2.
  19993. @item format
  19994. Specify the output pixel format.
  19995. Currently supported formats are:
  19996. @table @var
  19997. @item p010
  19998. @item nv12
  19999. @end table
  20000. @item range, r
  20001. Set the output color range.
  20002. Possible values are:
  20003. @table @var
  20004. @item tv/mpeg
  20005. @item pc/jpeg
  20006. @end table
  20007. Default is same as input.
  20008. @item primaries, p
  20009. Set the output color primaries.
  20010. Possible values are:
  20011. @table @var
  20012. @item bt709
  20013. @item bt2020
  20014. @end table
  20015. Default is same as input.
  20016. @item transfer, t
  20017. Set the output transfer characteristics.
  20018. Possible values are:
  20019. @table @var
  20020. @item bt709
  20021. @item bt2020
  20022. @end table
  20023. Default is bt709.
  20024. @item matrix, m
  20025. Set the output colorspace matrix.
  20026. Possible value are:
  20027. @table @var
  20028. @item bt709
  20029. @item bt2020
  20030. @end table
  20031. Default is same as input.
  20032. @end table
  20033. @subsection Example
  20034. @itemize
  20035. @item
  20036. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  20037. @example
  20038. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  20039. @end example
  20040. @end itemize
  20041. @section unsharp_opencl
  20042. Sharpen or blur the input video.
  20043. It accepts the following parameters:
  20044. @table @option
  20045. @item luma_msize_x, lx
  20046. Set the luma matrix horizontal size.
  20047. Range is @code{[1, 23]} and default value is @code{5}.
  20048. @item luma_msize_y, ly
  20049. Set the luma matrix vertical size.
  20050. Range is @code{[1, 23]} and default value is @code{5}.
  20051. @item luma_amount, la
  20052. Set the luma effect strength.
  20053. Range is @code{[-10, 10]} and default value is @code{1.0}.
  20054. Negative values will blur the input video, while positive values will
  20055. sharpen it, a value of zero will disable the effect.
  20056. @item chroma_msize_x, cx
  20057. Set the chroma matrix horizontal size.
  20058. Range is @code{[1, 23]} and default value is @code{5}.
  20059. @item chroma_msize_y, cy
  20060. Set the chroma matrix vertical size.
  20061. Range is @code{[1, 23]} and default value is @code{5}.
  20062. @item chroma_amount, ca
  20063. Set the chroma effect strength.
  20064. Range is @code{[-10, 10]} and default value is @code{0.0}.
  20065. Negative values will blur the input video, while positive values will
  20066. sharpen it, a value of zero will disable the effect.
  20067. @end table
  20068. All parameters are optional and default to the equivalent of the
  20069. string '5:5:1.0:5:5:0.0'.
  20070. @subsection Examples
  20071. @itemize
  20072. @item
  20073. Apply strong luma sharpen effect:
  20074. @example
  20075. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  20076. @end example
  20077. @item
  20078. Apply a strong blur of both luma and chroma parameters:
  20079. @example
  20080. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  20081. @end example
  20082. @end itemize
  20083. @section xfade_opencl
  20084. Cross fade two videos with custom transition effect by using OpenCL.
  20085. It accepts the following options:
  20086. @table @option
  20087. @item transition
  20088. Set one of possible transition effects.
  20089. @table @option
  20090. @item custom
  20091. Select custom transition effect, the actual transition description
  20092. will be picked from source and kernel options.
  20093. @item fade
  20094. @item wipeleft
  20095. @item wiperight
  20096. @item wipeup
  20097. @item wipedown
  20098. @item slideleft
  20099. @item slideright
  20100. @item slideup
  20101. @item slidedown
  20102. Default transition is fade.
  20103. @end table
  20104. @item source
  20105. OpenCL program source file for custom transition.
  20106. @item kernel
  20107. Set name of kernel to use for custom transition from program source file.
  20108. @item duration
  20109. Set duration of video transition.
  20110. @item offset
  20111. Set time of start of transition relative to first video.
  20112. @end table
  20113. The program source file must contain a kernel function with the given name,
  20114. which will be run once for each plane of the output. Each run on a plane
  20115. gets enqueued as a separate 2D global NDRange with one work-item for each
  20116. pixel to be generated. The global ID offset for each work-item is therefore
  20117. the coordinates of a pixel in the destination image.
  20118. The kernel function needs to take the following arguments:
  20119. @itemize
  20120. @item
  20121. Destination image, @var{__write_only image2d_t}.
  20122. This image will become the output; the kernel should write all of it.
  20123. @item
  20124. First Source image, @var{__read_only image2d_t}.
  20125. Second Source image, @var{__read_only image2d_t}.
  20126. These are the most recent images on each input. The kernel may read from
  20127. them to generate the output, but they can't be written to.
  20128. @item
  20129. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  20130. @end itemize
  20131. Example programs:
  20132. @itemize
  20133. @item
  20134. Apply dots curtain transition effect:
  20135. @verbatim
  20136. __kernel void blend_images(__write_only image2d_t dst,
  20137. __read_only image2d_t src1,
  20138. __read_only image2d_t src2,
  20139. float progress)
  20140. {
  20141. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20142. CLK_FILTER_LINEAR);
  20143. int2 p = (int2)(get_global_id(0), get_global_id(1));
  20144. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  20145. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  20146. rp = rp / dim;
  20147. float2 dots = (float2)(20.0, 20.0);
  20148. float2 center = (float2)(0,0);
  20149. float2 unused;
  20150. float4 val1 = read_imagef(src1, sampler, p);
  20151. float4 val2 = read_imagef(src2, sampler, p);
  20152. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  20153. write_imagef(dst, p, next ? val1 : val2);
  20154. }
  20155. @end verbatim
  20156. @end itemize
  20157. @c man end OPENCL VIDEO FILTERS
  20158. @chapter VAAPI Video Filters
  20159. @c man begin VAAPI VIDEO FILTERS
  20160. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  20161. To enable compilation of these filters you need to configure FFmpeg with
  20162. @code{--enable-vaapi}.
  20163. 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}
  20164. @section overlay_vaapi
  20165. Overlay one video on the top of another.
  20166. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20167. The filter accepts the following options:
  20168. @table @option
  20169. @item x
  20170. @item y
  20171. Set expressions for the x and y coordinates of the overlaid video
  20172. on the main video.
  20173. Default value is "0" for both expressions.
  20174. @item w
  20175. @item h
  20176. Set expressions for the width and height the overlaid video
  20177. on the main video.
  20178. Default values are 'overlay_iw' for 'w' and 'overlay_ih*w/overlay_iw' for 'h'.
  20179. The expressions can contain the following parameters:
  20180. @table @option
  20181. @item main_w, W
  20182. @item main_h, H
  20183. The main input width and height.
  20184. @item overlay_iw
  20185. @item overlay_ih
  20186. The overlay input width and height.
  20187. @item overlay_w, w
  20188. @item overlay_h, h
  20189. The overlay output width and height.
  20190. @item overlay_x, x
  20191. @item overlay_y, y
  20192. Position of the overlay layer inside of main
  20193. @end table
  20194. @item alpha
  20195. Set transparency of overlaid video. Allowed range is 0.0 to 1.0.
  20196. Higher value means lower transparency.
  20197. Default value is @code{1.0}.
  20198. @item eof_action
  20199. See @ref{framesync}.
  20200. @item shortest
  20201. See @ref{framesync}.
  20202. @item repeatlast
  20203. See @ref{framesync}.
  20204. @end table
  20205. This filter also supports the @ref{framesync} options.
  20206. @subsection Examples
  20207. @itemize
  20208. @item
  20209. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  20210. @example
  20211. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  20212. @end example
  20213. @item
  20214. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  20215. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20216. @example
  20217. -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
  20218. @end example
  20219. @end itemize
  20220. @section tonemap_vaapi
  20221. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  20222. It maps the dynamic range of HDR10 content to the SDR content.
  20223. It currently only accepts HDR10 as input.
  20224. It accepts the following parameters:
  20225. @table @option
  20226. @item format
  20227. Specify the output pixel format.
  20228. Currently supported formats are:
  20229. @table @var
  20230. @item p010
  20231. @item nv12
  20232. @end table
  20233. Default is nv12.
  20234. @item primaries, p
  20235. Set the output color primaries.
  20236. Default is same as input.
  20237. @item transfer, t
  20238. Set the output transfer characteristics.
  20239. Default is bt709.
  20240. @item matrix, m
  20241. Set the output colorspace matrix.
  20242. Default is same as input.
  20243. @end table
  20244. @subsection Example
  20245. @itemize
  20246. @item
  20247. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  20248. @example
  20249. tonemap_vaapi=format=p010:t=bt2020-10
  20250. @end example
  20251. @end itemize
  20252. @c man end VAAPI VIDEO FILTERS
  20253. @chapter Video Sources
  20254. @c man begin VIDEO SOURCES
  20255. Below is a description of the currently available video sources.
  20256. @section buffer
  20257. Buffer video frames, and make them available to the filter chain.
  20258. This source is mainly intended for a programmatic use, in particular
  20259. through the interface defined in @file{libavfilter/buffersrc.h}.
  20260. It accepts the following parameters:
  20261. @table @option
  20262. @item video_size
  20263. Specify the size (width and height) of the buffered video frames. For the
  20264. syntax of this option, check the
  20265. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20266. @item width
  20267. The input video width.
  20268. @item height
  20269. The input video height.
  20270. @item pix_fmt
  20271. A string representing the pixel format of the buffered video frames.
  20272. It may be a number corresponding to a pixel format, or a pixel format
  20273. name.
  20274. @item time_base
  20275. Specify the timebase assumed by the timestamps of the buffered frames.
  20276. @item frame_rate
  20277. Specify the frame rate expected for the video stream.
  20278. @item pixel_aspect, sar
  20279. The sample (pixel) aspect ratio of the input video.
  20280. @item sws_param
  20281. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  20282. to the filtergraph description to specify swscale flags for automatically
  20283. inserted scalers. See @ref{Filtergraph syntax}.
  20284. @item hw_frames_ctx
  20285. When using a hardware pixel format, this should be a reference to an
  20286. AVHWFramesContext describing input frames.
  20287. @end table
  20288. For example:
  20289. @example
  20290. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  20291. @end example
  20292. will instruct the source to accept video frames with size 320x240 and
  20293. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  20294. square pixels (1:1 sample aspect ratio).
  20295. Since the pixel format with name "yuv410p" corresponds to the number 6
  20296. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  20297. this example corresponds to:
  20298. @example
  20299. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  20300. @end example
  20301. Alternatively, the options can be specified as a flat string, but this
  20302. syntax is deprecated:
  20303. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  20304. @section cellauto
  20305. Create a pattern generated by an elementary cellular automaton.
  20306. The initial state of the cellular automaton can be defined through the
  20307. @option{filename} and @option{pattern} options. If such options are
  20308. not specified an initial state is created randomly.
  20309. At each new frame a new row in the video is filled with the result of
  20310. the cellular automaton next generation. The behavior when the whole
  20311. frame is filled is defined by the @option{scroll} option.
  20312. This source accepts the following options:
  20313. @table @option
  20314. @item filename, f
  20315. Read the initial cellular automaton state, i.e. the starting row, from
  20316. the specified file.
  20317. In the file, each non-whitespace character is considered an alive
  20318. cell, a newline will terminate the row, and further characters in the
  20319. file will be ignored.
  20320. @item pattern, p
  20321. Read the initial cellular automaton state, i.e. the starting row, from
  20322. the specified string.
  20323. Each non-whitespace character in the string is considered an alive
  20324. cell, a newline will terminate the row, and further characters in the
  20325. string will be ignored.
  20326. @item rate, r
  20327. Set the video rate, that is the number of frames generated per second.
  20328. Default is 25.
  20329. @item random_fill_ratio, ratio
  20330. Set the random fill ratio for the initial cellular automaton row. It
  20331. is a floating point number value ranging from 0 to 1, defaults to
  20332. 1/PHI.
  20333. This option is ignored when a file or a pattern is specified.
  20334. @item random_seed, seed
  20335. Set the seed for filling randomly the initial row, must be an integer
  20336. included between 0 and UINT32_MAX. If not specified, or if explicitly
  20337. set to -1, the filter will try to use a good random seed on a best
  20338. effort basis.
  20339. @item rule
  20340. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  20341. Default value is 110.
  20342. @item size, s
  20343. Set the size of the output video. For the syntax of this option, check the
  20344. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20345. If @option{filename} or @option{pattern} is specified, the size is set
  20346. by default to the width of the specified initial state row, and the
  20347. height is set to @var{width} * PHI.
  20348. If @option{size} is set, it must contain the width of the specified
  20349. pattern string, and the specified pattern will be centered in the
  20350. larger row.
  20351. If a filename or a pattern string is not specified, the size value
  20352. defaults to "320x518" (used for a randomly generated initial state).
  20353. @item scroll
  20354. If set to 1, scroll the output upward when all the rows in the output
  20355. have been already filled. If set to 0, the new generated row will be
  20356. written over the top row just after the bottom row is filled.
  20357. Defaults to 1.
  20358. @item start_full, full
  20359. If set to 1, completely fill the output with generated rows before
  20360. outputting the first frame.
  20361. This is the default behavior, for disabling set the value to 0.
  20362. @item stitch
  20363. If set to 1, stitch the left and right row edges together.
  20364. This is the default behavior, for disabling set the value to 0.
  20365. @end table
  20366. @subsection Examples
  20367. @itemize
  20368. @item
  20369. Read the initial state from @file{pattern}, and specify an output of
  20370. size 200x400.
  20371. @example
  20372. cellauto=f=pattern:s=200x400
  20373. @end example
  20374. @item
  20375. Generate a random initial row with a width of 200 cells, with a fill
  20376. ratio of 2/3:
  20377. @example
  20378. cellauto=ratio=2/3:s=200x200
  20379. @end example
  20380. @item
  20381. Create a pattern generated by rule 18 starting by a single alive cell
  20382. centered on an initial row with width 100:
  20383. @example
  20384. cellauto=p=@@:s=100x400:full=0:rule=18
  20385. @end example
  20386. @item
  20387. Specify a more elaborated initial pattern:
  20388. @example
  20389. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  20390. @end example
  20391. @end itemize
  20392. @anchor{coreimagesrc}
  20393. @section coreimagesrc
  20394. Video source generated on GPU using Apple's CoreImage API on OSX.
  20395. This video source is a specialized version of the @ref{coreimage} video filter.
  20396. Use a core image generator at the beginning of the applied filterchain to
  20397. generate the content.
  20398. The coreimagesrc video source accepts the following options:
  20399. @table @option
  20400. @item list_generators
  20401. List all available generators along with all their respective options as well as
  20402. possible minimum and maximum values along with the default values.
  20403. @example
  20404. list_generators=true
  20405. @end example
  20406. @item size, s
  20407. Specify the size of the sourced video. For the syntax of this option, check the
  20408. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20409. The default value is @code{320x240}.
  20410. @item rate, r
  20411. Specify the frame rate of the sourced video, as the number of frames
  20412. generated per second. It has to be a string in the format
  20413. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20414. number or a valid video frame rate abbreviation. The default value is
  20415. "25".
  20416. @item sar
  20417. Set the sample aspect ratio of the sourced video.
  20418. @item duration, d
  20419. Set the duration of the sourced video. See
  20420. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20421. for the accepted syntax.
  20422. If not specified, or the expressed duration is negative, the video is
  20423. supposed to be generated forever.
  20424. @end table
  20425. Additionally, all options of the @ref{coreimage} video filter are accepted.
  20426. A complete filterchain can be used for further processing of the
  20427. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  20428. and examples for details.
  20429. @subsection Examples
  20430. @itemize
  20431. @item
  20432. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  20433. given as complete and escaped command-line for Apple's standard bash shell:
  20434. @example
  20435. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  20436. @end example
  20437. This example is equivalent to the QRCode example of @ref{coreimage} without the
  20438. need for a nullsrc video source.
  20439. @end itemize
  20440. @section ddagrab
  20441. Captures the Windows Desktop via Desktop Duplication API.
  20442. The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding
  20443. or processing. So an explicit @ref{hwdownload} is needed for any kind of
  20444. software processing.
  20445. It accepts the following options:
  20446. @table @option
  20447. @item output_idx
  20448. DXGI Output Index to capture.
  20449. Usually corresponds to the index Windows has given the screen minus one,
  20450. so it's starting at 0.
  20451. Defaults to output 0.
  20452. @item draw_mouse
  20453. Whether to draw the mouse cursor.
  20454. Defaults to true.
  20455. Only affects hardware cursors. If a game or application renders its own cursor,
  20456. it'll always be captured.
  20457. @item framerate
  20458. Framerate at which the desktop will be captured.
  20459. Defaults to 30 FPS.
  20460. @item video_size
  20461. Specify the size of the captured video.
  20462. Defaults to the full size of the screen.
  20463. Cropped from the bottom/right if smaller than screen size.
  20464. @item offset_x
  20465. Horizontal offset of the captured video.
  20466. @item offset_y
  20467. Vertical offset of the captured video.
  20468. @item output_fmt
  20469. Desired filter output format.
  20470. Defaults to 8 Bit BGRA.
  20471. It accepts the following values:
  20472. @table @samp
  20473. @item auto
  20474. Passes all supported output formats to DDA and returns what DDA decides to use.
  20475. @item 8bit
  20476. @item bgra
  20477. 8 Bit formats always work, and DDA will convert to them if neccesary.
  20478. @item 10bit
  20479. @item x2bgr10
  20480. Filter initialization will fail if 10 bit format is requested but unavailable.
  20481. @end table
  20482. @end table
  20483. @subsection Examples
  20484. Capture primary screen and encode using nvenc:
  20485. @example
  20486. ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4
  20487. @end example
  20488. You can also skip the lavfi device and directly use the filter.
  20489. Also demonstrates downloading the frame and encoding with libx264.
  20490. Explicit output format specification is required in this case:
  20491. @example
  20492. ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4
  20493. @end example
  20494. If you want to capture only a subsection of the desktop, this can be achieved
  20495. by specifying a smaller size and its offsets into the screen:
  20496. @example
  20497. ddagrab=video_size=800x600:offset_x=100:offset_y=100
  20498. @end example
  20499. @section gradients
  20500. Generate several gradients.
  20501. @table @option
  20502. @item size, s
  20503. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20504. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20505. @item rate, r
  20506. Set frame rate, expressed as number of frames per second. Default
  20507. value is "25".
  20508. @item c0, c1, c2, c3, c4, c5, c6, c7
  20509. Set 8 colors. Default values for colors is to pick random one.
  20510. @item x0, y0, y0, y1
  20511. Set gradient line source and destination points. If negative or out of range, random ones
  20512. are picked.
  20513. @item nb_colors, n
  20514. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  20515. @item seed
  20516. Set seed for picking gradient line points.
  20517. @item duration, d
  20518. Set the duration of the sourced video. See
  20519. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20520. for the accepted syntax.
  20521. If not specified, or the expressed duration is negative, the video is
  20522. supposed to be generated forever.
  20523. @item speed
  20524. Set speed of gradients rotation.
  20525. @item type, t
  20526. Set type of gradients, can be @code{linear} or @code{radial} or @code{circular} or @code{spiral}.
  20527. @end table
  20528. @section mandelbrot
  20529. Generate a Mandelbrot set fractal, and progressively zoom towards the
  20530. point specified with @var{start_x} and @var{start_y}.
  20531. This source accepts the following options:
  20532. @table @option
  20533. @item end_pts
  20534. Set the terminal pts value. Default value is 400.
  20535. @item end_scale
  20536. Set the terminal scale value.
  20537. Must be a floating point value. Default value is 0.3.
  20538. @item inner
  20539. Set the inner coloring mode, that is the algorithm used to draw the
  20540. Mandelbrot fractal internal region.
  20541. It shall assume one of the following values:
  20542. @table @option
  20543. @item black
  20544. Set black mode.
  20545. @item convergence
  20546. Show time until convergence.
  20547. @item mincol
  20548. Set color based on point closest to the origin of the iterations.
  20549. @item period
  20550. Set period mode.
  20551. @end table
  20552. Default value is @var{mincol}.
  20553. @item bailout
  20554. Set the bailout value. Default value is 10.0.
  20555. @item maxiter
  20556. Set the maximum of iterations performed by the rendering
  20557. algorithm. Default value is 7189.
  20558. @item outer
  20559. Set outer coloring mode.
  20560. It shall assume one of following values:
  20561. @table @option
  20562. @item iteration_count
  20563. Set iteration count mode.
  20564. @item normalized_iteration_count
  20565. set normalized iteration count mode.
  20566. @end table
  20567. Default value is @var{normalized_iteration_count}.
  20568. @item rate, r
  20569. Set frame rate, expressed as number of frames per second. Default
  20570. value is "25".
  20571. @item size, s
  20572. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20573. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20574. @item start_scale
  20575. Set the initial scale value. Default value is 3.0.
  20576. @item start_x
  20577. Set the initial x position. Must be a floating point value between
  20578. -100 and 100. Default value is -0.743643887037158704752191506114774.
  20579. @item start_y
  20580. Set the initial y position. Must be a floating point value between
  20581. -100 and 100. Default value is -0.131825904205311970493132056385139.
  20582. @end table
  20583. @section mptestsrc
  20584. Generate various test patterns, as generated by the MPlayer test filter.
  20585. The size of the generated video is fixed, and is 256x256.
  20586. This source is useful in particular for testing encoding features.
  20587. This source accepts the following options:
  20588. @table @option
  20589. @item rate, r
  20590. Specify the frame rate of the sourced video, as the number of frames
  20591. generated per second. It has to be a string in the format
  20592. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20593. number or a valid video frame rate abbreviation. The default value is
  20594. "25".
  20595. @item duration, d
  20596. Set the duration of the sourced video. See
  20597. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20598. for the accepted syntax.
  20599. If not specified, or the expressed duration is negative, the video is
  20600. supposed to be generated forever.
  20601. @item test, t
  20602. Set the number or the name of the test to perform. Supported tests are:
  20603. @table @option
  20604. @item dc_luma
  20605. @item dc_chroma
  20606. @item freq_luma
  20607. @item freq_chroma
  20608. @item amp_luma
  20609. @item amp_chroma
  20610. @item cbp
  20611. @item mv
  20612. @item ring1
  20613. @item ring2
  20614. @item all
  20615. @item max_frames, m
  20616. Set the maximum number of frames generated for each test, default value is 30.
  20617. @end table
  20618. Default value is "all", which will cycle through the list of all tests.
  20619. @end table
  20620. Some examples:
  20621. @example
  20622. mptestsrc=t=dc_luma
  20623. @end example
  20624. will generate a "dc_luma" test pattern.
  20625. @section frei0r_src
  20626. Provide a frei0r source.
  20627. To enable compilation of this filter you need to install the frei0r
  20628. header and configure FFmpeg with @code{--enable-frei0r}.
  20629. This source accepts the following parameters:
  20630. @table @option
  20631. @item size
  20632. The size of the video to generate. For the syntax of this option, check the
  20633. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20634. @item framerate
  20635. The framerate of the generated video. It may be a string of the form
  20636. @var{num}/@var{den} or a frame rate abbreviation.
  20637. @item filter_name
  20638. The name to the frei0r source to load. For more information regarding frei0r and
  20639. how to set the parameters, read the @ref{frei0r} section in the video filters
  20640. documentation.
  20641. @item filter_params
  20642. A '|'-separated list of parameters to pass to the frei0r source.
  20643. @end table
  20644. For example, to generate a frei0r partik0l source with size 200x200
  20645. and frame rate 10 which is overlaid on the overlay filter main input:
  20646. @example
  20647. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  20648. @end example
  20649. @section life
  20650. Generate a life pattern.
  20651. This source is based on a generalization of John Conway's life game.
  20652. The sourced input represents a life grid, each pixel represents a cell
  20653. which can be in one of two possible states, alive or dead. Every cell
  20654. interacts with its eight neighbours, which are the cells that are
  20655. horizontally, vertically, or diagonally adjacent.
  20656. At each interaction the grid evolves according to the adopted rule,
  20657. which specifies the number of neighbor alive cells which will make a
  20658. cell stay alive or born. The @option{rule} option allows one to specify
  20659. the rule to adopt.
  20660. This source accepts the following options:
  20661. @table @option
  20662. @item filename, f
  20663. Set the file from which to read the initial grid state. In the file,
  20664. each non-whitespace character is considered an alive cell, and newline
  20665. is used to delimit the end of each row.
  20666. If this option is not specified, the initial grid is generated
  20667. randomly.
  20668. @item rate, r
  20669. Set the video rate, that is the number of frames generated per second.
  20670. Default is 25.
  20671. @item random_fill_ratio, ratio
  20672. Set the random fill ratio for the initial random grid. It is a
  20673. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  20674. It is ignored when a file is specified.
  20675. @item random_seed, seed
  20676. Set the seed for filling the initial random grid, must be an integer
  20677. included between 0 and UINT32_MAX. If not specified, or if explicitly
  20678. set to -1, the filter will try to use a good random seed on a best
  20679. effort basis.
  20680. @item rule
  20681. Set the life rule.
  20682. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  20683. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  20684. @var{NS} specifies the number of alive neighbor cells which make a
  20685. live cell stay alive, and @var{NB} the number of alive neighbor cells
  20686. which make a dead cell to become alive (i.e. to "born").
  20687. "s" and "b" can be used in place of "S" and "B", respectively.
  20688. Alternatively a rule can be specified by an 18-bits integer. The 9
  20689. high order bits are used to encode the next cell state if it is alive
  20690. for each number of neighbor alive cells, the low order bits specify
  20691. the rule for "borning" new cells. Higher order bits encode for an
  20692. higher number of neighbor cells.
  20693. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  20694. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  20695. Default value is "S23/B3", which is the original Conway's game of life
  20696. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  20697. cells, and will born a new cell if there are three alive cells around
  20698. a dead cell.
  20699. @item size, s
  20700. Set the size of the output video. For the syntax of this option, check the
  20701. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20702. If @option{filename} is specified, the size is set by default to the
  20703. same size of the input file. If @option{size} is set, it must contain
  20704. the size specified in the input file, and the initial grid defined in
  20705. that file is centered in the larger resulting area.
  20706. If a filename is not specified, the size value defaults to "320x240"
  20707. (used for a randomly generated initial grid).
  20708. @item stitch
  20709. If set to 1, stitch the left and right grid edges together, and the
  20710. top and bottom edges also. Defaults to 1.
  20711. @item mold
  20712. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  20713. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  20714. value from 0 to 255.
  20715. @item life_color
  20716. Set the color of living (or new born) cells.
  20717. @item death_color
  20718. Set the color of dead cells. If @option{mold} is set, this is the first color
  20719. used to represent a dead cell.
  20720. @item mold_color
  20721. Set mold color, for definitely dead and moldy cells.
  20722. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  20723. ffmpeg-utils manual,ffmpeg-utils}.
  20724. @end table
  20725. @subsection Examples
  20726. @itemize
  20727. @item
  20728. Read a grid from @file{pattern}, and center it on a grid of size
  20729. 300x300 pixels:
  20730. @example
  20731. life=f=pattern:s=300x300
  20732. @end example
  20733. @item
  20734. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  20735. @example
  20736. life=ratio=2/3:s=200x200
  20737. @end example
  20738. @item
  20739. Specify a custom rule for evolving a randomly generated grid:
  20740. @example
  20741. life=rule=S14/B34
  20742. @end example
  20743. @item
  20744. Full example with slow death effect (mold) using @command{ffplay}:
  20745. @example
  20746. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  20747. @end example
  20748. @end itemize
  20749. @anchor{allrgb}
  20750. @anchor{allyuv}
  20751. @anchor{color}
  20752. @anchor{colorchart}
  20753. @anchor{colorspectrum}
  20754. @anchor{haldclutsrc}
  20755. @anchor{nullsrc}
  20756. @anchor{pal75bars}
  20757. @anchor{pal100bars}
  20758. @anchor{rgbtestsrc}
  20759. @anchor{smptebars}
  20760. @anchor{smptehdbars}
  20761. @anchor{testsrc}
  20762. @anchor{testsrc2}
  20763. @anchor{yuvtestsrc}
  20764. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  20765. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  20766. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  20767. The @code{color} source provides an uniformly colored input.
  20768. The @code{colorchart} source provides a colors checker chart.
  20769. The @code{colorspectrum} source provides a color spectrum input.
  20770. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  20771. @ref{haldclut} filter.
  20772. The @code{nullsrc} source returns unprocessed video frames. It is
  20773. mainly useful to be employed in analysis / debugging tools, or as the
  20774. source for filters which ignore the input data.
  20775. The @code{pal75bars} source generates a color bars pattern, based on
  20776. EBU PAL recommendations with 75% color levels.
  20777. The @code{pal100bars} source generates a color bars pattern, based on
  20778. EBU PAL recommendations with 100% color levels.
  20779. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  20780. detecting RGB vs BGR issues. You should see a red, green and blue
  20781. stripe from top to bottom.
  20782. The @code{smptebars} source generates a color bars pattern, based on
  20783. the SMPTE Engineering Guideline EG 1-1990.
  20784. The @code{smptehdbars} source generates a color bars pattern, based on
  20785. the SMPTE RP 219-2002.
  20786. The @code{testsrc} source generates a test video pattern, showing a
  20787. color pattern, a scrolling gradient and a timestamp. This is mainly
  20788. intended for testing purposes.
  20789. The @code{testsrc2} source is similar to testsrc, but supports more
  20790. pixel formats instead of just @code{rgb24}. This allows using it as an
  20791. input for other tests without requiring a format conversion.
  20792. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  20793. see a y, cb and cr stripe from top to bottom.
  20794. The sources accept the following parameters:
  20795. @table @option
  20796. @item level
  20797. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  20798. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  20799. pixels to be used as identity matrix for 3D lookup tables. Each component is
  20800. coded on a @code{1/(N*N)} scale.
  20801. @item color, c
  20802. Specify the color of the source, only available in the @code{color}
  20803. source. For the syntax of this option, check the
  20804. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20805. @item size, s
  20806. Specify the size of the sourced video. For the syntax of this option, check the
  20807. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20808. The default value is @code{320x240}.
  20809. This option is not available with the @code{allrgb}, @code{allyuv}, and
  20810. @code{haldclutsrc} filters.
  20811. @item rate, r
  20812. Specify the frame rate of the sourced video, as the number of frames
  20813. generated per second. It has to be a string in the format
  20814. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20815. number or a valid video frame rate abbreviation. The default value is
  20816. "25".
  20817. @item duration, d
  20818. Set the duration of the sourced video. See
  20819. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20820. for the accepted syntax.
  20821. If not specified, or the expressed duration is negative, the video is
  20822. supposed to be generated forever.
  20823. Since the frame rate is used as time base, all frames including the last one
  20824. will have their full duration. If the specified duration is not a multiple
  20825. of the frame duration, it will be rounded up.
  20826. @item sar
  20827. Set the sample aspect ratio of the sourced video.
  20828. @item alpha
  20829. Specify the alpha (opacity) of the background, only available in the
  20830. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  20831. 255 (fully opaque, the default).
  20832. @item decimals, n
  20833. Set the number of decimals to show in the timestamp, only available in the
  20834. @code{testsrc} source.
  20835. The displayed timestamp value will correspond to the original
  20836. timestamp value multiplied by the power of 10 of the specified
  20837. value. Default value is 0.
  20838. @item type
  20839. Set the type of the color spectrum, only available in the
  20840. @code{colorspectrum} source. Can be one of the following:
  20841. @table @samp
  20842. @item black
  20843. @item white
  20844. @item all
  20845. @end table
  20846. @item patch_size
  20847. Set patch size of single color patch, only available in the
  20848. @code{colorchart} source. Default is @code{64x64}.
  20849. @item preset
  20850. Set colorchecker colors preset, only available in the
  20851. @code{colorchart} source.
  20852. Available values are:
  20853. @table @samp
  20854. @item reference
  20855. @item skintones
  20856. @end table
  20857. Default value is @code{reference}.
  20858. @end table
  20859. @subsection Examples
  20860. @itemize
  20861. @item
  20862. Generate a video with a duration of 5.3 seconds, with size
  20863. 176x144 and a frame rate of 10 frames per second:
  20864. @example
  20865. testsrc=duration=5.3:size=qcif:rate=10
  20866. @end example
  20867. @item
  20868. The following graph description will generate a red source
  20869. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  20870. frames per second:
  20871. @example
  20872. color=c=red@@0.2:s=qcif:r=10
  20873. @end example
  20874. @item
  20875. If the input content is to be ignored, @code{nullsrc} can be used. The
  20876. following command generates noise in the luminance plane by employing
  20877. the @code{geq} filter:
  20878. @example
  20879. nullsrc=s=256x256, geq=random(1)*255:128:128
  20880. @end example
  20881. @end itemize
  20882. @subsection Commands
  20883. The @code{color} source supports the following commands:
  20884. @table @option
  20885. @item c, color
  20886. Set the color of the created image. Accepts the same syntax of the
  20887. corresponding @option{color} option.
  20888. @end table
  20889. @section openclsrc
  20890. Generate video using an OpenCL program.
  20891. @table @option
  20892. @item source
  20893. OpenCL program source file.
  20894. @item kernel
  20895. Kernel name in program.
  20896. @item size, s
  20897. Size of frames to generate. This must be set.
  20898. @item format
  20899. Pixel format to use for the generated frames. This must be set.
  20900. @item rate, r
  20901. Number of frames generated every second. Default value is '25'.
  20902. @end table
  20903. For details of how the program loading works, see the @ref{program_opencl}
  20904. filter.
  20905. Example programs:
  20906. @itemize
  20907. @item
  20908. Generate a colour ramp by setting pixel values from the position of the pixel
  20909. in the output image. (Note that this will work with all pixel formats, but
  20910. the generated output will not be the same.)
  20911. @verbatim
  20912. __kernel void ramp(__write_only image2d_t dst,
  20913. unsigned int index)
  20914. {
  20915. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  20916. float4 val;
  20917. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  20918. write_imagef(dst, loc, val);
  20919. }
  20920. @end verbatim
  20921. @item
  20922. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  20923. @verbatim
  20924. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  20925. unsigned int index)
  20926. {
  20927. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  20928. float4 value = 0.0f;
  20929. int x = loc.x + index;
  20930. int y = loc.y + index;
  20931. while (x > 0 || y > 0) {
  20932. if (x % 3 == 1 && y % 3 == 1) {
  20933. value = 1.0f;
  20934. break;
  20935. }
  20936. x /= 3;
  20937. y /= 3;
  20938. }
  20939. write_imagef(dst, loc, value);
  20940. }
  20941. @end verbatim
  20942. @end itemize
  20943. @section sierpinski
  20944. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  20945. This source accepts the following options:
  20946. @table @option
  20947. @item size, s
  20948. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20949. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20950. @item rate, r
  20951. Set frame rate, expressed as number of frames per second. Default
  20952. value is "25".
  20953. @item seed
  20954. Set seed which is used for random panning.
  20955. @item jump
  20956. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  20957. @item type
  20958. Set fractal type, can be default @code{carpet} or @code{triangle}.
  20959. @end table
  20960. @c man end VIDEO SOURCES
  20961. @chapter Video Sinks
  20962. @c man begin VIDEO SINKS
  20963. Below is a description of the currently available video sinks.
  20964. @section buffersink
  20965. Buffer video frames, and make them available to the end of the filter
  20966. graph.
  20967. This sink is mainly intended for programmatic use, in particular
  20968. through the interface defined in @file{libavfilter/buffersink.h}
  20969. or the options system.
  20970. It accepts a pointer to an AVBufferSinkContext structure, which
  20971. defines the incoming buffers' formats, to be passed as the opaque
  20972. parameter to @code{avfilter_init_filter} for initialization.
  20973. @section nullsink
  20974. Null video sink: do absolutely nothing with the input video. It is
  20975. mainly useful as a template and for use in analysis / debugging
  20976. tools.
  20977. @c man end VIDEO SINKS
  20978. @chapter Multimedia Filters
  20979. @c man begin MULTIMEDIA FILTERS
  20980. Below is a description of the currently available multimedia filters.
  20981. @section a3dscope
  20982. Convert input audio to 3d scope video output.
  20983. The filter accepts the following options:
  20984. @table @option
  20985. @item rate, r
  20986. Set frame rate, expressed as number of frames per second. Default
  20987. value is "25".
  20988. @item size, s
  20989. Specify the video size for the output. For the syntax of this option, check the
  20990. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20991. Default value is @code{hd720}.
  20992. @item fov
  20993. Set the camera field of view. Default is 90 degrees.
  20994. Allowed range is from 40 to 150.
  20995. @item roll
  20996. Set the camera roll.
  20997. @item pitch
  20998. Set the camera pitch.
  20999. @item yaw
  21000. Set the camera yaw.
  21001. @item xzoom
  21002. Set the camera zoom on X-axis.
  21003. @item yzoom
  21004. Set the camera zoom on Y-axis.
  21005. @item zzoom
  21006. Set the camera zoom on Z-axis.
  21007. @item xpos
  21008. Set the camera position on X-axis.
  21009. @item ypos
  21010. Set the camera position on Y-axis.
  21011. @item zpos
  21012. Set the camera position on Z-axis.
  21013. @item length
  21014. Set the length of displayed audio waves in number of frames.
  21015. @end table
  21016. @subsection Commands
  21017. Filter supports the some above options as @ref{commands}.
  21018. @section abitscope
  21019. Convert input audio to a video output, displaying the audio bit scope.
  21020. The filter accepts the following options:
  21021. @table @option
  21022. @item rate, r
  21023. Set frame rate, expressed as number of frames per second. Default
  21024. value is "25".
  21025. @item size, s
  21026. Specify the video size for the output. For the syntax of this option, check the
  21027. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21028. Default value is @code{1024x256}.
  21029. @item colors
  21030. Specify list of colors separated by space or by '|' which will be used to
  21031. draw channels. Unrecognized or missing colors will be replaced
  21032. by white color.
  21033. @item mode, m
  21034. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  21035. @end table
  21036. @section adrawgraph
  21037. Draw a graph using input audio metadata.
  21038. See @ref{drawgraph}
  21039. @section agraphmonitor
  21040. See @ref{graphmonitor}.
  21041. @section ahistogram
  21042. Convert input audio to a video output, displaying the volume histogram.
  21043. The filter accepts the following options:
  21044. @table @option
  21045. @item dmode
  21046. Specify how histogram is calculated.
  21047. It accepts the following values:
  21048. @table @samp
  21049. @item single
  21050. Use single histogram for all channels.
  21051. @item separate
  21052. Use separate histogram for each channel.
  21053. @end table
  21054. Default is @code{single}.
  21055. @item rate, r
  21056. Set frame rate, expressed as number of frames per second. Default
  21057. value is "25".
  21058. @item size, s
  21059. Specify the video size for the output. For the syntax of this option, check the
  21060. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21061. Default value is @code{hd720}.
  21062. @item scale
  21063. Set display scale.
  21064. It accepts the following values:
  21065. @table @samp
  21066. @item log
  21067. logarithmic
  21068. @item sqrt
  21069. square root
  21070. @item cbrt
  21071. cubic root
  21072. @item lin
  21073. linear
  21074. @item rlog
  21075. reverse logarithmic
  21076. @end table
  21077. Default is @code{log}.
  21078. @item ascale
  21079. Set amplitude scale.
  21080. It accepts the following values:
  21081. @table @samp
  21082. @item log
  21083. logarithmic
  21084. @item lin
  21085. linear
  21086. @end table
  21087. Default is @code{log}.
  21088. @item acount
  21089. Set how much frames to accumulate in histogram.
  21090. Default is 1. Setting this to -1 accumulates all frames.
  21091. @item rheight
  21092. Set histogram ratio of window height.
  21093. @item slide
  21094. Set sonogram sliding.
  21095. It accepts the following values:
  21096. @table @samp
  21097. @item replace
  21098. replace old rows with new ones.
  21099. @item scroll
  21100. scroll from top to bottom.
  21101. @end table
  21102. Default is @code{replace}.
  21103. @item hmode
  21104. Set histogram mode.
  21105. It accepts the following values:
  21106. @table @samp
  21107. @item abs
  21108. Use absolute values of samples.
  21109. @item sign
  21110. Use untouched values of samples.
  21111. @end table
  21112. Default is @code{abs}.
  21113. @end table
  21114. @section aphasemeter
  21115. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  21116. representing mean phase of current audio frame. A video output can also be produced and is
  21117. enabled by default. The audio is passed through as first output.
  21118. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  21119. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  21120. and @code{1} means channels are in phase.
  21121. The filter accepts the following options, all related to its video output:
  21122. @table @option
  21123. @item rate, r
  21124. Set the output frame rate. Default value is @code{25}.
  21125. @item size, s
  21126. Set the video size for the output. For the syntax of this option, check the
  21127. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21128. Default value is @code{800x400}.
  21129. @item rc
  21130. @item gc
  21131. @item bc
  21132. Specify the red, green, blue contrast. Default values are @code{2},
  21133. @code{7} and @code{1}.
  21134. Allowed range is @code{[0, 255]}.
  21135. @item mpc
  21136. Set color which will be used for drawing median phase. If color is
  21137. @code{none} which is default, no median phase value will be drawn.
  21138. @item video
  21139. Enable video output. Default is enabled.
  21140. @end table
  21141. @subsection phasing detection
  21142. The filter also detects out of phase and mono sequences in stereo streams.
  21143. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  21144. The filter accepts the following options for this detection:
  21145. @table @option
  21146. @item phasing
  21147. Enable mono and out of phase detection. Default is disabled.
  21148. @item tolerance, t
  21149. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  21150. Allowed range is @code{[0, 1]}.
  21151. @item angle, a
  21152. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  21153. Allowed range is @code{[90, 180]}.
  21154. @item duration, d
  21155. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  21156. @end table
  21157. @subsection Examples
  21158. @itemize
  21159. @item
  21160. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  21161. @example
  21162. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  21163. @end example
  21164. @end itemize
  21165. @section avectorscope
  21166. Convert input audio to a video output, representing the audio vector
  21167. scope.
  21168. The filter is used to measure the difference between channels of stereo
  21169. audio stream. A monaural signal, consisting of identical left and right
  21170. signal, results in straight vertical line. Any stereo separation is visible
  21171. as a deviation from this line, creating a Lissajous figure.
  21172. If the straight (or deviation from it) but horizontal line appears this
  21173. indicates that the left and right channels are out of phase.
  21174. The filter accepts the following options:
  21175. @table @option
  21176. @item mode, m
  21177. Set the vectorscope mode.
  21178. Available values are:
  21179. @table @samp
  21180. @item lissajous
  21181. Lissajous rotated by 45 degrees.
  21182. @item lissajous_xy
  21183. Same as above but not rotated.
  21184. @item polar
  21185. Shape resembling half of circle.
  21186. @end table
  21187. Default value is @samp{lissajous}.
  21188. @item size, s
  21189. Set the video size for the output. For the syntax of this option, check the
  21190. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21191. Default value is @code{400x400}.
  21192. @item rate, r
  21193. Set the output frame rate. Default value is @code{25}.
  21194. @item rc
  21195. @item gc
  21196. @item bc
  21197. @item ac
  21198. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  21199. @code{160}, @code{80} and @code{255}.
  21200. Allowed range is @code{[0, 255]}.
  21201. @item rf
  21202. @item gf
  21203. @item bf
  21204. @item af
  21205. Specify the red, green, blue and alpha fade. Default values are @code{15},
  21206. @code{10}, @code{5} and @code{5}.
  21207. Allowed range is @code{[0, 255]}.
  21208. @item zoom
  21209. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  21210. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  21211. @item draw
  21212. Set the vectorscope drawing mode.
  21213. Available values are:
  21214. @table @samp
  21215. @item dot
  21216. Draw dot for each sample.
  21217. @item line
  21218. Draw line between previous and current sample.
  21219. @end table
  21220. Default value is @samp{dot}.
  21221. @item scale
  21222. Specify amplitude scale of audio samples.
  21223. Available values are:
  21224. @table @samp
  21225. @item lin
  21226. Linear.
  21227. @item sqrt
  21228. Square root.
  21229. @item cbrt
  21230. Cubic root.
  21231. @item log
  21232. Logarithmic.
  21233. @end table
  21234. @item swap
  21235. Swap left channel axis with right channel axis.
  21236. @item mirror
  21237. Mirror axis.
  21238. @table @samp
  21239. @item none
  21240. No mirror.
  21241. @item x
  21242. Mirror only x axis.
  21243. @item y
  21244. Mirror only y axis.
  21245. @item xy
  21246. Mirror both axis.
  21247. @end table
  21248. @end table
  21249. @subsection Examples
  21250. @itemize
  21251. @item
  21252. Complete example using @command{ffplay}:
  21253. @example
  21254. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  21255. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  21256. @end example
  21257. @end itemize
  21258. @subsection Commands
  21259. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  21260. @section bench, abench
  21261. Benchmark part of a filtergraph.
  21262. The filter accepts the following options:
  21263. @table @option
  21264. @item action
  21265. Start or stop a timer.
  21266. Available values are:
  21267. @table @samp
  21268. @item start
  21269. Get the current time, set it as frame metadata (using the key
  21270. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  21271. @item stop
  21272. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  21273. the input frame metadata to get the time difference. Time difference, average,
  21274. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  21275. @code{min}) are then printed. The timestamps are expressed in seconds.
  21276. @end table
  21277. @end table
  21278. @subsection Examples
  21279. @itemize
  21280. @item
  21281. Benchmark @ref{selectivecolor} filter:
  21282. @example
  21283. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  21284. @end example
  21285. @end itemize
  21286. @section concat
  21287. Concatenate audio and video streams, joining them together one after the
  21288. other.
  21289. The filter works on segments of synchronized video and audio streams. All
  21290. segments must have the same number of streams of each type, and that will
  21291. also be the number of streams at output.
  21292. The filter accepts the following options:
  21293. @table @option
  21294. @item n
  21295. Set the number of segments. Default is 2.
  21296. @item v
  21297. Set the number of output video streams, that is also the number of video
  21298. streams in each segment. Default is 1.
  21299. @item a
  21300. Set the number of output audio streams, that is also the number of audio
  21301. streams in each segment. Default is 0.
  21302. @item unsafe
  21303. Activate unsafe mode: do not fail if segments have a different format.
  21304. @end table
  21305. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  21306. @var{a} audio outputs.
  21307. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  21308. segment, in the same order as the outputs, then the inputs for the second
  21309. segment, etc.
  21310. Related streams do not always have exactly the same duration, for various
  21311. reasons including codec frame size or sloppy authoring. For that reason,
  21312. related synchronized streams (e.g. a video and its audio track) should be
  21313. concatenated at once. The concat filter will use the duration of the longest
  21314. stream in each segment (except the last one), and if necessary pad shorter
  21315. audio streams with silence.
  21316. For this filter to work correctly, all segments must start at timestamp 0.
  21317. All corresponding streams must have the same parameters in all segments; the
  21318. filtering system will automatically select a common pixel format for video
  21319. streams, and a common sample format, sample rate and channel layout for
  21320. audio streams, but other settings, such as resolution, must be converted
  21321. explicitly by the user.
  21322. Different frame rates are acceptable but will result in variable frame rate
  21323. at output; be sure to configure the output file to handle it.
  21324. @subsection Examples
  21325. @itemize
  21326. @item
  21327. Concatenate an opening, an episode and an ending, all in bilingual version
  21328. (video in stream 0, audio in streams 1 and 2):
  21329. @example
  21330. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  21331. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  21332. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  21333. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  21334. @end example
  21335. @item
  21336. Concatenate two parts, handling audio and video separately, using the
  21337. (a)movie sources, and adjusting the resolution:
  21338. @example
  21339. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  21340. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  21341. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  21342. @end example
  21343. Note that a desync will happen at the stitch if the audio and video streams
  21344. do not have exactly the same duration in the first file.
  21345. @end itemize
  21346. @subsection Commands
  21347. This filter supports the following commands:
  21348. @table @option
  21349. @item next
  21350. Close the current segment and step to the next one
  21351. @end table
  21352. @anchor{ebur128}
  21353. @section ebur128
  21354. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  21355. level. By default, it logs a message at a frequency of 10Hz with the
  21356. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  21357. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  21358. The filter can only analyze streams which have
  21359. sample format is double-precision floating point. The input stream will be converted to
  21360. this specification, if needed. Users may need to insert aformat and/or aresample filters
  21361. after this filter to obtain the original parameters.
  21362. The filter also has a video output (see the @var{video} option) with a real
  21363. time graph to observe the loudness evolution. The graphic contains the logged
  21364. message mentioned above, so it is not printed anymore when this option is set,
  21365. unless the verbose logging is set. The main graphing area contains the
  21366. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  21367. the momentary loudness (400 milliseconds), but can optionally be configured
  21368. to instead display short-term loudness (see @var{gauge}).
  21369. The green area marks a +/- 1LU target range around the target loudness
  21370. (-23LUFS by default, unless modified through @var{target}).
  21371. More information about the Loudness Recommendation EBU R128 on
  21372. @url{http://tech.ebu.ch/loudness}.
  21373. The filter accepts the following options:
  21374. @table @option
  21375. @item video
  21376. Activate the video output. The audio stream is passed unchanged whether this
  21377. option is set or no. The video stream will be the first output stream if
  21378. activated. Default is @code{0}.
  21379. @item size
  21380. Set the video size. This option is for video only. For the syntax of this
  21381. option, check the
  21382. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21383. Default and minimum resolution is @code{640x480}.
  21384. @item meter
  21385. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  21386. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  21387. other integer value between this range is allowed.
  21388. @item metadata
  21389. Set metadata injection. If set to @code{1}, the audio input will be segmented
  21390. into 100ms output frames, each of them containing various loudness information
  21391. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  21392. Default is @code{0}.
  21393. @item framelog
  21394. Force the frame logging level.
  21395. Available values are:
  21396. @table @samp
  21397. @item quiet
  21398. logging disabled
  21399. @item info
  21400. information logging level
  21401. @item verbose
  21402. verbose logging level
  21403. @end table
  21404. By default, the logging level is set to @var{info}. If the @option{video} or
  21405. the @option{metadata} options are set, it switches to @var{verbose}.
  21406. @item peak
  21407. Set peak mode(s).
  21408. Available modes can be cumulated (the option is a @code{flag} type). Possible
  21409. values are:
  21410. @table @samp
  21411. @item none
  21412. Disable any peak mode (default).
  21413. @item sample
  21414. Enable sample-peak mode.
  21415. Simple peak mode looking for the higher sample value. It logs a message
  21416. for sample-peak (identified by @code{SPK}).
  21417. @item true
  21418. Enable true-peak mode.
  21419. If enabled, the peak lookup is done on an over-sampled version of the input
  21420. stream for better peak accuracy. It logs a message for true-peak.
  21421. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  21422. This mode requires a build with @code{libswresample}.
  21423. @end table
  21424. @item dualmono
  21425. Treat mono input files as "dual mono". If a mono file is intended for playback
  21426. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  21427. If set to @code{true}, this option will compensate for this effect.
  21428. Multi-channel input files are not affected by this option.
  21429. @item panlaw
  21430. Set a specific pan law to be used for the measurement of dual mono files.
  21431. This parameter is optional, and has a default value of -3.01dB.
  21432. @item target
  21433. Set a specific target level (in LUFS) used as relative zero in the visualization.
  21434. This parameter is optional and has a default value of -23LUFS as specified
  21435. by EBU R128. However, material published online may prefer a level of -16LUFS
  21436. (e.g. for use with podcasts or video platforms).
  21437. @item gauge
  21438. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  21439. @code{shortterm}. By default the momentary value will be used, but in certain
  21440. scenarios it may be more useful to observe the short term value instead (e.g.
  21441. live mixing).
  21442. @item scale
  21443. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  21444. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  21445. video output, not the summary or continuous log output.
  21446. @end table
  21447. @subsection Examples
  21448. @itemize
  21449. @item
  21450. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  21451. @example
  21452. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  21453. @end example
  21454. @item
  21455. Run an analysis with @command{ffmpeg}:
  21456. @example
  21457. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  21458. @end example
  21459. @end itemize
  21460. @section interleave, ainterleave
  21461. Temporally interleave frames from several inputs.
  21462. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  21463. These filters read frames from several inputs and send the oldest
  21464. queued frame to the output.
  21465. Input streams must have well defined, monotonically increasing frame
  21466. timestamp values.
  21467. In order to submit one frame to output, these filters need to enqueue
  21468. at least one frame for each input, so they cannot work in case one
  21469. input is not yet terminated and will not receive incoming frames.
  21470. For example consider the case when one input is a @code{select} filter
  21471. which always drops input frames. The @code{interleave} filter will keep
  21472. reading from that input, but it will never be able to send new frames
  21473. to output until the input sends an end-of-stream signal.
  21474. Also, depending on inputs synchronization, the filters will drop
  21475. frames in case one input receives more frames than the other ones, and
  21476. the queue is already filled.
  21477. These filters accept the following options:
  21478. @table @option
  21479. @item nb_inputs, n
  21480. Set the number of different inputs, it is 2 by default.
  21481. @item duration
  21482. How to determine the end-of-stream.
  21483. @table @option
  21484. @item longest
  21485. The duration of the longest input. (default)
  21486. @item shortest
  21487. The duration of the shortest input.
  21488. @item first
  21489. The duration of the first input.
  21490. @end table
  21491. @end table
  21492. @subsection Examples
  21493. @itemize
  21494. @item
  21495. Interleave frames belonging to different streams using @command{ffmpeg}:
  21496. @example
  21497. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  21498. @end example
  21499. @item
  21500. Add flickering blur effect:
  21501. @example
  21502. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  21503. @end example
  21504. @end itemize
  21505. @section latency, alatency
  21506. Measure filtering latency.
  21507. Report previous filter filtering latency, delay in number of audio samples for audio filters
  21508. or number of video frames for video filters.
  21509. On end of input stream, filter will report min and max measured latency for previous running filter
  21510. in filtergraph.
  21511. @section metadata, ametadata
  21512. Manipulate frame metadata.
  21513. This filter accepts the following options:
  21514. @table @option
  21515. @item mode
  21516. Set mode of operation of the filter.
  21517. Can be one of the following:
  21518. @table @samp
  21519. @item select
  21520. If both @code{value} and @code{key} is set, select frames
  21521. which have such metadata. If only @code{key} is set, select
  21522. every frame that has such key in metadata.
  21523. @item add
  21524. Add new metadata @code{key} and @code{value}. If key is already available
  21525. do nothing.
  21526. @item modify
  21527. Modify value of already present key.
  21528. @item delete
  21529. If @code{value} is set, delete only keys that have such value.
  21530. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  21531. the frame.
  21532. @item print
  21533. Print key and its value if metadata was found. If @code{key} is not set print all
  21534. metadata values available in frame.
  21535. @end table
  21536. @item key
  21537. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  21538. @item value
  21539. Set metadata value which will be used. This option is mandatory for
  21540. @code{modify} and @code{add} mode.
  21541. @item function
  21542. Which function to use when comparing metadata value and @code{value}.
  21543. Can be one of following:
  21544. @table @samp
  21545. @item same_str
  21546. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  21547. @item starts_with
  21548. Values are interpreted as strings, returns true if metadata value starts with
  21549. the @code{value} option string.
  21550. @item less
  21551. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  21552. @item equal
  21553. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  21554. @item greater
  21555. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  21556. @item expr
  21557. Values are interpreted as floats, returns true if expression from option @code{expr}
  21558. evaluates to true.
  21559. @item ends_with
  21560. Values are interpreted as strings, returns true if metadata value ends with
  21561. the @code{value} option string.
  21562. @end table
  21563. @item expr
  21564. Set expression which is used when @code{function} is set to @code{expr}.
  21565. The expression is evaluated through the eval API and can contain the following
  21566. constants:
  21567. @table @option
  21568. @item VALUE1, FRAMEVAL
  21569. Float representation of @code{value} from metadata key.
  21570. @item VALUE2, USERVAL
  21571. Float representation of @code{value} as supplied by user in @code{value} option.
  21572. @end table
  21573. @item file
  21574. If specified in @code{print} mode, output is written to the named file. Instead of
  21575. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  21576. for standard output. If @code{file} option is not set, output is written to the log
  21577. with AV_LOG_INFO loglevel.
  21578. @item direct
  21579. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  21580. @end table
  21581. @subsection Examples
  21582. @itemize
  21583. @item
  21584. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  21585. between 0 and 1.
  21586. @example
  21587. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  21588. @end example
  21589. @item
  21590. Print silencedetect output to file @file{metadata.txt}.
  21591. @example
  21592. silencedetect,ametadata=mode=print:file=metadata.txt
  21593. @end example
  21594. @item
  21595. Direct all metadata to a pipe with file descriptor 4.
  21596. @example
  21597. metadata=mode=print:file='pipe\:4'
  21598. @end example
  21599. @end itemize
  21600. @section perms, aperms
  21601. Set read/write permissions for the output frames.
  21602. These filters are mainly aimed at developers to test direct path in the
  21603. following filter in the filtergraph.
  21604. The filters accept the following options:
  21605. @table @option
  21606. @item mode
  21607. Select the permissions mode.
  21608. It accepts the following values:
  21609. @table @samp
  21610. @item none
  21611. Do nothing. This is the default.
  21612. @item ro
  21613. Set all the output frames read-only.
  21614. @item rw
  21615. Set all the output frames directly writable.
  21616. @item toggle
  21617. Make the frame read-only if writable, and writable if read-only.
  21618. @item random
  21619. Set each output frame read-only or writable randomly.
  21620. @end table
  21621. @item seed
  21622. Set the seed for the @var{random} mode, must be an integer included between
  21623. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  21624. @code{-1}, the filter will try to use a good random seed on a best effort
  21625. basis.
  21626. @end table
  21627. Note: in case of auto-inserted filter between the permission filter and the
  21628. following one, the permission might not be received as expected in that
  21629. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  21630. perms/aperms filter can avoid this problem.
  21631. @section realtime, arealtime
  21632. Slow down filtering to match real time approximately.
  21633. These filters will pause the filtering for a variable amount of time to
  21634. match the output rate with the input timestamps.
  21635. They are similar to the @option{re} option to @code{ffmpeg}.
  21636. They accept the following options:
  21637. @table @option
  21638. @item limit
  21639. Time limit for the pauses. Any pause longer than that will be considered
  21640. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  21641. @item speed
  21642. Speed factor for processing. The value must be a float larger than zero.
  21643. Values larger than 1.0 will result in faster than realtime processing,
  21644. smaller will slow processing down. The @var{limit} is automatically adapted
  21645. accordingly. Default is 1.0.
  21646. A processing speed faster than what is possible without these filters cannot
  21647. be achieved.
  21648. @end table
  21649. @subsection Commands
  21650. Both filters supports the all above options as @ref{commands}.
  21651. @section segment, asegment
  21652. Split single input stream into multiple streams.
  21653. This filter does opposite of concat filters.
  21654. @code{segment} works on video frames, @code{asegment} on audio samples.
  21655. This filter accepts the following options:
  21656. @table @option
  21657. @item timestamps
  21658. Timestamps of output segments separated by '|'. The first segment will run
  21659. from the beginning of the input stream. The last segment will run until
  21660. the end of the input stream
  21661. @item frames, samples
  21662. Exact frame/sample count to split the segments.
  21663. @end table
  21664. In all cases, prefixing an each segment with '+' will make it relative to the
  21665. previous segment.
  21666. @subsection Examples
  21667. @itemize
  21668. @item
  21669. Split input audio stream into three output audio streams, starting at start of input audio stream
  21670. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  21671. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  21672. @example
  21673. asegment=timestamps="60|150"
  21674. @end example
  21675. @end itemize
  21676. @anchor{select}
  21677. @section select, aselect
  21678. Select frames to pass in output.
  21679. This filter accepts the following options:
  21680. @table @option
  21681. @item expr, e
  21682. Set expression, which is evaluated for each input frame.
  21683. If the expression is evaluated to zero, the frame is discarded.
  21684. If the evaluation result is negative or NaN, the frame is sent to the
  21685. first output; otherwise it is sent to the output with index
  21686. @code{ceil(val)-1}, assuming that the input index starts from 0.
  21687. For example a value of @code{1.2} corresponds to the output with index
  21688. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  21689. @item outputs, n
  21690. Set the number of outputs. The output to which to send the selected
  21691. frame is based on the result of the evaluation. Default value is 1.
  21692. @end table
  21693. The expression can contain the following constants:
  21694. @table @option
  21695. @item n
  21696. The (sequential) number of the filtered frame, starting from 0.
  21697. @item selected_n
  21698. The (sequential) number of the selected frame, starting from 0.
  21699. @item prev_selected_n
  21700. The sequential number of the last selected frame. It's NAN if undefined.
  21701. @item TB
  21702. The timebase of the input timestamps.
  21703. @item pts
  21704. The PTS (Presentation TimeStamp) of the filtered frame,
  21705. expressed in @var{TB} units. It's NAN if undefined.
  21706. @item t
  21707. The PTS of the filtered frame,
  21708. expressed in seconds. It's NAN if undefined.
  21709. @item prev_pts
  21710. The PTS of the previously filtered frame. It's NAN if undefined.
  21711. @item prev_selected_pts
  21712. The PTS of the last previously filtered frame. It's NAN if undefined.
  21713. @item prev_selected_t
  21714. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  21715. @item start_pts
  21716. The first PTS in the stream which is not NAN. It remains NAN if not found.
  21717. @item start_t
  21718. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  21719. @item pict_type @emph{(video only)}
  21720. The type of the filtered frame. It can assume one of the following
  21721. values:
  21722. @table @option
  21723. @item I
  21724. @item P
  21725. @item B
  21726. @item S
  21727. @item SI
  21728. @item SP
  21729. @item BI
  21730. @end table
  21731. @item interlace_type @emph{(video only)}
  21732. The frame interlace type. It can assume one of the following values:
  21733. @table @option
  21734. @item PROGRESSIVE
  21735. The frame is progressive (not interlaced).
  21736. @item TOPFIRST
  21737. The frame is top-field-first.
  21738. @item BOTTOMFIRST
  21739. The frame is bottom-field-first.
  21740. @end table
  21741. @item consumed_sample_n @emph{(audio only)}
  21742. the number of selected samples before the current frame
  21743. @item samples_n @emph{(audio only)}
  21744. the number of samples in the current frame
  21745. @item sample_rate @emph{(audio only)}
  21746. the input sample rate
  21747. @item key
  21748. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  21749. @item pos
  21750. the position in the file of the filtered frame, -1 if the information
  21751. is not available (e.g. for synthetic video)
  21752. @item scene @emph{(video only)}
  21753. value between 0 and 1 to indicate a new scene; a low value reflects a low
  21754. probability for the current frame to introduce a new scene, while a higher
  21755. value means the current frame is more likely to be one (see the example below)
  21756. @item concatdec_select
  21757. The concat demuxer can select only part of a concat input file by setting an
  21758. inpoint and an outpoint, but the output packets may not be entirely contained
  21759. in the selected interval. By using this variable, it is possible to skip frames
  21760. generated by the concat demuxer which are not exactly contained in the selected
  21761. interval.
  21762. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  21763. and the @var{lavf.concat.duration} packet metadata values which are also
  21764. present in the decoded frames.
  21765. The @var{concatdec_select} variable is -1 if the frame pts is at least
  21766. start_time and either the duration metadata is missing or the frame pts is less
  21767. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  21768. missing.
  21769. That basically means that an input frame is selected if its pts is within the
  21770. interval set by the concat demuxer.
  21771. @end table
  21772. The default value of the select expression is "1".
  21773. @subsection Examples
  21774. @itemize
  21775. @item
  21776. Select all frames in input:
  21777. @example
  21778. select
  21779. @end example
  21780. The example above is the same as:
  21781. @example
  21782. select=1
  21783. @end example
  21784. @item
  21785. Skip all frames:
  21786. @example
  21787. select=0
  21788. @end example
  21789. @item
  21790. Select only I-frames:
  21791. @example
  21792. select='eq(pict_type\,I)'
  21793. @end example
  21794. @item
  21795. Select one frame every 100:
  21796. @example
  21797. select='not(mod(n\,100))'
  21798. @end example
  21799. @item
  21800. Select only frames contained in the 10-20 time interval:
  21801. @example
  21802. select=between(t\,10\,20)
  21803. @end example
  21804. @item
  21805. Select only I-frames contained in the 10-20 time interval:
  21806. @example
  21807. select=between(t\,10\,20)*eq(pict_type\,I)
  21808. @end example
  21809. @item
  21810. Select frames with a minimum distance of 10 seconds:
  21811. @example
  21812. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  21813. @end example
  21814. @item
  21815. Use aselect to select only audio frames with samples number > 100:
  21816. @example
  21817. aselect='gt(samples_n\,100)'
  21818. @end example
  21819. @item
  21820. Create a mosaic of the first scenes:
  21821. @example
  21822. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  21823. @end example
  21824. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  21825. choice.
  21826. @item
  21827. Send even and odd frames to separate outputs, and compose them:
  21828. @example
  21829. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  21830. @end example
  21831. @item
  21832. Select useful frames from an ffconcat file which is using inpoints and
  21833. outpoints but where the source files are not intra frame only.
  21834. @example
  21835. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  21836. @end example
  21837. @end itemize
  21838. @section sendcmd, asendcmd
  21839. Send commands to filters in the filtergraph.
  21840. These filters read commands to be sent to other filters in the
  21841. filtergraph.
  21842. @code{sendcmd} must be inserted between two video filters,
  21843. @code{asendcmd} must be inserted between two audio filters, but apart
  21844. from that they act the same way.
  21845. The specification of commands can be provided in the filter arguments
  21846. with the @var{commands} option, or in a file specified by the
  21847. @var{filename} option.
  21848. These filters accept the following options:
  21849. @table @option
  21850. @item commands, c
  21851. Set the commands to be read and sent to the other filters.
  21852. @item filename, f
  21853. Set the filename of the commands to be read and sent to the other
  21854. filters.
  21855. @end table
  21856. @subsection Commands syntax
  21857. A commands description consists of a sequence of interval
  21858. specifications, comprising a list of commands to be executed when a
  21859. particular event related to that interval occurs. The occurring event
  21860. is typically the current frame time entering or leaving a given time
  21861. interval.
  21862. An interval is specified by the following syntax:
  21863. @example
  21864. @var{START}[-@var{END}] @var{COMMANDS};
  21865. @end example
  21866. The time interval is specified by the @var{START} and @var{END} times.
  21867. @var{END} is optional and defaults to the maximum time.
  21868. The current frame time is considered within the specified interval if
  21869. it is included in the interval [@var{START}, @var{END}), that is when
  21870. the time is greater or equal to @var{START} and is lesser than
  21871. @var{END}.
  21872. @var{COMMANDS} consists of a sequence of one or more command
  21873. specifications, separated by ",", relating to that interval. The
  21874. syntax of a command specification is given by:
  21875. @example
  21876. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  21877. @end example
  21878. @var{FLAGS} is optional and specifies the type of events relating to
  21879. the time interval which enable sending the specified command, and must
  21880. be a non-null sequence of identifier flags separated by "+" or "|" and
  21881. enclosed between "[" and "]".
  21882. The following flags are recognized:
  21883. @table @option
  21884. @item enter
  21885. The command is sent when the current frame timestamp enters the
  21886. specified interval. In other words, the command is sent when the
  21887. previous frame timestamp was not in the given interval, and the
  21888. current is.
  21889. @item leave
  21890. The command is sent when the current frame timestamp leaves the
  21891. specified interval. In other words, the command is sent when the
  21892. previous frame timestamp was in the given interval, and the
  21893. current is not.
  21894. @item expr
  21895. The command @var{ARG} is interpreted as expression and result of
  21896. expression is passed as @var{ARG}.
  21897. The expression is evaluated through the eval API and can contain the following
  21898. constants:
  21899. @table @option
  21900. @item POS
  21901. Original position in the file of the frame, or undefined if undefined
  21902. for the current frame.
  21903. @item PTS
  21904. The presentation timestamp in input.
  21905. @item N
  21906. The count of the input frame for video or audio, starting from 0.
  21907. @item T
  21908. The time in seconds of the current frame.
  21909. @item TS
  21910. The start time in seconds of the current command interval.
  21911. @item TE
  21912. The end time in seconds of the current command interval.
  21913. @item TI
  21914. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  21915. @item W
  21916. The video frame width.
  21917. @item H
  21918. The video frame height.
  21919. @end table
  21920. @end table
  21921. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  21922. assumed.
  21923. @var{TARGET} specifies the target of the command, usually the name of
  21924. the filter class or a specific filter instance name.
  21925. @var{COMMAND} specifies the name of the command for the target filter.
  21926. @var{ARG} is optional and specifies the optional list of argument for
  21927. the given @var{COMMAND}.
  21928. Between one interval specification and another, whitespaces, or
  21929. sequences of characters starting with @code{#} until the end of line,
  21930. are ignored and can be used to annotate comments.
  21931. A simplified BNF description of the commands specification syntax
  21932. follows:
  21933. @example
  21934. @var{COMMAND_FLAG} ::= "enter" | "leave"
  21935. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  21936. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  21937. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  21938. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  21939. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  21940. @end example
  21941. @subsection Examples
  21942. @itemize
  21943. @item
  21944. Specify audio tempo change at second 4:
  21945. @example
  21946. asendcmd=c='4.0 atempo tempo 1.5',atempo
  21947. @end example
  21948. @item
  21949. Target a specific filter instance:
  21950. @example
  21951. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  21952. @end example
  21953. @item
  21954. Specify a list of drawtext and hue commands in a file.
  21955. @example
  21956. # show text in the interval 5-10
  21957. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  21958. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  21959. # desaturate the image in the interval 15-20
  21960. 15.0-20.0 [enter] hue s 0,
  21961. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  21962. [leave] hue s 1,
  21963. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  21964. # apply an exponential saturation fade-out effect, starting from time 25
  21965. 25 [enter] hue s exp(25-t)
  21966. @end example
  21967. A filtergraph allowing to read and process the above command list
  21968. stored in a file @file{test.cmd}, can be specified with:
  21969. @example
  21970. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  21971. @end example
  21972. @end itemize
  21973. @anchor{setpts}
  21974. @section setpts, asetpts
  21975. Change the PTS (presentation timestamp) of the input frames.
  21976. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  21977. This filter accepts the following options:
  21978. @table @option
  21979. @item expr
  21980. The expression which is evaluated for each frame to construct its timestamp.
  21981. @end table
  21982. The expression is evaluated through the eval API and can contain the following
  21983. constants:
  21984. @table @option
  21985. @item FRAME_RATE, FR
  21986. frame rate, only defined for constant frame-rate video
  21987. @item PTS
  21988. The presentation timestamp in input
  21989. @item N
  21990. The count of the input frame for video or the number of consumed samples,
  21991. not including the current frame for audio, starting from 0.
  21992. @item NB_CONSUMED_SAMPLES
  21993. The number of consumed samples, not including the current frame (only
  21994. audio)
  21995. @item NB_SAMPLES, S
  21996. The number of samples in the current frame (only audio)
  21997. @item SAMPLE_RATE, SR
  21998. The audio sample rate.
  21999. @item STARTPTS
  22000. The PTS of the first frame.
  22001. @item STARTT
  22002. the time in seconds of the first frame
  22003. @item INTERLACED
  22004. State whether the current frame is interlaced.
  22005. @item T
  22006. the time in seconds of the current frame
  22007. @item POS
  22008. original position in the file of the frame, or undefined if undefined
  22009. for the current frame
  22010. @item PREV_INPTS
  22011. The previous input PTS.
  22012. @item PREV_INT
  22013. previous input time in seconds
  22014. @item PREV_OUTPTS
  22015. The previous output PTS.
  22016. @item PREV_OUTT
  22017. previous output time in seconds
  22018. @item RTCTIME
  22019. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  22020. instead.
  22021. @item RTCSTART
  22022. The wallclock (RTC) time at the start of the movie in microseconds.
  22023. @item TB
  22024. The timebase of the input timestamps.
  22025. @end table
  22026. @subsection Examples
  22027. @itemize
  22028. @item
  22029. Start counting PTS from zero
  22030. @example
  22031. setpts=PTS-STARTPTS
  22032. @end example
  22033. @item
  22034. Apply fast motion effect:
  22035. @example
  22036. setpts=0.5*PTS
  22037. @end example
  22038. @item
  22039. Apply slow motion effect:
  22040. @example
  22041. setpts=2.0*PTS
  22042. @end example
  22043. @item
  22044. Set fixed rate of 25 frames per second:
  22045. @example
  22046. setpts=N/(25*TB)
  22047. @end example
  22048. @item
  22049. Set fixed rate 25 fps with some jitter:
  22050. @example
  22051. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  22052. @end example
  22053. @item
  22054. Apply an offset of 10 seconds to the input PTS:
  22055. @example
  22056. setpts=PTS+10/TB
  22057. @end example
  22058. @item
  22059. Generate timestamps from a "live source" and rebase onto the current timebase:
  22060. @example
  22061. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  22062. @end example
  22063. @item
  22064. Generate timestamps by counting samples:
  22065. @example
  22066. asetpts=N/SR/TB
  22067. @end example
  22068. @end itemize
  22069. @section setrange
  22070. Force color range for the output video frame.
  22071. The @code{setrange} filter marks the color range property for the
  22072. output frames. It does not change the input frame, but only sets the
  22073. corresponding property, which affects how the frame is treated by
  22074. following filters.
  22075. The filter accepts the following options:
  22076. @table @option
  22077. @item range
  22078. Available values are:
  22079. @table @samp
  22080. @item auto
  22081. Keep the same color range property.
  22082. @item unspecified, unknown
  22083. Set the color range as unspecified.
  22084. @item limited, tv, mpeg
  22085. Set the color range as limited.
  22086. @item full, pc, jpeg
  22087. Set the color range as full.
  22088. @end table
  22089. @end table
  22090. @section settb, asettb
  22091. Set the timebase to use for the output frames timestamps.
  22092. It is mainly useful for testing timebase configuration.
  22093. It accepts the following parameters:
  22094. @table @option
  22095. @item expr, tb
  22096. The expression which is evaluated into the output timebase.
  22097. @end table
  22098. The value for @option{tb} is an arithmetic expression representing a
  22099. rational. The expression can contain the constants "AVTB" (the default
  22100. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  22101. audio only). Default value is "intb".
  22102. @subsection Examples
  22103. @itemize
  22104. @item
  22105. Set the timebase to 1/25:
  22106. @example
  22107. settb=expr=1/25
  22108. @end example
  22109. @item
  22110. Set the timebase to 1/10:
  22111. @example
  22112. settb=expr=0.1
  22113. @end example
  22114. @item
  22115. Set the timebase to 1001/1000:
  22116. @example
  22117. settb=1+0.001
  22118. @end example
  22119. @item
  22120. Set the timebase to 2*intb:
  22121. @example
  22122. settb=2*intb
  22123. @end example
  22124. @item
  22125. Set the default timebase value:
  22126. @example
  22127. settb=AVTB
  22128. @end example
  22129. @end itemize
  22130. @section showcqt
  22131. Convert input audio to a video output representing frequency spectrum
  22132. logarithmically using Brown-Puckette constant Q transform algorithm with
  22133. direct frequency domain coefficient calculation (but the transform itself
  22134. is not really constant Q, instead the Q factor is actually variable/clamped),
  22135. with musical tone scale, from E0 to D#10.
  22136. The filter accepts the following options:
  22137. @table @option
  22138. @item size, s
  22139. Specify the video size for the output. It must be even. For the syntax of this option,
  22140. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22141. Default value is @code{1920x1080}.
  22142. @item fps, rate, r
  22143. Set the output frame rate. Default value is @code{25}.
  22144. @item bar_h
  22145. Set the bargraph height. It must be even. Default value is @code{-1} which
  22146. computes the bargraph height automatically.
  22147. @item axis_h
  22148. Set the axis height. It must be even. Default value is @code{-1} which computes
  22149. the axis height automatically.
  22150. @item sono_h
  22151. Set the sonogram height. It must be even. Default value is @code{-1} which
  22152. computes the sonogram height automatically.
  22153. @item fullhd
  22154. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  22155. instead. Default value is @code{1}.
  22156. @item sono_v, volume
  22157. Specify the sonogram volume expression. It can contain variables:
  22158. @table @option
  22159. @item bar_v
  22160. the @var{bar_v} evaluated expression
  22161. @item frequency, freq, f
  22162. the frequency where it is evaluated
  22163. @item timeclamp, tc
  22164. the value of @var{timeclamp} option
  22165. @end table
  22166. and functions:
  22167. @table @option
  22168. @item a_weighting(f)
  22169. A-weighting of equal loudness
  22170. @item b_weighting(f)
  22171. B-weighting of equal loudness
  22172. @item c_weighting(f)
  22173. C-weighting of equal loudness.
  22174. @end table
  22175. Default value is @code{16}.
  22176. @item bar_v, volume2
  22177. Specify the bargraph volume expression. It can contain variables:
  22178. @table @option
  22179. @item sono_v
  22180. the @var{sono_v} evaluated expression
  22181. @item frequency, freq, f
  22182. the frequency where it is evaluated
  22183. @item timeclamp, tc
  22184. the value of @var{timeclamp} option
  22185. @end table
  22186. and functions:
  22187. @table @option
  22188. @item a_weighting(f)
  22189. A-weighting of equal loudness
  22190. @item b_weighting(f)
  22191. B-weighting of equal loudness
  22192. @item c_weighting(f)
  22193. C-weighting of equal loudness.
  22194. @end table
  22195. Default value is @code{sono_v}.
  22196. @item sono_g, gamma
  22197. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  22198. higher gamma makes the spectrum having more range. Default value is @code{3}.
  22199. Acceptable range is @code{[1, 7]}.
  22200. @item bar_g, gamma2
  22201. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  22202. @code{[1, 7]}.
  22203. @item bar_t
  22204. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  22205. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  22206. @item timeclamp, tc
  22207. Specify the transform timeclamp. At low frequency, there is trade-off between
  22208. accuracy in time domain and frequency domain. If timeclamp is lower,
  22209. event in time domain is represented more accurately (such as fast bass drum),
  22210. otherwise event in frequency domain is represented more accurately
  22211. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  22212. @item attack
  22213. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  22214. limits future samples by applying asymmetric windowing in time domain, useful
  22215. when low latency is required. Accepted range is @code{[0, 1]}.
  22216. @item basefreq
  22217. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  22218. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  22219. @item endfreq
  22220. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  22221. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  22222. @item coeffclamp
  22223. This option is deprecated and ignored.
  22224. @item tlength
  22225. Specify the transform length in time domain. Use this option to control accuracy
  22226. trade-off between time domain and frequency domain at every frequency sample.
  22227. It can contain variables:
  22228. @table @option
  22229. @item frequency, freq, f
  22230. the frequency where it is evaluated
  22231. @item timeclamp, tc
  22232. the value of @var{timeclamp} option.
  22233. @end table
  22234. Default value is @code{384*tc/(384+tc*f)}.
  22235. @item count
  22236. Specify the transform count for every video frame. Default value is @code{6}.
  22237. Acceptable range is @code{[1, 30]}.
  22238. @item fcount
  22239. Specify the transform count for every single pixel. Default value is @code{0},
  22240. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  22241. @item fontfile
  22242. Specify font file for use with freetype to draw the axis. If not specified,
  22243. use embedded font. Note that drawing with font file or embedded font is not
  22244. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  22245. option instead.
  22246. @item font
  22247. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  22248. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  22249. escaping.
  22250. @item fontcolor
  22251. Specify font color expression. This is arithmetic expression that should return
  22252. integer value 0xRRGGBB. It can contain variables:
  22253. @table @option
  22254. @item frequency, freq, f
  22255. the frequency where it is evaluated
  22256. @item timeclamp, tc
  22257. the value of @var{timeclamp} option
  22258. @end table
  22259. and functions:
  22260. @table @option
  22261. @item midi(f)
  22262. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  22263. @item r(x), g(x), b(x)
  22264. red, green, and blue value of intensity x.
  22265. @end table
  22266. Default value is @code{st(0, (midi(f)-59.5)/12);
  22267. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  22268. r(1-ld(1)) + b(ld(1))}.
  22269. @item axisfile
  22270. Specify image file to draw the axis. This option override @var{fontfile} and
  22271. @var{fontcolor} option.
  22272. @item axis, text
  22273. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  22274. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  22275. Default value is @code{1}.
  22276. @item csp
  22277. Set colorspace. The accepted values are:
  22278. @table @samp
  22279. @item unspecified
  22280. Unspecified (default)
  22281. @item bt709
  22282. BT.709
  22283. @item fcc
  22284. FCC
  22285. @item bt470bg
  22286. BT.470BG or BT.601-6 625
  22287. @item smpte170m
  22288. SMPTE-170M or BT.601-6 525
  22289. @item smpte240m
  22290. SMPTE-240M
  22291. @item bt2020ncl
  22292. BT.2020 with non-constant luminance
  22293. @end table
  22294. @item cscheme
  22295. Set spectrogram color scheme. This is list of floating point values with format
  22296. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  22297. The default is @code{1|0.5|0|0|0.5|1}.
  22298. @end table
  22299. @subsection Examples
  22300. @itemize
  22301. @item
  22302. Playing audio while showing the spectrum:
  22303. @example
  22304. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  22305. @end example
  22306. @item
  22307. Same as above, but with frame rate 30 fps:
  22308. @example
  22309. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  22310. @end example
  22311. @item
  22312. Playing at 1280x720:
  22313. @example
  22314. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  22315. @end example
  22316. @item
  22317. Disable sonogram display:
  22318. @example
  22319. sono_h=0
  22320. @end example
  22321. @item
  22322. A1 and its harmonics: A1, A2, (near)E3, A3:
  22323. @example
  22324. 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),
  22325. asplit[a][out1]; [a] showcqt [out0]'
  22326. @end example
  22327. @item
  22328. Same as above, but with more accuracy in frequency domain:
  22329. @example
  22330. 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),
  22331. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  22332. @end example
  22333. @item
  22334. Custom volume:
  22335. @example
  22336. bar_v=10:sono_v=bar_v*a_weighting(f)
  22337. @end example
  22338. @item
  22339. Custom gamma, now spectrum is linear to the amplitude.
  22340. @example
  22341. bar_g=2:sono_g=2
  22342. @end example
  22343. @item
  22344. Custom tlength equation:
  22345. @example
  22346. 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)))'
  22347. @end example
  22348. @item
  22349. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  22350. @example
  22351. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  22352. @end example
  22353. @item
  22354. Custom font using fontconfig:
  22355. @example
  22356. font='Courier New,Monospace,mono|bold'
  22357. @end example
  22358. @item
  22359. Custom frequency range with custom axis using image file:
  22360. @example
  22361. axisfile=myaxis.png:basefreq=40:endfreq=10000
  22362. @end example
  22363. @end itemize
  22364. @section showcwt
  22365. Convert input audio to video output representing frequency spectrum
  22366. using Continuous Wavelet Transform and Morlet wavelet.
  22367. The filter accepts the following options:
  22368. @table @option
  22369. @item size, s
  22370. Specify the video size for the output. For the syntax of this option,
  22371. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22372. Default value is @code{640x512}.
  22373. @item rate, r
  22374. Set the output frame rate. Default value is @code{25}.
  22375. @item scale
  22376. Set the frequency scale used. Allowed values are:
  22377. @table @option
  22378. @item linear
  22379. @item log2
  22380. @item bark
  22381. @item mel
  22382. @item erbs
  22383. @end table
  22384. Default value is @code{linear}.
  22385. @item min
  22386. Set the minimum frequency that will be used in output.
  22387. Default is @code{20} Hz.
  22388. @item max
  22389. Set the maximum frequency that will be used in output.
  22390. Default is @code{20000} Hz. The real frequency upper limit
  22391. depends on input audio's sample rate and such will be enforced
  22392. on this value when it is set to value greater than Nyquist frequency.
  22393. @item logb
  22394. Set the logarithmic basis for brightness strength when
  22395. mapping calculated magnitude values to pixel values.
  22396. Allowed range is from @code{0} to @code{1}.
  22397. Default value is @code{0.0001}.
  22398. @item deviation
  22399. Set the frequency deviation.
  22400. Lower values than @code{1} are more frequency oriented,
  22401. while higher values than @code{1} are more time oriented.
  22402. Allowed range is from @code{0} to @code{10}.
  22403. Default value is @code{1}.
  22404. @item pps
  22405. Set the number of pixel output per each second in one row.
  22406. Allowed range is from @code{1} to @code{1024}.
  22407. Default value is @code{64}.
  22408. @item mode
  22409. Set the output visual mode. Allowed values are:
  22410. @table @option
  22411. @item magnitude
  22412. Show magnitude.
  22413. @item phase
  22414. Show only phase.
  22415. @item magphase
  22416. Show combination of magnitude and phase.
  22417. Magnitude is mapped to brightness and phase to color.
  22418. @item channel
  22419. Show unique color per channel magnitude.
  22420. @item stereo
  22421. Show unique color per stereo difference.
  22422. @end table
  22423. Default value is @code{magnitude}.
  22424. @item slide
  22425. Set the output slide method. Allowed values are:
  22426. @table @option
  22427. @item replace
  22428. @item scroll
  22429. @item frame
  22430. @end table
  22431. @item direction
  22432. Set the direction method for output slide method. Allowed values are:
  22433. @table @option
  22434. @item lr
  22435. Direction from left to right.
  22436. @item rl
  22437. Direction from right to left.
  22438. @item ud
  22439. Direction from up to down.
  22440. @item du
  22441. Direction from down to up.
  22442. @end table
  22443. @end table
  22444. @section showfreqs
  22445. Convert input audio to video output representing the audio power spectrum.
  22446. Audio amplitude is on Y-axis while frequency is on X-axis.
  22447. The filter accepts the following options:
  22448. @table @option
  22449. @item size, s
  22450. Specify size of video. For the syntax of this option, check the
  22451. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22452. Default is @code{1024x512}.
  22453. @item rate, r
  22454. Set video rate. Default is @code{25}.
  22455. @item mode
  22456. Set display mode.
  22457. This set how each frequency bin will be represented.
  22458. It accepts the following values:
  22459. @table @samp
  22460. @item line
  22461. @item bar
  22462. @item dot
  22463. @end table
  22464. Default is @code{bar}.
  22465. @item ascale
  22466. Set amplitude scale.
  22467. It accepts the following values:
  22468. @table @samp
  22469. @item lin
  22470. Linear scale.
  22471. @item sqrt
  22472. Square root scale.
  22473. @item cbrt
  22474. Cubic root scale.
  22475. @item log
  22476. Logarithmic scale.
  22477. @end table
  22478. Default is @code{log}.
  22479. @item fscale
  22480. Set frequency scale.
  22481. It accepts the following values:
  22482. @table @samp
  22483. @item lin
  22484. Linear scale.
  22485. @item log
  22486. Logarithmic scale.
  22487. @item rlog
  22488. Reverse logarithmic scale.
  22489. @end table
  22490. Default is @code{lin}.
  22491. @item win_size
  22492. Set window size. Allowed range is from 16 to 65536.
  22493. Default is @code{2048}
  22494. @item win_func
  22495. Set windowing function.
  22496. It accepts the following values:
  22497. @table @samp
  22498. @item rect
  22499. @item bartlett
  22500. @item hanning
  22501. @item hamming
  22502. @item blackman
  22503. @item welch
  22504. @item flattop
  22505. @item bharris
  22506. @item bnuttall
  22507. @item bhann
  22508. @item sine
  22509. @item nuttall
  22510. @item lanczos
  22511. @item gauss
  22512. @item tukey
  22513. @item dolph
  22514. @item cauchy
  22515. @item parzen
  22516. @item poisson
  22517. @item bohman
  22518. @item kaiser
  22519. @end table
  22520. Default is @code{hanning}.
  22521. @item overlap
  22522. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  22523. which means optimal overlap for selected window function will be picked.
  22524. @item averaging
  22525. Set time averaging. Setting this to 0 will display current maximal peaks.
  22526. Default is @code{1}, which means time averaging is disabled.
  22527. @item colors
  22528. Specify list of colors separated by space or by '|' which will be used to
  22529. draw channel frequencies. Unrecognized or missing colors will be replaced
  22530. by white color.
  22531. @item cmode
  22532. Set channel display mode.
  22533. It accepts the following values:
  22534. @table @samp
  22535. @item combined
  22536. @item separate
  22537. @end table
  22538. Default is @code{combined}.
  22539. @item minamp
  22540. Set minimum amplitude used in @code{log} amplitude scaler.
  22541. @item data
  22542. Set data display mode.
  22543. It accepts the following values:
  22544. @table @samp
  22545. @item magnitude
  22546. @item phase
  22547. @item delay
  22548. @end table
  22549. Default is @code{magnitude}.
  22550. @item channels
  22551. Set channels to use when processing audio. By default all are processed.
  22552. @end table
  22553. @section showspatial
  22554. Convert stereo input audio to a video output, representing the spatial relationship
  22555. between two channels.
  22556. The filter accepts the following options:
  22557. @table @option
  22558. @item size, s
  22559. Specify the video size for the output. For the syntax of this option, check the
  22560. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22561. Default value is @code{512x512}.
  22562. @item win_size
  22563. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  22564. @item win_func
  22565. Set window function.
  22566. It accepts the following values:
  22567. @table @samp
  22568. @item rect
  22569. @item bartlett
  22570. @item hann
  22571. @item hanning
  22572. @item hamming
  22573. @item blackman
  22574. @item welch
  22575. @item flattop
  22576. @item bharris
  22577. @item bnuttall
  22578. @item bhann
  22579. @item sine
  22580. @item nuttall
  22581. @item lanczos
  22582. @item gauss
  22583. @item tukey
  22584. @item dolph
  22585. @item cauchy
  22586. @item parzen
  22587. @item poisson
  22588. @item bohman
  22589. @item kaiser
  22590. @end table
  22591. Default value is @code{hann}.
  22592. @item rate, r
  22593. Set output framerate.
  22594. @end table
  22595. @anchor{showspectrum}
  22596. @section showspectrum
  22597. Convert input audio to a video output, representing the audio frequency
  22598. spectrum.
  22599. The filter accepts the following options:
  22600. @table @option
  22601. @item size, s
  22602. Specify the video size for the output. For the syntax of this option, check the
  22603. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22604. Default value is @code{640x512}.
  22605. @item slide
  22606. Specify how the spectrum should slide along the window.
  22607. It accepts the following values:
  22608. @table @samp
  22609. @item replace
  22610. the samples start again on the left when they reach the right
  22611. @item scroll
  22612. the samples scroll from right to left
  22613. @item fullframe
  22614. frames are only produced when the samples reach the right
  22615. @item rscroll
  22616. the samples scroll from left to right
  22617. @item lreplace
  22618. the samples start again on the right when they reach the left
  22619. @end table
  22620. Default value is @code{replace}.
  22621. @item mode
  22622. Specify display mode.
  22623. It accepts the following values:
  22624. @table @samp
  22625. @item combined
  22626. all channels are displayed in the same row
  22627. @item separate
  22628. all channels are displayed in separate rows
  22629. @end table
  22630. Default value is @samp{combined}.
  22631. @item color
  22632. Specify display color mode.
  22633. It accepts the following values:
  22634. @table @samp
  22635. @item channel
  22636. each channel is displayed in a separate color
  22637. @item intensity
  22638. each channel is displayed using the same color scheme
  22639. @item rainbow
  22640. each channel is displayed using the rainbow color scheme
  22641. @item moreland
  22642. each channel is displayed using the moreland color scheme
  22643. @item nebulae
  22644. each channel is displayed using the nebulae color scheme
  22645. @item fire
  22646. each channel is displayed using the fire color scheme
  22647. @item fiery
  22648. each channel is displayed using the fiery color scheme
  22649. @item fruit
  22650. each channel is displayed using the fruit color scheme
  22651. @item cool
  22652. each channel is displayed using the cool color scheme
  22653. @item magma
  22654. each channel is displayed using the magma color scheme
  22655. @item green
  22656. each channel is displayed using the green color scheme
  22657. @item viridis
  22658. each channel is displayed using the viridis color scheme
  22659. @item plasma
  22660. each channel is displayed using the plasma color scheme
  22661. @item cividis
  22662. each channel is displayed using the cividis color scheme
  22663. @item terrain
  22664. each channel is displayed using the terrain color scheme
  22665. @end table
  22666. Default value is @samp{channel}.
  22667. @item scale
  22668. Specify scale used for calculating intensity color values.
  22669. It accepts the following values:
  22670. @table @samp
  22671. @item lin
  22672. linear
  22673. @item sqrt
  22674. square root, default
  22675. @item cbrt
  22676. cubic root
  22677. @item log
  22678. logarithmic
  22679. @item 4thrt
  22680. 4th root
  22681. @item 5thrt
  22682. 5th root
  22683. @end table
  22684. Default value is @samp{sqrt}.
  22685. @item fscale
  22686. Specify frequency scale.
  22687. It accepts the following values:
  22688. @table @samp
  22689. @item lin
  22690. linear
  22691. @item log
  22692. logarithmic
  22693. @end table
  22694. Default value is @samp{lin}.
  22695. @item saturation
  22696. Set saturation modifier for displayed colors. Negative values provide
  22697. alternative color scheme. @code{0} is no saturation at all.
  22698. Saturation must be in [-10.0, 10.0] range.
  22699. Default value is @code{1}.
  22700. @item win_func
  22701. Set window function.
  22702. It accepts the following values:
  22703. @table @samp
  22704. @item rect
  22705. @item bartlett
  22706. @item hann
  22707. @item hanning
  22708. @item hamming
  22709. @item blackman
  22710. @item welch
  22711. @item flattop
  22712. @item bharris
  22713. @item bnuttall
  22714. @item bhann
  22715. @item sine
  22716. @item nuttall
  22717. @item lanczos
  22718. @item gauss
  22719. @item tukey
  22720. @item dolph
  22721. @item cauchy
  22722. @item parzen
  22723. @item poisson
  22724. @item bohman
  22725. @item kaiser
  22726. @end table
  22727. Default value is @code{hann}.
  22728. @item orientation
  22729. Set orientation of time vs frequency axis. Can be @code{vertical} or
  22730. @code{horizontal}. Default is @code{vertical}.
  22731. @item overlap
  22732. Set ratio of overlap window. Default value is @code{0}.
  22733. When value is @code{1} overlap is set to recommended size for specific
  22734. window function currently used.
  22735. @item gain
  22736. Set scale gain for calculating intensity color values.
  22737. Default value is @code{1}.
  22738. @item data
  22739. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  22740. or unwrapped phase: @code{uphase}.
  22741. @item rotation
  22742. Set color rotation, must be in [-1.0, 1.0] range.
  22743. Default value is @code{0}.
  22744. @item start
  22745. Set start frequency from which to display spectrogram. Default is @code{0}.
  22746. @item stop
  22747. Set stop frequency to which to display spectrogram. Default is @code{0}.
  22748. @item fps
  22749. Set upper frame rate limit. Default is @code{auto}, unlimited.
  22750. @item legend
  22751. Draw time and frequency axes and legends. Default is disabled.
  22752. @item drange
  22753. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  22754. Allowed range is from 10 to 200.
  22755. @item limit
  22756. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  22757. Allowed range is from -100 to 100.
  22758. @item opacity
  22759. Set opacity strength when using pixel format output with alpha component.
  22760. @end table
  22761. The usage is very similar to the showwaves filter; see the examples in that
  22762. section.
  22763. @subsection Examples
  22764. @itemize
  22765. @item
  22766. Large window with logarithmic color scaling:
  22767. @example
  22768. showspectrum=s=1280x480:scale=log
  22769. @end example
  22770. @item
  22771. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  22772. @example
  22773. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  22774. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  22775. @end example
  22776. @end itemize
  22777. @section showspectrumpic
  22778. Convert input audio to a single video frame, representing the audio frequency
  22779. spectrum.
  22780. The filter accepts the following options:
  22781. @table @option
  22782. @item size, s
  22783. Specify the video size for the output. For the syntax of this option, check the
  22784. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22785. Default value is @code{4096x2048}.
  22786. @item mode
  22787. Specify display mode.
  22788. It accepts the following values:
  22789. @table @samp
  22790. @item combined
  22791. all channels are displayed in the same row
  22792. @item separate
  22793. all channels are displayed in separate rows
  22794. @end table
  22795. Default value is @samp{combined}.
  22796. @item color
  22797. Specify display color mode.
  22798. It accepts the following values:
  22799. @table @samp
  22800. @item channel
  22801. each channel is displayed in a separate color
  22802. @item intensity
  22803. each channel is displayed using the same color scheme
  22804. @item rainbow
  22805. each channel is displayed using the rainbow color scheme
  22806. @item moreland
  22807. each channel is displayed using the moreland color scheme
  22808. @item nebulae
  22809. each channel is displayed using the nebulae color scheme
  22810. @item fire
  22811. each channel is displayed using the fire color scheme
  22812. @item fiery
  22813. each channel is displayed using the fiery color scheme
  22814. @item fruit
  22815. each channel is displayed using the fruit color scheme
  22816. @item cool
  22817. each channel is displayed using the cool color scheme
  22818. @item magma
  22819. each channel is displayed using the magma color scheme
  22820. @item green
  22821. each channel is displayed using the green color scheme
  22822. @item viridis
  22823. each channel is displayed using the viridis color scheme
  22824. @item plasma
  22825. each channel is displayed using the plasma color scheme
  22826. @item cividis
  22827. each channel is displayed using the cividis color scheme
  22828. @item terrain
  22829. each channel is displayed using the terrain color scheme
  22830. @end table
  22831. Default value is @samp{intensity}.
  22832. @item scale
  22833. Specify scale used for calculating intensity color values.
  22834. It accepts the following values:
  22835. @table @samp
  22836. @item lin
  22837. linear
  22838. @item sqrt
  22839. square root, default
  22840. @item cbrt
  22841. cubic root
  22842. @item log
  22843. logarithmic
  22844. @item 4thrt
  22845. 4th root
  22846. @item 5thrt
  22847. 5th root
  22848. @end table
  22849. Default value is @samp{log}.
  22850. @item fscale
  22851. Specify frequency scale.
  22852. It accepts the following values:
  22853. @table @samp
  22854. @item lin
  22855. linear
  22856. @item log
  22857. logarithmic
  22858. @end table
  22859. Default value is @samp{lin}.
  22860. @item saturation
  22861. Set saturation modifier for displayed colors. Negative values provide
  22862. alternative color scheme. @code{0} is no saturation at all.
  22863. Saturation must be in [-10.0, 10.0] range.
  22864. Default value is @code{1}.
  22865. @item win_func
  22866. Set window function.
  22867. It accepts the following values:
  22868. @table @samp
  22869. @item rect
  22870. @item bartlett
  22871. @item hann
  22872. @item hanning
  22873. @item hamming
  22874. @item blackman
  22875. @item welch
  22876. @item flattop
  22877. @item bharris
  22878. @item bnuttall
  22879. @item bhann
  22880. @item sine
  22881. @item nuttall
  22882. @item lanczos
  22883. @item gauss
  22884. @item tukey
  22885. @item dolph
  22886. @item cauchy
  22887. @item parzen
  22888. @item poisson
  22889. @item bohman
  22890. @item kaiser
  22891. @end table
  22892. Default value is @code{hann}.
  22893. @item orientation
  22894. Set orientation of time vs frequency axis. Can be @code{vertical} or
  22895. @code{horizontal}. Default is @code{vertical}.
  22896. @item gain
  22897. Set scale gain for calculating intensity color values.
  22898. Default value is @code{1}.
  22899. @item legend
  22900. Draw time and frequency axes and legends. Default is enabled.
  22901. @item rotation
  22902. Set color rotation, must be in [-1.0, 1.0] range.
  22903. Default value is @code{0}.
  22904. @item start
  22905. Set start frequency from which to display spectrogram. Default is @code{0}.
  22906. @item stop
  22907. Set stop frequency to which to display spectrogram. Default is @code{0}.
  22908. @item drange
  22909. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  22910. Allowed range is from 10 to 200.
  22911. @item limit
  22912. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  22913. Allowed range is from -100 to 100.
  22914. @item opacity
  22915. Set opacity strength when using pixel format output with alpha component.
  22916. @end table
  22917. @subsection Examples
  22918. @itemize
  22919. @item
  22920. Extract an audio spectrogram of a whole audio track
  22921. in a 1024x1024 picture using @command{ffmpeg}:
  22922. @example
  22923. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  22924. @end example
  22925. @end itemize
  22926. @section showvolume
  22927. Convert input audio volume to a video output.
  22928. The filter accepts the following options:
  22929. @table @option
  22930. @item rate, r
  22931. Set video rate.
  22932. @item b
  22933. Set border width, allowed range is [0, 5]. Default is 1.
  22934. @item w
  22935. Set channel width, allowed range is [80, 8192]. Default is 400.
  22936. @item h
  22937. Set channel height, allowed range is [1, 900]. Default is 20.
  22938. @item f
  22939. Set fade, allowed range is [0, 1]. Default is 0.95.
  22940. @item c
  22941. Set volume color expression.
  22942. The expression can use the following variables:
  22943. @table @option
  22944. @item VOLUME
  22945. Current max volume of channel in dB.
  22946. @item PEAK
  22947. Current peak.
  22948. @item CHANNEL
  22949. Current channel number, starting from 0.
  22950. @end table
  22951. @item t
  22952. If set, displays channel names. Default is enabled.
  22953. @item v
  22954. If set, displays volume values. Default is enabled.
  22955. @item o
  22956. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  22957. default is @code{h}.
  22958. @item s
  22959. Set step size, allowed range is [0, 5]. Default is 0, which means
  22960. step is disabled.
  22961. @item p
  22962. Set background opacity, allowed range is [0, 1]. Default is 0.
  22963. @item m
  22964. Set metering mode, can be peak: @code{p} or rms: @code{r},
  22965. default is @code{p}.
  22966. @item ds
  22967. Set display scale, can be linear: @code{lin} or log: @code{log},
  22968. default is @code{lin}.
  22969. @item dm
  22970. In second.
  22971. If set to > 0., display a line for the max level
  22972. in the previous seconds.
  22973. default is disabled: @code{0.}
  22974. @item dmc
  22975. The color of the max line. Use when @code{dm} option is set to > 0.
  22976. default is: @code{orange}
  22977. @end table
  22978. @section showwaves
  22979. Convert input audio to a video output, representing the samples waves.
  22980. The filter accepts the following options:
  22981. @table @option
  22982. @item size, s
  22983. Specify the video size for the output. For the syntax of this option, check the
  22984. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22985. Default value is @code{600x240}.
  22986. @item mode
  22987. Set display mode.
  22988. Available values are:
  22989. @table @samp
  22990. @item point
  22991. Draw a point for each sample.
  22992. @item line
  22993. Draw a vertical line for each sample.
  22994. @item p2p
  22995. Draw a point for each sample and a line between them.
  22996. @item cline
  22997. Draw a centered vertical line for each sample.
  22998. @end table
  22999. Default value is @code{point}.
  23000. @item n
  23001. Set the number of samples which are printed on the same column. A
  23002. larger value will decrease the frame rate. Must be a positive
  23003. integer. This option can be set only if the value for @var{rate}
  23004. is not explicitly specified.
  23005. @item rate, r
  23006. Set the (approximate) output frame rate. This is done by setting the
  23007. option @var{n}. Default value is "25".
  23008. @item split_channels
  23009. Set if channels should be drawn separately or overlap. Default value is 0.
  23010. @item colors
  23011. Set colors separated by '|' which are going to be used for drawing of each channel.
  23012. @item scale
  23013. Set amplitude scale.
  23014. Available values are:
  23015. @table @samp
  23016. @item lin
  23017. Linear.
  23018. @item log
  23019. Logarithmic.
  23020. @item sqrt
  23021. Square root.
  23022. @item cbrt
  23023. Cubic root.
  23024. @end table
  23025. Default is linear.
  23026. @item draw
  23027. Set the draw mode. This is mostly useful to set for high @var{n}.
  23028. Available values are:
  23029. @table @samp
  23030. @item scale
  23031. Scale pixel values for each drawn sample.
  23032. @item full
  23033. Draw every sample directly.
  23034. @end table
  23035. Default value is @code{scale}.
  23036. @end table
  23037. @subsection Examples
  23038. @itemize
  23039. @item
  23040. Output the input file audio and the corresponding video representation
  23041. at the same time:
  23042. @example
  23043. amovie=a.mp3,asplit[out0],showwaves[out1]
  23044. @end example
  23045. @item
  23046. Create a synthetic signal and show it with showwaves, forcing a
  23047. frame rate of 30 frames per second:
  23048. @example
  23049. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  23050. @end example
  23051. @end itemize
  23052. @section showwavespic
  23053. Convert input audio to a single video frame, representing the samples waves.
  23054. The filter accepts the following options:
  23055. @table @option
  23056. @item size, s
  23057. Specify the video size for the output. For the syntax of this option, check the
  23058. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23059. Default value is @code{600x240}.
  23060. @item split_channels
  23061. Set if channels should be drawn separately or overlap. Default value is 0.
  23062. @item colors
  23063. Set colors separated by '|' which are going to be used for drawing of each channel.
  23064. @item scale
  23065. Set amplitude scale.
  23066. Available values are:
  23067. @table @samp
  23068. @item lin
  23069. Linear.
  23070. @item log
  23071. Logarithmic.
  23072. @item sqrt
  23073. Square root.
  23074. @item cbrt
  23075. Cubic root.
  23076. @end table
  23077. Default is linear.
  23078. @item draw
  23079. Set the draw mode.
  23080. Available values are:
  23081. @table @samp
  23082. @item scale
  23083. Scale pixel values for each drawn sample.
  23084. @item full
  23085. Draw every sample directly.
  23086. @end table
  23087. Default value is @code{scale}.
  23088. @item filter
  23089. Set the filter mode.
  23090. Available values are:
  23091. @table @samp
  23092. @item average
  23093. Use average samples values for each drawn sample.
  23094. @item peak
  23095. Use peak samples values for each drawn sample.
  23096. @end table
  23097. Default value is @code{average}.
  23098. @end table
  23099. @subsection Examples
  23100. @itemize
  23101. @item
  23102. Extract a channel split representation of the wave form of a whole audio track
  23103. in a 1024x800 picture using @command{ffmpeg}:
  23104. @example
  23105. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  23106. @end example
  23107. @end itemize
  23108. @section sidedata, asidedata
  23109. Delete frame side data, or select frames based on it.
  23110. This filter accepts the following options:
  23111. @table @option
  23112. @item mode
  23113. Set mode of operation of the filter.
  23114. Can be one of the following:
  23115. @table @samp
  23116. @item select
  23117. Select every frame with side data of @code{type}.
  23118. @item delete
  23119. Delete side data of @code{type}. If @code{type} is not set, delete all side
  23120. data in the frame.
  23121. @end table
  23122. @item type
  23123. Set side data type used with all modes. Must be set for @code{select} mode. For
  23124. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  23125. in @file{libavutil/frame.h}. For example, to choose
  23126. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  23127. @end table
  23128. @section spectrumsynth
  23129. Synthesize audio from 2 input video spectrums, first input stream represents
  23130. magnitude across time and second represents phase across time.
  23131. The filter will transform from frequency domain as displayed in videos back
  23132. to time domain as presented in audio output.
  23133. This filter is primarily created for reversing processed @ref{showspectrum}
  23134. filter outputs, but can synthesize sound from other spectrograms too.
  23135. But in such case results are going to be poor if the phase data is not
  23136. available, because in such cases phase data need to be recreated, usually
  23137. it's just recreated from random noise.
  23138. For best results use gray only output (@code{channel} color mode in
  23139. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  23140. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  23141. @code{data} option. Inputs videos should generally use @code{fullframe}
  23142. slide mode as that saves resources needed for decoding video.
  23143. The filter accepts the following options:
  23144. @table @option
  23145. @item sample_rate
  23146. Specify sample rate of output audio, the sample rate of audio from which
  23147. spectrum was generated may differ.
  23148. @item channels
  23149. Set number of channels represented in input video spectrums.
  23150. @item scale
  23151. Set scale which was used when generating magnitude input spectrum.
  23152. Can be @code{lin} or @code{log}. Default is @code{log}.
  23153. @item slide
  23154. Set slide which was used when generating inputs spectrums.
  23155. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  23156. Default is @code{fullframe}.
  23157. @item win_func
  23158. Set window function used for resynthesis.
  23159. @item overlap
  23160. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  23161. which means optimal overlap for selected window function will be picked.
  23162. @item orientation
  23163. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  23164. Default is @code{vertical}.
  23165. @end table
  23166. @subsection Examples
  23167. @itemize
  23168. @item
  23169. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  23170. then resynthesize videos back to audio with spectrumsynth:
  23171. @example
  23172. 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
  23173. 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
  23174. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  23175. @end example
  23176. @end itemize
  23177. @section split, asplit
  23178. Split input into several identical outputs.
  23179. @code{asplit} works with audio input, @code{split} with video.
  23180. The filter accepts a single parameter which specifies the number of outputs. If
  23181. unspecified, it defaults to 2.
  23182. @subsection Examples
  23183. @itemize
  23184. @item
  23185. Create two separate outputs from the same input:
  23186. @example
  23187. [in] split [out0][out1]
  23188. @end example
  23189. @item
  23190. To create 3 or more outputs, you need to specify the number of
  23191. outputs, like in:
  23192. @example
  23193. [in] asplit=3 [out0][out1][out2]
  23194. @end example
  23195. @item
  23196. Create two separate outputs from the same input, one cropped and
  23197. one padded:
  23198. @example
  23199. [in] split [splitout1][splitout2];
  23200. [splitout1] crop=100:100:0:0 [cropout];
  23201. [splitout2] pad=200:200:100:100 [padout];
  23202. @end example
  23203. @item
  23204. Create 5 copies of the input audio with @command{ffmpeg}:
  23205. @example
  23206. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  23207. @end example
  23208. @end itemize
  23209. @section zmq, azmq
  23210. Receive commands sent through a libzmq client, and forward them to
  23211. filters in the filtergraph.
  23212. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  23213. must be inserted between two video filters, @code{azmq} between two
  23214. audio filters. Both are capable to send messages to any filter type.
  23215. To enable these filters you need to install the libzmq library and
  23216. headers and configure FFmpeg with @code{--enable-libzmq}.
  23217. For more information about libzmq see:
  23218. @url{http://www.zeromq.org/}
  23219. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  23220. receives messages sent through a network interface defined by the
  23221. @option{bind_address} (or the abbreviation "@option{b}") option.
  23222. Default value of this option is @file{tcp://localhost:5555}. You may
  23223. want to alter this value to your needs, but do not forget to escape any
  23224. ':' signs (see @ref{filtergraph escaping}).
  23225. The received message must be in the form:
  23226. @example
  23227. @var{TARGET} @var{COMMAND} [@var{ARG}]
  23228. @end example
  23229. @var{TARGET} specifies the target of the command, usually the name of
  23230. the filter class or a specific filter instance name. The default
  23231. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  23232. but you can override this by using the @samp{filter_name@@id} syntax
  23233. (see @ref{Filtergraph syntax}).
  23234. @var{COMMAND} specifies the name of the command for the target filter.
  23235. @var{ARG} is optional and specifies the optional argument list for the
  23236. given @var{COMMAND}.
  23237. Upon reception, the message is processed and the corresponding command
  23238. is injected into the filtergraph. Depending on the result, the filter
  23239. will send a reply to the client, adopting the format:
  23240. @example
  23241. @var{ERROR_CODE} @var{ERROR_REASON}
  23242. @var{MESSAGE}
  23243. @end example
  23244. @var{MESSAGE} is optional.
  23245. @subsection Examples
  23246. Look at @file{tools/zmqsend} for an example of a zmq client which can
  23247. be used to send commands processed by these filters.
  23248. Consider the following filtergraph generated by @command{ffplay}.
  23249. In this example the last overlay filter has an instance name. All other
  23250. filters will have default instance names.
  23251. @example
  23252. ffplay -dumpgraph 1 -f lavfi "
  23253. color=s=100x100:c=red [l];
  23254. color=s=100x100:c=blue [r];
  23255. nullsrc=s=200x100, zmq [bg];
  23256. [bg][l] overlay [bg+l];
  23257. [bg+l][r] overlay@@my=x=100 "
  23258. @end example
  23259. To change the color of the left side of the video, the following
  23260. command can be used:
  23261. @example
  23262. echo Parsed_color_0 c yellow | tools/zmqsend
  23263. @end example
  23264. To change the right side:
  23265. @example
  23266. echo Parsed_color_1 c pink | tools/zmqsend
  23267. @end example
  23268. To change the position of the right side:
  23269. @example
  23270. echo overlay@@my x 150 | tools/zmqsend
  23271. @end example
  23272. @c man end MULTIMEDIA FILTERS
  23273. @chapter Multimedia Sources
  23274. @c man begin MULTIMEDIA SOURCES
  23275. Below is a description of the currently available multimedia sources.
  23276. @section amovie
  23277. This is the same as @ref{movie} source, except it selects an audio
  23278. stream by default.
  23279. @section avsynctest
  23280. Generate an Audio/Video Sync Test.
  23281. Generated stream periodically shows flash video frame and emits beep in audio.
  23282. Useful to inspect A/V sync issues.
  23283. It accepts the following options:
  23284. @table @option
  23285. @item size, s
  23286. Set output video size. Default value is @code{hd720}.
  23287. @item framerate, fr
  23288. Set output video frame rate. Default value is @code{30}.
  23289. @item samplerate, sr
  23290. Set output audio sample rate. Default value is @code{44100}.
  23291. @item amplitude, a
  23292. Set output audio beep amplitude. Default value is @code{0.7}.
  23293. @item period, p
  23294. Set output audio beep period in seconds. Default value is @code{3}.
  23295. @item delay, dl
  23296. Set output video flash delay in number of frames. Default value is @code{0}.
  23297. @item cycle, c
  23298. Enable cycling of video delays, by default is disabled.
  23299. @item duration, d
  23300. Set stream output duration. By default duration is unlimited.
  23301. @item fg, bg, ag
  23302. Set foreground/background/additional color.
  23303. @end table
  23304. @anchor{movie}
  23305. @section movie
  23306. Read audio and/or video stream(s) from a movie container.
  23307. It accepts the following parameters:
  23308. @table @option
  23309. @item filename
  23310. The name of the resource to read (not necessarily a file; it can also be a
  23311. device or a stream accessed through some protocol).
  23312. @item format_name, f
  23313. Specifies the format assumed for the movie to read, and can be either
  23314. the name of a container or an input device. If not specified, the
  23315. format is guessed from @var{movie_name} or by probing.
  23316. @item seek_point, sp
  23317. Specifies the seek point in seconds. The frames will be output
  23318. starting from this seek point. The parameter is evaluated with
  23319. @code{av_strtod}, so the numerical value may be suffixed by an IS
  23320. postfix. The default value is "0".
  23321. @item streams, s
  23322. Specifies the streams to read. Several streams can be specified,
  23323. separated by "+". The source will then have as many outputs, in the
  23324. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  23325. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  23326. respectively the default (best suited) video and audio stream. Default
  23327. is "dv", or "da" if the filter is called as "amovie".
  23328. @item stream_index, si
  23329. Specifies the index of the video stream to read. If the value is -1,
  23330. the most suitable video stream will be automatically selected. The default
  23331. value is "-1". Deprecated. If the filter is called "amovie", it will select
  23332. audio instead of video.
  23333. @item loop
  23334. Specifies how many times to read the stream in sequence.
  23335. If the value is 0, the stream will be looped infinitely.
  23336. Default value is "1".
  23337. Note that when the movie is looped the source timestamps are not
  23338. changed, so it will generate non monotonically increasing timestamps.
  23339. @item discontinuity
  23340. Specifies the time difference between frames above which the point is
  23341. considered a timestamp discontinuity which is removed by adjusting the later
  23342. timestamps.
  23343. @item dec_threads
  23344. Specifies the number of threads for decoding
  23345. @item format_opts
  23346. Specify format options for the opened file. Format options can be specified
  23347. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  23348. shows how to add protocol_whitelist and protocol_blacklist options:
  23349. @example
  23350. ffplay -f lavfi
  23351. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  23352. @end example
  23353. @end table
  23354. It allows overlaying a second video on top of the main input of
  23355. a filtergraph, as shown in this graph:
  23356. @example
  23357. input -----------> deltapts0 --> overlay --> output
  23358. ^
  23359. |
  23360. movie --> scale--> deltapts1 -------+
  23361. @end example
  23362. @subsection Examples
  23363. @itemize
  23364. @item
  23365. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  23366. on top of the input labelled "in":
  23367. @example
  23368. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  23369. [in] setpts=PTS-STARTPTS [main];
  23370. [main][over] overlay=16:16 [out]
  23371. @end example
  23372. @item
  23373. Read from a video4linux2 device, and overlay it on top of the input
  23374. labelled "in":
  23375. @example
  23376. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  23377. [in] setpts=PTS-STARTPTS [main];
  23378. [main][over] overlay=16:16 [out]
  23379. @end example
  23380. @item
  23381. Read the first video stream and the audio stream with id 0x81 from
  23382. dvd.vob; the video is connected to the pad named "video" and the audio is
  23383. connected to the pad named "audio":
  23384. @example
  23385. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  23386. @end example
  23387. @end itemize
  23388. @subsection Commands
  23389. Both movie and amovie support the following commands:
  23390. @table @option
  23391. @item seek
  23392. Perform seek using "av_seek_frame".
  23393. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  23394. @itemize
  23395. @item
  23396. @var{stream_index}: If stream_index is -1, a default
  23397. stream is selected, and @var{timestamp} is automatically converted
  23398. from AV_TIME_BASE units to the stream specific time_base.
  23399. @item
  23400. @var{timestamp}: Timestamp in AVStream.time_base units
  23401. or, if no stream is specified, in AV_TIME_BASE units.
  23402. @item
  23403. @var{flags}: Flags which select direction and seeking mode.
  23404. @end itemize
  23405. @item get_duration
  23406. Get movie duration in AV_TIME_BASE units.
  23407. @end table
  23408. @c man end MULTIMEDIA SOURCES