filters.texi 685 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  413. Default is @var{4th}.
  414. @end table
  415. @section acrusher
  416. Reduce audio bit resolution.
  417. This filter is bit crusher with enhanced functionality. A bit crusher
  418. is used to audibly reduce number of bits an audio signal is sampled
  419. with. This doesn't change the bit depth at all, it just produces the
  420. effect. Material reduced in bit depth sounds more harsh and "digital".
  421. This filter is able to even round to continuous values instead of discrete
  422. bit depths.
  423. Additionally it has a D/C offset which results in different crushing of
  424. the lower and the upper half of the signal.
  425. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  426. Another feature of this filter is the logarithmic mode.
  427. This setting switches from linear distances between bits to logarithmic ones.
  428. The result is a much more "natural" sounding crusher which doesn't gate low
  429. signals for example. The human ear has a logarithmic perception,
  430. so this kind of crushing is much more pleasant.
  431. Logarithmic crushing is also able to get anti-aliased.
  432. The filter accepts the following options:
  433. @table @option
  434. @item level_in
  435. Set level in.
  436. @item level_out
  437. Set level out.
  438. @item bits
  439. Set bit reduction.
  440. @item mix
  441. Set mixing amount.
  442. @item mode
  443. Can be linear: @code{lin} or logarithmic: @code{log}.
  444. @item dc
  445. Set DC.
  446. @item aa
  447. Set anti-aliasing.
  448. @item samples
  449. Set sample reduction.
  450. @item lfo
  451. Enable LFO. By default disabled.
  452. @item lforange
  453. Set LFO range.
  454. @item lforate
  455. Set LFO rate.
  456. @end table
  457. @section acue
  458. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  459. filter.
  460. @section adeclick
  461. Remove impulsive noise from input audio.
  462. Samples detected as impulsive noise are replaced by interpolated samples using
  463. autoregressive modelling.
  464. @table @option
  465. @item w
  466. Set window size, in milliseconds. Allowed range is from @code{10} to
  467. @code{100}. Default value is @code{55} milliseconds.
  468. This sets size of window which will be processed at once.
  469. @item o
  470. Set window overlap, in percentage of window size. Allowed range is from
  471. @code{50} to @code{95}. Default value is @code{75} percent.
  472. Setting this to a very high value increases impulsive noise removal but makes
  473. whole process much slower.
  474. @item a
  475. Set autoregression order, in percentage of window size. Allowed range is from
  476. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  477. controls quality of interpolated samples using neighbour good samples.
  478. @item t
  479. Set threshold value. Allowed range is from @code{1} to @code{100}.
  480. Default value is @code{2}.
  481. This controls the strength of impulsive noise which is going to be removed.
  482. The lower value, the more samples will be detected as impulsive noise.
  483. @item b
  484. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  485. @code{10}. Default value is @code{2}.
  486. If any two samples detected as noise are spaced less than this value then any
  487. sample between those two samples will be also detected as noise.
  488. @item m
  489. Set overlap method.
  490. It accepts the following values:
  491. @table @option
  492. @item a
  493. Select overlap-add method. Even not interpolated samples are slightly
  494. changed with this method.
  495. @item s
  496. Select overlap-save method. Not interpolated samples remain unchanged.
  497. @end table
  498. Default value is @code{a}.
  499. @end table
  500. @section adeclip
  501. Remove clipped samples from input audio.
  502. Samples detected as clipped are replaced by interpolated samples using
  503. autoregressive modelling.
  504. @table @option
  505. @item w
  506. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  507. Default value is @code{55} milliseconds.
  508. This sets size of window which will be processed at once.
  509. @item o
  510. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  511. to @code{95}. Default value is @code{75} percent.
  512. @item a
  513. Set autoregression order, in percentage of window size. Allowed range is from
  514. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  515. quality of interpolated samples using neighbour good samples.
  516. @item t
  517. Set threshold value. Allowed range is from @code{1} to @code{100}.
  518. Default value is @code{10}. Higher values make clip detection less aggressive.
  519. @item n
  520. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  521. Default value is @code{1000}. Higher values make clip detection less aggressive.
  522. @item m
  523. Set overlap method.
  524. It accepts the following values:
  525. @table @option
  526. @item a
  527. Select overlap-add method. Even not interpolated samples are slightly changed
  528. with this method.
  529. @item s
  530. Select overlap-save method. Not interpolated samples remain unchanged.
  531. @end table
  532. Default value is @code{a}.
  533. @end table
  534. @section adelay
  535. Delay one or more audio channels.
  536. Samples in delayed channel are filled with silence.
  537. The filter accepts the following option:
  538. @table @option
  539. @item delays
  540. Set list of delays in milliseconds for each channel separated by '|'.
  541. Unused delays will be silently ignored. If number of given delays is
  542. smaller than number of channels all remaining channels will not be delayed.
  543. If you want to delay exact number of samples, append 'S' to number.
  544. If you want instead to delay in seconds, append 's' to number.
  545. @item all
  546. Use last set delay for all remaining channels. By default is disabled.
  547. This option if enabled changes how option @code{delays} is interpreted.
  548. @end table
  549. @subsection Examples
  550. @itemize
  551. @item
  552. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  553. the second channel (and any other channels that may be present) unchanged.
  554. @example
  555. adelay=1500|0|500
  556. @end example
  557. @item
  558. Delay second channel by 500 samples, the third channel by 700 samples and leave
  559. the first channel (and any other channels that may be present) unchanged.
  560. @example
  561. adelay=0|500S|700S
  562. @end example
  563. @item
  564. Delay all channels by same number of samples:
  565. @example
  566. adelay=delays=64S:all=1
  567. @end example
  568. @end itemize
  569. @section aderivative, aintegral
  570. Compute derivative/integral of audio stream.
  571. Applying both filters one after another produces original audio.
  572. @section aecho
  573. Apply echoing to the input audio.
  574. Echoes are reflected sound and can occur naturally amongst mountains
  575. (and sometimes large buildings) when talking or shouting; digital echo
  576. effects emulate this behaviour and are often used to help fill out the
  577. sound of a single instrument or vocal. The time difference between the
  578. original signal and the reflection is the @code{delay}, and the
  579. loudness of the reflected signal is the @code{decay}.
  580. Multiple echoes can have different delays and decays.
  581. A description of the accepted parameters follows.
  582. @table @option
  583. @item in_gain
  584. Set input gain of reflected signal. Default is @code{0.6}.
  585. @item out_gain
  586. Set output gain of reflected signal. Default is @code{0.3}.
  587. @item delays
  588. Set list of time intervals in milliseconds between original signal and reflections
  589. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  590. Default is @code{1000}.
  591. @item decays
  592. Set list of loudness of reflected signals separated by '|'.
  593. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  594. Default is @code{0.5}.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Make it sound as if there are twice as many instruments as are actually playing:
  600. @example
  601. aecho=0.8:0.88:60:0.4
  602. @end example
  603. @item
  604. If delay is very short, then it sounds like a (metallic) robot playing music:
  605. @example
  606. aecho=0.8:0.88:6:0.4
  607. @end example
  608. @item
  609. A longer delay will sound like an open air concert in the mountains:
  610. @example
  611. aecho=0.8:0.9:1000:0.3
  612. @end example
  613. @item
  614. Same as above but with one more mountain:
  615. @example
  616. aecho=0.8:0.9:1000|1800:0.3|0.25
  617. @end example
  618. @end itemize
  619. @section aemphasis
  620. Audio emphasis filter creates or restores material directly taken from LPs or
  621. emphased CDs with different filter curves. E.g. to store music on vinyl the
  622. signal has to be altered by a filter first to even out the disadvantages of
  623. this recording medium.
  624. Once the material is played back the inverse filter has to be applied to
  625. restore the distortion of the frequency response.
  626. The filter accepts the following options:
  627. @table @option
  628. @item level_in
  629. Set input gain.
  630. @item level_out
  631. Set output gain.
  632. @item mode
  633. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  634. use @code{production} mode. Default is @code{reproduction} mode.
  635. @item type
  636. Set filter type. Selects medium. Can be one of the following:
  637. @table @option
  638. @item col
  639. select Columbia.
  640. @item emi
  641. select EMI.
  642. @item bsi
  643. select BSI (78RPM).
  644. @item riaa
  645. select RIAA.
  646. @item cd
  647. select Compact Disc (CD).
  648. @item 50fm
  649. select 50µs (FM).
  650. @item 75fm
  651. select 75µs (FM).
  652. @item 50kf
  653. select 50µs (FM-KF).
  654. @item 75kf
  655. select 75µs (FM-KF).
  656. @end table
  657. @end table
  658. @section aeval
  659. Modify an audio signal according to the specified expressions.
  660. This filter accepts one or more expressions (one for each channel),
  661. which are evaluated and used to modify a corresponding audio signal.
  662. It accepts the following parameters:
  663. @table @option
  664. @item exprs
  665. Set the '|'-separated expressions list for each separate channel. If
  666. the number of input channels is greater than the number of
  667. expressions, the last specified expression is used for the remaining
  668. output channels.
  669. @item channel_layout, c
  670. Set output channel layout. If not specified, the channel layout is
  671. specified by the number of expressions. If set to @samp{same}, it will
  672. use by default the same input channel layout.
  673. @end table
  674. Each expression in @var{exprs} can contain the following constants and functions:
  675. @table @option
  676. @item ch
  677. channel number of the current expression
  678. @item n
  679. number of the evaluated sample, starting from 0
  680. @item s
  681. sample rate
  682. @item t
  683. time of the evaluated sample expressed in seconds
  684. @item nb_in_channels
  685. @item nb_out_channels
  686. input and output number of channels
  687. @item val(CH)
  688. the value of input channel with number @var{CH}
  689. @end table
  690. Note: this filter is slow. For faster processing you should use a
  691. dedicated filter.
  692. @subsection Examples
  693. @itemize
  694. @item
  695. Half volume:
  696. @example
  697. aeval=val(ch)/2:c=same
  698. @end example
  699. @item
  700. Invert phase of the second channel:
  701. @example
  702. aeval=val(0)|-val(1)
  703. @end example
  704. @end itemize
  705. @anchor{afade}
  706. @section afade
  707. Apply fade-in/out effect to input audio.
  708. A description of the accepted parameters follows.
  709. @table @option
  710. @item type, t
  711. Specify the effect type, can be either @code{in} for fade-in, or
  712. @code{out} for a fade-out effect. Default is @code{in}.
  713. @item start_sample, ss
  714. Specify the number of the start sample for starting to apply the fade
  715. effect. Default is 0.
  716. @item nb_samples, ns
  717. Specify the number of samples for which the fade effect has to last. At
  718. the end of the fade-in effect the output audio will have the same
  719. volume as the input audio, at the end of the fade-out transition
  720. the output audio will be silence. Default is 44100.
  721. @item start_time, st
  722. Specify the start time of the fade effect. Default is 0.
  723. The value must be specified as a time duration; see
  724. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  725. for the accepted syntax.
  726. If set this option is used instead of @var{start_sample}.
  727. @item duration, d
  728. Specify the duration of the fade effect. See
  729. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  730. for the accepted syntax.
  731. At the end of the fade-in effect the output audio will have the same
  732. volume as the input audio, at the end of the fade-out transition
  733. the output audio will be silence.
  734. By default the duration is determined by @var{nb_samples}.
  735. If set this option is used instead of @var{nb_samples}.
  736. @item curve
  737. Set curve for fade transition.
  738. It accepts the following values:
  739. @table @option
  740. @item tri
  741. select triangular, linear slope (default)
  742. @item qsin
  743. select quarter of sine wave
  744. @item hsin
  745. select half of sine wave
  746. @item esin
  747. select exponential sine wave
  748. @item log
  749. select logarithmic
  750. @item ipar
  751. select inverted parabola
  752. @item qua
  753. select quadratic
  754. @item cub
  755. select cubic
  756. @item squ
  757. select square root
  758. @item cbr
  759. select cubic root
  760. @item par
  761. select parabola
  762. @item exp
  763. select exponential
  764. @item iqsin
  765. select inverted quarter of sine wave
  766. @item ihsin
  767. select inverted half of sine wave
  768. @item dese
  769. select double-exponential seat
  770. @item desi
  771. select double-exponential sigmoid
  772. @item losi
  773. select logistic sigmoid
  774. @item nofade
  775. no fade applied
  776. @end table
  777. @end table
  778. @subsection Examples
  779. @itemize
  780. @item
  781. Fade in first 15 seconds of audio:
  782. @example
  783. afade=t=in:ss=0:d=15
  784. @end example
  785. @item
  786. Fade out last 25 seconds of a 900 seconds audio:
  787. @example
  788. afade=t=out:st=875:d=25
  789. @end example
  790. @end itemize
  791. @section afftdn
  792. Denoise audio samples with FFT.
  793. A description of the accepted parameters follows.
  794. @table @option
  795. @item nr
  796. Set the noise reduction in dB, allowed range is 0.01 to 97.
  797. Default value is 12 dB.
  798. @item nf
  799. Set the noise floor in dB, allowed range is -80 to -20.
  800. Default value is -50 dB.
  801. @item nt
  802. Set the noise type.
  803. It accepts the following values:
  804. @table @option
  805. @item w
  806. Select white noise.
  807. @item v
  808. Select vinyl noise.
  809. @item s
  810. Select shellac noise.
  811. @item c
  812. Select custom noise, defined in @code{bn} option.
  813. Default value is white noise.
  814. @end table
  815. @item bn
  816. Set custom band noise for every one of 15 bands.
  817. Bands are separated by ' ' or '|'.
  818. @item rf
  819. Set the residual floor in dB, allowed range is -80 to -20.
  820. Default value is -38 dB.
  821. @item tn
  822. Enable noise tracking. By default is disabled.
  823. With this enabled, noise floor is automatically adjusted.
  824. @item tr
  825. Enable residual tracking. By default is disabled.
  826. @item om
  827. Set the output mode.
  828. It accepts the following values:
  829. @table @option
  830. @item i
  831. Pass input unchanged.
  832. @item o
  833. Pass noise filtered out.
  834. @item n
  835. Pass only noise.
  836. Default value is @var{o}.
  837. @end table
  838. @end table
  839. @subsection Commands
  840. This filter supports the following commands:
  841. @table @option
  842. @item sample_noise, sn
  843. Start or stop measuring noise profile.
  844. Syntax for the command is : "start" or "stop" string.
  845. After measuring noise profile is stopped it will be
  846. automatically applied in filtering.
  847. @item noise_reduction, nr
  848. Change noise reduction. Argument is single float number.
  849. Syntax for the command is : "@var{noise_reduction}"
  850. @item noise_floor, nf
  851. Change noise floor. Argument is single float number.
  852. Syntax for the command is : "@var{noise_floor}"
  853. @item output_mode, om
  854. Change output mode operation.
  855. Syntax for the command is : "i", "o" or "n" string.
  856. @end table
  857. @section afftfilt
  858. Apply arbitrary expressions to samples in frequency domain.
  859. @table @option
  860. @item real
  861. Set frequency domain real expression for each separate channel separated
  862. by '|'. Default is "re".
  863. If the number of input channels is greater than the number of
  864. expressions, the last specified expression is used for the remaining
  865. output channels.
  866. @item imag
  867. Set frequency domain imaginary expression for each separate channel
  868. separated by '|'. Default is "im".
  869. Each expression in @var{real} and @var{imag} can contain the following
  870. constants and functions:
  871. @table @option
  872. @item sr
  873. sample rate
  874. @item b
  875. current frequency bin number
  876. @item nb
  877. number of available bins
  878. @item ch
  879. channel number of the current expression
  880. @item chs
  881. number of channels
  882. @item pts
  883. current frame pts
  884. @item re
  885. current real part of frequency bin of current channel
  886. @item im
  887. current imaginary part of frequency bin of current channel
  888. @item real(b, ch)
  889. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  890. @item imag(b, ch)
  891. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  892. @end table
  893. @item win_size
  894. Set window size. Allowed range is from 16 to 131072.
  895. Default is @code{4096}
  896. @item win_func
  897. Set window function. Default is @code{hann}.
  898. @item overlap
  899. Set window overlap. If set to 1, the recommended overlap for selected
  900. window function will be picked. Default is @code{0.75}.
  901. @end table
  902. @subsection Examples
  903. @itemize
  904. @item
  905. Leave almost only low frequencies in audio:
  906. @example
  907. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  908. @end example
  909. @item
  910. Apply robotize effect:
  911. @example
  912. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  913. @end example
  914. @item
  915. Apply whisper effect:
  916. @example
  917. 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"
  918. @end example
  919. @end itemize
  920. @anchor{afir}
  921. @section afir
  922. Apply an arbitrary Finite Impulse Response filter.
  923. This filter is designed for applying long FIR filters,
  924. up to 60 seconds long.
  925. It can be used as component for digital crossover filters,
  926. room equalization, cross talk cancellation, wavefield synthesis,
  927. auralization, ambiophonics, ambisonics and spatialization.
  928. This filter uses the streams higher than first one as FIR coefficients.
  929. If the non-first stream holds a single channel, it will be used
  930. for all input channels in the first stream, otherwise
  931. the number of channels in the non-first stream must be same as
  932. the number of channels in the first stream.
  933. It accepts the following parameters:
  934. @table @option
  935. @item dry
  936. Set dry gain. This sets input gain.
  937. @item wet
  938. Set wet gain. This sets final output gain.
  939. @item length
  940. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  941. @item gtype
  942. Enable applying gain measured from power of IR.
  943. Set which approach to use for auto gain measurement.
  944. @table @option
  945. @item none
  946. Do not apply any gain.
  947. @item peak
  948. select peak gain, very conservative approach. This is default value.
  949. @item dc
  950. select DC gain, limited application.
  951. @item gn
  952. select gain to noise approach, this is most popular one.
  953. @end table
  954. @item irgain
  955. Set gain to be applied to IR coefficients before filtering.
  956. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  957. @item irfmt
  958. Set format of IR stream. Can be @code{mono} or @code{input}.
  959. Default is @code{input}.
  960. @item maxir
  961. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  962. Allowed range is 0.1 to 60 seconds.
  963. @item response
  964. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  965. By default it is disabled.
  966. @item channel
  967. Set for which IR channel to display frequency response. By default is first channel
  968. displayed. This option is used only when @var{response} is enabled.
  969. @item size
  970. Set video stream size. This option is used only when @var{response} is enabled.
  971. @item rate
  972. Set video stream frame rate. This option is used only when @var{response} is enabled.
  973. @item minp
  974. Set minimal partition size used for convolution. Default is @var{8192}.
  975. Allowed range is from @var{1} to @var{32768}.
  976. Lower values decreases latency at cost of higher CPU usage.
  977. @item maxp
  978. Set maximal partition size used for convolution. Default is @var{8192}.
  979. Allowed range is from @var{8} to @var{32768}.
  980. Lower values may increase CPU usage.
  981. @item nbirs
  982. Set number of input impulse responses streams which will be switchable at runtime.
  983. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  984. @item ir
  985. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  986. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  987. This option can be changed at runtime via @ref{commands}.
  988. @end table
  989. @subsection Examples
  990. @itemize
  991. @item
  992. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  993. @example
  994. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  995. @end example
  996. @end itemize
  997. @anchor{aformat}
  998. @section aformat
  999. Set output format constraints for the input audio. The framework will
  1000. negotiate the most appropriate format to minimize conversions.
  1001. It accepts the following parameters:
  1002. @table @option
  1003. @item sample_fmts, f
  1004. A '|'-separated list of requested sample formats.
  1005. @item sample_rates, r
  1006. A '|'-separated list of requested sample rates.
  1007. @item channel_layouts, cl
  1008. A '|'-separated list of requested channel layouts.
  1009. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1010. for the required syntax.
  1011. @end table
  1012. If a parameter is omitted, all values are allowed.
  1013. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1014. @example
  1015. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1016. @end example
  1017. @section agate
  1018. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1019. processing reduces disturbing noise between useful signals.
  1020. Gating is done by detecting the volume below a chosen level @var{threshold}
  1021. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1022. floor is set via @var{range}. Because an exact manipulation of the signal
  1023. would cause distortion of the waveform the reduction can be levelled over
  1024. time. This is done by setting @var{attack} and @var{release}.
  1025. @var{attack} determines how long the signal has to fall below the threshold
  1026. before any reduction will occur and @var{release} sets the time the signal
  1027. has to rise above the threshold to reduce the reduction again.
  1028. Shorter signals than the chosen attack time will be left untouched.
  1029. @table @option
  1030. @item level_in
  1031. Set input level before filtering.
  1032. Default is 1. Allowed range is from 0.015625 to 64.
  1033. @item mode
  1034. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1035. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1036. will be amplified, expanding dynamic range in upward direction.
  1037. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1038. @item range
  1039. Set the level of gain reduction when the signal is below the threshold.
  1040. Default is 0.06125. Allowed range is from 0 to 1.
  1041. Setting this to 0 disables reduction and then filter behaves like expander.
  1042. @item threshold
  1043. If a signal rises above this level the gain reduction is released.
  1044. Default is 0.125. Allowed range is from 0 to 1.
  1045. @item ratio
  1046. Set a ratio by which the signal is reduced.
  1047. Default is 2. Allowed range is from 1 to 9000.
  1048. @item attack
  1049. Amount of milliseconds the signal has to rise above the threshold before gain
  1050. reduction stops.
  1051. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1052. @item release
  1053. Amount of milliseconds the signal has to fall below the threshold before the
  1054. reduction is increased again. Default is 250 milliseconds.
  1055. Allowed range is from 0.01 to 9000.
  1056. @item makeup
  1057. Set amount of amplification of signal after processing.
  1058. Default is 1. Allowed range is from 1 to 64.
  1059. @item knee
  1060. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1061. Default is 2.828427125. Allowed range is from 1 to 8.
  1062. @item detection
  1063. Choose if exact signal should be taken for detection or an RMS like one.
  1064. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1065. @item link
  1066. Choose if the average level between all channels or the louder channel affects
  1067. the reduction.
  1068. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1069. @end table
  1070. @section aiir
  1071. Apply an arbitrary Infinite Impulse Response filter.
  1072. It accepts the following parameters:
  1073. @table @option
  1074. @item zeros, z
  1075. Set numerator/zeros coefficients.
  1076. @item poles, p
  1077. Set denominator/poles coefficients.
  1078. @item gains, k
  1079. Set channels gains.
  1080. @item dry_gain
  1081. Set input gain.
  1082. @item wet_gain
  1083. Set output gain.
  1084. @item format, f
  1085. Set coefficients format.
  1086. @table @samp
  1087. @item tf
  1088. digital transfer function
  1089. @item zp
  1090. Z-plane zeros/poles, cartesian (default)
  1091. @item pr
  1092. Z-plane zeros/poles, polar radians
  1093. @item pd
  1094. Z-plane zeros/poles, polar degrees
  1095. @item sp
  1096. S-plane zeros/poles
  1097. @end table
  1098. @item process, r
  1099. Set kind of processing.
  1100. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1101. @item precision, e
  1102. Set filtering precision.
  1103. @table @samp
  1104. @item dbl
  1105. double-precision floating-point (default)
  1106. @item flt
  1107. single-precision floating-point
  1108. @item i32
  1109. 32-bit integers
  1110. @item i16
  1111. 16-bit integers
  1112. @end table
  1113. @item normalize, n
  1114. Normalize filter coefficients, by default is enabled.
  1115. Enabling it will normalize magnitude response at DC to 0dB.
  1116. @item mix
  1117. How much to use filtered signal in output. Default is 1.
  1118. Range is between 0 and 1.
  1119. @item response
  1120. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1121. By default it is disabled.
  1122. @item channel
  1123. Set for which IR channel to display frequency response. By default is first channel
  1124. displayed. This option is used only when @var{response} is enabled.
  1125. @item size
  1126. Set video stream size. This option is used only when @var{response} is enabled.
  1127. @end table
  1128. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1129. order.
  1130. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1131. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1132. imaginary unit.
  1133. Different coefficients and gains can be provided for every channel, in such case
  1134. use '|' to separate coefficients or gains. Last provided coefficients will be
  1135. used for all remaining channels.
  1136. @subsection Examples
  1137. @itemize
  1138. @item
  1139. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1140. @example
  1141. 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
  1142. @end example
  1143. @item
  1144. Same as above but in @code{zp} format:
  1145. @example
  1146. 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
  1147. @end example
  1148. @end itemize
  1149. @section alimiter
  1150. The limiter prevents an input signal from rising over a desired threshold.
  1151. This limiter uses lookahead technology to prevent your signal from distorting.
  1152. It means that there is a small delay after the signal is processed. Keep in mind
  1153. that the delay it produces is the attack time you set.
  1154. The filter accepts the following options:
  1155. @table @option
  1156. @item level_in
  1157. Set input gain. Default is 1.
  1158. @item level_out
  1159. Set output gain. Default is 1.
  1160. @item limit
  1161. Don't let signals above this level pass the limiter. Default is 1.
  1162. @item attack
  1163. The limiter will reach its attenuation level in this amount of time in
  1164. milliseconds. Default is 5 milliseconds.
  1165. @item release
  1166. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1167. Default is 50 milliseconds.
  1168. @item asc
  1169. When gain reduction is always needed ASC takes care of releasing to an
  1170. average reduction level rather than reaching a reduction of 0 in the release
  1171. time.
  1172. @item asc_level
  1173. Select how much the release time is affected by ASC, 0 means nearly no changes
  1174. in release time while 1 produces higher release times.
  1175. @item level
  1176. Auto level output signal. Default is enabled.
  1177. This normalizes audio back to 0dB if enabled.
  1178. @end table
  1179. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1180. with @ref{aresample} before applying this filter.
  1181. @section allpass
  1182. Apply a two-pole all-pass filter with central frequency (in Hz)
  1183. @var{frequency}, and filter-width @var{width}.
  1184. An all-pass filter changes the audio's frequency to phase relationship
  1185. without changing its frequency to amplitude relationship.
  1186. The filter accepts the following options:
  1187. @table @option
  1188. @item frequency, f
  1189. Set frequency in Hz.
  1190. @item width_type, t
  1191. Set method to specify band-width of filter.
  1192. @table @option
  1193. @item h
  1194. Hz
  1195. @item q
  1196. Q-Factor
  1197. @item o
  1198. octave
  1199. @item s
  1200. slope
  1201. @item k
  1202. kHz
  1203. @end table
  1204. @item width, w
  1205. Specify the band-width of a filter in width_type units.
  1206. @item mix, m
  1207. How much to use filtered signal in output. Default is 1.
  1208. Range is between 0 and 1.
  1209. @item channels, c
  1210. Specify which channels to filter, by default all available are filtered.
  1211. @item normalize, n
  1212. Normalize biquad coefficients, by default is disabled.
  1213. Enabling it will normalize magnitude response at DC to 0dB.
  1214. @item order, o
  1215. Set the filter order, can be 1 or 2. Default is 2.
  1216. @end table
  1217. @subsection Commands
  1218. This filter supports the following commands:
  1219. @table @option
  1220. @item frequency, f
  1221. Change allpass frequency.
  1222. Syntax for the command is : "@var{frequency}"
  1223. @item width_type, t
  1224. Change allpass width_type.
  1225. Syntax for the command is : "@var{width_type}"
  1226. @item width, w
  1227. Change allpass width.
  1228. Syntax for the command is : "@var{width}"
  1229. @item mix, m
  1230. Change allpass mix.
  1231. Syntax for the command is : "@var{mix}"
  1232. @end table
  1233. @section aloop
  1234. Loop audio samples.
  1235. The filter accepts the following options:
  1236. @table @option
  1237. @item loop
  1238. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1239. Default is 0.
  1240. @item size
  1241. Set maximal number of samples. Default is 0.
  1242. @item start
  1243. Set first sample of loop. Default is 0.
  1244. @end table
  1245. @anchor{amerge}
  1246. @section amerge
  1247. Merge two or more audio streams into a single multi-channel stream.
  1248. The filter accepts the following options:
  1249. @table @option
  1250. @item inputs
  1251. Set the number of inputs. Default is 2.
  1252. @end table
  1253. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1254. the channel layout of the output will be set accordingly and the channels
  1255. will be reordered as necessary. If the channel layouts of the inputs are not
  1256. disjoint, the output will have all the channels of the first input then all
  1257. the channels of the second input, in that order, and the channel layout of
  1258. the output will be the default value corresponding to the total number of
  1259. channels.
  1260. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1261. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1262. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1263. first input, b1 is the first channel of the second input).
  1264. On the other hand, if both input are in stereo, the output channels will be
  1265. in the default order: a1, a2, b1, b2, and the channel layout will be
  1266. arbitrarily set to 4.0, which may or may not be the expected value.
  1267. All inputs must have the same sample rate, and format.
  1268. If inputs do not have the same duration, the output will stop with the
  1269. shortest.
  1270. @subsection Examples
  1271. @itemize
  1272. @item
  1273. Merge two mono files into a stereo stream:
  1274. @example
  1275. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1276. @end example
  1277. @item
  1278. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1279. @example
  1280. 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
  1281. @end example
  1282. @end itemize
  1283. @section amix
  1284. Mixes multiple audio inputs into a single output.
  1285. Note that this filter only supports float samples (the @var{amerge}
  1286. and @var{pan} audio filters support many formats). If the @var{amix}
  1287. input has integer samples then @ref{aresample} will be automatically
  1288. inserted to perform the conversion to float samples.
  1289. For example
  1290. @example
  1291. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1292. @end example
  1293. will mix 3 input audio streams to a single output with the same duration as the
  1294. first input and a dropout transition time of 3 seconds.
  1295. It accepts the following parameters:
  1296. @table @option
  1297. @item inputs
  1298. The number of inputs. If unspecified, it defaults to 2.
  1299. @item duration
  1300. How to determine the end-of-stream.
  1301. @table @option
  1302. @item longest
  1303. The duration of the longest input. (default)
  1304. @item shortest
  1305. The duration of the shortest input.
  1306. @item first
  1307. The duration of the first input.
  1308. @end table
  1309. @item dropout_transition
  1310. The transition time, in seconds, for volume renormalization when an input
  1311. stream ends. The default value is 2 seconds.
  1312. @item weights
  1313. Specify weight of each input audio stream as sequence.
  1314. Each weight is separated by space. By default all inputs have same weight.
  1315. @end table
  1316. @subsection Commands
  1317. This filter supports the following commands:
  1318. @table @option
  1319. @item weights
  1320. Syntax is same as option with same name.
  1321. @end table
  1322. @section amultiply
  1323. Multiply first audio stream with second audio stream and store result
  1324. in output audio stream. Multiplication is done by multiplying each
  1325. sample from first stream with sample at same position from second stream.
  1326. With this element-wise multiplication one can create amplitude fades and
  1327. amplitude modulations.
  1328. @section anequalizer
  1329. High-order parametric multiband equalizer for each channel.
  1330. It accepts the following parameters:
  1331. @table @option
  1332. @item params
  1333. This option string is in format:
  1334. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1335. Each equalizer band is separated by '|'.
  1336. @table @option
  1337. @item chn
  1338. Set channel number to which equalization will be applied.
  1339. If input doesn't have that channel the entry is ignored.
  1340. @item f
  1341. Set central frequency for band.
  1342. If input doesn't have that frequency the entry is ignored.
  1343. @item w
  1344. Set band width in hertz.
  1345. @item g
  1346. Set band gain in dB.
  1347. @item t
  1348. Set filter type for band, optional, can be:
  1349. @table @samp
  1350. @item 0
  1351. Butterworth, this is default.
  1352. @item 1
  1353. Chebyshev type 1.
  1354. @item 2
  1355. Chebyshev type 2.
  1356. @end table
  1357. @end table
  1358. @item curves
  1359. With this option activated frequency response of anequalizer is displayed
  1360. in video stream.
  1361. @item size
  1362. Set video stream size. Only useful if curves option is activated.
  1363. @item mgain
  1364. Set max gain that will be displayed. Only useful if curves option is activated.
  1365. Setting this to a reasonable value makes it possible to display gain which is derived from
  1366. neighbour bands which are too close to each other and thus produce higher gain
  1367. when both are activated.
  1368. @item fscale
  1369. Set frequency scale used to draw frequency response in video output.
  1370. Can be linear or logarithmic. Default is logarithmic.
  1371. @item colors
  1372. Set color for each channel curve which is going to be displayed in video stream.
  1373. This is list of color names separated by space or by '|'.
  1374. Unrecognised or missing colors will be replaced by white color.
  1375. @end table
  1376. @subsection Examples
  1377. @itemize
  1378. @item
  1379. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1380. for first 2 channels using Chebyshev type 1 filter:
  1381. @example
  1382. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1383. @end example
  1384. @end itemize
  1385. @subsection Commands
  1386. This filter supports the following commands:
  1387. @table @option
  1388. @item change
  1389. Alter existing filter parameters.
  1390. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1391. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1392. error is returned.
  1393. @var{freq} set new frequency parameter.
  1394. @var{width} set new width parameter in herz.
  1395. @var{gain} set new gain parameter in dB.
  1396. Full filter invocation with asendcmd may look like this:
  1397. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1398. @end table
  1399. @section anlmdn
  1400. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1401. Each sample is adjusted by looking for other samples with similar contexts. This
  1402. context similarity is defined by comparing their surrounding patches of size
  1403. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1404. The filter accepts the following options:
  1405. @table @option
  1406. @item s
  1407. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1408. @item p
  1409. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1410. Default value is 2 milliseconds.
  1411. @item r
  1412. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1413. Default value is 6 milliseconds.
  1414. @item o
  1415. Set the output mode.
  1416. It accepts the following values:
  1417. @table @option
  1418. @item i
  1419. Pass input unchanged.
  1420. @item o
  1421. Pass noise filtered out.
  1422. @item n
  1423. Pass only noise.
  1424. Default value is @var{o}.
  1425. @end table
  1426. @item m
  1427. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1428. @end table
  1429. @subsection Commands
  1430. This filter supports the following commands:
  1431. @table @option
  1432. @item s
  1433. Change denoise strength. Argument is single float number.
  1434. Syntax for the command is : "@var{s}"
  1435. @item o
  1436. Change output mode.
  1437. Syntax for the command is : "i", "o" or "n" string.
  1438. @end table
  1439. @section anlms
  1440. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1441. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1442. relate to producing the least mean square of the error signal (difference between the desired,
  1443. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1444. A description of the accepted options follows.
  1445. @table @option
  1446. @item order
  1447. Set filter order.
  1448. @item mu
  1449. Set filter mu.
  1450. @item eps
  1451. Set the filter eps.
  1452. @item leakage
  1453. Set the filter leakage.
  1454. @item out_mode
  1455. It accepts the following values:
  1456. @table @option
  1457. @item i
  1458. Pass the 1st input.
  1459. @item d
  1460. Pass the 2nd input.
  1461. @item o
  1462. Pass filtered samples.
  1463. @item n
  1464. Pass difference between desired and filtered samples.
  1465. Default value is @var{o}.
  1466. @end table
  1467. @end table
  1468. @subsection Examples
  1469. @itemize
  1470. @item
  1471. One of many usages of this filter is noise reduction, input audio is filtered
  1472. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1473. @example
  1474. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1475. @end example
  1476. @end itemize
  1477. @subsection Commands
  1478. This filter supports the same commands as options, excluding option @code{order}.
  1479. @section anull
  1480. Pass the audio source unchanged to the output.
  1481. @section apad
  1482. Pad the end of an audio stream with silence.
  1483. This can be used together with @command{ffmpeg} @option{-shortest} to
  1484. extend audio streams to the same length as the video stream.
  1485. A description of the accepted options follows.
  1486. @table @option
  1487. @item packet_size
  1488. Set silence packet size. Default value is 4096.
  1489. @item pad_len
  1490. Set the number of samples of silence to add to the end. After the
  1491. value is reached, the stream is terminated. This option is mutually
  1492. exclusive with @option{whole_len}.
  1493. @item whole_len
  1494. Set the minimum total number of samples in the output audio stream. If
  1495. the value is longer than the input audio length, silence is added to
  1496. the end, until the value is reached. This option is mutually exclusive
  1497. with @option{pad_len}.
  1498. @item pad_dur
  1499. Specify the duration of samples of silence to add. See
  1500. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1501. for the accepted syntax. Used only if set to non-zero value.
  1502. @item whole_dur
  1503. Specify the minimum total duration in the output audio stream. See
  1504. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1505. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1506. the input audio length, silence is added to the end, until the value is reached.
  1507. This option is mutually exclusive with @option{pad_dur}
  1508. @end table
  1509. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1510. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1511. the input stream indefinitely.
  1512. @subsection Examples
  1513. @itemize
  1514. @item
  1515. Add 1024 samples of silence to the end of the input:
  1516. @example
  1517. apad=pad_len=1024
  1518. @end example
  1519. @item
  1520. Make sure the audio output will contain at least 10000 samples, pad
  1521. the input with silence if required:
  1522. @example
  1523. apad=whole_len=10000
  1524. @end example
  1525. @item
  1526. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1527. video stream will always result the shortest and will be converted
  1528. until the end in the output file when using the @option{shortest}
  1529. option:
  1530. @example
  1531. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1532. @end example
  1533. @end itemize
  1534. @section aphaser
  1535. Add a phasing effect to the input audio.
  1536. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1537. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1538. A description of the accepted parameters follows.
  1539. @table @option
  1540. @item in_gain
  1541. Set input gain. Default is 0.4.
  1542. @item out_gain
  1543. Set output gain. Default is 0.74
  1544. @item delay
  1545. Set delay in milliseconds. Default is 3.0.
  1546. @item decay
  1547. Set decay. Default is 0.4.
  1548. @item speed
  1549. Set modulation speed in Hz. Default is 0.5.
  1550. @item type
  1551. Set modulation type. Default is triangular.
  1552. It accepts the following values:
  1553. @table @samp
  1554. @item triangular, t
  1555. @item sinusoidal, s
  1556. @end table
  1557. @end table
  1558. @section apulsator
  1559. Audio pulsator is something between an autopanner and a tremolo.
  1560. But it can produce funny stereo effects as well. Pulsator changes the volume
  1561. of the left and right channel based on a LFO (low frequency oscillator) with
  1562. different waveforms and shifted phases.
  1563. This filter have the ability to define an offset between left and right
  1564. channel. An offset of 0 means that both LFO shapes match each other.
  1565. The left and right channel are altered equally - a conventional tremolo.
  1566. An offset of 50% means that the shape of the right channel is exactly shifted
  1567. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1568. an autopanner. At 1 both curves match again. Every setting in between moves the
  1569. phase shift gapless between all stages and produces some "bypassing" sounds with
  1570. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1571. the 0.5) the faster the signal passes from the left to the right speaker.
  1572. The filter accepts the following options:
  1573. @table @option
  1574. @item level_in
  1575. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1576. @item level_out
  1577. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1578. @item mode
  1579. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1580. sawup or sawdown. Default is sine.
  1581. @item amount
  1582. Set modulation. Define how much of original signal is affected by the LFO.
  1583. @item offset_l
  1584. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1585. @item offset_r
  1586. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1587. @item width
  1588. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1589. @item timing
  1590. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1591. @item bpm
  1592. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1593. is set to bpm.
  1594. @item ms
  1595. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1596. is set to ms.
  1597. @item hz
  1598. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1599. if timing is set to hz.
  1600. @end table
  1601. @anchor{aresample}
  1602. @section aresample
  1603. Resample the input audio to the specified parameters, using the
  1604. libswresample library. If none are specified then the filter will
  1605. automatically convert between its input and output.
  1606. This filter is also able to stretch/squeeze the audio data to make it match
  1607. the timestamps or to inject silence / cut out audio to make it match the
  1608. timestamps, do a combination of both or do neither.
  1609. The filter accepts the syntax
  1610. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1611. expresses a sample rate and @var{resampler_options} is a list of
  1612. @var{key}=@var{value} pairs, separated by ":". See the
  1613. @ref{Resampler Options,,"Resampler Options" section in the
  1614. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1615. for the complete list of supported options.
  1616. @subsection Examples
  1617. @itemize
  1618. @item
  1619. Resample the input audio to 44100Hz:
  1620. @example
  1621. aresample=44100
  1622. @end example
  1623. @item
  1624. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1625. samples per second compensation:
  1626. @example
  1627. aresample=async=1000
  1628. @end example
  1629. @end itemize
  1630. @section areverse
  1631. Reverse an audio clip.
  1632. Warning: This filter requires memory to buffer the entire clip, so trimming
  1633. is suggested.
  1634. @subsection Examples
  1635. @itemize
  1636. @item
  1637. Take the first 5 seconds of a clip, and reverse it.
  1638. @example
  1639. atrim=end=5,areverse
  1640. @end example
  1641. @end itemize
  1642. @section arnndn
  1643. Reduce noise from speech using Recurrent Neural Networks.
  1644. This filter accepts the following options:
  1645. @table @option
  1646. @item model, m
  1647. Set train model file to load. This option is always required.
  1648. @end table
  1649. @section asetnsamples
  1650. Set the number of samples per each output audio frame.
  1651. The last output packet may contain a different number of samples, as
  1652. the filter will flush all the remaining samples when the input audio
  1653. signals its end.
  1654. The filter accepts the following options:
  1655. @table @option
  1656. @item nb_out_samples, n
  1657. Set the number of frames per each output audio frame. The number is
  1658. intended as the number of samples @emph{per each channel}.
  1659. Default value is 1024.
  1660. @item pad, p
  1661. If set to 1, the filter will pad the last audio frame with zeroes, so
  1662. that the last frame will contain the same number of samples as the
  1663. previous ones. Default value is 1.
  1664. @end table
  1665. For example, to set the number of per-frame samples to 1234 and
  1666. disable padding for the last frame, use:
  1667. @example
  1668. asetnsamples=n=1234:p=0
  1669. @end example
  1670. @section asetrate
  1671. Set the sample rate without altering the PCM data.
  1672. This will result in a change of speed and pitch.
  1673. The filter accepts the following options:
  1674. @table @option
  1675. @item sample_rate, r
  1676. Set the output sample rate. Default is 44100 Hz.
  1677. @end table
  1678. @section ashowinfo
  1679. Show a line containing various information for each input audio frame.
  1680. The input audio is not modified.
  1681. The shown line contains a sequence of key/value pairs of the form
  1682. @var{key}:@var{value}.
  1683. The following values are shown in the output:
  1684. @table @option
  1685. @item n
  1686. The (sequential) number of the input frame, starting from 0.
  1687. @item pts
  1688. The presentation timestamp of the input frame, in time base units; the time base
  1689. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1690. @item pts_time
  1691. The presentation timestamp of the input frame in seconds.
  1692. @item pos
  1693. position of the frame in the input stream, -1 if this information in
  1694. unavailable and/or meaningless (for example in case of synthetic audio)
  1695. @item fmt
  1696. The sample format.
  1697. @item chlayout
  1698. The channel layout.
  1699. @item rate
  1700. The sample rate for the audio frame.
  1701. @item nb_samples
  1702. The number of samples (per channel) in the frame.
  1703. @item checksum
  1704. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1705. audio, the data is treated as if all the planes were concatenated.
  1706. @item plane_checksums
  1707. A list of Adler-32 checksums for each data plane.
  1708. @end table
  1709. @section asoftclip
  1710. Apply audio soft clipping.
  1711. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1712. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1713. This filter accepts the following options:
  1714. @table @option
  1715. @item type
  1716. Set type of soft-clipping.
  1717. It accepts the following values:
  1718. @table @option
  1719. @item tanh
  1720. @item atan
  1721. @item cubic
  1722. @item exp
  1723. @item alg
  1724. @item quintic
  1725. @item sin
  1726. @end table
  1727. @item param
  1728. Set additional parameter which controls sigmoid function.
  1729. @end table
  1730. @subsection Commands
  1731. This filter supports the all above options as @ref{commands}.
  1732. @section asr
  1733. Automatic Speech Recognition
  1734. This filter uses PocketSphinx for speech recognition. To enable
  1735. compilation of this filter, you need to configure FFmpeg with
  1736. @code{--enable-pocketsphinx}.
  1737. It accepts the following options:
  1738. @table @option
  1739. @item rate
  1740. Set sampling rate of input audio. Defaults is @code{16000}.
  1741. This need to match speech models, otherwise one will get poor results.
  1742. @item hmm
  1743. Set dictionary containing acoustic model files.
  1744. @item dict
  1745. Set pronunciation dictionary.
  1746. @item lm
  1747. Set language model file.
  1748. @item lmctl
  1749. Set language model set.
  1750. @item lmname
  1751. Set which language model to use.
  1752. @item logfn
  1753. Set output for log messages.
  1754. @end table
  1755. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1756. @anchor{astats}
  1757. @section astats
  1758. Display time domain statistical information about the audio channels.
  1759. Statistics are calculated and displayed for each audio channel and,
  1760. where applicable, an overall figure is also given.
  1761. It accepts the following option:
  1762. @table @option
  1763. @item length
  1764. Short window length in seconds, used for peak and trough RMS measurement.
  1765. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1766. @item metadata
  1767. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1768. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1769. disabled.
  1770. Available keys for each channel are:
  1771. DC_offset
  1772. Min_level
  1773. Max_level
  1774. Min_difference
  1775. Max_difference
  1776. Mean_difference
  1777. RMS_difference
  1778. Peak_level
  1779. RMS_peak
  1780. RMS_trough
  1781. Crest_factor
  1782. Flat_factor
  1783. Peak_count
  1784. Noise_floor
  1785. Noise_floor_count
  1786. Bit_depth
  1787. Dynamic_range
  1788. Zero_crossings
  1789. Zero_crossings_rate
  1790. Number_of_NaNs
  1791. Number_of_Infs
  1792. Number_of_denormals
  1793. and for Overall:
  1794. DC_offset
  1795. Min_level
  1796. Max_level
  1797. Min_difference
  1798. Max_difference
  1799. Mean_difference
  1800. RMS_difference
  1801. Peak_level
  1802. RMS_level
  1803. RMS_peak
  1804. RMS_trough
  1805. Flat_factor
  1806. Peak_count
  1807. Noise_floor
  1808. Noise_floor_count
  1809. Bit_depth
  1810. Number_of_samples
  1811. Number_of_NaNs
  1812. Number_of_Infs
  1813. Number_of_denormals
  1814. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1815. this @code{lavfi.astats.Overall.Peak_count}.
  1816. For description what each key means read below.
  1817. @item reset
  1818. Set number of frame after which stats are going to be recalculated.
  1819. Default is disabled.
  1820. @item measure_perchannel
  1821. Select the entries which need to be measured per channel. The metadata keys can
  1822. be used as flags, default is @option{all} which measures everything.
  1823. @option{none} disables all per channel measurement.
  1824. @item measure_overall
  1825. Select the entries which need to be measured overall. The metadata keys can
  1826. be used as flags, default is @option{all} which measures everything.
  1827. @option{none} disables all overall measurement.
  1828. @end table
  1829. A description of each shown parameter follows:
  1830. @table @option
  1831. @item DC offset
  1832. Mean amplitude displacement from zero.
  1833. @item Min level
  1834. Minimal sample level.
  1835. @item Max level
  1836. Maximal sample level.
  1837. @item Min difference
  1838. Minimal difference between two consecutive samples.
  1839. @item Max difference
  1840. Maximal difference between two consecutive samples.
  1841. @item Mean difference
  1842. Mean difference between two consecutive samples.
  1843. The average of each difference between two consecutive samples.
  1844. @item RMS difference
  1845. Root Mean Square difference between two consecutive samples.
  1846. @item Peak level dB
  1847. @item RMS level dB
  1848. Standard peak and RMS level measured in dBFS.
  1849. @item RMS peak dB
  1850. @item RMS trough dB
  1851. Peak and trough values for RMS level measured over a short window.
  1852. @item Crest factor
  1853. Standard ratio of peak to RMS level (note: not in dB).
  1854. @item Flat factor
  1855. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1856. (i.e. either @var{Min level} or @var{Max level}).
  1857. @item Peak count
  1858. Number of occasions (not the number of samples) that the signal attained either
  1859. @var{Min level} or @var{Max level}.
  1860. @item Noise floor dB
  1861. Minimum local peak measured in dBFS over a short window.
  1862. @item Noise floor count
  1863. Number of occasions (not the number of samples) that the signal attained
  1864. @var{Noise floor}.
  1865. @item Bit depth
  1866. Overall bit depth of audio. Number of bits used for each sample.
  1867. @item Dynamic range
  1868. Measured dynamic range of audio in dB.
  1869. @item Zero crossings
  1870. Number of points where the waveform crosses the zero level axis.
  1871. @item Zero crossings rate
  1872. Rate of Zero crossings and number of audio samples.
  1873. @end table
  1874. @section asubboost
  1875. Boost subwoofer frequencies.
  1876. The filter accepts the following options:
  1877. @table @option
  1878. @item dry
  1879. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1880. Default value is 0.5.
  1881. @item wet
  1882. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  1883. Default value is 0.8.
  1884. @item decay
  1885. Set delay line decay gain value. Allowed range is from 0 to 1.
  1886. Default value is 0.7.
  1887. @item feedback
  1888. Set delay line feedback gain value. Allowed range is from 0 to 1.
  1889. Default value is 0.5.
  1890. @item cutoff
  1891. Set cutoff frequency in herz. Allowed range is 50 to 900.
  1892. Default value is 100.
  1893. @item slope
  1894. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  1895. Default value is 0.5.
  1896. @item delay
  1897. Set delay. Allowed range is from 1 to 100.
  1898. Default value is 20.
  1899. @end table
  1900. @subsection Commands
  1901. This filter supports the all above options as @ref{commands}.
  1902. @section atempo
  1903. Adjust audio tempo.
  1904. The filter accepts exactly one parameter, the audio tempo. If not
  1905. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1906. be in the [0.5, 100.0] range.
  1907. Note that tempo greater than 2 will skip some samples rather than
  1908. blend them in. If for any reason this is a concern it is always
  1909. possible to daisy-chain several instances of atempo to achieve the
  1910. desired product tempo.
  1911. @subsection Examples
  1912. @itemize
  1913. @item
  1914. Slow down audio to 80% tempo:
  1915. @example
  1916. atempo=0.8
  1917. @end example
  1918. @item
  1919. To speed up audio to 300% tempo:
  1920. @example
  1921. atempo=3
  1922. @end example
  1923. @item
  1924. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1925. @example
  1926. atempo=sqrt(3),atempo=sqrt(3)
  1927. @end example
  1928. @end itemize
  1929. @subsection Commands
  1930. This filter supports the following commands:
  1931. @table @option
  1932. @item tempo
  1933. Change filter tempo scale factor.
  1934. Syntax for the command is : "@var{tempo}"
  1935. @end table
  1936. @section atrim
  1937. Trim the input so that the output contains one continuous subpart of the input.
  1938. It accepts the following parameters:
  1939. @table @option
  1940. @item start
  1941. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1942. sample with the timestamp @var{start} will be the first sample in the output.
  1943. @item end
  1944. Specify time of the first audio sample that will be dropped, i.e. the
  1945. audio sample immediately preceding the one with the timestamp @var{end} will be
  1946. the last sample in the output.
  1947. @item start_pts
  1948. Same as @var{start}, except this option sets the start timestamp in samples
  1949. instead of seconds.
  1950. @item end_pts
  1951. Same as @var{end}, except this option sets the end timestamp in samples instead
  1952. of seconds.
  1953. @item duration
  1954. The maximum duration of the output in seconds.
  1955. @item start_sample
  1956. The number of the first sample that should be output.
  1957. @item end_sample
  1958. The number of the first sample that should be dropped.
  1959. @end table
  1960. @option{start}, @option{end}, and @option{duration} are expressed as time
  1961. duration specifications; see
  1962. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1963. Note that the first two sets of the start/end options and the @option{duration}
  1964. option look at the frame timestamp, while the _sample options simply count the
  1965. samples that pass through the filter. So start/end_pts and start/end_sample will
  1966. give different results when the timestamps are wrong, inexact or do not start at
  1967. zero. Also note that this filter does not modify the timestamps. If you wish
  1968. to have the output timestamps start at zero, insert the asetpts filter after the
  1969. atrim filter.
  1970. If multiple start or end options are set, this filter tries to be greedy and
  1971. keep all samples that match at least one of the specified constraints. To keep
  1972. only the part that matches all the constraints at once, chain multiple atrim
  1973. filters.
  1974. The defaults are such that all the input is kept. So it is possible to set e.g.
  1975. just the end values to keep everything before the specified time.
  1976. Examples:
  1977. @itemize
  1978. @item
  1979. Drop everything except the second minute of input:
  1980. @example
  1981. ffmpeg -i INPUT -af atrim=60:120
  1982. @end example
  1983. @item
  1984. Keep only the first 1000 samples:
  1985. @example
  1986. ffmpeg -i INPUT -af atrim=end_sample=1000
  1987. @end example
  1988. @end itemize
  1989. @section axcorrelate
  1990. Calculate normalized cross-correlation between two input audio streams.
  1991. Resulted samples are always between -1 and 1 inclusive.
  1992. If result is 1 it means two input samples are highly correlated in that selected segment.
  1993. Result 0 means they are not correlated at all.
  1994. If result is -1 it means two input samples are out of phase, which means they cancel each
  1995. other.
  1996. The filter accepts the following options:
  1997. @table @option
  1998. @item size
  1999. Set size of segment over which cross-correlation is calculated.
  2000. Default is 256. Allowed range is from 2 to 131072.
  2001. @item algo
  2002. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2003. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2004. are always zero and thus need much less calculations to make.
  2005. This is generally not true, but is valid for typical audio streams.
  2006. @end table
  2007. @subsection Examples
  2008. @itemize
  2009. @item
  2010. Calculate correlation between channels in stereo audio stream:
  2011. @example
  2012. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2013. @end example
  2014. @end itemize
  2015. @section bandpass
  2016. Apply a two-pole Butterworth band-pass filter with central
  2017. frequency @var{frequency}, and (3dB-point) band-width width.
  2018. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2019. instead of the default: constant 0dB peak gain.
  2020. The filter roll off at 6dB per octave (20dB per decade).
  2021. The filter accepts the following options:
  2022. @table @option
  2023. @item frequency, f
  2024. Set the filter's central frequency. Default is @code{3000}.
  2025. @item csg
  2026. Constant skirt gain if set to 1. Defaults to 0.
  2027. @item width_type, t
  2028. Set method to specify band-width of filter.
  2029. @table @option
  2030. @item h
  2031. Hz
  2032. @item q
  2033. Q-Factor
  2034. @item o
  2035. octave
  2036. @item s
  2037. slope
  2038. @item k
  2039. kHz
  2040. @end table
  2041. @item width, w
  2042. Specify the band-width of a filter in width_type units.
  2043. @item mix, m
  2044. How much to use filtered signal in output. Default is 1.
  2045. Range is between 0 and 1.
  2046. @item channels, c
  2047. Specify which channels to filter, by default all available are filtered.
  2048. @item normalize, n
  2049. Normalize biquad coefficients, by default is disabled.
  2050. Enabling it will normalize magnitude response at DC to 0dB.
  2051. @end table
  2052. @subsection Commands
  2053. This filter supports the following commands:
  2054. @table @option
  2055. @item frequency, f
  2056. Change bandpass frequency.
  2057. Syntax for the command is : "@var{frequency}"
  2058. @item width_type, t
  2059. Change bandpass width_type.
  2060. Syntax for the command is : "@var{width_type}"
  2061. @item width, w
  2062. Change bandpass width.
  2063. Syntax for the command is : "@var{width}"
  2064. @item mix, m
  2065. Change bandpass mix.
  2066. Syntax for the command is : "@var{mix}"
  2067. @end table
  2068. @section bandreject
  2069. Apply a two-pole Butterworth band-reject filter with central
  2070. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2071. The filter roll off at 6dB per octave (20dB per decade).
  2072. The filter accepts the following options:
  2073. @table @option
  2074. @item frequency, f
  2075. Set the filter's central frequency. Default is @code{3000}.
  2076. @item width_type, t
  2077. Set method to specify band-width of filter.
  2078. @table @option
  2079. @item h
  2080. Hz
  2081. @item q
  2082. Q-Factor
  2083. @item o
  2084. octave
  2085. @item s
  2086. slope
  2087. @item k
  2088. kHz
  2089. @end table
  2090. @item width, w
  2091. Specify the band-width of a filter in width_type units.
  2092. @item mix, m
  2093. How much to use filtered signal in output. Default is 1.
  2094. Range is between 0 and 1.
  2095. @item channels, c
  2096. Specify which channels to filter, by default all available are filtered.
  2097. @item normalize, n
  2098. Normalize biquad coefficients, by default is disabled.
  2099. Enabling it will normalize magnitude response at DC to 0dB.
  2100. @end table
  2101. @subsection Commands
  2102. This filter supports the following commands:
  2103. @table @option
  2104. @item frequency, f
  2105. Change bandreject frequency.
  2106. Syntax for the command is : "@var{frequency}"
  2107. @item width_type, t
  2108. Change bandreject width_type.
  2109. Syntax for the command is : "@var{width_type}"
  2110. @item width, w
  2111. Change bandreject width.
  2112. Syntax for the command is : "@var{width}"
  2113. @item mix, m
  2114. Change bandreject mix.
  2115. Syntax for the command is : "@var{mix}"
  2116. @end table
  2117. @section bass, lowshelf
  2118. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2119. shelving filter with a response similar to that of a standard
  2120. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2121. The filter accepts the following options:
  2122. @table @option
  2123. @item gain, g
  2124. Give the gain at 0 Hz. Its useful range is about -20
  2125. (for a large cut) to +20 (for a large boost).
  2126. Beware of clipping when using a positive gain.
  2127. @item frequency, f
  2128. Set the filter's central frequency and so can be used
  2129. to extend or reduce the frequency range to be boosted or cut.
  2130. The default value is @code{100} Hz.
  2131. @item width_type, t
  2132. Set method to specify band-width of filter.
  2133. @table @option
  2134. @item h
  2135. Hz
  2136. @item q
  2137. Q-Factor
  2138. @item o
  2139. octave
  2140. @item s
  2141. slope
  2142. @item k
  2143. kHz
  2144. @end table
  2145. @item width, w
  2146. Determine how steep is the filter's shelf transition.
  2147. @item mix, m
  2148. How much to use filtered signal in output. Default is 1.
  2149. Range is between 0 and 1.
  2150. @item channels, c
  2151. Specify which channels to filter, by default all available are filtered.
  2152. @item normalize, n
  2153. Normalize biquad coefficients, by default is disabled.
  2154. Enabling it will normalize magnitude response at DC to 0dB.
  2155. @end table
  2156. @subsection Commands
  2157. This filter supports the following commands:
  2158. @table @option
  2159. @item frequency, f
  2160. Change bass frequency.
  2161. Syntax for the command is : "@var{frequency}"
  2162. @item width_type, t
  2163. Change bass width_type.
  2164. Syntax for the command is : "@var{width_type}"
  2165. @item width, w
  2166. Change bass width.
  2167. Syntax for the command is : "@var{width}"
  2168. @item gain, g
  2169. Change bass gain.
  2170. Syntax for the command is : "@var{gain}"
  2171. @item mix, m
  2172. Change bass mix.
  2173. Syntax for the command is : "@var{mix}"
  2174. @end table
  2175. @section biquad
  2176. Apply a biquad IIR filter with the given coefficients.
  2177. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2178. are the numerator and denominator coefficients respectively.
  2179. and @var{channels}, @var{c} specify which channels to filter, by default all
  2180. available are filtered.
  2181. @subsection Commands
  2182. This filter supports the following commands:
  2183. @table @option
  2184. @item a0
  2185. @item a1
  2186. @item a2
  2187. @item b0
  2188. @item b1
  2189. @item b2
  2190. Change biquad parameter.
  2191. Syntax for the command is : "@var{value}"
  2192. @item mix, m
  2193. How much to use filtered signal in output. Default is 1.
  2194. Range is between 0 and 1.
  2195. @item channels, c
  2196. Specify which channels to filter, by default all available are filtered.
  2197. @item normalize, n
  2198. Normalize biquad coefficients, by default is disabled.
  2199. Enabling it will normalize magnitude response at DC to 0dB.
  2200. @end table
  2201. @section bs2b
  2202. Bauer stereo to binaural transformation, which improves headphone listening of
  2203. stereo audio records.
  2204. To enable compilation of this filter you need to configure FFmpeg with
  2205. @code{--enable-libbs2b}.
  2206. It accepts the following parameters:
  2207. @table @option
  2208. @item profile
  2209. Pre-defined crossfeed level.
  2210. @table @option
  2211. @item default
  2212. Default level (fcut=700, feed=50).
  2213. @item cmoy
  2214. Chu Moy circuit (fcut=700, feed=60).
  2215. @item jmeier
  2216. Jan Meier circuit (fcut=650, feed=95).
  2217. @end table
  2218. @item fcut
  2219. Cut frequency (in Hz).
  2220. @item feed
  2221. Feed level (in Hz).
  2222. @end table
  2223. @section channelmap
  2224. Remap input channels to new locations.
  2225. It accepts the following parameters:
  2226. @table @option
  2227. @item map
  2228. Map channels from input to output. The argument is a '|'-separated list of
  2229. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2230. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2231. channel (e.g. FL for front left) or its index in the input channel layout.
  2232. @var{out_channel} is the name of the output channel or its index in the output
  2233. channel layout. If @var{out_channel} is not given then it is implicitly an
  2234. index, starting with zero and increasing by one for each mapping.
  2235. @item channel_layout
  2236. The channel layout of the output stream.
  2237. @end table
  2238. If no mapping is present, the filter will implicitly map input channels to
  2239. output channels, preserving indices.
  2240. @subsection Examples
  2241. @itemize
  2242. @item
  2243. For example, assuming a 5.1+downmix input MOV file,
  2244. @example
  2245. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2246. @end example
  2247. will create an output WAV file tagged as stereo from the downmix channels of
  2248. the input.
  2249. @item
  2250. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2251. @example
  2252. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2253. @end example
  2254. @end itemize
  2255. @section channelsplit
  2256. Split each channel from an input audio stream into a separate output stream.
  2257. It accepts the following parameters:
  2258. @table @option
  2259. @item channel_layout
  2260. The channel layout of the input stream. The default is "stereo".
  2261. @item channels
  2262. A channel layout describing the channels to be extracted as separate output streams
  2263. or "all" to extract each input channel as a separate stream. The default is "all".
  2264. Choosing channels not present in channel layout in the input will result in an error.
  2265. @end table
  2266. @subsection Examples
  2267. @itemize
  2268. @item
  2269. For example, assuming a stereo input MP3 file,
  2270. @example
  2271. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2272. @end example
  2273. will create an output Matroska file with two audio streams, one containing only
  2274. the left channel and the other the right channel.
  2275. @item
  2276. Split a 5.1 WAV file into per-channel files:
  2277. @example
  2278. ffmpeg -i in.wav -filter_complex
  2279. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2280. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2281. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2282. side_right.wav
  2283. @end example
  2284. @item
  2285. Extract only LFE from a 5.1 WAV file:
  2286. @example
  2287. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2288. -map '[LFE]' lfe.wav
  2289. @end example
  2290. @end itemize
  2291. @section chorus
  2292. Add a chorus effect to the audio.
  2293. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2294. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2295. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2296. The modulation depth defines the range the modulated delay is played before or after
  2297. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2298. sound tuned around the original one, like in a chorus where some vocals are slightly
  2299. off key.
  2300. It accepts the following parameters:
  2301. @table @option
  2302. @item in_gain
  2303. Set input gain. Default is 0.4.
  2304. @item out_gain
  2305. Set output gain. Default is 0.4.
  2306. @item delays
  2307. Set delays. A typical delay is around 40ms to 60ms.
  2308. @item decays
  2309. Set decays.
  2310. @item speeds
  2311. Set speeds.
  2312. @item depths
  2313. Set depths.
  2314. @end table
  2315. @subsection Examples
  2316. @itemize
  2317. @item
  2318. A single delay:
  2319. @example
  2320. chorus=0.7:0.9:55:0.4:0.25:2
  2321. @end example
  2322. @item
  2323. Two delays:
  2324. @example
  2325. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2326. @end example
  2327. @item
  2328. Fuller sounding chorus with three delays:
  2329. @example
  2330. 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
  2331. @end example
  2332. @end itemize
  2333. @section compand
  2334. Compress or expand the audio's dynamic range.
  2335. It accepts the following parameters:
  2336. @table @option
  2337. @item attacks
  2338. @item decays
  2339. A list of times in seconds for each channel over which the instantaneous level
  2340. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2341. increase of volume and @var{decays} refers to decrease of volume. For most
  2342. situations, the attack time (response to the audio getting louder) should be
  2343. shorter than the decay time, because the human ear is more sensitive to sudden
  2344. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2345. a typical value for decay is 0.8 seconds.
  2346. If specified number of attacks & decays is lower than number of channels, the last
  2347. set attack/decay will be used for all remaining channels.
  2348. @item points
  2349. A list of points for the transfer function, specified in dB relative to the
  2350. maximum possible signal amplitude. Each key points list must be defined using
  2351. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2352. @code{x0/y0 x1/y1 x2/y2 ....}
  2353. The input values must be in strictly increasing order but the transfer function
  2354. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2355. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2356. function are @code{-70/-70|-60/-20|1/0}.
  2357. @item soft-knee
  2358. Set the curve radius in dB for all joints. It defaults to 0.01.
  2359. @item gain
  2360. Set the additional gain in dB to be applied at all points on the transfer
  2361. function. This allows for easy adjustment of the overall gain.
  2362. It defaults to 0.
  2363. @item volume
  2364. Set an initial volume, in dB, to be assumed for each channel when filtering
  2365. starts. This permits the user to supply a nominal level initially, so that, for
  2366. example, a very large gain is not applied to initial signal levels before the
  2367. companding has begun to operate. A typical value for audio which is initially
  2368. quiet is -90 dB. It defaults to 0.
  2369. @item delay
  2370. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2371. delayed before being fed to the volume adjuster. Specifying a delay
  2372. approximately equal to the attack/decay times allows the filter to effectively
  2373. operate in predictive rather than reactive mode. It defaults to 0.
  2374. @end table
  2375. @subsection Examples
  2376. @itemize
  2377. @item
  2378. Make music with both quiet and loud passages suitable for listening to in a
  2379. noisy environment:
  2380. @example
  2381. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2382. @end example
  2383. Another example for audio with whisper and explosion parts:
  2384. @example
  2385. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2386. @end example
  2387. @item
  2388. A noise gate for when the noise is at a lower level than the signal:
  2389. @example
  2390. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2391. @end example
  2392. @item
  2393. Here is another noise gate, this time for when the noise is at a higher level
  2394. than the signal (making it, in some ways, similar to squelch):
  2395. @example
  2396. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2397. @end example
  2398. @item
  2399. 2:1 compression starting at -6dB:
  2400. @example
  2401. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2402. @end example
  2403. @item
  2404. 2:1 compression starting at -9dB:
  2405. @example
  2406. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2407. @end example
  2408. @item
  2409. 2:1 compression starting at -12dB:
  2410. @example
  2411. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2412. @end example
  2413. @item
  2414. 2:1 compression starting at -18dB:
  2415. @example
  2416. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2417. @end example
  2418. @item
  2419. 3:1 compression starting at -15dB:
  2420. @example
  2421. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2422. @end example
  2423. @item
  2424. Compressor/Gate:
  2425. @example
  2426. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2427. @end example
  2428. @item
  2429. Expander:
  2430. @example
  2431. 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
  2432. @end example
  2433. @item
  2434. Hard limiter at -6dB:
  2435. @example
  2436. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2437. @end example
  2438. @item
  2439. Hard limiter at -12dB:
  2440. @example
  2441. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2442. @end example
  2443. @item
  2444. Hard noise gate at -35 dB:
  2445. @example
  2446. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2447. @end example
  2448. @item
  2449. Soft limiter:
  2450. @example
  2451. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2452. @end example
  2453. @end itemize
  2454. @section compensationdelay
  2455. Compensation Delay Line is a metric based delay to compensate differing
  2456. positions of microphones or speakers.
  2457. For example, you have recorded guitar with two microphones placed in
  2458. different locations. Because the front of sound wave has fixed speed in
  2459. normal conditions, the phasing of microphones can vary and depends on
  2460. their location and interposition. The best sound mix can be achieved when
  2461. these microphones are in phase (synchronized). Note that a distance of
  2462. ~30 cm between microphones makes one microphone capture the signal in
  2463. antiphase to the other microphone. That makes the final mix sound moody.
  2464. This filter helps to solve phasing problems by adding different delays
  2465. to each microphone track and make them synchronized.
  2466. The best result can be reached when you take one track as base and
  2467. synchronize other tracks one by one with it.
  2468. Remember that synchronization/delay tolerance depends on sample rate, too.
  2469. Higher sample rates will give more tolerance.
  2470. The filter accepts the following parameters:
  2471. @table @option
  2472. @item mm
  2473. Set millimeters distance. This is compensation distance for fine tuning.
  2474. Default is 0.
  2475. @item cm
  2476. Set cm distance. This is compensation distance for tightening distance setup.
  2477. Default is 0.
  2478. @item m
  2479. Set meters distance. This is compensation distance for hard distance setup.
  2480. Default is 0.
  2481. @item dry
  2482. Set dry amount. Amount of unprocessed (dry) signal.
  2483. Default is 0.
  2484. @item wet
  2485. Set wet amount. Amount of processed (wet) signal.
  2486. Default is 1.
  2487. @item temp
  2488. Set temperature in degrees Celsius. This is the temperature of the environment.
  2489. Default is 20.
  2490. @end table
  2491. @section crossfeed
  2492. Apply headphone crossfeed filter.
  2493. Crossfeed is the process of blending the left and right channels of stereo
  2494. audio recording.
  2495. It is mainly used to reduce extreme stereo separation of low frequencies.
  2496. The intent is to produce more speaker like sound to the listener.
  2497. The filter accepts the following options:
  2498. @table @option
  2499. @item strength
  2500. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2501. This sets gain of low shelf filter for side part of stereo image.
  2502. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2503. @item range
  2504. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2505. This sets cut off frequency of low shelf filter. Default is cut off near
  2506. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2507. @item slope
  2508. Set curve slope of low shelf filter. Default is 0.5.
  2509. Allowed range is from 0.01 to 1.
  2510. @item level_in
  2511. Set input gain. Default is 0.9.
  2512. @item level_out
  2513. Set output gain. Default is 1.
  2514. @end table
  2515. @subsection Commands
  2516. This filter supports the all above options as @ref{commands}.
  2517. @section crystalizer
  2518. Simple algorithm to expand audio dynamic range.
  2519. The filter accepts the following options:
  2520. @table @option
  2521. @item i
  2522. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2523. (unchanged sound) to 10.0 (maximum effect).
  2524. @item c
  2525. Enable clipping. By default is enabled.
  2526. @end table
  2527. @subsection Commands
  2528. This filter supports the all above options as @ref{commands}.
  2529. @section dcshift
  2530. Apply a DC shift to the audio.
  2531. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2532. in the recording chain) from the audio. The effect of a DC offset is reduced
  2533. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2534. a signal has a DC offset.
  2535. @table @option
  2536. @item shift
  2537. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2538. the audio.
  2539. @item limitergain
  2540. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2541. used to prevent clipping.
  2542. @end table
  2543. @section deesser
  2544. Apply de-essing to the audio samples.
  2545. @table @option
  2546. @item i
  2547. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2548. Default is 0.
  2549. @item m
  2550. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2551. Default is 0.5.
  2552. @item f
  2553. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2554. Default is 0.5.
  2555. @item s
  2556. Set the output mode.
  2557. It accepts the following values:
  2558. @table @option
  2559. @item i
  2560. Pass input unchanged.
  2561. @item o
  2562. Pass ess filtered out.
  2563. @item e
  2564. Pass only ess.
  2565. Default value is @var{o}.
  2566. @end table
  2567. @end table
  2568. @section drmeter
  2569. Measure audio dynamic range.
  2570. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2571. is found in transition material. And anything less that 8 have very poor dynamics
  2572. and is very compressed.
  2573. The filter accepts the following options:
  2574. @table @option
  2575. @item length
  2576. Set window length in seconds used to split audio into segments of equal length.
  2577. Default is 3 seconds.
  2578. @end table
  2579. @section dynaudnorm
  2580. Dynamic Audio Normalizer.
  2581. This filter applies a certain amount of gain to the input audio in order
  2582. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2583. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2584. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2585. This allows for applying extra gain to the "quiet" sections of the audio
  2586. while avoiding distortions or clipping the "loud" sections. In other words:
  2587. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2588. sections, in the sense that the volume of each section is brought to the
  2589. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2590. this goal *without* applying "dynamic range compressing". It will retain 100%
  2591. of the dynamic range *within* each section of the audio file.
  2592. @table @option
  2593. @item framelen, f
  2594. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2595. Default is 500 milliseconds.
  2596. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2597. referred to as frames. This is required, because a peak magnitude has no
  2598. meaning for just a single sample value. Instead, we need to determine the
  2599. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2600. normalizer would simply use the peak magnitude of the complete file, the
  2601. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2602. frame. The length of a frame is specified in milliseconds. By default, the
  2603. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2604. been found to give good results with most files.
  2605. Note that the exact frame length, in number of samples, will be determined
  2606. automatically, based on the sampling rate of the individual input audio file.
  2607. @item gausssize, g
  2608. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2609. number. Default is 31.
  2610. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2611. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2612. is specified in frames, centered around the current frame. For the sake of
  2613. simplicity, this must be an odd number. Consequently, the default value of 31
  2614. takes into account the current frame, as well as the 15 preceding frames and
  2615. the 15 subsequent frames. Using a larger window results in a stronger
  2616. smoothing effect and thus in less gain variation, i.e. slower gain
  2617. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2618. effect and thus in more gain variation, i.e. faster gain adaptation.
  2619. In other words, the more you increase this value, the more the Dynamic Audio
  2620. Normalizer will behave like a "traditional" normalization filter. On the
  2621. contrary, the more you decrease this value, the more the Dynamic Audio
  2622. Normalizer will behave like a dynamic range compressor.
  2623. @item peak, p
  2624. Set the target peak value. This specifies the highest permissible magnitude
  2625. level for the normalized audio input. This filter will try to approach the
  2626. target peak magnitude as closely as possible, but at the same time it also
  2627. makes sure that the normalized signal will never exceed the peak magnitude.
  2628. A frame's maximum local gain factor is imposed directly by the target peak
  2629. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2630. It is not recommended to go above this value.
  2631. @item maxgain, m
  2632. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2633. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2634. factor for each input frame, i.e. the maximum gain factor that does not
  2635. result in clipping or distortion. The maximum gain factor is determined by
  2636. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2637. additionally bounds the frame's maximum gain factor by a predetermined
  2638. (global) maximum gain factor. This is done in order to avoid excessive gain
  2639. factors in "silent" or almost silent frames. By default, the maximum gain
  2640. factor is 10.0, For most inputs the default value should be sufficient and
  2641. it usually is not recommended to increase this value. Though, for input
  2642. with an extremely low overall volume level, it may be necessary to allow even
  2643. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2644. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2645. Instead, a "sigmoid" threshold function will be applied. This way, the
  2646. gain factors will smoothly approach the threshold value, but never exceed that
  2647. value.
  2648. @item targetrms, r
  2649. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2650. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2651. This means that the maximum local gain factor for each frame is defined
  2652. (only) by the frame's highest magnitude sample. This way, the samples can
  2653. be amplified as much as possible without exceeding the maximum signal
  2654. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2655. Normalizer can also take into account the frame's root mean square,
  2656. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2657. determine the power of a time-varying signal. It is therefore considered
  2658. that the RMS is a better approximation of the "perceived loudness" than
  2659. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2660. frames to a constant RMS value, a uniform "perceived loudness" can be
  2661. established. If a target RMS value has been specified, a frame's local gain
  2662. factor is defined as the factor that would result in exactly that RMS value.
  2663. Note, however, that the maximum local gain factor is still restricted by the
  2664. frame's highest magnitude sample, in order to prevent clipping.
  2665. @item coupling, n
  2666. Enable channels coupling. By default is enabled.
  2667. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2668. amount. This means the same gain factor will be applied to all channels, i.e.
  2669. the maximum possible gain factor is determined by the "loudest" channel.
  2670. However, in some recordings, it may happen that the volume of the different
  2671. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2672. In this case, this option can be used to disable the channel coupling. This way,
  2673. the gain factor will be determined independently for each channel, depending
  2674. only on the individual channel's highest magnitude sample. This allows for
  2675. harmonizing the volume of the different channels.
  2676. @item correctdc, c
  2677. Enable DC bias correction. By default is disabled.
  2678. An audio signal (in the time domain) is a sequence of sample values.
  2679. In the Dynamic Audio Normalizer these sample values are represented in the
  2680. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2681. audio signal, or "waveform", should be centered around the zero point.
  2682. That means if we calculate the mean value of all samples in a file, or in a
  2683. single frame, then the result should be 0.0 or at least very close to that
  2684. value. If, however, there is a significant deviation of the mean value from
  2685. 0.0, in either positive or negative direction, this is referred to as a
  2686. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2687. Audio Normalizer provides optional DC bias correction.
  2688. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2689. the mean value, or "DC correction" offset, of each input frame and subtract
  2690. that value from all of the frame's sample values which ensures those samples
  2691. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2692. boundaries, the DC correction offset values will be interpolated smoothly
  2693. between neighbouring frames.
  2694. @item altboundary, b
  2695. Enable alternative boundary mode. By default is disabled.
  2696. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2697. around each frame. This includes the preceding frames as well as the
  2698. subsequent frames. However, for the "boundary" frames, located at the very
  2699. beginning and at the very end of the audio file, not all neighbouring
  2700. frames are available. In particular, for the first few frames in the audio
  2701. file, the preceding frames are not known. And, similarly, for the last few
  2702. frames in the audio file, the subsequent frames are not known. Thus, the
  2703. question arises which gain factors should be assumed for the missing frames
  2704. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2705. to deal with this situation. The default boundary mode assumes a gain factor
  2706. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2707. "fade out" at the beginning and at the end of the input, respectively.
  2708. @item compress, s
  2709. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2710. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2711. compression. This means that signal peaks will not be pruned and thus the
  2712. full dynamic range will be retained within each local neighbourhood. However,
  2713. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2714. normalization algorithm with a more "traditional" compression.
  2715. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2716. (thresholding) function. If (and only if) the compression feature is enabled,
  2717. all input frames will be processed by a soft knee thresholding function prior
  2718. to the actual normalization process. Put simply, the thresholding function is
  2719. going to prune all samples whose magnitude exceeds a certain threshold value.
  2720. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2721. value. Instead, the threshold value will be adjusted for each individual
  2722. frame.
  2723. In general, smaller parameters result in stronger compression, and vice versa.
  2724. Values below 3.0 are not recommended, because audible distortion may appear.
  2725. @item threshold, t
  2726. Set the target threshold value. This specifies the lowest permissible
  2727. magnitude level for the audio input which will be normalized.
  2728. If input frame volume is above this value frame will be normalized.
  2729. Otherwise frame may not be normalized at all. The default value is set
  2730. to 0, which means all input frames will be normalized.
  2731. This option is mostly useful if digital noise is not wanted to be amplified.
  2732. @end table
  2733. @subsection Commands
  2734. This filter supports the all above options as @ref{commands}.
  2735. @section earwax
  2736. Make audio easier to listen to on headphones.
  2737. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2738. so that when listened to on headphones the stereo image is moved from
  2739. inside your head (standard for headphones) to outside and in front of
  2740. the listener (standard for speakers).
  2741. Ported from SoX.
  2742. @section equalizer
  2743. Apply a two-pole peaking equalisation (EQ) filter. With this
  2744. filter, the signal-level at and around a selected frequency can
  2745. be increased or decreased, whilst (unlike bandpass and bandreject
  2746. filters) that at all other frequencies is unchanged.
  2747. In order to produce complex equalisation curves, this filter can
  2748. be given several times, each with a different central frequency.
  2749. The filter accepts the following options:
  2750. @table @option
  2751. @item frequency, f
  2752. Set the filter's central frequency in Hz.
  2753. @item width_type, t
  2754. Set method to specify band-width of filter.
  2755. @table @option
  2756. @item h
  2757. Hz
  2758. @item q
  2759. Q-Factor
  2760. @item o
  2761. octave
  2762. @item s
  2763. slope
  2764. @item k
  2765. kHz
  2766. @end table
  2767. @item width, w
  2768. Specify the band-width of a filter in width_type units.
  2769. @item gain, g
  2770. Set the required gain or attenuation in dB.
  2771. Beware of clipping when using a positive gain.
  2772. @item mix, m
  2773. How much to use filtered signal in output. Default is 1.
  2774. Range is between 0 and 1.
  2775. @item channels, c
  2776. Specify which channels to filter, by default all available are filtered.
  2777. @item normalize, n
  2778. Normalize biquad coefficients, by default is disabled.
  2779. Enabling it will normalize magnitude response at DC to 0dB.
  2780. @end table
  2781. @subsection Examples
  2782. @itemize
  2783. @item
  2784. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2785. @example
  2786. equalizer=f=1000:t=h:width=200:g=-10
  2787. @end example
  2788. @item
  2789. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2790. @example
  2791. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2792. @end example
  2793. @end itemize
  2794. @subsection Commands
  2795. This filter supports the following commands:
  2796. @table @option
  2797. @item frequency, f
  2798. Change equalizer frequency.
  2799. Syntax for the command is : "@var{frequency}"
  2800. @item width_type, t
  2801. Change equalizer width_type.
  2802. Syntax for the command is : "@var{width_type}"
  2803. @item width, w
  2804. Change equalizer width.
  2805. Syntax for the command is : "@var{width}"
  2806. @item gain, g
  2807. Change equalizer gain.
  2808. Syntax for the command is : "@var{gain}"
  2809. @item mix, m
  2810. Change equalizer mix.
  2811. Syntax for the command is : "@var{mix}"
  2812. @end table
  2813. @section extrastereo
  2814. Linearly increases the difference between left and right channels which
  2815. adds some sort of "live" effect to playback.
  2816. The filter accepts the following options:
  2817. @table @option
  2818. @item m
  2819. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2820. (average of both channels), with 1.0 sound will be unchanged, with
  2821. -1.0 left and right channels will be swapped.
  2822. @item c
  2823. Enable clipping. By default is enabled.
  2824. @end table
  2825. @subsection Commands
  2826. This filter supports the all above options as @ref{commands}.
  2827. @section firequalizer
  2828. Apply FIR Equalization using arbitrary frequency response.
  2829. The filter accepts the following option:
  2830. @table @option
  2831. @item gain
  2832. Set gain curve equation (in dB). The expression can contain variables:
  2833. @table @option
  2834. @item f
  2835. the evaluated frequency
  2836. @item sr
  2837. sample rate
  2838. @item ch
  2839. channel number, set to 0 when multichannels evaluation is disabled
  2840. @item chid
  2841. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2842. multichannels evaluation is disabled
  2843. @item chs
  2844. number of channels
  2845. @item chlayout
  2846. channel_layout, see libavutil/channel_layout.h
  2847. @end table
  2848. and functions:
  2849. @table @option
  2850. @item gain_interpolate(f)
  2851. interpolate gain on frequency f based on gain_entry
  2852. @item cubic_interpolate(f)
  2853. same as gain_interpolate, but smoother
  2854. @end table
  2855. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2856. @item gain_entry
  2857. Set gain entry for gain_interpolate function. The expression can
  2858. contain functions:
  2859. @table @option
  2860. @item entry(f, g)
  2861. store gain entry at frequency f with value g
  2862. @end table
  2863. This option is also available as command.
  2864. @item delay
  2865. Set filter delay in seconds. Higher value means more accurate.
  2866. Default is @code{0.01}.
  2867. @item accuracy
  2868. Set filter accuracy in Hz. Lower value means more accurate.
  2869. Default is @code{5}.
  2870. @item wfunc
  2871. Set window function. Acceptable values are:
  2872. @table @option
  2873. @item rectangular
  2874. rectangular window, useful when gain curve is already smooth
  2875. @item hann
  2876. hann window (default)
  2877. @item hamming
  2878. hamming window
  2879. @item blackman
  2880. blackman window
  2881. @item nuttall3
  2882. 3-terms continuous 1st derivative nuttall window
  2883. @item mnuttall3
  2884. minimum 3-terms discontinuous nuttall window
  2885. @item nuttall
  2886. 4-terms continuous 1st derivative nuttall window
  2887. @item bnuttall
  2888. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2889. @item bharris
  2890. blackman-harris window
  2891. @item tukey
  2892. tukey window
  2893. @end table
  2894. @item fixed
  2895. If enabled, use fixed number of audio samples. This improves speed when
  2896. filtering with large delay. Default is disabled.
  2897. @item multi
  2898. Enable multichannels evaluation on gain. Default is disabled.
  2899. @item zero_phase
  2900. Enable zero phase mode by subtracting timestamp to compensate delay.
  2901. Default is disabled.
  2902. @item scale
  2903. Set scale used by gain. Acceptable values are:
  2904. @table @option
  2905. @item linlin
  2906. linear frequency, linear gain
  2907. @item linlog
  2908. linear frequency, logarithmic (in dB) gain (default)
  2909. @item loglin
  2910. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2911. @item loglog
  2912. logarithmic frequency, logarithmic gain
  2913. @end table
  2914. @item dumpfile
  2915. Set file for dumping, suitable for gnuplot.
  2916. @item dumpscale
  2917. Set scale for dumpfile. Acceptable values are same with scale option.
  2918. Default is linlog.
  2919. @item fft2
  2920. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2921. Default is disabled.
  2922. @item min_phase
  2923. Enable minimum phase impulse response. Default is disabled.
  2924. @end table
  2925. @subsection Examples
  2926. @itemize
  2927. @item
  2928. lowpass at 1000 Hz:
  2929. @example
  2930. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2931. @end example
  2932. @item
  2933. lowpass at 1000 Hz with gain_entry:
  2934. @example
  2935. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2936. @end example
  2937. @item
  2938. custom equalization:
  2939. @example
  2940. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2941. @end example
  2942. @item
  2943. higher delay with zero phase to compensate delay:
  2944. @example
  2945. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2946. @end example
  2947. @item
  2948. lowpass on left channel, highpass on right channel:
  2949. @example
  2950. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2951. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2952. @end example
  2953. @end itemize
  2954. @section flanger
  2955. Apply a flanging effect to the audio.
  2956. The filter accepts the following options:
  2957. @table @option
  2958. @item delay
  2959. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2960. @item depth
  2961. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2962. @item regen
  2963. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2964. Default value is 0.
  2965. @item width
  2966. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2967. Default value is 71.
  2968. @item speed
  2969. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2970. @item shape
  2971. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2972. Default value is @var{sinusoidal}.
  2973. @item phase
  2974. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2975. Default value is 25.
  2976. @item interp
  2977. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2978. Default is @var{linear}.
  2979. @end table
  2980. @section haas
  2981. Apply Haas effect to audio.
  2982. Note that this makes most sense to apply on mono signals.
  2983. With this filter applied to mono signals it give some directionality and
  2984. stretches its stereo image.
  2985. The filter accepts the following options:
  2986. @table @option
  2987. @item level_in
  2988. Set input level. By default is @var{1}, or 0dB
  2989. @item level_out
  2990. Set output level. By default is @var{1}, or 0dB.
  2991. @item side_gain
  2992. Set gain applied to side part of signal. By default is @var{1}.
  2993. @item middle_source
  2994. Set kind of middle source. Can be one of the following:
  2995. @table @samp
  2996. @item left
  2997. Pick left channel.
  2998. @item right
  2999. Pick right channel.
  3000. @item mid
  3001. Pick middle part signal of stereo image.
  3002. @item side
  3003. Pick side part signal of stereo image.
  3004. @end table
  3005. @item middle_phase
  3006. Change middle phase. By default is disabled.
  3007. @item left_delay
  3008. Set left channel delay. By default is @var{2.05} milliseconds.
  3009. @item left_balance
  3010. Set left channel balance. By default is @var{-1}.
  3011. @item left_gain
  3012. Set left channel gain. By default is @var{1}.
  3013. @item left_phase
  3014. Change left phase. By default is disabled.
  3015. @item right_delay
  3016. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3017. @item right_balance
  3018. Set right channel balance. By default is @var{1}.
  3019. @item right_gain
  3020. Set right channel gain. By default is @var{1}.
  3021. @item right_phase
  3022. Change right phase. By default is enabled.
  3023. @end table
  3024. @section hdcd
  3025. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3026. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3027. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3028. of HDCD, and detects the Transient Filter flag.
  3029. @example
  3030. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3031. @end example
  3032. When using the filter with wav, note the default encoding for wav is 16-bit,
  3033. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3034. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3035. @example
  3036. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3037. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3038. @end example
  3039. The filter accepts the following options:
  3040. @table @option
  3041. @item disable_autoconvert
  3042. Disable any automatic format conversion or resampling in the filter graph.
  3043. @item process_stereo
  3044. Process the stereo channels together. If target_gain does not match between
  3045. channels, consider it invalid and use the last valid target_gain.
  3046. @item cdt_ms
  3047. Set the code detect timer period in ms.
  3048. @item force_pe
  3049. Always extend peaks above -3dBFS even if PE isn't signaled.
  3050. @item analyze_mode
  3051. Replace audio with a solid tone and adjust the amplitude to signal some
  3052. specific aspect of the decoding process. The output file can be loaded in
  3053. an audio editor alongside the original to aid analysis.
  3054. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3055. Modes are:
  3056. @table @samp
  3057. @item 0, off
  3058. Disabled
  3059. @item 1, lle
  3060. Gain adjustment level at each sample
  3061. @item 2, pe
  3062. Samples where peak extend occurs
  3063. @item 3, cdt
  3064. Samples where the code detect timer is active
  3065. @item 4, tgm
  3066. Samples where the target gain does not match between channels
  3067. @end table
  3068. @end table
  3069. @section headphone
  3070. Apply head-related transfer functions (HRTFs) to create virtual
  3071. loudspeakers around the user for binaural listening via headphones.
  3072. The HRIRs are provided via additional streams, for each channel
  3073. one stereo input stream is needed.
  3074. The filter accepts the following options:
  3075. @table @option
  3076. @item map
  3077. Set mapping of input streams for convolution.
  3078. The argument is a '|'-separated list of channel names in order as they
  3079. are given as additional stream inputs for filter.
  3080. This also specify number of input streams. Number of input streams
  3081. must be not less than number of channels in first stream plus one.
  3082. @item gain
  3083. Set gain applied to audio. Value is in dB. Default is 0.
  3084. @item type
  3085. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3086. processing audio in time domain which is slow.
  3087. @var{freq} is processing audio in frequency domain which is fast.
  3088. Default is @var{freq}.
  3089. @item lfe
  3090. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3091. @item size
  3092. Set size of frame in number of samples which will be processed at once.
  3093. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3094. @item hrir
  3095. Set format of hrir stream.
  3096. Default value is @var{stereo}. Alternative value is @var{multich}.
  3097. If value is set to @var{stereo}, number of additional streams should
  3098. be greater or equal to number of input channels in first input stream.
  3099. Also each additional stream should have stereo number of channels.
  3100. If value is set to @var{multich}, number of additional streams should
  3101. be exactly one. Also number of input channels of additional stream
  3102. should be equal or greater than twice number of channels of first input
  3103. stream.
  3104. @end table
  3105. @subsection Examples
  3106. @itemize
  3107. @item
  3108. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3109. each amovie filter use stereo file with IR coefficients as input.
  3110. The files give coefficients for each position of virtual loudspeaker:
  3111. @example
  3112. ffmpeg -i input.wav
  3113. -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"
  3114. output.wav
  3115. @end example
  3116. @item
  3117. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3118. but now in @var{multich} @var{hrir} format.
  3119. @example
  3120. 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"
  3121. output.wav
  3122. @end example
  3123. @end itemize
  3124. @section highpass
  3125. Apply a high-pass filter with 3dB point frequency.
  3126. The filter can be either single-pole, or double-pole (the default).
  3127. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3128. The filter accepts the following options:
  3129. @table @option
  3130. @item frequency, f
  3131. Set frequency in Hz. Default is 3000.
  3132. @item poles, p
  3133. Set number of poles. Default is 2.
  3134. @item width_type, t
  3135. Set method to specify band-width of filter.
  3136. @table @option
  3137. @item h
  3138. Hz
  3139. @item q
  3140. Q-Factor
  3141. @item o
  3142. octave
  3143. @item s
  3144. slope
  3145. @item k
  3146. kHz
  3147. @end table
  3148. @item width, w
  3149. Specify the band-width of a filter in width_type units.
  3150. Applies only to double-pole filter.
  3151. The default is 0.707q and gives a Butterworth response.
  3152. @item mix, m
  3153. How much to use filtered signal in output. Default is 1.
  3154. Range is between 0 and 1.
  3155. @item channels, c
  3156. Specify which channels to filter, by default all available are filtered.
  3157. @item normalize, n
  3158. Normalize biquad coefficients, by default is disabled.
  3159. Enabling it will normalize magnitude response at DC to 0dB.
  3160. @end table
  3161. @subsection Commands
  3162. This filter supports the following commands:
  3163. @table @option
  3164. @item frequency, f
  3165. Change highpass frequency.
  3166. Syntax for the command is : "@var{frequency}"
  3167. @item width_type, t
  3168. Change highpass width_type.
  3169. Syntax for the command is : "@var{width_type}"
  3170. @item width, w
  3171. Change highpass width.
  3172. Syntax for the command is : "@var{width}"
  3173. @item mix, m
  3174. Change highpass mix.
  3175. Syntax for the command is : "@var{mix}"
  3176. @end table
  3177. @section join
  3178. Join multiple input streams into one multi-channel stream.
  3179. It accepts the following parameters:
  3180. @table @option
  3181. @item inputs
  3182. The number of input streams. It defaults to 2.
  3183. @item channel_layout
  3184. The desired output channel layout. It defaults to stereo.
  3185. @item map
  3186. Map channels from inputs to output. The argument is a '|'-separated list of
  3187. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3188. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3189. can be either the name of the input channel (e.g. FL for front left) or its
  3190. index in the specified input stream. @var{out_channel} is the name of the output
  3191. channel.
  3192. @end table
  3193. The filter will attempt to guess the mappings when they are not specified
  3194. explicitly. It does so by first trying to find an unused matching input channel
  3195. and if that fails it picks the first unused input channel.
  3196. Join 3 inputs (with properly set channel layouts):
  3197. @example
  3198. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3199. @end example
  3200. Build a 5.1 output from 6 single-channel streams:
  3201. @example
  3202. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3203. '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'
  3204. out
  3205. @end example
  3206. @section ladspa
  3207. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3208. To enable compilation of this filter you need to configure FFmpeg with
  3209. @code{--enable-ladspa}.
  3210. @table @option
  3211. @item file, f
  3212. Specifies the name of LADSPA plugin library to load. If the environment
  3213. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3214. each one of the directories specified by the colon separated list in
  3215. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3216. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3217. @file{/usr/lib/ladspa/}.
  3218. @item plugin, p
  3219. Specifies the plugin within the library. Some libraries contain only
  3220. one plugin, but others contain many of them. If this is not set filter
  3221. will list all available plugins within the specified library.
  3222. @item controls, c
  3223. Set the '|' separated list of controls which are zero or more floating point
  3224. values that determine the behavior of the loaded plugin (for example delay,
  3225. threshold or gain).
  3226. Controls need to be defined using the following syntax:
  3227. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3228. @var{valuei} is the value set on the @var{i}-th control.
  3229. Alternatively they can be also defined using the following syntax:
  3230. @var{value0}|@var{value1}|@var{value2}|..., where
  3231. @var{valuei} is the value set on the @var{i}-th control.
  3232. If @option{controls} is set to @code{help}, all available controls and
  3233. their valid ranges are printed.
  3234. @item sample_rate, s
  3235. Specify the sample rate, default to 44100. Only used if plugin have
  3236. zero inputs.
  3237. @item nb_samples, n
  3238. Set the number of samples per channel per each output frame, default
  3239. is 1024. Only used if plugin have zero inputs.
  3240. @item duration, d
  3241. Set the minimum duration of the sourced audio. See
  3242. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3243. for the accepted syntax.
  3244. Note that the resulting duration may be greater than the specified duration,
  3245. as the generated audio is always cut at the end of a complete frame.
  3246. If not specified, or the expressed duration is negative, the audio is
  3247. supposed to be generated forever.
  3248. Only used if plugin have zero inputs.
  3249. @end table
  3250. @subsection Examples
  3251. @itemize
  3252. @item
  3253. List all available plugins within amp (LADSPA example plugin) library:
  3254. @example
  3255. ladspa=file=amp
  3256. @end example
  3257. @item
  3258. List all available controls and their valid ranges for @code{vcf_notch}
  3259. plugin from @code{VCF} library:
  3260. @example
  3261. ladspa=f=vcf:p=vcf_notch:c=help
  3262. @end example
  3263. @item
  3264. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3265. plugin library:
  3266. @example
  3267. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3268. @end example
  3269. @item
  3270. Add reverberation to the audio using TAP-plugins
  3271. (Tom's Audio Processing plugins):
  3272. @example
  3273. ladspa=file=tap_reverb:tap_reverb
  3274. @end example
  3275. @item
  3276. Generate white noise, with 0.2 amplitude:
  3277. @example
  3278. ladspa=file=cmt:noise_source_white:c=c0=.2
  3279. @end example
  3280. @item
  3281. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3282. @code{C* Audio Plugin Suite} (CAPS) library:
  3283. @example
  3284. ladspa=file=caps:Click:c=c1=20'
  3285. @end example
  3286. @item
  3287. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3288. @example
  3289. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3290. @end example
  3291. @item
  3292. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3293. @code{SWH Plugins} collection:
  3294. @example
  3295. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3296. @end example
  3297. @item
  3298. Attenuate low frequencies using Multiband EQ from Steve Harris
  3299. @code{SWH Plugins} collection:
  3300. @example
  3301. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3302. @end example
  3303. @item
  3304. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3305. (CAPS) library:
  3306. @example
  3307. ladspa=caps:Narrower
  3308. @end example
  3309. @item
  3310. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3311. @example
  3312. ladspa=caps:White:.2
  3313. @end example
  3314. @item
  3315. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3316. @example
  3317. ladspa=caps:Fractal:c=c1=1
  3318. @end example
  3319. @item
  3320. Dynamic volume normalization using @code{VLevel} plugin:
  3321. @example
  3322. ladspa=vlevel-ladspa:vlevel_mono
  3323. @end example
  3324. @end itemize
  3325. @subsection Commands
  3326. This filter supports the following commands:
  3327. @table @option
  3328. @item cN
  3329. Modify the @var{N}-th control value.
  3330. If the specified value is not valid, it is ignored and prior one is kept.
  3331. @end table
  3332. @section loudnorm
  3333. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3334. Support for both single pass (livestreams, files) and double pass (files) modes.
  3335. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3336. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3337. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3338. The filter accepts the following options:
  3339. @table @option
  3340. @item I, i
  3341. Set integrated loudness target.
  3342. Range is -70.0 - -5.0. Default value is -24.0.
  3343. @item LRA, lra
  3344. Set loudness range target.
  3345. Range is 1.0 - 20.0. Default value is 7.0.
  3346. @item TP, tp
  3347. Set maximum true peak.
  3348. Range is -9.0 - +0.0. Default value is -2.0.
  3349. @item measured_I, measured_i
  3350. Measured IL of input file.
  3351. Range is -99.0 - +0.0.
  3352. @item measured_LRA, measured_lra
  3353. Measured LRA of input file.
  3354. Range is 0.0 - 99.0.
  3355. @item measured_TP, measured_tp
  3356. Measured true peak of input file.
  3357. Range is -99.0 - +99.0.
  3358. @item measured_thresh
  3359. Measured threshold of input file.
  3360. Range is -99.0 - +0.0.
  3361. @item offset
  3362. Set offset gain. Gain is applied before the true-peak limiter.
  3363. Range is -99.0 - +99.0. Default is +0.0.
  3364. @item linear
  3365. Normalize by linearly scaling the source audio.
  3366. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3367. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3368. be lower than source LRA and the change in integrated loudness shouldn't
  3369. result in a true peak which exceeds the target TP. If any of these
  3370. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3371. Options are @code{true} or @code{false}. Default is @code{true}.
  3372. @item dual_mono
  3373. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3374. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3375. If set to @code{true}, this option will compensate for this effect.
  3376. Multi-channel input files are not affected by this option.
  3377. Options are true or false. Default is false.
  3378. @item print_format
  3379. Set print format for stats. Options are summary, json, or none.
  3380. Default value is none.
  3381. @end table
  3382. @section lowpass
  3383. Apply a low-pass filter with 3dB point frequency.
  3384. The filter can be either single-pole or double-pole (the default).
  3385. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3386. The filter accepts the following options:
  3387. @table @option
  3388. @item frequency, f
  3389. Set frequency in Hz. Default is 500.
  3390. @item poles, p
  3391. Set number of poles. Default is 2.
  3392. @item width_type, t
  3393. Set method to specify band-width of filter.
  3394. @table @option
  3395. @item h
  3396. Hz
  3397. @item q
  3398. Q-Factor
  3399. @item o
  3400. octave
  3401. @item s
  3402. slope
  3403. @item k
  3404. kHz
  3405. @end table
  3406. @item width, w
  3407. Specify the band-width of a filter in width_type units.
  3408. Applies only to double-pole filter.
  3409. The default is 0.707q and gives a Butterworth response.
  3410. @item mix, m
  3411. How much to use filtered signal in output. Default is 1.
  3412. Range is between 0 and 1.
  3413. @item channels, c
  3414. Specify which channels to filter, by default all available are filtered.
  3415. @item normalize, n
  3416. Normalize biquad coefficients, by default is disabled.
  3417. Enabling it will normalize magnitude response at DC to 0dB.
  3418. @end table
  3419. @subsection Examples
  3420. @itemize
  3421. @item
  3422. Lowpass only LFE channel, it LFE is not present it does nothing:
  3423. @example
  3424. lowpass=c=LFE
  3425. @end example
  3426. @end itemize
  3427. @subsection Commands
  3428. This filter supports the following commands:
  3429. @table @option
  3430. @item frequency, f
  3431. Change lowpass frequency.
  3432. Syntax for the command is : "@var{frequency}"
  3433. @item width_type, t
  3434. Change lowpass width_type.
  3435. Syntax for the command is : "@var{width_type}"
  3436. @item width, w
  3437. Change lowpass width.
  3438. Syntax for the command is : "@var{width}"
  3439. @item mix, m
  3440. Change lowpass mix.
  3441. Syntax for the command is : "@var{mix}"
  3442. @end table
  3443. @section lv2
  3444. Load a LV2 (LADSPA Version 2) plugin.
  3445. To enable compilation of this filter you need to configure FFmpeg with
  3446. @code{--enable-lv2}.
  3447. @table @option
  3448. @item plugin, p
  3449. Specifies the plugin URI. You may need to escape ':'.
  3450. @item controls, c
  3451. Set the '|' separated list of controls which are zero or more floating point
  3452. values that determine the behavior of the loaded plugin (for example delay,
  3453. threshold or gain).
  3454. If @option{controls} is set to @code{help}, all available controls and
  3455. their valid ranges are printed.
  3456. @item sample_rate, s
  3457. Specify the sample rate, default to 44100. Only used if plugin have
  3458. zero inputs.
  3459. @item nb_samples, n
  3460. Set the number of samples per channel per each output frame, default
  3461. is 1024. Only used if plugin have zero inputs.
  3462. @item duration, d
  3463. Set the minimum duration of the sourced audio. See
  3464. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3465. for the accepted syntax.
  3466. Note that the resulting duration may be greater than the specified duration,
  3467. as the generated audio is always cut at the end of a complete frame.
  3468. If not specified, or the expressed duration is negative, the audio is
  3469. supposed to be generated forever.
  3470. Only used if plugin have zero inputs.
  3471. @end table
  3472. @subsection Examples
  3473. @itemize
  3474. @item
  3475. Apply bass enhancer plugin from Calf:
  3476. @example
  3477. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3478. @end example
  3479. @item
  3480. Apply vinyl plugin from Calf:
  3481. @example
  3482. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3483. @end example
  3484. @item
  3485. Apply bit crusher plugin from ArtyFX:
  3486. @example
  3487. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3488. @end example
  3489. @end itemize
  3490. @section mcompand
  3491. Multiband Compress or expand the audio's dynamic range.
  3492. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3493. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3494. response when absent compander action.
  3495. It accepts the following parameters:
  3496. @table @option
  3497. @item args
  3498. This option syntax is:
  3499. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3500. For explanation of each item refer to compand filter documentation.
  3501. @end table
  3502. @anchor{pan}
  3503. @section pan
  3504. Mix channels with specific gain levels. The filter accepts the output
  3505. channel layout followed by a set of channels definitions.
  3506. This filter is also designed to efficiently remap the channels of an audio
  3507. stream.
  3508. The filter accepts parameters of the form:
  3509. "@var{l}|@var{outdef}|@var{outdef}|..."
  3510. @table @option
  3511. @item l
  3512. output channel layout or number of channels
  3513. @item outdef
  3514. output channel specification, of the form:
  3515. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3516. @item out_name
  3517. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3518. number (c0, c1, etc.)
  3519. @item gain
  3520. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3521. @item in_name
  3522. input channel to use, see out_name for details; it is not possible to mix
  3523. named and numbered input channels
  3524. @end table
  3525. If the `=' in a channel specification is replaced by `<', then the gains for
  3526. that specification will be renormalized so that the total is 1, thus
  3527. avoiding clipping noise.
  3528. @subsection Mixing examples
  3529. For example, if you want to down-mix from stereo to mono, but with a bigger
  3530. factor for the left channel:
  3531. @example
  3532. pan=1c|c0=0.9*c0+0.1*c1
  3533. @end example
  3534. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3535. 7-channels surround:
  3536. @example
  3537. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3538. @end example
  3539. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3540. that should be preferred (see "-ac" option) unless you have very specific
  3541. needs.
  3542. @subsection Remapping examples
  3543. The channel remapping will be effective if, and only if:
  3544. @itemize
  3545. @item gain coefficients are zeroes or ones,
  3546. @item only one input per channel output,
  3547. @end itemize
  3548. If all these conditions are satisfied, the filter will notify the user ("Pure
  3549. channel mapping detected"), and use an optimized and lossless method to do the
  3550. remapping.
  3551. For example, if you have a 5.1 source and want a stereo audio stream by
  3552. dropping the extra channels:
  3553. @example
  3554. pan="stereo| c0=FL | c1=FR"
  3555. @end example
  3556. Given the same source, you can also switch front left and front right channels
  3557. and keep the input channel layout:
  3558. @example
  3559. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3560. @end example
  3561. If the input is a stereo audio stream, you can mute the front left channel (and
  3562. still keep the stereo channel layout) with:
  3563. @example
  3564. pan="stereo|c1=c1"
  3565. @end example
  3566. Still with a stereo audio stream input, you can copy the right channel in both
  3567. front left and right:
  3568. @example
  3569. pan="stereo| c0=FR | c1=FR"
  3570. @end example
  3571. @section replaygain
  3572. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3573. outputs it unchanged.
  3574. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3575. @section resample
  3576. Convert the audio sample format, sample rate and channel layout. It is
  3577. not meant to be used directly.
  3578. @section rubberband
  3579. Apply time-stretching and pitch-shifting with librubberband.
  3580. To enable compilation of this filter, you need to configure FFmpeg with
  3581. @code{--enable-librubberband}.
  3582. The filter accepts the following options:
  3583. @table @option
  3584. @item tempo
  3585. Set tempo scale factor.
  3586. @item pitch
  3587. Set pitch scale factor.
  3588. @item transients
  3589. Set transients detector.
  3590. Possible values are:
  3591. @table @var
  3592. @item crisp
  3593. @item mixed
  3594. @item smooth
  3595. @end table
  3596. @item detector
  3597. Set detector.
  3598. Possible values are:
  3599. @table @var
  3600. @item compound
  3601. @item percussive
  3602. @item soft
  3603. @end table
  3604. @item phase
  3605. Set phase.
  3606. Possible values are:
  3607. @table @var
  3608. @item laminar
  3609. @item independent
  3610. @end table
  3611. @item window
  3612. Set processing window size.
  3613. Possible values are:
  3614. @table @var
  3615. @item standard
  3616. @item short
  3617. @item long
  3618. @end table
  3619. @item smoothing
  3620. Set smoothing.
  3621. Possible values are:
  3622. @table @var
  3623. @item off
  3624. @item on
  3625. @end table
  3626. @item formant
  3627. Enable formant preservation when shift pitching.
  3628. Possible values are:
  3629. @table @var
  3630. @item shifted
  3631. @item preserved
  3632. @end table
  3633. @item pitchq
  3634. Set pitch quality.
  3635. Possible values are:
  3636. @table @var
  3637. @item quality
  3638. @item speed
  3639. @item consistency
  3640. @end table
  3641. @item channels
  3642. Set channels.
  3643. Possible values are:
  3644. @table @var
  3645. @item apart
  3646. @item together
  3647. @end table
  3648. @end table
  3649. @subsection Commands
  3650. This filter supports the following commands:
  3651. @table @option
  3652. @item tempo
  3653. Change filter tempo scale factor.
  3654. Syntax for the command is : "@var{tempo}"
  3655. @item pitch
  3656. Change filter pitch scale factor.
  3657. Syntax for the command is : "@var{pitch}"
  3658. @end table
  3659. @section sidechaincompress
  3660. This filter acts like normal compressor but has the ability to compress
  3661. detected signal using second input signal.
  3662. It needs two input streams and returns one output stream.
  3663. First input stream will be processed depending on second stream signal.
  3664. The filtered signal then can be filtered with other filters in later stages of
  3665. processing. See @ref{pan} and @ref{amerge} filter.
  3666. The filter accepts the following options:
  3667. @table @option
  3668. @item level_in
  3669. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3670. @item mode
  3671. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3672. Default is @code{downward}.
  3673. @item threshold
  3674. If a signal of second stream raises above this level it will affect the gain
  3675. reduction of first stream.
  3676. By default is 0.125. Range is between 0.00097563 and 1.
  3677. @item ratio
  3678. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3679. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3680. Default is 2. Range is between 1 and 20.
  3681. @item attack
  3682. Amount of milliseconds the signal has to rise above the threshold before gain
  3683. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3684. @item release
  3685. Amount of milliseconds the signal has to fall below the threshold before
  3686. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3687. @item makeup
  3688. Set the amount by how much signal will be amplified after processing.
  3689. Default is 1. Range is from 1 to 64.
  3690. @item knee
  3691. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3692. Default is 2.82843. Range is between 1 and 8.
  3693. @item link
  3694. Choose if the @code{average} level between all channels of side-chain stream
  3695. or the louder(@code{maximum}) channel of side-chain stream affects the
  3696. reduction. Default is @code{average}.
  3697. @item detection
  3698. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3699. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3700. @item level_sc
  3701. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3702. @item mix
  3703. How much to use compressed signal in output. Default is 1.
  3704. Range is between 0 and 1.
  3705. @end table
  3706. @subsection Commands
  3707. This filter supports the all above options as @ref{commands}.
  3708. @subsection Examples
  3709. @itemize
  3710. @item
  3711. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3712. depending on the signal of 2nd input and later compressed signal to be
  3713. merged with 2nd input:
  3714. @example
  3715. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3716. @end example
  3717. @end itemize
  3718. @section sidechaingate
  3719. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3720. filter the detected signal before sending it to the gain reduction stage.
  3721. Normally a gate uses the full range signal to detect a level above the
  3722. threshold.
  3723. For example: If you cut all lower frequencies from your sidechain signal
  3724. the gate will decrease the volume of your track only if not enough highs
  3725. appear. With this technique you are able to reduce the resonation of a
  3726. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3727. guitar.
  3728. It needs two input streams and returns one output stream.
  3729. First input stream will be processed depending on second stream signal.
  3730. The filter accepts the following options:
  3731. @table @option
  3732. @item level_in
  3733. Set input level before filtering.
  3734. Default is 1. Allowed range is from 0.015625 to 64.
  3735. @item mode
  3736. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3737. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3738. will be amplified, expanding dynamic range in upward direction.
  3739. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3740. @item range
  3741. Set the level of gain reduction when the signal is below the threshold.
  3742. Default is 0.06125. Allowed range is from 0 to 1.
  3743. Setting this to 0 disables reduction and then filter behaves like expander.
  3744. @item threshold
  3745. If a signal rises above this level the gain reduction is released.
  3746. Default is 0.125. Allowed range is from 0 to 1.
  3747. @item ratio
  3748. Set a ratio about which the signal is reduced.
  3749. Default is 2. Allowed range is from 1 to 9000.
  3750. @item attack
  3751. Amount of milliseconds the signal has to rise above the threshold before gain
  3752. reduction stops.
  3753. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3754. @item release
  3755. Amount of milliseconds the signal has to fall below the threshold before the
  3756. reduction is increased again. Default is 250 milliseconds.
  3757. Allowed range is from 0.01 to 9000.
  3758. @item makeup
  3759. Set amount of amplification of signal after processing.
  3760. Default is 1. Allowed range is from 1 to 64.
  3761. @item knee
  3762. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3763. Default is 2.828427125. Allowed range is from 1 to 8.
  3764. @item detection
  3765. Choose if exact signal should be taken for detection or an RMS like one.
  3766. Default is rms. Can be peak or rms.
  3767. @item link
  3768. Choose if the average level between all channels or the louder channel affects
  3769. the reduction.
  3770. Default is average. Can be average or maximum.
  3771. @item level_sc
  3772. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3773. @end table
  3774. @section silencedetect
  3775. Detect silence in an audio stream.
  3776. This filter logs a message when it detects that the input audio volume is less
  3777. or equal to a noise tolerance value for a duration greater or equal to the
  3778. minimum detected noise duration.
  3779. The printed times and duration are expressed in seconds. The
  3780. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3781. is set on the first frame whose timestamp equals or exceeds the detection
  3782. duration and it contains the timestamp of the first frame of the silence.
  3783. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3784. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3785. keys are set on the first frame after the silence. If @option{mono} is
  3786. enabled, and each channel is evaluated separately, the @code{.X}
  3787. suffixed keys are used, and @code{X} corresponds to the channel number.
  3788. The filter accepts the following options:
  3789. @table @option
  3790. @item noise, n
  3791. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3792. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3793. @item duration, d
  3794. Set silence duration until notification (default is 2 seconds). See
  3795. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3796. for the accepted syntax.
  3797. @item mono, m
  3798. Process each channel separately, instead of combined. By default is disabled.
  3799. @end table
  3800. @subsection Examples
  3801. @itemize
  3802. @item
  3803. Detect 5 seconds of silence with -50dB noise tolerance:
  3804. @example
  3805. silencedetect=n=-50dB:d=5
  3806. @end example
  3807. @item
  3808. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3809. tolerance in @file{silence.mp3}:
  3810. @example
  3811. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3812. @end example
  3813. @end itemize
  3814. @section silenceremove
  3815. Remove silence from the beginning, middle or end of the audio.
  3816. The filter accepts the following options:
  3817. @table @option
  3818. @item start_periods
  3819. This value is used to indicate if audio should be trimmed at beginning of
  3820. the audio. A value of zero indicates no silence should be trimmed from the
  3821. beginning. When specifying a non-zero value, it trims audio up until it
  3822. finds non-silence. Normally, when trimming silence from beginning of audio
  3823. the @var{start_periods} will be @code{1} but it can be increased to higher
  3824. values to trim all audio up to specific count of non-silence periods.
  3825. Default value is @code{0}.
  3826. @item start_duration
  3827. Specify the amount of time that non-silence must be detected before it stops
  3828. trimming audio. By increasing the duration, bursts of noises can be treated
  3829. as silence and trimmed off. Default value is @code{0}.
  3830. @item start_threshold
  3831. This indicates what sample value should be treated as silence. For digital
  3832. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3833. you may wish to increase the value to account for background noise.
  3834. Can be specified in dB (in case "dB" is appended to the specified value)
  3835. or amplitude ratio. Default value is @code{0}.
  3836. @item start_silence
  3837. Specify max duration of silence at beginning that will be kept after
  3838. trimming. Default is 0, which is equal to trimming all samples detected
  3839. as silence.
  3840. @item start_mode
  3841. Specify mode of detection of silence end in start of multi-channel audio.
  3842. Can be @var{any} or @var{all}. Default is @var{any}.
  3843. With @var{any}, any sample that is detected as non-silence will cause
  3844. stopped trimming of silence.
  3845. With @var{all}, only if all channels are detected as non-silence will cause
  3846. stopped trimming of silence.
  3847. @item stop_periods
  3848. Set the count for trimming silence from the end of audio.
  3849. To remove silence from the middle of a file, specify a @var{stop_periods}
  3850. that is negative. This value is then treated as a positive value and is
  3851. used to indicate the effect should restart processing as specified by
  3852. @var{start_periods}, making it suitable for removing periods of silence
  3853. in the middle of the audio.
  3854. Default value is @code{0}.
  3855. @item stop_duration
  3856. Specify a duration of silence that must exist before audio is not copied any
  3857. more. By specifying a higher duration, silence that is wanted can be left in
  3858. the audio.
  3859. Default value is @code{0}.
  3860. @item stop_threshold
  3861. This is the same as @option{start_threshold} but for trimming silence from
  3862. the end of audio.
  3863. Can be specified in dB (in case "dB" is appended to the specified value)
  3864. or amplitude ratio. Default value is @code{0}.
  3865. @item stop_silence
  3866. Specify max duration of silence at end that will be kept after
  3867. trimming. Default is 0, which is equal to trimming all samples detected
  3868. as silence.
  3869. @item stop_mode
  3870. Specify mode of detection of silence start in end of multi-channel audio.
  3871. Can be @var{any} or @var{all}. Default is @var{any}.
  3872. With @var{any}, any sample that is detected as non-silence will cause
  3873. stopped trimming of silence.
  3874. With @var{all}, only if all channels are detected as non-silence will cause
  3875. stopped trimming of silence.
  3876. @item detection
  3877. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3878. and works better with digital silence which is exactly 0.
  3879. Default value is @code{rms}.
  3880. @item window
  3881. Set duration in number of seconds used to calculate size of window in number
  3882. of samples for detecting silence.
  3883. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3884. @end table
  3885. @subsection Examples
  3886. @itemize
  3887. @item
  3888. The following example shows how this filter can be used to start a recording
  3889. that does not contain the delay at the start which usually occurs between
  3890. pressing the record button and the start of the performance:
  3891. @example
  3892. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3893. @end example
  3894. @item
  3895. Trim all silence encountered from beginning to end where there is more than 1
  3896. second of silence in audio:
  3897. @example
  3898. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3899. @end example
  3900. @item
  3901. Trim all digital silence samples, using peak detection, from beginning to end
  3902. where there is more than 0 samples of digital silence in audio and digital
  3903. silence is detected in all channels at same positions in stream:
  3904. @example
  3905. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3906. @end example
  3907. @end itemize
  3908. @section sofalizer
  3909. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3910. loudspeakers around the user for binaural listening via headphones (audio
  3911. formats up to 9 channels supported).
  3912. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3913. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3914. Austrian Academy of Sciences.
  3915. To enable compilation of this filter you need to configure FFmpeg with
  3916. @code{--enable-libmysofa}.
  3917. The filter accepts the following options:
  3918. @table @option
  3919. @item sofa
  3920. Set the SOFA file used for rendering.
  3921. @item gain
  3922. Set gain applied to audio. Value is in dB. Default is 0.
  3923. @item rotation
  3924. Set rotation of virtual loudspeakers in deg. Default is 0.
  3925. @item elevation
  3926. Set elevation of virtual speakers in deg. Default is 0.
  3927. @item radius
  3928. Set distance in meters between loudspeakers and the listener with near-field
  3929. HRTFs. Default is 1.
  3930. @item type
  3931. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3932. processing audio in time domain which is slow.
  3933. @var{freq} is processing audio in frequency domain which is fast.
  3934. Default is @var{freq}.
  3935. @item speakers
  3936. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3937. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3938. Each virtual loudspeaker is described with short channel name following with
  3939. azimuth and elevation in degrees.
  3940. Each virtual loudspeaker description is separated by '|'.
  3941. For example to override front left and front right channel positions use:
  3942. 'speakers=FL 45 15|FR 345 15'.
  3943. Descriptions with unrecognised channel names are ignored.
  3944. @item lfegain
  3945. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3946. @item framesize
  3947. Set custom frame size in number of samples. Default is 1024.
  3948. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3949. is set to @var{freq}.
  3950. @item normalize
  3951. Should all IRs be normalized upon importing SOFA file.
  3952. By default is enabled.
  3953. @item interpolate
  3954. Should nearest IRs be interpolated with neighbor IRs if exact position
  3955. does not match. By default is disabled.
  3956. @item minphase
  3957. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3958. @item anglestep
  3959. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3960. @item radstep
  3961. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3962. @end table
  3963. @subsection Examples
  3964. @itemize
  3965. @item
  3966. Using ClubFritz6 sofa file:
  3967. @example
  3968. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3969. @end example
  3970. @item
  3971. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3972. @example
  3973. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3974. @end example
  3975. @item
  3976. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3977. and also with custom gain:
  3978. @example
  3979. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3980. @end example
  3981. @end itemize
  3982. @section stereotools
  3983. This filter has some handy utilities to manage stereo signals, for converting
  3984. M/S stereo recordings to L/R signal while having control over the parameters
  3985. or spreading the stereo image of master track.
  3986. The filter accepts the following options:
  3987. @table @option
  3988. @item level_in
  3989. Set input level before filtering for both channels. Defaults is 1.
  3990. Allowed range is from 0.015625 to 64.
  3991. @item level_out
  3992. Set output level after filtering for both channels. Defaults is 1.
  3993. Allowed range is from 0.015625 to 64.
  3994. @item balance_in
  3995. Set input balance between both channels. Default is 0.
  3996. Allowed range is from -1 to 1.
  3997. @item balance_out
  3998. Set output balance between both channels. Default is 0.
  3999. Allowed range is from -1 to 1.
  4000. @item softclip
  4001. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4002. clipping. Disabled by default.
  4003. @item mutel
  4004. Mute the left channel. Disabled by default.
  4005. @item muter
  4006. Mute the right channel. Disabled by default.
  4007. @item phasel
  4008. Change the phase of the left channel. Disabled by default.
  4009. @item phaser
  4010. Change the phase of the right channel. Disabled by default.
  4011. @item mode
  4012. Set stereo mode. Available values are:
  4013. @table @samp
  4014. @item lr>lr
  4015. Left/Right to Left/Right, this is default.
  4016. @item lr>ms
  4017. Left/Right to Mid/Side.
  4018. @item ms>lr
  4019. Mid/Side to Left/Right.
  4020. @item lr>ll
  4021. Left/Right to Left/Left.
  4022. @item lr>rr
  4023. Left/Right to Right/Right.
  4024. @item lr>l+r
  4025. Left/Right to Left + Right.
  4026. @item lr>rl
  4027. Left/Right to Right/Left.
  4028. @item ms>ll
  4029. Mid/Side to Left/Left.
  4030. @item ms>rr
  4031. Mid/Side to Right/Right.
  4032. @end table
  4033. @item slev
  4034. Set level of side signal. Default is 1.
  4035. Allowed range is from 0.015625 to 64.
  4036. @item sbal
  4037. Set balance of side signal. Default is 0.
  4038. Allowed range is from -1 to 1.
  4039. @item mlev
  4040. Set level of the middle signal. Default is 1.
  4041. Allowed range is from 0.015625 to 64.
  4042. @item mpan
  4043. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4044. @item base
  4045. Set stereo base between mono and inversed channels. Default is 0.
  4046. Allowed range is from -1 to 1.
  4047. @item delay
  4048. Set delay in milliseconds how much to delay left from right channel and
  4049. vice versa. Default is 0. Allowed range is from -20 to 20.
  4050. @item sclevel
  4051. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4052. @item phase
  4053. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4054. @item bmode_in, bmode_out
  4055. Set balance mode for balance_in/balance_out option.
  4056. Can be one of the following:
  4057. @table @samp
  4058. @item balance
  4059. Classic balance mode. Attenuate one channel at time.
  4060. Gain is raised up to 1.
  4061. @item amplitude
  4062. Similar as classic mode above but gain is raised up to 2.
  4063. @item power
  4064. Equal power distribution, from -6dB to +6dB range.
  4065. @end table
  4066. @end table
  4067. @subsection Examples
  4068. @itemize
  4069. @item
  4070. Apply karaoke like effect:
  4071. @example
  4072. stereotools=mlev=0.015625
  4073. @end example
  4074. @item
  4075. Convert M/S signal to L/R:
  4076. @example
  4077. "stereotools=mode=ms>lr"
  4078. @end example
  4079. @end itemize
  4080. @section stereowiden
  4081. This filter enhance the stereo effect by suppressing signal common to both
  4082. channels and by delaying the signal of left into right and vice versa,
  4083. thereby widening the stereo effect.
  4084. The filter accepts the following options:
  4085. @table @option
  4086. @item delay
  4087. Time in milliseconds of the delay of left signal into right and vice versa.
  4088. Default is 20 milliseconds.
  4089. @item feedback
  4090. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4091. effect of left signal in right output and vice versa which gives widening
  4092. effect. Default is 0.3.
  4093. @item crossfeed
  4094. Cross feed of left into right with inverted phase. This helps in suppressing
  4095. the mono. If the value is 1 it will cancel all the signal common to both
  4096. channels. Default is 0.3.
  4097. @item drymix
  4098. Set level of input signal of original channel. Default is 0.8.
  4099. @end table
  4100. @subsection Commands
  4101. This filter supports the all above options except @code{delay} as @ref{commands}.
  4102. @section superequalizer
  4103. Apply 18 band equalizer.
  4104. The filter accepts the following options:
  4105. @table @option
  4106. @item 1b
  4107. Set 65Hz band gain.
  4108. @item 2b
  4109. Set 92Hz band gain.
  4110. @item 3b
  4111. Set 131Hz band gain.
  4112. @item 4b
  4113. Set 185Hz band gain.
  4114. @item 5b
  4115. Set 262Hz band gain.
  4116. @item 6b
  4117. Set 370Hz band gain.
  4118. @item 7b
  4119. Set 523Hz band gain.
  4120. @item 8b
  4121. Set 740Hz band gain.
  4122. @item 9b
  4123. Set 1047Hz band gain.
  4124. @item 10b
  4125. Set 1480Hz band gain.
  4126. @item 11b
  4127. Set 2093Hz band gain.
  4128. @item 12b
  4129. Set 2960Hz band gain.
  4130. @item 13b
  4131. Set 4186Hz band gain.
  4132. @item 14b
  4133. Set 5920Hz band gain.
  4134. @item 15b
  4135. Set 8372Hz band gain.
  4136. @item 16b
  4137. Set 11840Hz band gain.
  4138. @item 17b
  4139. Set 16744Hz band gain.
  4140. @item 18b
  4141. Set 20000Hz band gain.
  4142. @end table
  4143. @section surround
  4144. Apply audio surround upmix filter.
  4145. This filter allows to produce multichannel output from audio stream.
  4146. The filter accepts the following options:
  4147. @table @option
  4148. @item chl_out
  4149. Set output channel layout. By default, this is @var{5.1}.
  4150. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4151. for the required syntax.
  4152. @item chl_in
  4153. Set input channel layout. By default, this is @var{stereo}.
  4154. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4155. for the required syntax.
  4156. @item level_in
  4157. Set input volume level. By default, this is @var{1}.
  4158. @item level_out
  4159. Set output volume level. By default, this is @var{1}.
  4160. @item lfe
  4161. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4162. @item lfe_low
  4163. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4164. @item lfe_high
  4165. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4166. @item lfe_mode
  4167. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4168. In @var{add} mode, LFE channel is created from input audio and added to output.
  4169. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4170. also all non-LFE output channels are subtracted with output LFE channel.
  4171. @item angle
  4172. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4173. Default is @var{90}.
  4174. @item fc_in
  4175. Set front center input volume. By default, this is @var{1}.
  4176. @item fc_out
  4177. Set front center output volume. By default, this is @var{1}.
  4178. @item fl_in
  4179. Set front left input volume. By default, this is @var{1}.
  4180. @item fl_out
  4181. Set front left output volume. By default, this is @var{1}.
  4182. @item fr_in
  4183. Set front right input volume. By default, this is @var{1}.
  4184. @item fr_out
  4185. Set front right output volume. By default, this is @var{1}.
  4186. @item sl_in
  4187. Set side left input volume. By default, this is @var{1}.
  4188. @item sl_out
  4189. Set side left output volume. By default, this is @var{1}.
  4190. @item sr_in
  4191. Set side right input volume. By default, this is @var{1}.
  4192. @item sr_out
  4193. Set side right output volume. By default, this is @var{1}.
  4194. @item bl_in
  4195. Set back left input volume. By default, this is @var{1}.
  4196. @item bl_out
  4197. Set back left output volume. By default, this is @var{1}.
  4198. @item br_in
  4199. Set back right input volume. By default, this is @var{1}.
  4200. @item br_out
  4201. Set back right output volume. By default, this is @var{1}.
  4202. @item bc_in
  4203. Set back center input volume. By default, this is @var{1}.
  4204. @item bc_out
  4205. Set back center output volume. By default, this is @var{1}.
  4206. @item lfe_in
  4207. Set LFE input volume. By default, this is @var{1}.
  4208. @item lfe_out
  4209. Set LFE output volume. By default, this is @var{1}.
  4210. @item allx
  4211. Set spread usage of stereo image across X axis for all channels.
  4212. @item ally
  4213. Set spread usage of stereo image across Y axis for all channels.
  4214. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4215. Set spread usage of stereo image across X axis for each channel.
  4216. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4217. Set spread usage of stereo image across Y axis for each channel.
  4218. @item win_size
  4219. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4220. @item win_func
  4221. Set window function.
  4222. It accepts the following values:
  4223. @table @samp
  4224. @item rect
  4225. @item bartlett
  4226. @item hann, hanning
  4227. @item hamming
  4228. @item blackman
  4229. @item welch
  4230. @item flattop
  4231. @item bharris
  4232. @item bnuttall
  4233. @item bhann
  4234. @item sine
  4235. @item nuttall
  4236. @item lanczos
  4237. @item gauss
  4238. @item tukey
  4239. @item dolph
  4240. @item cauchy
  4241. @item parzen
  4242. @item poisson
  4243. @item bohman
  4244. @end table
  4245. Default is @code{hann}.
  4246. @item overlap
  4247. Set window overlap. If set to 1, the recommended overlap for selected
  4248. window function will be picked. Default is @code{0.5}.
  4249. @end table
  4250. @section treble, highshelf
  4251. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4252. shelving filter with a response similar to that of a standard
  4253. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4254. The filter accepts the following options:
  4255. @table @option
  4256. @item gain, g
  4257. Give the gain at whichever is the lower of ~22 kHz and the
  4258. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4259. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4260. @item frequency, f
  4261. Set the filter's central frequency and so can be used
  4262. to extend or reduce the frequency range to be boosted or cut.
  4263. The default value is @code{3000} Hz.
  4264. @item width_type, t
  4265. Set method to specify band-width of filter.
  4266. @table @option
  4267. @item h
  4268. Hz
  4269. @item q
  4270. Q-Factor
  4271. @item o
  4272. octave
  4273. @item s
  4274. slope
  4275. @item k
  4276. kHz
  4277. @end table
  4278. @item width, w
  4279. Determine how steep is the filter's shelf transition.
  4280. @item mix, m
  4281. How much to use filtered signal in output. Default is 1.
  4282. Range is between 0 and 1.
  4283. @item channels, c
  4284. Specify which channels to filter, by default all available are filtered.
  4285. @item normalize, n
  4286. Normalize biquad coefficients, by default is disabled.
  4287. Enabling it will normalize magnitude response at DC to 0dB.
  4288. @end table
  4289. @subsection Commands
  4290. This filter supports the following commands:
  4291. @table @option
  4292. @item frequency, f
  4293. Change treble frequency.
  4294. Syntax for the command is : "@var{frequency}"
  4295. @item width_type, t
  4296. Change treble width_type.
  4297. Syntax for the command is : "@var{width_type}"
  4298. @item width, w
  4299. Change treble width.
  4300. Syntax for the command is : "@var{width}"
  4301. @item gain, g
  4302. Change treble gain.
  4303. Syntax for the command is : "@var{gain}"
  4304. @item mix, m
  4305. Change treble mix.
  4306. Syntax for the command is : "@var{mix}"
  4307. @end table
  4308. @section tremolo
  4309. Sinusoidal amplitude modulation.
  4310. The filter accepts the following options:
  4311. @table @option
  4312. @item f
  4313. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4314. (20 Hz or lower) will result in a tremolo effect.
  4315. This filter may also be used as a ring modulator by specifying
  4316. a modulation frequency higher than 20 Hz.
  4317. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4318. @item d
  4319. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4320. Default value is 0.5.
  4321. @end table
  4322. @section vibrato
  4323. Sinusoidal phase modulation.
  4324. The filter accepts the following options:
  4325. @table @option
  4326. @item f
  4327. Modulation frequency in Hertz.
  4328. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4329. @item d
  4330. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4331. Default value is 0.5.
  4332. @end table
  4333. @section volume
  4334. Adjust the input audio volume.
  4335. It accepts the following parameters:
  4336. @table @option
  4337. @item volume
  4338. Set audio volume expression.
  4339. Output values are clipped to the maximum value.
  4340. The output audio volume is given by the relation:
  4341. @example
  4342. @var{output_volume} = @var{volume} * @var{input_volume}
  4343. @end example
  4344. The default value for @var{volume} is "1.0".
  4345. @item precision
  4346. This parameter represents the mathematical precision.
  4347. It determines which input sample formats will be allowed, which affects the
  4348. precision of the volume scaling.
  4349. @table @option
  4350. @item fixed
  4351. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4352. @item float
  4353. 32-bit floating-point; this limits input sample format to FLT. (default)
  4354. @item double
  4355. 64-bit floating-point; this limits input sample format to DBL.
  4356. @end table
  4357. @item replaygain
  4358. Choose the behaviour on encountering ReplayGain side data in input frames.
  4359. @table @option
  4360. @item drop
  4361. Remove ReplayGain side data, ignoring its contents (the default).
  4362. @item ignore
  4363. Ignore ReplayGain side data, but leave it in the frame.
  4364. @item track
  4365. Prefer the track gain, if present.
  4366. @item album
  4367. Prefer the album gain, if present.
  4368. @end table
  4369. @item replaygain_preamp
  4370. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4371. Default value for @var{replaygain_preamp} is 0.0.
  4372. @item replaygain_noclip
  4373. Prevent clipping by limiting the gain applied.
  4374. Default value for @var{replaygain_noclip} is 1.
  4375. @item eval
  4376. Set when the volume expression is evaluated.
  4377. It accepts the following values:
  4378. @table @samp
  4379. @item once
  4380. only evaluate expression once during the filter initialization, or
  4381. when the @samp{volume} command is sent
  4382. @item frame
  4383. evaluate expression for each incoming frame
  4384. @end table
  4385. Default value is @samp{once}.
  4386. @end table
  4387. The volume expression can contain the following parameters.
  4388. @table @option
  4389. @item n
  4390. frame number (starting at zero)
  4391. @item nb_channels
  4392. number of channels
  4393. @item nb_consumed_samples
  4394. number of samples consumed by the filter
  4395. @item nb_samples
  4396. number of samples in the current frame
  4397. @item pos
  4398. original frame position in the file
  4399. @item pts
  4400. frame PTS
  4401. @item sample_rate
  4402. sample rate
  4403. @item startpts
  4404. PTS at start of stream
  4405. @item startt
  4406. time at start of stream
  4407. @item t
  4408. frame time
  4409. @item tb
  4410. timestamp timebase
  4411. @item volume
  4412. last set volume value
  4413. @end table
  4414. Note that when @option{eval} is set to @samp{once} only the
  4415. @var{sample_rate} and @var{tb} variables are available, all other
  4416. variables will evaluate to NAN.
  4417. @subsection Commands
  4418. This filter supports the following commands:
  4419. @table @option
  4420. @item volume
  4421. Modify the volume expression.
  4422. The command accepts the same syntax of the corresponding option.
  4423. If the specified expression is not valid, it is kept at its current
  4424. value.
  4425. @end table
  4426. @subsection Examples
  4427. @itemize
  4428. @item
  4429. Halve the input audio volume:
  4430. @example
  4431. volume=volume=0.5
  4432. volume=volume=1/2
  4433. volume=volume=-6.0206dB
  4434. @end example
  4435. In all the above example the named key for @option{volume} can be
  4436. omitted, for example like in:
  4437. @example
  4438. volume=0.5
  4439. @end example
  4440. @item
  4441. Increase input audio power by 6 decibels using fixed-point precision:
  4442. @example
  4443. volume=volume=6dB:precision=fixed
  4444. @end example
  4445. @item
  4446. Fade volume after time 10 with an annihilation period of 5 seconds:
  4447. @example
  4448. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4449. @end example
  4450. @end itemize
  4451. @section volumedetect
  4452. Detect the volume of the input video.
  4453. The filter has no parameters. The input is not modified. Statistics about
  4454. the volume will be printed in the log when the input stream end is reached.
  4455. In particular it will show the mean volume (root mean square), maximum
  4456. volume (on a per-sample basis), and the beginning of a histogram of the
  4457. registered volume values (from the maximum value to a cumulated 1/1000 of
  4458. the samples).
  4459. All volumes are in decibels relative to the maximum PCM value.
  4460. @subsection Examples
  4461. Here is an excerpt of the output:
  4462. @example
  4463. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4464. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4465. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4466. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4467. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4468. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4469. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4470. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4471. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4472. @end example
  4473. It means that:
  4474. @itemize
  4475. @item
  4476. The mean square energy is approximately -27 dB, or 10^-2.7.
  4477. @item
  4478. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4479. @item
  4480. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4481. @end itemize
  4482. In other words, raising the volume by +4 dB does not cause any clipping,
  4483. raising it by +5 dB causes clipping for 6 samples, etc.
  4484. @c man end AUDIO FILTERS
  4485. @chapter Audio Sources
  4486. @c man begin AUDIO SOURCES
  4487. Below is a description of the currently available audio sources.
  4488. @section abuffer
  4489. Buffer audio frames, and make them available to the filter chain.
  4490. This source is mainly intended for a programmatic use, in particular
  4491. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4492. It accepts the following parameters:
  4493. @table @option
  4494. @item time_base
  4495. The timebase which will be used for timestamps of submitted frames. It must be
  4496. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4497. @item sample_rate
  4498. The sample rate of the incoming audio buffers.
  4499. @item sample_fmt
  4500. The sample format of the incoming audio buffers.
  4501. Either a sample format name or its corresponding integer representation from
  4502. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4503. @item channel_layout
  4504. The channel layout of the incoming audio buffers.
  4505. Either a channel layout name from channel_layout_map in
  4506. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4507. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4508. @item channels
  4509. The number of channels of the incoming audio buffers.
  4510. If both @var{channels} and @var{channel_layout} are specified, then they
  4511. must be consistent.
  4512. @end table
  4513. @subsection Examples
  4514. @example
  4515. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4516. @end example
  4517. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4518. Since the sample format with name "s16p" corresponds to the number
  4519. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4520. equivalent to:
  4521. @example
  4522. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4523. @end example
  4524. @section aevalsrc
  4525. Generate an audio signal specified by an expression.
  4526. This source accepts in input one or more expressions (one for each
  4527. channel), which are evaluated and used to generate a corresponding
  4528. audio signal.
  4529. This source accepts the following options:
  4530. @table @option
  4531. @item exprs
  4532. Set the '|'-separated expressions list for each separate channel. In case the
  4533. @option{channel_layout} option is not specified, the selected channel layout
  4534. depends on the number of provided expressions. Otherwise the last
  4535. specified expression is applied to the remaining output channels.
  4536. @item channel_layout, c
  4537. Set the channel layout. The number of channels in the specified layout
  4538. must be equal to the number of specified expressions.
  4539. @item duration, d
  4540. Set the minimum duration of the sourced audio. See
  4541. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4542. for the accepted syntax.
  4543. Note that the resulting duration may be greater than the specified
  4544. duration, as the generated audio is always cut at the end of a
  4545. complete frame.
  4546. If not specified, or the expressed duration is negative, the audio is
  4547. supposed to be generated forever.
  4548. @item nb_samples, n
  4549. Set the number of samples per channel per each output frame,
  4550. default to 1024.
  4551. @item sample_rate, s
  4552. Specify the sample rate, default to 44100.
  4553. @end table
  4554. Each expression in @var{exprs} can contain the following constants:
  4555. @table @option
  4556. @item n
  4557. number of the evaluated sample, starting from 0
  4558. @item t
  4559. time of the evaluated sample expressed in seconds, starting from 0
  4560. @item s
  4561. sample rate
  4562. @end table
  4563. @subsection Examples
  4564. @itemize
  4565. @item
  4566. Generate silence:
  4567. @example
  4568. aevalsrc=0
  4569. @end example
  4570. @item
  4571. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4572. 8000 Hz:
  4573. @example
  4574. aevalsrc="sin(440*2*PI*t):s=8000"
  4575. @end example
  4576. @item
  4577. Generate a two channels signal, specify the channel layout (Front
  4578. Center + Back Center) explicitly:
  4579. @example
  4580. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4581. @end example
  4582. @item
  4583. Generate white noise:
  4584. @example
  4585. aevalsrc="-2+random(0)"
  4586. @end example
  4587. @item
  4588. Generate an amplitude modulated signal:
  4589. @example
  4590. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4591. @end example
  4592. @item
  4593. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4594. @example
  4595. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4596. @end example
  4597. @end itemize
  4598. @section afirsrc
  4599. Generate a FIR coefficients using frequency sampling method.
  4600. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4601. The filter accepts the following options:
  4602. @table @option
  4603. @item taps, t
  4604. Set number of filter coefficents in output audio stream.
  4605. Default value is 1025.
  4606. @item frequency, f
  4607. Set frequency points from where magnitude and phase are set.
  4608. This must be in non decreasing order, and first element must be 0, while last element
  4609. must be 1. Elements are separated by white spaces.
  4610. @item magnitude, m
  4611. Set magnitude value for every frequency point set by @option{frequency}.
  4612. Number of values must be same as number of frequency points.
  4613. Values are separated by white spaces.
  4614. @item phase, p
  4615. Set phase value for every frequency point set by @option{frequency}.
  4616. Number of values must be same as number of frequency points.
  4617. Values are separated by white spaces.
  4618. @item sample_rate, r
  4619. Set sample rate, default is 44100.
  4620. @item nb_samples, n
  4621. Set number of samples per each frame. Default is 1024.
  4622. @item win_func, w
  4623. Set window function. Default is blackman.
  4624. @end table
  4625. @section anullsrc
  4626. The null audio source, return unprocessed audio frames. It is mainly useful
  4627. as a template and to be employed in analysis / debugging tools, or as
  4628. the source for filters which ignore the input data (for example the sox
  4629. synth filter).
  4630. This source accepts the following options:
  4631. @table @option
  4632. @item channel_layout, cl
  4633. Specifies the channel layout, and can be either an integer or a string
  4634. representing a channel layout. The default value of @var{channel_layout}
  4635. is "stereo".
  4636. Check the channel_layout_map definition in
  4637. @file{libavutil/channel_layout.c} for the mapping between strings and
  4638. channel layout values.
  4639. @item sample_rate, r
  4640. Specifies the sample rate, and defaults to 44100.
  4641. @item nb_samples, n
  4642. Set the number of samples per requested frames.
  4643. @end table
  4644. @subsection Examples
  4645. @itemize
  4646. @item
  4647. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4648. @example
  4649. anullsrc=r=48000:cl=4
  4650. @end example
  4651. @item
  4652. Do the same operation with a more obvious syntax:
  4653. @example
  4654. anullsrc=r=48000:cl=mono
  4655. @end example
  4656. @end itemize
  4657. All the parameters need to be explicitly defined.
  4658. @section flite
  4659. Synthesize a voice utterance using the libflite library.
  4660. To enable compilation of this filter you need to configure FFmpeg with
  4661. @code{--enable-libflite}.
  4662. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4663. The filter accepts the following options:
  4664. @table @option
  4665. @item list_voices
  4666. If set to 1, list the names of the available voices and exit
  4667. immediately. Default value is 0.
  4668. @item nb_samples, n
  4669. Set the maximum number of samples per frame. Default value is 512.
  4670. @item textfile
  4671. Set the filename containing the text to speak.
  4672. @item text
  4673. Set the text to speak.
  4674. @item voice, v
  4675. Set the voice to use for the speech synthesis. Default value is
  4676. @code{kal}. See also the @var{list_voices} option.
  4677. @end table
  4678. @subsection Examples
  4679. @itemize
  4680. @item
  4681. Read from file @file{speech.txt}, and synthesize the text using the
  4682. standard flite voice:
  4683. @example
  4684. flite=textfile=speech.txt
  4685. @end example
  4686. @item
  4687. Read the specified text selecting the @code{slt} voice:
  4688. @example
  4689. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4690. @end example
  4691. @item
  4692. Input text to ffmpeg:
  4693. @example
  4694. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4695. @end example
  4696. @item
  4697. Make @file{ffplay} speak the specified text, using @code{flite} and
  4698. the @code{lavfi} device:
  4699. @example
  4700. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4701. @end example
  4702. @end itemize
  4703. For more information about libflite, check:
  4704. @url{http://www.festvox.org/flite/}
  4705. @section anoisesrc
  4706. Generate a noise audio signal.
  4707. The filter accepts the following options:
  4708. @table @option
  4709. @item sample_rate, r
  4710. Specify the sample rate. Default value is 48000 Hz.
  4711. @item amplitude, a
  4712. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4713. is 1.0.
  4714. @item duration, d
  4715. Specify the duration of the generated audio stream. Not specifying this option
  4716. results in noise with an infinite length.
  4717. @item color, colour, c
  4718. Specify the color of noise. Available noise colors are white, pink, brown,
  4719. blue, violet and velvet. Default color is white.
  4720. @item seed, s
  4721. Specify a value used to seed the PRNG.
  4722. @item nb_samples, n
  4723. Set the number of samples per each output frame, default is 1024.
  4724. @end table
  4725. @subsection Examples
  4726. @itemize
  4727. @item
  4728. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4729. @example
  4730. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4731. @end example
  4732. @end itemize
  4733. @section hilbert
  4734. Generate odd-tap Hilbert transform FIR coefficients.
  4735. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4736. the signal by 90 degrees.
  4737. This is used in many matrix coding schemes and for analytic signal generation.
  4738. The process is often written as a multiplication by i (or j), the imaginary unit.
  4739. The filter accepts the following options:
  4740. @table @option
  4741. @item sample_rate, s
  4742. Set sample rate, default is 44100.
  4743. @item taps, t
  4744. Set length of FIR filter, default is 22051.
  4745. @item nb_samples, n
  4746. Set number of samples per each frame.
  4747. @item win_func, w
  4748. Set window function to be used when generating FIR coefficients.
  4749. @end table
  4750. @section sinc
  4751. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4752. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4753. The filter accepts the following options:
  4754. @table @option
  4755. @item sample_rate, r
  4756. Set sample rate, default is 44100.
  4757. @item nb_samples, n
  4758. Set number of samples per each frame. Default is 1024.
  4759. @item hp
  4760. Set high-pass frequency. Default is 0.
  4761. @item lp
  4762. Set low-pass frequency. Default is 0.
  4763. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4764. is higher than 0 then filter will create band-pass filter coefficients,
  4765. otherwise band-reject filter coefficients.
  4766. @item phase
  4767. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4768. @item beta
  4769. Set Kaiser window beta.
  4770. @item att
  4771. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4772. @item round
  4773. Enable rounding, by default is disabled.
  4774. @item hptaps
  4775. Set number of taps for high-pass filter.
  4776. @item lptaps
  4777. Set number of taps for low-pass filter.
  4778. @end table
  4779. @section sine
  4780. Generate an audio signal made of a sine wave with amplitude 1/8.
  4781. The audio signal is bit-exact.
  4782. The filter accepts the following options:
  4783. @table @option
  4784. @item frequency, f
  4785. Set the carrier frequency. Default is 440 Hz.
  4786. @item beep_factor, b
  4787. Enable a periodic beep every second with frequency @var{beep_factor} times
  4788. the carrier frequency. Default is 0, meaning the beep is disabled.
  4789. @item sample_rate, r
  4790. Specify the sample rate, default is 44100.
  4791. @item duration, d
  4792. Specify the duration of the generated audio stream.
  4793. @item samples_per_frame
  4794. Set the number of samples per output frame.
  4795. The expression can contain the following constants:
  4796. @table @option
  4797. @item n
  4798. The (sequential) number of the output audio frame, starting from 0.
  4799. @item pts
  4800. The PTS (Presentation TimeStamp) of the output audio frame,
  4801. expressed in @var{TB} units.
  4802. @item t
  4803. The PTS of the output audio frame, expressed in seconds.
  4804. @item TB
  4805. The timebase of the output audio frames.
  4806. @end table
  4807. Default is @code{1024}.
  4808. @end table
  4809. @subsection Examples
  4810. @itemize
  4811. @item
  4812. Generate a simple 440 Hz sine wave:
  4813. @example
  4814. sine
  4815. @end example
  4816. @item
  4817. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4818. @example
  4819. sine=220:4:d=5
  4820. sine=f=220:b=4:d=5
  4821. sine=frequency=220:beep_factor=4:duration=5
  4822. @end example
  4823. @item
  4824. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4825. pattern:
  4826. @example
  4827. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4828. @end example
  4829. @end itemize
  4830. @c man end AUDIO SOURCES
  4831. @chapter Audio Sinks
  4832. @c man begin AUDIO SINKS
  4833. Below is a description of the currently available audio sinks.
  4834. @section abuffersink
  4835. Buffer audio frames, and make them available to the end of filter chain.
  4836. This sink is mainly intended for programmatic use, in particular
  4837. through the interface defined in @file{libavfilter/buffersink.h}
  4838. or the options system.
  4839. It accepts a pointer to an AVABufferSinkContext structure, which
  4840. defines the incoming buffers' formats, to be passed as the opaque
  4841. parameter to @code{avfilter_init_filter} for initialization.
  4842. @section anullsink
  4843. Null audio sink; do absolutely nothing with the input audio. It is
  4844. mainly useful as a template and for use in analysis / debugging
  4845. tools.
  4846. @c man end AUDIO SINKS
  4847. @chapter Video Filters
  4848. @c man begin VIDEO FILTERS
  4849. When you configure your FFmpeg build, you can disable any of the
  4850. existing filters using @code{--disable-filters}.
  4851. The configure output will show the video filters included in your
  4852. build.
  4853. Below is a description of the currently available video filters.
  4854. @section addroi
  4855. Mark a region of interest in a video frame.
  4856. The frame data is passed through unchanged, but metadata is attached
  4857. to the frame indicating regions of interest which can affect the
  4858. behaviour of later encoding. Multiple regions can be marked by
  4859. applying the filter multiple times.
  4860. @table @option
  4861. @item x
  4862. Region distance in pixels from the left edge of the frame.
  4863. @item y
  4864. Region distance in pixels from the top edge of the frame.
  4865. @item w
  4866. Region width in pixels.
  4867. @item h
  4868. Region height in pixels.
  4869. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4870. and may contain the following variables:
  4871. @table @option
  4872. @item iw
  4873. Width of the input frame.
  4874. @item ih
  4875. Height of the input frame.
  4876. @end table
  4877. @item qoffset
  4878. Quantisation offset to apply within the region.
  4879. This must be a real value in the range -1 to +1. A value of zero
  4880. indicates no quality change. A negative value asks for better quality
  4881. (less quantisation), while a positive value asks for worse quality
  4882. (greater quantisation).
  4883. The range is calibrated so that the extreme values indicate the
  4884. largest possible offset - if the rest of the frame is encoded with the
  4885. worst possible quality, an offset of -1 indicates that this region
  4886. should be encoded with the best possible quality anyway. Intermediate
  4887. values are then interpolated in some codec-dependent way.
  4888. For example, in 10-bit H.264 the quantisation parameter varies between
  4889. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4890. this region should be encoded with a QP around one-tenth of the full
  4891. range better than the rest of the frame. So, if most of the frame
  4892. were to be encoded with a QP of around 30, this region would get a QP
  4893. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4894. An extreme value of -1 would indicate that this region should be
  4895. encoded with the best possible quality regardless of the treatment of
  4896. the rest of the frame - that is, should be encoded at a QP of -12.
  4897. @item clear
  4898. If set to true, remove any existing regions of interest marked on the
  4899. frame before adding the new one.
  4900. @end table
  4901. @subsection Examples
  4902. @itemize
  4903. @item
  4904. Mark the centre quarter of the frame as interesting.
  4905. @example
  4906. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4907. @end example
  4908. @item
  4909. Mark the 100-pixel-wide region on the left edge of the frame as very
  4910. uninteresting (to be encoded at much lower quality than the rest of
  4911. the frame).
  4912. @example
  4913. addroi=0:0:100:ih:+1/5
  4914. @end example
  4915. @end itemize
  4916. @section alphaextract
  4917. Extract the alpha component from the input as a grayscale video. This
  4918. is especially useful with the @var{alphamerge} filter.
  4919. @section alphamerge
  4920. Add or replace the alpha component of the primary input with the
  4921. grayscale value of a second input. This is intended for use with
  4922. @var{alphaextract} to allow the transmission or storage of frame
  4923. sequences that have alpha in a format that doesn't support an alpha
  4924. channel.
  4925. For example, to reconstruct full frames from a normal YUV-encoded video
  4926. and a separate video created with @var{alphaextract}, you might use:
  4927. @example
  4928. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4929. @end example
  4930. Since this filter is designed for reconstruction, it operates on frame
  4931. sequences without considering timestamps, and terminates when either
  4932. input reaches end of stream. This will cause problems if your encoding
  4933. pipeline drops frames. If you're trying to apply an image as an
  4934. overlay to a video stream, consider the @var{overlay} filter instead.
  4935. @section amplify
  4936. Amplify differences between current pixel and pixels of adjacent frames in
  4937. same pixel location.
  4938. This filter accepts the following options:
  4939. @table @option
  4940. @item radius
  4941. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4942. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4943. @item factor
  4944. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4945. @item threshold
  4946. Set threshold for difference amplification. Any difference greater or equal to
  4947. this value will not alter source pixel. Default is 10.
  4948. Allowed range is from 0 to 65535.
  4949. @item tolerance
  4950. Set tolerance for difference amplification. Any difference lower to
  4951. this value will not alter source pixel. Default is 0.
  4952. Allowed range is from 0 to 65535.
  4953. @item low
  4954. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4955. This option controls maximum possible value that will decrease source pixel value.
  4956. @item high
  4957. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4958. This option controls maximum possible value that will increase source pixel value.
  4959. @item planes
  4960. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4961. @end table
  4962. @subsection Commands
  4963. This filter supports the following @ref{commands} that corresponds to option of same name:
  4964. @table @option
  4965. @item factor
  4966. @item threshold
  4967. @item tolerance
  4968. @item low
  4969. @item high
  4970. @item planes
  4971. @end table
  4972. @section ass
  4973. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4974. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4975. Substation Alpha) subtitles files.
  4976. This filter accepts the following option in addition to the common options from
  4977. the @ref{subtitles} filter:
  4978. @table @option
  4979. @item shaping
  4980. Set the shaping engine
  4981. Available values are:
  4982. @table @samp
  4983. @item auto
  4984. The default libass shaping engine, which is the best available.
  4985. @item simple
  4986. Fast, font-agnostic shaper that can do only substitutions
  4987. @item complex
  4988. Slower shaper using OpenType for substitutions and positioning
  4989. @end table
  4990. The default is @code{auto}.
  4991. @end table
  4992. @section atadenoise
  4993. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4994. The filter accepts the following options:
  4995. @table @option
  4996. @item 0a
  4997. Set threshold A for 1st plane. Default is 0.02.
  4998. Valid range is 0 to 0.3.
  4999. @item 0b
  5000. Set threshold B for 1st plane. Default is 0.04.
  5001. Valid range is 0 to 5.
  5002. @item 1a
  5003. Set threshold A for 2nd plane. Default is 0.02.
  5004. Valid range is 0 to 0.3.
  5005. @item 1b
  5006. Set threshold B for 2nd plane. Default is 0.04.
  5007. Valid range is 0 to 5.
  5008. @item 2a
  5009. Set threshold A for 3rd plane. Default is 0.02.
  5010. Valid range is 0 to 0.3.
  5011. @item 2b
  5012. Set threshold B for 3rd plane. Default is 0.04.
  5013. Valid range is 0 to 5.
  5014. Threshold A is designed to react on abrupt changes in the input signal and
  5015. threshold B is designed to react on continuous changes in the input signal.
  5016. @item s
  5017. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5018. number in range [5, 129].
  5019. @item p
  5020. Set what planes of frame filter will use for averaging. Default is all.
  5021. @item a
  5022. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5023. Alternatively can be set to @code{s} serial.
  5024. Parallel can be faster then serial, while other way around is never true.
  5025. Parallel will abort early on first change being greater then thresholds, while serial
  5026. will continue processing other side of frames if they are equal or bellow thresholds.
  5027. @end table
  5028. @subsection Commands
  5029. This filter supports same @ref{commands} as options except option @code{s}.
  5030. The command accepts the same syntax of the corresponding option.
  5031. @section avgblur
  5032. Apply average blur filter.
  5033. The filter accepts the following options:
  5034. @table @option
  5035. @item sizeX
  5036. Set horizontal radius size.
  5037. @item planes
  5038. Set which planes to filter. By default all planes are filtered.
  5039. @item sizeY
  5040. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5041. Default is @code{0}.
  5042. @end table
  5043. @subsection Commands
  5044. This filter supports same commands as options.
  5045. The command accepts the same syntax of the corresponding option.
  5046. If the specified expression is not valid, it is kept at its current
  5047. value.
  5048. @section bbox
  5049. Compute the bounding box for the non-black pixels in the input frame
  5050. luminance plane.
  5051. This filter computes the bounding box containing all the pixels with a
  5052. luminance value greater than the minimum allowed value.
  5053. The parameters describing the bounding box are printed on the filter
  5054. log.
  5055. The filter accepts the following option:
  5056. @table @option
  5057. @item min_val
  5058. Set the minimal luminance value. Default is @code{16}.
  5059. @end table
  5060. @section bilateral
  5061. Apply bilateral filter, spatial smoothing while preserving edges.
  5062. The filter accepts the following options:
  5063. @table @option
  5064. @item sigmaS
  5065. Set sigma of gaussian function to calculate spatial weight.
  5066. Allowed range is 0 to 10. Default is 0.1.
  5067. @item sigmaR
  5068. Set sigma of gaussian function to calculate range weight.
  5069. Allowed range is 0 to 1. Default is 0.1.
  5070. @item planes
  5071. Set planes to filter. Default is first only.
  5072. @end table
  5073. @section bitplanenoise
  5074. Show and measure bit plane noise.
  5075. The filter accepts the following options:
  5076. @table @option
  5077. @item bitplane
  5078. Set which plane to analyze. Default is @code{1}.
  5079. @item filter
  5080. Filter out noisy pixels from @code{bitplane} set above.
  5081. Default is disabled.
  5082. @end table
  5083. @section blackdetect
  5084. Detect video intervals that are (almost) completely black. Can be
  5085. useful to detect chapter transitions, commercials, or invalid
  5086. recordings.
  5087. The filter outputs its detection analysis to both the log as well as
  5088. frame metadata. If a black segment of at least the specified minimum
  5089. duration is found, a line with the start and end timestamps as well
  5090. as duration is printed to the log with level @code{info}. In addition,
  5091. a log line with level @code{debug} is printed per frame showing the
  5092. black amount detected for that frame.
  5093. The filter also attaches metadata to the first frame of a black
  5094. segment with key @code{lavfi.black_start} and to the first frame
  5095. after the black segment ends with key @code{lavfi.black_end}. The
  5096. value is the frame's timestamp. This metadata is added regardless
  5097. of the minimum duration specified.
  5098. The filter accepts the following options:
  5099. @table @option
  5100. @item black_min_duration, d
  5101. Set the minimum detected black duration expressed in seconds. It must
  5102. be a non-negative floating point number.
  5103. Default value is 2.0.
  5104. @item picture_black_ratio_th, pic_th
  5105. Set the threshold for considering a picture "black".
  5106. Express the minimum value for the ratio:
  5107. @example
  5108. @var{nb_black_pixels} / @var{nb_pixels}
  5109. @end example
  5110. for which a picture is considered black.
  5111. Default value is 0.98.
  5112. @item pixel_black_th, pix_th
  5113. Set the threshold for considering a pixel "black".
  5114. The threshold expresses the maximum pixel luminance value for which a
  5115. pixel is considered "black". The provided value is scaled according to
  5116. the following equation:
  5117. @example
  5118. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5119. @end example
  5120. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5121. the input video format, the range is [0-255] for YUV full-range
  5122. formats and [16-235] for YUV non full-range formats.
  5123. Default value is 0.10.
  5124. @end table
  5125. The following example sets the maximum pixel threshold to the minimum
  5126. value, and detects only black intervals of 2 or more seconds:
  5127. @example
  5128. blackdetect=d=2:pix_th=0.00
  5129. @end example
  5130. @section blackframe
  5131. Detect frames that are (almost) completely black. Can be useful to
  5132. detect chapter transitions or commercials. Output lines consist of
  5133. the frame number of the detected frame, the percentage of blackness,
  5134. the position in the file if known or -1 and the timestamp in seconds.
  5135. In order to display the output lines, you need to set the loglevel at
  5136. least to the AV_LOG_INFO value.
  5137. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5138. The value represents the percentage of pixels in the picture that
  5139. are below the threshold value.
  5140. It accepts the following parameters:
  5141. @table @option
  5142. @item amount
  5143. The percentage of the pixels that have to be below the threshold; it defaults to
  5144. @code{98}.
  5145. @item threshold, thresh
  5146. The threshold below which a pixel value is considered black; it defaults to
  5147. @code{32}.
  5148. @end table
  5149. @anchor{blend}
  5150. @section blend
  5151. Blend two video frames into each other.
  5152. The @code{blend} filter takes two input streams and outputs one
  5153. stream, the first input is the "top" layer and second input is
  5154. "bottom" layer. By default, the output terminates when the longest input terminates.
  5155. The @code{tblend} (time blend) filter takes two consecutive frames
  5156. from one single stream, and outputs the result obtained by blending
  5157. the new frame on top of the old frame.
  5158. A description of the accepted options follows.
  5159. @table @option
  5160. @item c0_mode
  5161. @item c1_mode
  5162. @item c2_mode
  5163. @item c3_mode
  5164. @item all_mode
  5165. Set blend mode for specific pixel component or all pixel components in case
  5166. of @var{all_mode}. Default value is @code{normal}.
  5167. Available values for component modes are:
  5168. @table @samp
  5169. @item addition
  5170. @item grainmerge
  5171. @item and
  5172. @item average
  5173. @item burn
  5174. @item darken
  5175. @item difference
  5176. @item grainextract
  5177. @item divide
  5178. @item dodge
  5179. @item freeze
  5180. @item exclusion
  5181. @item extremity
  5182. @item glow
  5183. @item hardlight
  5184. @item hardmix
  5185. @item heat
  5186. @item lighten
  5187. @item linearlight
  5188. @item multiply
  5189. @item multiply128
  5190. @item negation
  5191. @item normal
  5192. @item or
  5193. @item overlay
  5194. @item phoenix
  5195. @item pinlight
  5196. @item reflect
  5197. @item screen
  5198. @item softlight
  5199. @item subtract
  5200. @item vividlight
  5201. @item xor
  5202. @end table
  5203. @item c0_opacity
  5204. @item c1_opacity
  5205. @item c2_opacity
  5206. @item c3_opacity
  5207. @item all_opacity
  5208. Set blend opacity for specific pixel component or all pixel components in case
  5209. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5210. @item c0_expr
  5211. @item c1_expr
  5212. @item c2_expr
  5213. @item c3_expr
  5214. @item all_expr
  5215. Set blend expression for specific pixel component or all pixel components in case
  5216. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5217. The expressions can use the following variables:
  5218. @table @option
  5219. @item N
  5220. The sequential number of the filtered frame, starting from @code{0}.
  5221. @item X
  5222. @item Y
  5223. the coordinates of the current sample
  5224. @item W
  5225. @item H
  5226. the width and height of currently filtered plane
  5227. @item SW
  5228. @item SH
  5229. Width and height scale for the plane being filtered. It is the
  5230. ratio between the dimensions of the current plane to the luma plane,
  5231. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5232. the luma plane and @code{0.5,0.5} for the chroma planes.
  5233. @item T
  5234. Time of the current frame, expressed in seconds.
  5235. @item TOP, A
  5236. Value of pixel component at current location for first video frame (top layer).
  5237. @item BOTTOM, B
  5238. Value of pixel component at current location for second video frame (bottom layer).
  5239. @end table
  5240. @end table
  5241. The @code{blend} filter also supports the @ref{framesync} options.
  5242. @subsection Examples
  5243. @itemize
  5244. @item
  5245. Apply transition from bottom layer to top layer in first 10 seconds:
  5246. @example
  5247. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5248. @end example
  5249. @item
  5250. Apply linear horizontal transition from top layer to bottom layer:
  5251. @example
  5252. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5253. @end example
  5254. @item
  5255. Apply 1x1 checkerboard effect:
  5256. @example
  5257. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5258. @end example
  5259. @item
  5260. Apply uncover left effect:
  5261. @example
  5262. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5263. @end example
  5264. @item
  5265. Apply uncover down effect:
  5266. @example
  5267. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5268. @end example
  5269. @item
  5270. Apply uncover up-left effect:
  5271. @example
  5272. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5273. @end example
  5274. @item
  5275. Split diagonally video and shows top and bottom layer on each side:
  5276. @example
  5277. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5278. @end example
  5279. @item
  5280. Display differences between the current and the previous frame:
  5281. @example
  5282. tblend=all_mode=grainextract
  5283. @end example
  5284. @end itemize
  5285. @section bm3d
  5286. Denoise frames using Block-Matching 3D algorithm.
  5287. The filter accepts the following options.
  5288. @table @option
  5289. @item sigma
  5290. Set denoising strength. Default value is 1.
  5291. Allowed range is from 0 to 999.9.
  5292. The denoising algorithm is very sensitive to sigma, so adjust it
  5293. according to the source.
  5294. @item block
  5295. Set local patch size. This sets dimensions in 2D.
  5296. @item bstep
  5297. Set sliding step for processing blocks. Default value is 4.
  5298. Allowed range is from 1 to 64.
  5299. Smaller values allows processing more reference blocks and is slower.
  5300. @item group
  5301. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5302. When set to 1, no block matching is done. Larger values allows more blocks
  5303. in single group.
  5304. Allowed range is from 1 to 256.
  5305. @item range
  5306. Set radius for search block matching. Default is 9.
  5307. Allowed range is from 1 to INT32_MAX.
  5308. @item mstep
  5309. Set step between two search locations for block matching. Default is 1.
  5310. Allowed range is from 1 to 64. Smaller is slower.
  5311. @item thmse
  5312. Set threshold of mean square error for block matching. Valid range is 0 to
  5313. INT32_MAX.
  5314. @item hdthr
  5315. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5316. Larger values results in stronger hard-thresholding filtering in frequency
  5317. domain.
  5318. @item estim
  5319. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5320. Default is @code{basic}.
  5321. @item ref
  5322. If enabled, filter will use 2nd stream for block matching.
  5323. Default is disabled for @code{basic} value of @var{estim} option,
  5324. and always enabled if value of @var{estim} is @code{final}.
  5325. @item planes
  5326. Set planes to filter. Default is all available except alpha.
  5327. @end table
  5328. @subsection Examples
  5329. @itemize
  5330. @item
  5331. Basic filtering with bm3d:
  5332. @example
  5333. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5334. @end example
  5335. @item
  5336. Same as above, but filtering only luma:
  5337. @example
  5338. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5339. @end example
  5340. @item
  5341. Same as above, but with both estimation modes:
  5342. @example
  5343. 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
  5344. @end example
  5345. @item
  5346. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5347. @example
  5348. 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
  5349. @end example
  5350. @end itemize
  5351. @section boxblur
  5352. Apply a boxblur algorithm to the input video.
  5353. It accepts the following parameters:
  5354. @table @option
  5355. @item luma_radius, lr
  5356. @item luma_power, lp
  5357. @item chroma_radius, cr
  5358. @item chroma_power, cp
  5359. @item alpha_radius, ar
  5360. @item alpha_power, ap
  5361. @end table
  5362. A description of the accepted options follows.
  5363. @table @option
  5364. @item luma_radius, lr
  5365. @item chroma_radius, cr
  5366. @item alpha_radius, ar
  5367. Set an expression for the box radius in pixels used for blurring the
  5368. corresponding input plane.
  5369. The radius value must be a non-negative number, and must not be
  5370. greater than the value of the expression @code{min(w,h)/2} for the
  5371. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5372. planes.
  5373. Default value for @option{luma_radius} is "2". If not specified,
  5374. @option{chroma_radius} and @option{alpha_radius} default to the
  5375. corresponding value set for @option{luma_radius}.
  5376. The expressions can contain the following constants:
  5377. @table @option
  5378. @item w
  5379. @item h
  5380. The input width and height in pixels.
  5381. @item cw
  5382. @item ch
  5383. The input chroma image width and height in pixels.
  5384. @item hsub
  5385. @item vsub
  5386. The horizontal and vertical chroma subsample values. For example, for the
  5387. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5388. @end table
  5389. @item luma_power, lp
  5390. @item chroma_power, cp
  5391. @item alpha_power, ap
  5392. Specify how many times the boxblur filter is applied to the
  5393. corresponding plane.
  5394. Default value for @option{luma_power} is 2. If not specified,
  5395. @option{chroma_power} and @option{alpha_power} default to the
  5396. corresponding value set for @option{luma_power}.
  5397. A value of 0 will disable the effect.
  5398. @end table
  5399. @subsection Examples
  5400. @itemize
  5401. @item
  5402. Apply a boxblur filter with the luma, chroma, and alpha radii
  5403. set to 2:
  5404. @example
  5405. boxblur=luma_radius=2:luma_power=1
  5406. boxblur=2:1
  5407. @end example
  5408. @item
  5409. Set the luma radius to 2, and alpha and chroma radius to 0:
  5410. @example
  5411. boxblur=2:1:cr=0:ar=0
  5412. @end example
  5413. @item
  5414. Set the luma and chroma radii to a fraction of the video dimension:
  5415. @example
  5416. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5417. @end example
  5418. @end itemize
  5419. @section bwdif
  5420. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5421. Deinterlacing Filter").
  5422. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5423. interpolation algorithms.
  5424. It accepts the following parameters:
  5425. @table @option
  5426. @item mode
  5427. The interlacing mode to adopt. It accepts one of the following values:
  5428. @table @option
  5429. @item 0, send_frame
  5430. Output one frame for each frame.
  5431. @item 1, send_field
  5432. Output one frame for each field.
  5433. @end table
  5434. The default value is @code{send_field}.
  5435. @item parity
  5436. The picture field parity assumed for the input interlaced video. It accepts one
  5437. of the following values:
  5438. @table @option
  5439. @item 0, tff
  5440. Assume the top field is first.
  5441. @item 1, bff
  5442. Assume the bottom field is first.
  5443. @item -1, auto
  5444. Enable automatic detection of field parity.
  5445. @end table
  5446. The default value is @code{auto}.
  5447. If the interlacing is unknown or the decoder does not export this information,
  5448. top field first will be assumed.
  5449. @item deint
  5450. Specify which frames to deinterlace. Accepts one of the following
  5451. values:
  5452. @table @option
  5453. @item 0, all
  5454. Deinterlace all frames.
  5455. @item 1, interlaced
  5456. Only deinterlace frames marked as interlaced.
  5457. @end table
  5458. The default value is @code{all}.
  5459. @end table
  5460. @section cas
  5461. Apply Contrast Adaptive Sharpen filter to video stream.
  5462. The filter accepts the following options:
  5463. @table @option
  5464. @item strength
  5465. Set the sharpening strength. Default value is 0.
  5466. @item planes
  5467. Set planes to filter. Default value is to filter all
  5468. planes except alpha plane.
  5469. @end table
  5470. @section chromahold
  5471. Remove all color information for all colors except for certain one.
  5472. The filter accepts the following options:
  5473. @table @option
  5474. @item color
  5475. The color which will not be replaced with neutral chroma.
  5476. @item similarity
  5477. Similarity percentage with the above color.
  5478. 0.01 matches only the exact key color, while 1.0 matches everything.
  5479. @item blend
  5480. Blend percentage.
  5481. 0.0 makes pixels either fully gray, or not gray at all.
  5482. Higher values result in more preserved color.
  5483. @item yuv
  5484. Signals that the color passed is already in YUV instead of RGB.
  5485. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5486. This can be used to pass exact YUV values as hexadecimal numbers.
  5487. @end table
  5488. @subsection Commands
  5489. This filter supports same @ref{commands} as options.
  5490. The command accepts the same syntax of the corresponding option.
  5491. If the specified expression is not valid, it is kept at its current
  5492. value.
  5493. @section chromakey
  5494. YUV colorspace color/chroma keying.
  5495. The filter accepts the following options:
  5496. @table @option
  5497. @item color
  5498. The color which will be replaced with transparency.
  5499. @item similarity
  5500. Similarity percentage with the key color.
  5501. 0.01 matches only the exact key color, while 1.0 matches everything.
  5502. @item blend
  5503. Blend percentage.
  5504. 0.0 makes pixels either fully transparent, or not transparent at all.
  5505. Higher values result in semi-transparent pixels, with a higher transparency
  5506. the more similar the pixels color is to the key color.
  5507. @item yuv
  5508. Signals that the color passed is already in YUV instead of RGB.
  5509. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5510. This can be used to pass exact YUV values as hexadecimal numbers.
  5511. @end table
  5512. @subsection Commands
  5513. This filter supports same @ref{commands} as options.
  5514. The command accepts the same syntax of the corresponding option.
  5515. If the specified expression is not valid, it is kept at its current
  5516. value.
  5517. @subsection Examples
  5518. @itemize
  5519. @item
  5520. Make every green pixel in the input image transparent:
  5521. @example
  5522. ffmpeg -i input.png -vf chromakey=green out.png
  5523. @end example
  5524. @item
  5525. Overlay a greenscreen-video on top of a static black background.
  5526. @example
  5527. 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
  5528. @end example
  5529. @end itemize
  5530. @section chromashift
  5531. Shift chroma pixels horizontally and/or vertically.
  5532. The filter accepts the following options:
  5533. @table @option
  5534. @item cbh
  5535. Set amount to shift chroma-blue horizontally.
  5536. @item cbv
  5537. Set amount to shift chroma-blue vertically.
  5538. @item crh
  5539. Set amount to shift chroma-red horizontally.
  5540. @item crv
  5541. Set amount to shift chroma-red vertically.
  5542. @item edge
  5543. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5544. @end table
  5545. @subsection Commands
  5546. This filter supports the all above options as @ref{commands}.
  5547. @section ciescope
  5548. Display CIE color diagram with pixels overlaid onto it.
  5549. The filter accepts the following options:
  5550. @table @option
  5551. @item system
  5552. Set color system.
  5553. @table @samp
  5554. @item ntsc, 470m
  5555. @item ebu, 470bg
  5556. @item smpte
  5557. @item 240m
  5558. @item apple
  5559. @item widergb
  5560. @item cie1931
  5561. @item rec709, hdtv
  5562. @item uhdtv, rec2020
  5563. @item dcip3
  5564. @end table
  5565. @item cie
  5566. Set CIE system.
  5567. @table @samp
  5568. @item xyy
  5569. @item ucs
  5570. @item luv
  5571. @end table
  5572. @item gamuts
  5573. Set what gamuts to draw.
  5574. See @code{system} option for available values.
  5575. @item size, s
  5576. Set ciescope size, by default set to 512.
  5577. @item intensity, i
  5578. Set intensity used to map input pixel values to CIE diagram.
  5579. @item contrast
  5580. Set contrast used to draw tongue colors that are out of active color system gamut.
  5581. @item corrgamma
  5582. Correct gamma displayed on scope, by default enabled.
  5583. @item showwhite
  5584. Show white point on CIE diagram, by default disabled.
  5585. @item gamma
  5586. Set input gamma. Used only with XYZ input color space.
  5587. @end table
  5588. @section codecview
  5589. Visualize information exported by some codecs.
  5590. Some codecs can export information through frames using side-data or other
  5591. means. For example, some MPEG based codecs export motion vectors through the
  5592. @var{export_mvs} flag in the codec @option{flags2} option.
  5593. The filter accepts the following option:
  5594. @table @option
  5595. @item mv
  5596. Set motion vectors to visualize.
  5597. Available flags for @var{mv} are:
  5598. @table @samp
  5599. @item pf
  5600. forward predicted MVs of P-frames
  5601. @item bf
  5602. forward predicted MVs of B-frames
  5603. @item bb
  5604. backward predicted MVs of B-frames
  5605. @end table
  5606. @item qp
  5607. Display quantization parameters using the chroma planes.
  5608. @item mv_type, mvt
  5609. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5610. Available flags for @var{mv_type} are:
  5611. @table @samp
  5612. @item fp
  5613. forward predicted MVs
  5614. @item bp
  5615. backward predicted MVs
  5616. @end table
  5617. @item frame_type, ft
  5618. Set frame type to visualize motion vectors of.
  5619. Available flags for @var{frame_type} are:
  5620. @table @samp
  5621. @item if
  5622. intra-coded frames (I-frames)
  5623. @item pf
  5624. predicted frames (P-frames)
  5625. @item bf
  5626. bi-directionally predicted frames (B-frames)
  5627. @end table
  5628. @end table
  5629. @subsection Examples
  5630. @itemize
  5631. @item
  5632. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5633. @example
  5634. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5635. @end example
  5636. @item
  5637. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5638. @example
  5639. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5640. @end example
  5641. @end itemize
  5642. @section colorbalance
  5643. Modify intensity of primary colors (red, green and blue) of input frames.
  5644. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5645. regions for the red-cyan, green-magenta or blue-yellow balance.
  5646. A positive adjustment value shifts the balance towards the primary color, a negative
  5647. value towards the complementary color.
  5648. The filter accepts the following options:
  5649. @table @option
  5650. @item rs
  5651. @item gs
  5652. @item bs
  5653. Adjust red, green and blue shadows (darkest pixels).
  5654. @item rm
  5655. @item gm
  5656. @item bm
  5657. Adjust red, green and blue midtones (medium pixels).
  5658. @item rh
  5659. @item gh
  5660. @item bh
  5661. Adjust red, green and blue highlights (brightest pixels).
  5662. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5663. @item pl
  5664. Preserve lightness when changing color balance. Default is disabled.
  5665. @end table
  5666. @subsection Examples
  5667. @itemize
  5668. @item
  5669. Add red color cast to shadows:
  5670. @example
  5671. colorbalance=rs=.3
  5672. @end example
  5673. @end itemize
  5674. @subsection Commands
  5675. This filter supports the all above options as @ref{commands}.
  5676. @section colorchannelmixer
  5677. Adjust video input frames by re-mixing color channels.
  5678. This filter modifies a color channel by adding the values associated to
  5679. the other channels of the same pixels. For example if the value to
  5680. modify is red, the output value will be:
  5681. @example
  5682. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5683. @end example
  5684. The filter accepts the following options:
  5685. @table @option
  5686. @item rr
  5687. @item rg
  5688. @item rb
  5689. @item ra
  5690. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5691. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5692. @item gr
  5693. @item gg
  5694. @item gb
  5695. @item ga
  5696. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5697. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5698. @item br
  5699. @item bg
  5700. @item bb
  5701. @item ba
  5702. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5703. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5704. @item ar
  5705. @item ag
  5706. @item ab
  5707. @item aa
  5708. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5709. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5710. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5711. @end table
  5712. @subsection Examples
  5713. @itemize
  5714. @item
  5715. Convert source to grayscale:
  5716. @example
  5717. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5718. @end example
  5719. @item
  5720. Simulate sepia tones:
  5721. @example
  5722. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5723. @end example
  5724. @end itemize
  5725. @subsection Commands
  5726. This filter supports the all above options as @ref{commands}.
  5727. @section colorkey
  5728. RGB colorspace color keying.
  5729. The filter accepts the following options:
  5730. @table @option
  5731. @item color
  5732. The color which will be replaced with transparency.
  5733. @item similarity
  5734. Similarity percentage with the key color.
  5735. 0.01 matches only the exact key color, while 1.0 matches everything.
  5736. @item blend
  5737. Blend percentage.
  5738. 0.0 makes pixels either fully transparent, or not transparent at all.
  5739. Higher values result in semi-transparent pixels, with a higher transparency
  5740. the more similar the pixels color is to the key color.
  5741. @end table
  5742. @subsection Examples
  5743. @itemize
  5744. @item
  5745. Make every green pixel in the input image transparent:
  5746. @example
  5747. ffmpeg -i input.png -vf colorkey=green out.png
  5748. @end example
  5749. @item
  5750. Overlay a greenscreen-video on top of a static background image.
  5751. @example
  5752. 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
  5753. @end example
  5754. @end itemize
  5755. @subsection Commands
  5756. This filter supports same @ref{commands} as options.
  5757. The command accepts the same syntax of the corresponding option.
  5758. If the specified expression is not valid, it is kept at its current
  5759. value.
  5760. @section colorhold
  5761. Remove all color information for all RGB colors except for certain one.
  5762. The filter accepts the following options:
  5763. @table @option
  5764. @item color
  5765. The color which will not be replaced with neutral gray.
  5766. @item similarity
  5767. Similarity percentage with the above color.
  5768. 0.01 matches only the exact key color, while 1.0 matches everything.
  5769. @item blend
  5770. Blend percentage. 0.0 makes pixels fully gray.
  5771. Higher values result in more preserved color.
  5772. @end table
  5773. @subsection Commands
  5774. This filter supports same @ref{commands} as options.
  5775. The command accepts the same syntax of the corresponding option.
  5776. If the specified expression is not valid, it is kept at its current
  5777. value.
  5778. @section colorlevels
  5779. Adjust video input frames using levels.
  5780. The filter accepts the following options:
  5781. @table @option
  5782. @item rimin
  5783. @item gimin
  5784. @item bimin
  5785. @item aimin
  5786. Adjust red, green, blue and alpha input black point.
  5787. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5788. @item rimax
  5789. @item gimax
  5790. @item bimax
  5791. @item aimax
  5792. Adjust red, green, blue and alpha input white point.
  5793. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5794. Input levels are used to lighten highlights (bright tones), darken shadows
  5795. (dark tones), change the balance of bright and dark tones.
  5796. @item romin
  5797. @item gomin
  5798. @item bomin
  5799. @item aomin
  5800. Adjust red, green, blue and alpha output black point.
  5801. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5802. @item romax
  5803. @item gomax
  5804. @item bomax
  5805. @item aomax
  5806. Adjust red, green, blue and alpha output white point.
  5807. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5808. Output levels allows manual selection of a constrained output level range.
  5809. @end table
  5810. @subsection Examples
  5811. @itemize
  5812. @item
  5813. Make video output darker:
  5814. @example
  5815. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5816. @end example
  5817. @item
  5818. Increase contrast:
  5819. @example
  5820. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5821. @end example
  5822. @item
  5823. Make video output lighter:
  5824. @example
  5825. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5826. @end example
  5827. @item
  5828. Increase brightness:
  5829. @example
  5830. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5831. @end example
  5832. @end itemize
  5833. @subsection Commands
  5834. This filter supports the all above options as @ref{commands}.
  5835. @section colormatrix
  5836. Convert color matrix.
  5837. The filter accepts the following options:
  5838. @table @option
  5839. @item src
  5840. @item dst
  5841. Specify the source and destination color matrix. Both values must be
  5842. specified.
  5843. The accepted values are:
  5844. @table @samp
  5845. @item bt709
  5846. BT.709
  5847. @item fcc
  5848. FCC
  5849. @item bt601
  5850. BT.601
  5851. @item bt470
  5852. BT.470
  5853. @item bt470bg
  5854. BT.470BG
  5855. @item smpte170m
  5856. SMPTE-170M
  5857. @item smpte240m
  5858. SMPTE-240M
  5859. @item bt2020
  5860. BT.2020
  5861. @end table
  5862. @end table
  5863. For example to convert from BT.601 to SMPTE-240M, use the command:
  5864. @example
  5865. colormatrix=bt601:smpte240m
  5866. @end example
  5867. @section colorspace
  5868. Convert colorspace, transfer characteristics or color primaries.
  5869. Input video needs to have an even size.
  5870. The filter accepts the following options:
  5871. @table @option
  5872. @anchor{all}
  5873. @item all
  5874. Specify all color properties at once.
  5875. The accepted values are:
  5876. @table @samp
  5877. @item bt470m
  5878. BT.470M
  5879. @item bt470bg
  5880. BT.470BG
  5881. @item bt601-6-525
  5882. BT.601-6 525
  5883. @item bt601-6-625
  5884. BT.601-6 625
  5885. @item bt709
  5886. BT.709
  5887. @item smpte170m
  5888. SMPTE-170M
  5889. @item smpte240m
  5890. SMPTE-240M
  5891. @item bt2020
  5892. BT.2020
  5893. @end table
  5894. @anchor{space}
  5895. @item space
  5896. Specify output colorspace.
  5897. The accepted values are:
  5898. @table @samp
  5899. @item bt709
  5900. BT.709
  5901. @item fcc
  5902. FCC
  5903. @item bt470bg
  5904. BT.470BG or BT.601-6 625
  5905. @item smpte170m
  5906. SMPTE-170M or BT.601-6 525
  5907. @item smpte240m
  5908. SMPTE-240M
  5909. @item ycgco
  5910. YCgCo
  5911. @item bt2020ncl
  5912. BT.2020 with non-constant luminance
  5913. @end table
  5914. @anchor{trc}
  5915. @item trc
  5916. Specify output transfer characteristics.
  5917. The accepted values are:
  5918. @table @samp
  5919. @item bt709
  5920. BT.709
  5921. @item bt470m
  5922. BT.470M
  5923. @item bt470bg
  5924. BT.470BG
  5925. @item gamma22
  5926. Constant gamma of 2.2
  5927. @item gamma28
  5928. Constant gamma of 2.8
  5929. @item smpte170m
  5930. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5931. @item smpte240m
  5932. SMPTE-240M
  5933. @item srgb
  5934. SRGB
  5935. @item iec61966-2-1
  5936. iec61966-2-1
  5937. @item iec61966-2-4
  5938. iec61966-2-4
  5939. @item xvycc
  5940. xvycc
  5941. @item bt2020-10
  5942. BT.2020 for 10-bits content
  5943. @item bt2020-12
  5944. BT.2020 for 12-bits content
  5945. @end table
  5946. @anchor{primaries}
  5947. @item primaries
  5948. Specify output color primaries.
  5949. The accepted values are:
  5950. @table @samp
  5951. @item bt709
  5952. BT.709
  5953. @item bt470m
  5954. BT.470M
  5955. @item bt470bg
  5956. BT.470BG or BT.601-6 625
  5957. @item smpte170m
  5958. SMPTE-170M or BT.601-6 525
  5959. @item smpte240m
  5960. SMPTE-240M
  5961. @item film
  5962. film
  5963. @item smpte431
  5964. SMPTE-431
  5965. @item smpte432
  5966. SMPTE-432
  5967. @item bt2020
  5968. BT.2020
  5969. @item jedec-p22
  5970. JEDEC P22 phosphors
  5971. @end table
  5972. @anchor{range}
  5973. @item range
  5974. Specify output color range.
  5975. The accepted values are:
  5976. @table @samp
  5977. @item tv
  5978. TV (restricted) range
  5979. @item mpeg
  5980. MPEG (restricted) range
  5981. @item pc
  5982. PC (full) range
  5983. @item jpeg
  5984. JPEG (full) range
  5985. @end table
  5986. @item format
  5987. Specify output color format.
  5988. The accepted values are:
  5989. @table @samp
  5990. @item yuv420p
  5991. YUV 4:2:0 planar 8-bits
  5992. @item yuv420p10
  5993. YUV 4:2:0 planar 10-bits
  5994. @item yuv420p12
  5995. YUV 4:2:0 planar 12-bits
  5996. @item yuv422p
  5997. YUV 4:2:2 planar 8-bits
  5998. @item yuv422p10
  5999. YUV 4:2:2 planar 10-bits
  6000. @item yuv422p12
  6001. YUV 4:2:2 planar 12-bits
  6002. @item yuv444p
  6003. YUV 4:4:4 planar 8-bits
  6004. @item yuv444p10
  6005. YUV 4:4:4 planar 10-bits
  6006. @item yuv444p12
  6007. YUV 4:4:4 planar 12-bits
  6008. @end table
  6009. @item fast
  6010. Do a fast conversion, which skips gamma/primary correction. This will take
  6011. significantly less CPU, but will be mathematically incorrect. To get output
  6012. compatible with that produced by the colormatrix filter, use fast=1.
  6013. @item dither
  6014. Specify dithering mode.
  6015. The accepted values are:
  6016. @table @samp
  6017. @item none
  6018. No dithering
  6019. @item fsb
  6020. Floyd-Steinberg dithering
  6021. @end table
  6022. @item wpadapt
  6023. Whitepoint adaptation mode.
  6024. The accepted values are:
  6025. @table @samp
  6026. @item bradford
  6027. Bradford whitepoint adaptation
  6028. @item vonkries
  6029. von Kries whitepoint adaptation
  6030. @item identity
  6031. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6032. @end table
  6033. @item iall
  6034. Override all input properties at once. Same accepted values as @ref{all}.
  6035. @item ispace
  6036. Override input colorspace. Same accepted values as @ref{space}.
  6037. @item iprimaries
  6038. Override input color primaries. Same accepted values as @ref{primaries}.
  6039. @item itrc
  6040. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6041. @item irange
  6042. Override input color range. Same accepted values as @ref{range}.
  6043. @end table
  6044. The filter converts the transfer characteristics, color space and color
  6045. primaries to the specified user values. The output value, if not specified,
  6046. is set to a default value based on the "all" property. If that property is
  6047. also not specified, the filter will log an error. The output color range and
  6048. format default to the same value as the input color range and format. The
  6049. input transfer characteristics, color space, color primaries and color range
  6050. should be set on the input data. If any of these are missing, the filter will
  6051. log an error and no conversion will take place.
  6052. For example to convert the input to SMPTE-240M, use the command:
  6053. @example
  6054. colorspace=smpte240m
  6055. @end example
  6056. @section convolution
  6057. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6058. The filter accepts the following options:
  6059. @table @option
  6060. @item 0m
  6061. @item 1m
  6062. @item 2m
  6063. @item 3m
  6064. Set matrix for each plane.
  6065. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6066. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6067. @item 0rdiv
  6068. @item 1rdiv
  6069. @item 2rdiv
  6070. @item 3rdiv
  6071. Set multiplier for calculated value for each plane.
  6072. If unset or 0, it will be sum of all matrix elements.
  6073. @item 0bias
  6074. @item 1bias
  6075. @item 2bias
  6076. @item 3bias
  6077. Set bias for each plane. This value is added to the result of the multiplication.
  6078. Useful for making the overall image brighter or darker. Default is 0.0.
  6079. @item 0mode
  6080. @item 1mode
  6081. @item 2mode
  6082. @item 3mode
  6083. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6084. Default is @var{square}.
  6085. @end table
  6086. @subsection Examples
  6087. @itemize
  6088. @item
  6089. Apply sharpen:
  6090. @example
  6091. 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"
  6092. @end example
  6093. @item
  6094. Apply blur:
  6095. @example
  6096. 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"
  6097. @end example
  6098. @item
  6099. Apply edge enhance:
  6100. @example
  6101. 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"
  6102. @end example
  6103. @item
  6104. Apply edge detect:
  6105. @example
  6106. 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"
  6107. @end example
  6108. @item
  6109. Apply laplacian edge detector which includes diagonals:
  6110. @example
  6111. 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"
  6112. @end example
  6113. @item
  6114. Apply emboss:
  6115. @example
  6116. 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"
  6117. @end example
  6118. @end itemize
  6119. @section convolve
  6120. Apply 2D convolution of video stream in frequency domain using second stream
  6121. as impulse.
  6122. The filter accepts the following options:
  6123. @table @option
  6124. @item planes
  6125. Set which planes to process.
  6126. @item impulse
  6127. Set which impulse video frames will be processed, can be @var{first}
  6128. or @var{all}. Default is @var{all}.
  6129. @end table
  6130. The @code{convolve} filter also supports the @ref{framesync} options.
  6131. @section copy
  6132. Copy the input video source unchanged to the output. This is mainly useful for
  6133. testing purposes.
  6134. @anchor{coreimage}
  6135. @section coreimage
  6136. Video filtering on GPU using Apple's CoreImage API on OSX.
  6137. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6138. processed by video hardware. However, software-based OpenGL implementations
  6139. exist which means there is no guarantee for hardware processing. It depends on
  6140. the respective OSX.
  6141. There are many filters and image generators provided by Apple that come with a
  6142. large variety of options. The filter has to be referenced by its name along
  6143. with its options.
  6144. The coreimage filter accepts the following options:
  6145. @table @option
  6146. @item list_filters
  6147. List all available filters and generators along with all their respective
  6148. options as well as possible minimum and maximum values along with the default
  6149. values.
  6150. @example
  6151. list_filters=true
  6152. @end example
  6153. @item filter
  6154. Specify all filters by their respective name and options.
  6155. Use @var{list_filters} to determine all valid filter names and options.
  6156. Numerical options are specified by a float value and are automatically clamped
  6157. to their respective value range. Vector and color options have to be specified
  6158. by a list of space separated float values. Character escaping has to be done.
  6159. A special option name @code{default} is available to use default options for a
  6160. filter.
  6161. It is required to specify either @code{default} or at least one of the filter options.
  6162. All omitted options are used with their default values.
  6163. The syntax of the filter string is as follows:
  6164. @example
  6165. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6166. @end example
  6167. @item output_rect
  6168. Specify a rectangle where the output of the filter chain is copied into the
  6169. input image. It is given by a list of space separated float values:
  6170. @example
  6171. output_rect=x\ y\ width\ height
  6172. @end example
  6173. If not given, the output rectangle equals the dimensions of the input image.
  6174. The output rectangle is automatically cropped at the borders of the input
  6175. image. Negative values are valid for each component.
  6176. @example
  6177. output_rect=25\ 25\ 100\ 100
  6178. @end example
  6179. @end table
  6180. Several filters can be chained for successive processing without GPU-HOST
  6181. transfers allowing for fast processing of complex filter chains.
  6182. Currently, only filters with zero (generators) or exactly one (filters) input
  6183. image and one output image are supported. Also, transition filters are not yet
  6184. usable as intended.
  6185. Some filters generate output images with additional padding depending on the
  6186. respective filter kernel. The padding is automatically removed to ensure the
  6187. filter output has the same size as the input image.
  6188. For image generators, the size of the output image is determined by the
  6189. previous output image of the filter chain or the input image of the whole
  6190. filterchain, respectively. The generators do not use the pixel information of
  6191. this image to generate their output. However, the generated output is
  6192. blended onto this image, resulting in partial or complete coverage of the
  6193. output image.
  6194. The @ref{coreimagesrc} video source can be used for generating input images
  6195. which are directly fed into the filter chain. By using it, providing input
  6196. images by another video source or an input video is not required.
  6197. @subsection Examples
  6198. @itemize
  6199. @item
  6200. List all filters available:
  6201. @example
  6202. coreimage=list_filters=true
  6203. @end example
  6204. @item
  6205. Use the CIBoxBlur filter with default options to blur an image:
  6206. @example
  6207. coreimage=filter=CIBoxBlur@@default
  6208. @end example
  6209. @item
  6210. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6211. its center at 100x100 and a radius of 50 pixels:
  6212. @example
  6213. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6214. @end example
  6215. @item
  6216. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6217. given as complete and escaped command-line for Apple's standard bash shell:
  6218. @example
  6219. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6220. @end example
  6221. @end itemize
  6222. @section cover_rect
  6223. Cover a rectangular object
  6224. It accepts the following options:
  6225. @table @option
  6226. @item cover
  6227. Filepath of the optional cover image, needs to be in yuv420.
  6228. @item mode
  6229. Set covering mode.
  6230. It accepts the following values:
  6231. @table @samp
  6232. @item cover
  6233. cover it by the supplied image
  6234. @item blur
  6235. cover it by interpolating the surrounding pixels
  6236. @end table
  6237. Default value is @var{blur}.
  6238. @end table
  6239. @subsection Examples
  6240. @itemize
  6241. @item
  6242. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6243. @example
  6244. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6245. @end example
  6246. @end itemize
  6247. @section crop
  6248. Crop the input video to given dimensions.
  6249. It accepts the following parameters:
  6250. @table @option
  6251. @item w, out_w
  6252. The width of the output video. It defaults to @code{iw}.
  6253. This expression is evaluated only once during the filter
  6254. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6255. @item h, out_h
  6256. The height of the output video. It defaults to @code{ih}.
  6257. This expression is evaluated only once during the filter
  6258. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6259. @item x
  6260. The horizontal position, in the input video, of the left edge of the output
  6261. video. It defaults to @code{(in_w-out_w)/2}.
  6262. This expression is evaluated per-frame.
  6263. @item y
  6264. The vertical position, in the input video, of the top edge of the output video.
  6265. It defaults to @code{(in_h-out_h)/2}.
  6266. This expression is evaluated per-frame.
  6267. @item keep_aspect
  6268. If set to 1 will force the output display aspect ratio
  6269. to be the same of the input, by changing the output sample aspect
  6270. ratio. It defaults to 0.
  6271. @item exact
  6272. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6273. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6274. It defaults to 0.
  6275. @end table
  6276. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6277. expressions containing the following constants:
  6278. @table @option
  6279. @item x
  6280. @item y
  6281. The computed values for @var{x} and @var{y}. They are evaluated for
  6282. each new frame.
  6283. @item in_w
  6284. @item in_h
  6285. The input width and height.
  6286. @item iw
  6287. @item ih
  6288. These are the same as @var{in_w} and @var{in_h}.
  6289. @item out_w
  6290. @item out_h
  6291. The output (cropped) width and height.
  6292. @item ow
  6293. @item oh
  6294. These are the same as @var{out_w} and @var{out_h}.
  6295. @item a
  6296. same as @var{iw} / @var{ih}
  6297. @item sar
  6298. input sample aspect ratio
  6299. @item dar
  6300. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6301. @item hsub
  6302. @item vsub
  6303. horizontal and vertical chroma subsample values. For example for the
  6304. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6305. @item n
  6306. The number of the input frame, starting from 0.
  6307. @item pos
  6308. the position in the file of the input frame, NAN if unknown
  6309. @item t
  6310. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6311. @end table
  6312. The expression for @var{out_w} may depend on the value of @var{out_h},
  6313. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6314. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6315. evaluated after @var{out_w} and @var{out_h}.
  6316. The @var{x} and @var{y} parameters specify the expressions for the
  6317. position of the top-left corner of the output (non-cropped) area. They
  6318. are evaluated for each frame. If the evaluated value is not valid, it
  6319. is approximated to the nearest valid value.
  6320. The expression for @var{x} may depend on @var{y}, and the expression
  6321. for @var{y} may depend on @var{x}.
  6322. @subsection Examples
  6323. @itemize
  6324. @item
  6325. Crop area with size 100x100 at position (12,34).
  6326. @example
  6327. crop=100:100:12:34
  6328. @end example
  6329. Using named options, the example above becomes:
  6330. @example
  6331. crop=w=100:h=100:x=12:y=34
  6332. @end example
  6333. @item
  6334. Crop the central input area with size 100x100:
  6335. @example
  6336. crop=100:100
  6337. @end example
  6338. @item
  6339. Crop the central input area with size 2/3 of the input video:
  6340. @example
  6341. crop=2/3*in_w:2/3*in_h
  6342. @end example
  6343. @item
  6344. Crop the input video central square:
  6345. @example
  6346. crop=out_w=in_h
  6347. crop=in_h
  6348. @end example
  6349. @item
  6350. Delimit the rectangle with the top-left corner placed at position
  6351. 100:100 and the right-bottom corner corresponding to the right-bottom
  6352. corner of the input image.
  6353. @example
  6354. crop=in_w-100:in_h-100:100:100
  6355. @end example
  6356. @item
  6357. Crop 10 pixels from the left and right borders, and 20 pixels from
  6358. the top and bottom borders
  6359. @example
  6360. crop=in_w-2*10:in_h-2*20
  6361. @end example
  6362. @item
  6363. Keep only the bottom right quarter of the input image:
  6364. @example
  6365. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6366. @end example
  6367. @item
  6368. Crop height for getting Greek harmony:
  6369. @example
  6370. crop=in_w:1/PHI*in_w
  6371. @end example
  6372. @item
  6373. Apply trembling effect:
  6374. @example
  6375. 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)
  6376. @end example
  6377. @item
  6378. Apply erratic camera effect depending on timestamp:
  6379. @example
  6380. 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)"
  6381. @end example
  6382. @item
  6383. Set x depending on the value of y:
  6384. @example
  6385. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6386. @end example
  6387. @end itemize
  6388. @subsection Commands
  6389. This filter supports the following commands:
  6390. @table @option
  6391. @item w, out_w
  6392. @item h, out_h
  6393. @item x
  6394. @item y
  6395. Set width/height of the output video and the horizontal/vertical position
  6396. in the input video.
  6397. The command accepts the same syntax of the corresponding option.
  6398. If the specified expression is not valid, it is kept at its current
  6399. value.
  6400. @end table
  6401. @section cropdetect
  6402. Auto-detect the crop size.
  6403. It calculates the necessary cropping parameters and prints the
  6404. recommended parameters via the logging system. The detected dimensions
  6405. correspond to the non-black area of the input video.
  6406. It accepts the following parameters:
  6407. @table @option
  6408. @item limit
  6409. Set higher black value threshold, which can be optionally specified
  6410. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6411. value greater to the set value is considered non-black. It defaults to 24.
  6412. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6413. on the bitdepth of the pixel format.
  6414. @item round
  6415. The value which the width/height should be divisible by. It defaults to
  6416. 16. The offset is automatically adjusted to center the video. Use 2 to
  6417. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6418. encoding to most video codecs.
  6419. @item reset_count, reset
  6420. Set the counter that determines after how many frames cropdetect will
  6421. reset the previously detected largest video area and start over to
  6422. detect the current optimal crop area. Default value is 0.
  6423. This can be useful when channel logos distort the video area. 0
  6424. indicates 'never reset', and returns the largest area encountered during
  6425. playback.
  6426. @end table
  6427. @anchor{cue}
  6428. @section cue
  6429. Delay video filtering until a given wallclock timestamp. The filter first
  6430. passes on @option{preroll} amount of frames, then it buffers at most
  6431. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6432. it forwards the buffered frames and also any subsequent frames coming in its
  6433. input.
  6434. The filter can be used synchronize the output of multiple ffmpeg processes for
  6435. realtime output devices like decklink. By putting the delay in the filtering
  6436. chain and pre-buffering frames the process can pass on data to output almost
  6437. immediately after the target wallclock timestamp is reached.
  6438. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6439. some use cases.
  6440. @table @option
  6441. @item cue
  6442. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6443. @item preroll
  6444. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6445. @item buffer
  6446. The maximum duration of content to buffer before waiting for the cue expressed
  6447. in seconds. Default is 0.
  6448. @end table
  6449. @anchor{curves}
  6450. @section curves
  6451. Apply color adjustments using curves.
  6452. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6453. component (red, green and blue) has its values defined by @var{N} key points
  6454. tied from each other using a smooth curve. The x-axis represents the pixel
  6455. values from the input frame, and the y-axis the new pixel values to be set for
  6456. the output frame.
  6457. By default, a component curve is defined by the two points @var{(0;0)} and
  6458. @var{(1;1)}. This creates a straight line where each original pixel value is
  6459. "adjusted" to its own value, which means no change to the image.
  6460. The filter allows you to redefine these two points and add some more. A new
  6461. curve (using a natural cubic spline interpolation) will be define to pass
  6462. smoothly through all these new coordinates. The new defined points needs to be
  6463. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6464. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6465. the vector spaces, the values will be clipped accordingly.
  6466. The filter accepts the following options:
  6467. @table @option
  6468. @item preset
  6469. Select one of the available color presets. This option can be used in addition
  6470. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6471. options takes priority on the preset values.
  6472. Available presets are:
  6473. @table @samp
  6474. @item none
  6475. @item color_negative
  6476. @item cross_process
  6477. @item darker
  6478. @item increase_contrast
  6479. @item lighter
  6480. @item linear_contrast
  6481. @item medium_contrast
  6482. @item negative
  6483. @item strong_contrast
  6484. @item vintage
  6485. @end table
  6486. Default is @code{none}.
  6487. @item master, m
  6488. Set the master key points. These points will define a second pass mapping. It
  6489. is sometimes called a "luminance" or "value" mapping. It can be used with
  6490. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6491. post-processing LUT.
  6492. @item red, r
  6493. Set the key points for the red component.
  6494. @item green, g
  6495. Set the key points for the green component.
  6496. @item blue, b
  6497. Set the key points for the blue component.
  6498. @item all
  6499. Set the key points for all components (not including master).
  6500. Can be used in addition to the other key points component
  6501. options. In this case, the unset component(s) will fallback on this
  6502. @option{all} setting.
  6503. @item psfile
  6504. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6505. @item plot
  6506. Save Gnuplot script of the curves in specified file.
  6507. @end table
  6508. To avoid some filtergraph syntax conflicts, each key points list need to be
  6509. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6510. @subsection Examples
  6511. @itemize
  6512. @item
  6513. Increase slightly the middle level of blue:
  6514. @example
  6515. curves=blue='0/0 0.5/0.58 1/1'
  6516. @end example
  6517. @item
  6518. Vintage effect:
  6519. @example
  6520. 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'
  6521. @end example
  6522. Here we obtain the following coordinates for each components:
  6523. @table @var
  6524. @item red
  6525. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6526. @item green
  6527. @code{(0;0) (0.50;0.48) (1;1)}
  6528. @item blue
  6529. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6530. @end table
  6531. @item
  6532. The previous example can also be achieved with the associated built-in preset:
  6533. @example
  6534. curves=preset=vintage
  6535. @end example
  6536. @item
  6537. Or simply:
  6538. @example
  6539. curves=vintage
  6540. @end example
  6541. @item
  6542. Use a Photoshop preset and redefine the points of the green component:
  6543. @example
  6544. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6545. @end example
  6546. @item
  6547. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6548. and @command{gnuplot}:
  6549. @example
  6550. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6551. gnuplot -p /tmp/curves.plt
  6552. @end example
  6553. @end itemize
  6554. @section datascope
  6555. Video data analysis filter.
  6556. This filter shows hexadecimal pixel values of part of video.
  6557. The filter accepts the following options:
  6558. @table @option
  6559. @item size, s
  6560. Set output video size.
  6561. @item x
  6562. Set x offset from where to pick pixels.
  6563. @item y
  6564. Set y offset from where to pick pixels.
  6565. @item mode
  6566. Set scope mode, can be one of the following:
  6567. @table @samp
  6568. @item mono
  6569. Draw hexadecimal pixel values with white color on black background.
  6570. @item color
  6571. Draw hexadecimal pixel values with input video pixel color on black
  6572. background.
  6573. @item color2
  6574. Draw hexadecimal pixel values on color background picked from input video,
  6575. the text color is picked in such way so its always visible.
  6576. @end table
  6577. @item axis
  6578. Draw rows and columns numbers on left and top of video.
  6579. @item opacity
  6580. Set background opacity.
  6581. @item format
  6582. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6583. @end table
  6584. @section dblur
  6585. Apply Directional blur filter.
  6586. The filter accepts the following options:
  6587. @table @option
  6588. @item angle
  6589. Set angle of directional blur. Default is @code{45}.
  6590. @item radius
  6591. Set radius of directional blur. Default is @code{5}.
  6592. @item planes
  6593. Set which planes to filter. By default all planes are filtered.
  6594. @end table
  6595. @subsection Commands
  6596. This filter supports same @ref{commands} as options.
  6597. The command accepts the same syntax of the corresponding option.
  6598. If the specified expression is not valid, it is kept at its current
  6599. value.
  6600. @section dctdnoiz
  6601. Denoise frames using 2D DCT (frequency domain filtering).
  6602. This filter is not designed for real time.
  6603. The filter accepts the following options:
  6604. @table @option
  6605. @item sigma, s
  6606. Set the noise sigma constant.
  6607. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6608. coefficient (absolute value) below this threshold with be dropped.
  6609. If you need a more advanced filtering, see @option{expr}.
  6610. Default is @code{0}.
  6611. @item overlap
  6612. Set number overlapping pixels for each block. Since the filter can be slow, you
  6613. may want to reduce this value, at the cost of a less effective filter and the
  6614. risk of various artefacts.
  6615. If the overlapping value doesn't permit processing the whole input width or
  6616. height, a warning will be displayed and according borders won't be denoised.
  6617. Default value is @var{blocksize}-1, which is the best possible setting.
  6618. @item expr, e
  6619. Set the coefficient factor expression.
  6620. For each coefficient of a DCT block, this expression will be evaluated as a
  6621. multiplier value for the coefficient.
  6622. If this is option is set, the @option{sigma} option will be ignored.
  6623. The absolute value of the coefficient can be accessed through the @var{c}
  6624. variable.
  6625. @item n
  6626. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6627. @var{blocksize}, which is the width and height of the processed blocks.
  6628. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6629. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6630. on the speed processing. Also, a larger block size does not necessarily means a
  6631. better de-noising.
  6632. @end table
  6633. @subsection Examples
  6634. Apply a denoise with a @option{sigma} of @code{4.5}:
  6635. @example
  6636. dctdnoiz=4.5
  6637. @end example
  6638. The same operation can be achieved using the expression system:
  6639. @example
  6640. dctdnoiz=e='gte(c, 4.5*3)'
  6641. @end example
  6642. Violent denoise using a block size of @code{16x16}:
  6643. @example
  6644. dctdnoiz=15:n=4
  6645. @end example
  6646. @section deband
  6647. Remove banding artifacts from input video.
  6648. It works by replacing banded pixels with average value of referenced pixels.
  6649. The filter accepts the following options:
  6650. @table @option
  6651. @item 1thr
  6652. @item 2thr
  6653. @item 3thr
  6654. @item 4thr
  6655. Set banding detection threshold for each plane. Default is 0.02.
  6656. Valid range is 0.00003 to 0.5.
  6657. If difference between current pixel and reference pixel is less than threshold,
  6658. it will be considered as banded.
  6659. @item range, r
  6660. Banding detection range in pixels. Default is 16. If positive, random number
  6661. in range 0 to set value will be used. If negative, exact absolute value
  6662. will be used.
  6663. The range defines square of four pixels around current pixel.
  6664. @item direction, d
  6665. Set direction in radians from which four pixel will be compared. If positive,
  6666. random direction from 0 to set direction will be picked. If negative, exact of
  6667. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6668. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6669. column.
  6670. @item blur, b
  6671. If enabled, current pixel is compared with average value of all four
  6672. surrounding pixels. The default is enabled. If disabled current pixel is
  6673. compared with all four surrounding pixels. The pixel is considered banded
  6674. if only all four differences with surrounding pixels are less than threshold.
  6675. @item coupling, c
  6676. If enabled, current pixel is changed if and only if all pixel components are banded,
  6677. e.g. banding detection threshold is triggered for all color components.
  6678. The default is disabled.
  6679. @end table
  6680. @section deblock
  6681. Remove blocking artifacts from input video.
  6682. The filter accepts the following options:
  6683. @table @option
  6684. @item filter
  6685. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6686. This controls what kind of deblocking is applied.
  6687. @item block
  6688. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6689. @item alpha
  6690. @item beta
  6691. @item gamma
  6692. @item delta
  6693. Set blocking detection thresholds. Allowed range is 0 to 1.
  6694. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6695. Using higher threshold gives more deblocking strength.
  6696. Setting @var{alpha} controls threshold detection at exact edge of block.
  6697. Remaining options controls threshold detection near the edge. Each one for
  6698. below/above or left/right. Setting any of those to @var{0} disables
  6699. deblocking.
  6700. @item planes
  6701. Set planes to filter. Default is to filter all available planes.
  6702. @end table
  6703. @subsection Examples
  6704. @itemize
  6705. @item
  6706. Deblock using weak filter and block size of 4 pixels.
  6707. @example
  6708. deblock=filter=weak:block=4
  6709. @end example
  6710. @item
  6711. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6712. deblocking more edges.
  6713. @example
  6714. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6715. @end example
  6716. @item
  6717. Similar as above, but filter only first plane.
  6718. @example
  6719. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6720. @end example
  6721. @item
  6722. Similar as above, but filter only second and third plane.
  6723. @example
  6724. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6725. @end example
  6726. @end itemize
  6727. @anchor{decimate}
  6728. @section decimate
  6729. Drop duplicated frames at regular intervals.
  6730. The filter accepts the following options:
  6731. @table @option
  6732. @item cycle
  6733. Set the number of frames from which one will be dropped. Setting this to
  6734. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6735. Default is @code{5}.
  6736. @item dupthresh
  6737. Set the threshold for duplicate detection. If the difference metric for a frame
  6738. is less than or equal to this value, then it is declared as duplicate. Default
  6739. is @code{1.1}
  6740. @item scthresh
  6741. Set scene change threshold. Default is @code{15}.
  6742. @item blockx
  6743. @item blocky
  6744. Set the size of the x and y-axis blocks used during metric calculations.
  6745. Larger blocks give better noise suppression, but also give worse detection of
  6746. small movements. Must be a power of two. Default is @code{32}.
  6747. @item ppsrc
  6748. Mark main input as a pre-processed input and activate clean source input
  6749. stream. This allows the input to be pre-processed with various filters to help
  6750. the metrics calculation while keeping the frame selection lossless. When set to
  6751. @code{1}, the first stream is for the pre-processed input, and the second
  6752. stream is the clean source from where the kept frames are chosen. Default is
  6753. @code{0}.
  6754. @item chroma
  6755. Set whether or not chroma is considered in the metric calculations. Default is
  6756. @code{1}.
  6757. @end table
  6758. @section deconvolve
  6759. Apply 2D deconvolution of video stream in frequency domain using second stream
  6760. as impulse.
  6761. The filter accepts the following options:
  6762. @table @option
  6763. @item planes
  6764. Set which planes to process.
  6765. @item impulse
  6766. Set which impulse video frames will be processed, can be @var{first}
  6767. or @var{all}. Default is @var{all}.
  6768. @item noise
  6769. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6770. and height are not same and not power of 2 or if stream prior to convolving
  6771. had noise.
  6772. @end table
  6773. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6774. @section dedot
  6775. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6776. It accepts the following options:
  6777. @table @option
  6778. @item m
  6779. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6780. @var{rainbows} for cross-color reduction.
  6781. @item lt
  6782. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6783. @item tl
  6784. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6785. @item tc
  6786. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6787. @item ct
  6788. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6789. @end table
  6790. @section deflate
  6791. Apply deflate effect to the video.
  6792. This filter replaces the pixel by the local(3x3) average by taking into account
  6793. only values lower than the pixel.
  6794. It accepts the following options:
  6795. @table @option
  6796. @item threshold0
  6797. @item threshold1
  6798. @item threshold2
  6799. @item threshold3
  6800. Limit the maximum change for each plane, default is 65535.
  6801. If 0, plane will remain unchanged.
  6802. @end table
  6803. @subsection Commands
  6804. This filter supports the all above options as @ref{commands}.
  6805. @section deflicker
  6806. Remove temporal frame luminance variations.
  6807. It accepts the following options:
  6808. @table @option
  6809. @item size, s
  6810. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6811. @item mode, m
  6812. Set averaging mode to smooth temporal luminance variations.
  6813. Available values are:
  6814. @table @samp
  6815. @item am
  6816. Arithmetic mean
  6817. @item gm
  6818. Geometric mean
  6819. @item hm
  6820. Harmonic mean
  6821. @item qm
  6822. Quadratic mean
  6823. @item cm
  6824. Cubic mean
  6825. @item pm
  6826. Power mean
  6827. @item median
  6828. Median
  6829. @end table
  6830. @item bypass
  6831. Do not actually modify frame. Useful when one only wants metadata.
  6832. @end table
  6833. @section dejudder
  6834. Remove judder produced by partially interlaced telecined content.
  6835. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6836. source was partially telecined content then the output of @code{pullup,dejudder}
  6837. will have a variable frame rate. May change the recorded frame rate of the
  6838. container. Aside from that change, this filter will not affect constant frame
  6839. rate video.
  6840. The option available in this filter is:
  6841. @table @option
  6842. @item cycle
  6843. Specify the length of the window over which the judder repeats.
  6844. Accepts any integer greater than 1. Useful values are:
  6845. @table @samp
  6846. @item 4
  6847. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6848. @item 5
  6849. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6850. @item 20
  6851. If a mixture of the two.
  6852. @end table
  6853. The default is @samp{4}.
  6854. @end table
  6855. @section delogo
  6856. Suppress a TV station logo by a simple interpolation of the surrounding
  6857. pixels. Just set a rectangle covering the logo and watch it disappear
  6858. (and sometimes something even uglier appear - your mileage may vary).
  6859. It accepts the following parameters:
  6860. @table @option
  6861. @item x
  6862. @item y
  6863. Specify the top left corner coordinates of the logo. They must be
  6864. specified.
  6865. @item w
  6866. @item h
  6867. Specify the width and height of the logo to clear. They must be
  6868. specified.
  6869. @item band, t
  6870. Specify the thickness of the fuzzy edge of the rectangle (added to
  6871. @var{w} and @var{h}). The default value is 1. This option is
  6872. deprecated, setting higher values should no longer be necessary and
  6873. is not recommended.
  6874. @item show
  6875. When set to 1, a green rectangle is drawn on the screen to simplify
  6876. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6877. The default value is 0.
  6878. The rectangle is drawn on the outermost pixels which will be (partly)
  6879. replaced with interpolated values. The values of the next pixels
  6880. immediately outside this rectangle in each direction will be used to
  6881. compute the interpolated pixel values inside the rectangle.
  6882. @end table
  6883. @subsection Examples
  6884. @itemize
  6885. @item
  6886. Set a rectangle covering the area with top left corner coordinates 0,0
  6887. and size 100x77, and a band of size 10:
  6888. @example
  6889. delogo=x=0:y=0:w=100:h=77:band=10
  6890. @end example
  6891. @end itemize
  6892. @anchor{derain}
  6893. @section derain
  6894. Remove the rain in the input image/video by applying the derain methods based on
  6895. convolutional neural networks. Supported models:
  6896. @itemize
  6897. @item
  6898. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6899. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6900. @end itemize
  6901. Training as well as model generation scripts are provided in
  6902. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6903. Native model files (.model) can be generated from TensorFlow model
  6904. files (.pb) by using tools/python/convert.py
  6905. The filter accepts the following options:
  6906. @table @option
  6907. @item filter_type
  6908. Specify which filter to use. This option accepts the following values:
  6909. @table @samp
  6910. @item derain
  6911. Derain filter. To conduct derain filter, you need to use a derain model.
  6912. @item dehaze
  6913. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6914. @end table
  6915. Default value is @samp{derain}.
  6916. @item dnn_backend
  6917. Specify which DNN backend to use for model loading and execution. This option accepts
  6918. the following values:
  6919. @table @samp
  6920. @item native
  6921. Native implementation of DNN loading and execution.
  6922. @item tensorflow
  6923. TensorFlow backend. To enable this backend you
  6924. need to install the TensorFlow for C library (see
  6925. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6926. @code{--enable-libtensorflow}
  6927. @end table
  6928. Default value is @samp{native}.
  6929. @item model
  6930. Set path to model file specifying network architecture and its parameters.
  6931. Note that different backends use different file formats. TensorFlow and native
  6932. backend can load files for only its format.
  6933. @end table
  6934. It can also be finished with @ref{dnn_processing} filter.
  6935. @section deshake
  6936. Attempt to fix small changes in horizontal and/or vertical shift. This
  6937. filter helps remove camera shake from hand-holding a camera, bumping a
  6938. tripod, moving on a vehicle, etc.
  6939. The filter accepts the following options:
  6940. @table @option
  6941. @item x
  6942. @item y
  6943. @item w
  6944. @item h
  6945. Specify a rectangular area where to limit the search for motion
  6946. vectors.
  6947. If desired the search for motion vectors can be limited to a
  6948. rectangular area of the frame defined by its top left corner, width
  6949. and height. These parameters have the same meaning as the drawbox
  6950. filter which can be used to visualise the position of the bounding
  6951. box.
  6952. This is useful when simultaneous movement of subjects within the frame
  6953. might be confused for camera motion by the motion vector search.
  6954. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6955. then the full frame is used. This allows later options to be set
  6956. without specifying the bounding box for the motion vector search.
  6957. Default - search the whole frame.
  6958. @item rx
  6959. @item ry
  6960. Specify the maximum extent of movement in x and y directions in the
  6961. range 0-64 pixels. Default 16.
  6962. @item edge
  6963. Specify how to generate pixels to fill blanks at the edge of the
  6964. frame. Available values are:
  6965. @table @samp
  6966. @item blank, 0
  6967. Fill zeroes at blank locations
  6968. @item original, 1
  6969. Original image at blank locations
  6970. @item clamp, 2
  6971. Extruded edge value at blank locations
  6972. @item mirror, 3
  6973. Mirrored edge at blank locations
  6974. @end table
  6975. Default value is @samp{mirror}.
  6976. @item blocksize
  6977. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6978. default 8.
  6979. @item contrast
  6980. Specify the contrast threshold for blocks. Only blocks with more than
  6981. the specified contrast (difference between darkest and lightest
  6982. pixels) will be considered. Range 1-255, default 125.
  6983. @item search
  6984. Specify the search strategy. Available values are:
  6985. @table @samp
  6986. @item exhaustive, 0
  6987. Set exhaustive search
  6988. @item less, 1
  6989. Set less exhaustive search.
  6990. @end table
  6991. Default value is @samp{exhaustive}.
  6992. @item filename
  6993. If set then a detailed log of the motion search is written to the
  6994. specified file.
  6995. @end table
  6996. @section despill
  6997. Remove unwanted contamination of foreground colors, caused by reflected color of
  6998. greenscreen or bluescreen.
  6999. This filter accepts the following options:
  7000. @table @option
  7001. @item type
  7002. Set what type of despill to use.
  7003. @item mix
  7004. Set how spillmap will be generated.
  7005. @item expand
  7006. Set how much to get rid of still remaining spill.
  7007. @item red
  7008. Controls amount of red in spill area.
  7009. @item green
  7010. Controls amount of green in spill area.
  7011. Should be -1 for greenscreen.
  7012. @item blue
  7013. Controls amount of blue in spill area.
  7014. Should be -1 for bluescreen.
  7015. @item brightness
  7016. Controls brightness of spill area, preserving colors.
  7017. @item alpha
  7018. Modify alpha from generated spillmap.
  7019. @end table
  7020. @section detelecine
  7021. Apply an exact inverse of the telecine operation. It requires a predefined
  7022. pattern specified using the pattern option which must be the same as that passed
  7023. to the telecine filter.
  7024. This filter accepts the following options:
  7025. @table @option
  7026. @item first_field
  7027. @table @samp
  7028. @item top, t
  7029. top field first
  7030. @item bottom, b
  7031. bottom field first
  7032. The default value is @code{top}.
  7033. @end table
  7034. @item pattern
  7035. A string of numbers representing the pulldown pattern you wish to apply.
  7036. The default value is @code{23}.
  7037. @item start_frame
  7038. A number representing position of the first frame with respect to the telecine
  7039. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7040. @end table
  7041. @section dilation
  7042. Apply dilation effect to the video.
  7043. This filter replaces the pixel by the local(3x3) maximum.
  7044. It accepts the following options:
  7045. @table @option
  7046. @item threshold0
  7047. @item threshold1
  7048. @item threshold2
  7049. @item threshold3
  7050. Limit the maximum change for each plane, default is 65535.
  7051. If 0, plane will remain unchanged.
  7052. @item coordinates
  7053. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7054. pixels are used.
  7055. Flags to local 3x3 coordinates maps like this:
  7056. 1 2 3
  7057. 4 5
  7058. 6 7 8
  7059. @end table
  7060. @subsection Commands
  7061. This filter supports the all above options as @ref{commands}.
  7062. @section displace
  7063. Displace pixels as indicated by second and third input stream.
  7064. It takes three input streams and outputs one stream, the first input is the
  7065. source, and second and third input are displacement maps.
  7066. The second input specifies how much to displace pixels along the
  7067. x-axis, while the third input specifies how much to displace pixels
  7068. along the y-axis.
  7069. If one of displacement map streams terminates, last frame from that
  7070. displacement map will be used.
  7071. Note that once generated, displacements maps can be reused over and over again.
  7072. A description of the accepted options follows.
  7073. @table @option
  7074. @item edge
  7075. Set displace behavior for pixels that are out of range.
  7076. Available values are:
  7077. @table @samp
  7078. @item blank
  7079. Missing pixels are replaced by black pixels.
  7080. @item smear
  7081. Adjacent pixels will spread out to replace missing pixels.
  7082. @item wrap
  7083. Out of range pixels are wrapped so they point to pixels of other side.
  7084. @item mirror
  7085. Out of range pixels will be replaced with mirrored pixels.
  7086. @end table
  7087. Default is @samp{smear}.
  7088. @end table
  7089. @subsection Examples
  7090. @itemize
  7091. @item
  7092. Add ripple effect to rgb input of video size hd720:
  7093. @example
  7094. 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
  7095. @end example
  7096. @item
  7097. Add wave effect to rgb input of video size hd720:
  7098. @example
  7099. 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
  7100. @end example
  7101. @end itemize
  7102. @anchor{dnn_processing}
  7103. @section dnn_processing
  7104. Do image processing with deep neural networks. It works together with another filter
  7105. which converts the pixel format of the Frame to what the dnn network requires.
  7106. The filter accepts the following options:
  7107. @table @option
  7108. @item dnn_backend
  7109. Specify which DNN backend to use for model loading and execution. This option accepts
  7110. the following values:
  7111. @table @samp
  7112. @item native
  7113. Native implementation of DNN loading and execution.
  7114. @item tensorflow
  7115. TensorFlow backend. To enable this backend you
  7116. need to install the TensorFlow for C library (see
  7117. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7118. @code{--enable-libtensorflow}
  7119. @end table
  7120. Default value is @samp{native}.
  7121. @item model
  7122. Set path to model file specifying network architecture and its parameters.
  7123. Note that different backends use different file formats. TensorFlow and native
  7124. backend can load files for only its format.
  7125. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7126. @item input
  7127. Set the input name of the dnn network.
  7128. @item output
  7129. Set the output name of the dnn network.
  7130. @end table
  7131. @subsection Examples
  7132. @itemize
  7133. @item
  7134. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7135. @example
  7136. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7137. @end example
  7138. @item
  7139. Halve the pixel value of the frame with format gray32f:
  7140. @example
  7141. 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
  7142. @end example
  7143. @item
  7144. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7145. @example
  7146. ./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
  7147. @end example
  7148. @item
  7149. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7150. @example
  7151. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7152. @end example
  7153. @end itemize
  7154. @section drawbox
  7155. Draw a colored box on the input image.
  7156. It accepts the following parameters:
  7157. @table @option
  7158. @item x
  7159. @item y
  7160. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7161. @item width, w
  7162. @item height, h
  7163. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7164. the input width and height. It defaults to 0.
  7165. @item color, c
  7166. Specify the color of the box to write. For the general syntax of this option,
  7167. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7168. value @code{invert} is used, the box edge color is the same as the
  7169. video with inverted luma.
  7170. @item thickness, t
  7171. The expression which sets the thickness of the box edge.
  7172. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7173. See below for the list of accepted constants.
  7174. @item replace
  7175. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7176. will overwrite the video's color and alpha pixels.
  7177. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7178. @end table
  7179. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7180. following constants:
  7181. @table @option
  7182. @item dar
  7183. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7184. @item hsub
  7185. @item vsub
  7186. horizontal and vertical chroma subsample values. For example for the
  7187. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7188. @item in_h, ih
  7189. @item in_w, iw
  7190. The input width and height.
  7191. @item sar
  7192. The input sample aspect ratio.
  7193. @item x
  7194. @item y
  7195. The x and y offset coordinates where the box is drawn.
  7196. @item w
  7197. @item h
  7198. The width and height of the drawn box.
  7199. @item t
  7200. The thickness of the drawn box.
  7201. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7202. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7203. @end table
  7204. @subsection Examples
  7205. @itemize
  7206. @item
  7207. Draw a black box around the edge of the input image:
  7208. @example
  7209. drawbox
  7210. @end example
  7211. @item
  7212. Draw a box with color red and an opacity of 50%:
  7213. @example
  7214. drawbox=10:20:200:60:red@@0.5
  7215. @end example
  7216. The previous example can be specified as:
  7217. @example
  7218. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7219. @end example
  7220. @item
  7221. Fill the box with pink color:
  7222. @example
  7223. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7224. @end example
  7225. @item
  7226. Draw a 2-pixel red 2.40:1 mask:
  7227. @example
  7228. 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
  7229. @end example
  7230. @end itemize
  7231. @subsection Commands
  7232. This filter supports same commands as options.
  7233. The command accepts the same syntax of the corresponding option.
  7234. If the specified expression is not valid, it is kept at its current
  7235. value.
  7236. @anchor{drawgraph}
  7237. @section drawgraph
  7238. Draw a graph using input video metadata.
  7239. It accepts the following parameters:
  7240. @table @option
  7241. @item m1
  7242. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7243. @item fg1
  7244. Set 1st foreground color expression.
  7245. @item m2
  7246. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7247. @item fg2
  7248. Set 2nd foreground color expression.
  7249. @item m3
  7250. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7251. @item fg3
  7252. Set 3rd foreground color expression.
  7253. @item m4
  7254. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7255. @item fg4
  7256. Set 4th foreground color expression.
  7257. @item min
  7258. Set minimal value of metadata value.
  7259. @item max
  7260. Set maximal value of metadata value.
  7261. @item bg
  7262. Set graph background color. Default is white.
  7263. @item mode
  7264. Set graph mode.
  7265. Available values for mode is:
  7266. @table @samp
  7267. @item bar
  7268. @item dot
  7269. @item line
  7270. @end table
  7271. Default is @code{line}.
  7272. @item slide
  7273. Set slide mode.
  7274. Available values for slide is:
  7275. @table @samp
  7276. @item frame
  7277. Draw new frame when right border is reached.
  7278. @item replace
  7279. Replace old columns with new ones.
  7280. @item scroll
  7281. Scroll from right to left.
  7282. @item rscroll
  7283. Scroll from left to right.
  7284. @item picture
  7285. Draw single picture.
  7286. @end table
  7287. Default is @code{frame}.
  7288. @item size
  7289. Set size of graph video. For the syntax of this option, check the
  7290. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7291. The default value is @code{900x256}.
  7292. @item rate, r
  7293. Set the output frame rate. Default value is @code{25}.
  7294. The foreground color expressions can use the following variables:
  7295. @table @option
  7296. @item MIN
  7297. Minimal value of metadata value.
  7298. @item MAX
  7299. Maximal value of metadata value.
  7300. @item VAL
  7301. Current metadata key value.
  7302. @end table
  7303. The color is defined as 0xAABBGGRR.
  7304. @end table
  7305. Example using metadata from @ref{signalstats} filter:
  7306. @example
  7307. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7308. @end example
  7309. Example using metadata from @ref{ebur128} filter:
  7310. @example
  7311. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7312. @end example
  7313. @section drawgrid
  7314. Draw a grid on the input image.
  7315. It accepts the following parameters:
  7316. @table @option
  7317. @item x
  7318. @item y
  7319. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7320. @item width, w
  7321. @item height, h
  7322. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7323. input width and height, respectively, minus @code{thickness}, so image gets
  7324. framed. Default to 0.
  7325. @item color, c
  7326. Specify the color of the grid. For the general syntax of this option,
  7327. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7328. value @code{invert} is used, the grid color is the same as the
  7329. video with inverted luma.
  7330. @item thickness, t
  7331. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7332. See below for the list of accepted constants.
  7333. @item replace
  7334. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7335. will overwrite the video's color and alpha pixels.
  7336. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7337. @end table
  7338. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7339. following constants:
  7340. @table @option
  7341. @item dar
  7342. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7343. @item hsub
  7344. @item vsub
  7345. horizontal and vertical chroma subsample values. For example for the
  7346. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7347. @item in_h, ih
  7348. @item in_w, iw
  7349. The input grid cell width and height.
  7350. @item sar
  7351. The input sample aspect ratio.
  7352. @item x
  7353. @item y
  7354. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7355. @item w
  7356. @item h
  7357. The width and height of the drawn cell.
  7358. @item t
  7359. The thickness of the drawn cell.
  7360. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7361. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7362. @end table
  7363. @subsection Examples
  7364. @itemize
  7365. @item
  7366. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7367. @example
  7368. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7369. @end example
  7370. @item
  7371. Draw a white 3x3 grid with an opacity of 50%:
  7372. @example
  7373. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7374. @end example
  7375. @end itemize
  7376. @subsection Commands
  7377. This filter supports same commands as options.
  7378. The command accepts the same syntax of the corresponding option.
  7379. If the specified expression is not valid, it is kept at its current
  7380. value.
  7381. @anchor{drawtext}
  7382. @section drawtext
  7383. Draw a text string or text from a specified file on top of a video, using the
  7384. libfreetype library.
  7385. To enable compilation of this filter, you need to configure FFmpeg with
  7386. @code{--enable-libfreetype}.
  7387. To enable default font fallback and the @var{font} option you need to
  7388. configure FFmpeg with @code{--enable-libfontconfig}.
  7389. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7390. @code{--enable-libfribidi}.
  7391. @subsection Syntax
  7392. It accepts the following parameters:
  7393. @table @option
  7394. @item box
  7395. Used to draw a box around text using the background color.
  7396. The value must be either 1 (enable) or 0 (disable).
  7397. The default value of @var{box} is 0.
  7398. @item boxborderw
  7399. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7400. The default value of @var{boxborderw} is 0.
  7401. @item boxcolor
  7402. The color to be used for drawing box around text. For the syntax of this
  7403. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7404. The default value of @var{boxcolor} is "white".
  7405. @item line_spacing
  7406. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7407. The default value of @var{line_spacing} is 0.
  7408. @item borderw
  7409. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7410. The default value of @var{borderw} is 0.
  7411. @item bordercolor
  7412. Set the color to be used for drawing border around text. For the syntax of this
  7413. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7414. The default value of @var{bordercolor} is "black".
  7415. @item expansion
  7416. Select how the @var{text} is expanded. Can be either @code{none},
  7417. @code{strftime} (deprecated) or
  7418. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7419. below for details.
  7420. @item basetime
  7421. Set a start time for the count. Value is in microseconds. Only applied
  7422. in the deprecated strftime expansion mode. To emulate in normal expansion
  7423. mode use the @code{pts} function, supplying the start time (in seconds)
  7424. as the second argument.
  7425. @item fix_bounds
  7426. If true, check and fix text coords to avoid clipping.
  7427. @item fontcolor
  7428. The color to be used for drawing fonts. For the syntax of this option, check
  7429. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7430. The default value of @var{fontcolor} is "black".
  7431. @item fontcolor_expr
  7432. String which is expanded the same way as @var{text} to obtain dynamic
  7433. @var{fontcolor} value. By default this option has empty value and is not
  7434. processed. When this option is set, it overrides @var{fontcolor} option.
  7435. @item font
  7436. The font family to be used for drawing text. By default Sans.
  7437. @item fontfile
  7438. The font file to be used for drawing text. The path must be included.
  7439. This parameter is mandatory if the fontconfig support is disabled.
  7440. @item alpha
  7441. Draw the text applying alpha blending. The value can
  7442. be a number between 0.0 and 1.0.
  7443. The expression accepts the same variables @var{x, y} as well.
  7444. The default value is 1.
  7445. Please see @var{fontcolor_expr}.
  7446. @item fontsize
  7447. The font size to be used for drawing text.
  7448. The default value of @var{fontsize} is 16.
  7449. @item text_shaping
  7450. If set to 1, attempt to shape the text (for example, reverse the order of
  7451. right-to-left text and join Arabic characters) before drawing it.
  7452. Otherwise, just draw the text exactly as given.
  7453. By default 1 (if supported).
  7454. @item ft_load_flags
  7455. The flags to be used for loading the fonts.
  7456. The flags map the corresponding flags supported by libfreetype, and are
  7457. a combination of the following values:
  7458. @table @var
  7459. @item default
  7460. @item no_scale
  7461. @item no_hinting
  7462. @item render
  7463. @item no_bitmap
  7464. @item vertical_layout
  7465. @item force_autohint
  7466. @item crop_bitmap
  7467. @item pedantic
  7468. @item ignore_global_advance_width
  7469. @item no_recurse
  7470. @item ignore_transform
  7471. @item monochrome
  7472. @item linear_design
  7473. @item no_autohint
  7474. @end table
  7475. Default value is "default".
  7476. For more information consult the documentation for the FT_LOAD_*
  7477. libfreetype flags.
  7478. @item shadowcolor
  7479. The color to be used for drawing a shadow behind the drawn text. For the
  7480. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7481. ffmpeg-utils manual,ffmpeg-utils}.
  7482. The default value of @var{shadowcolor} is "black".
  7483. @item shadowx
  7484. @item shadowy
  7485. The x and y offsets for the text shadow position with respect to the
  7486. position of the text. They can be either positive or negative
  7487. values. The default value for both is "0".
  7488. @item start_number
  7489. The starting frame number for the n/frame_num variable. The default value
  7490. is "0".
  7491. @item tabsize
  7492. The size in number of spaces to use for rendering the tab.
  7493. Default value is 4.
  7494. @item timecode
  7495. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7496. format. It can be used with or without text parameter. @var{timecode_rate}
  7497. option must be specified.
  7498. @item timecode_rate, rate, r
  7499. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7500. integer. Minimum value is "1".
  7501. Drop-frame timecode is supported for frame rates 30 & 60.
  7502. @item tc24hmax
  7503. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7504. Default is 0 (disabled).
  7505. @item text
  7506. The text string to be drawn. The text must be a sequence of UTF-8
  7507. encoded characters.
  7508. This parameter is mandatory if no file is specified with the parameter
  7509. @var{textfile}.
  7510. @item textfile
  7511. A text file containing text to be drawn. The text must be a sequence
  7512. of UTF-8 encoded characters.
  7513. This parameter is mandatory if no text string is specified with the
  7514. parameter @var{text}.
  7515. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7516. @item reload
  7517. If set to 1, the @var{textfile} will be reloaded before each frame.
  7518. Be sure to update it atomically, or it may be read partially, or even fail.
  7519. @item x
  7520. @item y
  7521. The expressions which specify the offsets where text will be drawn
  7522. within the video frame. They are relative to the top/left border of the
  7523. output image.
  7524. The default value of @var{x} and @var{y} is "0".
  7525. See below for the list of accepted constants and functions.
  7526. @end table
  7527. The parameters for @var{x} and @var{y} are expressions containing the
  7528. following constants and functions:
  7529. @table @option
  7530. @item dar
  7531. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7532. @item hsub
  7533. @item vsub
  7534. horizontal and vertical chroma subsample values. For example for the
  7535. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7536. @item line_h, lh
  7537. the height of each text line
  7538. @item main_h, h, H
  7539. the input height
  7540. @item main_w, w, W
  7541. the input width
  7542. @item max_glyph_a, ascent
  7543. the maximum distance from the baseline to the highest/upper grid
  7544. coordinate used to place a glyph outline point, for all the rendered
  7545. glyphs.
  7546. It is a positive value, due to the grid's orientation with the Y axis
  7547. upwards.
  7548. @item max_glyph_d, descent
  7549. the maximum distance from the baseline to the lowest grid coordinate
  7550. used to place a glyph outline point, for all the rendered glyphs.
  7551. This is a negative value, due to the grid's orientation, with the Y axis
  7552. upwards.
  7553. @item max_glyph_h
  7554. maximum glyph height, that is the maximum height for all the glyphs
  7555. contained in the rendered text, it is equivalent to @var{ascent} -
  7556. @var{descent}.
  7557. @item max_glyph_w
  7558. maximum glyph width, that is the maximum width for all the glyphs
  7559. contained in the rendered text
  7560. @item n
  7561. the number of input frame, starting from 0
  7562. @item rand(min, max)
  7563. return a random number included between @var{min} and @var{max}
  7564. @item sar
  7565. The input sample aspect ratio.
  7566. @item t
  7567. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7568. @item text_h, th
  7569. the height of the rendered text
  7570. @item text_w, tw
  7571. the width of the rendered text
  7572. @item x
  7573. @item y
  7574. the x and y offset coordinates where the text is drawn.
  7575. These parameters allow the @var{x} and @var{y} expressions to refer
  7576. to each other, so you can for example specify @code{y=x/dar}.
  7577. @item pict_type
  7578. A one character description of the current frame's picture type.
  7579. @item pkt_pos
  7580. The current packet's position in the input file or stream
  7581. (in bytes, from the start of the input). A value of -1 indicates
  7582. this info is not available.
  7583. @item pkt_duration
  7584. The current packet's duration, in seconds.
  7585. @item pkt_size
  7586. The current packet's size (in bytes).
  7587. @end table
  7588. @anchor{drawtext_expansion}
  7589. @subsection Text expansion
  7590. If @option{expansion} is set to @code{strftime},
  7591. the filter recognizes strftime() sequences in the provided text and
  7592. expands them accordingly. Check the documentation of strftime(). This
  7593. feature is deprecated.
  7594. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7595. If @option{expansion} is set to @code{normal} (which is the default),
  7596. the following expansion mechanism is used.
  7597. The backslash character @samp{\}, followed by any character, always expands to
  7598. the second character.
  7599. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7600. braces is a function name, possibly followed by arguments separated by ':'.
  7601. If the arguments contain special characters or delimiters (':' or '@}'),
  7602. they should be escaped.
  7603. Note that they probably must also be escaped as the value for the
  7604. @option{text} option in the filter argument string and as the filter
  7605. argument in the filtergraph description, and possibly also for the shell,
  7606. that makes up to four levels of escaping; using a text file avoids these
  7607. problems.
  7608. The following functions are available:
  7609. @table @command
  7610. @item expr, e
  7611. The expression evaluation result.
  7612. It must take one argument specifying the expression to be evaluated,
  7613. which accepts the same constants and functions as the @var{x} and
  7614. @var{y} values. Note that not all constants should be used, for
  7615. example the text size is not known when evaluating the expression, so
  7616. the constants @var{text_w} and @var{text_h} will have an undefined
  7617. value.
  7618. @item expr_int_format, eif
  7619. Evaluate the expression's value and output as formatted integer.
  7620. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7621. The second argument specifies the output format. Allowed values are @samp{x},
  7622. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7623. @code{printf} function.
  7624. The third parameter is optional and sets the number of positions taken by the output.
  7625. It can be used to add padding with zeros from the left.
  7626. @item gmtime
  7627. The time at which the filter is running, expressed in UTC.
  7628. It can accept an argument: a strftime() format string.
  7629. @item localtime
  7630. The time at which the filter is running, expressed in the local time zone.
  7631. It can accept an argument: a strftime() format string.
  7632. @item metadata
  7633. Frame metadata. Takes one or two arguments.
  7634. The first argument is mandatory and specifies the metadata key.
  7635. The second argument is optional and specifies a default value, used when the
  7636. metadata key is not found or empty.
  7637. Available metadata can be identified by inspecting entries
  7638. starting with TAG included within each frame section
  7639. printed by running @code{ffprobe -show_frames}.
  7640. String metadata generated in filters leading to
  7641. the drawtext filter are also available.
  7642. @item n, frame_num
  7643. The frame number, starting from 0.
  7644. @item pict_type
  7645. A one character description of the current picture type.
  7646. @item pts
  7647. The timestamp of the current frame.
  7648. It can take up to three arguments.
  7649. The first argument is the format of the timestamp; it defaults to @code{flt}
  7650. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7651. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7652. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7653. @code{localtime} stands for the timestamp of the frame formatted as
  7654. local time zone time.
  7655. The second argument is an offset added to the timestamp.
  7656. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7657. supplied to present the hour part of the formatted timestamp in 24h format
  7658. (00-23).
  7659. If the format is set to @code{localtime} or @code{gmtime},
  7660. a third argument may be supplied: a strftime() format string.
  7661. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7662. @end table
  7663. @subsection Commands
  7664. This filter supports altering parameters via commands:
  7665. @table @option
  7666. @item reinit
  7667. Alter existing filter parameters.
  7668. Syntax for the argument is the same as for filter invocation, e.g.
  7669. @example
  7670. fontsize=56:fontcolor=green:text='Hello World'
  7671. @end example
  7672. Full filter invocation with sendcmd would look like this:
  7673. @example
  7674. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7675. @end example
  7676. @end table
  7677. If the entire argument can't be parsed or applied as valid values then the filter will
  7678. continue with its existing parameters.
  7679. @subsection Examples
  7680. @itemize
  7681. @item
  7682. Draw "Test Text" with font FreeSerif, using the default values for the
  7683. optional parameters.
  7684. @example
  7685. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7686. @end example
  7687. @item
  7688. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7689. and y=50 (counting from the top-left corner of the screen), text is
  7690. yellow with a red box around it. Both the text and the box have an
  7691. opacity of 20%.
  7692. @example
  7693. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7694. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7695. @end example
  7696. Note that the double quotes are not necessary if spaces are not used
  7697. within the parameter list.
  7698. @item
  7699. Show the text at the center of the video frame:
  7700. @example
  7701. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7702. @end example
  7703. @item
  7704. Show the text at a random position, switching to a new position every 30 seconds:
  7705. @example
  7706. 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)"
  7707. @end example
  7708. @item
  7709. Show a text line sliding from right to left in the last row of the video
  7710. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7711. with no newlines.
  7712. @example
  7713. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7714. @end example
  7715. @item
  7716. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7717. @example
  7718. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7719. @end example
  7720. @item
  7721. Draw a single green letter "g", at the center of the input video.
  7722. The glyph baseline is placed at half screen height.
  7723. @example
  7724. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7725. @end example
  7726. @item
  7727. Show text for 1 second every 3 seconds:
  7728. @example
  7729. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7730. @end example
  7731. @item
  7732. Use fontconfig to set the font. Note that the colons need to be escaped.
  7733. @example
  7734. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7735. @end example
  7736. @item
  7737. Print the date of a real-time encoding (see strftime(3)):
  7738. @example
  7739. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7740. @end example
  7741. @item
  7742. Show text fading in and out (appearing/disappearing):
  7743. @example
  7744. #!/bin/sh
  7745. DS=1.0 # display start
  7746. DE=10.0 # display end
  7747. FID=1.5 # fade in duration
  7748. FOD=5 # fade out duration
  7749. 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 @}"
  7750. @end example
  7751. @item
  7752. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7753. and the @option{fontsize} value are included in the @option{y} offset.
  7754. @example
  7755. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7756. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7757. @end example
  7758. @item
  7759. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7760. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7761. must have option @option{-export_path_metadata 1} for the special metadata fields
  7762. to be available for filters.
  7763. @example
  7764. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7765. @end example
  7766. @end itemize
  7767. For more information about libfreetype, check:
  7768. @url{http://www.freetype.org/}.
  7769. For more information about fontconfig, check:
  7770. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7771. For more information about libfribidi, check:
  7772. @url{http://fribidi.org/}.
  7773. @section edgedetect
  7774. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7775. The filter accepts the following options:
  7776. @table @option
  7777. @item low
  7778. @item high
  7779. Set low and high threshold values used by the Canny thresholding
  7780. algorithm.
  7781. The high threshold selects the "strong" edge pixels, which are then
  7782. connected through 8-connectivity with the "weak" edge pixels selected
  7783. by the low threshold.
  7784. @var{low} and @var{high} threshold values must be chosen in the range
  7785. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7786. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7787. is @code{50/255}.
  7788. @item mode
  7789. Define the drawing mode.
  7790. @table @samp
  7791. @item wires
  7792. Draw white/gray wires on black background.
  7793. @item colormix
  7794. Mix the colors to create a paint/cartoon effect.
  7795. @item canny
  7796. Apply Canny edge detector on all selected planes.
  7797. @end table
  7798. Default value is @var{wires}.
  7799. @item planes
  7800. Select planes for filtering. By default all available planes are filtered.
  7801. @end table
  7802. @subsection Examples
  7803. @itemize
  7804. @item
  7805. Standard edge detection with custom values for the hysteresis thresholding:
  7806. @example
  7807. edgedetect=low=0.1:high=0.4
  7808. @end example
  7809. @item
  7810. Painting effect without thresholding:
  7811. @example
  7812. edgedetect=mode=colormix:high=0
  7813. @end example
  7814. @end itemize
  7815. @section elbg
  7816. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7817. For each input image, the filter will compute the optimal mapping from
  7818. the input to the output given the codebook length, that is the number
  7819. of distinct output colors.
  7820. This filter accepts the following options.
  7821. @table @option
  7822. @item codebook_length, l
  7823. Set codebook length. The value must be a positive integer, and
  7824. represents the number of distinct output colors. Default value is 256.
  7825. @item nb_steps, n
  7826. Set the maximum number of iterations to apply for computing the optimal
  7827. mapping. The higher the value the better the result and the higher the
  7828. computation time. Default value is 1.
  7829. @item seed, s
  7830. Set a random seed, must be an integer included between 0 and
  7831. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7832. will try to use a good random seed on a best effort basis.
  7833. @item pal8
  7834. Set pal8 output pixel format. This option does not work with codebook
  7835. length greater than 256.
  7836. @end table
  7837. @section entropy
  7838. Measure graylevel entropy in histogram of color channels of video frames.
  7839. It accepts the following parameters:
  7840. @table @option
  7841. @item mode
  7842. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7843. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7844. between neighbour histogram values.
  7845. @end table
  7846. @section eq
  7847. Set brightness, contrast, saturation and approximate gamma adjustment.
  7848. The filter accepts the following options:
  7849. @table @option
  7850. @item contrast
  7851. Set the contrast expression. The value must be a float value in range
  7852. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7853. @item brightness
  7854. Set the brightness expression. The value must be a float value in
  7855. range @code{-1.0} to @code{1.0}. The default value is "0".
  7856. @item saturation
  7857. Set the saturation expression. The value must be a float in
  7858. range @code{0.0} to @code{3.0}. The default value is "1".
  7859. @item gamma
  7860. Set the gamma expression. The value must be a float in range
  7861. @code{0.1} to @code{10.0}. The default value is "1".
  7862. @item gamma_r
  7863. Set the gamma expression for red. The value must be a float in
  7864. range @code{0.1} to @code{10.0}. The default value is "1".
  7865. @item gamma_g
  7866. Set the gamma expression for green. The value must be a float in range
  7867. @code{0.1} to @code{10.0}. The default value is "1".
  7868. @item gamma_b
  7869. Set the gamma expression for blue. The value must be a float in range
  7870. @code{0.1} to @code{10.0}. The default value is "1".
  7871. @item gamma_weight
  7872. Set the gamma weight expression. It can be used to reduce the effect
  7873. of a high gamma value on bright image areas, e.g. keep them from
  7874. getting overamplified and just plain white. The value must be a float
  7875. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7876. gamma correction all the way down while @code{1.0} leaves it at its
  7877. full strength. Default is "1".
  7878. @item eval
  7879. Set when the expressions for brightness, contrast, saturation and
  7880. gamma expressions are evaluated.
  7881. It accepts the following values:
  7882. @table @samp
  7883. @item init
  7884. only evaluate expressions once during the filter initialization or
  7885. when a command is processed
  7886. @item frame
  7887. evaluate expressions for each incoming frame
  7888. @end table
  7889. Default value is @samp{init}.
  7890. @end table
  7891. The expressions accept the following parameters:
  7892. @table @option
  7893. @item n
  7894. frame count of the input frame starting from 0
  7895. @item pos
  7896. byte position of the corresponding packet in the input file, NAN if
  7897. unspecified
  7898. @item r
  7899. frame rate of the input video, NAN if the input frame rate is unknown
  7900. @item t
  7901. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7902. @end table
  7903. @subsection Commands
  7904. The filter supports the following commands:
  7905. @table @option
  7906. @item contrast
  7907. Set the contrast expression.
  7908. @item brightness
  7909. Set the brightness expression.
  7910. @item saturation
  7911. Set the saturation expression.
  7912. @item gamma
  7913. Set the gamma expression.
  7914. @item gamma_r
  7915. Set the gamma_r expression.
  7916. @item gamma_g
  7917. Set gamma_g expression.
  7918. @item gamma_b
  7919. Set gamma_b expression.
  7920. @item gamma_weight
  7921. Set gamma_weight expression.
  7922. The command accepts the same syntax of the corresponding option.
  7923. If the specified expression is not valid, it is kept at its current
  7924. value.
  7925. @end table
  7926. @section erosion
  7927. Apply erosion effect to the video.
  7928. This filter replaces the pixel by the local(3x3) minimum.
  7929. It accepts the following options:
  7930. @table @option
  7931. @item threshold0
  7932. @item threshold1
  7933. @item threshold2
  7934. @item threshold3
  7935. Limit the maximum change for each plane, default is 65535.
  7936. If 0, plane will remain unchanged.
  7937. @item coordinates
  7938. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7939. pixels are used.
  7940. Flags to local 3x3 coordinates maps like this:
  7941. 1 2 3
  7942. 4 5
  7943. 6 7 8
  7944. @end table
  7945. @subsection Commands
  7946. This filter supports the all above options as @ref{commands}.
  7947. @section extractplanes
  7948. Extract color channel components from input video stream into
  7949. separate grayscale video streams.
  7950. The filter accepts the following option:
  7951. @table @option
  7952. @item planes
  7953. Set plane(s) to extract.
  7954. Available values for planes are:
  7955. @table @samp
  7956. @item y
  7957. @item u
  7958. @item v
  7959. @item a
  7960. @item r
  7961. @item g
  7962. @item b
  7963. @end table
  7964. Choosing planes not available in the input will result in an error.
  7965. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7966. with @code{y}, @code{u}, @code{v} planes at same time.
  7967. @end table
  7968. @subsection Examples
  7969. @itemize
  7970. @item
  7971. Extract luma, u and v color channel component from input video frame
  7972. into 3 grayscale outputs:
  7973. @example
  7974. 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
  7975. @end example
  7976. @end itemize
  7977. @section fade
  7978. Apply a fade-in/out effect to the input video.
  7979. It accepts the following parameters:
  7980. @table @option
  7981. @item type, t
  7982. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7983. effect.
  7984. Default is @code{in}.
  7985. @item start_frame, s
  7986. Specify the number of the frame to start applying the fade
  7987. effect at. Default is 0.
  7988. @item nb_frames, n
  7989. The number of frames that the fade effect lasts. At the end of the
  7990. fade-in effect, the output video will have the same intensity as the input video.
  7991. At the end of the fade-out transition, the output video will be filled with the
  7992. selected @option{color}.
  7993. Default is 25.
  7994. @item alpha
  7995. If set to 1, fade only alpha channel, if one exists on the input.
  7996. Default value is 0.
  7997. @item start_time, st
  7998. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7999. effect. If both start_frame and start_time are specified, the fade will start at
  8000. whichever comes last. Default is 0.
  8001. @item duration, d
  8002. The number of seconds for which the fade effect has to last. At the end of the
  8003. fade-in effect the output video will have the same intensity as the input video,
  8004. at the end of the fade-out transition the output video will be filled with the
  8005. selected @option{color}.
  8006. If both duration and nb_frames are specified, duration is used. Default is 0
  8007. (nb_frames is used by default).
  8008. @item color, c
  8009. Specify the color of the fade. Default is "black".
  8010. @end table
  8011. @subsection Examples
  8012. @itemize
  8013. @item
  8014. Fade in the first 30 frames of video:
  8015. @example
  8016. fade=in:0:30
  8017. @end example
  8018. The command above is equivalent to:
  8019. @example
  8020. fade=t=in:s=0:n=30
  8021. @end example
  8022. @item
  8023. Fade out the last 45 frames of a 200-frame video:
  8024. @example
  8025. fade=out:155:45
  8026. fade=type=out:start_frame=155:nb_frames=45
  8027. @end example
  8028. @item
  8029. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8030. @example
  8031. fade=in:0:25, fade=out:975:25
  8032. @end example
  8033. @item
  8034. Make the first 5 frames yellow, then fade in from frame 5-24:
  8035. @example
  8036. fade=in:5:20:color=yellow
  8037. @end example
  8038. @item
  8039. Fade in alpha over first 25 frames of video:
  8040. @example
  8041. fade=in:0:25:alpha=1
  8042. @end example
  8043. @item
  8044. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8045. @example
  8046. fade=t=in:st=5.5:d=0.5
  8047. @end example
  8048. @end itemize
  8049. @section fftdnoiz
  8050. Denoise frames using 3D FFT (frequency domain filtering).
  8051. The filter accepts the following options:
  8052. @table @option
  8053. @item sigma
  8054. Set the noise sigma constant. This sets denoising strength.
  8055. Default value is 1. Allowed range is from 0 to 30.
  8056. Using very high sigma with low overlap may give blocking artifacts.
  8057. @item amount
  8058. Set amount of denoising. By default all detected noise is reduced.
  8059. Default value is 1. Allowed range is from 0 to 1.
  8060. @item block
  8061. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8062. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8063. block size in pixels is 2^4 which is 16.
  8064. @item overlap
  8065. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8066. @item prev
  8067. Set number of previous frames to use for denoising. By default is set to 0.
  8068. @item next
  8069. Set number of next frames to to use for denoising. By default is set to 0.
  8070. @item planes
  8071. Set planes which will be filtered, by default are all available filtered
  8072. except alpha.
  8073. @end table
  8074. @section fftfilt
  8075. Apply arbitrary expressions to samples in frequency domain
  8076. @table @option
  8077. @item dc_Y
  8078. Adjust the dc value (gain) of the luma plane of the image. The filter
  8079. accepts an integer value in range @code{0} to @code{1000}. The default
  8080. value is set to @code{0}.
  8081. @item dc_U
  8082. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8083. filter accepts an integer value in range @code{0} to @code{1000}. The
  8084. default value is set to @code{0}.
  8085. @item dc_V
  8086. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8087. filter accepts an integer value in range @code{0} to @code{1000}. The
  8088. default value is set to @code{0}.
  8089. @item weight_Y
  8090. Set the frequency domain weight expression for the luma plane.
  8091. @item weight_U
  8092. Set the frequency domain weight expression for the 1st chroma plane.
  8093. @item weight_V
  8094. Set the frequency domain weight expression for the 2nd chroma plane.
  8095. @item eval
  8096. Set when the expressions are evaluated.
  8097. It accepts the following values:
  8098. @table @samp
  8099. @item init
  8100. Only evaluate expressions once during the filter initialization.
  8101. @item frame
  8102. Evaluate expressions for each incoming frame.
  8103. @end table
  8104. Default value is @samp{init}.
  8105. The filter accepts the following variables:
  8106. @item X
  8107. @item Y
  8108. The coordinates of the current sample.
  8109. @item W
  8110. @item H
  8111. The width and height of the image.
  8112. @item N
  8113. The number of input frame, starting from 0.
  8114. @end table
  8115. @subsection Examples
  8116. @itemize
  8117. @item
  8118. High-pass:
  8119. @example
  8120. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8121. @end example
  8122. @item
  8123. Low-pass:
  8124. @example
  8125. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8126. @end example
  8127. @item
  8128. Sharpen:
  8129. @example
  8130. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8131. @end example
  8132. @item
  8133. Blur:
  8134. @example
  8135. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8136. @end example
  8137. @end itemize
  8138. @section field
  8139. Extract a single field from an interlaced image using stride
  8140. arithmetic to avoid wasting CPU time. The output frames are marked as
  8141. non-interlaced.
  8142. The filter accepts the following options:
  8143. @table @option
  8144. @item type
  8145. Specify whether to extract the top (if the value is @code{0} or
  8146. @code{top}) or the bottom field (if the value is @code{1} or
  8147. @code{bottom}).
  8148. @end table
  8149. @section fieldhint
  8150. Create new frames by copying the top and bottom fields from surrounding frames
  8151. supplied as numbers by the hint file.
  8152. @table @option
  8153. @item hint
  8154. Set file containing hints: absolute/relative frame numbers.
  8155. There must be one line for each frame in a clip. Each line must contain two
  8156. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8157. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8158. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8159. for @code{relative} mode. First number tells from which frame to pick up top
  8160. field and second number tells from which frame to pick up bottom field.
  8161. If optionally followed by @code{+} output frame will be marked as interlaced,
  8162. else if followed by @code{-} output frame will be marked as progressive, else
  8163. it will be marked same as input frame.
  8164. If optionally followed by @code{t} output frame will use only top field, or in
  8165. case of @code{b} it will use only bottom field.
  8166. If line starts with @code{#} or @code{;} that line is skipped.
  8167. @item mode
  8168. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8169. @end table
  8170. Example of first several lines of @code{hint} file for @code{relative} mode:
  8171. @example
  8172. 0,0 - # first frame
  8173. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8174. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8175. 1,0 -
  8176. 0,0 -
  8177. 0,0 -
  8178. 1,0 -
  8179. 1,0 -
  8180. 1,0 -
  8181. 0,0 -
  8182. 0,0 -
  8183. 1,0 -
  8184. 1,0 -
  8185. 1,0 -
  8186. 0,0 -
  8187. @end example
  8188. @section fieldmatch
  8189. Field matching filter for inverse telecine. It is meant to reconstruct the
  8190. progressive frames from a telecined stream. The filter does not drop duplicated
  8191. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8192. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8193. The separation of the field matching and the decimation is notably motivated by
  8194. the possibility of inserting a de-interlacing filter fallback between the two.
  8195. If the source has mixed telecined and real interlaced content,
  8196. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8197. But these remaining combed frames will be marked as interlaced, and thus can be
  8198. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8199. In addition to the various configuration options, @code{fieldmatch} can take an
  8200. optional second stream, activated through the @option{ppsrc} option. If
  8201. enabled, the frames reconstruction will be based on the fields and frames from
  8202. this second stream. This allows the first input to be pre-processed in order to
  8203. help the various algorithms of the filter, while keeping the output lossless
  8204. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8205. or brightness/contrast adjustments can help.
  8206. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8207. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8208. which @code{fieldmatch} is based on. While the semantic and usage are very
  8209. close, some behaviour and options names can differ.
  8210. The @ref{decimate} filter currently only works for constant frame rate input.
  8211. If your input has mixed telecined (30fps) and progressive content with a lower
  8212. framerate like 24fps use the following filterchain to produce the necessary cfr
  8213. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8214. The filter accepts the following options:
  8215. @table @option
  8216. @item order
  8217. Specify the assumed field order of the input stream. Available values are:
  8218. @table @samp
  8219. @item auto
  8220. Auto detect parity (use FFmpeg's internal parity value).
  8221. @item bff
  8222. Assume bottom field first.
  8223. @item tff
  8224. Assume top field first.
  8225. @end table
  8226. Note that it is sometimes recommended not to trust the parity announced by the
  8227. stream.
  8228. Default value is @var{auto}.
  8229. @item mode
  8230. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8231. sense that it won't risk creating jerkiness due to duplicate frames when
  8232. possible, but if there are bad edits or blended fields it will end up
  8233. outputting combed frames when a good match might actually exist. On the other
  8234. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8235. but will almost always find a good frame if there is one. The other values are
  8236. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8237. jerkiness and creating duplicate frames versus finding good matches in sections
  8238. with bad edits, orphaned fields, blended fields, etc.
  8239. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8240. Available values are:
  8241. @table @samp
  8242. @item pc
  8243. 2-way matching (p/c)
  8244. @item pc_n
  8245. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8246. @item pc_u
  8247. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8248. @item pc_n_ub
  8249. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8250. still combed (p/c + n + u/b)
  8251. @item pcn
  8252. 3-way matching (p/c/n)
  8253. @item pcn_ub
  8254. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8255. detected as combed (p/c/n + u/b)
  8256. @end table
  8257. The parenthesis at the end indicate the matches that would be used for that
  8258. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8259. @var{top}).
  8260. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8261. the slowest.
  8262. Default value is @var{pc_n}.
  8263. @item ppsrc
  8264. Mark the main input stream as a pre-processed input, and enable the secondary
  8265. input stream as the clean source to pick the fields from. See the filter
  8266. introduction for more details. It is similar to the @option{clip2} feature from
  8267. VFM/TFM.
  8268. Default value is @code{0} (disabled).
  8269. @item field
  8270. Set the field to match from. It is recommended to set this to the same value as
  8271. @option{order} unless you experience matching failures with that setting. In
  8272. certain circumstances changing the field that is used to match from can have a
  8273. large impact on matching performance. Available values are:
  8274. @table @samp
  8275. @item auto
  8276. Automatic (same value as @option{order}).
  8277. @item bottom
  8278. Match from the bottom field.
  8279. @item top
  8280. Match from the top field.
  8281. @end table
  8282. Default value is @var{auto}.
  8283. @item mchroma
  8284. Set whether or not chroma is included during the match comparisons. In most
  8285. cases it is recommended to leave this enabled. You should set this to @code{0}
  8286. only if your clip has bad chroma problems such as heavy rainbowing or other
  8287. artifacts. Setting this to @code{0} could also be used to speed things up at
  8288. the cost of some accuracy.
  8289. Default value is @code{1}.
  8290. @item y0
  8291. @item y1
  8292. These define an exclusion band which excludes the lines between @option{y0} and
  8293. @option{y1} from being included in the field matching decision. An exclusion
  8294. band can be used to ignore subtitles, a logo, or other things that may
  8295. interfere with the matching. @option{y0} sets the starting scan line and
  8296. @option{y1} sets the ending line; all lines in between @option{y0} and
  8297. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8298. @option{y0} and @option{y1} to the same value will disable the feature.
  8299. @option{y0} and @option{y1} defaults to @code{0}.
  8300. @item scthresh
  8301. Set the scene change detection threshold as a percentage of maximum change on
  8302. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8303. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8304. @option{scthresh} is @code{[0.0, 100.0]}.
  8305. Default value is @code{12.0}.
  8306. @item combmatch
  8307. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8308. account the combed scores of matches when deciding what match to use as the
  8309. final match. Available values are:
  8310. @table @samp
  8311. @item none
  8312. No final matching based on combed scores.
  8313. @item sc
  8314. Combed scores are only used when a scene change is detected.
  8315. @item full
  8316. Use combed scores all the time.
  8317. @end table
  8318. Default is @var{sc}.
  8319. @item combdbg
  8320. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8321. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8322. Available values are:
  8323. @table @samp
  8324. @item none
  8325. No forced calculation.
  8326. @item pcn
  8327. Force p/c/n calculations.
  8328. @item pcnub
  8329. Force p/c/n/u/b calculations.
  8330. @end table
  8331. Default value is @var{none}.
  8332. @item cthresh
  8333. This is the area combing threshold used for combed frame detection. This
  8334. essentially controls how "strong" or "visible" combing must be to be detected.
  8335. Larger values mean combing must be more visible and smaller values mean combing
  8336. can be less visible or strong and still be detected. Valid settings are from
  8337. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8338. be detected as combed). This is basically a pixel difference value. A good
  8339. range is @code{[8, 12]}.
  8340. Default value is @code{9}.
  8341. @item chroma
  8342. Sets whether or not chroma is considered in the combed frame decision. Only
  8343. disable this if your source has chroma problems (rainbowing, etc.) that are
  8344. causing problems for the combed frame detection with chroma enabled. Actually,
  8345. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8346. where there is chroma only combing in the source.
  8347. Default value is @code{0}.
  8348. @item blockx
  8349. @item blocky
  8350. Respectively set the x-axis and y-axis size of the window used during combed
  8351. frame detection. This has to do with the size of the area in which
  8352. @option{combpel} pixels are required to be detected as combed for a frame to be
  8353. declared combed. See the @option{combpel} parameter description for more info.
  8354. Possible values are any number that is a power of 2 starting at 4 and going up
  8355. to 512.
  8356. Default value is @code{16}.
  8357. @item combpel
  8358. The number of combed pixels inside any of the @option{blocky} by
  8359. @option{blockx} size blocks on the frame for the frame to be detected as
  8360. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8361. setting controls "how much" combing there must be in any localized area (a
  8362. window defined by the @option{blockx} and @option{blocky} settings) on the
  8363. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8364. which point no frames will ever be detected as combed). This setting is known
  8365. as @option{MI} in TFM/VFM vocabulary.
  8366. Default value is @code{80}.
  8367. @end table
  8368. @anchor{p/c/n/u/b meaning}
  8369. @subsection p/c/n/u/b meaning
  8370. @subsubsection p/c/n
  8371. We assume the following telecined stream:
  8372. @example
  8373. Top fields: 1 2 2 3 4
  8374. Bottom fields: 1 2 3 4 4
  8375. @end example
  8376. The numbers correspond to the progressive frame the fields relate to. Here, the
  8377. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8378. When @code{fieldmatch} is configured to run a matching from bottom
  8379. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8380. @example
  8381. Input stream:
  8382. T 1 2 2 3 4
  8383. B 1 2 3 4 4 <-- matching reference
  8384. Matches: c c n n c
  8385. Output stream:
  8386. T 1 2 3 4 4
  8387. B 1 2 3 4 4
  8388. @end example
  8389. As a result of the field matching, we can see that some frames get duplicated.
  8390. To perform a complete inverse telecine, you need to rely on a decimation filter
  8391. after this operation. See for instance the @ref{decimate} filter.
  8392. The same operation now matching from top fields (@option{field}=@var{top})
  8393. looks like this:
  8394. @example
  8395. Input stream:
  8396. T 1 2 2 3 4 <-- matching reference
  8397. B 1 2 3 4 4
  8398. Matches: c c p p c
  8399. Output stream:
  8400. T 1 2 2 3 4
  8401. B 1 2 2 3 4
  8402. @end example
  8403. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8404. basically, they refer to the frame and field of the opposite parity:
  8405. @itemize
  8406. @item @var{p} matches the field of the opposite parity in the previous frame
  8407. @item @var{c} matches the field of the opposite parity in the current frame
  8408. @item @var{n} matches the field of the opposite parity in the next frame
  8409. @end itemize
  8410. @subsubsection u/b
  8411. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8412. from the opposite parity flag. In the following examples, we assume that we are
  8413. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8414. 'x' is placed above and below each matched fields.
  8415. With bottom matching (@option{field}=@var{bottom}):
  8416. @example
  8417. Match: c p n b u
  8418. x x x x x
  8419. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8420. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8421. x x x x x
  8422. Output frames:
  8423. 2 1 2 2 2
  8424. 2 2 2 1 3
  8425. @end example
  8426. With top matching (@option{field}=@var{top}):
  8427. @example
  8428. Match: c p n b u
  8429. x x x x x
  8430. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8431. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8432. x x x x x
  8433. Output frames:
  8434. 2 2 2 1 2
  8435. 2 1 3 2 2
  8436. @end example
  8437. @subsection Examples
  8438. Simple IVTC of a top field first telecined stream:
  8439. @example
  8440. fieldmatch=order=tff:combmatch=none, decimate
  8441. @end example
  8442. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8443. @example
  8444. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8445. @end example
  8446. @section fieldorder
  8447. Transform the field order of the input video.
  8448. It accepts the following parameters:
  8449. @table @option
  8450. @item order
  8451. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8452. for bottom field first.
  8453. @end table
  8454. The default value is @samp{tff}.
  8455. The transformation is done by shifting the picture content up or down
  8456. by one line, and filling the remaining line with appropriate picture content.
  8457. This method is consistent with most broadcast field order converters.
  8458. If the input video is not flagged as being interlaced, or it is already
  8459. flagged as being of the required output field order, then this filter does
  8460. not alter the incoming video.
  8461. It is very useful when converting to or from PAL DV material,
  8462. which is bottom field first.
  8463. For example:
  8464. @example
  8465. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8466. @end example
  8467. @section fifo, afifo
  8468. Buffer input images and send them when they are requested.
  8469. It is mainly useful when auto-inserted by the libavfilter
  8470. framework.
  8471. It does not take parameters.
  8472. @section fillborders
  8473. Fill borders of the input video, without changing video stream dimensions.
  8474. Sometimes video can have garbage at the four edges and you may not want to
  8475. crop video input to keep size multiple of some number.
  8476. This filter accepts the following options:
  8477. @table @option
  8478. @item left
  8479. Number of pixels to fill from left border.
  8480. @item right
  8481. Number of pixels to fill from right border.
  8482. @item top
  8483. Number of pixels to fill from top border.
  8484. @item bottom
  8485. Number of pixels to fill from bottom border.
  8486. @item mode
  8487. Set fill mode.
  8488. It accepts the following values:
  8489. @table @samp
  8490. @item smear
  8491. fill pixels using outermost pixels
  8492. @item mirror
  8493. fill pixels using mirroring
  8494. @item fixed
  8495. fill pixels with constant value
  8496. @end table
  8497. Default is @var{smear}.
  8498. @item color
  8499. Set color for pixels in fixed mode. Default is @var{black}.
  8500. @end table
  8501. @subsection Commands
  8502. This filter supports same @ref{commands} as options.
  8503. The command accepts the same syntax of the corresponding option.
  8504. If the specified expression is not valid, it is kept at its current
  8505. value.
  8506. @section find_rect
  8507. Find a rectangular object
  8508. It accepts the following options:
  8509. @table @option
  8510. @item object
  8511. Filepath of the object image, needs to be in gray8.
  8512. @item threshold
  8513. Detection threshold, default is 0.5.
  8514. @item mipmaps
  8515. Number of mipmaps, default is 3.
  8516. @item xmin, ymin, xmax, ymax
  8517. Specifies the rectangle in which to search.
  8518. @end table
  8519. @subsection Examples
  8520. @itemize
  8521. @item
  8522. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8523. @example
  8524. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8525. @end example
  8526. @end itemize
  8527. @section floodfill
  8528. Flood area with values of same pixel components with another values.
  8529. It accepts the following options:
  8530. @table @option
  8531. @item x
  8532. Set pixel x coordinate.
  8533. @item y
  8534. Set pixel y coordinate.
  8535. @item s0
  8536. Set source #0 component value.
  8537. @item s1
  8538. Set source #1 component value.
  8539. @item s2
  8540. Set source #2 component value.
  8541. @item s3
  8542. Set source #3 component value.
  8543. @item d0
  8544. Set destination #0 component value.
  8545. @item d1
  8546. Set destination #1 component value.
  8547. @item d2
  8548. Set destination #2 component value.
  8549. @item d3
  8550. Set destination #3 component value.
  8551. @end table
  8552. @anchor{format}
  8553. @section format
  8554. Convert the input video to one of the specified pixel formats.
  8555. Libavfilter will try to pick one that is suitable as input to
  8556. the next filter.
  8557. It accepts the following parameters:
  8558. @table @option
  8559. @item pix_fmts
  8560. A '|'-separated list of pixel format names, such as
  8561. "pix_fmts=yuv420p|monow|rgb24".
  8562. @end table
  8563. @subsection Examples
  8564. @itemize
  8565. @item
  8566. Convert the input video to the @var{yuv420p} format
  8567. @example
  8568. format=pix_fmts=yuv420p
  8569. @end example
  8570. Convert the input video to any of the formats in the list
  8571. @example
  8572. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8573. @end example
  8574. @end itemize
  8575. @anchor{fps}
  8576. @section fps
  8577. Convert the video to specified constant frame rate by duplicating or dropping
  8578. frames as necessary.
  8579. It accepts the following parameters:
  8580. @table @option
  8581. @item fps
  8582. The desired output frame rate. The default is @code{25}.
  8583. @item start_time
  8584. Assume the first PTS should be the given value, in seconds. This allows for
  8585. padding/trimming at the start of stream. By default, no assumption is made
  8586. about the first frame's expected PTS, so no padding or trimming is done.
  8587. For example, this could be set to 0 to pad the beginning with duplicates of
  8588. the first frame if a video stream starts after the audio stream or to trim any
  8589. frames with a negative PTS.
  8590. @item round
  8591. Timestamp (PTS) rounding method.
  8592. Possible values are:
  8593. @table @option
  8594. @item zero
  8595. round towards 0
  8596. @item inf
  8597. round away from 0
  8598. @item down
  8599. round towards -infinity
  8600. @item up
  8601. round towards +infinity
  8602. @item near
  8603. round to nearest
  8604. @end table
  8605. The default is @code{near}.
  8606. @item eof_action
  8607. Action performed when reading the last frame.
  8608. Possible values are:
  8609. @table @option
  8610. @item round
  8611. Use same timestamp rounding method as used for other frames.
  8612. @item pass
  8613. Pass through last frame if input duration has not been reached yet.
  8614. @end table
  8615. The default is @code{round}.
  8616. @end table
  8617. Alternatively, the options can be specified as a flat string:
  8618. @var{fps}[:@var{start_time}[:@var{round}]].
  8619. See also the @ref{setpts} filter.
  8620. @subsection Examples
  8621. @itemize
  8622. @item
  8623. A typical usage in order to set the fps to 25:
  8624. @example
  8625. fps=fps=25
  8626. @end example
  8627. @item
  8628. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8629. @example
  8630. fps=fps=film:round=near
  8631. @end example
  8632. @end itemize
  8633. @section framepack
  8634. Pack two different video streams into a stereoscopic video, setting proper
  8635. metadata on supported codecs. The two views should have the same size and
  8636. framerate and processing will stop when the shorter video ends. Please note
  8637. that you may conveniently adjust view properties with the @ref{scale} and
  8638. @ref{fps} filters.
  8639. It accepts the following parameters:
  8640. @table @option
  8641. @item format
  8642. The desired packing format. Supported values are:
  8643. @table @option
  8644. @item sbs
  8645. The views are next to each other (default).
  8646. @item tab
  8647. The views are on top of each other.
  8648. @item lines
  8649. The views are packed by line.
  8650. @item columns
  8651. The views are packed by column.
  8652. @item frameseq
  8653. The views are temporally interleaved.
  8654. @end table
  8655. @end table
  8656. Some examples:
  8657. @example
  8658. # Convert left and right views into a frame-sequential video
  8659. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8660. # Convert views into a side-by-side video with the same output resolution as the input
  8661. 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
  8662. @end example
  8663. @section framerate
  8664. Change the frame rate by interpolating new video output frames from the source
  8665. frames.
  8666. This filter is not designed to function correctly with interlaced media. If
  8667. you wish to change the frame rate of interlaced media then you are required
  8668. to deinterlace before this filter and re-interlace after this filter.
  8669. A description of the accepted options follows.
  8670. @table @option
  8671. @item fps
  8672. Specify the output frames per second. This option can also be specified
  8673. as a value alone. The default is @code{50}.
  8674. @item interp_start
  8675. Specify the start of a range where the output frame will be created as a
  8676. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8677. the default is @code{15}.
  8678. @item interp_end
  8679. Specify the end of a range where the output frame will be created as a
  8680. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8681. the default is @code{240}.
  8682. @item scene
  8683. Specify the level at which a scene change is detected as a value between
  8684. 0 and 100 to indicate a new scene; a low value reflects a low
  8685. probability for the current frame to introduce a new scene, while a higher
  8686. value means the current frame is more likely to be one.
  8687. The default is @code{8.2}.
  8688. @item flags
  8689. Specify flags influencing the filter process.
  8690. Available value for @var{flags} is:
  8691. @table @option
  8692. @item scene_change_detect, scd
  8693. Enable scene change detection using the value of the option @var{scene}.
  8694. This flag is enabled by default.
  8695. @end table
  8696. @end table
  8697. @section framestep
  8698. Select one frame every N-th frame.
  8699. This filter accepts the following option:
  8700. @table @option
  8701. @item step
  8702. Select frame after every @code{step} frames.
  8703. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8704. @end table
  8705. @section freezedetect
  8706. Detect frozen video.
  8707. This filter logs a message and sets frame metadata when it detects that the
  8708. input video has no significant change in content during a specified duration.
  8709. Video freeze detection calculates the mean average absolute difference of all
  8710. the components of video frames and compares it to a noise floor.
  8711. The printed times and duration are expressed in seconds. The
  8712. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8713. whose timestamp equals or exceeds the detection duration and it contains the
  8714. timestamp of the first frame of the freeze. The
  8715. @code{lavfi.freezedetect.freeze_duration} and
  8716. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8717. after the freeze.
  8718. The filter accepts the following options:
  8719. @table @option
  8720. @item noise, n
  8721. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8722. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8723. 0.001.
  8724. @item duration, d
  8725. Set freeze duration until notification (default is 2 seconds).
  8726. @end table
  8727. @section freezeframes
  8728. Freeze video frames.
  8729. This filter freezes video frames using frame from 2nd input.
  8730. The filter accepts the following options:
  8731. @table @option
  8732. @item first
  8733. Set number of first frame from which to start freeze.
  8734. @item last
  8735. Set number of last frame from which to end freeze.
  8736. @item replace
  8737. Set number of frame from 2nd input which will be used instead of replaced frames.
  8738. @end table
  8739. @anchor{frei0r}
  8740. @section frei0r
  8741. Apply a frei0r effect to the input video.
  8742. To enable the compilation of this filter, you need to install the frei0r
  8743. header and configure FFmpeg with @code{--enable-frei0r}.
  8744. It accepts the following parameters:
  8745. @table @option
  8746. @item filter_name
  8747. The name of the frei0r effect to load. If the environment variable
  8748. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8749. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8750. Otherwise, the standard frei0r paths are searched, in this order:
  8751. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8752. @file{/usr/lib/frei0r-1/}.
  8753. @item filter_params
  8754. A '|'-separated list of parameters to pass to the frei0r effect.
  8755. @end table
  8756. A frei0r effect parameter can be a boolean (its value is either
  8757. "y" or "n"), a double, a color (specified as
  8758. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8759. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8760. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8761. a position (specified as @var{X}/@var{Y}, where
  8762. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8763. The number and types of parameters depend on the loaded effect. If an
  8764. effect parameter is not specified, the default value is set.
  8765. @subsection Examples
  8766. @itemize
  8767. @item
  8768. Apply the distort0r effect, setting the first two double parameters:
  8769. @example
  8770. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8771. @end example
  8772. @item
  8773. Apply the colordistance effect, taking a color as the first parameter:
  8774. @example
  8775. frei0r=colordistance:0.2/0.3/0.4
  8776. frei0r=colordistance:violet
  8777. frei0r=colordistance:0x112233
  8778. @end example
  8779. @item
  8780. Apply the perspective effect, specifying the top left and top right image
  8781. positions:
  8782. @example
  8783. frei0r=perspective:0.2/0.2|0.8/0.2
  8784. @end example
  8785. @end itemize
  8786. For more information, see
  8787. @url{http://frei0r.dyne.org}
  8788. @section fspp
  8789. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8790. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8791. processing filter, one of them is performed once per block, not per pixel.
  8792. This allows for much higher speed.
  8793. The filter accepts the following options:
  8794. @table @option
  8795. @item quality
  8796. Set quality. This option defines the number of levels for averaging. It accepts
  8797. an integer in the range 4-5. Default value is @code{4}.
  8798. @item qp
  8799. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8800. If not set, the filter will use the QP from the video stream (if available).
  8801. @item strength
  8802. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8803. more details but also more artifacts, while higher values make the image smoother
  8804. but also blurrier. Default value is @code{0} − PSNR optimal.
  8805. @item use_bframe_qp
  8806. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8807. option may cause flicker since the B-Frames have often larger QP. Default is
  8808. @code{0} (not enabled).
  8809. @end table
  8810. @section gblur
  8811. Apply Gaussian blur filter.
  8812. The filter accepts the following options:
  8813. @table @option
  8814. @item sigma
  8815. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8816. @item steps
  8817. Set number of steps for Gaussian approximation. Default is @code{1}.
  8818. @item planes
  8819. Set which planes to filter. By default all planes are filtered.
  8820. @item sigmaV
  8821. Set vertical sigma, if negative it will be same as @code{sigma}.
  8822. Default is @code{-1}.
  8823. @end table
  8824. @subsection Commands
  8825. This filter supports same commands as options.
  8826. The command accepts the same syntax of the corresponding option.
  8827. If the specified expression is not valid, it is kept at its current
  8828. value.
  8829. @section geq
  8830. Apply generic equation to each pixel.
  8831. The filter accepts the following options:
  8832. @table @option
  8833. @item lum_expr, lum
  8834. Set the luminance expression.
  8835. @item cb_expr, cb
  8836. Set the chrominance blue expression.
  8837. @item cr_expr, cr
  8838. Set the chrominance red expression.
  8839. @item alpha_expr, a
  8840. Set the alpha expression.
  8841. @item red_expr, r
  8842. Set the red expression.
  8843. @item green_expr, g
  8844. Set the green expression.
  8845. @item blue_expr, b
  8846. Set the blue expression.
  8847. @end table
  8848. The colorspace is selected according to the specified options. If one
  8849. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8850. options is specified, the filter will automatically select a YCbCr
  8851. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8852. @option{blue_expr} options is specified, it will select an RGB
  8853. colorspace.
  8854. If one of the chrominance expression is not defined, it falls back on the other
  8855. one. If no alpha expression is specified it will evaluate to opaque value.
  8856. If none of chrominance expressions are specified, they will evaluate
  8857. to the luminance expression.
  8858. The expressions can use the following variables and functions:
  8859. @table @option
  8860. @item N
  8861. The sequential number of the filtered frame, starting from @code{0}.
  8862. @item X
  8863. @item Y
  8864. The coordinates of the current sample.
  8865. @item W
  8866. @item H
  8867. The width and height of the image.
  8868. @item SW
  8869. @item SH
  8870. Width and height scale depending on the currently filtered plane. It is the
  8871. ratio between the corresponding luma plane number of pixels and the current
  8872. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8873. @code{0.5,0.5} for chroma planes.
  8874. @item T
  8875. Time of the current frame, expressed in seconds.
  8876. @item p(x, y)
  8877. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8878. plane.
  8879. @item lum(x, y)
  8880. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8881. plane.
  8882. @item cb(x, y)
  8883. Return the value of the pixel at location (@var{x},@var{y}) of the
  8884. blue-difference chroma plane. Return 0 if there is no such plane.
  8885. @item cr(x, y)
  8886. Return the value of the pixel at location (@var{x},@var{y}) of the
  8887. red-difference chroma plane. Return 0 if there is no such plane.
  8888. @item r(x, y)
  8889. @item g(x, y)
  8890. @item b(x, y)
  8891. Return the value of the pixel at location (@var{x},@var{y}) of the
  8892. red/green/blue component. Return 0 if there is no such component.
  8893. @item alpha(x, y)
  8894. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8895. plane. Return 0 if there is no such plane.
  8896. @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)
  8897. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  8898. sums of samples within a rectangle. See the functions without the sum postfix.
  8899. @item interpolation
  8900. Set one of interpolation methods:
  8901. @table @option
  8902. @item nearest, n
  8903. @item bilinear, b
  8904. @end table
  8905. Default is bilinear.
  8906. @end table
  8907. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8908. automatically clipped to the closer edge.
  8909. Please note that this filter can use multiple threads in which case each slice
  8910. will have its own expression state. If you want to use only a single expression
  8911. state because your expressions depend on previous state then you should limit
  8912. the number of filter threads to 1.
  8913. @subsection Examples
  8914. @itemize
  8915. @item
  8916. Flip the image horizontally:
  8917. @example
  8918. geq=p(W-X\,Y)
  8919. @end example
  8920. @item
  8921. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8922. wavelength of 100 pixels:
  8923. @example
  8924. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8925. @end example
  8926. @item
  8927. Generate a fancy enigmatic moving light:
  8928. @example
  8929. 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
  8930. @end example
  8931. @item
  8932. Generate a quick emboss effect:
  8933. @example
  8934. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8935. @end example
  8936. @item
  8937. Modify RGB components depending on pixel position:
  8938. @example
  8939. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8940. @end example
  8941. @item
  8942. Create a radial gradient that is the same size as the input (also see
  8943. the @ref{vignette} filter):
  8944. @example
  8945. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8946. @end example
  8947. @end itemize
  8948. @section gradfun
  8949. Fix the banding artifacts that are sometimes introduced into nearly flat
  8950. regions by truncation to 8-bit color depth.
  8951. Interpolate the gradients that should go where the bands are, and
  8952. dither them.
  8953. It is designed for playback only. Do not use it prior to
  8954. lossy compression, because compression tends to lose the dither and
  8955. bring back the bands.
  8956. It accepts the following parameters:
  8957. @table @option
  8958. @item strength
  8959. The maximum amount by which the filter will change any one pixel. This is also
  8960. the threshold for detecting nearly flat regions. Acceptable values range from
  8961. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8962. valid range.
  8963. @item radius
  8964. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8965. gradients, but also prevents the filter from modifying the pixels near detailed
  8966. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8967. values will be clipped to the valid range.
  8968. @end table
  8969. Alternatively, the options can be specified as a flat string:
  8970. @var{strength}[:@var{radius}]
  8971. @subsection Examples
  8972. @itemize
  8973. @item
  8974. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8975. @example
  8976. gradfun=3.5:8
  8977. @end example
  8978. @item
  8979. Specify radius, omitting the strength (which will fall-back to the default
  8980. value):
  8981. @example
  8982. gradfun=radius=8
  8983. @end example
  8984. @end itemize
  8985. @anchor{graphmonitor}
  8986. @section graphmonitor
  8987. Show various filtergraph stats.
  8988. With this filter one can debug complete filtergraph.
  8989. Especially issues with links filling with queued frames.
  8990. The filter accepts the following options:
  8991. @table @option
  8992. @item size, s
  8993. Set video output size. Default is @var{hd720}.
  8994. @item opacity, o
  8995. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8996. @item mode, m
  8997. Set output mode, can be @var{fulll} or @var{compact}.
  8998. In @var{compact} mode only filters with some queued frames have displayed stats.
  8999. @item flags, f
  9000. Set flags which enable which stats are shown in video.
  9001. Available values for flags are:
  9002. @table @samp
  9003. @item queue
  9004. Display number of queued frames in each link.
  9005. @item frame_count_in
  9006. Display number of frames taken from filter.
  9007. @item frame_count_out
  9008. Display number of frames given out from filter.
  9009. @item pts
  9010. Display current filtered frame pts.
  9011. @item time
  9012. Display current filtered frame time.
  9013. @item timebase
  9014. Display time base for filter link.
  9015. @item format
  9016. Display used format for filter link.
  9017. @item size
  9018. Display video size or number of audio channels in case of audio used by filter link.
  9019. @item rate
  9020. Display video frame rate or sample rate in case of audio used by filter link.
  9021. @end table
  9022. @item rate, r
  9023. Set upper limit for video rate of output stream, Default value is @var{25}.
  9024. This guarantee that output video frame rate will not be higher than this value.
  9025. @end table
  9026. @section greyedge
  9027. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9028. and corrects the scene colors accordingly.
  9029. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9030. The filter accepts the following options:
  9031. @table @option
  9032. @item difford
  9033. The order of differentiation to be applied on the scene. Must be chosen in the range
  9034. [0,2] and default value is 1.
  9035. @item minknorm
  9036. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9037. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9038. max value instead of calculating Minkowski distance.
  9039. @item sigma
  9040. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9041. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9042. can't be equal to 0 if @var{difford} is greater than 0.
  9043. @end table
  9044. @subsection Examples
  9045. @itemize
  9046. @item
  9047. Grey Edge:
  9048. @example
  9049. greyedge=difford=1:minknorm=5:sigma=2
  9050. @end example
  9051. @item
  9052. Max Edge:
  9053. @example
  9054. greyedge=difford=1:minknorm=0:sigma=2
  9055. @end example
  9056. @end itemize
  9057. @anchor{haldclut}
  9058. @section haldclut
  9059. Apply a Hald CLUT to a video stream.
  9060. First input is the video stream to process, and second one is the Hald CLUT.
  9061. The Hald CLUT input can be a simple picture or a complete video stream.
  9062. The filter accepts the following options:
  9063. @table @option
  9064. @item shortest
  9065. Force termination when the shortest input terminates. Default is @code{0}.
  9066. @item repeatlast
  9067. Continue applying the last CLUT after the end of the stream. A value of
  9068. @code{0} disable the filter after the last frame of the CLUT is reached.
  9069. Default is @code{1}.
  9070. @end table
  9071. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9072. filters share the same internals).
  9073. This filter also supports the @ref{framesync} options.
  9074. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9075. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9076. @subsection Workflow examples
  9077. @subsubsection Hald CLUT video stream
  9078. Generate an identity Hald CLUT stream altered with various effects:
  9079. @example
  9080. 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
  9081. @end example
  9082. Note: make sure you use a lossless codec.
  9083. Then use it with @code{haldclut} to apply it on some random stream:
  9084. @example
  9085. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9086. @end example
  9087. The Hald CLUT will be applied to the 10 first seconds (duration of
  9088. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9089. to the remaining frames of the @code{mandelbrot} stream.
  9090. @subsubsection Hald CLUT with preview
  9091. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9092. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9093. biggest possible square starting at the top left of the picture. The remaining
  9094. padding pixels (bottom or right) will be ignored. This area can be used to add
  9095. a preview of the Hald CLUT.
  9096. Typically, the following generated Hald CLUT will be supported by the
  9097. @code{haldclut} filter:
  9098. @example
  9099. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9100. pad=iw+320 [padded_clut];
  9101. smptebars=s=320x256, split [a][b];
  9102. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9103. [main][b] overlay=W-320" -frames:v 1 clut.png
  9104. @end example
  9105. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9106. bars are displayed on the right-top, and below the same color bars processed by
  9107. the color changes.
  9108. Then, the effect of this Hald CLUT can be visualized with:
  9109. @example
  9110. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9111. @end example
  9112. @section hflip
  9113. Flip the input video horizontally.
  9114. For example, to horizontally flip the input video with @command{ffmpeg}:
  9115. @example
  9116. ffmpeg -i in.avi -vf "hflip" out.avi
  9117. @end example
  9118. @section histeq
  9119. This filter applies a global color histogram equalization on a
  9120. per-frame basis.
  9121. It can be used to correct video that has a compressed range of pixel
  9122. intensities. The filter redistributes the pixel intensities to
  9123. equalize their distribution across the intensity range. It may be
  9124. viewed as an "automatically adjusting contrast filter". This filter is
  9125. useful only for correcting degraded or poorly captured source
  9126. video.
  9127. The filter accepts the following options:
  9128. @table @option
  9129. @item strength
  9130. Determine the amount of equalization to be applied. As the strength
  9131. is reduced, the distribution of pixel intensities more-and-more
  9132. approaches that of the input frame. The value must be a float number
  9133. in the range [0,1] and defaults to 0.200.
  9134. @item intensity
  9135. Set the maximum intensity that can generated and scale the output
  9136. values appropriately. The strength should be set as desired and then
  9137. the intensity can be limited if needed to avoid washing-out. The value
  9138. must be a float number in the range [0,1] and defaults to 0.210.
  9139. @item antibanding
  9140. Set the antibanding level. If enabled the filter will randomly vary
  9141. the luminance of output pixels by a small amount to avoid banding of
  9142. the histogram. Possible values are @code{none}, @code{weak} or
  9143. @code{strong}. It defaults to @code{none}.
  9144. @end table
  9145. @anchor{histogram}
  9146. @section histogram
  9147. Compute and draw a color distribution histogram for the input video.
  9148. The computed histogram is a representation of the color component
  9149. distribution in an image.
  9150. Standard histogram displays the color components distribution in an image.
  9151. Displays color graph for each color component. Shows distribution of
  9152. the Y, U, V, A or R, G, B components, depending on input format, in the
  9153. current frame. Below each graph a color component scale meter is shown.
  9154. The filter accepts the following options:
  9155. @table @option
  9156. @item level_height
  9157. Set height of level. Default value is @code{200}.
  9158. Allowed range is [50, 2048].
  9159. @item scale_height
  9160. Set height of color scale. Default value is @code{12}.
  9161. Allowed range is [0, 40].
  9162. @item display_mode
  9163. Set display mode.
  9164. It accepts the following values:
  9165. @table @samp
  9166. @item stack
  9167. Per color component graphs are placed below each other.
  9168. @item parade
  9169. Per color component graphs are placed side by side.
  9170. @item overlay
  9171. Presents information identical to that in the @code{parade}, except
  9172. that the graphs representing color components are superimposed directly
  9173. over one another.
  9174. @end table
  9175. Default is @code{stack}.
  9176. @item levels_mode
  9177. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9178. Default is @code{linear}.
  9179. @item components
  9180. Set what color components to display.
  9181. Default is @code{7}.
  9182. @item fgopacity
  9183. Set foreground opacity. Default is @code{0.7}.
  9184. @item bgopacity
  9185. Set background opacity. Default is @code{0.5}.
  9186. @end table
  9187. @subsection Examples
  9188. @itemize
  9189. @item
  9190. Calculate and draw histogram:
  9191. @example
  9192. ffplay -i input -vf histogram
  9193. @end example
  9194. @end itemize
  9195. @anchor{hqdn3d}
  9196. @section hqdn3d
  9197. This is a high precision/quality 3d denoise filter. It aims to reduce
  9198. image noise, producing smooth images and making still images really
  9199. still. It should enhance compressibility.
  9200. It accepts the following optional parameters:
  9201. @table @option
  9202. @item luma_spatial
  9203. A non-negative floating point number which specifies spatial luma strength.
  9204. It defaults to 4.0.
  9205. @item chroma_spatial
  9206. A non-negative floating point number which specifies spatial chroma strength.
  9207. It defaults to 3.0*@var{luma_spatial}/4.0.
  9208. @item luma_tmp
  9209. A floating point number which specifies luma temporal strength. It defaults to
  9210. 6.0*@var{luma_spatial}/4.0.
  9211. @item chroma_tmp
  9212. A floating point number which specifies chroma temporal strength. It defaults to
  9213. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9214. @end table
  9215. @subsection Commands
  9216. This filter supports same @ref{commands} as options.
  9217. The command accepts the same syntax of the corresponding option.
  9218. If the specified expression is not valid, it is kept at its current
  9219. value.
  9220. @anchor{hwdownload}
  9221. @section hwdownload
  9222. Download hardware frames to system memory.
  9223. The input must be in hardware frames, and the output a non-hardware format.
  9224. Not all formats will be supported on the output - it may be necessary to insert
  9225. an additional @option{format} filter immediately following in the graph to get
  9226. the output in a supported format.
  9227. @section hwmap
  9228. Map hardware frames to system memory or to another device.
  9229. This filter has several different modes of operation; which one is used depends
  9230. on the input and output formats:
  9231. @itemize
  9232. @item
  9233. Hardware frame input, normal frame output
  9234. Map the input frames to system memory and pass them to the output. If the
  9235. original hardware frame is later required (for example, after overlaying
  9236. something else on part of it), the @option{hwmap} filter can be used again
  9237. in the next mode to retrieve it.
  9238. @item
  9239. Normal frame input, hardware frame output
  9240. If the input is actually a software-mapped hardware frame, then unmap it -
  9241. that is, return the original hardware frame.
  9242. Otherwise, a device must be provided. Create new hardware surfaces on that
  9243. device for the output, then map them back to the software format at the input
  9244. and give those frames to the preceding filter. This will then act like the
  9245. @option{hwupload} filter, but may be able to avoid an additional copy when
  9246. the input is already in a compatible format.
  9247. @item
  9248. Hardware frame input and output
  9249. A device must be supplied for the output, either directly or with the
  9250. @option{derive_device} option. The input and output devices must be of
  9251. different types and compatible - the exact meaning of this is
  9252. system-dependent, but typically it means that they must refer to the same
  9253. underlying hardware context (for example, refer to the same graphics card).
  9254. If the input frames were originally created on the output device, then unmap
  9255. to retrieve the original frames.
  9256. Otherwise, map the frames to the output device - create new hardware frames
  9257. on the output corresponding to the frames on the input.
  9258. @end itemize
  9259. The following additional parameters are accepted:
  9260. @table @option
  9261. @item mode
  9262. Set the frame mapping mode. Some combination of:
  9263. @table @var
  9264. @item read
  9265. The mapped frame should be readable.
  9266. @item write
  9267. The mapped frame should be writeable.
  9268. @item overwrite
  9269. The mapping will always overwrite the entire frame.
  9270. This may improve performance in some cases, as the original contents of the
  9271. frame need not be loaded.
  9272. @item direct
  9273. The mapping must not involve any copying.
  9274. Indirect mappings to copies of frames are created in some cases where either
  9275. direct mapping is not possible or it would have unexpected properties.
  9276. Setting this flag ensures that the mapping is direct and will fail if that is
  9277. not possible.
  9278. @end table
  9279. Defaults to @var{read+write} if not specified.
  9280. @item derive_device @var{type}
  9281. Rather than using the device supplied at initialisation, instead derive a new
  9282. device of type @var{type} from the device the input frames exist on.
  9283. @item reverse
  9284. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9285. and map them back to the source. This may be necessary in some cases where
  9286. a mapping in one direction is required but only the opposite direction is
  9287. supported by the devices being used.
  9288. This option is dangerous - it may break the preceding filter in undefined
  9289. ways if there are any additional constraints on that filter's output.
  9290. Do not use it without fully understanding the implications of its use.
  9291. @end table
  9292. @anchor{hwupload}
  9293. @section hwupload
  9294. Upload system memory frames to hardware surfaces.
  9295. The device to upload to must be supplied when the filter is initialised. If
  9296. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9297. option or with the @option{derive_device} option. The input and output devices
  9298. must be of different types and compatible - the exact meaning of this is
  9299. system-dependent, but typically it means that they must refer to the same
  9300. underlying hardware context (for example, refer to the same graphics card).
  9301. The following additional parameters are accepted:
  9302. @table @option
  9303. @item derive_device @var{type}
  9304. Rather than using the device supplied at initialisation, instead derive a new
  9305. device of type @var{type} from the device the input frames exist on.
  9306. @end table
  9307. @anchor{hwupload_cuda}
  9308. @section hwupload_cuda
  9309. Upload system memory frames to a CUDA device.
  9310. It accepts the following optional parameters:
  9311. @table @option
  9312. @item device
  9313. The number of the CUDA device to use
  9314. @end table
  9315. @section hqx
  9316. Apply a high-quality magnification filter designed for pixel art. This filter
  9317. was originally created by Maxim Stepin.
  9318. It accepts the following option:
  9319. @table @option
  9320. @item n
  9321. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9322. @code{hq3x} and @code{4} for @code{hq4x}.
  9323. Default is @code{3}.
  9324. @end table
  9325. @section hstack
  9326. Stack input videos horizontally.
  9327. All streams must be of same pixel format and of same height.
  9328. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9329. to create same output.
  9330. The filter accepts the following option:
  9331. @table @option
  9332. @item inputs
  9333. Set number of input streams. Default is 2.
  9334. @item shortest
  9335. If set to 1, force the output to terminate when the shortest input
  9336. terminates. Default value is 0.
  9337. @end table
  9338. @section hue
  9339. Modify the hue and/or the saturation of the input.
  9340. It accepts the following parameters:
  9341. @table @option
  9342. @item h
  9343. Specify the hue angle as a number of degrees. It accepts an expression,
  9344. and defaults to "0".
  9345. @item s
  9346. Specify the saturation in the [-10,10] range. It accepts an expression and
  9347. defaults to "1".
  9348. @item H
  9349. Specify the hue angle as a number of radians. It accepts an
  9350. expression, and defaults to "0".
  9351. @item b
  9352. Specify the brightness in the [-10,10] range. It accepts an expression and
  9353. defaults to "0".
  9354. @end table
  9355. @option{h} and @option{H} are mutually exclusive, and can't be
  9356. specified at the same time.
  9357. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9358. expressions containing the following constants:
  9359. @table @option
  9360. @item n
  9361. frame count of the input frame starting from 0
  9362. @item pts
  9363. presentation timestamp of the input frame expressed in time base units
  9364. @item r
  9365. frame rate of the input video, NAN if the input frame rate is unknown
  9366. @item t
  9367. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9368. @item tb
  9369. time base of the input video
  9370. @end table
  9371. @subsection Examples
  9372. @itemize
  9373. @item
  9374. Set the hue to 90 degrees and the saturation to 1.0:
  9375. @example
  9376. hue=h=90:s=1
  9377. @end example
  9378. @item
  9379. Same command but expressing the hue in radians:
  9380. @example
  9381. hue=H=PI/2:s=1
  9382. @end example
  9383. @item
  9384. Rotate hue and make the saturation swing between 0
  9385. and 2 over a period of 1 second:
  9386. @example
  9387. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9388. @end example
  9389. @item
  9390. Apply a 3 seconds saturation fade-in effect starting at 0:
  9391. @example
  9392. hue="s=min(t/3\,1)"
  9393. @end example
  9394. The general fade-in expression can be written as:
  9395. @example
  9396. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9397. @end example
  9398. @item
  9399. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9400. @example
  9401. hue="s=max(0\, min(1\, (8-t)/3))"
  9402. @end example
  9403. The general fade-out expression can be written as:
  9404. @example
  9405. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9406. @end example
  9407. @end itemize
  9408. @subsection Commands
  9409. This filter supports the following commands:
  9410. @table @option
  9411. @item b
  9412. @item s
  9413. @item h
  9414. @item H
  9415. Modify the hue and/or the saturation and/or brightness of the input video.
  9416. The command accepts the same syntax of the corresponding option.
  9417. If the specified expression is not valid, it is kept at its current
  9418. value.
  9419. @end table
  9420. @section hysteresis
  9421. Grow first stream into second stream by connecting components.
  9422. This makes it possible to build more robust edge masks.
  9423. This filter accepts the following options:
  9424. @table @option
  9425. @item planes
  9426. Set which planes will be processed as bitmap, unprocessed planes will be
  9427. copied from first stream.
  9428. By default value 0xf, all planes will be processed.
  9429. @item threshold
  9430. Set threshold which is used in filtering. If pixel component value is higher than
  9431. this value filter algorithm for connecting components is activated.
  9432. By default value is 0.
  9433. @end table
  9434. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9435. @section idet
  9436. Detect video interlacing type.
  9437. This filter tries to detect if the input frames are interlaced, progressive,
  9438. top or bottom field first. It will also try to detect fields that are
  9439. repeated between adjacent frames (a sign of telecine).
  9440. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9441. Multiple frame detection incorporates the classification history of previous frames.
  9442. The filter will log these metadata values:
  9443. @table @option
  9444. @item single.current_frame
  9445. Detected type of current frame using single-frame detection. One of:
  9446. ``tff'' (top field first), ``bff'' (bottom field first),
  9447. ``progressive'', or ``undetermined''
  9448. @item single.tff
  9449. Cumulative number of frames detected as top field first using single-frame detection.
  9450. @item multiple.tff
  9451. Cumulative number of frames detected as top field first using multiple-frame detection.
  9452. @item single.bff
  9453. Cumulative number of frames detected as bottom field first using single-frame detection.
  9454. @item multiple.current_frame
  9455. Detected type of current frame using multiple-frame detection. One of:
  9456. ``tff'' (top field first), ``bff'' (bottom field first),
  9457. ``progressive'', or ``undetermined''
  9458. @item multiple.bff
  9459. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9460. @item single.progressive
  9461. Cumulative number of frames detected as progressive using single-frame detection.
  9462. @item multiple.progressive
  9463. Cumulative number of frames detected as progressive using multiple-frame detection.
  9464. @item single.undetermined
  9465. Cumulative number of frames that could not be classified using single-frame detection.
  9466. @item multiple.undetermined
  9467. Cumulative number of frames that could not be classified using multiple-frame detection.
  9468. @item repeated.current_frame
  9469. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9470. @item repeated.neither
  9471. Cumulative number of frames with no repeated field.
  9472. @item repeated.top
  9473. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9474. @item repeated.bottom
  9475. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9476. @end table
  9477. The filter accepts the following options:
  9478. @table @option
  9479. @item intl_thres
  9480. Set interlacing threshold.
  9481. @item prog_thres
  9482. Set progressive threshold.
  9483. @item rep_thres
  9484. Threshold for repeated field detection.
  9485. @item half_life
  9486. Number of frames after which a given frame's contribution to the
  9487. statistics is halved (i.e., it contributes only 0.5 to its
  9488. classification). The default of 0 means that all frames seen are given
  9489. full weight of 1.0 forever.
  9490. @item analyze_interlaced_flag
  9491. When this is not 0 then idet will use the specified number of frames to determine
  9492. if the interlaced flag is accurate, it will not count undetermined frames.
  9493. If the flag is found to be accurate it will be used without any further
  9494. computations, if it is found to be inaccurate it will be cleared without any
  9495. further computations. This allows inserting the idet filter as a low computational
  9496. method to clean up the interlaced flag
  9497. @end table
  9498. @section il
  9499. Deinterleave or interleave fields.
  9500. This filter allows one to process interlaced images fields without
  9501. deinterlacing them. Deinterleaving splits the input frame into 2
  9502. fields (so called half pictures). Odd lines are moved to the top
  9503. half of the output image, even lines to the bottom half.
  9504. You can process (filter) them independently and then re-interleave them.
  9505. The filter accepts the following options:
  9506. @table @option
  9507. @item luma_mode, l
  9508. @item chroma_mode, c
  9509. @item alpha_mode, a
  9510. Available values for @var{luma_mode}, @var{chroma_mode} and
  9511. @var{alpha_mode} are:
  9512. @table @samp
  9513. @item none
  9514. Do nothing.
  9515. @item deinterleave, d
  9516. Deinterleave fields, placing one above the other.
  9517. @item interleave, i
  9518. Interleave fields. Reverse the effect of deinterleaving.
  9519. @end table
  9520. Default value is @code{none}.
  9521. @item luma_swap, ls
  9522. @item chroma_swap, cs
  9523. @item alpha_swap, as
  9524. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9525. @end table
  9526. @subsection Commands
  9527. This filter supports the all above options as @ref{commands}.
  9528. @section inflate
  9529. Apply inflate effect to the video.
  9530. This filter replaces the pixel by the local(3x3) average by taking into account
  9531. only values higher than the pixel.
  9532. It accepts the following options:
  9533. @table @option
  9534. @item threshold0
  9535. @item threshold1
  9536. @item threshold2
  9537. @item threshold3
  9538. Limit the maximum change for each plane, default is 65535.
  9539. If 0, plane will remain unchanged.
  9540. @end table
  9541. @subsection Commands
  9542. This filter supports the all above options as @ref{commands}.
  9543. @section interlace
  9544. Simple interlacing filter from progressive contents. This interleaves upper (or
  9545. lower) lines from odd frames with lower (or upper) lines from even frames,
  9546. halving the frame rate and preserving image height.
  9547. @example
  9548. Original Original New Frame
  9549. Frame 'j' Frame 'j+1' (tff)
  9550. ========== =========== ==================
  9551. Line 0 --------------------> Frame 'j' Line 0
  9552. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9553. Line 2 ---------------------> Frame 'j' Line 2
  9554. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9555. ... ... ...
  9556. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9557. @end example
  9558. It accepts the following optional parameters:
  9559. @table @option
  9560. @item scan
  9561. This determines whether the interlaced frame is taken from the even
  9562. (tff - default) or odd (bff) lines of the progressive frame.
  9563. @item lowpass
  9564. Vertical lowpass filter to avoid twitter interlacing and
  9565. reduce moire patterns.
  9566. @table @samp
  9567. @item 0, off
  9568. Disable vertical lowpass filter
  9569. @item 1, linear
  9570. Enable linear filter (default)
  9571. @item 2, complex
  9572. Enable complex filter. This will slightly less reduce twitter and moire
  9573. but better retain detail and subjective sharpness impression.
  9574. @end table
  9575. @end table
  9576. @section kerndeint
  9577. Deinterlace input video by applying Donald Graft's adaptive kernel
  9578. deinterling. Work on interlaced parts of a video to produce
  9579. progressive frames.
  9580. The description of the accepted parameters follows.
  9581. @table @option
  9582. @item thresh
  9583. Set the threshold which affects the filter's tolerance when
  9584. determining if a pixel line must be processed. It must be an integer
  9585. in the range [0,255] and defaults to 10. A value of 0 will result in
  9586. applying the process on every pixels.
  9587. @item map
  9588. Paint pixels exceeding the threshold value to white if set to 1.
  9589. Default is 0.
  9590. @item order
  9591. Set the fields order. Swap fields if set to 1, leave fields alone if
  9592. 0. Default is 0.
  9593. @item sharp
  9594. Enable additional sharpening if set to 1. Default is 0.
  9595. @item twoway
  9596. Enable twoway sharpening if set to 1. Default is 0.
  9597. @end table
  9598. @subsection Examples
  9599. @itemize
  9600. @item
  9601. Apply default values:
  9602. @example
  9603. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9604. @end example
  9605. @item
  9606. Enable additional sharpening:
  9607. @example
  9608. kerndeint=sharp=1
  9609. @end example
  9610. @item
  9611. Paint processed pixels in white:
  9612. @example
  9613. kerndeint=map=1
  9614. @end example
  9615. @end itemize
  9616. @section lagfun
  9617. Slowly update darker pixels.
  9618. This filter makes short flashes of light appear longer.
  9619. This filter accepts the following options:
  9620. @table @option
  9621. @item decay
  9622. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9623. @item planes
  9624. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9625. @end table
  9626. @section lenscorrection
  9627. Correct radial lens distortion
  9628. This filter can be used to correct for radial distortion as can result from the use
  9629. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9630. one can use tools available for example as part of opencv or simply trial-and-error.
  9631. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9632. and extract the k1 and k2 coefficients from the resulting matrix.
  9633. Note that effectively the same filter is available in the open-source tools Krita and
  9634. Digikam from the KDE project.
  9635. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9636. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9637. brightness distribution, so you may want to use both filters together in certain
  9638. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9639. be applied before or after lens correction.
  9640. @subsection Options
  9641. The filter accepts the following options:
  9642. @table @option
  9643. @item cx
  9644. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9645. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9646. width. Default is 0.5.
  9647. @item cy
  9648. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9649. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9650. height. Default is 0.5.
  9651. @item k1
  9652. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9653. no correction. Default is 0.
  9654. @item k2
  9655. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9656. 0 means no correction. Default is 0.
  9657. @end table
  9658. The formula that generates the correction is:
  9659. @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)
  9660. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9661. distances from the focal point in the source and target images, respectively.
  9662. @section lensfun
  9663. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9664. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9665. to apply the lens correction. The filter will load the lensfun database and
  9666. query it to find the corresponding camera and lens entries in the database. As
  9667. long as these entries can be found with the given options, the filter can
  9668. perform corrections on frames. Note that incomplete strings will result in the
  9669. filter choosing the best match with the given options, and the filter will
  9670. output the chosen camera and lens models (logged with level "info"). You must
  9671. provide the make, camera model, and lens model as they are required.
  9672. The filter accepts the following options:
  9673. @table @option
  9674. @item make
  9675. The make of the camera (for example, "Canon"). This option is required.
  9676. @item model
  9677. The model of the camera (for example, "Canon EOS 100D"). This option is
  9678. required.
  9679. @item lens_model
  9680. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9681. option is required.
  9682. @item mode
  9683. The type of correction to apply. The following values are valid options:
  9684. @table @samp
  9685. @item vignetting
  9686. Enables fixing lens vignetting.
  9687. @item geometry
  9688. Enables fixing lens geometry. This is the default.
  9689. @item subpixel
  9690. Enables fixing chromatic aberrations.
  9691. @item vig_geo
  9692. Enables fixing lens vignetting and lens geometry.
  9693. @item vig_subpixel
  9694. Enables fixing lens vignetting and chromatic aberrations.
  9695. @item distortion
  9696. Enables fixing both lens geometry and chromatic aberrations.
  9697. @item all
  9698. Enables all possible corrections.
  9699. @end table
  9700. @item focal_length
  9701. The focal length of the image/video (zoom; expected constant for video). For
  9702. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9703. range should be chosen when using that lens. Default 18.
  9704. @item aperture
  9705. The aperture of the image/video (expected constant for video). Note that
  9706. aperture is only used for vignetting correction. Default 3.5.
  9707. @item focus_distance
  9708. The focus distance of the image/video (expected constant for video). Note that
  9709. focus distance is only used for vignetting and only slightly affects the
  9710. vignetting correction process. If unknown, leave it at the default value (which
  9711. is 1000).
  9712. @item scale
  9713. The scale factor which is applied after transformation. After correction the
  9714. video is no longer necessarily rectangular. This parameter controls how much of
  9715. the resulting image is visible. The value 0 means that a value will be chosen
  9716. automatically such that there is little or no unmapped area in the output
  9717. image. 1.0 means that no additional scaling is done. Lower values may result
  9718. in more of the corrected image being visible, while higher values may avoid
  9719. unmapped areas in the output.
  9720. @item target_geometry
  9721. The target geometry of the output image/video. The following values are valid
  9722. options:
  9723. @table @samp
  9724. @item rectilinear (default)
  9725. @item fisheye
  9726. @item panoramic
  9727. @item equirectangular
  9728. @item fisheye_orthographic
  9729. @item fisheye_stereographic
  9730. @item fisheye_equisolid
  9731. @item fisheye_thoby
  9732. @end table
  9733. @item reverse
  9734. Apply the reverse of image correction (instead of correcting distortion, apply
  9735. it).
  9736. @item interpolation
  9737. The type of interpolation used when correcting distortion. The following values
  9738. are valid options:
  9739. @table @samp
  9740. @item nearest
  9741. @item linear (default)
  9742. @item lanczos
  9743. @end table
  9744. @end table
  9745. @subsection Examples
  9746. @itemize
  9747. @item
  9748. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9749. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9750. aperture of "8.0".
  9751. @example
  9752. 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
  9753. @end example
  9754. @item
  9755. Apply the same as before, but only for the first 5 seconds of video.
  9756. @example
  9757. 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
  9758. @end example
  9759. @end itemize
  9760. @section libvmaf
  9761. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9762. score between two input videos.
  9763. The obtained VMAF score is printed through the logging system.
  9764. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9765. After installing the library it can be enabled using:
  9766. @code{./configure --enable-libvmaf --enable-version3}.
  9767. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9768. The filter has following options:
  9769. @table @option
  9770. @item model_path
  9771. Set the model path which is to be used for SVM.
  9772. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9773. @item log_path
  9774. Set the file path to be used to store logs.
  9775. @item log_fmt
  9776. Set the format of the log file (xml or json).
  9777. @item enable_transform
  9778. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9779. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9780. Default value: @code{false}
  9781. @item phone_model
  9782. Invokes the phone model which will generate VMAF scores higher than in the
  9783. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9784. Default value: @code{false}
  9785. @item psnr
  9786. Enables computing psnr along with vmaf.
  9787. Default value: @code{false}
  9788. @item ssim
  9789. Enables computing ssim along with vmaf.
  9790. Default value: @code{false}
  9791. @item ms_ssim
  9792. Enables computing ms_ssim along with vmaf.
  9793. Default value: @code{false}
  9794. @item pool
  9795. Set the pool method to be used for computing vmaf.
  9796. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9797. @item n_threads
  9798. Set number of threads to be used when computing vmaf.
  9799. Default value: @code{0}, which makes use of all available logical processors.
  9800. @item n_subsample
  9801. Set interval for frame subsampling used when computing vmaf.
  9802. Default value: @code{1}
  9803. @item enable_conf_interval
  9804. Enables confidence interval.
  9805. Default value: @code{false}
  9806. @end table
  9807. This filter also supports the @ref{framesync} options.
  9808. @subsection Examples
  9809. @itemize
  9810. @item
  9811. On the below examples the input file @file{main.mpg} being processed is
  9812. compared with the reference file @file{ref.mpg}.
  9813. @example
  9814. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9815. @end example
  9816. @item
  9817. Example with options:
  9818. @example
  9819. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9820. @end example
  9821. @item
  9822. Example with options and different containers:
  9823. @example
  9824. 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]libvmaf=psnr=1:log_fmt=json" -f null -
  9825. @end example
  9826. @end itemize
  9827. @section limiter
  9828. Limits the pixel components values to the specified range [min, max].
  9829. The filter accepts the following options:
  9830. @table @option
  9831. @item min
  9832. Lower bound. Defaults to the lowest allowed value for the input.
  9833. @item max
  9834. Upper bound. Defaults to the highest allowed value for the input.
  9835. @item planes
  9836. Specify which planes will be processed. Defaults to all available.
  9837. @end table
  9838. @section loop
  9839. Loop video frames.
  9840. The filter accepts the following options:
  9841. @table @option
  9842. @item loop
  9843. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9844. Default is 0.
  9845. @item size
  9846. Set maximal size in number of frames. Default is 0.
  9847. @item start
  9848. Set first frame of loop. Default is 0.
  9849. @end table
  9850. @subsection Examples
  9851. @itemize
  9852. @item
  9853. Loop single first frame infinitely:
  9854. @example
  9855. loop=loop=-1:size=1:start=0
  9856. @end example
  9857. @item
  9858. Loop single first frame 10 times:
  9859. @example
  9860. loop=loop=10:size=1:start=0
  9861. @end example
  9862. @item
  9863. Loop 10 first frames 5 times:
  9864. @example
  9865. loop=loop=5:size=10:start=0
  9866. @end example
  9867. @end itemize
  9868. @section lut1d
  9869. Apply a 1D LUT to an input video.
  9870. The filter accepts the following options:
  9871. @table @option
  9872. @item file
  9873. Set the 1D LUT file name.
  9874. Currently supported formats:
  9875. @table @samp
  9876. @item cube
  9877. Iridas
  9878. @item csp
  9879. cineSpace
  9880. @end table
  9881. @item interp
  9882. Select interpolation mode.
  9883. Available values are:
  9884. @table @samp
  9885. @item nearest
  9886. Use values from the nearest defined point.
  9887. @item linear
  9888. Interpolate values using the linear interpolation.
  9889. @item cosine
  9890. Interpolate values using the cosine interpolation.
  9891. @item cubic
  9892. Interpolate values using the cubic interpolation.
  9893. @item spline
  9894. Interpolate values using the spline interpolation.
  9895. @end table
  9896. @end table
  9897. @anchor{lut3d}
  9898. @section lut3d
  9899. Apply a 3D LUT to an input video.
  9900. The filter accepts the following options:
  9901. @table @option
  9902. @item file
  9903. Set the 3D LUT file name.
  9904. Currently supported formats:
  9905. @table @samp
  9906. @item 3dl
  9907. AfterEffects
  9908. @item cube
  9909. Iridas
  9910. @item dat
  9911. DaVinci
  9912. @item m3d
  9913. Pandora
  9914. @item csp
  9915. cineSpace
  9916. @end table
  9917. @item interp
  9918. Select interpolation mode.
  9919. Available values are:
  9920. @table @samp
  9921. @item nearest
  9922. Use values from the nearest defined point.
  9923. @item trilinear
  9924. Interpolate values using the 8 points defining a cube.
  9925. @item tetrahedral
  9926. Interpolate values using a tetrahedron.
  9927. @end table
  9928. @end table
  9929. @section lumakey
  9930. Turn certain luma values into transparency.
  9931. The filter accepts the following options:
  9932. @table @option
  9933. @item threshold
  9934. Set the luma which will be used as base for transparency.
  9935. Default value is @code{0}.
  9936. @item tolerance
  9937. Set the range of luma values to be keyed out.
  9938. Default value is @code{0.01}.
  9939. @item softness
  9940. Set the range of softness. Default value is @code{0}.
  9941. Use this to control gradual transition from zero to full transparency.
  9942. @end table
  9943. @subsection Commands
  9944. This filter supports same @ref{commands} as options.
  9945. The command accepts the same syntax of the corresponding option.
  9946. If the specified expression is not valid, it is kept at its current
  9947. value.
  9948. @section lut, lutrgb, lutyuv
  9949. Compute a look-up table for binding each pixel component input value
  9950. to an output value, and apply it to the input video.
  9951. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9952. to an RGB input video.
  9953. These filters accept the following parameters:
  9954. @table @option
  9955. @item c0
  9956. set first pixel component expression
  9957. @item c1
  9958. set second pixel component expression
  9959. @item c2
  9960. set third pixel component expression
  9961. @item c3
  9962. set fourth pixel component expression, corresponds to the alpha component
  9963. @item r
  9964. set red component expression
  9965. @item g
  9966. set green component expression
  9967. @item b
  9968. set blue component expression
  9969. @item a
  9970. alpha component expression
  9971. @item y
  9972. set Y/luminance component expression
  9973. @item u
  9974. set U/Cb component expression
  9975. @item v
  9976. set V/Cr component expression
  9977. @end table
  9978. Each of them specifies the expression to use for computing the lookup table for
  9979. the corresponding pixel component values.
  9980. The exact component associated to each of the @var{c*} options depends on the
  9981. format in input.
  9982. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9983. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9984. The expressions can contain the following constants and functions:
  9985. @table @option
  9986. @item w
  9987. @item h
  9988. The input width and height.
  9989. @item val
  9990. The input value for the pixel component.
  9991. @item clipval
  9992. The input value, clipped to the @var{minval}-@var{maxval} range.
  9993. @item maxval
  9994. The maximum value for the pixel component.
  9995. @item minval
  9996. The minimum value for the pixel component.
  9997. @item negval
  9998. The negated value for the pixel component value, clipped to the
  9999. @var{minval}-@var{maxval} range; it corresponds to the expression
  10000. "maxval-clipval+minval".
  10001. @item clip(val)
  10002. The computed value in @var{val}, clipped to the
  10003. @var{minval}-@var{maxval} range.
  10004. @item gammaval(gamma)
  10005. The computed gamma correction value of the pixel component value,
  10006. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10007. expression
  10008. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10009. @end table
  10010. All expressions default to "val".
  10011. @subsection Examples
  10012. @itemize
  10013. @item
  10014. Negate input video:
  10015. @example
  10016. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10017. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10018. @end example
  10019. The above is the same as:
  10020. @example
  10021. lutrgb="r=negval:g=negval:b=negval"
  10022. lutyuv="y=negval:u=negval:v=negval"
  10023. @end example
  10024. @item
  10025. Negate luminance:
  10026. @example
  10027. lutyuv=y=negval
  10028. @end example
  10029. @item
  10030. Remove chroma components, turning the video into a graytone image:
  10031. @example
  10032. lutyuv="u=128:v=128"
  10033. @end example
  10034. @item
  10035. Apply a luma burning effect:
  10036. @example
  10037. lutyuv="y=2*val"
  10038. @end example
  10039. @item
  10040. Remove green and blue components:
  10041. @example
  10042. lutrgb="g=0:b=0"
  10043. @end example
  10044. @item
  10045. Set a constant alpha channel value on input:
  10046. @example
  10047. format=rgba,lutrgb=a="maxval-minval/2"
  10048. @end example
  10049. @item
  10050. Correct luminance gamma by a factor of 0.5:
  10051. @example
  10052. lutyuv=y=gammaval(0.5)
  10053. @end example
  10054. @item
  10055. Discard least significant bits of luma:
  10056. @example
  10057. lutyuv=y='bitand(val, 128+64+32)'
  10058. @end example
  10059. @item
  10060. Technicolor like effect:
  10061. @example
  10062. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10063. @end example
  10064. @end itemize
  10065. @section lut2, tlut2
  10066. The @code{lut2} filter takes two input streams and outputs one
  10067. stream.
  10068. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10069. from one single stream.
  10070. This filter accepts the following parameters:
  10071. @table @option
  10072. @item c0
  10073. set first pixel component expression
  10074. @item c1
  10075. set second pixel component expression
  10076. @item c2
  10077. set third pixel component expression
  10078. @item c3
  10079. set fourth pixel component expression, corresponds to the alpha component
  10080. @item d
  10081. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10082. which means bit depth is automatically picked from first input format.
  10083. @end table
  10084. The @code{lut2} filter also supports the @ref{framesync} options.
  10085. Each of them specifies the expression to use for computing the lookup table for
  10086. the corresponding pixel component values.
  10087. The exact component associated to each of the @var{c*} options depends on the
  10088. format in inputs.
  10089. The expressions can contain the following constants:
  10090. @table @option
  10091. @item w
  10092. @item h
  10093. The input width and height.
  10094. @item x
  10095. The first input value for the pixel component.
  10096. @item y
  10097. The second input value for the pixel component.
  10098. @item bdx
  10099. The first input video bit depth.
  10100. @item bdy
  10101. The second input video bit depth.
  10102. @end table
  10103. All expressions default to "x".
  10104. @subsection Examples
  10105. @itemize
  10106. @item
  10107. Highlight differences between two RGB video streams:
  10108. @example
  10109. 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)'
  10110. @end example
  10111. @item
  10112. Highlight differences between two YUV video streams:
  10113. @example
  10114. 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)'
  10115. @end example
  10116. @item
  10117. Show max difference between two video streams:
  10118. @example
  10119. 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)))'
  10120. @end example
  10121. @end itemize
  10122. @section maskedclamp
  10123. Clamp the first input stream with the second input and third input stream.
  10124. Returns the value of first stream to be between second input
  10125. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10126. This filter accepts the following options:
  10127. @table @option
  10128. @item undershoot
  10129. Default value is @code{0}.
  10130. @item overshoot
  10131. Default value is @code{0}.
  10132. @item planes
  10133. Set which planes will be processed as bitmap, unprocessed planes will be
  10134. copied from first stream.
  10135. By default value 0xf, all planes will be processed.
  10136. @end table
  10137. @section maskedmax
  10138. Merge the second and third input stream into output stream using absolute differences
  10139. between second input stream and first input stream and absolute difference between
  10140. third input stream and first input stream. The picked value will be from second input
  10141. stream if second absolute difference is greater than first one or from third input stream
  10142. otherwise.
  10143. This filter accepts the following options:
  10144. @table @option
  10145. @item planes
  10146. Set which planes will be processed as bitmap, unprocessed planes will be
  10147. copied from first stream.
  10148. By default value 0xf, all planes will be processed.
  10149. @end table
  10150. @section maskedmerge
  10151. Merge the first input stream with the second input stream using per pixel
  10152. weights in the third input stream.
  10153. A value of 0 in the third stream pixel component means that pixel component
  10154. from first stream is returned unchanged, while maximum value (eg. 255 for
  10155. 8-bit videos) means that pixel component from second stream is returned
  10156. unchanged. Intermediate values define the amount of merging between both
  10157. input stream's pixel components.
  10158. This filter accepts the following options:
  10159. @table @option
  10160. @item planes
  10161. Set which planes will be processed as bitmap, unprocessed planes will be
  10162. copied from first stream.
  10163. By default value 0xf, all planes will be processed.
  10164. @end table
  10165. @section maskedmin
  10166. Merge the second and third input stream into output stream using absolute differences
  10167. between second input stream and first input stream and absolute difference between
  10168. third input stream and first input stream. The picked value will be from second input
  10169. stream if second absolute difference is less than first one or from third input stream
  10170. otherwise.
  10171. This filter accepts the following options:
  10172. @table @option
  10173. @item planes
  10174. Set which planes will be processed as bitmap, unprocessed planes will be
  10175. copied from first stream.
  10176. By default value 0xf, all planes will be processed.
  10177. @end table
  10178. @section maskedthreshold
  10179. Pick pixels comparing absolute difference of two video streams with fixed
  10180. threshold.
  10181. If absolute difference between pixel component of first and second video
  10182. stream is equal or lower than user supplied threshold than pixel component
  10183. from first video stream is picked, otherwise pixel component from second
  10184. video stream is picked.
  10185. This filter accepts the following options:
  10186. @table @option
  10187. @item threshold
  10188. Set threshold used when picking pixels from absolute difference from two input
  10189. video streams.
  10190. @item planes
  10191. Set which planes will be processed as bitmap, unprocessed planes will be
  10192. copied from second stream.
  10193. By default value 0xf, all planes will be processed.
  10194. @end table
  10195. @section maskfun
  10196. Create mask from input video.
  10197. For example it is useful to create motion masks after @code{tblend} filter.
  10198. This filter accepts the following options:
  10199. @table @option
  10200. @item low
  10201. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10202. @item high
  10203. Set high threshold. Any pixel component higher than this value will be set to max value
  10204. allowed for current pixel format.
  10205. @item planes
  10206. Set planes to filter, by default all available planes are filtered.
  10207. @item fill
  10208. Fill all frame pixels with this value.
  10209. @item sum
  10210. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10211. average, output frame will be completely filled with value set by @var{fill} option.
  10212. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10213. @end table
  10214. @section mcdeint
  10215. Apply motion-compensation deinterlacing.
  10216. It needs one field per frame as input and must thus be used together
  10217. with yadif=1/3 or equivalent.
  10218. This filter accepts the following options:
  10219. @table @option
  10220. @item mode
  10221. Set the deinterlacing mode.
  10222. It accepts one of the following values:
  10223. @table @samp
  10224. @item fast
  10225. @item medium
  10226. @item slow
  10227. use iterative motion estimation
  10228. @item extra_slow
  10229. like @samp{slow}, but use multiple reference frames.
  10230. @end table
  10231. Default value is @samp{fast}.
  10232. @item parity
  10233. Set the picture field parity assumed for the input video. It must be
  10234. one of the following values:
  10235. @table @samp
  10236. @item 0, tff
  10237. assume top field first
  10238. @item 1, bff
  10239. assume bottom field first
  10240. @end table
  10241. Default value is @samp{bff}.
  10242. @item qp
  10243. Set per-block quantization parameter (QP) used by the internal
  10244. encoder.
  10245. Higher values should result in a smoother motion vector field but less
  10246. optimal individual vectors. Default value is 1.
  10247. @end table
  10248. @section median
  10249. Pick median pixel from certain rectangle defined by radius.
  10250. This filter accepts the following options:
  10251. @table @option
  10252. @item radius
  10253. Set horizontal radius size. Default value is @code{1}.
  10254. Allowed range is integer from 1 to 127.
  10255. @item planes
  10256. Set which planes to process. Default is @code{15}, which is all available planes.
  10257. @item radiusV
  10258. Set vertical radius size. Default value is @code{0}.
  10259. Allowed range is integer from 0 to 127.
  10260. If it is 0, value will be picked from horizontal @code{radius} option.
  10261. @item percentile
  10262. Set median percentile. Default value is @code{0.5}.
  10263. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10264. minimum values, and @code{1} maximum values.
  10265. @end table
  10266. @subsection Commands
  10267. This filter supports same @ref{commands} as options.
  10268. The command accepts the same syntax of the corresponding option.
  10269. If the specified expression is not valid, it is kept at its current
  10270. value.
  10271. @section mergeplanes
  10272. Merge color channel components from several video streams.
  10273. The filter accepts up to 4 input streams, and merge selected input
  10274. planes to the output video.
  10275. This filter accepts the following options:
  10276. @table @option
  10277. @item mapping
  10278. Set input to output plane mapping. Default is @code{0}.
  10279. The mappings is specified as a bitmap. It should be specified as a
  10280. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10281. mapping for the first plane of the output stream. 'A' sets the number of
  10282. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10283. corresponding input to use (from 0 to 3). The rest of the mappings is
  10284. similar, 'Bb' describes the mapping for the output stream second
  10285. plane, 'Cc' describes the mapping for the output stream third plane and
  10286. 'Dd' describes the mapping for the output stream fourth plane.
  10287. @item format
  10288. Set output pixel format. Default is @code{yuva444p}.
  10289. @end table
  10290. @subsection Examples
  10291. @itemize
  10292. @item
  10293. Merge three gray video streams of same width and height into single video stream:
  10294. @example
  10295. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10296. @end example
  10297. @item
  10298. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10299. @example
  10300. [a0][a1]mergeplanes=0x00010210:yuva444p
  10301. @end example
  10302. @item
  10303. Swap Y and A plane in yuva444p stream:
  10304. @example
  10305. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10306. @end example
  10307. @item
  10308. Swap U and V plane in yuv420p stream:
  10309. @example
  10310. format=yuv420p,mergeplanes=0x000201:yuv420p
  10311. @end example
  10312. @item
  10313. Cast a rgb24 clip to yuv444p:
  10314. @example
  10315. format=rgb24,mergeplanes=0x000102:yuv444p
  10316. @end example
  10317. @end itemize
  10318. @section mestimate
  10319. Estimate and export motion vectors using block matching algorithms.
  10320. Motion vectors are stored in frame side data to be used by other filters.
  10321. This filter accepts the following options:
  10322. @table @option
  10323. @item method
  10324. Specify the motion estimation method. Accepts one of the following values:
  10325. @table @samp
  10326. @item esa
  10327. Exhaustive search algorithm.
  10328. @item tss
  10329. Three step search algorithm.
  10330. @item tdls
  10331. Two dimensional logarithmic search algorithm.
  10332. @item ntss
  10333. New three step search algorithm.
  10334. @item fss
  10335. Four step search algorithm.
  10336. @item ds
  10337. Diamond search algorithm.
  10338. @item hexbs
  10339. Hexagon-based search algorithm.
  10340. @item epzs
  10341. Enhanced predictive zonal search algorithm.
  10342. @item umh
  10343. Uneven multi-hexagon search algorithm.
  10344. @end table
  10345. Default value is @samp{esa}.
  10346. @item mb_size
  10347. Macroblock size. Default @code{16}.
  10348. @item search_param
  10349. Search parameter. Default @code{7}.
  10350. @end table
  10351. @section midequalizer
  10352. Apply Midway Image Equalization effect using two video streams.
  10353. Midway Image Equalization adjusts a pair of images to have the same
  10354. histogram, while maintaining their dynamics as much as possible. It's
  10355. useful for e.g. matching exposures from a pair of stereo cameras.
  10356. This filter has two inputs and one output, which must be of same pixel format, but
  10357. may be of different sizes. The output of filter is first input adjusted with
  10358. midway histogram of both inputs.
  10359. This filter accepts the following option:
  10360. @table @option
  10361. @item planes
  10362. Set which planes to process. Default is @code{15}, which is all available planes.
  10363. @end table
  10364. @section minterpolate
  10365. Convert the video to specified frame rate using motion interpolation.
  10366. This filter accepts the following options:
  10367. @table @option
  10368. @item fps
  10369. 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}.
  10370. @item mi_mode
  10371. Motion interpolation mode. Following values are accepted:
  10372. @table @samp
  10373. @item dup
  10374. Duplicate previous or next frame for interpolating new ones.
  10375. @item blend
  10376. Blend source frames. Interpolated frame is mean of previous and next frames.
  10377. @item mci
  10378. Motion compensated interpolation. Following options are effective when this mode is selected:
  10379. @table @samp
  10380. @item mc_mode
  10381. Motion compensation mode. Following values are accepted:
  10382. @table @samp
  10383. @item obmc
  10384. Overlapped block motion compensation.
  10385. @item aobmc
  10386. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10387. @end table
  10388. Default mode is @samp{obmc}.
  10389. @item me_mode
  10390. Motion estimation mode. Following values are accepted:
  10391. @table @samp
  10392. @item bidir
  10393. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10394. @item bilat
  10395. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10396. @end table
  10397. Default mode is @samp{bilat}.
  10398. @item me
  10399. The algorithm to be used for motion estimation. Following values are accepted:
  10400. @table @samp
  10401. @item esa
  10402. Exhaustive search algorithm.
  10403. @item tss
  10404. Three step search algorithm.
  10405. @item tdls
  10406. Two dimensional logarithmic search algorithm.
  10407. @item ntss
  10408. New three step search algorithm.
  10409. @item fss
  10410. Four step search algorithm.
  10411. @item ds
  10412. Diamond search algorithm.
  10413. @item hexbs
  10414. Hexagon-based search algorithm.
  10415. @item epzs
  10416. Enhanced predictive zonal search algorithm.
  10417. @item umh
  10418. Uneven multi-hexagon search algorithm.
  10419. @end table
  10420. Default algorithm is @samp{epzs}.
  10421. @item mb_size
  10422. Macroblock size. Default @code{16}.
  10423. @item search_param
  10424. Motion estimation search parameter. Default @code{32}.
  10425. @item vsbmc
  10426. 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).
  10427. @end table
  10428. @end table
  10429. @item scd
  10430. 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:
  10431. @table @samp
  10432. @item none
  10433. Disable scene change detection.
  10434. @item fdiff
  10435. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10436. @end table
  10437. Default method is @samp{fdiff}.
  10438. @item scd_threshold
  10439. Scene change detection threshold. Default is @code{10.}.
  10440. @end table
  10441. @section mix
  10442. Mix several video input streams into one video stream.
  10443. A description of the accepted options follows.
  10444. @table @option
  10445. @item nb_inputs
  10446. The number of inputs. If unspecified, it defaults to 2.
  10447. @item weights
  10448. Specify weight of each input video stream as sequence.
  10449. Each weight is separated by space. If number of weights
  10450. is smaller than number of @var{frames} last specified
  10451. weight will be used for all remaining unset weights.
  10452. @item scale
  10453. Specify scale, if it is set it will be multiplied with sum
  10454. of each weight multiplied with pixel values to give final destination
  10455. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10456. @item duration
  10457. Specify how end of stream is determined.
  10458. @table @samp
  10459. @item longest
  10460. The duration of the longest input. (default)
  10461. @item shortest
  10462. The duration of the shortest input.
  10463. @item first
  10464. The duration of the first input.
  10465. @end table
  10466. @end table
  10467. @section mpdecimate
  10468. Drop frames that do not differ greatly from the previous frame in
  10469. order to reduce frame rate.
  10470. The main use of this filter is for very-low-bitrate encoding
  10471. (e.g. streaming over dialup modem), but it could in theory be used for
  10472. fixing movies that were inverse-telecined incorrectly.
  10473. A description of the accepted options follows.
  10474. @table @option
  10475. @item max
  10476. Set the maximum number of consecutive frames which can be dropped (if
  10477. positive), or the minimum interval between dropped frames (if
  10478. negative). If the value is 0, the frame is dropped disregarding the
  10479. number of previous sequentially dropped frames.
  10480. Default value is 0.
  10481. @item hi
  10482. @item lo
  10483. @item frac
  10484. Set the dropping threshold values.
  10485. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10486. represent actual pixel value differences, so a threshold of 64
  10487. corresponds to 1 unit of difference for each pixel, or the same spread
  10488. out differently over the block.
  10489. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10490. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10491. meaning the whole image) differ by more than a threshold of @option{lo}.
  10492. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10493. 64*5, and default value for @option{frac} is 0.33.
  10494. @end table
  10495. @section negate
  10496. Negate (invert) the input video.
  10497. It accepts the following option:
  10498. @table @option
  10499. @item negate_alpha
  10500. With value 1, it negates the alpha component, if present. Default value is 0.
  10501. @end table
  10502. @anchor{nlmeans}
  10503. @section nlmeans
  10504. Denoise frames using Non-Local Means algorithm.
  10505. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10506. context similarity is defined by comparing their surrounding patches of size
  10507. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10508. around the pixel.
  10509. Note that the research area defines centers for patches, which means some
  10510. patches will be made of pixels outside that research area.
  10511. The filter accepts the following options.
  10512. @table @option
  10513. @item s
  10514. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10515. @item p
  10516. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10517. @item pc
  10518. Same as @option{p} but for chroma planes.
  10519. The default value is @var{0} and means automatic.
  10520. @item r
  10521. Set research size. Default is 15. Must be odd number in range [0, 99].
  10522. @item rc
  10523. Same as @option{r} but for chroma planes.
  10524. The default value is @var{0} and means automatic.
  10525. @end table
  10526. @section nnedi
  10527. Deinterlace video using neural network edge directed interpolation.
  10528. This filter accepts the following options:
  10529. @table @option
  10530. @item weights
  10531. Mandatory option, without binary file filter can not work.
  10532. Currently file can be found here:
  10533. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10534. @item deint
  10535. Set which frames to deinterlace, by default it is @code{all}.
  10536. Can be @code{all} or @code{interlaced}.
  10537. @item field
  10538. Set mode of operation.
  10539. Can be one of the following:
  10540. @table @samp
  10541. @item af
  10542. Use frame flags, both fields.
  10543. @item a
  10544. Use frame flags, single field.
  10545. @item t
  10546. Use top field only.
  10547. @item b
  10548. Use bottom field only.
  10549. @item tf
  10550. Use both fields, top first.
  10551. @item bf
  10552. Use both fields, bottom first.
  10553. @end table
  10554. @item planes
  10555. Set which planes to process, by default filter process all frames.
  10556. @item nsize
  10557. Set size of local neighborhood around each pixel, used by the predictor neural
  10558. network.
  10559. Can be one of the following:
  10560. @table @samp
  10561. @item s8x6
  10562. @item s16x6
  10563. @item s32x6
  10564. @item s48x6
  10565. @item s8x4
  10566. @item s16x4
  10567. @item s32x4
  10568. @end table
  10569. @item nns
  10570. Set the number of neurons in predictor neural network.
  10571. Can be one of the following:
  10572. @table @samp
  10573. @item n16
  10574. @item n32
  10575. @item n64
  10576. @item n128
  10577. @item n256
  10578. @end table
  10579. @item qual
  10580. Controls the number of different neural network predictions that are blended
  10581. together to compute the final output value. Can be @code{fast}, default or
  10582. @code{slow}.
  10583. @item etype
  10584. Set which set of weights to use in the predictor.
  10585. Can be one of the following:
  10586. @table @samp
  10587. @item a
  10588. weights trained to minimize absolute error
  10589. @item s
  10590. weights trained to minimize squared error
  10591. @end table
  10592. @item pscrn
  10593. Controls whether or not the prescreener neural network is used to decide
  10594. which pixels should be processed by the predictor neural network and which
  10595. can be handled by simple cubic interpolation.
  10596. The prescreener is trained to know whether cubic interpolation will be
  10597. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10598. The computational complexity of the prescreener nn is much less than that of
  10599. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10600. using the prescreener generally results in much faster processing.
  10601. The prescreener is pretty accurate, so the difference between using it and not
  10602. using it is almost always unnoticeable.
  10603. Can be one of the following:
  10604. @table @samp
  10605. @item none
  10606. @item original
  10607. @item new
  10608. @end table
  10609. Default is @code{new}.
  10610. @item fapprox
  10611. Set various debugging flags.
  10612. @end table
  10613. @section noformat
  10614. Force libavfilter not to use any of the specified pixel formats for the
  10615. input to the next filter.
  10616. It accepts the following parameters:
  10617. @table @option
  10618. @item pix_fmts
  10619. A '|'-separated list of pixel format names, such as
  10620. pix_fmts=yuv420p|monow|rgb24".
  10621. @end table
  10622. @subsection Examples
  10623. @itemize
  10624. @item
  10625. Force libavfilter to use a format different from @var{yuv420p} for the
  10626. input to the vflip filter:
  10627. @example
  10628. noformat=pix_fmts=yuv420p,vflip
  10629. @end example
  10630. @item
  10631. Convert the input video to any of the formats not contained in the list:
  10632. @example
  10633. noformat=yuv420p|yuv444p|yuv410p
  10634. @end example
  10635. @end itemize
  10636. @section noise
  10637. Add noise on video input frame.
  10638. The filter accepts the following options:
  10639. @table @option
  10640. @item all_seed
  10641. @item c0_seed
  10642. @item c1_seed
  10643. @item c2_seed
  10644. @item c3_seed
  10645. Set noise seed for specific pixel component or all pixel components in case
  10646. of @var{all_seed}. Default value is @code{123457}.
  10647. @item all_strength, alls
  10648. @item c0_strength, c0s
  10649. @item c1_strength, c1s
  10650. @item c2_strength, c2s
  10651. @item c3_strength, c3s
  10652. Set noise strength for specific pixel component or all pixel components in case
  10653. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10654. @item all_flags, allf
  10655. @item c0_flags, c0f
  10656. @item c1_flags, c1f
  10657. @item c2_flags, c2f
  10658. @item c3_flags, c3f
  10659. Set pixel component flags or set flags for all components if @var{all_flags}.
  10660. Available values for component flags are:
  10661. @table @samp
  10662. @item a
  10663. averaged temporal noise (smoother)
  10664. @item p
  10665. mix random noise with a (semi)regular pattern
  10666. @item t
  10667. temporal noise (noise pattern changes between frames)
  10668. @item u
  10669. uniform noise (gaussian otherwise)
  10670. @end table
  10671. @end table
  10672. @subsection Examples
  10673. Add temporal and uniform noise to input video:
  10674. @example
  10675. noise=alls=20:allf=t+u
  10676. @end example
  10677. @section normalize
  10678. Normalize RGB video (aka histogram stretching, contrast stretching).
  10679. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10680. For each channel of each frame, the filter computes the input range and maps
  10681. it linearly to the user-specified output range. The output range defaults
  10682. to the full dynamic range from pure black to pure white.
  10683. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10684. changes in brightness) caused when small dark or bright objects enter or leave
  10685. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10686. video camera, and, like a video camera, it may cause a period of over- or
  10687. under-exposure of the video.
  10688. The R,G,B channels can be normalized independently, which may cause some
  10689. color shifting, or linked together as a single channel, which prevents
  10690. color shifting. Linked normalization preserves hue. Independent normalization
  10691. does not, so it can be used to remove some color casts. Independent and linked
  10692. normalization can be combined in any ratio.
  10693. The normalize filter accepts the following options:
  10694. @table @option
  10695. @item blackpt
  10696. @item whitept
  10697. Colors which define the output range. The minimum input value is mapped to
  10698. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10699. The defaults are black and white respectively. Specifying white for
  10700. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10701. normalized video. Shades of grey can be used to reduce the dynamic range
  10702. (contrast). Specifying saturated colors here can create some interesting
  10703. effects.
  10704. @item smoothing
  10705. The number of previous frames to use for temporal smoothing. The input range
  10706. of each channel is smoothed using a rolling average over the current frame
  10707. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10708. smoothing).
  10709. @item independence
  10710. Controls the ratio of independent (color shifting) channel normalization to
  10711. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10712. independent. Defaults to 1.0 (fully independent).
  10713. @item strength
  10714. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10715. expensive no-op. Defaults to 1.0 (full strength).
  10716. @end table
  10717. @subsection Commands
  10718. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10719. The command accepts the same syntax of the corresponding option.
  10720. If the specified expression is not valid, it is kept at its current
  10721. value.
  10722. @subsection Examples
  10723. Stretch video contrast to use the full dynamic range, with no temporal
  10724. smoothing; may flicker depending on the source content:
  10725. @example
  10726. normalize=blackpt=black:whitept=white:smoothing=0
  10727. @end example
  10728. As above, but with 50 frames of temporal smoothing; flicker should be
  10729. reduced, depending on the source content:
  10730. @example
  10731. normalize=blackpt=black:whitept=white:smoothing=50
  10732. @end example
  10733. As above, but with hue-preserving linked channel normalization:
  10734. @example
  10735. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10736. @end example
  10737. As above, but with half strength:
  10738. @example
  10739. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10740. @end example
  10741. Map the darkest input color to red, the brightest input color to cyan:
  10742. @example
  10743. normalize=blackpt=red:whitept=cyan
  10744. @end example
  10745. @section null
  10746. Pass the video source unchanged to the output.
  10747. @section ocr
  10748. Optical Character Recognition
  10749. This filter uses Tesseract for optical character recognition. To enable
  10750. compilation of this filter, you need to configure FFmpeg with
  10751. @code{--enable-libtesseract}.
  10752. It accepts the following options:
  10753. @table @option
  10754. @item datapath
  10755. Set datapath to tesseract data. Default is to use whatever was
  10756. set at installation.
  10757. @item language
  10758. Set language, default is "eng".
  10759. @item whitelist
  10760. Set character whitelist.
  10761. @item blacklist
  10762. Set character blacklist.
  10763. @end table
  10764. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10765. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10766. @section ocv
  10767. Apply a video transform using libopencv.
  10768. To enable this filter, install the libopencv library and headers and
  10769. configure FFmpeg with @code{--enable-libopencv}.
  10770. It accepts the following parameters:
  10771. @table @option
  10772. @item filter_name
  10773. The name of the libopencv filter to apply.
  10774. @item filter_params
  10775. The parameters to pass to the libopencv filter. If not specified, the default
  10776. values are assumed.
  10777. @end table
  10778. Refer to the official libopencv documentation for more precise
  10779. information:
  10780. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10781. Several libopencv filters are supported; see the following subsections.
  10782. @anchor{dilate}
  10783. @subsection dilate
  10784. Dilate an image by using a specific structuring element.
  10785. It corresponds to the libopencv function @code{cvDilate}.
  10786. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10787. @var{struct_el} represents a structuring element, and has the syntax:
  10788. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10789. @var{cols} and @var{rows} represent the number of columns and rows of
  10790. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10791. point, and @var{shape} the shape for the structuring element. @var{shape}
  10792. must be "rect", "cross", "ellipse", or "custom".
  10793. If the value for @var{shape} is "custom", it must be followed by a
  10794. string of the form "=@var{filename}". The file with name
  10795. @var{filename} is assumed to represent a binary image, with each
  10796. printable character corresponding to a bright pixel. When a custom
  10797. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10798. or columns and rows of the read file are assumed instead.
  10799. The default value for @var{struct_el} is "3x3+0x0/rect".
  10800. @var{nb_iterations} specifies the number of times the transform is
  10801. applied to the image, and defaults to 1.
  10802. Some examples:
  10803. @example
  10804. # Use the default values
  10805. ocv=dilate
  10806. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10807. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10808. # Read the shape from the file diamond.shape, iterating two times.
  10809. # The file diamond.shape may contain a pattern of characters like this
  10810. # *
  10811. # ***
  10812. # *****
  10813. # ***
  10814. # *
  10815. # The specified columns and rows are ignored
  10816. # but the anchor point coordinates are not
  10817. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10818. @end example
  10819. @subsection erode
  10820. Erode an image by using a specific structuring element.
  10821. It corresponds to the libopencv function @code{cvErode}.
  10822. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10823. with the same syntax and semantics as the @ref{dilate} filter.
  10824. @subsection smooth
  10825. Smooth the input video.
  10826. The filter takes the following parameters:
  10827. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10828. @var{type} is the type of smooth filter to apply, and must be one of
  10829. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10830. or "bilateral". The default value is "gaussian".
  10831. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10832. depends on the smooth type. @var{param1} and
  10833. @var{param2} accept integer positive values or 0. @var{param3} and
  10834. @var{param4} accept floating point values.
  10835. The default value for @var{param1} is 3. The default value for the
  10836. other parameters is 0.
  10837. These parameters correspond to the parameters assigned to the
  10838. libopencv function @code{cvSmooth}.
  10839. @section oscilloscope
  10840. 2D Video Oscilloscope.
  10841. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10842. It accepts the following parameters:
  10843. @table @option
  10844. @item x
  10845. Set scope center x position.
  10846. @item y
  10847. Set scope center y position.
  10848. @item s
  10849. Set scope size, relative to frame diagonal.
  10850. @item t
  10851. Set scope tilt/rotation.
  10852. @item o
  10853. Set trace opacity.
  10854. @item tx
  10855. Set trace center x position.
  10856. @item ty
  10857. Set trace center y position.
  10858. @item tw
  10859. Set trace width, relative to width of frame.
  10860. @item th
  10861. Set trace height, relative to height of frame.
  10862. @item c
  10863. Set which components to trace. By default it traces first three components.
  10864. @item g
  10865. Draw trace grid. By default is enabled.
  10866. @item st
  10867. Draw some statistics. By default is enabled.
  10868. @item sc
  10869. Draw scope. By default is enabled.
  10870. @end table
  10871. @subsection Commands
  10872. This filter supports same @ref{commands} as options.
  10873. The command accepts the same syntax of the corresponding option.
  10874. If the specified expression is not valid, it is kept at its current
  10875. value.
  10876. @subsection Examples
  10877. @itemize
  10878. @item
  10879. Inspect full first row of video frame.
  10880. @example
  10881. oscilloscope=x=0.5:y=0:s=1
  10882. @end example
  10883. @item
  10884. Inspect full last row of video frame.
  10885. @example
  10886. oscilloscope=x=0.5:y=1:s=1
  10887. @end example
  10888. @item
  10889. Inspect full 5th line of video frame of height 1080.
  10890. @example
  10891. oscilloscope=x=0.5:y=5/1080:s=1
  10892. @end example
  10893. @item
  10894. Inspect full last column of video frame.
  10895. @example
  10896. oscilloscope=x=1:y=0.5:s=1:t=1
  10897. @end example
  10898. @end itemize
  10899. @anchor{overlay}
  10900. @section overlay
  10901. Overlay one video on top of another.
  10902. It takes two inputs and has one output. The first input is the "main"
  10903. video on which the second input is overlaid.
  10904. It accepts the following parameters:
  10905. A description of the accepted options follows.
  10906. @table @option
  10907. @item x
  10908. @item y
  10909. Set the expression for the x and y coordinates of the overlaid video
  10910. on the main video. Default value is "0" for both expressions. In case
  10911. the expression is invalid, it is set to a huge value (meaning that the
  10912. overlay will not be displayed within the output visible area).
  10913. @item eof_action
  10914. See @ref{framesync}.
  10915. @item eval
  10916. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10917. It accepts the following values:
  10918. @table @samp
  10919. @item init
  10920. only evaluate expressions once during the filter initialization or
  10921. when a command is processed
  10922. @item frame
  10923. evaluate expressions for each incoming frame
  10924. @end table
  10925. Default value is @samp{frame}.
  10926. @item shortest
  10927. See @ref{framesync}.
  10928. @item format
  10929. Set the format for the output video.
  10930. It accepts the following values:
  10931. @table @samp
  10932. @item yuv420
  10933. force YUV420 output
  10934. @item yuv422
  10935. force YUV422 output
  10936. @item yuv444
  10937. force YUV444 output
  10938. @item rgb
  10939. force packed RGB output
  10940. @item gbrp
  10941. force planar RGB output
  10942. @item auto
  10943. automatically pick format
  10944. @end table
  10945. Default value is @samp{yuv420}.
  10946. @item repeatlast
  10947. See @ref{framesync}.
  10948. @item alpha
  10949. Set format of alpha of the overlaid video, it can be @var{straight} or
  10950. @var{premultiplied}. Default is @var{straight}.
  10951. @end table
  10952. The @option{x}, and @option{y} expressions can contain the following
  10953. parameters.
  10954. @table @option
  10955. @item main_w, W
  10956. @item main_h, H
  10957. The main input width and height.
  10958. @item overlay_w, w
  10959. @item overlay_h, h
  10960. The overlay input width and height.
  10961. @item x
  10962. @item y
  10963. The computed values for @var{x} and @var{y}. They are evaluated for
  10964. each new frame.
  10965. @item hsub
  10966. @item vsub
  10967. horizontal and vertical chroma subsample values of the output
  10968. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10969. @var{vsub} is 1.
  10970. @item n
  10971. the number of input frame, starting from 0
  10972. @item pos
  10973. the position in the file of the input frame, NAN if unknown
  10974. @item t
  10975. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10976. @end table
  10977. This filter also supports the @ref{framesync} options.
  10978. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10979. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10980. when @option{eval} is set to @samp{init}.
  10981. Be aware that frames are taken from each input video in timestamp
  10982. order, hence, if their initial timestamps differ, it is a good idea
  10983. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10984. have them begin in the same zero timestamp, as the example for
  10985. the @var{movie} filter does.
  10986. You can chain together more overlays but you should test the
  10987. efficiency of such approach.
  10988. @subsection Commands
  10989. This filter supports the following commands:
  10990. @table @option
  10991. @item x
  10992. @item y
  10993. Modify the x and y of the overlay input.
  10994. The command accepts the same syntax of the corresponding option.
  10995. If the specified expression is not valid, it is kept at its current
  10996. value.
  10997. @end table
  10998. @subsection Examples
  10999. @itemize
  11000. @item
  11001. Draw the overlay at 10 pixels from the bottom right corner of the main
  11002. video:
  11003. @example
  11004. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11005. @end example
  11006. Using named options the example above becomes:
  11007. @example
  11008. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11009. @end example
  11010. @item
  11011. Insert a transparent PNG logo in the bottom left corner of the input,
  11012. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11013. @example
  11014. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11015. @end example
  11016. @item
  11017. Insert 2 different transparent PNG logos (second logo on bottom
  11018. right corner) using the @command{ffmpeg} tool:
  11019. @example
  11020. 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
  11021. @end example
  11022. @item
  11023. Add a transparent color layer on top of the main video; @code{WxH}
  11024. must specify the size of the main input to the overlay filter:
  11025. @example
  11026. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11027. @end example
  11028. @item
  11029. Play an original video and a filtered version (here with the deshake
  11030. filter) side by side using the @command{ffplay} tool:
  11031. @example
  11032. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11033. @end example
  11034. The above command is the same as:
  11035. @example
  11036. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11037. @end example
  11038. @item
  11039. Make a sliding overlay appearing from the left to the right top part of the
  11040. screen starting since time 2:
  11041. @example
  11042. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11043. @end example
  11044. @item
  11045. Compose output by putting two input videos side to side:
  11046. @example
  11047. ffmpeg -i left.avi -i right.avi -filter_complex "
  11048. nullsrc=size=200x100 [background];
  11049. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11050. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11051. [background][left] overlay=shortest=1 [background+left];
  11052. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11053. "
  11054. @end example
  11055. @item
  11056. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11057. @example
  11058. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11059. -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]'
  11060. masked.avi
  11061. @end example
  11062. @item
  11063. Chain several overlays in cascade:
  11064. @example
  11065. nullsrc=s=200x200 [bg];
  11066. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11067. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11068. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11069. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11070. [in3] null, [mid2] overlay=100:100 [out0]
  11071. @end example
  11072. @end itemize
  11073. @anchor{overlay_cuda}
  11074. @section overlay_cuda
  11075. Overlay one video on top of another.
  11076. This is the CUDA cariant of the @ref{overlay} filter.
  11077. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11078. It takes two inputs and has one output. The first input is the "main"
  11079. video on which the second input is overlaid.
  11080. It accepts the following parameters:
  11081. @table @option
  11082. @item x
  11083. @item y
  11084. Set the x and y coordinates of the overlaid video on the main video.
  11085. Default value is "0" for both expressions.
  11086. @item eof_action
  11087. See @ref{framesync}.
  11088. @item shortest
  11089. See @ref{framesync}.
  11090. @item repeatlast
  11091. See @ref{framesync}.
  11092. @end table
  11093. This filter also supports the @ref{framesync} options.
  11094. @section owdenoise
  11095. Apply Overcomplete Wavelet denoiser.
  11096. The filter accepts the following options:
  11097. @table @option
  11098. @item depth
  11099. Set depth.
  11100. Larger depth values will denoise lower frequency components more, but
  11101. slow down filtering.
  11102. Must be an int in the range 8-16, default is @code{8}.
  11103. @item luma_strength, ls
  11104. Set luma strength.
  11105. Must be a double value in the range 0-1000, default is @code{1.0}.
  11106. @item chroma_strength, cs
  11107. Set chroma strength.
  11108. Must be a double value in the range 0-1000, default is @code{1.0}.
  11109. @end table
  11110. @anchor{pad}
  11111. @section pad
  11112. Add paddings to the input image, and place the original input at the
  11113. provided @var{x}, @var{y} coordinates.
  11114. It accepts the following parameters:
  11115. @table @option
  11116. @item width, w
  11117. @item height, h
  11118. Specify an expression for the size of the output image with the
  11119. paddings added. If the value for @var{width} or @var{height} is 0, the
  11120. corresponding input size is used for the output.
  11121. The @var{width} expression can reference the value set by the
  11122. @var{height} expression, and vice versa.
  11123. The default value of @var{width} and @var{height} is 0.
  11124. @item x
  11125. @item y
  11126. Specify the offsets to place the input image at within the padded area,
  11127. with respect to the top/left border of the output image.
  11128. The @var{x} expression can reference the value set by the @var{y}
  11129. expression, and vice versa.
  11130. The default value of @var{x} and @var{y} is 0.
  11131. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11132. so the input image is centered on the padded area.
  11133. @item color
  11134. Specify the color of the padded area. For the syntax of this option,
  11135. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11136. manual,ffmpeg-utils}.
  11137. The default value of @var{color} is "black".
  11138. @item eval
  11139. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11140. It accepts the following values:
  11141. @table @samp
  11142. @item init
  11143. Only evaluate expressions once during the filter initialization or when
  11144. a command is processed.
  11145. @item frame
  11146. Evaluate expressions for each incoming frame.
  11147. @end table
  11148. Default value is @samp{init}.
  11149. @item aspect
  11150. Pad to aspect instead to a resolution.
  11151. @end table
  11152. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11153. options are expressions containing the following constants:
  11154. @table @option
  11155. @item in_w
  11156. @item in_h
  11157. The input video width and height.
  11158. @item iw
  11159. @item ih
  11160. These are the same as @var{in_w} and @var{in_h}.
  11161. @item out_w
  11162. @item out_h
  11163. The output width and height (the size of the padded area), as
  11164. specified by the @var{width} and @var{height} expressions.
  11165. @item ow
  11166. @item oh
  11167. These are the same as @var{out_w} and @var{out_h}.
  11168. @item x
  11169. @item y
  11170. The x and y offsets as specified by the @var{x} and @var{y}
  11171. expressions, or NAN if not yet specified.
  11172. @item a
  11173. same as @var{iw} / @var{ih}
  11174. @item sar
  11175. input sample aspect ratio
  11176. @item dar
  11177. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11178. @item hsub
  11179. @item vsub
  11180. The horizontal and vertical chroma subsample values. For example for the
  11181. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11182. @end table
  11183. @subsection Examples
  11184. @itemize
  11185. @item
  11186. Add paddings with the color "violet" to the input video. The output video
  11187. size is 640x480, and the top-left corner of the input video is placed at
  11188. column 0, row 40
  11189. @example
  11190. pad=640:480:0:40:violet
  11191. @end example
  11192. The example above is equivalent to the following command:
  11193. @example
  11194. pad=width=640:height=480:x=0:y=40:color=violet
  11195. @end example
  11196. @item
  11197. Pad the input to get an output with dimensions increased by 3/2,
  11198. and put the input video at the center of the padded area:
  11199. @example
  11200. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11201. @end example
  11202. @item
  11203. Pad the input to get a squared output with size equal to the maximum
  11204. value between the input width and height, and put the input video at
  11205. the center of the padded area:
  11206. @example
  11207. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11208. @end example
  11209. @item
  11210. Pad the input to get a final w/h ratio of 16:9:
  11211. @example
  11212. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11213. @end example
  11214. @item
  11215. In case of anamorphic video, in order to set the output display aspect
  11216. correctly, it is necessary to use @var{sar} in the expression,
  11217. according to the relation:
  11218. @example
  11219. (ih * X / ih) * sar = output_dar
  11220. X = output_dar / sar
  11221. @end example
  11222. Thus the previous example needs to be modified to:
  11223. @example
  11224. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11225. @end example
  11226. @item
  11227. Double the output size and put the input video in the bottom-right
  11228. corner of the output padded area:
  11229. @example
  11230. pad="2*iw:2*ih:ow-iw:oh-ih"
  11231. @end example
  11232. @end itemize
  11233. @anchor{palettegen}
  11234. @section palettegen
  11235. Generate one palette for a whole video stream.
  11236. It accepts the following options:
  11237. @table @option
  11238. @item max_colors
  11239. Set the maximum number of colors to quantize in the palette.
  11240. Note: the palette will still contain 256 colors; the unused palette entries
  11241. will be black.
  11242. @item reserve_transparent
  11243. Create a palette of 255 colors maximum and reserve the last one for
  11244. transparency. Reserving the transparency color is useful for GIF optimization.
  11245. If not set, the maximum of colors in the palette will be 256. You probably want
  11246. to disable this option for a standalone image.
  11247. Set by default.
  11248. @item transparency_color
  11249. Set the color that will be used as background for transparency.
  11250. @item stats_mode
  11251. Set statistics mode.
  11252. It accepts the following values:
  11253. @table @samp
  11254. @item full
  11255. Compute full frame histograms.
  11256. @item diff
  11257. Compute histograms only for the part that differs from previous frame. This
  11258. might be relevant to give more importance to the moving part of your input if
  11259. the background is static.
  11260. @item single
  11261. Compute new histogram for each frame.
  11262. @end table
  11263. Default value is @var{full}.
  11264. @end table
  11265. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11266. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11267. color quantization of the palette. This information is also visible at
  11268. @var{info} logging level.
  11269. @subsection Examples
  11270. @itemize
  11271. @item
  11272. Generate a representative palette of a given video using @command{ffmpeg}:
  11273. @example
  11274. ffmpeg -i input.mkv -vf palettegen palette.png
  11275. @end example
  11276. @end itemize
  11277. @section paletteuse
  11278. Use a palette to downsample an input video stream.
  11279. The filter takes two inputs: one video stream and a palette. The palette must
  11280. be a 256 pixels image.
  11281. It accepts the following options:
  11282. @table @option
  11283. @item dither
  11284. Select dithering mode. Available algorithms are:
  11285. @table @samp
  11286. @item bayer
  11287. Ordered 8x8 bayer dithering (deterministic)
  11288. @item heckbert
  11289. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11290. Note: this dithering is sometimes considered "wrong" and is included as a
  11291. reference.
  11292. @item floyd_steinberg
  11293. Floyd and Steingberg dithering (error diffusion)
  11294. @item sierra2
  11295. Frankie Sierra dithering v2 (error diffusion)
  11296. @item sierra2_4a
  11297. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11298. @end table
  11299. Default is @var{sierra2_4a}.
  11300. @item bayer_scale
  11301. When @var{bayer} dithering is selected, this option defines the scale of the
  11302. pattern (how much the crosshatch pattern is visible). A low value means more
  11303. visible pattern for less banding, and higher value means less visible pattern
  11304. at the cost of more banding.
  11305. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11306. @item diff_mode
  11307. If set, define the zone to process
  11308. @table @samp
  11309. @item rectangle
  11310. Only the changing rectangle will be reprocessed. This is similar to GIF
  11311. cropping/offsetting compression mechanism. This option can be useful for speed
  11312. if only a part of the image is changing, and has use cases such as limiting the
  11313. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11314. moving scene (it leads to more deterministic output if the scene doesn't change
  11315. much, and as a result less moving noise and better GIF compression).
  11316. @end table
  11317. Default is @var{none}.
  11318. @item new
  11319. Take new palette for each output frame.
  11320. @item alpha_threshold
  11321. Sets the alpha threshold for transparency. Alpha values above this threshold
  11322. will be treated as completely opaque, and values below this threshold will be
  11323. treated as completely transparent.
  11324. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11325. @end table
  11326. @subsection Examples
  11327. @itemize
  11328. @item
  11329. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11330. using @command{ffmpeg}:
  11331. @example
  11332. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11333. @end example
  11334. @end itemize
  11335. @section perspective
  11336. Correct perspective of video not recorded perpendicular to the screen.
  11337. A description of the accepted parameters follows.
  11338. @table @option
  11339. @item x0
  11340. @item y0
  11341. @item x1
  11342. @item y1
  11343. @item x2
  11344. @item y2
  11345. @item x3
  11346. @item y3
  11347. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11348. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11349. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11350. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11351. then the corners of the source will be sent to the specified coordinates.
  11352. The expressions can use the following variables:
  11353. @table @option
  11354. @item W
  11355. @item H
  11356. the width and height of video frame.
  11357. @item in
  11358. Input frame count.
  11359. @item on
  11360. Output frame count.
  11361. @end table
  11362. @item interpolation
  11363. Set interpolation for perspective correction.
  11364. It accepts the following values:
  11365. @table @samp
  11366. @item linear
  11367. @item cubic
  11368. @end table
  11369. Default value is @samp{linear}.
  11370. @item sense
  11371. Set interpretation of coordinate options.
  11372. It accepts the following values:
  11373. @table @samp
  11374. @item 0, source
  11375. Send point in the source specified by the given coordinates to
  11376. the corners of the destination.
  11377. @item 1, destination
  11378. Send the corners of the source to the point in the destination specified
  11379. by the given coordinates.
  11380. Default value is @samp{source}.
  11381. @end table
  11382. @item eval
  11383. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11384. It accepts the following values:
  11385. @table @samp
  11386. @item init
  11387. only evaluate expressions once during the filter initialization or
  11388. when a command is processed
  11389. @item frame
  11390. evaluate expressions for each incoming frame
  11391. @end table
  11392. Default value is @samp{init}.
  11393. @end table
  11394. @section phase
  11395. Delay interlaced video by one field time so that the field order changes.
  11396. The intended use is to fix PAL movies that have been captured with the
  11397. opposite field order to the film-to-video transfer.
  11398. A description of the accepted parameters follows.
  11399. @table @option
  11400. @item mode
  11401. Set phase mode.
  11402. It accepts the following values:
  11403. @table @samp
  11404. @item t
  11405. Capture field order top-first, transfer bottom-first.
  11406. Filter will delay the bottom field.
  11407. @item b
  11408. Capture field order bottom-first, transfer top-first.
  11409. Filter will delay the top field.
  11410. @item p
  11411. Capture and transfer with the same field order. This mode only exists
  11412. for the documentation of the other options to refer to, but if you
  11413. actually select it, the filter will faithfully do nothing.
  11414. @item a
  11415. Capture field order determined automatically by field flags, transfer
  11416. opposite.
  11417. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11418. basis using field flags. If no field information is available,
  11419. then this works just like @samp{u}.
  11420. @item u
  11421. Capture unknown or varying, transfer opposite.
  11422. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11423. analyzing the images and selecting the alternative that produces best
  11424. match between the fields.
  11425. @item T
  11426. Capture top-first, transfer unknown or varying.
  11427. Filter selects among @samp{t} and @samp{p} using image analysis.
  11428. @item B
  11429. Capture bottom-first, transfer unknown or varying.
  11430. Filter selects among @samp{b} and @samp{p} using image analysis.
  11431. @item A
  11432. Capture determined by field flags, transfer unknown or varying.
  11433. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11434. image analysis. If no field information is available, then this works just
  11435. like @samp{U}. This is the default mode.
  11436. @item U
  11437. Both capture and transfer unknown or varying.
  11438. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11439. @end table
  11440. @end table
  11441. @section photosensitivity
  11442. Reduce various flashes in video, so to help users with epilepsy.
  11443. It accepts the following options:
  11444. @table @option
  11445. @item frames, f
  11446. Set how many frames to use when filtering. Default is 30.
  11447. @item threshold, t
  11448. Set detection threshold factor. Default is 1.
  11449. Lower is stricter.
  11450. @item skip
  11451. Set how many pixels to skip when sampling frames. Default is 1.
  11452. Allowed range is from 1 to 1024.
  11453. @item bypass
  11454. Leave frames unchanged. Default is disabled.
  11455. @end table
  11456. @section pixdesctest
  11457. Pixel format descriptor test filter, mainly useful for internal
  11458. testing. The output video should be equal to the input video.
  11459. For example:
  11460. @example
  11461. format=monow, pixdesctest
  11462. @end example
  11463. can be used to test the monowhite pixel format descriptor definition.
  11464. @section pixscope
  11465. Display sample values of color channels. Mainly useful for checking color
  11466. and levels. Minimum supported resolution is 640x480.
  11467. The filters accept the following options:
  11468. @table @option
  11469. @item x
  11470. Set scope X position, relative offset on X axis.
  11471. @item y
  11472. Set scope Y position, relative offset on Y axis.
  11473. @item w
  11474. Set scope width.
  11475. @item h
  11476. Set scope height.
  11477. @item o
  11478. Set window opacity. This window also holds statistics about pixel area.
  11479. @item wx
  11480. Set window X position, relative offset on X axis.
  11481. @item wy
  11482. Set window Y position, relative offset on Y axis.
  11483. @end table
  11484. @section pp
  11485. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11486. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11487. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11488. Each subfilter and some options have a short and a long name that can be used
  11489. interchangeably, i.e. dr/dering are the same.
  11490. The filters accept the following options:
  11491. @table @option
  11492. @item subfilters
  11493. Set postprocessing subfilters string.
  11494. @end table
  11495. All subfilters share common options to determine their scope:
  11496. @table @option
  11497. @item a/autoq
  11498. Honor the quality commands for this subfilter.
  11499. @item c/chrom
  11500. Do chrominance filtering, too (default).
  11501. @item y/nochrom
  11502. Do luminance filtering only (no chrominance).
  11503. @item n/noluma
  11504. Do chrominance filtering only (no luminance).
  11505. @end table
  11506. These options can be appended after the subfilter name, separated by a '|'.
  11507. Available subfilters are:
  11508. @table @option
  11509. @item hb/hdeblock[|difference[|flatness]]
  11510. Horizontal deblocking filter
  11511. @table @option
  11512. @item difference
  11513. Difference factor where higher values mean more deblocking (default: @code{32}).
  11514. @item flatness
  11515. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11516. @end table
  11517. @item vb/vdeblock[|difference[|flatness]]
  11518. Vertical deblocking filter
  11519. @table @option
  11520. @item difference
  11521. Difference factor where higher values mean more deblocking (default: @code{32}).
  11522. @item flatness
  11523. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11524. @end table
  11525. @item ha/hadeblock[|difference[|flatness]]
  11526. Accurate horizontal deblocking filter
  11527. @table @option
  11528. @item difference
  11529. Difference factor where higher values mean more deblocking (default: @code{32}).
  11530. @item flatness
  11531. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11532. @end table
  11533. @item va/vadeblock[|difference[|flatness]]
  11534. Accurate vertical deblocking filter
  11535. @table @option
  11536. @item difference
  11537. Difference factor where higher values mean more deblocking (default: @code{32}).
  11538. @item flatness
  11539. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11540. @end table
  11541. @end table
  11542. The horizontal and vertical deblocking filters share the difference and
  11543. flatness values so you cannot set different horizontal and vertical
  11544. thresholds.
  11545. @table @option
  11546. @item h1/x1hdeblock
  11547. Experimental horizontal deblocking filter
  11548. @item v1/x1vdeblock
  11549. Experimental vertical deblocking filter
  11550. @item dr/dering
  11551. Deringing filter
  11552. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11553. @table @option
  11554. @item threshold1
  11555. larger -> stronger filtering
  11556. @item threshold2
  11557. larger -> stronger filtering
  11558. @item threshold3
  11559. larger -> stronger filtering
  11560. @end table
  11561. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11562. @table @option
  11563. @item f/fullyrange
  11564. Stretch luminance to @code{0-255}.
  11565. @end table
  11566. @item lb/linblenddeint
  11567. Linear blend deinterlacing filter that deinterlaces the given block by
  11568. filtering all lines with a @code{(1 2 1)} filter.
  11569. @item li/linipoldeint
  11570. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11571. linearly interpolating every second line.
  11572. @item ci/cubicipoldeint
  11573. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11574. cubically interpolating every second line.
  11575. @item md/mediandeint
  11576. Median deinterlacing filter that deinterlaces the given block by applying a
  11577. median filter to every second line.
  11578. @item fd/ffmpegdeint
  11579. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11580. second line with a @code{(-1 4 2 4 -1)} filter.
  11581. @item l5/lowpass5
  11582. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11583. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11584. @item fq/forceQuant[|quantizer]
  11585. Overrides the quantizer table from the input with the constant quantizer you
  11586. specify.
  11587. @table @option
  11588. @item quantizer
  11589. Quantizer to use
  11590. @end table
  11591. @item de/default
  11592. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11593. @item fa/fast
  11594. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11595. @item ac
  11596. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11597. @end table
  11598. @subsection Examples
  11599. @itemize
  11600. @item
  11601. Apply horizontal and vertical deblocking, deringing and automatic
  11602. brightness/contrast:
  11603. @example
  11604. pp=hb/vb/dr/al
  11605. @end example
  11606. @item
  11607. Apply default filters without brightness/contrast correction:
  11608. @example
  11609. pp=de/-al
  11610. @end example
  11611. @item
  11612. Apply default filters and temporal denoiser:
  11613. @example
  11614. pp=default/tmpnoise|1|2|3
  11615. @end example
  11616. @item
  11617. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11618. automatically depending on available CPU time:
  11619. @example
  11620. pp=hb|y/vb|a
  11621. @end example
  11622. @end itemize
  11623. @section pp7
  11624. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11625. similar to spp = 6 with 7 point DCT, where only the center sample is
  11626. used after IDCT.
  11627. The filter accepts the following options:
  11628. @table @option
  11629. @item qp
  11630. Force a constant quantization parameter. It accepts an integer in range
  11631. 0 to 63. If not set, the filter will use the QP from the video stream
  11632. (if available).
  11633. @item mode
  11634. Set thresholding mode. Available modes are:
  11635. @table @samp
  11636. @item hard
  11637. Set hard thresholding.
  11638. @item soft
  11639. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11640. @item medium
  11641. Set medium thresholding (good results, default).
  11642. @end table
  11643. @end table
  11644. @section premultiply
  11645. Apply alpha premultiply effect to input video stream using first plane
  11646. of second stream as alpha.
  11647. Both streams must have same dimensions and same pixel format.
  11648. The filter accepts the following option:
  11649. @table @option
  11650. @item planes
  11651. Set which planes will be processed, unprocessed planes will be copied.
  11652. By default value 0xf, all planes will be processed.
  11653. @item inplace
  11654. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11655. @end table
  11656. @section prewitt
  11657. Apply prewitt operator to input video stream.
  11658. The filter accepts the following option:
  11659. @table @option
  11660. @item planes
  11661. Set which planes will be processed, unprocessed planes will be copied.
  11662. By default value 0xf, all planes will be processed.
  11663. @item scale
  11664. Set value which will be multiplied with filtered result.
  11665. @item delta
  11666. Set value which will be added to filtered result.
  11667. @end table
  11668. @section pseudocolor
  11669. Alter frame colors in video with pseudocolors.
  11670. This filter accepts the following options:
  11671. @table @option
  11672. @item c0
  11673. set pixel first component expression
  11674. @item c1
  11675. set pixel second component expression
  11676. @item c2
  11677. set pixel third component expression
  11678. @item c3
  11679. set pixel fourth component expression, corresponds to the alpha component
  11680. @item i
  11681. set component to use as base for altering colors
  11682. @end table
  11683. Each of them specifies the expression to use for computing the lookup table for
  11684. the corresponding pixel component values.
  11685. The expressions can contain the following constants and functions:
  11686. @table @option
  11687. @item w
  11688. @item h
  11689. The input width and height.
  11690. @item val
  11691. The input value for the pixel component.
  11692. @item ymin, umin, vmin, amin
  11693. The minimum allowed component value.
  11694. @item ymax, umax, vmax, amax
  11695. The maximum allowed component value.
  11696. @end table
  11697. All expressions default to "val".
  11698. @subsection Examples
  11699. @itemize
  11700. @item
  11701. Change too high luma values to gradient:
  11702. @example
  11703. 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'"
  11704. @end example
  11705. @end itemize
  11706. @section psnr
  11707. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11708. Ratio) between two input videos.
  11709. This filter takes in input two input videos, the first input is
  11710. considered the "main" source and is passed unchanged to the
  11711. output. The second input is used as a "reference" video for computing
  11712. the PSNR.
  11713. Both video inputs must have the same resolution and pixel format for
  11714. this filter to work correctly. Also it assumes that both inputs
  11715. have the same number of frames, which are compared one by one.
  11716. The obtained average PSNR is printed through the logging system.
  11717. The filter stores the accumulated MSE (mean squared error) of each
  11718. frame, and at the end of the processing it is averaged across all frames
  11719. equally, and the following formula is applied to obtain the PSNR:
  11720. @example
  11721. PSNR = 10*log10(MAX^2/MSE)
  11722. @end example
  11723. Where MAX is the average of the maximum values of each component of the
  11724. image.
  11725. The description of the accepted parameters follows.
  11726. @table @option
  11727. @item stats_file, f
  11728. If specified the filter will use the named file to save the PSNR of
  11729. each individual frame. When filename equals "-" the data is sent to
  11730. standard output.
  11731. @item stats_version
  11732. Specifies which version of the stats file format to use. Details of
  11733. each format are written below.
  11734. Default value is 1.
  11735. @item stats_add_max
  11736. Determines whether the max value is output to the stats log.
  11737. Default value is 0.
  11738. Requires stats_version >= 2. If this is set and stats_version < 2,
  11739. the filter will return an error.
  11740. @end table
  11741. This filter also supports the @ref{framesync} options.
  11742. The file printed if @var{stats_file} is selected, contains a sequence of
  11743. key/value pairs of the form @var{key}:@var{value} for each compared
  11744. couple of frames.
  11745. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11746. the list of per-frame-pair stats, with key value pairs following the frame
  11747. format with the following parameters:
  11748. @table @option
  11749. @item psnr_log_version
  11750. The version of the log file format. Will match @var{stats_version}.
  11751. @item fields
  11752. A comma separated list of the per-frame-pair parameters included in
  11753. the log.
  11754. @end table
  11755. A description of each shown per-frame-pair parameter follows:
  11756. @table @option
  11757. @item n
  11758. sequential number of the input frame, starting from 1
  11759. @item mse_avg
  11760. Mean Square Error pixel-by-pixel average difference of the compared
  11761. frames, averaged over all the image components.
  11762. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11763. Mean Square Error pixel-by-pixel average difference of the compared
  11764. frames for the component specified by the suffix.
  11765. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11766. Peak Signal to Noise ratio of the compared frames for the component
  11767. specified by the suffix.
  11768. @item max_avg, max_y, max_u, max_v
  11769. Maximum allowed value for each channel, and average over all
  11770. channels.
  11771. @end table
  11772. @subsection Examples
  11773. @itemize
  11774. @item
  11775. For example:
  11776. @example
  11777. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11778. [main][ref] psnr="stats_file=stats.log" [out]
  11779. @end example
  11780. On this example the input file being processed is compared with the
  11781. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11782. is stored in @file{stats.log}.
  11783. @item
  11784. Another example with different containers:
  11785. @example
  11786. 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 -
  11787. @end example
  11788. @end itemize
  11789. @anchor{pullup}
  11790. @section pullup
  11791. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11792. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11793. content.
  11794. The pullup filter is designed to take advantage of future context in making
  11795. its decisions. This filter is stateless in the sense that it does not lock
  11796. onto a pattern to follow, but it instead looks forward to the following
  11797. fields in order to identify matches and rebuild progressive frames.
  11798. To produce content with an even framerate, insert the fps filter after
  11799. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11800. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11801. The filter accepts the following options:
  11802. @table @option
  11803. @item jl
  11804. @item jr
  11805. @item jt
  11806. @item jb
  11807. These options set the amount of "junk" to ignore at the left, right, top, and
  11808. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11809. while top and bottom are in units of 2 lines.
  11810. The default is 8 pixels on each side.
  11811. @item sb
  11812. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11813. filter generating an occasional mismatched frame, but it may also cause an
  11814. excessive number of frames to be dropped during high motion sequences.
  11815. Conversely, setting it to -1 will make filter match fields more easily.
  11816. This may help processing of video where there is slight blurring between
  11817. the fields, but may also cause there to be interlaced frames in the output.
  11818. Default value is @code{0}.
  11819. @item mp
  11820. Set the metric plane to use. It accepts the following values:
  11821. @table @samp
  11822. @item l
  11823. Use luma plane.
  11824. @item u
  11825. Use chroma blue plane.
  11826. @item v
  11827. Use chroma red plane.
  11828. @end table
  11829. This option may be set to use chroma plane instead of the default luma plane
  11830. for doing filter's computations. This may improve accuracy on very clean
  11831. source material, but more likely will decrease accuracy, especially if there
  11832. is chroma noise (rainbow effect) or any grayscale video.
  11833. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11834. load and make pullup usable in realtime on slow machines.
  11835. @end table
  11836. For best results (without duplicated frames in the output file) it is
  11837. necessary to change the output frame rate. For example, to inverse
  11838. telecine NTSC input:
  11839. @example
  11840. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11841. @end example
  11842. @section qp
  11843. Change video quantization parameters (QP).
  11844. The filter accepts the following option:
  11845. @table @option
  11846. @item qp
  11847. Set expression for quantization parameter.
  11848. @end table
  11849. The expression is evaluated through the eval API and can contain, among others,
  11850. the following constants:
  11851. @table @var
  11852. @item known
  11853. 1 if index is not 129, 0 otherwise.
  11854. @item qp
  11855. Sequential index starting from -129 to 128.
  11856. @end table
  11857. @subsection Examples
  11858. @itemize
  11859. @item
  11860. Some equation like:
  11861. @example
  11862. qp=2+2*sin(PI*qp)
  11863. @end example
  11864. @end itemize
  11865. @section random
  11866. Flush video frames from internal cache of frames into a random order.
  11867. No frame is discarded.
  11868. Inspired by @ref{frei0r} nervous filter.
  11869. @table @option
  11870. @item frames
  11871. Set size in number of frames of internal cache, in range from @code{2} to
  11872. @code{512}. Default is @code{30}.
  11873. @item seed
  11874. Set seed for random number generator, must be an integer included between
  11875. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11876. less than @code{0}, the filter will try to use a good random seed on a
  11877. best effort basis.
  11878. @end table
  11879. @section readeia608
  11880. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11881. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11882. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11883. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11884. @table @option
  11885. @item lavfi.readeia608.X.cc
  11886. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11887. @item lavfi.readeia608.X.line
  11888. The number of the line on which the EIA-608 data was identified and read.
  11889. @end table
  11890. This filter accepts the following options:
  11891. @table @option
  11892. @item scan_min
  11893. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11894. @item scan_max
  11895. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11896. @item spw
  11897. Set the ratio of width reserved for sync code detection.
  11898. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  11899. @item chp
  11900. Enable checking the parity bit. In the event of a parity error, the filter will output
  11901. @code{0x00} for that character. Default is false.
  11902. @item lp
  11903. Lowpass lines prior to further processing. Default is enabled.
  11904. @end table
  11905. @subsection Examples
  11906. @itemize
  11907. @item
  11908. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11909. @example
  11910. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  11911. @end example
  11912. @end itemize
  11913. @section readvitc
  11914. Read vertical interval timecode (VITC) information from the top lines of a
  11915. video frame.
  11916. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11917. timecode value, if a valid timecode has been detected. Further metadata key
  11918. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11919. timecode data has been found or not.
  11920. This filter accepts the following options:
  11921. @table @option
  11922. @item scan_max
  11923. Set the maximum number of lines to scan for VITC data. If the value is set to
  11924. @code{-1} the full video frame is scanned. Default is @code{45}.
  11925. @item thr_b
  11926. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11927. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11928. @item thr_w
  11929. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11930. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11931. @end table
  11932. @subsection Examples
  11933. @itemize
  11934. @item
  11935. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11936. draw @code{--:--:--:--} as a placeholder:
  11937. @example
  11938. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11939. @end example
  11940. @end itemize
  11941. @section remap
  11942. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11943. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11944. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11945. value for pixel will be used for destination pixel.
  11946. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11947. will have Xmap/Ymap video stream dimensions.
  11948. Xmap and Ymap input video streams are 16bit depth, single channel.
  11949. @table @option
  11950. @item format
  11951. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11952. Default is @code{color}.
  11953. @item fill
  11954. Specify the color of the unmapped pixels. For the syntax of this option,
  11955. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11956. manual,ffmpeg-utils}. Default color is @code{black}.
  11957. @end table
  11958. @section removegrain
  11959. The removegrain filter is a spatial denoiser for progressive video.
  11960. @table @option
  11961. @item m0
  11962. Set mode for the first plane.
  11963. @item m1
  11964. Set mode for the second plane.
  11965. @item m2
  11966. Set mode for the third plane.
  11967. @item m3
  11968. Set mode for the fourth plane.
  11969. @end table
  11970. Range of mode is from 0 to 24. Description of each mode follows:
  11971. @table @var
  11972. @item 0
  11973. Leave input plane unchanged. Default.
  11974. @item 1
  11975. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11976. @item 2
  11977. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11978. @item 3
  11979. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11980. @item 4
  11981. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11982. This is equivalent to a median filter.
  11983. @item 5
  11984. Line-sensitive clipping giving the minimal change.
  11985. @item 6
  11986. Line-sensitive clipping, intermediate.
  11987. @item 7
  11988. Line-sensitive clipping, intermediate.
  11989. @item 8
  11990. Line-sensitive clipping, intermediate.
  11991. @item 9
  11992. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11993. @item 10
  11994. Replaces the target pixel with the closest neighbour.
  11995. @item 11
  11996. [1 2 1] horizontal and vertical kernel blur.
  11997. @item 12
  11998. Same as mode 11.
  11999. @item 13
  12000. Bob mode, interpolates top field from the line where the neighbours
  12001. pixels are the closest.
  12002. @item 14
  12003. Bob mode, interpolates bottom field from the line where the neighbours
  12004. pixels are the closest.
  12005. @item 15
  12006. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12007. interpolation formula.
  12008. @item 16
  12009. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12010. interpolation formula.
  12011. @item 17
  12012. Clips the pixel with the minimum and maximum of respectively the maximum and
  12013. minimum of each pair of opposite neighbour pixels.
  12014. @item 18
  12015. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12016. the current pixel is minimal.
  12017. @item 19
  12018. Replaces the pixel with the average of its 8 neighbours.
  12019. @item 20
  12020. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12021. @item 21
  12022. Clips pixels using the averages of opposite neighbour.
  12023. @item 22
  12024. Same as mode 21 but simpler and faster.
  12025. @item 23
  12026. Small edge and halo removal, but reputed useless.
  12027. @item 24
  12028. Similar as 23.
  12029. @end table
  12030. @section removelogo
  12031. Suppress a TV station logo, using an image file to determine which
  12032. pixels comprise the logo. It works by filling in the pixels that
  12033. comprise the logo with neighboring pixels.
  12034. The filter accepts the following options:
  12035. @table @option
  12036. @item filename, f
  12037. Set the filter bitmap file, which can be any image format supported by
  12038. libavformat. The width and height of the image file must match those of the
  12039. video stream being processed.
  12040. @end table
  12041. Pixels in the provided bitmap image with a value of zero are not
  12042. considered part of the logo, non-zero pixels are considered part of
  12043. the logo. If you use white (255) for the logo and black (0) for the
  12044. rest, you will be safe. For making the filter bitmap, it is
  12045. recommended to take a screen capture of a black frame with the logo
  12046. visible, and then using a threshold filter followed by the erode
  12047. filter once or twice.
  12048. If needed, little splotches can be fixed manually. Remember that if
  12049. logo pixels are not covered, the filter quality will be much
  12050. reduced. Marking too many pixels as part of the logo does not hurt as
  12051. much, but it will increase the amount of blurring needed to cover over
  12052. the image and will destroy more information than necessary, and extra
  12053. pixels will slow things down on a large logo.
  12054. @section repeatfields
  12055. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12056. fields based on its value.
  12057. @section reverse
  12058. Reverse a video clip.
  12059. Warning: This filter requires memory to buffer the entire clip, so trimming
  12060. is suggested.
  12061. @subsection Examples
  12062. @itemize
  12063. @item
  12064. Take the first 5 seconds of a clip, and reverse it.
  12065. @example
  12066. trim=end=5,reverse
  12067. @end example
  12068. @end itemize
  12069. @section rgbashift
  12070. Shift R/G/B/A pixels horizontally and/or vertically.
  12071. The filter accepts the following options:
  12072. @table @option
  12073. @item rh
  12074. Set amount to shift red horizontally.
  12075. @item rv
  12076. Set amount to shift red vertically.
  12077. @item gh
  12078. Set amount to shift green horizontally.
  12079. @item gv
  12080. Set amount to shift green vertically.
  12081. @item bh
  12082. Set amount to shift blue horizontally.
  12083. @item bv
  12084. Set amount to shift blue vertically.
  12085. @item ah
  12086. Set amount to shift alpha horizontally.
  12087. @item av
  12088. Set amount to shift alpha vertically.
  12089. @item edge
  12090. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12091. @end table
  12092. @subsection Commands
  12093. This filter supports the all above options as @ref{commands}.
  12094. @section roberts
  12095. Apply roberts cross operator to input video stream.
  12096. The filter accepts the following option:
  12097. @table @option
  12098. @item planes
  12099. Set which planes will be processed, unprocessed planes will be copied.
  12100. By default value 0xf, all planes will be processed.
  12101. @item scale
  12102. Set value which will be multiplied with filtered result.
  12103. @item delta
  12104. Set value which will be added to filtered result.
  12105. @end table
  12106. @section rotate
  12107. Rotate video by an arbitrary angle expressed in radians.
  12108. The filter accepts the following options:
  12109. A description of the optional parameters follows.
  12110. @table @option
  12111. @item angle, a
  12112. Set an expression for the angle by which to rotate the input video
  12113. clockwise, expressed as a number of radians. A negative value will
  12114. result in a counter-clockwise rotation. By default it is set to "0".
  12115. This expression is evaluated for each frame.
  12116. @item out_w, ow
  12117. Set the output width expression, default value is "iw".
  12118. This expression is evaluated just once during configuration.
  12119. @item out_h, oh
  12120. Set the output height expression, default value is "ih".
  12121. This expression is evaluated just once during configuration.
  12122. @item bilinear
  12123. Enable bilinear interpolation if set to 1, a value of 0 disables
  12124. it. Default value is 1.
  12125. @item fillcolor, c
  12126. Set the color used to fill the output area not covered by the rotated
  12127. image. For the general syntax of this option, check the
  12128. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12129. If the special value "none" is selected then no
  12130. background is printed (useful for example if the background is never shown).
  12131. Default value is "black".
  12132. @end table
  12133. The expressions for the angle and the output size can contain the
  12134. following constants and functions:
  12135. @table @option
  12136. @item n
  12137. sequential number of the input frame, starting from 0. It is always NAN
  12138. before the first frame is filtered.
  12139. @item t
  12140. time in seconds of the input frame, it is set to 0 when the filter is
  12141. configured. It is always NAN before the first frame is filtered.
  12142. @item hsub
  12143. @item vsub
  12144. horizontal and vertical chroma subsample values. For example for the
  12145. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12146. @item in_w, iw
  12147. @item in_h, ih
  12148. the input video width and height
  12149. @item out_w, ow
  12150. @item out_h, oh
  12151. the output width and height, that is the size of the padded area as
  12152. specified by the @var{width} and @var{height} expressions
  12153. @item rotw(a)
  12154. @item roth(a)
  12155. the minimal width/height required for completely containing the input
  12156. video rotated by @var{a} radians.
  12157. These are only available when computing the @option{out_w} and
  12158. @option{out_h} expressions.
  12159. @end table
  12160. @subsection Examples
  12161. @itemize
  12162. @item
  12163. Rotate the input by PI/6 radians clockwise:
  12164. @example
  12165. rotate=PI/6
  12166. @end example
  12167. @item
  12168. Rotate the input by PI/6 radians counter-clockwise:
  12169. @example
  12170. rotate=-PI/6
  12171. @end example
  12172. @item
  12173. Rotate the input by 45 degrees clockwise:
  12174. @example
  12175. rotate=45*PI/180
  12176. @end example
  12177. @item
  12178. Apply a constant rotation with period T, starting from an angle of PI/3:
  12179. @example
  12180. rotate=PI/3+2*PI*t/T
  12181. @end example
  12182. @item
  12183. Make the input video rotation oscillating with a period of T
  12184. seconds and an amplitude of A radians:
  12185. @example
  12186. rotate=A*sin(2*PI/T*t)
  12187. @end example
  12188. @item
  12189. Rotate the video, output size is chosen so that the whole rotating
  12190. input video is always completely contained in the output:
  12191. @example
  12192. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12193. @end example
  12194. @item
  12195. Rotate the video, reduce the output size so that no background is ever
  12196. shown:
  12197. @example
  12198. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12199. @end example
  12200. @end itemize
  12201. @subsection Commands
  12202. The filter supports the following commands:
  12203. @table @option
  12204. @item a, angle
  12205. Set the angle expression.
  12206. The command accepts the same syntax of the corresponding option.
  12207. If the specified expression is not valid, it is kept at its current
  12208. value.
  12209. @end table
  12210. @section sab
  12211. Apply Shape Adaptive Blur.
  12212. The filter accepts the following options:
  12213. @table @option
  12214. @item luma_radius, lr
  12215. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12216. value is 1.0. A greater value will result in a more blurred image, and
  12217. in slower processing.
  12218. @item luma_pre_filter_radius, lpfr
  12219. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12220. value is 1.0.
  12221. @item luma_strength, ls
  12222. Set luma maximum difference between pixels to still be considered, must
  12223. be a value in the 0.1-100.0 range, default value is 1.0.
  12224. @item chroma_radius, cr
  12225. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12226. greater value will result in a more blurred image, and in slower
  12227. processing.
  12228. @item chroma_pre_filter_radius, cpfr
  12229. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12230. @item chroma_strength, cs
  12231. Set chroma maximum difference between pixels to still be considered,
  12232. must be a value in the -0.9-100.0 range.
  12233. @end table
  12234. Each chroma option value, if not explicitly specified, is set to the
  12235. corresponding luma option value.
  12236. @anchor{scale}
  12237. @section scale
  12238. Scale (resize) the input video, using the libswscale library.
  12239. The scale filter forces the output display aspect ratio to be the same
  12240. of the input, by changing the output sample aspect ratio.
  12241. If the input image format is different from the format requested by
  12242. the next filter, the scale filter will convert the input to the
  12243. requested format.
  12244. @subsection Options
  12245. The filter accepts the following options, or any of the options
  12246. supported by the libswscale scaler.
  12247. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12248. the complete list of scaler options.
  12249. @table @option
  12250. @item width, w
  12251. @item height, h
  12252. Set the output video dimension expression. Default value is the input
  12253. dimension.
  12254. If the @var{width} or @var{w} value is 0, the input width is used for
  12255. the output. If the @var{height} or @var{h} value is 0, the input height
  12256. is used for the output.
  12257. If one and only one of the values is -n with n >= 1, the scale filter
  12258. will use a value that maintains the aspect ratio of the input image,
  12259. calculated from the other specified dimension. After that it will,
  12260. however, make sure that the calculated dimension is divisible by n and
  12261. adjust the value if necessary.
  12262. If both values are -n with n >= 1, the behavior will be identical to
  12263. both values being set to 0 as previously detailed.
  12264. See below for the list of accepted constants for use in the dimension
  12265. expression.
  12266. @item eval
  12267. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12268. @table @samp
  12269. @item init
  12270. Only evaluate expressions once during the filter initialization or when a command is processed.
  12271. @item frame
  12272. Evaluate expressions for each incoming frame.
  12273. @end table
  12274. Default value is @samp{init}.
  12275. @item interl
  12276. Set the interlacing mode. It accepts the following values:
  12277. @table @samp
  12278. @item 1
  12279. Force interlaced aware scaling.
  12280. @item 0
  12281. Do not apply interlaced scaling.
  12282. @item -1
  12283. Select interlaced aware scaling depending on whether the source frames
  12284. are flagged as interlaced or not.
  12285. @end table
  12286. Default value is @samp{0}.
  12287. @item flags
  12288. Set libswscale scaling flags. See
  12289. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12290. complete list of values. If not explicitly specified the filter applies
  12291. the default flags.
  12292. @item param0, param1
  12293. Set libswscale input parameters for scaling algorithms that need them. See
  12294. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12295. complete documentation. If not explicitly specified the filter applies
  12296. empty parameters.
  12297. @item size, s
  12298. Set the video size. For the syntax of this option, check the
  12299. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12300. @item in_color_matrix
  12301. @item out_color_matrix
  12302. Set in/output YCbCr color space type.
  12303. This allows the autodetected value to be overridden as well as allows forcing
  12304. a specific value used for the output and encoder.
  12305. If not specified, the color space type depends on the pixel format.
  12306. Possible values:
  12307. @table @samp
  12308. @item auto
  12309. Choose automatically.
  12310. @item bt709
  12311. Format conforming to International Telecommunication Union (ITU)
  12312. Recommendation BT.709.
  12313. @item fcc
  12314. Set color space conforming to the United States Federal Communications
  12315. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12316. @item bt601
  12317. @item bt470
  12318. @item smpte170m
  12319. Set color space conforming to:
  12320. @itemize
  12321. @item
  12322. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12323. @item
  12324. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12325. @item
  12326. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12327. @end itemize
  12328. @item smpte240m
  12329. Set color space conforming to SMPTE ST 240:1999.
  12330. @item bt2020
  12331. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12332. @end table
  12333. @item in_range
  12334. @item out_range
  12335. Set in/output YCbCr sample range.
  12336. This allows the autodetected value to be overridden as well as allows forcing
  12337. a specific value used for the output and encoder. If not specified, the
  12338. range depends on the pixel format. Possible values:
  12339. @table @samp
  12340. @item auto/unknown
  12341. Choose automatically.
  12342. @item jpeg/full/pc
  12343. Set full range (0-255 in case of 8-bit luma).
  12344. @item mpeg/limited/tv
  12345. Set "MPEG" range (16-235 in case of 8-bit luma).
  12346. @end table
  12347. @item force_original_aspect_ratio
  12348. Enable decreasing or increasing output video width or height if necessary to
  12349. keep the original aspect ratio. Possible values:
  12350. @table @samp
  12351. @item disable
  12352. Scale the video as specified and disable this feature.
  12353. @item decrease
  12354. The output video dimensions will automatically be decreased if needed.
  12355. @item increase
  12356. The output video dimensions will automatically be increased if needed.
  12357. @end table
  12358. One useful instance of this option is that when you know a specific device's
  12359. maximum allowed resolution, you can use this to limit the output video to
  12360. that, while retaining the aspect ratio. For example, device A allows
  12361. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12362. decrease) and specifying 1280x720 to the command line makes the output
  12363. 1280x533.
  12364. Please note that this is a different thing than specifying -1 for @option{w}
  12365. or @option{h}, you still need to specify the output resolution for this option
  12366. to work.
  12367. @item force_divisible_by
  12368. Ensures that both the output dimensions, width and height, are divisible by the
  12369. given integer when used together with @option{force_original_aspect_ratio}. This
  12370. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12371. This option respects the value set for @option{force_original_aspect_ratio},
  12372. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12373. may be slightly modified.
  12374. This option can be handy if you need to have a video fit within or exceed
  12375. a defined resolution using @option{force_original_aspect_ratio} but also have
  12376. encoder restrictions on width or height divisibility.
  12377. @end table
  12378. The values of the @option{w} and @option{h} options are expressions
  12379. containing the following constants:
  12380. @table @var
  12381. @item in_w
  12382. @item in_h
  12383. The input width and height
  12384. @item iw
  12385. @item ih
  12386. These are the same as @var{in_w} and @var{in_h}.
  12387. @item out_w
  12388. @item out_h
  12389. The output (scaled) width and height
  12390. @item ow
  12391. @item oh
  12392. These are the same as @var{out_w} and @var{out_h}
  12393. @item a
  12394. The same as @var{iw} / @var{ih}
  12395. @item sar
  12396. input sample aspect ratio
  12397. @item dar
  12398. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12399. @item hsub
  12400. @item vsub
  12401. horizontal and vertical input chroma subsample values. For example for the
  12402. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12403. @item ohsub
  12404. @item ovsub
  12405. horizontal and vertical output chroma subsample values. For example for the
  12406. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12407. @item n
  12408. The (sequential) number of the input frame, starting from 0.
  12409. Only available with @code{eval=frame}.
  12410. @item t
  12411. The presentation timestamp of the input frame, expressed as a number of
  12412. seconds. Only available with @code{eval=frame}.
  12413. @item pos
  12414. The position (byte offset) of the frame in the input stream, or NaN if
  12415. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12416. Only available with @code{eval=frame}.
  12417. @end table
  12418. @subsection Examples
  12419. @itemize
  12420. @item
  12421. Scale the input video to a size of 200x100
  12422. @example
  12423. scale=w=200:h=100
  12424. @end example
  12425. This is equivalent to:
  12426. @example
  12427. scale=200:100
  12428. @end example
  12429. or:
  12430. @example
  12431. scale=200x100
  12432. @end example
  12433. @item
  12434. Specify a size abbreviation for the output size:
  12435. @example
  12436. scale=qcif
  12437. @end example
  12438. which can also be written as:
  12439. @example
  12440. scale=size=qcif
  12441. @end example
  12442. @item
  12443. Scale the input to 2x:
  12444. @example
  12445. scale=w=2*iw:h=2*ih
  12446. @end example
  12447. @item
  12448. The above is the same as:
  12449. @example
  12450. scale=2*in_w:2*in_h
  12451. @end example
  12452. @item
  12453. Scale the input to 2x with forced interlaced scaling:
  12454. @example
  12455. scale=2*iw:2*ih:interl=1
  12456. @end example
  12457. @item
  12458. Scale the input to half size:
  12459. @example
  12460. scale=w=iw/2:h=ih/2
  12461. @end example
  12462. @item
  12463. Increase the width, and set the height to the same size:
  12464. @example
  12465. scale=3/2*iw:ow
  12466. @end example
  12467. @item
  12468. Seek Greek harmony:
  12469. @example
  12470. scale=iw:1/PHI*iw
  12471. scale=ih*PHI:ih
  12472. @end example
  12473. @item
  12474. Increase the height, and set the width to 3/2 of the height:
  12475. @example
  12476. scale=w=3/2*oh:h=3/5*ih
  12477. @end example
  12478. @item
  12479. Increase the size, making the size a multiple of the chroma
  12480. subsample values:
  12481. @example
  12482. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12483. @end example
  12484. @item
  12485. Increase the width to a maximum of 500 pixels,
  12486. keeping the same aspect ratio as the input:
  12487. @example
  12488. scale=w='min(500\, iw*3/2):h=-1'
  12489. @end example
  12490. @item
  12491. Make pixels square by combining scale and setsar:
  12492. @example
  12493. scale='trunc(ih*dar):ih',setsar=1/1
  12494. @end example
  12495. @item
  12496. Make pixels square by combining scale and setsar,
  12497. making sure the resulting resolution is even (required by some codecs):
  12498. @example
  12499. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12500. @end example
  12501. @end itemize
  12502. @subsection Commands
  12503. This filter supports the following commands:
  12504. @table @option
  12505. @item width, w
  12506. @item height, h
  12507. Set the output video dimension expression.
  12508. The command accepts the same syntax of the corresponding option.
  12509. If the specified expression is not valid, it is kept at its current
  12510. value.
  12511. @end table
  12512. @section scale_npp
  12513. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12514. format conversion on CUDA video frames. Setting the output width and height
  12515. works in the same way as for the @var{scale} filter.
  12516. The following additional options are accepted:
  12517. @table @option
  12518. @item format
  12519. The pixel format of the output CUDA frames. If set to the string "same" (the
  12520. default), the input format will be kept. Note that automatic format negotiation
  12521. and conversion is not yet supported for hardware frames
  12522. @item interp_algo
  12523. The interpolation algorithm used for resizing. One of the following:
  12524. @table @option
  12525. @item nn
  12526. Nearest neighbour.
  12527. @item linear
  12528. @item cubic
  12529. @item cubic2p_bspline
  12530. 2-parameter cubic (B=1, C=0)
  12531. @item cubic2p_catmullrom
  12532. 2-parameter cubic (B=0, C=1/2)
  12533. @item cubic2p_b05c03
  12534. 2-parameter cubic (B=1/2, C=3/10)
  12535. @item super
  12536. Supersampling
  12537. @item lanczos
  12538. @end table
  12539. @item force_original_aspect_ratio
  12540. Enable decreasing or increasing output video width or height if necessary to
  12541. keep the original aspect ratio. Possible values:
  12542. @table @samp
  12543. @item disable
  12544. Scale the video as specified and disable this feature.
  12545. @item decrease
  12546. The output video dimensions will automatically be decreased if needed.
  12547. @item increase
  12548. The output video dimensions will automatically be increased if needed.
  12549. @end table
  12550. One useful instance of this option is that when you know a specific device's
  12551. maximum allowed resolution, you can use this to limit the output video to
  12552. that, while retaining the aspect ratio. For example, device A allows
  12553. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12554. decrease) and specifying 1280x720 to the command line makes the output
  12555. 1280x533.
  12556. Please note that this is a different thing than specifying -1 for @option{w}
  12557. or @option{h}, you still need to specify the output resolution for this option
  12558. to work.
  12559. @item force_divisible_by
  12560. Ensures that both the output dimensions, width and height, are divisible by the
  12561. given integer when used together with @option{force_original_aspect_ratio}. This
  12562. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12563. This option respects the value set for @option{force_original_aspect_ratio},
  12564. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12565. may be slightly modified.
  12566. This option can be handy if you need to have a video fit within or exceed
  12567. a defined resolution using @option{force_original_aspect_ratio} but also have
  12568. encoder restrictions on width or height divisibility.
  12569. @end table
  12570. @section scale2ref
  12571. Scale (resize) the input video, based on a reference video.
  12572. See the scale filter for available options, scale2ref supports the same but
  12573. uses the reference video instead of the main input as basis. scale2ref also
  12574. supports the following additional constants for the @option{w} and
  12575. @option{h} options:
  12576. @table @var
  12577. @item main_w
  12578. @item main_h
  12579. The main input video's width and height
  12580. @item main_a
  12581. The same as @var{main_w} / @var{main_h}
  12582. @item main_sar
  12583. The main input video's sample aspect ratio
  12584. @item main_dar, mdar
  12585. The main input video's display aspect ratio. Calculated from
  12586. @code{(main_w / main_h) * main_sar}.
  12587. @item main_hsub
  12588. @item main_vsub
  12589. The main input video's horizontal and vertical chroma subsample values.
  12590. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12591. is 1.
  12592. @item main_n
  12593. The (sequential) number of the main input frame, starting from 0.
  12594. Only available with @code{eval=frame}.
  12595. @item main_t
  12596. The presentation timestamp of the main input frame, expressed as a number of
  12597. seconds. Only available with @code{eval=frame}.
  12598. @item main_pos
  12599. The position (byte offset) of the frame in the main input stream, or NaN if
  12600. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12601. Only available with @code{eval=frame}.
  12602. @end table
  12603. @subsection Examples
  12604. @itemize
  12605. @item
  12606. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12607. @example
  12608. 'scale2ref[b][a];[a][b]overlay'
  12609. @end example
  12610. @item
  12611. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12612. @example
  12613. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12614. @end example
  12615. @end itemize
  12616. @subsection Commands
  12617. This filter supports the following commands:
  12618. @table @option
  12619. @item width, w
  12620. @item height, h
  12621. Set the output video dimension expression.
  12622. The command accepts the same syntax of the corresponding option.
  12623. If the specified expression is not valid, it is kept at its current
  12624. value.
  12625. @end table
  12626. @section scroll
  12627. Scroll input video horizontally and/or vertically by constant speed.
  12628. The filter accepts the following options:
  12629. @table @option
  12630. @item horizontal, h
  12631. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12632. Negative values changes scrolling direction.
  12633. @item vertical, v
  12634. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12635. Negative values changes scrolling direction.
  12636. @item hpos
  12637. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12638. @item vpos
  12639. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12640. @end table
  12641. @subsection Commands
  12642. This filter supports the following @ref{commands}:
  12643. @table @option
  12644. @item horizontal, h
  12645. Set the horizontal scrolling speed.
  12646. @item vertical, v
  12647. Set the vertical scrolling speed.
  12648. @end table
  12649. @anchor{scdet}
  12650. @section scdet
  12651. Detect video scene change.
  12652. This filter sets frame metadata with mafd between frame, the scene score, and
  12653. forward the frame to the next filter, so they can use these metadata to detect
  12654. scene change or others.
  12655. In addition, this filter logs a message and sets frame metadata when it detects
  12656. a scene change by @option{threshold}.
  12657. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12658. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12659. to detect scene change.
  12660. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12661. detect scene change with @option{threshold}.
  12662. The filter accepts the following options:
  12663. @table @option
  12664. @item threshold, t
  12665. Set the scene change detection threshold as a percentage of maximum change. Good
  12666. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12667. @code{[0., 100.]}.
  12668. Default value is @code{10.}.
  12669. @item sc_pass, s
  12670. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12671. You can enable it if you want to get snapshot of scene change frames only.
  12672. @end table
  12673. @anchor{selectivecolor}
  12674. @section selectivecolor
  12675. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12676. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12677. by the "purity" of the color (that is, how saturated it already is).
  12678. This filter is similar to the Adobe Photoshop Selective Color tool.
  12679. The filter accepts the following options:
  12680. @table @option
  12681. @item correction_method
  12682. Select color correction method.
  12683. Available values are:
  12684. @table @samp
  12685. @item absolute
  12686. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12687. component value).
  12688. @item relative
  12689. Specified adjustments are relative to the original component value.
  12690. @end table
  12691. Default is @code{absolute}.
  12692. @item reds
  12693. Adjustments for red pixels (pixels where the red component is the maximum)
  12694. @item yellows
  12695. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12696. @item greens
  12697. Adjustments for green pixels (pixels where the green component is the maximum)
  12698. @item cyans
  12699. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12700. @item blues
  12701. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12702. @item magentas
  12703. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12704. @item whites
  12705. Adjustments for white pixels (pixels where all components are greater than 128)
  12706. @item neutrals
  12707. Adjustments for all pixels except pure black and pure white
  12708. @item blacks
  12709. Adjustments for black pixels (pixels where all components are lesser than 128)
  12710. @item psfile
  12711. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12712. @end table
  12713. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12714. 4 space separated floating point adjustment values in the [-1,1] range,
  12715. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12716. pixels of its range.
  12717. @subsection Examples
  12718. @itemize
  12719. @item
  12720. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12721. increase magenta by 27% in blue areas:
  12722. @example
  12723. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12724. @end example
  12725. @item
  12726. Use a Photoshop selective color preset:
  12727. @example
  12728. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12729. @end example
  12730. @end itemize
  12731. @anchor{separatefields}
  12732. @section separatefields
  12733. The @code{separatefields} takes a frame-based video input and splits
  12734. each frame into its components fields, producing a new half height clip
  12735. with twice the frame rate and twice the frame count.
  12736. This filter use field-dominance information in frame to decide which
  12737. of each pair of fields to place first in the output.
  12738. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12739. @section setdar, setsar
  12740. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12741. output video.
  12742. This is done by changing the specified Sample (aka Pixel) Aspect
  12743. Ratio, according to the following equation:
  12744. @example
  12745. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12746. @end example
  12747. Keep in mind that the @code{setdar} filter does not modify the pixel
  12748. dimensions of the video frame. Also, the display aspect ratio set by
  12749. this filter may be changed by later filters in the filterchain,
  12750. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12751. applied.
  12752. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12753. the filter output video.
  12754. Note that as a consequence of the application of this filter, the
  12755. output display aspect ratio will change according to the equation
  12756. above.
  12757. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12758. filter may be changed by later filters in the filterchain, e.g. if
  12759. another "setsar" or a "setdar" filter is applied.
  12760. It accepts the following parameters:
  12761. @table @option
  12762. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12763. Set the aspect ratio used by the filter.
  12764. The parameter can be a floating point number string, an expression, or
  12765. a string of the form @var{num}:@var{den}, where @var{num} and
  12766. @var{den} are the numerator and denominator of the aspect ratio. If
  12767. the parameter is not specified, it is assumed the value "0".
  12768. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12769. should be escaped.
  12770. @item max
  12771. Set the maximum integer value to use for expressing numerator and
  12772. denominator when reducing the expressed aspect ratio to a rational.
  12773. Default value is @code{100}.
  12774. @end table
  12775. The parameter @var{sar} is an expression containing
  12776. the following constants:
  12777. @table @option
  12778. @item E, PI, PHI
  12779. These are approximated values for the mathematical constants e
  12780. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12781. @item w, h
  12782. The input width and height.
  12783. @item a
  12784. These are the same as @var{w} / @var{h}.
  12785. @item sar
  12786. The input sample aspect ratio.
  12787. @item dar
  12788. The input display aspect ratio. It is the same as
  12789. (@var{w} / @var{h}) * @var{sar}.
  12790. @item hsub, vsub
  12791. Horizontal and vertical chroma subsample values. For example, for the
  12792. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12793. @end table
  12794. @subsection Examples
  12795. @itemize
  12796. @item
  12797. To change the display aspect ratio to 16:9, specify one of the following:
  12798. @example
  12799. setdar=dar=1.77777
  12800. setdar=dar=16/9
  12801. @end example
  12802. @item
  12803. To change the sample aspect ratio to 10:11, specify:
  12804. @example
  12805. setsar=sar=10/11
  12806. @end example
  12807. @item
  12808. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12809. 1000 in the aspect ratio reduction, use the command:
  12810. @example
  12811. setdar=ratio=16/9:max=1000
  12812. @end example
  12813. @end itemize
  12814. @anchor{setfield}
  12815. @section setfield
  12816. Force field for the output video frame.
  12817. The @code{setfield} filter marks the interlace type field for the
  12818. output frames. It does not change the input frame, but only sets the
  12819. corresponding property, which affects how the frame is treated by
  12820. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12821. The filter accepts the following options:
  12822. @table @option
  12823. @item mode
  12824. Available values are:
  12825. @table @samp
  12826. @item auto
  12827. Keep the same field property.
  12828. @item bff
  12829. Mark the frame as bottom-field-first.
  12830. @item tff
  12831. Mark the frame as top-field-first.
  12832. @item prog
  12833. Mark the frame as progressive.
  12834. @end table
  12835. @end table
  12836. @anchor{setparams}
  12837. @section setparams
  12838. Force frame parameter for the output video frame.
  12839. The @code{setparams} filter marks interlace and color range for the
  12840. output frames. It does not change the input frame, but only sets the
  12841. corresponding property, which affects how the frame is treated by
  12842. filters/encoders.
  12843. @table @option
  12844. @item field_mode
  12845. Available values are:
  12846. @table @samp
  12847. @item auto
  12848. Keep the same field property (default).
  12849. @item bff
  12850. Mark the frame as bottom-field-first.
  12851. @item tff
  12852. Mark the frame as top-field-first.
  12853. @item prog
  12854. Mark the frame as progressive.
  12855. @end table
  12856. @item range
  12857. Available values are:
  12858. @table @samp
  12859. @item auto
  12860. Keep the same color range property (default).
  12861. @item unspecified, unknown
  12862. Mark the frame as unspecified color range.
  12863. @item limited, tv, mpeg
  12864. Mark the frame as limited range.
  12865. @item full, pc, jpeg
  12866. Mark the frame as full range.
  12867. @end table
  12868. @item color_primaries
  12869. Set the color primaries.
  12870. Available values are:
  12871. @table @samp
  12872. @item auto
  12873. Keep the same color primaries property (default).
  12874. @item bt709
  12875. @item unknown
  12876. @item bt470m
  12877. @item bt470bg
  12878. @item smpte170m
  12879. @item smpte240m
  12880. @item film
  12881. @item bt2020
  12882. @item smpte428
  12883. @item smpte431
  12884. @item smpte432
  12885. @item jedec-p22
  12886. @end table
  12887. @item color_trc
  12888. Set the color transfer.
  12889. Available values are:
  12890. @table @samp
  12891. @item auto
  12892. Keep the same color trc property (default).
  12893. @item bt709
  12894. @item unknown
  12895. @item bt470m
  12896. @item bt470bg
  12897. @item smpte170m
  12898. @item smpte240m
  12899. @item linear
  12900. @item log100
  12901. @item log316
  12902. @item iec61966-2-4
  12903. @item bt1361e
  12904. @item iec61966-2-1
  12905. @item bt2020-10
  12906. @item bt2020-12
  12907. @item smpte2084
  12908. @item smpte428
  12909. @item arib-std-b67
  12910. @end table
  12911. @item colorspace
  12912. Set the colorspace.
  12913. Available values are:
  12914. @table @samp
  12915. @item auto
  12916. Keep the same colorspace property (default).
  12917. @item gbr
  12918. @item bt709
  12919. @item unknown
  12920. @item fcc
  12921. @item bt470bg
  12922. @item smpte170m
  12923. @item smpte240m
  12924. @item ycgco
  12925. @item bt2020nc
  12926. @item bt2020c
  12927. @item smpte2085
  12928. @item chroma-derived-nc
  12929. @item chroma-derived-c
  12930. @item ictcp
  12931. @end table
  12932. @end table
  12933. @section showinfo
  12934. Show a line containing various information for each input video frame.
  12935. The input video is not modified.
  12936. This filter supports the following options:
  12937. @table @option
  12938. @item checksum
  12939. Calculate checksums of each plane. By default enabled.
  12940. @end table
  12941. The shown line contains a sequence of key/value pairs of the form
  12942. @var{key}:@var{value}.
  12943. The following values are shown in the output:
  12944. @table @option
  12945. @item n
  12946. The (sequential) number of the input frame, starting from 0.
  12947. @item pts
  12948. The Presentation TimeStamp of the input frame, expressed as a number of
  12949. time base units. The time base unit depends on the filter input pad.
  12950. @item pts_time
  12951. The Presentation TimeStamp of the input frame, expressed as a number of
  12952. seconds.
  12953. @item pos
  12954. The position of the frame in the input stream, or -1 if this information is
  12955. unavailable and/or meaningless (for example in case of synthetic video).
  12956. @item fmt
  12957. The pixel format name.
  12958. @item sar
  12959. The sample aspect ratio of the input frame, expressed in the form
  12960. @var{num}/@var{den}.
  12961. @item s
  12962. The size of the input frame. For the syntax of this option, check the
  12963. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12964. @item i
  12965. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12966. for bottom field first).
  12967. @item iskey
  12968. This is 1 if the frame is a key frame, 0 otherwise.
  12969. @item type
  12970. The picture type of the input frame ("I" for an I-frame, "P" for a
  12971. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12972. Also refer to the documentation of the @code{AVPictureType} enum and of
  12973. the @code{av_get_picture_type_char} function defined in
  12974. @file{libavutil/avutil.h}.
  12975. @item checksum
  12976. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12977. @item plane_checksum
  12978. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12979. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12980. @item mean
  12981. The mean value of pixels in each plane of the input frame, expressed in the form
  12982. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  12983. @item stdev
  12984. The standard deviation of pixel values in each plane of the input frame, expressed
  12985. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  12986. @end table
  12987. @section showpalette
  12988. Displays the 256 colors palette of each frame. This filter is only relevant for
  12989. @var{pal8} pixel format frames.
  12990. It accepts the following option:
  12991. @table @option
  12992. @item s
  12993. Set the size of the box used to represent one palette color entry. Default is
  12994. @code{30} (for a @code{30x30} pixel box).
  12995. @end table
  12996. @section shuffleframes
  12997. Reorder and/or duplicate and/or drop video frames.
  12998. It accepts the following parameters:
  12999. @table @option
  13000. @item mapping
  13001. Set the destination indexes of input frames.
  13002. This is space or '|' separated list of indexes that maps input frames to output
  13003. frames. Number of indexes also sets maximal value that each index may have.
  13004. '-1' index have special meaning and that is to drop frame.
  13005. @end table
  13006. The first frame has the index 0. The default is to keep the input unchanged.
  13007. @subsection Examples
  13008. @itemize
  13009. @item
  13010. Swap second and third frame of every three frames of the input:
  13011. @example
  13012. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13013. @end example
  13014. @item
  13015. Swap 10th and 1st frame of every ten frames of the input:
  13016. @example
  13017. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13018. @end example
  13019. @end itemize
  13020. @section shuffleplanes
  13021. Reorder and/or duplicate video planes.
  13022. It accepts the following parameters:
  13023. @table @option
  13024. @item map0
  13025. The index of the input plane to be used as the first output plane.
  13026. @item map1
  13027. The index of the input plane to be used as the second output plane.
  13028. @item map2
  13029. The index of the input plane to be used as the third output plane.
  13030. @item map3
  13031. The index of the input plane to be used as the fourth output plane.
  13032. @end table
  13033. The first plane has the index 0. The default is to keep the input unchanged.
  13034. @subsection Examples
  13035. @itemize
  13036. @item
  13037. Swap the second and third planes of the input:
  13038. @example
  13039. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13040. @end example
  13041. @end itemize
  13042. @anchor{signalstats}
  13043. @section signalstats
  13044. Evaluate various visual metrics that assist in determining issues associated
  13045. with the digitization of analog video media.
  13046. By default the filter will log these metadata values:
  13047. @table @option
  13048. @item YMIN
  13049. Display the minimal Y value contained within the input frame. Expressed in
  13050. range of [0-255].
  13051. @item YLOW
  13052. Display the Y value at the 10% percentile within the input frame. Expressed in
  13053. range of [0-255].
  13054. @item YAVG
  13055. Display the average Y value within the input frame. Expressed in range of
  13056. [0-255].
  13057. @item YHIGH
  13058. Display the Y value at the 90% percentile within the input frame. Expressed in
  13059. range of [0-255].
  13060. @item YMAX
  13061. Display the maximum Y value contained within the input frame. Expressed in
  13062. range of [0-255].
  13063. @item UMIN
  13064. Display the minimal U value contained within the input frame. Expressed in
  13065. range of [0-255].
  13066. @item ULOW
  13067. Display the U value at the 10% percentile within the input frame. Expressed in
  13068. range of [0-255].
  13069. @item UAVG
  13070. Display the average U value within the input frame. Expressed in range of
  13071. [0-255].
  13072. @item UHIGH
  13073. Display the U value at the 90% percentile within the input frame. Expressed in
  13074. range of [0-255].
  13075. @item UMAX
  13076. Display the maximum U value contained within the input frame. Expressed in
  13077. range of [0-255].
  13078. @item VMIN
  13079. Display the minimal V value contained within the input frame. Expressed in
  13080. range of [0-255].
  13081. @item VLOW
  13082. Display the V value at the 10% percentile within the input frame. Expressed in
  13083. range of [0-255].
  13084. @item VAVG
  13085. Display the average V value within the input frame. Expressed in range of
  13086. [0-255].
  13087. @item VHIGH
  13088. Display the V value at the 90% percentile within the input frame. Expressed in
  13089. range of [0-255].
  13090. @item VMAX
  13091. Display the maximum V value contained within the input frame. Expressed in
  13092. range of [0-255].
  13093. @item SATMIN
  13094. Display the minimal saturation value contained within the input frame.
  13095. Expressed in range of [0-~181.02].
  13096. @item SATLOW
  13097. Display the saturation value at the 10% percentile within the input frame.
  13098. Expressed in range of [0-~181.02].
  13099. @item SATAVG
  13100. Display the average saturation value within the input frame. Expressed in range
  13101. of [0-~181.02].
  13102. @item SATHIGH
  13103. Display the saturation value at the 90% percentile within the input frame.
  13104. Expressed in range of [0-~181.02].
  13105. @item SATMAX
  13106. Display the maximum saturation value contained within the input frame.
  13107. Expressed in range of [0-~181.02].
  13108. @item HUEMED
  13109. Display the median value for hue within the input frame. Expressed in range of
  13110. [0-360].
  13111. @item HUEAVG
  13112. Display the average value for hue within the input frame. Expressed in range of
  13113. [0-360].
  13114. @item YDIF
  13115. Display the average of sample value difference between all values of the Y
  13116. plane in the current frame and corresponding values of the previous input frame.
  13117. Expressed in range of [0-255].
  13118. @item UDIF
  13119. Display the average of sample value difference between all values of the U
  13120. plane in the current frame and corresponding values of the previous input frame.
  13121. Expressed in range of [0-255].
  13122. @item VDIF
  13123. Display the average of sample value difference between all values of the V
  13124. plane in the current frame and corresponding values of the previous input frame.
  13125. Expressed in range of [0-255].
  13126. @item YBITDEPTH
  13127. Display bit depth of Y plane in current frame.
  13128. Expressed in range of [0-16].
  13129. @item UBITDEPTH
  13130. Display bit depth of U plane in current frame.
  13131. Expressed in range of [0-16].
  13132. @item VBITDEPTH
  13133. Display bit depth of V plane in current frame.
  13134. Expressed in range of [0-16].
  13135. @end table
  13136. The filter accepts the following options:
  13137. @table @option
  13138. @item stat
  13139. @item out
  13140. @option{stat} specify an additional form of image analysis.
  13141. @option{out} output video with the specified type of pixel highlighted.
  13142. Both options accept the following values:
  13143. @table @samp
  13144. @item tout
  13145. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13146. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13147. include the results of video dropouts, head clogs, or tape tracking issues.
  13148. @item vrep
  13149. Identify @var{vertical line repetition}. Vertical line repetition includes
  13150. similar rows of pixels within a frame. In born-digital video vertical line
  13151. repetition is common, but this pattern is uncommon in video digitized from an
  13152. analog source. When it occurs in video that results from the digitization of an
  13153. analog source it can indicate concealment from a dropout compensator.
  13154. @item brng
  13155. Identify pixels that fall outside of legal broadcast range.
  13156. @end table
  13157. @item color, c
  13158. Set the highlight color for the @option{out} option. The default color is
  13159. yellow.
  13160. @end table
  13161. @subsection Examples
  13162. @itemize
  13163. @item
  13164. Output data of various video metrics:
  13165. @example
  13166. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13167. @end example
  13168. @item
  13169. Output specific data about the minimum and maximum values of the Y plane per frame:
  13170. @example
  13171. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13172. @end example
  13173. @item
  13174. Playback video while highlighting pixels that are outside of broadcast range in red.
  13175. @example
  13176. ffplay example.mov -vf signalstats="out=brng:color=red"
  13177. @end example
  13178. @item
  13179. Playback video with signalstats metadata drawn over the frame.
  13180. @example
  13181. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13182. @end example
  13183. The contents of signalstat_drawtext.txt used in the command are:
  13184. @example
  13185. time %@{pts:hms@}
  13186. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13187. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13188. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13189. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13190. @end example
  13191. @end itemize
  13192. @anchor{signature}
  13193. @section signature
  13194. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13195. input. In this case the matching between the inputs can be calculated additionally.
  13196. The filter always passes through the first input. The signature of each stream can
  13197. be written into a file.
  13198. It accepts the following options:
  13199. @table @option
  13200. @item detectmode
  13201. Enable or disable the matching process.
  13202. Available values are:
  13203. @table @samp
  13204. @item off
  13205. Disable the calculation of a matching (default).
  13206. @item full
  13207. Calculate the matching for the whole video and output whether the whole video
  13208. matches or only parts.
  13209. @item fast
  13210. Calculate only until a matching is found or the video ends. Should be faster in
  13211. some cases.
  13212. @end table
  13213. @item nb_inputs
  13214. Set the number of inputs. The option value must be a non negative integer.
  13215. Default value is 1.
  13216. @item filename
  13217. Set the path to which the output is written. If there is more than one input,
  13218. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13219. integer), that will be replaced with the input number. If no filename is
  13220. specified, no output will be written. This is the default.
  13221. @item format
  13222. Choose the output format.
  13223. Available values are:
  13224. @table @samp
  13225. @item binary
  13226. Use the specified binary representation (default).
  13227. @item xml
  13228. Use the specified xml representation.
  13229. @end table
  13230. @item th_d
  13231. Set threshold to detect one word as similar. The option value must be an integer
  13232. greater than zero. The default value is 9000.
  13233. @item th_dc
  13234. Set threshold to detect all words as similar. The option value must be an integer
  13235. greater than zero. The default value is 60000.
  13236. @item th_xh
  13237. Set threshold to detect frames as similar. The option value must be an integer
  13238. greater than zero. The default value is 116.
  13239. @item th_di
  13240. Set the minimum length of a sequence in frames to recognize it as matching
  13241. sequence. The option value must be a non negative integer value.
  13242. The default value is 0.
  13243. @item th_it
  13244. Set the minimum relation, that matching frames to all frames must have.
  13245. The option value must be a double value between 0 and 1. The default value is 0.5.
  13246. @end table
  13247. @subsection Examples
  13248. @itemize
  13249. @item
  13250. To calculate the signature of an input video and store it in signature.bin:
  13251. @example
  13252. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13253. @end example
  13254. @item
  13255. To detect whether two videos match and store the signatures in XML format in
  13256. signature0.xml and signature1.xml:
  13257. @example
  13258. 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 -
  13259. @end example
  13260. @end itemize
  13261. @anchor{smartblur}
  13262. @section smartblur
  13263. Blur the input video without impacting the outlines.
  13264. It accepts the following options:
  13265. @table @option
  13266. @item luma_radius, lr
  13267. Set the luma radius. The option value must be a float number in
  13268. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13269. used to blur the image (slower if larger). Default value is 1.0.
  13270. @item luma_strength, ls
  13271. Set the luma strength. The option value must be a float number
  13272. in the range [-1.0,1.0] that configures the blurring. A value included
  13273. in [0.0,1.0] will blur the image whereas a value included in
  13274. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13275. @item luma_threshold, lt
  13276. Set the luma threshold used as a coefficient to determine
  13277. whether a pixel should be blurred or not. The option value must be an
  13278. integer in the range [-30,30]. A value of 0 will filter all the image,
  13279. a value included in [0,30] will filter flat areas and a value included
  13280. in [-30,0] will filter edges. Default value is 0.
  13281. @item chroma_radius, cr
  13282. Set the chroma radius. The option value must be a float number in
  13283. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13284. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13285. @item chroma_strength, cs
  13286. Set the chroma strength. The option value must be a float number
  13287. in the range [-1.0,1.0] that configures the blurring. A value included
  13288. in [0.0,1.0] will blur the image whereas a value included in
  13289. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13290. @item chroma_threshold, ct
  13291. Set the chroma threshold used as a coefficient to determine
  13292. whether a pixel should be blurred or not. The option value must be an
  13293. integer in the range [-30,30]. A value of 0 will filter all the image,
  13294. a value included in [0,30] will filter flat areas and a value included
  13295. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13296. @end table
  13297. If a chroma option is not explicitly set, the corresponding luma value
  13298. is set.
  13299. @section sobel
  13300. Apply sobel operator to input video stream.
  13301. The filter accepts the following option:
  13302. @table @option
  13303. @item planes
  13304. Set which planes will be processed, unprocessed planes will be copied.
  13305. By default value 0xf, all planes will be processed.
  13306. @item scale
  13307. Set value which will be multiplied with filtered result.
  13308. @item delta
  13309. Set value which will be added to filtered result.
  13310. @end table
  13311. @anchor{spp}
  13312. @section spp
  13313. Apply a simple postprocessing filter that compresses and decompresses the image
  13314. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13315. and average the results.
  13316. The filter accepts the following options:
  13317. @table @option
  13318. @item quality
  13319. Set quality. This option defines the number of levels for averaging. It accepts
  13320. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13321. effect. A value of @code{6} means the higher quality. For each increment of
  13322. that value the speed drops by a factor of approximately 2. Default value is
  13323. @code{3}.
  13324. @item qp
  13325. Force a constant quantization parameter. If not set, the filter will use the QP
  13326. from the video stream (if available).
  13327. @item mode
  13328. Set thresholding mode. Available modes are:
  13329. @table @samp
  13330. @item hard
  13331. Set hard thresholding (default).
  13332. @item soft
  13333. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13334. @end table
  13335. @item use_bframe_qp
  13336. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13337. option may cause flicker since the B-Frames have often larger QP. Default is
  13338. @code{0} (not enabled).
  13339. @end table
  13340. @subsection Commands
  13341. This filter supports the following commands:
  13342. @table @option
  13343. @item quality, level
  13344. Set quality level. The value @code{max} can be used to set the maximum level,
  13345. currently @code{6}.
  13346. @end table
  13347. @anchor{sr}
  13348. @section sr
  13349. Scale the input by applying one of the super-resolution methods based on
  13350. convolutional neural networks. Supported models:
  13351. @itemize
  13352. @item
  13353. Super-Resolution Convolutional Neural Network model (SRCNN).
  13354. See @url{https://arxiv.org/abs/1501.00092}.
  13355. @item
  13356. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13357. See @url{https://arxiv.org/abs/1609.05158}.
  13358. @end itemize
  13359. Training scripts as well as scripts for model file (.pb) saving can be found at
  13360. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13361. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13362. Native model files (.model) can be generated from TensorFlow model
  13363. files (.pb) by using tools/python/convert.py
  13364. The filter accepts the following options:
  13365. @table @option
  13366. @item dnn_backend
  13367. Specify which DNN backend to use for model loading and execution. This option accepts
  13368. the following values:
  13369. @table @samp
  13370. @item native
  13371. Native implementation of DNN loading and execution.
  13372. @item tensorflow
  13373. TensorFlow backend. To enable this backend you
  13374. need to install the TensorFlow for C library (see
  13375. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13376. @code{--enable-libtensorflow}
  13377. @end table
  13378. Default value is @samp{native}.
  13379. @item model
  13380. Set path to model file specifying network architecture and its parameters.
  13381. Note that different backends use different file formats. TensorFlow backend
  13382. can load files for both formats, while native backend can load files for only
  13383. its format.
  13384. @item scale_factor
  13385. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13386. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13387. input upscaled using bicubic upscaling with proper scale factor.
  13388. @end table
  13389. This feature can also be finished with @ref{dnn_processing} filter.
  13390. @section ssim
  13391. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13392. This filter takes in input two input videos, the first input is
  13393. considered the "main" source and is passed unchanged to the
  13394. output. The second input is used as a "reference" video for computing
  13395. the SSIM.
  13396. Both video inputs must have the same resolution and pixel format for
  13397. this filter to work correctly. Also it assumes that both inputs
  13398. have the same number of frames, which are compared one by one.
  13399. The filter stores the calculated SSIM of each frame.
  13400. The description of the accepted parameters follows.
  13401. @table @option
  13402. @item stats_file, f
  13403. If specified the filter will use the named file to save the SSIM of
  13404. each individual frame. When filename equals "-" the data is sent to
  13405. standard output.
  13406. @end table
  13407. The file printed if @var{stats_file} is selected, contains a sequence of
  13408. key/value pairs of the form @var{key}:@var{value} for each compared
  13409. couple of frames.
  13410. A description of each shown parameter follows:
  13411. @table @option
  13412. @item n
  13413. sequential number of the input frame, starting from 1
  13414. @item Y, U, V, R, G, B
  13415. SSIM of the compared frames for the component specified by the suffix.
  13416. @item All
  13417. SSIM of the compared frames for the whole frame.
  13418. @item dB
  13419. Same as above but in dB representation.
  13420. @end table
  13421. This filter also supports the @ref{framesync} options.
  13422. @subsection Examples
  13423. @itemize
  13424. @item
  13425. For example:
  13426. @example
  13427. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13428. [main][ref] ssim="stats_file=stats.log" [out]
  13429. @end example
  13430. On this example the input file being processed is compared with the
  13431. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13432. is stored in @file{stats.log}.
  13433. @item
  13434. Another example with both psnr and ssim at same time:
  13435. @example
  13436. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13437. @end example
  13438. @item
  13439. Another example with different containers:
  13440. @example
  13441. 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 -
  13442. @end example
  13443. @end itemize
  13444. @section stereo3d
  13445. Convert between different stereoscopic image formats.
  13446. The filters accept the following options:
  13447. @table @option
  13448. @item in
  13449. Set stereoscopic image format of input.
  13450. Available values for input image formats are:
  13451. @table @samp
  13452. @item sbsl
  13453. side by side parallel (left eye left, right eye right)
  13454. @item sbsr
  13455. side by side crosseye (right eye left, left eye right)
  13456. @item sbs2l
  13457. side by side parallel with half width resolution
  13458. (left eye left, right eye right)
  13459. @item sbs2r
  13460. side by side crosseye with half width resolution
  13461. (right eye left, left eye right)
  13462. @item abl
  13463. @item tbl
  13464. above-below (left eye above, right eye below)
  13465. @item abr
  13466. @item tbr
  13467. above-below (right eye above, left eye below)
  13468. @item ab2l
  13469. @item tb2l
  13470. above-below with half height resolution
  13471. (left eye above, right eye below)
  13472. @item ab2r
  13473. @item tb2r
  13474. above-below with half height resolution
  13475. (right eye above, left eye below)
  13476. @item al
  13477. alternating frames (left eye first, right eye second)
  13478. @item ar
  13479. alternating frames (right eye first, left eye second)
  13480. @item irl
  13481. interleaved rows (left eye has top row, right eye starts on next row)
  13482. @item irr
  13483. interleaved rows (right eye has top row, left eye starts on next row)
  13484. @item icl
  13485. interleaved columns, left eye first
  13486. @item icr
  13487. interleaved columns, right eye first
  13488. Default value is @samp{sbsl}.
  13489. @end table
  13490. @item out
  13491. Set stereoscopic image format of output.
  13492. @table @samp
  13493. @item sbsl
  13494. side by side parallel (left eye left, right eye right)
  13495. @item sbsr
  13496. side by side crosseye (right eye left, left eye right)
  13497. @item sbs2l
  13498. side by side parallel with half width resolution
  13499. (left eye left, right eye right)
  13500. @item sbs2r
  13501. side by side crosseye with half width resolution
  13502. (right eye left, left eye right)
  13503. @item abl
  13504. @item tbl
  13505. above-below (left eye above, right eye below)
  13506. @item abr
  13507. @item tbr
  13508. above-below (right eye above, left eye below)
  13509. @item ab2l
  13510. @item tb2l
  13511. above-below with half height resolution
  13512. (left eye above, right eye below)
  13513. @item ab2r
  13514. @item tb2r
  13515. above-below with half height resolution
  13516. (right eye above, left eye below)
  13517. @item al
  13518. alternating frames (left eye first, right eye second)
  13519. @item ar
  13520. alternating frames (right eye first, left eye second)
  13521. @item irl
  13522. interleaved rows (left eye has top row, right eye starts on next row)
  13523. @item irr
  13524. interleaved rows (right eye has top row, left eye starts on next row)
  13525. @item arbg
  13526. anaglyph red/blue gray
  13527. (red filter on left eye, blue filter on right eye)
  13528. @item argg
  13529. anaglyph red/green gray
  13530. (red filter on left eye, green filter on right eye)
  13531. @item arcg
  13532. anaglyph red/cyan gray
  13533. (red filter on left eye, cyan filter on right eye)
  13534. @item arch
  13535. anaglyph red/cyan half colored
  13536. (red filter on left eye, cyan filter on right eye)
  13537. @item arcc
  13538. anaglyph red/cyan color
  13539. (red filter on left eye, cyan filter on right eye)
  13540. @item arcd
  13541. anaglyph red/cyan color optimized with the least squares projection of dubois
  13542. (red filter on left eye, cyan filter on right eye)
  13543. @item agmg
  13544. anaglyph green/magenta gray
  13545. (green filter on left eye, magenta filter on right eye)
  13546. @item agmh
  13547. anaglyph green/magenta half colored
  13548. (green filter on left eye, magenta filter on right eye)
  13549. @item agmc
  13550. anaglyph green/magenta colored
  13551. (green filter on left eye, magenta filter on right eye)
  13552. @item agmd
  13553. anaglyph green/magenta color optimized with the least squares projection of dubois
  13554. (green filter on left eye, magenta filter on right eye)
  13555. @item aybg
  13556. anaglyph yellow/blue gray
  13557. (yellow filter on left eye, blue filter on right eye)
  13558. @item aybh
  13559. anaglyph yellow/blue half colored
  13560. (yellow filter on left eye, blue filter on right eye)
  13561. @item aybc
  13562. anaglyph yellow/blue colored
  13563. (yellow filter on left eye, blue filter on right eye)
  13564. @item aybd
  13565. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13566. (yellow filter on left eye, blue filter on right eye)
  13567. @item ml
  13568. mono output (left eye only)
  13569. @item mr
  13570. mono output (right eye only)
  13571. @item chl
  13572. checkerboard, left eye first
  13573. @item chr
  13574. checkerboard, right eye first
  13575. @item icl
  13576. interleaved columns, left eye first
  13577. @item icr
  13578. interleaved columns, right eye first
  13579. @item hdmi
  13580. HDMI frame pack
  13581. @end table
  13582. Default value is @samp{arcd}.
  13583. @end table
  13584. @subsection Examples
  13585. @itemize
  13586. @item
  13587. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13588. @example
  13589. stereo3d=sbsl:aybd
  13590. @end example
  13591. @item
  13592. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13593. @example
  13594. stereo3d=abl:sbsr
  13595. @end example
  13596. @end itemize
  13597. @section streamselect, astreamselect
  13598. Select video or audio streams.
  13599. The filter accepts the following options:
  13600. @table @option
  13601. @item inputs
  13602. Set number of inputs. Default is 2.
  13603. @item map
  13604. Set input indexes to remap to outputs.
  13605. @end table
  13606. @subsection Commands
  13607. The @code{streamselect} and @code{astreamselect} filter supports the following
  13608. commands:
  13609. @table @option
  13610. @item map
  13611. Set input indexes to remap to outputs.
  13612. @end table
  13613. @subsection Examples
  13614. @itemize
  13615. @item
  13616. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13617. @example
  13618. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13619. @end example
  13620. @item
  13621. Same as above, but for audio:
  13622. @example
  13623. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13624. @end example
  13625. @end itemize
  13626. @anchor{subtitles}
  13627. @section subtitles
  13628. Draw subtitles on top of input video using the libass library.
  13629. To enable compilation of this filter you need to configure FFmpeg with
  13630. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13631. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13632. Alpha) subtitles format.
  13633. The filter accepts the following options:
  13634. @table @option
  13635. @item filename, f
  13636. Set the filename of the subtitle file to read. It must be specified.
  13637. @item original_size
  13638. Specify the size of the original video, the video for which the ASS file
  13639. was composed. For the syntax of this option, check the
  13640. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13641. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13642. correctly scale the fonts if the aspect ratio has been changed.
  13643. @item fontsdir
  13644. Set a directory path containing fonts that can be used by the filter.
  13645. These fonts will be used in addition to whatever the font provider uses.
  13646. @item alpha
  13647. Process alpha channel, by default alpha channel is untouched.
  13648. @item charenc
  13649. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13650. useful if not UTF-8.
  13651. @item stream_index, si
  13652. Set subtitles stream index. @code{subtitles} filter only.
  13653. @item force_style
  13654. Override default style or script info parameters of the subtitles. It accepts a
  13655. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13656. @end table
  13657. If the first key is not specified, it is assumed that the first value
  13658. specifies the @option{filename}.
  13659. For example, to render the file @file{sub.srt} on top of the input
  13660. video, use the command:
  13661. @example
  13662. subtitles=sub.srt
  13663. @end example
  13664. which is equivalent to:
  13665. @example
  13666. subtitles=filename=sub.srt
  13667. @end example
  13668. To render the default subtitles stream from file @file{video.mkv}, use:
  13669. @example
  13670. subtitles=video.mkv
  13671. @end example
  13672. To render the second subtitles stream from that file, use:
  13673. @example
  13674. subtitles=video.mkv:si=1
  13675. @end example
  13676. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13677. @code{DejaVu Serif}, use:
  13678. @example
  13679. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13680. @end example
  13681. @section super2xsai
  13682. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13683. Interpolate) pixel art scaling algorithm.
  13684. Useful for enlarging pixel art images without reducing sharpness.
  13685. @section swaprect
  13686. Swap two rectangular objects in video.
  13687. This filter accepts the following options:
  13688. @table @option
  13689. @item w
  13690. Set object width.
  13691. @item h
  13692. Set object height.
  13693. @item x1
  13694. Set 1st rect x coordinate.
  13695. @item y1
  13696. Set 1st rect y coordinate.
  13697. @item x2
  13698. Set 2nd rect x coordinate.
  13699. @item y2
  13700. Set 2nd rect y coordinate.
  13701. All expressions are evaluated once for each frame.
  13702. @end table
  13703. The all options are expressions containing the following constants:
  13704. @table @option
  13705. @item w
  13706. @item h
  13707. The input width and height.
  13708. @item a
  13709. same as @var{w} / @var{h}
  13710. @item sar
  13711. input sample aspect ratio
  13712. @item dar
  13713. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13714. @item n
  13715. The number of the input frame, starting from 0.
  13716. @item t
  13717. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13718. @item pos
  13719. the position in the file of the input frame, NAN if unknown
  13720. @end table
  13721. @section swapuv
  13722. Swap U & V plane.
  13723. @section tblend
  13724. Blend successive video frames.
  13725. See @ref{blend}
  13726. @section telecine
  13727. Apply telecine process to the video.
  13728. This filter accepts the following options:
  13729. @table @option
  13730. @item first_field
  13731. @table @samp
  13732. @item top, t
  13733. top field first
  13734. @item bottom, b
  13735. bottom field first
  13736. The default value is @code{top}.
  13737. @end table
  13738. @item pattern
  13739. A string of numbers representing the pulldown pattern you wish to apply.
  13740. The default value is @code{23}.
  13741. @end table
  13742. @example
  13743. Some typical patterns:
  13744. NTSC output (30i):
  13745. 27.5p: 32222
  13746. 24p: 23 (classic)
  13747. 24p: 2332 (preferred)
  13748. 20p: 33
  13749. 18p: 334
  13750. 16p: 3444
  13751. PAL output (25i):
  13752. 27.5p: 12222
  13753. 24p: 222222222223 ("Euro pulldown")
  13754. 16.67p: 33
  13755. 16p: 33333334
  13756. @end example
  13757. @section thistogram
  13758. Compute and draw a color distribution histogram for the input video across time.
  13759. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13760. at certain time, this filter shows also past histograms of number of frames defined
  13761. by @code{width} option.
  13762. The computed histogram is a representation of the color component
  13763. distribution in an image.
  13764. The filter accepts the following options:
  13765. @table @option
  13766. @item width, w
  13767. Set width of single color component output. Default value is @code{0}.
  13768. Value of @code{0} means width will be picked from input video.
  13769. This also set number of passed histograms to keep.
  13770. Allowed range is [0, 8192].
  13771. @item display_mode, d
  13772. Set display mode.
  13773. It accepts the following values:
  13774. @table @samp
  13775. @item stack
  13776. Per color component graphs are placed below each other.
  13777. @item parade
  13778. Per color component graphs are placed side by side.
  13779. @item overlay
  13780. Presents information identical to that in the @code{parade}, except
  13781. that the graphs representing color components are superimposed directly
  13782. over one another.
  13783. @end table
  13784. Default is @code{stack}.
  13785. @item levels_mode, m
  13786. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13787. Default is @code{linear}.
  13788. @item components, c
  13789. Set what color components to display.
  13790. Default is @code{7}.
  13791. @item bgopacity, b
  13792. Set background opacity. Default is @code{0.9}.
  13793. @item envelope, e
  13794. Show envelope. Default is disabled.
  13795. @item ecolor, ec
  13796. Set envelope color. Default is @code{gold}.
  13797. @end table
  13798. @section threshold
  13799. Apply threshold effect to video stream.
  13800. This filter needs four video streams to perform thresholding.
  13801. First stream is stream we are filtering.
  13802. Second stream is holding threshold values, third stream is holding min values,
  13803. and last, fourth stream is holding max values.
  13804. The filter accepts the following option:
  13805. @table @option
  13806. @item planes
  13807. Set which planes will be processed, unprocessed planes will be copied.
  13808. By default value 0xf, all planes will be processed.
  13809. @end table
  13810. For example if first stream pixel's component value is less then threshold value
  13811. of pixel component from 2nd threshold stream, third stream value will picked,
  13812. otherwise fourth stream pixel component value will be picked.
  13813. Using color source filter one can perform various types of thresholding:
  13814. @subsection Examples
  13815. @itemize
  13816. @item
  13817. Binary threshold, using gray color as threshold:
  13818. @example
  13819. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13820. @end example
  13821. @item
  13822. Inverted binary threshold, using gray color as threshold:
  13823. @example
  13824. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13825. @end example
  13826. @item
  13827. Truncate binary threshold, using gray color as threshold:
  13828. @example
  13829. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13830. @end example
  13831. @item
  13832. Threshold to zero, using gray color as threshold:
  13833. @example
  13834. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13835. @end example
  13836. @item
  13837. Inverted threshold to zero, using gray color as threshold:
  13838. @example
  13839. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13840. @end example
  13841. @end itemize
  13842. @section thumbnail
  13843. Select the most representative frame in a given sequence of consecutive frames.
  13844. The filter accepts the following options:
  13845. @table @option
  13846. @item n
  13847. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13848. will pick one of them, and then handle the next batch of @var{n} frames until
  13849. the end. Default is @code{100}.
  13850. @end table
  13851. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13852. value will result in a higher memory usage, so a high value is not recommended.
  13853. @subsection Examples
  13854. @itemize
  13855. @item
  13856. Extract one picture each 50 frames:
  13857. @example
  13858. thumbnail=50
  13859. @end example
  13860. @item
  13861. Complete example of a thumbnail creation with @command{ffmpeg}:
  13862. @example
  13863. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13864. @end example
  13865. @end itemize
  13866. @anchor{tile}
  13867. @section tile
  13868. Tile several successive frames together.
  13869. The @ref{untile} filter can do the reverse.
  13870. The filter accepts the following options:
  13871. @table @option
  13872. @item layout
  13873. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13874. this option, check the
  13875. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13876. @item nb_frames
  13877. Set the maximum number of frames to render in the given area. It must be less
  13878. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13879. the area will be used.
  13880. @item margin
  13881. Set the outer border margin in pixels.
  13882. @item padding
  13883. Set the inner border thickness (i.e. the number of pixels between frames). For
  13884. more advanced padding options (such as having different values for the edges),
  13885. refer to the pad video filter.
  13886. @item color
  13887. Specify the color of the unused area. For the syntax of this option, check the
  13888. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13889. The default value of @var{color} is "black".
  13890. @item overlap
  13891. Set the number of frames to overlap when tiling several successive frames together.
  13892. The value must be between @code{0} and @var{nb_frames - 1}.
  13893. @item init_padding
  13894. Set the number of frames to initially be empty before displaying first output frame.
  13895. This controls how soon will one get first output frame.
  13896. The value must be between @code{0} and @var{nb_frames - 1}.
  13897. @end table
  13898. @subsection Examples
  13899. @itemize
  13900. @item
  13901. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13902. @example
  13903. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13904. @end example
  13905. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13906. duplicating each output frame to accommodate the originally detected frame
  13907. rate.
  13908. @item
  13909. Display @code{5} pictures in an area of @code{3x2} frames,
  13910. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13911. mixed flat and named options:
  13912. @example
  13913. tile=3x2:nb_frames=5:padding=7:margin=2
  13914. @end example
  13915. @end itemize
  13916. @section tinterlace
  13917. Perform various types of temporal field interlacing.
  13918. Frames are counted starting from 1, so the first input frame is
  13919. considered odd.
  13920. The filter accepts the following options:
  13921. @table @option
  13922. @item mode
  13923. Specify the mode of the interlacing. This option can also be specified
  13924. as a value alone. See below for a list of values for this option.
  13925. Available values are:
  13926. @table @samp
  13927. @item merge, 0
  13928. Move odd frames into the upper field, even into the lower field,
  13929. generating a double height frame at half frame rate.
  13930. @example
  13931. ------> time
  13932. Input:
  13933. Frame 1 Frame 2 Frame 3 Frame 4
  13934. 11111 22222 33333 44444
  13935. 11111 22222 33333 44444
  13936. 11111 22222 33333 44444
  13937. 11111 22222 33333 44444
  13938. Output:
  13939. 11111 33333
  13940. 22222 44444
  13941. 11111 33333
  13942. 22222 44444
  13943. 11111 33333
  13944. 22222 44444
  13945. 11111 33333
  13946. 22222 44444
  13947. @end example
  13948. @item drop_even, 1
  13949. Only output odd frames, even frames are dropped, generating a frame with
  13950. unchanged height at half frame rate.
  13951. @example
  13952. ------> time
  13953. Input:
  13954. Frame 1 Frame 2 Frame 3 Frame 4
  13955. 11111 22222 33333 44444
  13956. 11111 22222 33333 44444
  13957. 11111 22222 33333 44444
  13958. 11111 22222 33333 44444
  13959. Output:
  13960. 11111 33333
  13961. 11111 33333
  13962. 11111 33333
  13963. 11111 33333
  13964. @end example
  13965. @item drop_odd, 2
  13966. Only output even frames, odd frames are dropped, generating a frame with
  13967. unchanged height at half frame rate.
  13968. @example
  13969. ------> time
  13970. Input:
  13971. Frame 1 Frame 2 Frame 3 Frame 4
  13972. 11111 22222 33333 44444
  13973. 11111 22222 33333 44444
  13974. 11111 22222 33333 44444
  13975. 11111 22222 33333 44444
  13976. Output:
  13977. 22222 44444
  13978. 22222 44444
  13979. 22222 44444
  13980. 22222 44444
  13981. @end example
  13982. @item pad, 3
  13983. Expand each frame to full height, but pad alternate lines with black,
  13984. generating a frame with double height at the same input frame rate.
  13985. @example
  13986. ------> time
  13987. Input:
  13988. Frame 1 Frame 2 Frame 3 Frame 4
  13989. 11111 22222 33333 44444
  13990. 11111 22222 33333 44444
  13991. 11111 22222 33333 44444
  13992. 11111 22222 33333 44444
  13993. Output:
  13994. 11111 ..... 33333 .....
  13995. ..... 22222 ..... 44444
  13996. 11111 ..... 33333 .....
  13997. ..... 22222 ..... 44444
  13998. 11111 ..... 33333 .....
  13999. ..... 22222 ..... 44444
  14000. 11111 ..... 33333 .....
  14001. ..... 22222 ..... 44444
  14002. @end example
  14003. @item interleave_top, 4
  14004. Interleave the upper field from odd frames with the lower field from
  14005. even frames, generating a frame with unchanged height at half frame rate.
  14006. @example
  14007. ------> time
  14008. Input:
  14009. Frame 1 Frame 2 Frame 3 Frame 4
  14010. 11111<- 22222 33333<- 44444
  14011. 11111 22222<- 33333 44444<-
  14012. 11111<- 22222 33333<- 44444
  14013. 11111 22222<- 33333 44444<-
  14014. Output:
  14015. 11111 33333
  14016. 22222 44444
  14017. 11111 33333
  14018. 22222 44444
  14019. @end example
  14020. @item interleave_bottom, 5
  14021. Interleave the lower field from odd frames with the upper field from
  14022. even frames, generating a frame with unchanged height at half frame rate.
  14023. @example
  14024. ------> time
  14025. Input:
  14026. Frame 1 Frame 2 Frame 3 Frame 4
  14027. 11111 22222<- 33333 44444<-
  14028. 11111<- 22222 33333<- 44444
  14029. 11111 22222<- 33333 44444<-
  14030. 11111<- 22222 33333<- 44444
  14031. Output:
  14032. 22222 44444
  14033. 11111 33333
  14034. 22222 44444
  14035. 11111 33333
  14036. @end example
  14037. @item interlacex2, 6
  14038. Double frame rate with unchanged height. Frames are inserted each
  14039. containing the second temporal field from the previous input frame and
  14040. the first temporal field from the next input frame. This mode relies on
  14041. the top_field_first flag. Useful for interlaced video displays with no
  14042. field synchronisation.
  14043. @example
  14044. ------> time
  14045. Input:
  14046. Frame 1 Frame 2 Frame 3 Frame 4
  14047. 11111 22222 33333 44444
  14048. 11111 22222 33333 44444
  14049. 11111 22222 33333 44444
  14050. 11111 22222 33333 44444
  14051. Output:
  14052. 11111 22222 22222 33333 33333 44444 44444
  14053. 11111 11111 22222 22222 33333 33333 44444
  14054. 11111 22222 22222 33333 33333 44444 44444
  14055. 11111 11111 22222 22222 33333 33333 44444
  14056. @end example
  14057. @item mergex2, 7
  14058. Move odd frames into the upper field, even into the lower field,
  14059. generating a double height frame at same frame rate.
  14060. @example
  14061. ------> time
  14062. Input:
  14063. Frame 1 Frame 2 Frame 3 Frame 4
  14064. 11111 22222 33333 44444
  14065. 11111 22222 33333 44444
  14066. 11111 22222 33333 44444
  14067. 11111 22222 33333 44444
  14068. Output:
  14069. 11111 33333 33333 55555
  14070. 22222 22222 44444 44444
  14071. 11111 33333 33333 55555
  14072. 22222 22222 44444 44444
  14073. 11111 33333 33333 55555
  14074. 22222 22222 44444 44444
  14075. 11111 33333 33333 55555
  14076. 22222 22222 44444 44444
  14077. @end example
  14078. @end table
  14079. Numeric values are deprecated but are accepted for backward
  14080. compatibility reasons.
  14081. Default mode is @code{merge}.
  14082. @item flags
  14083. Specify flags influencing the filter process.
  14084. Available value for @var{flags} is:
  14085. @table @option
  14086. @item low_pass_filter, vlpf
  14087. Enable linear vertical low-pass filtering in the filter.
  14088. Vertical low-pass filtering is required when creating an interlaced
  14089. destination from a progressive source which contains high-frequency
  14090. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14091. patterning.
  14092. @item complex_filter, cvlpf
  14093. Enable complex vertical low-pass filtering.
  14094. This will slightly less reduce interlace 'twitter' and Moire
  14095. patterning but better retain detail and subjective sharpness impression.
  14096. @item bypass_il
  14097. Bypass already interlaced frames, only adjust the frame rate.
  14098. @end table
  14099. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14100. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14101. @end table
  14102. @section tmedian
  14103. Pick median pixels from several successive input video frames.
  14104. The filter accepts the following options:
  14105. @table @option
  14106. @item radius
  14107. Set radius of median filter.
  14108. Default is 1. Allowed range is from 1 to 127.
  14109. @item planes
  14110. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14111. @item percentile
  14112. Set median percentile. Default value is @code{0.5}.
  14113. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14114. minimum values, and @code{1} maximum values.
  14115. @end table
  14116. @section tmix
  14117. Mix successive video frames.
  14118. A description of the accepted options follows.
  14119. @table @option
  14120. @item frames
  14121. The number of successive frames to mix. If unspecified, it defaults to 3.
  14122. @item weights
  14123. Specify weight of each input video frame.
  14124. Each weight is separated by space. If number of weights is smaller than
  14125. number of @var{frames} last specified weight will be used for all remaining
  14126. unset weights.
  14127. @item scale
  14128. Specify scale, if it is set it will be multiplied with sum
  14129. of each weight multiplied with pixel values to give final destination
  14130. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14131. @end table
  14132. @subsection Examples
  14133. @itemize
  14134. @item
  14135. Average 7 successive frames:
  14136. @example
  14137. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14138. @end example
  14139. @item
  14140. Apply simple temporal convolution:
  14141. @example
  14142. tmix=frames=3:weights="-1 3 -1"
  14143. @end example
  14144. @item
  14145. Similar as above but only showing temporal differences:
  14146. @example
  14147. tmix=frames=3:weights="-1 2 -1":scale=1
  14148. @end example
  14149. @end itemize
  14150. @anchor{tonemap}
  14151. @section tonemap
  14152. Tone map colors from different dynamic ranges.
  14153. This filter expects data in single precision floating point, as it needs to
  14154. operate on (and can output) out-of-range values. Another filter, such as
  14155. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14156. The tonemapping algorithms implemented only work on linear light, so input
  14157. data should be linearized beforehand (and possibly correctly tagged).
  14158. @example
  14159. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14160. @end example
  14161. @subsection Options
  14162. The filter accepts the following options.
  14163. @table @option
  14164. @item tonemap
  14165. Set the tone map algorithm to use.
  14166. Possible values are:
  14167. @table @var
  14168. @item none
  14169. Do not apply any tone map, only desaturate overbright pixels.
  14170. @item clip
  14171. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14172. in-range values, while distorting out-of-range values.
  14173. @item linear
  14174. Stretch the entire reference gamut to a linear multiple of the display.
  14175. @item gamma
  14176. Fit a logarithmic transfer between the tone curves.
  14177. @item reinhard
  14178. Preserve overall image brightness with a simple curve, using nonlinear
  14179. contrast, which results in flattening details and degrading color accuracy.
  14180. @item hable
  14181. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14182. of slightly darkening everything. Use it when detail preservation is more
  14183. important than color and brightness accuracy.
  14184. @item mobius
  14185. Smoothly map out-of-range values, while retaining contrast and colors for
  14186. in-range material as much as possible. Use it when color accuracy is more
  14187. important than detail preservation.
  14188. @end table
  14189. Default is none.
  14190. @item param
  14191. Tune the tone mapping algorithm.
  14192. This affects the following algorithms:
  14193. @table @var
  14194. @item none
  14195. Ignored.
  14196. @item linear
  14197. Specifies the scale factor to use while stretching.
  14198. Default to 1.0.
  14199. @item gamma
  14200. Specifies the exponent of the function.
  14201. Default to 1.8.
  14202. @item clip
  14203. Specify an extra linear coefficient to multiply into the signal before clipping.
  14204. Default to 1.0.
  14205. @item reinhard
  14206. Specify the local contrast coefficient at the display peak.
  14207. Default to 0.5, which means that in-gamut values will be about half as bright
  14208. as when clipping.
  14209. @item hable
  14210. Ignored.
  14211. @item mobius
  14212. Specify the transition point from linear to mobius transform. Every value
  14213. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14214. more accurate the result will be, at the cost of losing bright details.
  14215. Default to 0.3, which due to the steep initial slope still preserves in-range
  14216. colors fairly accurately.
  14217. @end table
  14218. @item desat
  14219. Apply desaturation for highlights that exceed this level of brightness. The
  14220. higher the parameter, the more color information will be preserved. This
  14221. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14222. (smoothly) turning into white instead. This makes images feel more natural,
  14223. at the cost of reducing information about out-of-range colors.
  14224. The default of 2.0 is somewhat conservative and will mostly just apply to
  14225. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14226. This option works only if the input frame has a supported color tag.
  14227. @item peak
  14228. Override signal/nominal/reference peak with this value. Useful when the
  14229. embedded peak information in display metadata is not reliable or when tone
  14230. mapping from a lower range to a higher range.
  14231. @end table
  14232. @section tpad
  14233. Temporarily pad video frames.
  14234. The filter accepts the following options:
  14235. @table @option
  14236. @item start
  14237. Specify number of delay frames before input video stream. Default is 0.
  14238. @item stop
  14239. Specify number of padding frames after input video stream.
  14240. Set to -1 to pad indefinitely. Default is 0.
  14241. @item start_mode
  14242. Set kind of frames added to beginning of stream.
  14243. Can be either @var{add} or @var{clone}.
  14244. With @var{add} frames of solid-color are added.
  14245. With @var{clone} frames are clones of first frame.
  14246. Default is @var{add}.
  14247. @item stop_mode
  14248. Set kind of frames added to end of stream.
  14249. Can be either @var{add} or @var{clone}.
  14250. With @var{add} frames of solid-color are added.
  14251. With @var{clone} frames are clones of last frame.
  14252. Default is @var{add}.
  14253. @item start_duration, stop_duration
  14254. Specify the duration of the start/stop delay. See
  14255. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14256. for the accepted syntax.
  14257. These options override @var{start} and @var{stop}. Default is 0.
  14258. @item color
  14259. Specify the color of the padded area. For the syntax of this option,
  14260. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14261. manual,ffmpeg-utils}.
  14262. The default value of @var{color} is "black".
  14263. @end table
  14264. @anchor{transpose}
  14265. @section transpose
  14266. Transpose rows with columns in the input video and optionally flip it.
  14267. It accepts the following parameters:
  14268. @table @option
  14269. @item dir
  14270. Specify the transposition direction.
  14271. Can assume the following values:
  14272. @table @samp
  14273. @item 0, 4, cclock_flip
  14274. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14275. @example
  14276. L.R L.l
  14277. . . -> . .
  14278. l.r R.r
  14279. @end example
  14280. @item 1, 5, clock
  14281. Rotate by 90 degrees clockwise, that is:
  14282. @example
  14283. L.R l.L
  14284. . . -> . .
  14285. l.r r.R
  14286. @end example
  14287. @item 2, 6, cclock
  14288. Rotate by 90 degrees counterclockwise, that is:
  14289. @example
  14290. L.R R.r
  14291. . . -> . .
  14292. l.r L.l
  14293. @end example
  14294. @item 3, 7, clock_flip
  14295. Rotate by 90 degrees clockwise and vertically flip, that is:
  14296. @example
  14297. L.R r.R
  14298. . . -> . .
  14299. l.r l.L
  14300. @end example
  14301. @end table
  14302. For values between 4-7, the transposition is only done if the input
  14303. video geometry is portrait and not landscape. These values are
  14304. deprecated, the @code{passthrough} option should be used instead.
  14305. Numerical values are deprecated, and should be dropped in favor of
  14306. symbolic constants.
  14307. @item passthrough
  14308. Do not apply the transposition if the input geometry matches the one
  14309. specified by the specified value. It accepts the following values:
  14310. @table @samp
  14311. @item none
  14312. Always apply transposition.
  14313. @item portrait
  14314. Preserve portrait geometry (when @var{height} >= @var{width}).
  14315. @item landscape
  14316. Preserve landscape geometry (when @var{width} >= @var{height}).
  14317. @end table
  14318. Default value is @code{none}.
  14319. @end table
  14320. For example to rotate by 90 degrees clockwise and preserve portrait
  14321. layout:
  14322. @example
  14323. transpose=dir=1:passthrough=portrait
  14324. @end example
  14325. The command above can also be specified as:
  14326. @example
  14327. transpose=1:portrait
  14328. @end example
  14329. @section transpose_npp
  14330. Transpose rows with columns in the input video and optionally flip it.
  14331. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14332. It accepts the following parameters:
  14333. @table @option
  14334. @item dir
  14335. Specify the transposition direction.
  14336. Can assume the following values:
  14337. @table @samp
  14338. @item cclock_flip
  14339. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14340. @item clock
  14341. Rotate by 90 degrees clockwise.
  14342. @item cclock
  14343. Rotate by 90 degrees counterclockwise.
  14344. @item clock_flip
  14345. Rotate by 90 degrees clockwise and vertically flip.
  14346. @end table
  14347. @item passthrough
  14348. Do not apply the transposition if the input geometry matches the one
  14349. specified by the specified value. It accepts the following values:
  14350. @table @samp
  14351. @item none
  14352. Always apply transposition. (default)
  14353. @item portrait
  14354. Preserve portrait geometry (when @var{height} >= @var{width}).
  14355. @item landscape
  14356. Preserve landscape geometry (when @var{width} >= @var{height}).
  14357. @end table
  14358. @end table
  14359. @section trim
  14360. Trim the input so that the output contains one continuous subpart of the input.
  14361. It accepts the following parameters:
  14362. @table @option
  14363. @item start
  14364. Specify the time of the start of the kept section, i.e. the frame with the
  14365. timestamp @var{start} will be the first frame in the output.
  14366. @item end
  14367. Specify the time of the first frame that will be dropped, i.e. the frame
  14368. immediately preceding the one with the timestamp @var{end} will be the last
  14369. frame in the output.
  14370. @item start_pts
  14371. This is the same as @var{start}, except this option sets the start timestamp
  14372. in timebase units instead of seconds.
  14373. @item end_pts
  14374. This is the same as @var{end}, except this option sets the end timestamp
  14375. in timebase units instead of seconds.
  14376. @item duration
  14377. The maximum duration of the output in seconds.
  14378. @item start_frame
  14379. The number of the first frame that should be passed to the output.
  14380. @item end_frame
  14381. The number of the first frame that should be dropped.
  14382. @end table
  14383. @option{start}, @option{end}, and @option{duration} are expressed as time
  14384. duration specifications; see
  14385. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14386. for the accepted syntax.
  14387. Note that the first two sets of the start/end options and the @option{duration}
  14388. option look at the frame timestamp, while the _frame variants simply count the
  14389. frames that pass through the filter. Also note that this filter does not modify
  14390. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14391. setpts filter after the trim filter.
  14392. If multiple start or end options are set, this filter tries to be greedy and
  14393. keep all the frames that match at least one of the specified constraints. To keep
  14394. only the part that matches all the constraints at once, chain multiple trim
  14395. filters.
  14396. The defaults are such that all the input is kept. So it is possible to set e.g.
  14397. just the end values to keep everything before the specified time.
  14398. Examples:
  14399. @itemize
  14400. @item
  14401. Drop everything except the second minute of input:
  14402. @example
  14403. ffmpeg -i INPUT -vf trim=60:120
  14404. @end example
  14405. @item
  14406. Keep only the first second:
  14407. @example
  14408. ffmpeg -i INPUT -vf trim=duration=1
  14409. @end example
  14410. @end itemize
  14411. @section unpremultiply
  14412. Apply alpha unpremultiply effect to input video stream using first plane
  14413. of second stream as alpha.
  14414. Both streams must have same dimensions and same pixel format.
  14415. The filter accepts the following option:
  14416. @table @option
  14417. @item planes
  14418. Set which planes will be processed, unprocessed planes will be copied.
  14419. By default value 0xf, all planes will be processed.
  14420. If the format has 1 or 2 components, then luma is bit 0.
  14421. If the format has 3 or 4 components:
  14422. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14423. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14424. If present, the alpha channel is always the last bit.
  14425. @item inplace
  14426. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14427. @end table
  14428. @anchor{unsharp}
  14429. @section unsharp
  14430. Sharpen or blur the input video.
  14431. It accepts the following parameters:
  14432. @table @option
  14433. @item luma_msize_x, lx
  14434. Set the luma matrix horizontal size. It must be an odd integer between
  14435. 3 and 23. The default value is 5.
  14436. @item luma_msize_y, ly
  14437. Set the luma matrix vertical size. It must be an odd integer between 3
  14438. and 23. The default value is 5.
  14439. @item luma_amount, la
  14440. Set the luma effect strength. It must be a floating point number, reasonable
  14441. values lay between -1.5 and 1.5.
  14442. Negative values will blur the input video, while positive values will
  14443. sharpen it, a value of zero will disable the effect.
  14444. Default value is 1.0.
  14445. @item chroma_msize_x, cx
  14446. Set the chroma matrix horizontal size. It must be an odd integer
  14447. between 3 and 23. The default value is 5.
  14448. @item chroma_msize_y, cy
  14449. Set the chroma matrix vertical size. It must be an odd integer
  14450. between 3 and 23. The default value is 5.
  14451. @item chroma_amount, ca
  14452. Set the chroma effect strength. It must be a floating point number, reasonable
  14453. values lay between -1.5 and 1.5.
  14454. Negative values will blur the input video, while positive values will
  14455. sharpen it, a value of zero will disable the effect.
  14456. Default value is 0.0.
  14457. @end table
  14458. All parameters are optional and default to the equivalent of the
  14459. string '5:5:1.0:5:5:0.0'.
  14460. @subsection Examples
  14461. @itemize
  14462. @item
  14463. Apply strong luma sharpen effect:
  14464. @example
  14465. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14466. @end example
  14467. @item
  14468. Apply a strong blur of both luma and chroma parameters:
  14469. @example
  14470. unsharp=7:7:-2:7:7:-2
  14471. @end example
  14472. @end itemize
  14473. @anchor{untile}
  14474. @section untile
  14475. Decompose a video made of tiled images into the individual images.
  14476. The frame rate of the output video is the frame rate of the input video
  14477. multiplied by the number of tiles.
  14478. This filter does the reverse of @ref{tile}.
  14479. The filter accepts the following options:
  14480. @table @option
  14481. @item layout
  14482. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14483. this option, check the
  14484. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14485. @end table
  14486. @subsection Examples
  14487. @itemize
  14488. @item
  14489. Produce a 1-second video from a still image file made of 25 frames stacked
  14490. vertically, like an analogic film reel:
  14491. @example
  14492. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14493. @end example
  14494. @end itemize
  14495. @section uspp
  14496. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14497. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14498. shifts and average the results.
  14499. The way this differs from the behavior of spp is that uspp actually encodes &
  14500. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14501. DCT similar to MJPEG.
  14502. The filter accepts the following options:
  14503. @table @option
  14504. @item quality
  14505. Set quality. This option defines the number of levels for averaging. It accepts
  14506. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14507. effect. A value of @code{8} means the higher quality. For each increment of
  14508. that value the speed drops by a factor of approximately 2. Default value is
  14509. @code{3}.
  14510. @item qp
  14511. Force a constant quantization parameter. If not set, the filter will use the QP
  14512. from the video stream (if available).
  14513. @end table
  14514. @section v360
  14515. Convert 360 videos between various formats.
  14516. The filter accepts the following options:
  14517. @table @option
  14518. @item input
  14519. @item output
  14520. Set format of the input/output video.
  14521. Available formats:
  14522. @table @samp
  14523. @item e
  14524. @item equirect
  14525. Equirectangular projection.
  14526. @item c3x2
  14527. @item c6x1
  14528. @item c1x6
  14529. Cubemap with 3x2/6x1/1x6 layout.
  14530. Format specific options:
  14531. @table @option
  14532. @item in_pad
  14533. @item out_pad
  14534. Set padding proportion for the input/output cubemap. Values in decimals.
  14535. Example values:
  14536. @table @samp
  14537. @item 0
  14538. No padding.
  14539. @item 0.01
  14540. 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)
  14541. @end table
  14542. Default value is @b{@samp{0}}.
  14543. Maximum value is @b{@samp{0.1}}.
  14544. @item fin_pad
  14545. @item fout_pad
  14546. Set fixed padding for the input/output cubemap. Values in pixels.
  14547. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14548. @item in_forder
  14549. @item out_forder
  14550. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14551. Designation of directions:
  14552. @table @samp
  14553. @item r
  14554. right
  14555. @item l
  14556. left
  14557. @item u
  14558. up
  14559. @item d
  14560. down
  14561. @item f
  14562. forward
  14563. @item b
  14564. back
  14565. @end table
  14566. Default value is @b{@samp{rludfb}}.
  14567. @item in_frot
  14568. @item out_frot
  14569. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14570. Designation of angles:
  14571. @table @samp
  14572. @item 0
  14573. 0 degrees clockwise
  14574. @item 1
  14575. 90 degrees clockwise
  14576. @item 2
  14577. 180 degrees clockwise
  14578. @item 3
  14579. 270 degrees clockwise
  14580. @end table
  14581. Default value is @b{@samp{000000}}.
  14582. @end table
  14583. @item eac
  14584. Equi-Angular Cubemap.
  14585. @item flat
  14586. @item gnomonic
  14587. @item rectilinear
  14588. Regular video.
  14589. Format specific options:
  14590. @table @option
  14591. @item h_fov
  14592. @item v_fov
  14593. @item d_fov
  14594. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14595. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14596. @item ih_fov
  14597. @item iv_fov
  14598. @item id_fov
  14599. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14600. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14601. @end table
  14602. @item dfisheye
  14603. Dual fisheye.
  14604. Format specific options:
  14605. @table @option
  14606. @item h_fov
  14607. @item v_fov
  14608. @item d_fov
  14609. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14610. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14611. @item ih_fov
  14612. @item iv_fov
  14613. @item id_fov
  14614. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14615. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14616. @end table
  14617. @item barrel
  14618. @item fb
  14619. @item barrelsplit
  14620. Facebook's 360 formats.
  14621. @item sg
  14622. Stereographic format.
  14623. Format specific options:
  14624. @table @option
  14625. @item h_fov
  14626. @item v_fov
  14627. @item d_fov
  14628. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14629. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14630. @item ih_fov
  14631. @item iv_fov
  14632. @item id_fov
  14633. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14634. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14635. @end table
  14636. @item mercator
  14637. Mercator format.
  14638. @item ball
  14639. Ball format, gives significant distortion toward the back.
  14640. @item hammer
  14641. Hammer-Aitoff map projection format.
  14642. @item sinusoidal
  14643. Sinusoidal map projection format.
  14644. @item fisheye
  14645. Fisheye projection.
  14646. Format specific options:
  14647. @table @option
  14648. @item h_fov
  14649. @item v_fov
  14650. @item d_fov
  14651. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14652. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14653. @item ih_fov
  14654. @item iv_fov
  14655. @item id_fov
  14656. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14657. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14658. @end table
  14659. @item pannini
  14660. Pannini projection.
  14661. Format specific options:
  14662. @table @option
  14663. @item h_fov
  14664. Set output pannini parameter.
  14665. @item ih_fov
  14666. Set input pannini parameter.
  14667. @end table
  14668. @item cylindrical
  14669. Cylindrical projection.
  14670. Format specific options:
  14671. @table @option
  14672. @item h_fov
  14673. @item v_fov
  14674. @item d_fov
  14675. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14676. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14677. @item ih_fov
  14678. @item iv_fov
  14679. @item id_fov
  14680. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14681. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14682. @end table
  14683. @item perspective
  14684. Perspective projection. @i{(output only)}
  14685. Format specific options:
  14686. @table @option
  14687. @item v_fov
  14688. Set perspective parameter.
  14689. @end table
  14690. @item tetrahedron
  14691. Tetrahedron projection.
  14692. @item tsp
  14693. Truncated square pyramid projection.
  14694. @item he
  14695. @item hequirect
  14696. Half equirectangular projection.
  14697. @end table
  14698. @item interp
  14699. Set interpolation method.@*
  14700. @i{Note: more complex interpolation methods require much more memory to run.}
  14701. Available methods:
  14702. @table @samp
  14703. @item near
  14704. @item nearest
  14705. Nearest neighbour.
  14706. @item line
  14707. @item linear
  14708. Bilinear interpolation.
  14709. @item lagrange9
  14710. Lagrange9 interpolation.
  14711. @item cube
  14712. @item cubic
  14713. Bicubic interpolation.
  14714. @item lanc
  14715. @item lanczos
  14716. Lanczos interpolation.
  14717. @item sp16
  14718. @item spline16
  14719. Spline16 interpolation.
  14720. @item gauss
  14721. @item gaussian
  14722. Gaussian interpolation.
  14723. @end table
  14724. Default value is @b{@samp{line}}.
  14725. @item w
  14726. @item h
  14727. Set the output video resolution.
  14728. Default resolution depends on formats.
  14729. @item in_stereo
  14730. @item out_stereo
  14731. Set the input/output stereo format.
  14732. @table @samp
  14733. @item 2d
  14734. 2D mono
  14735. @item sbs
  14736. Side by side
  14737. @item tb
  14738. Top bottom
  14739. @end table
  14740. Default value is @b{@samp{2d}} for input and output format.
  14741. @item yaw
  14742. @item pitch
  14743. @item roll
  14744. Set rotation for the output video. Values in degrees.
  14745. @item rorder
  14746. Set rotation order for the output video. Choose one item for each position.
  14747. @table @samp
  14748. @item y, Y
  14749. yaw
  14750. @item p, P
  14751. pitch
  14752. @item r, R
  14753. roll
  14754. @end table
  14755. Default value is @b{@samp{ypr}}.
  14756. @item h_flip
  14757. @item v_flip
  14758. @item d_flip
  14759. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14760. @item ih_flip
  14761. @item iv_flip
  14762. Set if input video is flipped horizontally/vertically. Boolean values.
  14763. @item in_trans
  14764. Set if input video is transposed. Boolean value, by default disabled.
  14765. @item out_trans
  14766. Set if output video needs to be transposed. Boolean value, by default disabled.
  14767. @item alpha_mask
  14768. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  14769. @end table
  14770. @subsection Examples
  14771. @itemize
  14772. @item
  14773. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14774. @example
  14775. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14776. @end example
  14777. @item
  14778. Extract back view of Equi-Angular Cubemap:
  14779. @example
  14780. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14781. @end example
  14782. @item
  14783. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14784. @example
  14785. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14786. @end example
  14787. @end itemize
  14788. @subsection Commands
  14789. This filter supports subset of above options as @ref{commands}.
  14790. @section vaguedenoiser
  14791. Apply a wavelet based denoiser.
  14792. It transforms each frame from the video input into the wavelet domain,
  14793. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14794. the obtained coefficients. It does an inverse wavelet transform after.
  14795. Due to wavelet properties, it should give a nice smoothed result, and
  14796. reduced noise, without blurring picture features.
  14797. This filter accepts the following options:
  14798. @table @option
  14799. @item threshold
  14800. The filtering strength. The higher, the more filtered the video will be.
  14801. Hard thresholding can use a higher threshold than soft thresholding
  14802. before the video looks overfiltered. Default value is 2.
  14803. @item method
  14804. The filtering method the filter will use.
  14805. It accepts the following values:
  14806. @table @samp
  14807. @item hard
  14808. All values under the threshold will be zeroed.
  14809. @item soft
  14810. All values under the threshold will be zeroed. All values above will be
  14811. reduced by the threshold.
  14812. @item garrote
  14813. Scales or nullifies coefficients - intermediary between (more) soft and
  14814. (less) hard thresholding.
  14815. @end table
  14816. Default is garrote.
  14817. @item nsteps
  14818. Number of times, the wavelet will decompose the picture. Picture can't
  14819. be decomposed beyond a particular point (typically, 8 for a 640x480
  14820. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14821. @item percent
  14822. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14823. @item planes
  14824. A list of the planes to process. By default all planes are processed.
  14825. @item type
  14826. The threshold type the filter will use.
  14827. It accepts the following values:
  14828. @table @samp
  14829. @item universal
  14830. Threshold used is same for all decompositions.
  14831. @item bayes
  14832. Threshold used depends also on each decomposition coefficients.
  14833. @end table
  14834. Default is universal.
  14835. @end table
  14836. @section vectorscope
  14837. Display 2 color component values in the two dimensional graph (which is called
  14838. a vectorscope).
  14839. This filter accepts the following options:
  14840. @table @option
  14841. @item mode, m
  14842. Set vectorscope mode.
  14843. It accepts the following values:
  14844. @table @samp
  14845. @item gray
  14846. @item tint
  14847. Gray values are displayed on graph, higher brightness means more pixels have
  14848. same component color value on location in graph. This is the default mode.
  14849. @item color
  14850. Gray values are displayed on graph. Surrounding pixels values which are not
  14851. present in video frame are drawn in gradient of 2 color components which are
  14852. set by option @code{x} and @code{y}. The 3rd color component is static.
  14853. @item color2
  14854. Actual color components values present in video frame are displayed on graph.
  14855. @item color3
  14856. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14857. on graph increases value of another color component, which is luminance by
  14858. default values of @code{x} and @code{y}.
  14859. @item color4
  14860. Actual colors present in video frame are displayed on graph. If two different
  14861. colors map to same position on graph then color with higher value of component
  14862. not present in graph is picked.
  14863. @item color5
  14864. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14865. component picked from radial gradient.
  14866. @end table
  14867. @item x
  14868. Set which color component will be represented on X-axis. Default is @code{1}.
  14869. @item y
  14870. Set which color component will be represented on Y-axis. Default is @code{2}.
  14871. @item intensity, i
  14872. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14873. of color component which represents frequency of (X, Y) location in graph.
  14874. @item envelope, e
  14875. @table @samp
  14876. @item none
  14877. No envelope, this is default.
  14878. @item instant
  14879. Instant envelope, even darkest single pixel will be clearly highlighted.
  14880. @item peak
  14881. Hold maximum and minimum values presented in graph over time. This way you
  14882. can still spot out of range values without constantly looking at vectorscope.
  14883. @item peak+instant
  14884. Peak and instant envelope combined together.
  14885. @end table
  14886. @item graticule, g
  14887. Set what kind of graticule to draw.
  14888. @table @samp
  14889. @item none
  14890. @item green
  14891. @item color
  14892. @item invert
  14893. @end table
  14894. @item opacity, o
  14895. Set graticule opacity.
  14896. @item flags, f
  14897. Set graticule flags.
  14898. @table @samp
  14899. @item white
  14900. Draw graticule for white point.
  14901. @item black
  14902. Draw graticule for black point.
  14903. @item name
  14904. Draw color points short names.
  14905. @end table
  14906. @item bgopacity, b
  14907. Set background opacity.
  14908. @item lthreshold, l
  14909. Set low threshold for color component not represented on X or Y axis.
  14910. Values lower than this value will be ignored. Default is 0.
  14911. Note this value is multiplied with actual max possible value one pixel component
  14912. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14913. is 0.1 * 255 = 25.
  14914. @item hthreshold, h
  14915. Set high threshold for color component not represented on X or Y axis.
  14916. Values higher than this value will be ignored. Default is 1.
  14917. Note this value is multiplied with actual max possible value one pixel component
  14918. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14919. is 0.9 * 255 = 230.
  14920. @item colorspace, c
  14921. Set what kind of colorspace to use when drawing graticule.
  14922. @table @samp
  14923. @item auto
  14924. @item 601
  14925. @item 709
  14926. @end table
  14927. Default is auto.
  14928. @item tint0, t0
  14929. @item tint1, t1
  14930. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  14931. This means no tint, and output will remain gray.
  14932. @end table
  14933. @anchor{vidstabdetect}
  14934. @section vidstabdetect
  14935. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14936. @ref{vidstabtransform} for pass 2.
  14937. This filter generates a file with relative translation and rotation
  14938. transform information about subsequent frames, which is then used by
  14939. the @ref{vidstabtransform} filter.
  14940. To enable compilation of this filter you need to configure FFmpeg with
  14941. @code{--enable-libvidstab}.
  14942. This filter accepts the following options:
  14943. @table @option
  14944. @item result
  14945. Set the path to the file used to write the transforms information.
  14946. Default value is @file{transforms.trf}.
  14947. @item shakiness
  14948. Set how shaky the video is and how quick the camera is. It accepts an
  14949. integer in the range 1-10, a value of 1 means little shakiness, a
  14950. value of 10 means strong shakiness. Default value is 5.
  14951. @item accuracy
  14952. Set the accuracy of the detection process. It must be a value in the
  14953. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14954. accuracy. Default value is 15.
  14955. @item stepsize
  14956. Set stepsize of the search process. The region around minimum is
  14957. scanned with 1 pixel resolution. Default value is 6.
  14958. @item mincontrast
  14959. Set minimum contrast. Below this value a local measurement field is
  14960. discarded. Must be a floating point value in the range 0-1. Default
  14961. value is 0.3.
  14962. @item tripod
  14963. Set reference frame number for tripod mode.
  14964. If enabled, the motion of the frames is compared to a reference frame
  14965. in the filtered stream, identified by the specified number. The idea
  14966. is to compensate all movements in a more-or-less static scene and keep
  14967. the camera view absolutely still.
  14968. If set to 0, it is disabled. The frames are counted starting from 1.
  14969. @item show
  14970. Show fields and transforms in the resulting frames. It accepts an
  14971. integer in the range 0-2. Default value is 0, which disables any
  14972. visualization.
  14973. @end table
  14974. @subsection Examples
  14975. @itemize
  14976. @item
  14977. Use default values:
  14978. @example
  14979. vidstabdetect
  14980. @end example
  14981. @item
  14982. Analyze strongly shaky movie and put the results in file
  14983. @file{mytransforms.trf}:
  14984. @example
  14985. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14986. @end example
  14987. @item
  14988. Visualize the result of internal transformations in the resulting
  14989. video:
  14990. @example
  14991. vidstabdetect=show=1
  14992. @end example
  14993. @item
  14994. Analyze a video with medium shakiness using @command{ffmpeg}:
  14995. @example
  14996. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14997. @end example
  14998. @end itemize
  14999. @anchor{vidstabtransform}
  15000. @section vidstabtransform
  15001. Video stabilization/deshaking: pass 2 of 2,
  15002. see @ref{vidstabdetect} for pass 1.
  15003. Read a file with transform information for each frame and
  15004. apply/compensate them. Together with the @ref{vidstabdetect}
  15005. filter this can be used to deshake videos. See also
  15006. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15007. the @ref{unsharp} filter, see below.
  15008. To enable compilation of this filter you need to configure FFmpeg with
  15009. @code{--enable-libvidstab}.
  15010. @subsection Options
  15011. @table @option
  15012. @item input
  15013. Set path to the file used to read the transforms. Default value is
  15014. @file{transforms.trf}.
  15015. @item smoothing
  15016. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15017. camera movements. Default value is 10.
  15018. For example a number of 10 means that 21 frames are used (10 in the
  15019. past and 10 in the future) to smoothen the motion in the video. A
  15020. larger value leads to a smoother video, but limits the acceleration of
  15021. the camera (pan/tilt movements). 0 is a special case where a static
  15022. camera is simulated.
  15023. @item optalgo
  15024. Set the camera path optimization algorithm.
  15025. Accepted values are:
  15026. @table @samp
  15027. @item gauss
  15028. gaussian kernel low-pass filter on camera motion (default)
  15029. @item avg
  15030. averaging on transformations
  15031. @end table
  15032. @item maxshift
  15033. Set maximal number of pixels to translate frames. Default value is -1,
  15034. meaning no limit.
  15035. @item maxangle
  15036. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15037. value is -1, meaning no limit.
  15038. @item crop
  15039. Specify how to deal with borders that may be visible due to movement
  15040. compensation.
  15041. Available values are:
  15042. @table @samp
  15043. @item keep
  15044. keep image information from previous frame (default)
  15045. @item black
  15046. fill the border black
  15047. @end table
  15048. @item invert
  15049. Invert transforms if set to 1. Default value is 0.
  15050. @item relative
  15051. Consider transforms as relative to previous frame if set to 1,
  15052. absolute if set to 0. Default value is 0.
  15053. @item zoom
  15054. Set percentage to zoom. A positive value will result in a zoom-in
  15055. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15056. zoom).
  15057. @item optzoom
  15058. Set optimal zooming to avoid borders.
  15059. Accepted values are:
  15060. @table @samp
  15061. @item 0
  15062. disabled
  15063. @item 1
  15064. optimal static zoom value is determined (only very strong movements
  15065. will lead to visible borders) (default)
  15066. @item 2
  15067. optimal adaptive zoom value is determined (no borders will be
  15068. visible), see @option{zoomspeed}
  15069. @end table
  15070. Note that the value given at zoom is added to the one calculated here.
  15071. @item zoomspeed
  15072. Set percent to zoom maximally each frame (enabled when
  15073. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15074. 0.25.
  15075. @item interpol
  15076. Specify type of interpolation.
  15077. Available values are:
  15078. @table @samp
  15079. @item no
  15080. no interpolation
  15081. @item linear
  15082. linear only horizontal
  15083. @item bilinear
  15084. linear in both directions (default)
  15085. @item bicubic
  15086. cubic in both directions (slow)
  15087. @end table
  15088. @item tripod
  15089. Enable virtual tripod mode if set to 1, which is equivalent to
  15090. @code{relative=0:smoothing=0}. Default value is 0.
  15091. Use also @code{tripod} option of @ref{vidstabdetect}.
  15092. @item debug
  15093. Increase log verbosity if set to 1. Also the detected global motions
  15094. are written to the temporary file @file{global_motions.trf}. Default
  15095. value is 0.
  15096. @end table
  15097. @subsection Examples
  15098. @itemize
  15099. @item
  15100. Use @command{ffmpeg} for a typical stabilization with default values:
  15101. @example
  15102. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15103. @end example
  15104. Note the use of the @ref{unsharp} filter which is always recommended.
  15105. @item
  15106. Zoom in a bit more and load transform data from a given file:
  15107. @example
  15108. vidstabtransform=zoom=5:input="mytransforms.trf"
  15109. @end example
  15110. @item
  15111. Smoothen the video even more:
  15112. @example
  15113. vidstabtransform=smoothing=30
  15114. @end example
  15115. @end itemize
  15116. @section vflip
  15117. Flip the input video vertically.
  15118. For example, to vertically flip a video with @command{ffmpeg}:
  15119. @example
  15120. ffmpeg -i in.avi -vf "vflip" out.avi
  15121. @end example
  15122. @section vfrdet
  15123. Detect variable frame rate video.
  15124. This filter tries to detect if the input is variable or constant frame rate.
  15125. At end it will output number of frames detected as having variable delta pts,
  15126. and ones with constant delta pts.
  15127. If there was frames with variable delta, than it will also show min, max and
  15128. average delta encountered.
  15129. @section vibrance
  15130. Boost or alter saturation.
  15131. The filter accepts the following options:
  15132. @table @option
  15133. @item intensity
  15134. Set strength of boost if positive value or strength of alter if negative value.
  15135. Default is 0. Allowed range is from -2 to 2.
  15136. @item rbal
  15137. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15138. @item gbal
  15139. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15140. @item bbal
  15141. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15142. @item rlum
  15143. Set the red luma coefficient.
  15144. @item glum
  15145. Set the green luma coefficient.
  15146. @item blum
  15147. Set the blue luma coefficient.
  15148. @item alternate
  15149. If @code{intensity} is negative and this is set to 1, colors will change,
  15150. otherwise colors will be less saturated, more towards gray.
  15151. @end table
  15152. @subsection Commands
  15153. This filter supports the all above options as @ref{commands}.
  15154. @anchor{vignette}
  15155. @section vignette
  15156. Make or reverse a natural vignetting effect.
  15157. The filter accepts the following options:
  15158. @table @option
  15159. @item angle, a
  15160. Set lens angle expression as a number of radians.
  15161. The value is clipped in the @code{[0,PI/2]} range.
  15162. Default value: @code{"PI/5"}
  15163. @item x0
  15164. @item y0
  15165. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15166. by default.
  15167. @item mode
  15168. Set forward/backward mode.
  15169. Available modes are:
  15170. @table @samp
  15171. @item forward
  15172. The larger the distance from the central point, the darker the image becomes.
  15173. @item backward
  15174. The larger the distance from the central point, the brighter the image becomes.
  15175. This can be used to reverse a vignette effect, though there is no automatic
  15176. detection to extract the lens @option{angle} and other settings (yet). It can
  15177. also be used to create a burning effect.
  15178. @end table
  15179. Default value is @samp{forward}.
  15180. @item eval
  15181. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15182. It accepts the following values:
  15183. @table @samp
  15184. @item init
  15185. Evaluate expressions only once during the filter initialization.
  15186. @item frame
  15187. Evaluate expressions for each incoming frame. This is way slower than the
  15188. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15189. allows advanced dynamic expressions.
  15190. @end table
  15191. Default value is @samp{init}.
  15192. @item dither
  15193. Set dithering to reduce the circular banding effects. Default is @code{1}
  15194. (enabled).
  15195. @item aspect
  15196. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15197. Setting this value to the SAR of the input will make a rectangular vignetting
  15198. following the dimensions of the video.
  15199. Default is @code{1/1}.
  15200. @end table
  15201. @subsection Expressions
  15202. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15203. following parameters.
  15204. @table @option
  15205. @item w
  15206. @item h
  15207. input width and height
  15208. @item n
  15209. the number of input frame, starting from 0
  15210. @item pts
  15211. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15212. @var{TB} units, NAN if undefined
  15213. @item r
  15214. frame rate of the input video, NAN if the input frame rate is unknown
  15215. @item t
  15216. the PTS (Presentation TimeStamp) of the filtered video frame,
  15217. expressed in seconds, NAN if undefined
  15218. @item tb
  15219. time base of the input video
  15220. @end table
  15221. @subsection Examples
  15222. @itemize
  15223. @item
  15224. Apply simple strong vignetting effect:
  15225. @example
  15226. vignette=PI/4
  15227. @end example
  15228. @item
  15229. Make a flickering vignetting:
  15230. @example
  15231. vignette='PI/4+random(1)*PI/50':eval=frame
  15232. @end example
  15233. @end itemize
  15234. @section vmafmotion
  15235. Obtain the average VMAF motion score of a video.
  15236. It is one of the component metrics of VMAF.
  15237. The obtained average motion score is printed through the logging system.
  15238. The filter accepts the following options:
  15239. @table @option
  15240. @item stats_file
  15241. If specified, the filter will use the named file to save the motion score of
  15242. each frame with respect to the previous frame.
  15243. When filename equals "-" the data is sent to standard output.
  15244. @end table
  15245. Example:
  15246. @example
  15247. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15248. @end example
  15249. @section vstack
  15250. Stack input videos vertically.
  15251. All streams must be of same pixel format and of same width.
  15252. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15253. to create same output.
  15254. The filter accepts the following options:
  15255. @table @option
  15256. @item inputs
  15257. Set number of input streams. Default is 2.
  15258. @item shortest
  15259. If set to 1, force the output to terminate when the shortest input
  15260. terminates. Default value is 0.
  15261. @end table
  15262. @section w3fdif
  15263. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15264. Deinterlacing Filter").
  15265. Based on the process described by Martin Weston for BBC R&D, and
  15266. implemented based on the de-interlace algorithm written by Jim
  15267. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15268. uses filter coefficients calculated by BBC R&D.
  15269. This filter uses field-dominance information in frame to decide which
  15270. of each pair of fields to place first in the output.
  15271. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15272. There are two sets of filter coefficients, so called "simple"
  15273. and "complex". Which set of filter coefficients is used can
  15274. be set by passing an optional parameter:
  15275. @table @option
  15276. @item filter
  15277. Set the interlacing filter coefficients. Accepts one of the following values:
  15278. @table @samp
  15279. @item simple
  15280. Simple filter coefficient set.
  15281. @item complex
  15282. More-complex filter coefficient set.
  15283. @end table
  15284. Default value is @samp{complex}.
  15285. @item deint
  15286. Specify which frames to deinterlace. Accepts one of the following values:
  15287. @table @samp
  15288. @item all
  15289. Deinterlace all frames,
  15290. @item interlaced
  15291. Only deinterlace frames marked as interlaced.
  15292. @end table
  15293. Default value is @samp{all}.
  15294. @end table
  15295. @section waveform
  15296. Video waveform monitor.
  15297. The waveform monitor plots color component intensity. By default luminance
  15298. only. Each column of the waveform corresponds to a column of pixels in the
  15299. source video.
  15300. It accepts the following options:
  15301. @table @option
  15302. @item mode, m
  15303. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15304. In row mode, the graph on the left side represents color component value 0 and
  15305. the right side represents value = 255. In column mode, the top side represents
  15306. color component value = 0 and bottom side represents value = 255.
  15307. @item intensity, i
  15308. Set intensity. Smaller values are useful to find out how many values of the same
  15309. luminance are distributed across input rows/columns.
  15310. Default value is @code{0.04}. Allowed range is [0, 1].
  15311. @item mirror, r
  15312. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15313. In mirrored mode, higher values will be represented on the left
  15314. side for @code{row} mode and at the top for @code{column} mode. Default is
  15315. @code{1} (mirrored).
  15316. @item display, d
  15317. Set display mode.
  15318. It accepts the following values:
  15319. @table @samp
  15320. @item overlay
  15321. Presents information identical to that in the @code{parade}, except
  15322. that the graphs representing color components are superimposed directly
  15323. over one another.
  15324. This display mode makes it easier to spot relative differences or similarities
  15325. in overlapping areas of the color components that are supposed to be identical,
  15326. such as neutral whites, grays, or blacks.
  15327. @item stack
  15328. Display separate graph for the color components side by side in
  15329. @code{row} mode or one below the other in @code{column} mode.
  15330. @item parade
  15331. Display separate graph for the color components side by side in
  15332. @code{column} mode or one below the other in @code{row} mode.
  15333. Using this display mode makes it easy to spot color casts in the highlights
  15334. and shadows of an image, by comparing the contours of the top and the bottom
  15335. graphs of each waveform. Since whites, grays, and blacks are characterized
  15336. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15337. should display three waveforms of roughly equal width/height. If not, the
  15338. correction is easy to perform by making level adjustments the three waveforms.
  15339. @end table
  15340. Default is @code{stack}.
  15341. @item components, c
  15342. Set which color components to display. Default is 1, which means only luminance
  15343. or red color component if input is in RGB colorspace. If is set for example to
  15344. 7 it will display all 3 (if) available color components.
  15345. @item envelope, e
  15346. @table @samp
  15347. @item none
  15348. No envelope, this is default.
  15349. @item instant
  15350. Instant envelope, minimum and maximum values presented in graph will be easily
  15351. visible even with small @code{step} value.
  15352. @item peak
  15353. Hold minimum and maximum values presented in graph across time. This way you
  15354. can still spot out of range values without constantly looking at waveforms.
  15355. @item peak+instant
  15356. Peak and instant envelope combined together.
  15357. @end table
  15358. @item filter, f
  15359. @table @samp
  15360. @item lowpass
  15361. No filtering, this is default.
  15362. @item flat
  15363. Luma and chroma combined together.
  15364. @item aflat
  15365. Similar as above, but shows difference between blue and red chroma.
  15366. @item xflat
  15367. Similar as above, but use different colors.
  15368. @item yflat
  15369. Similar as above, but again with different colors.
  15370. @item chroma
  15371. Displays only chroma.
  15372. @item color
  15373. Displays actual color value on waveform.
  15374. @item acolor
  15375. Similar as above, but with luma showing frequency of chroma values.
  15376. @end table
  15377. @item graticule, g
  15378. Set which graticule to display.
  15379. @table @samp
  15380. @item none
  15381. Do not display graticule.
  15382. @item green
  15383. Display green graticule showing legal broadcast ranges.
  15384. @item orange
  15385. Display orange graticule showing legal broadcast ranges.
  15386. @item invert
  15387. Display invert graticule showing legal broadcast ranges.
  15388. @end table
  15389. @item opacity, o
  15390. Set graticule opacity.
  15391. @item flags, fl
  15392. Set graticule flags.
  15393. @table @samp
  15394. @item numbers
  15395. Draw numbers above lines. By default enabled.
  15396. @item dots
  15397. Draw dots instead of lines.
  15398. @end table
  15399. @item scale, s
  15400. Set scale used for displaying graticule.
  15401. @table @samp
  15402. @item digital
  15403. @item millivolts
  15404. @item ire
  15405. @end table
  15406. Default is digital.
  15407. @item bgopacity, b
  15408. Set background opacity.
  15409. @item tint0, t0
  15410. @item tint1, t1
  15411. Set tint for output.
  15412. Only used with lowpass filter and when display is not overlay and input
  15413. pixel formats are not RGB.
  15414. @end table
  15415. @section weave, doubleweave
  15416. The @code{weave} takes a field-based video input and join
  15417. each two sequential fields into single frame, producing a new double
  15418. height clip with half the frame rate and half the frame count.
  15419. The @code{doubleweave} works same as @code{weave} but without
  15420. halving frame rate and frame count.
  15421. It accepts the following option:
  15422. @table @option
  15423. @item first_field
  15424. Set first field. Available values are:
  15425. @table @samp
  15426. @item top, t
  15427. Set the frame as top-field-first.
  15428. @item bottom, b
  15429. Set the frame as bottom-field-first.
  15430. @end table
  15431. @end table
  15432. @subsection Examples
  15433. @itemize
  15434. @item
  15435. Interlace video using @ref{select} and @ref{separatefields} filter:
  15436. @example
  15437. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15438. @end example
  15439. @end itemize
  15440. @section xbr
  15441. Apply the xBR high-quality magnification filter which is designed for pixel
  15442. art. It follows a set of edge-detection rules, see
  15443. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15444. It accepts the following option:
  15445. @table @option
  15446. @item n
  15447. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15448. @code{3xBR} and @code{4} for @code{4xBR}.
  15449. Default is @code{3}.
  15450. @end table
  15451. @section xfade
  15452. Apply cross fade from one input video stream to another input video stream.
  15453. The cross fade is applied for specified duration.
  15454. The filter accepts the following options:
  15455. @table @option
  15456. @item transition
  15457. Set one of available transition effects:
  15458. @table @samp
  15459. @item custom
  15460. @item fade
  15461. @item wipeleft
  15462. @item wiperight
  15463. @item wipeup
  15464. @item wipedown
  15465. @item slideleft
  15466. @item slideright
  15467. @item slideup
  15468. @item slidedown
  15469. @item circlecrop
  15470. @item rectcrop
  15471. @item distance
  15472. @item fadeblack
  15473. @item fadewhite
  15474. @item radial
  15475. @item smoothleft
  15476. @item smoothright
  15477. @item smoothup
  15478. @item smoothdown
  15479. @item circleopen
  15480. @item circleclose
  15481. @item vertopen
  15482. @item vertclose
  15483. @item horzopen
  15484. @item horzclose
  15485. @item dissolve
  15486. @item pixelize
  15487. @item diagtl
  15488. @item diagtr
  15489. @item diagbl
  15490. @item diagbr
  15491. @item hlslice
  15492. @item hrslice
  15493. @item vuslice
  15494. @item vdslice
  15495. @end table
  15496. Default transition effect is fade.
  15497. @item duration
  15498. Set cross fade duration in seconds.
  15499. Default duration is 1 second.
  15500. @item offset
  15501. Set cross fade start relative to first input stream in seconds.
  15502. Default offset is 0.
  15503. @item expr
  15504. Set expression for custom transition effect.
  15505. The expressions can use the following variables and functions:
  15506. @table @option
  15507. @item X
  15508. @item Y
  15509. The coordinates of the current sample.
  15510. @item W
  15511. @item H
  15512. The width and height of the image.
  15513. @item P
  15514. Progress of transition effect.
  15515. @item PLANE
  15516. Currently processed plane.
  15517. @item A
  15518. Return value of first input at current location and plane.
  15519. @item B
  15520. Return value of second input at current location and plane.
  15521. @item a0(x, y)
  15522. @item a1(x, y)
  15523. @item a2(x, y)
  15524. @item a3(x, y)
  15525. Return the value of the pixel at location (@var{x},@var{y}) of the
  15526. first/second/third/fourth component of first input.
  15527. @item b0(x, y)
  15528. @item b1(x, y)
  15529. @item b2(x, y)
  15530. @item b3(x, y)
  15531. Return the value of the pixel at location (@var{x},@var{y}) of the
  15532. first/second/third/fourth component of second input.
  15533. @end table
  15534. @end table
  15535. @subsection Examples
  15536. @itemize
  15537. @item
  15538. Cross fade from one input video to another input video, with fade transition and duration of transition
  15539. of 2 seconds starting at offset of 5 seconds:
  15540. @example
  15541. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15542. @end example
  15543. @end itemize
  15544. @section xmedian
  15545. Pick median pixels from several input videos.
  15546. The filter accepts the following options:
  15547. @table @option
  15548. @item inputs
  15549. Set number of inputs.
  15550. Default is 3. Allowed range is from 3 to 255.
  15551. If number of inputs is even number, than result will be mean value between two median values.
  15552. @item planes
  15553. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15554. @item percentile
  15555. Set median percentile. Default value is @code{0.5}.
  15556. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15557. minimum values, and @code{1} maximum values.
  15558. @end table
  15559. @section xstack
  15560. Stack video inputs into custom layout.
  15561. All streams must be of same pixel format.
  15562. The filter accepts the following options:
  15563. @table @option
  15564. @item inputs
  15565. Set number of input streams. Default is 2.
  15566. @item layout
  15567. Specify layout of inputs.
  15568. This option requires the desired layout configuration to be explicitly set by the user.
  15569. This sets position of each video input in output. Each input
  15570. is separated by '|'.
  15571. The first number represents the column, and the second number represents the row.
  15572. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15573. where X is video input from which to take width or height.
  15574. Multiple values can be used when separated by '+'. In such
  15575. case values are summed together.
  15576. Note that if inputs are of different sizes gaps may appear, as not all of
  15577. the output video frame will be filled. Similarly, videos can overlap each
  15578. other if their position doesn't leave enough space for the full frame of
  15579. adjoining videos.
  15580. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15581. a layout must be set by the user.
  15582. @item shortest
  15583. If set to 1, force the output to terminate when the shortest input
  15584. terminates. Default value is 0.
  15585. @item fill
  15586. If set to valid color, all unused pixels will be filled with that color.
  15587. By default fill is set to none, so it is disabled.
  15588. @end table
  15589. @subsection Examples
  15590. @itemize
  15591. @item
  15592. Display 4 inputs into 2x2 grid.
  15593. Layout:
  15594. @example
  15595. input1(0, 0) | input3(w0, 0)
  15596. input2(0, h0) | input4(w0, h0)
  15597. @end example
  15598. @example
  15599. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15600. @end example
  15601. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15602. @item
  15603. Display 4 inputs into 1x4 grid.
  15604. Layout:
  15605. @example
  15606. input1(0, 0)
  15607. input2(0, h0)
  15608. input3(0, h0+h1)
  15609. input4(0, h0+h1+h2)
  15610. @end example
  15611. @example
  15612. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15613. @end example
  15614. Note that if inputs are of different widths, unused space will appear.
  15615. @item
  15616. Display 9 inputs into 3x3 grid.
  15617. Layout:
  15618. @example
  15619. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15620. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15621. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15622. @end example
  15623. @example
  15624. 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
  15625. @end example
  15626. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15627. @item
  15628. Display 16 inputs into 4x4 grid.
  15629. Layout:
  15630. @example
  15631. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15632. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15633. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15634. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15635. @end example
  15636. @example
  15637. 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|
  15638. 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
  15639. @end example
  15640. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15641. @end itemize
  15642. @anchor{yadif}
  15643. @section yadif
  15644. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15645. filter").
  15646. It accepts the following parameters:
  15647. @table @option
  15648. @item mode
  15649. The interlacing mode to adopt. It accepts one of the following values:
  15650. @table @option
  15651. @item 0, send_frame
  15652. Output one frame for each frame.
  15653. @item 1, send_field
  15654. Output one frame for each field.
  15655. @item 2, send_frame_nospatial
  15656. Like @code{send_frame}, but it skips the spatial interlacing check.
  15657. @item 3, send_field_nospatial
  15658. Like @code{send_field}, but it skips the spatial interlacing check.
  15659. @end table
  15660. The default value is @code{send_frame}.
  15661. @item parity
  15662. The picture field parity assumed for the input interlaced video. It accepts one
  15663. of the following values:
  15664. @table @option
  15665. @item 0, tff
  15666. Assume the top field is first.
  15667. @item 1, bff
  15668. Assume the bottom field is first.
  15669. @item -1, auto
  15670. Enable automatic detection of field parity.
  15671. @end table
  15672. The default value is @code{auto}.
  15673. If the interlacing is unknown or the decoder does not export this information,
  15674. top field first will be assumed.
  15675. @item deint
  15676. Specify which frames to deinterlace. Accepts one of the following
  15677. values:
  15678. @table @option
  15679. @item 0, all
  15680. Deinterlace all frames.
  15681. @item 1, interlaced
  15682. Only deinterlace frames marked as interlaced.
  15683. @end table
  15684. The default value is @code{all}.
  15685. @end table
  15686. @section yadif_cuda
  15687. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15688. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15689. and/or nvenc.
  15690. It accepts the following parameters:
  15691. @table @option
  15692. @item mode
  15693. The interlacing mode to adopt. It accepts one of the following values:
  15694. @table @option
  15695. @item 0, send_frame
  15696. Output one frame for each frame.
  15697. @item 1, send_field
  15698. Output one frame for each field.
  15699. @item 2, send_frame_nospatial
  15700. Like @code{send_frame}, but it skips the spatial interlacing check.
  15701. @item 3, send_field_nospatial
  15702. Like @code{send_field}, but it skips the spatial interlacing check.
  15703. @end table
  15704. The default value is @code{send_frame}.
  15705. @item parity
  15706. The picture field parity assumed for the input interlaced video. It accepts one
  15707. of the following values:
  15708. @table @option
  15709. @item 0, tff
  15710. Assume the top field is first.
  15711. @item 1, bff
  15712. Assume the bottom field is first.
  15713. @item -1, auto
  15714. Enable automatic detection of field parity.
  15715. @end table
  15716. The default value is @code{auto}.
  15717. If the interlacing is unknown or the decoder does not export this information,
  15718. top field first will be assumed.
  15719. @item deint
  15720. Specify which frames to deinterlace. Accepts one of the following
  15721. values:
  15722. @table @option
  15723. @item 0, all
  15724. Deinterlace all frames.
  15725. @item 1, interlaced
  15726. Only deinterlace frames marked as interlaced.
  15727. @end table
  15728. The default value is @code{all}.
  15729. @end table
  15730. @section yaepblur
  15731. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15732. The algorithm is described in
  15733. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15734. It accepts the following parameters:
  15735. @table @option
  15736. @item radius, r
  15737. Set the window radius. Default value is 3.
  15738. @item planes, p
  15739. Set which planes to filter. Default is only the first plane.
  15740. @item sigma, s
  15741. Set blur strength. Default value is 128.
  15742. @end table
  15743. @subsection Commands
  15744. This filter supports same @ref{commands} as options.
  15745. @section zoompan
  15746. Apply Zoom & Pan effect.
  15747. This filter accepts the following options:
  15748. @table @option
  15749. @item zoom, z
  15750. Set the zoom expression. Range is 1-10. Default is 1.
  15751. @item x
  15752. @item y
  15753. Set the x and y expression. Default is 0.
  15754. @item d
  15755. Set the duration expression in number of frames.
  15756. This sets for how many number of frames effect will last for
  15757. single input image.
  15758. @item s
  15759. Set the output image size, default is 'hd720'.
  15760. @item fps
  15761. Set the output frame rate, default is '25'.
  15762. @end table
  15763. Each expression can contain the following constants:
  15764. @table @option
  15765. @item in_w, iw
  15766. Input width.
  15767. @item in_h, ih
  15768. Input height.
  15769. @item out_w, ow
  15770. Output width.
  15771. @item out_h, oh
  15772. Output height.
  15773. @item in
  15774. Input frame count.
  15775. @item on
  15776. Output frame count.
  15777. @item x
  15778. @item y
  15779. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15780. for current input frame.
  15781. @item px
  15782. @item py
  15783. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15784. not yet such frame (first input frame).
  15785. @item zoom
  15786. Last calculated zoom from 'z' expression for current input frame.
  15787. @item pzoom
  15788. Last calculated zoom of last output frame of previous input frame.
  15789. @item duration
  15790. Number of output frames for current input frame. Calculated from 'd' expression
  15791. for each input frame.
  15792. @item pduration
  15793. number of output frames created for previous input frame
  15794. @item a
  15795. Rational number: input width / input height
  15796. @item sar
  15797. sample aspect ratio
  15798. @item dar
  15799. display aspect ratio
  15800. @end table
  15801. @subsection Examples
  15802. @itemize
  15803. @item
  15804. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  15805. @example
  15806. 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
  15807. @end example
  15808. @item
  15809. Zoom-in up to 1.5 and pan always at center of picture:
  15810. @example
  15811. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15812. @end example
  15813. @item
  15814. Same as above but without pausing:
  15815. @example
  15816. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15817. @end example
  15818. @end itemize
  15819. @anchor{zscale}
  15820. @section zscale
  15821. Scale (resize) the input video, using the z.lib library:
  15822. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15823. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15824. The zscale filter forces the output display aspect ratio to be the same
  15825. as the input, by changing the output sample aspect ratio.
  15826. If the input image format is different from the format requested by
  15827. the next filter, the zscale filter will convert the input to the
  15828. requested format.
  15829. @subsection Options
  15830. The filter accepts the following options.
  15831. @table @option
  15832. @item width, w
  15833. @item height, h
  15834. Set the output video dimension expression. Default value is the input
  15835. dimension.
  15836. If the @var{width} or @var{w} value is 0, the input width is used for
  15837. the output. If the @var{height} or @var{h} value is 0, the input height
  15838. is used for the output.
  15839. If one and only one of the values is -n with n >= 1, the zscale filter
  15840. will use a value that maintains the aspect ratio of the input image,
  15841. calculated from the other specified dimension. After that it will,
  15842. however, make sure that the calculated dimension is divisible by n and
  15843. adjust the value if necessary.
  15844. If both values are -n with n >= 1, the behavior will be identical to
  15845. both values being set to 0 as previously detailed.
  15846. See below for the list of accepted constants for use in the dimension
  15847. expression.
  15848. @item size, s
  15849. Set the video size. For the syntax of this option, check the
  15850. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15851. @item dither, d
  15852. Set the dither type.
  15853. Possible values are:
  15854. @table @var
  15855. @item none
  15856. @item ordered
  15857. @item random
  15858. @item error_diffusion
  15859. @end table
  15860. Default is none.
  15861. @item filter, f
  15862. Set the resize filter type.
  15863. Possible values are:
  15864. @table @var
  15865. @item point
  15866. @item bilinear
  15867. @item bicubic
  15868. @item spline16
  15869. @item spline36
  15870. @item lanczos
  15871. @end table
  15872. Default is bilinear.
  15873. @item range, r
  15874. Set the color range.
  15875. Possible values are:
  15876. @table @var
  15877. @item input
  15878. @item limited
  15879. @item full
  15880. @end table
  15881. Default is same as input.
  15882. @item primaries, p
  15883. Set the color primaries.
  15884. Possible values are:
  15885. @table @var
  15886. @item input
  15887. @item 709
  15888. @item unspecified
  15889. @item 170m
  15890. @item 240m
  15891. @item 2020
  15892. @end table
  15893. Default is same as input.
  15894. @item transfer, t
  15895. Set the transfer characteristics.
  15896. Possible values are:
  15897. @table @var
  15898. @item input
  15899. @item 709
  15900. @item unspecified
  15901. @item 601
  15902. @item linear
  15903. @item 2020_10
  15904. @item 2020_12
  15905. @item smpte2084
  15906. @item iec61966-2-1
  15907. @item arib-std-b67
  15908. @end table
  15909. Default is same as input.
  15910. @item matrix, m
  15911. Set the colorspace matrix.
  15912. Possible value are:
  15913. @table @var
  15914. @item input
  15915. @item 709
  15916. @item unspecified
  15917. @item 470bg
  15918. @item 170m
  15919. @item 2020_ncl
  15920. @item 2020_cl
  15921. @end table
  15922. Default is same as input.
  15923. @item rangein, rin
  15924. Set the input color range.
  15925. Possible values are:
  15926. @table @var
  15927. @item input
  15928. @item limited
  15929. @item full
  15930. @end table
  15931. Default is same as input.
  15932. @item primariesin, pin
  15933. Set the input color primaries.
  15934. Possible values are:
  15935. @table @var
  15936. @item input
  15937. @item 709
  15938. @item unspecified
  15939. @item 170m
  15940. @item 240m
  15941. @item 2020
  15942. @end table
  15943. Default is same as input.
  15944. @item transferin, tin
  15945. Set the input transfer characteristics.
  15946. Possible values are:
  15947. @table @var
  15948. @item input
  15949. @item 709
  15950. @item unspecified
  15951. @item 601
  15952. @item linear
  15953. @item 2020_10
  15954. @item 2020_12
  15955. @end table
  15956. Default is same as input.
  15957. @item matrixin, min
  15958. Set the input colorspace matrix.
  15959. Possible value are:
  15960. @table @var
  15961. @item input
  15962. @item 709
  15963. @item unspecified
  15964. @item 470bg
  15965. @item 170m
  15966. @item 2020_ncl
  15967. @item 2020_cl
  15968. @end table
  15969. @item chromal, c
  15970. Set the output chroma location.
  15971. Possible values are:
  15972. @table @var
  15973. @item input
  15974. @item left
  15975. @item center
  15976. @item topleft
  15977. @item top
  15978. @item bottomleft
  15979. @item bottom
  15980. @end table
  15981. @item chromalin, cin
  15982. Set the input chroma location.
  15983. Possible values are:
  15984. @table @var
  15985. @item input
  15986. @item left
  15987. @item center
  15988. @item topleft
  15989. @item top
  15990. @item bottomleft
  15991. @item bottom
  15992. @end table
  15993. @item npl
  15994. Set the nominal peak luminance.
  15995. @end table
  15996. The values of the @option{w} and @option{h} options are expressions
  15997. containing the following constants:
  15998. @table @var
  15999. @item in_w
  16000. @item in_h
  16001. The input width and height
  16002. @item iw
  16003. @item ih
  16004. These are the same as @var{in_w} and @var{in_h}.
  16005. @item out_w
  16006. @item out_h
  16007. The output (scaled) width and height
  16008. @item ow
  16009. @item oh
  16010. These are the same as @var{out_w} and @var{out_h}
  16011. @item a
  16012. The same as @var{iw} / @var{ih}
  16013. @item sar
  16014. input sample aspect ratio
  16015. @item dar
  16016. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16017. @item hsub
  16018. @item vsub
  16019. horizontal and vertical input chroma subsample values. For example for the
  16020. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16021. @item ohsub
  16022. @item ovsub
  16023. horizontal and vertical output chroma subsample values. For example for the
  16024. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16025. @end table
  16026. @subsection Commands
  16027. This filter supports the following commands:
  16028. @table @option
  16029. @item width, w
  16030. @item height, h
  16031. Set the output video dimension expression.
  16032. The command accepts the same syntax of the corresponding option.
  16033. If the specified expression is not valid, it is kept at its current
  16034. value.
  16035. @end table
  16036. @c man end VIDEO FILTERS
  16037. @chapter OpenCL Video Filters
  16038. @c man begin OPENCL VIDEO FILTERS
  16039. Below is a description of the currently available OpenCL video filters.
  16040. To enable compilation of these filters you need to configure FFmpeg with
  16041. @code{--enable-opencl}.
  16042. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16043. @table @option
  16044. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16045. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16046. given device parameters.
  16047. @item -filter_hw_device @var{name}
  16048. Pass the hardware device called @var{name} to all filters in any filter graph.
  16049. @end table
  16050. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16051. @itemize
  16052. @item
  16053. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16054. @example
  16055. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16056. @end example
  16057. @end itemize
  16058. 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.
  16059. @section avgblur_opencl
  16060. Apply average blur filter.
  16061. The filter accepts the following options:
  16062. @table @option
  16063. @item sizeX
  16064. Set horizontal radius size.
  16065. Range is @code{[1, 1024]} and default value is @code{1}.
  16066. @item planes
  16067. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16068. @item sizeY
  16069. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16070. @end table
  16071. @subsection Example
  16072. @itemize
  16073. @item
  16074. 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.
  16075. @example
  16076. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16077. @end example
  16078. @end itemize
  16079. @section boxblur_opencl
  16080. Apply a boxblur algorithm to the input video.
  16081. It accepts the following parameters:
  16082. @table @option
  16083. @item luma_radius, lr
  16084. @item luma_power, lp
  16085. @item chroma_radius, cr
  16086. @item chroma_power, cp
  16087. @item alpha_radius, ar
  16088. @item alpha_power, ap
  16089. @end table
  16090. A description of the accepted options follows.
  16091. @table @option
  16092. @item luma_radius, lr
  16093. @item chroma_radius, cr
  16094. @item alpha_radius, ar
  16095. Set an expression for the box radius in pixels used for blurring the
  16096. corresponding input plane.
  16097. The radius value must be a non-negative number, and must not be
  16098. greater than the value of the expression @code{min(w,h)/2} for the
  16099. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16100. planes.
  16101. Default value for @option{luma_radius} is "2". If not specified,
  16102. @option{chroma_radius} and @option{alpha_radius} default to the
  16103. corresponding value set for @option{luma_radius}.
  16104. The expressions can contain the following constants:
  16105. @table @option
  16106. @item w
  16107. @item h
  16108. The input width and height in pixels.
  16109. @item cw
  16110. @item ch
  16111. The input chroma image width and height in pixels.
  16112. @item hsub
  16113. @item vsub
  16114. The horizontal and vertical chroma subsample values. For example, for the
  16115. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16116. @end table
  16117. @item luma_power, lp
  16118. @item chroma_power, cp
  16119. @item alpha_power, ap
  16120. Specify how many times the boxblur filter is applied to the
  16121. corresponding plane.
  16122. Default value for @option{luma_power} is 2. If not specified,
  16123. @option{chroma_power} and @option{alpha_power} default to the
  16124. corresponding value set for @option{luma_power}.
  16125. A value of 0 will disable the effect.
  16126. @end table
  16127. @subsection Examples
  16128. 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.
  16129. @itemize
  16130. @item
  16131. Apply a boxblur filter with the luma, chroma, and alpha radius
  16132. 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.
  16133. @example
  16134. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16135. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16136. @end example
  16137. @item
  16138. 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.
  16139. For the luma plane, a 2x2 box radius will be run once.
  16140. For the chroma plane, a 4x4 box radius will be run 5 times.
  16141. For the alpha plane, a 3x3 box radius will be run 7 times.
  16142. @example
  16143. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16144. @end example
  16145. @end itemize
  16146. @section colorkey_opencl
  16147. RGB colorspace color keying.
  16148. The filter accepts the following options:
  16149. @table @option
  16150. @item color
  16151. The color which will be replaced with transparency.
  16152. @item similarity
  16153. Similarity percentage with the key color.
  16154. 0.01 matches only the exact key color, while 1.0 matches everything.
  16155. @item blend
  16156. Blend percentage.
  16157. 0.0 makes pixels either fully transparent, or not transparent at all.
  16158. Higher values result in semi-transparent pixels, with a higher transparency
  16159. the more similar the pixels color is to the key color.
  16160. @end table
  16161. @subsection Examples
  16162. @itemize
  16163. @item
  16164. Make every semi-green pixel in the input transparent with some slight blending:
  16165. @example
  16166. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16167. @end example
  16168. @end itemize
  16169. @section convolution_opencl
  16170. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16171. The filter accepts the following options:
  16172. @table @option
  16173. @item 0m
  16174. @item 1m
  16175. @item 2m
  16176. @item 3m
  16177. Set matrix for each plane.
  16178. Matrix is sequence of 9, 25 or 49 signed numbers.
  16179. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16180. @item 0rdiv
  16181. @item 1rdiv
  16182. @item 2rdiv
  16183. @item 3rdiv
  16184. Set multiplier for calculated value for each plane.
  16185. If unset or 0, it will be sum of all matrix elements.
  16186. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16187. @item 0bias
  16188. @item 1bias
  16189. @item 2bias
  16190. @item 3bias
  16191. Set bias for each plane. This value is added to the result of the multiplication.
  16192. Useful for making the overall image brighter or darker.
  16193. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16194. @end table
  16195. @subsection Examples
  16196. @itemize
  16197. @item
  16198. Apply sharpen:
  16199. @example
  16200. -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
  16201. @end example
  16202. @item
  16203. Apply blur:
  16204. @example
  16205. -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
  16206. @end example
  16207. @item
  16208. Apply edge enhance:
  16209. @example
  16210. -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
  16211. @end example
  16212. @item
  16213. Apply edge detect:
  16214. @example
  16215. -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
  16216. @end example
  16217. @item
  16218. Apply laplacian edge detector which includes diagonals:
  16219. @example
  16220. -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
  16221. @end example
  16222. @item
  16223. Apply emboss:
  16224. @example
  16225. -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
  16226. @end example
  16227. @end itemize
  16228. @section erosion_opencl
  16229. Apply erosion effect to the video.
  16230. This filter replaces the pixel by the local(3x3) minimum.
  16231. It accepts the following options:
  16232. @table @option
  16233. @item threshold0
  16234. @item threshold1
  16235. @item threshold2
  16236. @item threshold3
  16237. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16238. If @code{0}, plane will remain unchanged.
  16239. @item coordinates
  16240. Flag which specifies the pixel to refer to.
  16241. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16242. Flags to local 3x3 coordinates region centered on @code{x}:
  16243. 1 2 3
  16244. 4 x 5
  16245. 6 7 8
  16246. @end table
  16247. @subsection Example
  16248. @itemize
  16249. @item
  16250. 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.
  16251. @example
  16252. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16253. @end example
  16254. @end itemize
  16255. @section deshake_opencl
  16256. Feature-point based video stabilization filter.
  16257. The filter accepts the following options:
  16258. @table @option
  16259. @item tripod
  16260. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16261. @item debug
  16262. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16263. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16264. Viewing point matches in the output video is only supported for RGB input.
  16265. Defaults to @code{0}.
  16266. @item adaptive_crop
  16267. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16268. Defaults to @code{1}.
  16269. @item refine_features
  16270. Whether or not feature points should be refined at a sub-pixel level.
  16271. This can be turned off for a slight performance gain at the cost of precision.
  16272. Defaults to @code{1}.
  16273. @item smooth_strength
  16274. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16275. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16276. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16277. Defaults to @code{0.0}.
  16278. @item smooth_window_multiplier
  16279. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16280. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16281. Acceptable values range from @code{0.1} to @code{10.0}.
  16282. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16283. potentially improving smoothness, but also increase latency and memory usage.
  16284. Defaults to @code{2.0}.
  16285. @end table
  16286. @subsection Examples
  16287. @itemize
  16288. @item
  16289. Stabilize a video with a fixed, medium smoothing strength:
  16290. @example
  16291. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16292. @end example
  16293. @item
  16294. Stabilize a video with debugging (both in console and in rendered video):
  16295. @example
  16296. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16297. @end example
  16298. @end itemize
  16299. @section dilation_opencl
  16300. Apply dilation effect to the video.
  16301. This filter replaces the pixel by the local(3x3) maximum.
  16302. It accepts the following options:
  16303. @table @option
  16304. @item threshold0
  16305. @item threshold1
  16306. @item threshold2
  16307. @item threshold3
  16308. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16309. If @code{0}, plane will remain unchanged.
  16310. @item coordinates
  16311. Flag which specifies the pixel to refer to.
  16312. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16313. Flags to local 3x3 coordinates region centered on @code{x}:
  16314. 1 2 3
  16315. 4 x 5
  16316. 6 7 8
  16317. @end table
  16318. @subsection Example
  16319. @itemize
  16320. @item
  16321. 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.
  16322. @example
  16323. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16324. @end example
  16325. @end itemize
  16326. @section nlmeans_opencl
  16327. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16328. @section overlay_opencl
  16329. Overlay one video on top of another.
  16330. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16331. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16332. The filter accepts the following options:
  16333. @table @option
  16334. @item x
  16335. Set the x coordinate of the overlaid video on the main video.
  16336. Default value is @code{0}.
  16337. @item y
  16338. Set the y coordinate of the overlaid video on the main video.
  16339. Default value is @code{0}.
  16340. @end table
  16341. @subsection Examples
  16342. @itemize
  16343. @item
  16344. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16345. @example
  16346. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16347. @end example
  16348. @item
  16349. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16350. @example
  16351. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16352. @end example
  16353. @end itemize
  16354. @section pad_opencl
  16355. Add paddings to the input image, and place the original input at the
  16356. provided @var{x}, @var{y} coordinates.
  16357. It accepts the following options:
  16358. @table @option
  16359. @item width, w
  16360. @item height, h
  16361. Specify an expression for the size of the output image with the
  16362. paddings added. If the value for @var{width} or @var{height} is 0, the
  16363. corresponding input size is used for the output.
  16364. The @var{width} expression can reference the value set by the
  16365. @var{height} expression, and vice versa.
  16366. The default value of @var{width} and @var{height} is 0.
  16367. @item x
  16368. @item y
  16369. Specify the offsets to place the input image at within the padded area,
  16370. with respect to the top/left border of the output image.
  16371. The @var{x} expression can reference the value set by the @var{y}
  16372. expression, and vice versa.
  16373. The default value of @var{x} and @var{y} is 0.
  16374. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16375. so the input image is centered on the padded area.
  16376. @item color
  16377. Specify the color of the padded area. For the syntax of this option,
  16378. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16379. manual,ffmpeg-utils}.
  16380. @item aspect
  16381. Pad to an aspect instead to a resolution.
  16382. @end table
  16383. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16384. options are expressions containing the following constants:
  16385. @table @option
  16386. @item in_w
  16387. @item in_h
  16388. The input video width and height.
  16389. @item iw
  16390. @item ih
  16391. These are the same as @var{in_w} and @var{in_h}.
  16392. @item out_w
  16393. @item out_h
  16394. The output width and height (the size of the padded area), as
  16395. specified by the @var{width} and @var{height} expressions.
  16396. @item ow
  16397. @item oh
  16398. These are the same as @var{out_w} and @var{out_h}.
  16399. @item x
  16400. @item y
  16401. The x and y offsets as specified by the @var{x} and @var{y}
  16402. expressions, or NAN if not yet specified.
  16403. @item a
  16404. same as @var{iw} / @var{ih}
  16405. @item sar
  16406. input sample aspect ratio
  16407. @item dar
  16408. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16409. @end table
  16410. @section prewitt_opencl
  16411. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16412. The filter accepts the following option:
  16413. @table @option
  16414. @item planes
  16415. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16416. @item scale
  16417. Set value which will be multiplied with filtered result.
  16418. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16419. @item delta
  16420. Set value which will be added to filtered result.
  16421. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16422. @end table
  16423. @subsection Example
  16424. @itemize
  16425. @item
  16426. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16427. @example
  16428. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16429. @end example
  16430. @end itemize
  16431. @anchor{program_opencl}
  16432. @section program_opencl
  16433. Filter video using an OpenCL program.
  16434. @table @option
  16435. @item source
  16436. OpenCL program source file.
  16437. @item kernel
  16438. Kernel name in program.
  16439. @item inputs
  16440. Number of inputs to the filter. Defaults to 1.
  16441. @item size, s
  16442. Size of output frames. Defaults to the same as the first input.
  16443. @end table
  16444. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16445. The program source file must contain a kernel function with the given name,
  16446. which will be run once for each plane of the output. Each run on a plane
  16447. gets enqueued as a separate 2D global NDRange with one work-item for each
  16448. pixel to be generated. The global ID offset for each work-item is therefore
  16449. the coordinates of a pixel in the destination image.
  16450. The kernel function needs to take the following arguments:
  16451. @itemize
  16452. @item
  16453. Destination image, @var{__write_only image2d_t}.
  16454. This image will become the output; the kernel should write all of it.
  16455. @item
  16456. Frame index, @var{unsigned int}.
  16457. This is a counter starting from zero and increasing by one for each frame.
  16458. @item
  16459. Source images, @var{__read_only image2d_t}.
  16460. These are the most recent images on each input. The kernel may read from
  16461. them to generate the output, but they can't be written to.
  16462. @end itemize
  16463. Example programs:
  16464. @itemize
  16465. @item
  16466. Copy the input to the output (output must be the same size as the input).
  16467. @verbatim
  16468. __kernel void copy(__write_only image2d_t destination,
  16469. unsigned int index,
  16470. __read_only image2d_t source)
  16471. {
  16472. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16473. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16474. float4 value = read_imagef(source, sampler, location);
  16475. write_imagef(destination, location, value);
  16476. }
  16477. @end verbatim
  16478. @item
  16479. Apply a simple transformation, rotating the input by an amount increasing
  16480. with the index counter. Pixel values are linearly interpolated by the
  16481. sampler, and the output need not have the same dimensions as the input.
  16482. @verbatim
  16483. __kernel void rotate_image(__write_only image2d_t dst,
  16484. unsigned int index,
  16485. __read_only image2d_t src)
  16486. {
  16487. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16488. CLK_FILTER_LINEAR);
  16489. float angle = (float)index / 100.0f;
  16490. float2 dst_dim = convert_float2(get_image_dim(dst));
  16491. float2 src_dim = convert_float2(get_image_dim(src));
  16492. float2 dst_cen = dst_dim / 2.0f;
  16493. float2 src_cen = src_dim / 2.0f;
  16494. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16495. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16496. float2 src_pos = {
  16497. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16498. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16499. };
  16500. src_pos = src_pos * src_dim / dst_dim;
  16501. float2 src_loc = src_pos + src_cen;
  16502. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16503. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16504. write_imagef(dst, dst_loc, 0.5f);
  16505. else
  16506. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16507. }
  16508. @end verbatim
  16509. @item
  16510. Blend two inputs together, with the amount of each input used varying
  16511. with the index counter.
  16512. @verbatim
  16513. __kernel void blend_images(__write_only image2d_t dst,
  16514. unsigned int index,
  16515. __read_only image2d_t src1,
  16516. __read_only image2d_t src2)
  16517. {
  16518. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16519. CLK_FILTER_LINEAR);
  16520. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16521. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16522. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16523. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16524. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16525. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16526. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16527. }
  16528. @end verbatim
  16529. @end itemize
  16530. @section roberts_opencl
  16531. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16532. The filter accepts the following option:
  16533. @table @option
  16534. @item planes
  16535. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16536. @item scale
  16537. Set value which will be multiplied with filtered result.
  16538. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16539. @item delta
  16540. Set value which will be added to filtered result.
  16541. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16542. @end table
  16543. @subsection Example
  16544. @itemize
  16545. @item
  16546. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16547. @example
  16548. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16549. @end example
  16550. @end itemize
  16551. @section sobel_opencl
  16552. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16553. The filter accepts the following option:
  16554. @table @option
  16555. @item planes
  16556. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16557. @item scale
  16558. Set value which will be multiplied with filtered result.
  16559. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16560. @item delta
  16561. Set value which will be added to filtered result.
  16562. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16563. @end table
  16564. @subsection Example
  16565. @itemize
  16566. @item
  16567. Apply sobel operator with scale set to 2 and delta set to 10
  16568. @example
  16569. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16570. @end example
  16571. @end itemize
  16572. @section tonemap_opencl
  16573. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16574. It accepts the following parameters:
  16575. @table @option
  16576. @item tonemap
  16577. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16578. @item param
  16579. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16580. @item desat
  16581. Apply desaturation for highlights that exceed this level of brightness. The
  16582. higher the parameter, the more color information will be preserved. This
  16583. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16584. (smoothly) turning into white instead. This makes images feel more natural,
  16585. at the cost of reducing information about out-of-range colors.
  16586. The default value is 0.5, and the algorithm here is a little different from
  16587. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16588. @item threshold
  16589. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16590. is used to detect whether the scene has changed or not. If the distance between
  16591. the current frame average brightness and the current running average exceeds
  16592. a threshold value, we would re-calculate scene average and peak brightness.
  16593. The default value is 0.2.
  16594. @item format
  16595. Specify the output pixel format.
  16596. Currently supported formats are:
  16597. @table @var
  16598. @item p010
  16599. @item nv12
  16600. @end table
  16601. @item range, r
  16602. Set the output color range.
  16603. Possible values are:
  16604. @table @var
  16605. @item tv/mpeg
  16606. @item pc/jpeg
  16607. @end table
  16608. Default is same as input.
  16609. @item primaries, p
  16610. Set the output color primaries.
  16611. Possible values are:
  16612. @table @var
  16613. @item bt709
  16614. @item bt2020
  16615. @end table
  16616. Default is same as input.
  16617. @item transfer, t
  16618. Set the output transfer characteristics.
  16619. Possible values are:
  16620. @table @var
  16621. @item bt709
  16622. @item bt2020
  16623. @end table
  16624. Default is bt709.
  16625. @item matrix, m
  16626. Set the output colorspace matrix.
  16627. Possible value are:
  16628. @table @var
  16629. @item bt709
  16630. @item bt2020
  16631. @end table
  16632. Default is same as input.
  16633. @end table
  16634. @subsection Example
  16635. @itemize
  16636. @item
  16637. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16638. @example
  16639. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16640. @end example
  16641. @end itemize
  16642. @section unsharp_opencl
  16643. Sharpen or blur the input video.
  16644. It accepts the following parameters:
  16645. @table @option
  16646. @item luma_msize_x, lx
  16647. Set the luma matrix horizontal size.
  16648. Range is @code{[1, 23]} and default value is @code{5}.
  16649. @item luma_msize_y, ly
  16650. Set the luma matrix vertical size.
  16651. Range is @code{[1, 23]} and default value is @code{5}.
  16652. @item luma_amount, la
  16653. Set the luma effect strength.
  16654. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16655. Negative values will blur the input video, while positive values will
  16656. sharpen it, a value of zero will disable the effect.
  16657. @item chroma_msize_x, cx
  16658. Set the chroma matrix horizontal size.
  16659. Range is @code{[1, 23]} and default value is @code{5}.
  16660. @item chroma_msize_y, cy
  16661. Set the chroma matrix vertical size.
  16662. Range is @code{[1, 23]} and default value is @code{5}.
  16663. @item chroma_amount, ca
  16664. Set the chroma effect strength.
  16665. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16666. Negative values will blur the input video, while positive values will
  16667. sharpen it, a value of zero will disable the effect.
  16668. @end table
  16669. All parameters are optional and default to the equivalent of the
  16670. string '5:5:1.0:5:5:0.0'.
  16671. @subsection Examples
  16672. @itemize
  16673. @item
  16674. Apply strong luma sharpen effect:
  16675. @example
  16676. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16677. @end example
  16678. @item
  16679. Apply a strong blur of both luma and chroma parameters:
  16680. @example
  16681. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16682. @end example
  16683. @end itemize
  16684. @section xfade_opencl
  16685. Cross fade two videos with custom transition effect by using OpenCL.
  16686. It accepts the following options:
  16687. @table @option
  16688. @item transition
  16689. Set one of possible transition effects.
  16690. @table @option
  16691. @item custom
  16692. Select custom transition effect, the actual transition description
  16693. will be picked from source and kernel options.
  16694. @item fade
  16695. @item wipeleft
  16696. @item wiperight
  16697. @item wipeup
  16698. @item wipedown
  16699. @item slideleft
  16700. @item slideright
  16701. @item slideup
  16702. @item slidedown
  16703. Default transition is fade.
  16704. @end table
  16705. @item source
  16706. OpenCL program source file for custom transition.
  16707. @item kernel
  16708. Set name of kernel to use for custom transition from program source file.
  16709. @item duration
  16710. Set duration of video transition.
  16711. @item offset
  16712. Set time of start of transition relative to first video.
  16713. @end table
  16714. The program source file must contain a kernel function with the given name,
  16715. which will be run once for each plane of the output. Each run on a plane
  16716. gets enqueued as a separate 2D global NDRange with one work-item for each
  16717. pixel to be generated. The global ID offset for each work-item is therefore
  16718. the coordinates of a pixel in the destination image.
  16719. The kernel function needs to take the following arguments:
  16720. @itemize
  16721. @item
  16722. Destination image, @var{__write_only image2d_t}.
  16723. This image will become the output; the kernel should write all of it.
  16724. @item
  16725. First Source image, @var{__read_only image2d_t}.
  16726. Second Source image, @var{__read_only image2d_t}.
  16727. These are the most recent images on each input. The kernel may read from
  16728. them to generate the output, but they can't be written to.
  16729. @item
  16730. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  16731. @end itemize
  16732. Example programs:
  16733. @itemize
  16734. @item
  16735. Apply dots curtain transition effect:
  16736. @verbatim
  16737. __kernel void blend_images(__write_only image2d_t dst,
  16738. __read_only image2d_t src1,
  16739. __read_only image2d_t src2,
  16740. float progress)
  16741. {
  16742. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16743. CLK_FILTER_LINEAR);
  16744. int2 p = (int2)(get_global_id(0), get_global_id(1));
  16745. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  16746. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  16747. rp = rp / dim;
  16748. float2 dots = (float2)(20.0, 20.0);
  16749. float2 center = (float2)(0,0);
  16750. float2 unused;
  16751. float4 val1 = read_imagef(src1, sampler, p);
  16752. float4 val2 = read_imagef(src2, sampler, p);
  16753. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  16754. write_imagef(dst, p, next ? val1 : val2);
  16755. }
  16756. @end verbatim
  16757. @end itemize
  16758. @c man end OPENCL VIDEO FILTERS
  16759. @chapter VAAPI Video Filters
  16760. @c man begin VAAPI VIDEO FILTERS
  16761. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16762. To enable compilation of these filters you need to configure FFmpeg with
  16763. @code{--enable-vaapi}.
  16764. 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}
  16765. @section tonemap_vaapi
  16766. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16767. It maps the dynamic range of HDR10 content to the SDR content.
  16768. It currently only accepts HDR10 as input.
  16769. It accepts the following parameters:
  16770. @table @option
  16771. @item format
  16772. Specify the output pixel format.
  16773. Currently supported formats are:
  16774. @table @var
  16775. @item p010
  16776. @item nv12
  16777. @end table
  16778. Default is nv12.
  16779. @item primaries, p
  16780. Set the output color primaries.
  16781. Default is same as input.
  16782. @item transfer, t
  16783. Set the output transfer characteristics.
  16784. Default is bt709.
  16785. @item matrix, m
  16786. Set the output colorspace matrix.
  16787. Default is same as input.
  16788. @end table
  16789. @subsection Example
  16790. @itemize
  16791. @item
  16792. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16793. @example
  16794. tonemap_vaapi=format=p010:t=bt2020-10
  16795. @end example
  16796. @end itemize
  16797. @c man end VAAPI VIDEO FILTERS
  16798. @chapter Video Sources
  16799. @c man begin VIDEO SOURCES
  16800. Below is a description of the currently available video sources.
  16801. @section buffer
  16802. Buffer video frames, and make them available to the filter chain.
  16803. This source is mainly intended for a programmatic use, in particular
  16804. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  16805. It accepts the following parameters:
  16806. @table @option
  16807. @item video_size
  16808. Specify the size (width and height) of the buffered video frames. For the
  16809. syntax of this option, check the
  16810. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16811. @item width
  16812. The input video width.
  16813. @item height
  16814. The input video height.
  16815. @item pix_fmt
  16816. A string representing the pixel format of the buffered video frames.
  16817. It may be a number corresponding to a pixel format, or a pixel format
  16818. name.
  16819. @item time_base
  16820. Specify the timebase assumed by the timestamps of the buffered frames.
  16821. @item frame_rate
  16822. Specify the frame rate expected for the video stream.
  16823. @item pixel_aspect, sar
  16824. The sample (pixel) aspect ratio of the input video.
  16825. @item sws_param
  16826. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  16827. to the filtergraph description to specify swscale flags for automatically
  16828. inserted scalers. See @ref{Filtergraph syntax}.
  16829. @item hw_frames_ctx
  16830. When using a hardware pixel format, this should be a reference to an
  16831. AVHWFramesContext describing input frames.
  16832. @end table
  16833. For example:
  16834. @example
  16835. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  16836. @end example
  16837. will instruct the source to accept video frames with size 320x240 and
  16838. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  16839. square pixels (1:1 sample aspect ratio).
  16840. Since the pixel format with name "yuv410p" corresponds to the number 6
  16841. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16842. this example corresponds to:
  16843. @example
  16844. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16845. @end example
  16846. Alternatively, the options can be specified as a flat string, but this
  16847. syntax is deprecated:
  16848. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  16849. @section cellauto
  16850. Create a pattern generated by an elementary cellular automaton.
  16851. The initial state of the cellular automaton can be defined through the
  16852. @option{filename} and @option{pattern} options. If such options are
  16853. not specified an initial state is created randomly.
  16854. At each new frame a new row in the video is filled with the result of
  16855. the cellular automaton next generation. The behavior when the whole
  16856. frame is filled is defined by the @option{scroll} option.
  16857. This source accepts the following options:
  16858. @table @option
  16859. @item filename, f
  16860. Read the initial cellular automaton state, i.e. the starting row, from
  16861. the specified file.
  16862. In the file, each non-whitespace character is considered an alive
  16863. cell, a newline will terminate the row, and further characters in the
  16864. file will be ignored.
  16865. @item pattern, p
  16866. Read the initial cellular automaton state, i.e. the starting row, from
  16867. the specified string.
  16868. Each non-whitespace character in the string is considered an alive
  16869. cell, a newline will terminate the row, and further characters in the
  16870. string will be ignored.
  16871. @item rate, r
  16872. Set the video rate, that is the number of frames generated per second.
  16873. Default is 25.
  16874. @item random_fill_ratio, ratio
  16875. Set the random fill ratio for the initial cellular automaton row. It
  16876. is a floating point number value ranging from 0 to 1, defaults to
  16877. 1/PHI.
  16878. This option is ignored when a file or a pattern is specified.
  16879. @item random_seed, seed
  16880. Set the seed for filling randomly the initial row, must be an integer
  16881. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16882. set to -1, the filter will try to use a good random seed on a best
  16883. effort basis.
  16884. @item rule
  16885. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  16886. Default value is 110.
  16887. @item size, s
  16888. Set the size of the output video. For the syntax of this option, check the
  16889. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16890. If @option{filename} or @option{pattern} is specified, the size is set
  16891. by default to the width of the specified initial state row, and the
  16892. height is set to @var{width} * PHI.
  16893. If @option{size} is set, it must contain the width of the specified
  16894. pattern string, and the specified pattern will be centered in the
  16895. larger row.
  16896. If a filename or a pattern string is not specified, the size value
  16897. defaults to "320x518" (used for a randomly generated initial state).
  16898. @item scroll
  16899. If set to 1, scroll the output upward when all the rows in the output
  16900. have been already filled. If set to 0, the new generated row will be
  16901. written over the top row just after the bottom row is filled.
  16902. Defaults to 1.
  16903. @item start_full, full
  16904. If set to 1, completely fill the output with generated rows before
  16905. outputting the first frame.
  16906. This is the default behavior, for disabling set the value to 0.
  16907. @item stitch
  16908. If set to 1, stitch the left and right row edges together.
  16909. This is the default behavior, for disabling set the value to 0.
  16910. @end table
  16911. @subsection Examples
  16912. @itemize
  16913. @item
  16914. Read the initial state from @file{pattern}, and specify an output of
  16915. size 200x400.
  16916. @example
  16917. cellauto=f=pattern:s=200x400
  16918. @end example
  16919. @item
  16920. Generate a random initial row with a width of 200 cells, with a fill
  16921. ratio of 2/3:
  16922. @example
  16923. cellauto=ratio=2/3:s=200x200
  16924. @end example
  16925. @item
  16926. Create a pattern generated by rule 18 starting by a single alive cell
  16927. centered on an initial row with width 100:
  16928. @example
  16929. cellauto=p=@@:s=100x400:full=0:rule=18
  16930. @end example
  16931. @item
  16932. Specify a more elaborated initial pattern:
  16933. @example
  16934. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  16935. @end example
  16936. @end itemize
  16937. @anchor{coreimagesrc}
  16938. @section coreimagesrc
  16939. Video source generated on GPU using Apple's CoreImage API on OSX.
  16940. This video source is a specialized version of the @ref{coreimage} video filter.
  16941. Use a core image generator at the beginning of the applied filterchain to
  16942. generate the content.
  16943. The coreimagesrc video source accepts the following options:
  16944. @table @option
  16945. @item list_generators
  16946. List all available generators along with all their respective options as well as
  16947. possible minimum and maximum values along with the default values.
  16948. @example
  16949. list_generators=true
  16950. @end example
  16951. @item size, s
  16952. Specify the size of the sourced video. For the syntax of this option, check the
  16953. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16954. The default value is @code{320x240}.
  16955. @item rate, r
  16956. Specify the frame rate of the sourced video, as the number of frames
  16957. generated per second. It has to be a string in the format
  16958. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16959. number or a valid video frame rate abbreviation. The default value is
  16960. "25".
  16961. @item sar
  16962. Set the sample aspect ratio of the sourced video.
  16963. @item duration, d
  16964. Set the duration of the sourced video. See
  16965. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16966. for the accepted syntax.
  16967. If not specified, or the expressed duration is negative, the video is
  16968. supposed to be generated forever.
  16969. @end table
  16970. Additionally, all options of the @ref{coreimage} video filter are accepted.
  16971. A complete filterchain can be used for further processing of the
  16972. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  16973. and examples for details.
  16974. @subsection Examples
  16975. @itemize
  16976. @item
  16977. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  16978. given as complete and escaped command-line for Apple's standard bash shell:
  16979. @example
  16980. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  16981. @end example
  16982. This example is equivalent to the QRCode example of @ref{coreimage} without the
  16983. need for a nullsrc video source.
  16984. @end itemize
  16985. @section gradients
  16986. Generate several gradients.
  16987. @table @option
  16988. @item size, s
  16989. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16990. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16991. @item rate, r
  16992. Set frame rate, expressed as number of frames per second. Default
  16993. value is "25".
  16994. @item c0, c1, c2, c3, c4, c5, c6, c7
  16995. Set 8 colors. Default values for colors is to pick random one.
  16996. @item x0, y0, y0, y1
  16997. Set gradient line source and destination points. If negative or out of range, random ones
  16998. are picked.
  16999. @item nb_colors, n
  17000. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17001. @item seed
  17002. Set seed for picking gradient line points.
  17003. @end table
  17004. @section mandelbrot
  17005. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17006. point specified with @var{start_x} and @var{start_y}.
  17007. This source accepts the following options:
  17008. @table @option
  17009. @item end_pts
  17010. Set the terminal pts value. Default value is 400.
  17011. @item end_scale
  17012. Set the terminal scale value.
  17013. Must be a floating point value. Default value is 0.3.
  17014. @item inner
  17015. Set the inner coloring mode, that is the algorithm used to draw the
  17016. Mandelbrot fractal internal region.
  17017. It shall assume one of the following values:
  17018. @table @option
  17019. @item black
  17020. Set black mode.
  17021. @item convergence
  17022. Show time until convergence.
  17023. @item mincol
  17024. Set color based on point closest to the origin of the iterations.
  17025. @item period
  17026. Set period mode.
  17027. @end table
  17028. Default value is @var{mincol}.
  17029. @item bailout
  17030. Set the bailout value. Default value is 10.0.
  17031. @item maxiter
  17032. Set the maximum of iterations performed by the rendering
  17033. algorithm. Default value is 7189.
  17034. @item outer
  17035. Set outer coloring mode.
  17036. It shall assume one of following values:
  17037. @table @option
  17038. @item iteration_count
  17039. Set iteration count mode.
  17040. @item normalized_iteration_count
  17041. set normalized iteration count mode.
  17042. @end table
  17043. Default value is @var{normalized_iteration_count}.
  17044. @item rate, r
  17045. Set frame rate, expressed as number of frames per second. Default
  17046. value is "25".
  17047. @item size, s
  17048. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17049. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17050. @item start_scale
  17051. Set the initial scale value. Default value is 3.0.
  17052. @item start_x
  17053. Set the initial x position. Must be a floating point value between
  17054. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17055. @item start_y
  17056. Set the initial y position. Must be a floating point value between
  17057. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17058. @end table
  17059. @section mptestsrc
  17060. Generate various test patterns, as generated by the MPlayer test filter.
  17061. The size of the generated video is fixed, and is 256x256.
  17062. This source is useful in particular for testing encoding features.
  17063. This source accepts the following options:
  17064. @table @option
  17065. @item rate, r
  17066. Specify the frame rate of the sourced video, as the number of frames
  17067. generated per second. It has to be a string in the format
  17068. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17069. number or a valid video frame rate abbreviation. The default value is
  17070. "25".
  17071. @item duration, d
  17072. Set the duration of the sourced video. See
  17073. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17074. for the accepted syntax.
  17075. If not specified, or the expressed duration is negative, the video is
  17076. supposed to be generated forever.
  17077. @item test, t
  17078. Set the number or the name of the test to perform. Supported tests are:
  17079. @table @option
  17080. @item dc_luma
  17081. @item dc_chroma
  17082. @item freq_luma
  17083. @item freq_chroma
  17084. @item amp_luma
  17085. @item amp_chroma
  17086. @item cbp
  17087. @item mv
  17088. @item ring1
  17089. @item ring2
  17090. @item all
  17091. @item max_frames, m
  17092. Set the maximum number of frames generated for each test, default value is 30.
  17093. @end table
  17094. Default value is "all", which will cycle through the list of all tests.
  17095. @end table
  17096. Some examples:
  17097. @example
  17098. mptestsrc=t=dc_luma
  17099. @end example
  17100. will generate a "dc_luma" test pattern.
  17101. @section frei0r_src
  17102. Provide a frei0r source.
  17103. To enable compilation of this filter you need to install the frei0r
  17104. header and configure FFmpeg with @code{--enable-frei0r}.
  17105. This source accepts the following parameters:
  17106. @table @option
  17107. @item size
  17108. The size of the video to generate. For the syntax of this option, check the
  17109. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17110. @item framerate
  17111. The framerate of the generated video. It may be a string of the form
  17112. @var{num}/@var{den} or a frame rate abbreviation.
  17113. @item filter_name
  17114. The name to the frei0r source to load. For more information regarding frei0r and
  17115. how to set the parameters, read the @ref{frei0r} section in the video filters
  17116. documentation.
  17117. @item filter_params
  17118. A '|'-separated list of parameters to pass to the frei0r source.
  17119. @end table
  17120. For example, to generate a frei0r partik0l source with size 200x200
  17121. and frame rate 10 which is overlaid on the overlay filter main input:
  17122. @example
  17123. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17124. @end example
  17125. @section life
  17126. Generate a life pattern.
  17127. This source is based on a generalization of John Conway's life game.
  17128. The sourced input represents a life grid, each pixel represents a cell
  17129. which can be in one of two possible states, alive or dead. Every cell
  17130. interacts with its eight neighbours, which are the cells that are
  17131. horizontally, vertically, or diagonally adjacent.
  17132. At each interaction the grid evolves according to the adopted rule,
  17133. which specifies the number of neighbor alive cells which will make a
  17134. cell stay alive or born. The @option{rule} option allows one to specify
  17135. the rule to adopt.
  17136. This source accepts the following options:
  17137. @table @option
  17138. @item filename, f
  17139. Set the file from which to read the initial grid state. In the file,
  17140. each non-whitespace character is considered an alive cell, and newline
  17141. is used to delimit the end of each row.
  17142. If this option is not specified, the initial grid is generated
  17143. randomly.
  17144. @item rate, r
  17145. Set the video rate, that is the number of frames generated per second.
  17146. Default is 25.
  17147. @item random_fill_ratio, ratio
  17148. Set the random fill ratio for the initial random grid. It is a
  17149. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17150. It is ignored when a file is specified.
  17151. @item random_seed, seed
  17152. Set the seed for filling the initial random grid, must be an integer
  17153. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17154. set to -1, the filter will try to use a good random seed on a best
  17155. effort basis.
  17156. @item rule
  17157. Set the life rule.
  17158. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17159. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17160. @var{NS} specifies the number of alive neighbor cells which make a
  17161. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17162. which make a dead cell to become alive (i.e. to "born").
  17163. "s" and "b" can be used in place of "S" and "B", respectively.
  17164. Alternatively a rule can be specified by an 18-bits integer. The 9
  17165. high order bits are used to encode the next cell state if it is alive
  17166. for each number of neighbor alive cells, the low order bits specify
  17167. the rule for "borning" new cells. Higher order bits encode for an
  17168. higher number of neighbor cells.
  17169. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17170. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17171. Default value is "S23/B3", which is the original Conway's game of life
  17172. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17173. cells, and will born a new cell if there are three alive cells around
  17174. a dead cell.
  17175. @item size, s
  17176. Set the size of the output video. For the syntax of this option, check the
  17177. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17178. If @option{filename} is specified, the size is set by default to the
  17179. same size of the input file. If @option{size} is set, it must contain
  17180. the size specified in the input file, and the initial grid defined in
  17181. that file is centered in the larger resulting area.
  17182. If a filename is not specified, the size value defaults to "320x240"
  17183. (used for a randomly generated initial grid).
  17184. @item stitch
  17185. If set to 1, stitch the left and right grid edges together, and the
  17186. top and bottom edges also. Defaults to 1.
  17187. @item mold
  17188. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17189. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17190. value from 0 to 255.
  17191. @item life_color
  17192. Set the color of living (or new born) cells.
  17193. @item death_color
  17194. Set the color of dead cells. If @option{mold} is set, this is the first color
  17195. used to represent a dead cell.
  17196. @item mold_color
  17197. Set mold color, for definitely dead and moldy cells.
  17198. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17199. ffmpeg-utils manual,ffmpeg-utils}.
  17200. @end table
  17201. @subsection Examples
  17202. @itemize
  17203. @item
  17204. Read a grid from @file{pattern}, and center it on a grid of size
  17205. 300x300 pixels:
  17206. @example
  17207. life=f=pattern:s=300x300
  17208. @end example
  17209. @item
  17210. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17211. @example
  17212. life=ratio=2/3:s=200x200
  17213. @end example
  17214. @item
  17215. Specify a custom rule for evolving a randomly generated grid:
  17216. @example
  17217. life=rule=S14/B34
  17218. @end example
  17219. @item
  17220. Full example with slow death effect (mold) using @command{ffplay}:
  17221. @example
  17222. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17223. @end example
  17224. @end itemize
  17225. @anchor{allrgb}
  17226. @anchor{allyuv}
  17227. @anchor{color}
  17228. @anchor{haldclutsrc}
  17229. @anchor{nullsrc}
  17230. @anchor{pal75bars}
  17231. @anchor{pal100bars}
  17232. @anchor{rgbtestsrc}
  17233. @anchor{smptebars}
  17234. @anchor{smptehdbars}
  17235. @anchor{testsrc}
  17236. @anchor{testsrc2}
  17237. @anchor{yuvtestsrc}
  17238. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17239. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17240. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17241. The @code{color} source provides an uniformly colored input.
  17242. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17243. @ref{haldclut} filter.
  17244. The @code{nullsrc} source returns unprocessed video frames. It is
  17245. mainly useful to be employed in analysis / debugging tools, or as the
  17246. source for filters which ignore the input data.
  17247. The @code{pal75bars} source generates a color bars pattern, based on
  17248. EBU PAL recommendations with 75% color levels.
  17249. The @code{pal100bars} source generates a color bars pattern, based on
  17250. EBU PAL recommendations with 100% color levels.
  17251. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17252. detecting RGB vs BGR issues. You should see a red, green and blue
  17253. stripe from top to bottom.
  17254. The @code{smptebars} source generates a color bars pattern, based on
  17255. the SMPTE Engineering Guideline EG 1-1990.
  17256. The @code{smptehdbars} source generates a color bars pattern, based on
  17257. the SMPTE RP 219-2002.
  17258. The @code{testsrc} source generates a test video pattern, showing a
  17259. color pattern, a scrolling gradient and a timestamp. This is mainly
  17260. intended for testing purposes.
  17261. The @code{testsrc2} source is similar to testsrc, but supports more
  17262. pixel formats instead of just @code{rgb24}. This allows using it as an
  17263. input for other tests without requiring a format conversion.
  17264. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17265. see a y, cb and cr stripe from top to bottom.
  17266. The sources accept the following parameters:
  17267. @table @option
  17268. @item level
  17269. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17270. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17271. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17272. coded on a @code{1/(N*N)} scale.
  17273. @item color, c
  17274. Specify the color of the source, only available in the @code{color}
  17275. source. For the syntax of this option, check the
  17276. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17277. @item size, s
  17278. Specify the size of the sourced video. For the syntax of this option, check the
  17279. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17280. The default value is @code{320x240}.
  17281. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17282. @code{haldclutsrc} filters.
  17283. @item rate, r
  17284. Specify the frame rate of the sourced video, as the number of frames
  17285. generated per second. It has to be a string in the format
  17286. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17287. number or a valid video frame rate abbreviation. The default value is
  17288. "25".
  17289. @item duration, d
  17290. Set the duration of the sourced video. See
  17291. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17292. for the accepted syntax.
  17293. If not specified, or the expressed duration is negative, the video is
  17294. supposed to be generated forever.
  17295. @item sar
  17296. Set the sample aspect ratio of the sourced video.
  17297. @item alpha
  17298. Specify the alpha (opacity) of the background, only available in the
  17299. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17300. 255 (fully opaque, the default).
  17301. @item decimals, n
  17302. Set the number of decimals to show in the timestamp, only available in the
  17303. @code{testsrc} source.
  17304. The displayed timestamp value will correspond to the original
  17305. timestamp value multiplied by the power of 10 of the specified
  17306. value. Default value is 0.
  17307. @end table
  17308. @subsection Examples
  17309. @itemize
  17310. @item
  17311. Generate a video with a duration of 5.3 seconds, with size
  17312. 176x144 and a frame rate of 10 frames per second:
  17313. @example
  17314. testsrc=duration=5.3:size=qcif:rate=10
  17315. @end example
  17316. @item
  17317. The following graph description will generate a red source
  17318. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17319. frames per second:
  17320. @example
  17321. color=c=red@@0.2:s=qcif:r=10
  17322. @end example
  17323. @item
  17324. If the input content is to be ignored, @code{nullsrc} can be used. The
  17325. following command generates noise in the luminance plane by employing
  17326. the @code{geq} filter:
  17327. @example
  17328. nullsrc=s=256x256, geq=random(1)*255:128:128
  17329. @end example
  17330. @end itemize
  17331. @subsection Commands
  17332. The @code{color} source supports the following commands:
  17333. @table @option
  17334. @item c, color
  17335. Set the color of the created image. Accepts the same syntax of the
  17336. corresponding @option{color} option.
  17337. @end table
  17338. @section openclsrc
  17339. Generate video using an OpenCL program.
  17340. @table @option
  17341. @item source
  17342. OpenCL program source file.
  17343. @item kernel
  17344. Kernel name in program.
  17345. @item size, s
  17346. Size of frames to generate. This must be set.
  17347. @item format
  17348. Pixel format to use for the generated frames. This must be set.
  17349. @item rate, r
  17350. Number of frames generated every second. Default value is '25'.
  17351. @end table
  17352. For details of how the program loading works, see the @ref{program_opencl}
  17353. filter.
  17354. Example programs:
  17355. @itemize
  17356. @item
  17357. Generate a colour ramp by setting pixel values from the position of the pixel
  17358. in the output image. (Note that this will work with all pixel formats, but
  17359. the generated output will not be the same.)
  17360. @verbatim
  17361. __kernel void ramp(__write_only image2d_t dst,
  17362. unsigned int index)
  17363. {
  17364. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17365. float4 val;
  17366. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17367. write_imagef(dst, loc, val);
  17368. }
  17369. @end verbatim
  17370. @item
  17371. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17372. @verbatim
  17373. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17374. unsigned int index)
  17375. {
  17376. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17377. float4 value = 0.0f;
  17378. int x = loc.x + index;
  17379. int y = loc.y + index;
  17380. while (x > 0 || y > 0) {
  17381. if (x % 3 == 1 && y % 3 == 1) {
  17382. value = 1.0f;
  17383. break;
  17384. }
  17385. x /= 3;
  17386. y /= 3;
  17387. }
  17388. write_imagef(dst, loc, value);
  17389. }
  17390. @end verbatim
  17391. @end itemize
  17392. @section sierpinski
  17393. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17394. This source accepts the following options:
  17395. @table @option
  17396. @item size, s
  17397. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17398. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17399. @item rate, r
  17400. Set frame rate, expressed as number of frames per second. Default
  17401. value is "25".
  17402. @item seed
  17403. Set seed which is used for random panning.
  17404. @item jump
  17405. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17406. @item type
  17407. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17408. @end table
  17409. @c man end VIDEO SOURCES
  17410. @chapter Video Sinks
  17411. @c man begin VIDEO SINKS
  17412. Below is a description of the currently available video sinks.
  17413. @section buffersink
  17414. Buffer video frames, and make them available to the end of the filter
  17415. graph.
  17416. This sink is mainly intended for programmatic use, in particular
  17417. through the interface defined in @file{libavfilter/buffersink.h}
  17418. or the options system.
  17419. It accepts a pointer to an AVBufferSinkContext structure, which
  17420. defines the incoming buffers' formats, to be passed as the opaque
  17421. parameter to @code{avfilter_init_filter} for initialization.
  17422. @section nullsink
  17423. Null video sink: do absolutely nothing with the input video. It is
  17424. mainly useful as a template and for use in analysis / debugging
  17425. tools.
  17426. @c man end VIDEO SINKS
  17427. @chapter Multimedia Filters
  17428. @c man begin MULTIMEDIA FILTERS
  17429. Below is a description of the currently available multimedia filters.
  17430. @section abitscope
  17431. Convert input audio to a video output, displaying the audio bit scope.
  17432. The filter accepts the following options:
  17433. @table @option
  17434. @item rate, r
  17435. Set frame rate, expressed as number of frames per second. Default
  17436. value is "25".
  17437. @item size, s
  17438. Specify the video size for the output. For the syntax of this option, check the
  17439. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17440. Default value is @code{1024x256}.
  17441. @item colors
  17442. Specify list of colors separated by space or by '|' which will be used to
  17443. draw channels. Unrecognized or missing colors will be replaced
  17444. by white color.
  17445. @end table
  17446. @section adrawgraph
  17447. Draw a graph using input audio metadata.
  17448. See @ref{drawgraph}
  17449. @section agraphmonitor
  17450. See @ref{graphmonitor}.
  17451. @section ahistogram
  17452. Convert input audio to a video output, displaying the volume histogram.
  17453. The filter accepts the following options:
  17454. @table @option
  17455. @item dmode
  17456. Specify how histogram is calculated.
  17457. It accepts the following values:
  17458. @table @samp
  17459. @item single
  17460. Use single histogram for all channels.
  17461. @item separate
  17462. Use separate histogram for each channel.
  17463. @end table
  17464. Default is @code{single}.
  17465. @item rate, r
  17466. Set frame rate, expressed as number of frames per second. Default
  17467. value is "25".
  17468. @item size, s
  17469. Specify the video size for the output. For the syntax of this option, check the
  17470. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17471. Default value is @code{hd720}.
  17472. @item scale
  17473. Set display scale.
  17474. It accepts the following values:
  17475. @table @samp
  17476. @item log
  17477. logarithmic
  17478. @item sqrt
  17479. square root
  17480. @item cbrt
  17481. cubic root
  17482. @item lin
  17483. linear
  17484. @item rlog
  17485. reverse logarithmic
  17486. @end table
  17487. Default is @code{log}.
  17488. @item ascale
  17489. Set amplitude scale.
  17490. It accepts the following values:
  17491. @table @samp
  17492. @item log
  17493. logarithmic
  17494. @item lin
  17495. linear
  17496. @end table
  17497. Default is @code{log}.
  17498. @item acount
  17499. Set how much frames to accumulate in histogram.
  17500. Default is 1. Setting this to -1 accumulates all frames.
  17501. @item rheight
  17502. Set histogram ratio of window height.
  17503. @item slide
  17504. Set sonogram sliding.
  17505. It accepts the following values:
  17506. @table @samp
  17507. @item replace
  17508. replace old rows with new ones.
  17509. @item scroll
  17510. scroll from top to bottom.
  17511. @end table
  17512. Default is @code{replace}.
  17513. @end table
  17514. @section aphasemeter
  17515. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17516. representing mean phase of current audio frame. A video output can also be produced and is
  17517. enabled by default. The audio is passed through as first output.
  17518. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17519. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17520. and @code{1} means channels are in phase.
  17521. The filter accepts the following options, all related to its video output:
  17522. @table @option
  17523. @item rate, r
  17524. Set the output frame rate. Default value is @code{25}.
  17525. @item size, s
  17526. Set the video size for the output. For the syntax of this option, check the
  17527. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17528. Default value is @code{800x400}.
  17529. @item rc
  17530. @item gc
  17531. @item bc
  17532. Specify the red, green, blue contrast. Default values are @code{2},
  17533. @code{7} and @code{1}.
  17534. Allowed range is @code{[0, 255]}.
  17535. @item mpc
  17536. Set color which will be used for drawing median phase. If color is
  17537. @code{none} which is default, no median phase value will be drawn.
  17538. @item video
  17539. Enable video output. Default is enabled.
  17540. @end table
  17541. @section avectorscope
  17542. Convert input audio to a video output, representing the audio vector
  17543. scope.
  17544. The filter is used to measure the difference between channels of stereo
  17545. audio stream. A monaural signal, consisting of identical left and right
  17546. signal, results in straight vertical line. Any stereo separation is visible
  17547. as a deviation from this line, creating a Lissajous figure.
  17548. If the straight (or deviation from it) but horizontal line appears this
  17549. indicates that the left and right channels are out of phase.
  17550. The filter accepts the following options:
  17551. @table @option
  17552. @item mode, m
  17553. Set the vectorscope mode.
  17554. Available values are:
  17555. @table @samp
  17556. @item lissajous
  17557. Lissajous rotated by 45 degrees.
  17558. @item lissajous_xy
  17559. Same as above but not rotated.
  17560. @item polar
  17561. Shape resembling half of circle.
  17562. @end table
  17563. Default value is @samp{lissajous}.
  17564. @item size, s
  17565. Set the video size for the output. For the syntax of this option, check the
  17566. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17567. Default value is @code{400x400}.
  17568. @item rate, r
  17569. Set the output frame rate. Default value is @code{25}.
  17570. @item rc
  17571. @item gc
  17572. @item bc
  17573. @item ac
  17574. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17575. @code{160}, @code{80} and @code{255}.
  17576. Allowed range is @code{[0, 255]}.
  17577. @item rf
  17578. @item gf
  17579. @item bf
  17580. @item af
  17581. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17582. @code{10}, @code{5} and @code{5}.
  17583. Allowed range is @code{[0, 255]}.
  17584. @item zoom
  17585. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17586. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17587. @item draw
  17588. Set the vectorscope drawing mode.
  17589. Available values are:
  17590. @table @samp
  17591. @item dot
  17592. Draw dot for each sample.
  17593. @item line
  17594. Draw line between previous and current sample.
  17595. @end table
  17596. Default value is @samp{dot}.
  17597. @item scale
  17598. Specify amplitude scale of audio samples.
  17599. Available values are:
  17600. @table @samp
  17601. @item lin
  17602. Linear.
  17603. @item sqrt
  17604. Square root.
  17605. @item cbrt
  17606. Cubic root.
  17607. @item log
  17608. Logarithmic.
  17609. @end table
  17610. @item swap
  17611. Swap left channel axis with right channel axis.
  17612. @item mirror
  17613. Mirror axis.
  17614. @table @samp
  17615. @item none
  17616. No mirror.
  17617. @item x
  17618. Mirror only x axis.
  17619. @item y
  17620. Mirror only y axis.
  17621. @item xy
  17622. Mirror both axis.
  17623. @end table
  17624. @end table
  17625. @subsection Examples
  17626. @itemize
  17627. @item
  17628. Complete example using @command{ffplay}:
  17629. @example
  17630. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17631. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17632. @end example
  17633. @end itemize
  17634. @section bench, abench
  17635. Benchmark part of a filtergraph.
  17636. The filter accepts the following options:
  17637. @table @option
  17638. @item action
  17639. Start or stop a timer.
  17640. Available values are:
  17641. @table @samp
  17642. @item start
  17643. Get the current time, set it as frame metadata (using the key
  17644. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17645. @item stop
  17646. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17647. the input frame metadata to get the time difference. Time difference, average,
  17648. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17649. @code{min}) are then printed. The timestamps are expressed in seconds.
  17650. @end table
  17651. @end table
  17652. @subsection Examples
  17653. @itemize
  17654. @item
  17655. Benchmark @ref{selectivecolor} filter:
  17656. @example
  17657. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17658. @end example
  17659. @end itemize
  17660. @section concat
  17661. Concatenate audio and video streams, joining them together one after the
  17662. other.
  17663. The filter works on segments of synchronized video and audio streams. All
  17664. segments must have the same number of streams of each type, and that will
  17665. also be the number of streams at output.
  17666. The filter accepts the following options:
  17667. @table @option
  17668. @item n
  17669. Set the number of segments. Default is 2.
  17670. @item v
  17671. Set the number of output video streams, that is also the number of video
  17672. streams in each segment. Default is 1.
  17673. @item a
  17674. Set the number of output audio streams, that is also the number of audio
  17675. streams in each segment. Default is 0.
  17676. @item unsafe
  17677. Activate unsafe mode: do not fail if segments have a different format.
  17678. @end table
  17679. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  17680. @var{a} audio outputs.
  17681. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  17682. segment, in the same order as the outputs, then the inputs for the second
  17683. segment, etc.
  17684. Related streams do not always have exactly the same duration, for various
  17685. reasons including codec frame size or sloppy authoring. For that reason,
  17686. related synchronized streams (e.g. a video and its audio track) should be
  17687. concatenated at once. The concat filter will use the duration of the longest
  17688. stream in each segment (except the last one), and if necessary pad shorter
  17689. audio streams with silence.
  17690. For this filter to work correctly, all segments must start at timestamp 0.
  17691. All corresponding streams must have the same parameters in all segments; the
  17692. filtering system will automatically select a common pixel format for video
  17693. streams, and a common sample format, sample rate and channel layout for
  17694. audio streams, but other settings, such as resolution, must be converted
  17695. explicitly by the user.
  17696. Different frame rates are acceptable but will result in variable frame rate
  17697. at output; be sure to configure the output file to handle it.
  17698. @subsection Examples
  17699. @itemize
  17700. @item
  17701. Concatenate an opening, an episode and an ending, all in bilingual version
  17702. (video in stream 0, audio in streams 1 and 2):
  17703. @example
  17704. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17705. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17706. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17707. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17708. @end example
  17709. @item
  17710. Concatenate two parts, handling audio and video separately, using the
  17711. (a)movie sources, and adjusting the resolution:
  17712. @example
  17713. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17714. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17715. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17716. @end example
  17717. Note that a desync will happen at the stitch if the audio and video streams
  17718. do not have exactly the same duration in the first file.
  17719. @end itemize
  17720. @subsection Commands
  17721. This filter supports the following commands:
  17722. @table @option
  17723. @item next
  17724. Close the current segment and step to the next one
  17725. @end table
  17726. @anchor{ebur128}
  17727. @section ebur128
  17728. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17729. level. By default, it logs a message at a frequency of 10Hz with the
  17730. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17731. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17732. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17733. sample format is double-precision floating point. The input stream will be converted to
  17734. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17735. after this filter to obtain the original parameters.
  17736. The filter also has a video output (see the @var{video} option) with a real
  17737. time graph to observe the loudness evolution. The graphic contains the logged
  17738. message mentioned above, so it is not printed anymore when this option is set,
  17739. unless the verbose logging is set. The main graphing area contains the
  17740. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17741. the momentary loudness (400 milliseconds), but can optionally be configured
  17742. to instead display short-term loudness (see @var{gauge}).
  17743. The green area marks a +/- 1LU target range around the target loudness
  17744. (-23LUFS by default, unless modified through @var{target}).
  17745. More information about the Loudness Recommendation EBU R128 on
  17746. @url{http://tech.ebu.ch/loudness}.
  17747. The filter accepts the following options:
  17748. @table @option
  17749. @item video
  17750. Activate the video output. The audio stream is passed unchanged whether this
  17751. option is set or no. The video stream will be the first output stream if
  17752. activated. Default is @code{0}.
  17753. @item size
  17754. Set the video size. This option is for video only. For the syntax of this
  17755. option, check the
  17756. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17757. Default and minimum resolution is @code{640x480}.
  17758. @item meter
  17759. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  17760. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  17761. other integer value between this range is allowed.
  17762. @item metadata
  17763. Set metadata injection. If set to @code{1}, the audio input will be segmented
  17764. into 100ms output frames, each of them containing various loudness information
  17765. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  17766. Default is @code{0}.
  17767. @item framelog
  17768. Force the frame logging level.
  17769. Available values are:
  17770. @table @samp
  17771. @item info
  17772. information logging level
  17773. @item verbose
  17774. verbose logging level
  17775. @end table
  17776. By default, the logging level is set to @var{info}. If the @option{video} or
  17777. the @option{metadata} options are set, it switches to @var{verbose}.
  17778. @item peak
  17779. Set peak mode(s).
  17780. Available modes can be cumulated (the option is a @code{flag} type). Possible
  17781. values are:
  17782. @table @samp
  17783. @item none
  17784. Disable any peak mode (default).
  17785. @item sample
  17786. Enable sample-peak mode.
  17787. Simple peak mode looking for the higher sample value. It logs a message
  17788. for sample-peak (identified by @code{SPK}).
  17789. @item true
  17790. Enable true-peak mode.
  17791. If enabled, the peak lookup is done on an over-sampled version of the input
  17792. stream for better peak accuracy. It logs a message for true-peak.
  17793. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17794. This mode requires a build with @code{libswresample}.
  17795. @end table
  17796. @item dualmono
  17797. Treat mono input files as "dual mono". If a mono file is intended for playback
  17798. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17799. If set to @code{true}, this option will compensate for this effect.
  17800. Multi-channel input files are not affected by this option.
  17801. @item panlaw
  17802. Set a specific pan law to be used for the measurement of dual mono files.
  17803. This parameter is optional, and has a default value of -3.01dB.
  17804. @item target
  17805. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17806. This parameter is optional and has a default value of -23LUFS as specified
  17807. by EBU R128. However, material published online may prefer a level of -16LUFS
  17808. (e.g. for use with podcasts or video platforms).
  17809. @item gauge
  17810. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17811. @code{shortterm}. By default the momentary value will be used, but in certain
  17812. scenarios it may be more useful to observe the short term value instead (e.g.
  17813. live mixing).
  17814. @item scale
  17815. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  17816. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  17817. video output, not the summary or continuous log output.
  17818. @end table
  17819. @subsection Examples
  17820. @itemize
  17821. @item
  17822. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  17823. @example
  17824. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  17825. @end example
  17826. @item
  17827. Run an analysis with @command{ffmpeg}:
  17828. @example
  17829. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  17830. @end example
  17831. @end itemize
  17832. @section interleave, ainterleave
  17833. Temporally interleave frames from several inputs.
  17834. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  17835. These filters read frames from several inputs and send the oldest
  17836. queued frame to the output.
  17837. Input streams must have well defined, monotonically increasing frame
  17838. timestamp values.
  17839. In order to submit one frame to output, these filters need to enqueue
  17840. at least one frame for each input, so they cannot work in case one
  17841. input is not yet terminated and will not receive incoming frames.
  17842. For example consider the case when one input is a @code{select} filter
  17843. which always drops input frames. The @code{interleave} filter will keep
  17844. reading from that input, but it will never be able to send new frames
  17845. to output until the input sends an end-of-stream signal.
  17846. Also, depending on inputs synchronization, the filters will drop
  17847. frames in case one input receives more frames than the other ones, and
  17848. the queue is already filled.
  17849. These filters accept the following options:
  17850. @table @option
  17851. @item nb_inputs, n
  17852. Set the number of different inputs, it is 2 by default.
  17853. @item duration
  17854. How to determine the end-of-stream.
  17855. @table @option
  17856. @item longest
  17857. The duration of the longest input. (default)
  17858. @item shortest
  17859. The duration of the shortest input.
  17860. @item first
  17861. The duration of the first input.
  17862. @end table
  17863. @end table
  17864. @subsection Examples
  17865. @itemize
  17866. @item
  17867. Interleave frames belonging to different streams using @command{ffmpeg}:
  17868. @example
  17869. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  17870. @end example
  17871. @item
  17872. Add flickering blur effect:
  17873. @example
  17874. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  17875. @end example
  17876. @end itemize
  17877. @section metadata, ametadata
  17878. Manipulate frame metadata.
  17879. This filter accepts the following options:
  17880. @table @option
  17881. @item mode
  17882. Set mode of operation of the filter.
  17883. Can be one of the following:
  17884. @table @samp
  17885. @item select
  17886. If both @code{value} and @code{key} is set, select frames
  17887. which have such metadata. If only @code{key} is set, select
  17888. every frame that has such key in metadata.
  17889. @item add
  17890. Add new metadata @code{key} and @code{value}. If key is already available
  17891. do nothing.
  17892. @item modify
  17893. Modify value of already present key.
  17894. @item delete
  17895. If @code{value} is set, delete only keys that have such value.
  17896. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  17897. the frame.
  17898. @item print
  17899. Print key and its value if metadata was found. If @code{key} is not set print all
  17900. metadata values available in frame.
  17901. @end table
  17902. @item key
  17903. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  17904. @item value
  17905. Set metadata value which will be used. This option is mandatory for
  17906. @code{modify} and @code{add} mode.
  17907. @item function
  17908. Which function to use when comparing metadata value and @code{value}.
  17909. Can be one of following:
  17910. @table @samp
  17911. @item same_str
  17912. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  17913. @item starts_with
  17914. Values are interpreted as strings, returns true if metadata value starts with
  17915. the @code{value} option string.
  17916. @item less
  17917. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  17918. @item equal
  17919. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  17920. @item greater
  17921. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  17922. @item expr
  17923. Values are interpreted as floats, returns true if expression from option @code{expr}
  17924. evaluates to true.
  17925. @item ends_with
  17926. Values are interpreted as strings, returns true if metadata value ends with
  17927. the @code{value} option string.
  17928. @end table
  17929. @item expr
  17930. Set expression which is used when @code{function} is set to @code{expr}.
  17931. The expression is evaluated through the eval API and can contain the following
  17932. constants:
  17933. @table @option
  17934. @item VALUE1
  17935. Float representation of @code{value} from metadata key.
  17936. @item VALUE2
  17937. Float representation of @code{value} as supplied by user in @code{value} option.
  17938. @end table
  17939. @item file
  17940. If specified in @code{print} mode, output is written to the named file. Instead of
  17941. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  17942. for standard output. If @code{file} option is not set, output is written to the log
  17943. with AV_LOG_INFO loglevel.
  17944. @item direct
  17945. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  17946. @end table
  17947. @subsection Examples
  17948. @itemize
  17949. @item
  17950. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  17951. between 0 and 1.
  17952. @example
  17953. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  17954. @end example
  17955. @item
  17956. Print silencedetect output to file @file{metadata.txt}.
  17957. @example
  17958. silencedetect,ametadata=mode=print:file=metadata.txt
  17959. @end example
  17960. @item
  17961. Direct all metadata to a pipe with file descriptor 4.
  17962. @example
  17963. metadata=mode=print:file='pipe\:4'
  17964. @end example
  17965. @end itemize
  17966. @section perms, aperms
  17967. Set read/write permissions for the output frames.
  17968. These filters are mainly aimed at developers to test direct path in the
  17969. following filter in the filtergraph.
  17970. The filters accept the following options:
  17971. @table @option
  17972. @item mode
  17973. Select the permissions mode.
  17974. It accepts the following values:
  17975. @table @samp
  17976. @item none
  17977. Do nothing. This is the default.
  17978. @item ro
  17979. Set all the output frames read-only.
  17980. @item rw
  17981. Set all the output frames directly writable.
  17982. @item toggle
  17983. Make the frame read-only if writable, and writable if read-only.
  17984. @item random
  17985. Set each output frame read-only or writable randomly.
  17986. @end table
  17987. @item seed
  17988. Set the seed for the @var{random} mode, must be an integer included between
  17989. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  17990. @code{-1}, the filter will try to use a good random seed on a best effort
  17991. basis.
  17992. @end table
  17993. Note: in case of auto-inserted filter between the permission filter and the
  17994. following one, the permission might not be received as expected in that
  17995. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  17996. perms/aperms filter can avoid this problem.
  17997. @section realtime, arealtime
  17998. Slow down filtering to match real time approximately.
  17999. These filters will pause the filtering for a variable amount of time to
  18000. match the output rate with the input timestamps.
  18001. They are similar to the @option{re} option to @code{ffmpeg}.
  18002. They accept the following options:
  18003. @table @option
  18004. @item limit
  18005. Time limit for the pauses. Any pause longer than that will be considered
  18006. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18007. @item speed
  18008. Speed factor for processing. The value must be a float larger than zero.
  18009. Values larger than 1.0 will result in faster than realtime processing,
  18010. smaller will slow processing down. The @var{limit} is automatically adapted
  18011. accordingly. Default is 1.0.
  18012. A processing speed faster than what is possible without these filters cannot
  18013. be achieved.
  18014. @end table
  18015. @anchor{select}
  18016. @section select, aselect
  18017. Select frames to pass in output.
  18018. This filter accepts the following options:
  18019. @table @option
  18020. @item expr, e
  18021. Set expression, which is evaluated for each input frame.
  18022. If the expression is evaluated to zero, the frame is discarded.
  18023. If the evaluation result is negative or NaN, the frame is sent to the
  18024. first output; otherwise it is sent to the output with index
  18025. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18026. For example a value of @code{1.2} corresponds to the output with index
  18027. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18028. @item outputs, n
  18029. Set the number of outputs. The output to which to send the selected
  18030. frame is based on the result of the evaluation. Default value is 1.
  18031. @end table
  18032. The expression can contain the following constants:
  18033. @table @option
  18034. @item n
  18035. The (sequential) number of the filtered frame, starting from 0.
  18036. @item selected_n
  18037. The (sequential) number of the selected frame, starting from 0.
  18038. @item prev_selected_n
  18039. The sequential number of the last selected frame. It's NAN if undefined.
  18040. @item TB
  18041. The timebase of the input timestamps.
  18042. @item pts
  18043. The PTS (Presentation TimeStamp) of the filtered video frame,
  18044. expressed in @var{TB} units. It's NAN if undefined.
  18045. @item t
  18046. The PTS of the filtered video frame,
  18047. expressed in seconds. It's NAN if undefined.
  18048. @item prev_pts
  18049. The PTS of the previously filtered video frame. It's NAN if undefined.
  18050. @item prev_selected_pts
  18051. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18052. @item prev_selected_t
  18053. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18054. @item start_pts
  18055. The PTS of the first video frame in the video. It's NAN if undefined.
  18056. @item start_t
  18057. The time of the first video frame in the video. It's NAN if undefined.
  18058. @item pict_type @emph{(video only)}
  18059. The type of the filtered frame. It can assume one of the following
  18060. values:
  18061. @table @option
  18062. @item I
  18063. @item P
  18064. @item B
  18065. @item S
  18066. @item SI
  18067. @item SP
  18068. @item BI
  18069. @end table
  18070. @item interlace_type @emph{(video only)}
  18071. The frame interlace type. It can assume one of the following values:
  18072. @table @option
  18073. @item PROGRESSIVE
  18074. The frame is progressive (not interlaced).
  18075. @item TOPFIRST
  18076. The frame is top-field-first.
  18077. @item BOTTOMFIRST
  18078. The frame is bottom-field-first.
  18079. @end table
  18080. @item consumed_sample_n @emph{(audio only)}
  18081. the number of selected samples before the current frame
  18082. @item samples_n @emph{(audio only)}
  18083. the number of samples in the current frame
  18084. @item sample_rate @emph{(audio only)}
  18085. the input sample rate
  18086. @item key
  18087. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18088. @item pos
  18089. the position in the file of the filtered frame, -1 if the information
  18090. is not available (e.g. for synthetic video)
  18091. @item scene @emph{(video only)}
  18092. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18093. probability for the current frame to introduce a new scene, while a higher
  18094. value means the current frame is more likely to be one (see the example below)
  18095. @item concatdec_select
  18096. The concat demuxer can select only part of a concat input file by setting an
  18097. inpoint and an outpoint, but the output packets may not be entirely contained
  18098. in the selected interval. By using this variable, it is possible to skip frames
  18099. generated by the concat demuxer which are not exactly contained in the selected
  18100. interval.
  18101. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18102. and the @var{lavf.concat.duration} packet metadata values which are also
  18103. present in the decoded frames.
  18104. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18105. start_time and either the duration metadata is missing or the frame pts is less
  18106. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18107. missing.
  18108. That basically means that an input frame is selected if its pts is within the
  18109. interval set by the concat demuxer.
  18110. @end table
  18111. The default value of the select expression is "1".
  18112. @subsection Examples
  18113. @itemize
  18114. @item
  18115. Select all frames in input:
  18116. @example
  18117. select
  18118. @end example
  18119. The example above is the same as:
  18120. @example
  18121. select=1
  18122. @end example
  18123. @item
  18124. Skip all frames:
  18125. @example
  18126. select=0
  18127. @end example
  18128. @item
  18129. Select only I-frames:
  18130. @example
  18131. select='eq(pict_type\,I)'
  18132. @end example
  18133. @item
  18134. Select one frame every 100:
  18135. @example
  18136. select='not(mod(n\,100))'
  18137. @end example
  18138. @item
  18139. Select only frames contained in the 10-20 time interval:
  18140. @example
  18141. select=between(t\,10\,20)
  18142. @end example
  18143. @item
  18144. Select only I-frames contained in the 10-20 time interval:
  18145. @example
  18146. select=between(t\,10\,20)*eq(pict_type\,I)
  18147. @end example
  18148. @item
  18149. Select frames with a minimum distance of 10 seconds:
  18150. @example
  18151. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18152. @end example
  18153. @item
  18154. Use aselect to select only audio frames with samples number > 100:
  18155. @example
  18156. aselect='gt(samples_n\,100)'
  18157. @end example
  18158. @item
  18159. Create a mosaic of the first scenes:
  18160. @example
  18161. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18162. @end example
  18163. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18164. choice.
  18165. @item
  18166. Send even and odd frames to separate outputs, and compose them:
  18167. @example
  18168. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18169. @end example
  18170. @item
  18171. Select useful frames from an ffconcat file which is using inpoints and
  18172. outpoints but where the source files are not intra frame only.
  18173. @example
  18174. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18175. @end example
  18176. @end itemize
  18177. @section sendcmd, asendcmd
  18178. Send commands to filters in the filtergraph.
  18179. These filters read commands to be sent to other filters in the
  18180. filtergraph.
  18181. @code{sendcmd} must be inserted between two video filters,
  18182. @code{asendcmd} must be inserted between two audio filters, but apart
  18183. from that they act the same way.
  18184. The specification of commands can be provided in the filter arguments
  18185. with the @var{commands} option, or in a file specified by the
  18186. @var{filename} option.
  18187. These filters accept the following options:
  18188. @table @option
  18189. @item commands, c
  18190. Set the commands to be read and sent to the other filters.
  18191. @item filename, f
  18192. Set the filename of the commands to be read and sent to the other
  18193. filters.
  18194. @end table
  18195. @subsection Commands syntax
  18196. A commands description consists of a sequence of interval
  18197. specifications, comprising a list of commands to be executed when a
  18198. particular event related to that interval occurs. The occurring event
  18199. is typically the current frame time entering or leaving a given time
  18200. interval.
  18201. An interval is specified by the following syntax:
  18202. @example
  18203. @var{START}[-@var{END}] @var{COMMANDS};
  18204. @end example
  18205. The time interval is specified by the @var{START} and @var{END} times.
  18206. @var{END} is optional and defaults to the maximum time.
  18207. The current frame time is considered within the specified interval if
  18208. it is included in the interval [@var{START}, @var{END}), that is when
  18209. the time is greater or equal to @var{START} and is lesser than
  18210. @var{END}.
  18211. @var{COMMANDS} consists of a sequence of one or more command
  18212. specifications, separated by ",", relating to that interval. The
  18213. syntax of a command specification is given by:
  18214. @example
  18215. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18216. @end example
  18217. @var{FLAGS} is optional and specifies the type of events relating to
  18218. the time interval which enable sending the specified command, and must
  18219. be a non-null sequence of identifier flags separated by "+" or "|" and
  18220. enclosed between "[" and "]".
  18221. The following flags are recognized:
  18222. @table @option
  18223. @item enter
  18224. The command is sent when the current frame timestamp enters the
  18225. specified interval. In other words, the command is sent when the
  18226. previous frame timestamp was not in the given interval, and the
  18227. current is.
  18228. @item leave
  18229. The command is sent when the current frame timestamp leaves the
  18230. specified interval. In other words, the command is sent when the
  18231. previous frame timestamp was in the given interval, and the
  18232. current is not.
  18233. @item expr
  18234. The command @var{ARG} is interpreted as expression and result of
  18235. expression is passed as @var{ARG}.
  18236. The expression is evaluated through the eval API and can contain the following
  18237. constants:
  18238. @table @option
  18239. @item POS
  18240. Original position in the file of the frame, or undefined if undefined
  18241. for the current frame.
  18242. @item PTS
  18243. The presentation timestamp in input.
  18244. @item N
  18245. The count of the input frame for video or audio, starting from 0.
  18246. @item T
  18247. The time in seconds of the current frame.
  18248. @item TS
  18249. The start time in seconds of the current command interval.
  18250. @item TE
  18251. The end time in seconds of the current command interval.
  18252. @item TI
  18253. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18254. @end table
  18255. @end table
  18256. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18257. assumed.
  18258. @var{TARGET} specifies the target of the command, usually the name of
  18259. the filter class or a specific filter instance name.
  18260. @var{COMMAND} specifies the name of the command for the target filter.
  18261. @var{ARG} is optional and specifies the optional list of argument for
  18262. the given @var{COMMAND}.
  18263. Between one interval specification and another, whitespaces, or
  18264. sequences of characters starting with @code{#} until the end of line,
  18265. are ignored and can be used to annotate comments.
  18266. A simplified BNF description of the commands specification syntax
  18267. follows:
  18268. @example
  18269. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18270. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18271. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18272. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18273. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18274. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18275. @end example
  18276. @subsection Examples
  18277. @itemize
  18278. @item
  18279. Specify audio tempo change at second 4:
  18280. @example
  18281. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18282. @end example
  18283. @item
  18284. Target a specific filter instance:
  18285. @example
  18286. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18287. @end example
  18288. @item
  18289. Specify a list of drawtext and hue commands in a file.
  18290. @example
  18291. # show text in the interval 5-10
  18292. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18293. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18294. # desaturate the image in the interval 15-20
  18295. 15.0-20.0 [enter] hue s 0,
  18296. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18297. [leave] hue s 1,
  18298. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18299. # apply an exponential saturation fade-out effect, starting from time 25
  18300. 25 [enter] hue s exp(25-t)
  18301. @end example
  18302. A filtergraph allowing to read and process the above command list
  18303. stored in a file @file{test.cmd}, can be specified with:
  18304. @example
  18305. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18306. @end example
  18307. @end itemize
  18308. @anchor{setpts}
  18309. @section setpts, asetpts
  18310. Change the PTS (presentation timestamp) of the input frames.
  18311. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18312. This filter accepts the following options:
  18313. @table @option
  18314. @item expr
  18315. The expression which is evaluated for each frame to construct its timestamp.
  18316. @end table
  18317. The expression is evaluated through the eval API and can contain the following
  18318. constants:
  18319. @table @option
  18320. @item FRAME_RATE, FR
  18321. frame rate, only defined for constant frame-rate video
  18322. @item PTS
  18323. The presentation timestamp in input
  18324. @item N
  18325. The count of the input frame for video or the number of consumed samples,
  18326. not including the current frame for audio, starting from 0.
  18327. @item NB_CONSUMED_SAMPLES
  18328. The number of consumed samples, not including the current frame (only
  18329. audio)
  18330. @item NB_SAMPLES, S
  18331. The number of samples in the current frame (only audio)
  18332. @item SAMPLE_RATE, SR
  18333. The audio sample rate.
  18334. @item STARTPTS
  18335. The PTS of the first frame.
  18336. @item STARTT
  18337. the time in seconds of the first frame
  18338. @item INTERLACED
  18339. State whether the current frame is interlaced.
  18340. @item T
  18341. the time in seconds of the current frame
  18342. @item POS
  18343. original position in the file of the frame, or undefined if undefined
  18344. for the current frame
  18345. @item PREV_INPTS
  18346. The previous input PTS.
  18347. @item PREV_INT
  18348. previous input time in seconds
  18349. @item PREV_OUTPTS
  18350. The previous output PTS.
  18351. @item PREV_OUTT
  18352. previous output time in seconds
  18353. @item RTCTIME
  18354. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18355. instead.
  18356. @item RTCSTART
  18357. The wallclock (RTC) time at the start of the movie in microseconds.
  18358. @item TB
  18359. The timebase of the input timestamps.
  18360. @end table
  18361. @subsection Examples
  18362. @itemize
  18363. @item
  18364. Start counting PTS from zero
  18365. @example
  18366. setpts=PTS-STARTPTS
  18367. @end example
  18368. @item
  18369. Apply fast motion effect:
  18370. @example
  18371. setpts=0.5*PTS
  18372. @end example
  18373. @item
  18374. Apply slow motion effect:
  18375. @example
  18376. setpts=2.0*PTS
  18377. @end example
  18378. @item
  18379. Set fixed rate of 25 frames per second:
  18380. @example
  18381. setpts=N/(25*TB)
  18382. @end example
  18383. @item
  18384. Set fixed rate 25 fps with some jitter:
  18385. @example
  18386. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18387. @end example
  18388. @item
  18389. Apply an offset of 10 seconds to the input PTS:
  18390. @example
  18391. setpts=PTS+10/TB
  18392. @end example
  18393. @item
  18394. Generate timestamps from a "live source" and rebase onto the current timebase:
  18395. @example
  18396. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18397. @end example
  18398. @item
  18399. Generate timestamps by counting samples:
  18400. @example
  18401. asetpts=N/SR/TB
  18402. @end example
  18403. @end itemize
  18404. @section setrange
  18405. Force color range for the output video frame.
  18406. The @code{setrange} filter marks the color range property for the
  18407. output frames. It does not change the input frame, but only sets the
  18408. corresponding property, which affects how the frame is treated by
  18409. following filters.
  18410. The filter accepts the following options:
  18411. @table @option
  18412. @item range
  18413. Available values are:
  18414. @table @samp
  18415. @item auto
  18416. Keep the same color range property.
  18417. @item unspecified, unknown
  18418. Set the color range as unspecified.
  18419. @item limited, tv, mpeg
  18420. Set the color range as limited.
  18421. @item full, pc, jpeg
  18422. Set the color range as full.
  18423. @end table
  18424. @end table
  18425. @section settb, asettb
  18426. Set the timebase to use for the output frames timestamps.
  18427. It is mainly useful for testing timebase configuration.
  18428. It accepts the following parameters:
  18429. @table @option
  18430. @item expr, tb
  18431. The expression which is evaluated into the output timebase.
  18432. @end table
  18433. The value for @option{tb} is an arithmetic expression representing a
  18434. rational. The expression can contain the constants "AVTB" (the default
  18435. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18436. audio only). Default value is "intb".
  18437. @subsection Examples
  18438. @itemize
  18439. @item
  18440. Set the timebase to 1/25:
  18441. @example
  18442. settb=expr=1/25
  18443. @end example
  18444. @item
  18445. Set the timebase to 1/10:
  18446. @example
  18447. settb=expr=0.1
  18448. @end example
  18449. @item
  18450. Set the timebase to 1001/1000:
  18451. @example
  18452. settb=1+0.001
  18453. @end example
  18454. @item
  18455. Set the timebase to 2*intb:
  18456. @example
  18457. settb=2*intb
  18458. @end example
  18459. @item
  18460. Set the default timebase value:
  18461. @example
  18462. settb=AVTB
  18463. @end example
  18464. @end itemize
  18465. @section showcqt
  18466. Convert input audio to a video output representing frequency spectrum
  18467. logarithmically using Brown-Puckette constant Q transform algorithm with
  18468. direct frequency domain coefficient calculation (but the transform itself
  18469. is not really constant Q, instead the Q factor is actually variable/clamped),
  18470. with musical tone scale, from E0 to D#10.
  18471. The filter accepts the following options:
  18472. @table @option
  18473. @item size, s
  18474. Specify the video size for the output. It must be even. For the syntax of this option,
  18475. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18476. Default value is @code{1920x1080}.
  18477. @item fps, rate, r
  18478. Set the output frame rate. Default value is @code{25}.
  18479. @item bar_h
  18480. Set the bargraph height. It must be even. Default value is @code{-1} which
  18481. computes the bargraph height automatically.
  18482. @item axis_h
  18483. Set the axis height. It must be even. Default value is @code{-1} which computes
  18484. the axis height automatically.
  18485. @item sono_h
  18486. Set the sonogram height. It must be even. Default value is @code{-1} which
  18487. computes the sonogram height automatically.
  18488. @item fullhd
  18489. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18490. instead. Default value is @code{1}.
  18491. @item sono_v, volume
  18492. Specify the sonogram volume expression. It can contain variables:
  18493. @table @option
  18494. @item bar_v
  18495. the @var{bar_v} evaluated expression
  18496. @item frequency, freq, f
  18497. the frequency where it is evaluated
  18498. @item timeclamp, tc
  18499. the value of @var{timeclamp} option
  18500. @end table
  18501. and functions:
  18502. @table @option
  18503. @item a_weighting(f)
  18504. A-weighting of equal loudness
  18505. @item b_weighting(f)
  18506. B-weighting of equal loudness
  18507. @item c_weighting(f)
  18508. C-weighting of equal loudness.
  18509. @end table
  18510. Default value is @code{16}.
  18511. @item bar_v, volume2
  18512. Specify the bargraph volume expression. It can contain variables:
  18513. @table @option
  18514. @item sono_v
  18515. the @var{sono_v} evaluated expression
  18516. @item frequency, freq, f
  18517. the frequency where it is evaluated
  18518. @item timeclamp, tc
  18519. the value of @var{timeclamp} option
  18520. @end table
  18521. and functions:
  18522. @table @option
  18523. @item a_weighting(f)
  18524. A-weighting of equal loudness
  18525. @item b_weighting(f)
  18526. B-weighting of equal loudness
  18527. @item c_weighting(f)
  18528. C-weighting of equal loudness.
  18529. @end table
  18530. Default value is @code{sono_v}.
  18531. @item sono_g, gamma
  18532. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18533. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18534. Acceptable range is @code{[1, 7]}.
  18535. @item bar_g, gamma2
  18536. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18537. @code{[1, 7]}.
  18538. @item bar_t
  18539. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18540. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18541. @item timeclamp, tc
  18542. Specify the transform timeclamp. At low frequency, there is trade-off between
  18543. accuracy in time domain and frequency domain. If timeclamp is lower,
  18544. event in time domain is represented more accurately (such as fast bass drum),
  18545. otherwise event in frequency domain is represented more accurately
  18546. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18547. @item attack
  18548. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18549. limits future samples by applying asymmetric windowing in time domain, useful
  18550. when low latency is required. Accepted range is @code{[0, 1]}.
  18551. @item basefreq
  18552. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18553. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18554. @item endfreq
  18555. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18556. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18557. @item coeffclamp
  18558. This option is deprecated and ignored.
  18559. @item tlength
  18560. Specify the transform length in time domain. Use this option to control accuracy
  18561. trade-off between time domain and frequency domain at every frequency sample.
  18562. It can contain variables:
  18563. @table @option
  18564. @item frequency, freq, f
  18565. the frequency where it is evaluated
  18566. @item timeclamp, tc
  18567. the value of @var{timeclamp} option.
  18568. @end table
  18569. Default value is @code{384*tc/(384+tc*f)}.
  18570. @item count
  18571. Specify the transform count for every video frame. Default value is @code{6}.
  18572. Acceptable range is @code{[1, 30]}.
  18573. @item fcount
  18574. Specify the transform count for every single pixel. Default value is @code{0},
  18575. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18576. @item fontfile
  18577. Specify font file for use with freetype to draw the axis. If not specified,
  18578. use embedded font. Note that drawing with font file or embedded font is not
  18579. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18580. option instead.
  18581. @item font
  18582. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18583. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18584. escaping.
  18585. @item fontcolor
  18586. Specify font color expression. This is arithmetic expression that should return
  18587. integer value 0xRRGGBB. It can contain variables:
  18588. @table @option
  18589. @item frequency, freq, f
  18590. the frequency where it is evaluated
  18591. @item timeclamp, tc
  18592. the value of @var{timeclamp} option
  18593. @end table
  18594. and functions:
  18595. @table @option
  18596. @item midi(f)
  18597. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18598. @item r(x), g(x), b(x)
  18599. red, green, and blue value of intensity x.
  18600. @end table
  18601. Default value is @code{st(0, (midi(f)-59.5)/12);
  18602. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18603. r(1-ld(1)) + b(ld(1))}.
  18604. @item axisfile
  18605. Specify image file to draw the axis. This option override @var{fontfile} and
  18606. @var{fontcolor} option.
  18607. @item axis, text
  18608. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18609. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18610. Default value is @code{1}.
  18611. @item csp
  18612. Set colorspace. The accepted values are:
  18613. @table @samp
  18614. @item unspecified
  18615. Unspecified (default)
  18616. @item bt709
  18617. BT.709
  18618. @item fcc
  18619. FCC
  18620. @item bt470bg
  18621. BT.470BG or BT.601-6 625
  18622. @item smpte170m
  18623. SMPTE-170M or BT.601-6 525
  18624. @item smpte240m
  18625. SMPTE-240M
  18626. @item bt2020ncl
  18627. BT.2020 with non-constant luminance
  18628. @end table
  18629. @item cscheme
  18630. Set spectrogram color scheme. This is list of floating point values with format
  18631. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18632. The default is @code{1|0.5|0|0|0.5|1}.
  18633. @end table
  18634. @subsection Examples
  18635. @itemize
  18636. @item
  18637. Playing audio while showing the spectrum:
  18638. @example
  18639. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18640. @end example
  18641. @item
  18642. Same as above, but with frame rate 30 fps:
  18643. @example
  18644. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18645. @end example
  18646. @item
  18647. Playing at 1280x720:
  18648. @example
  18649. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18650. @end example
  18651. @item
  18652. Disable sonogram display:
  18653. @example
  18654. sono_h=0
  18655. @end example
  18656. @item
  18657. A1 and its harmonics: A1, A2, (near)E3, A3:
  18658. @example
  18659. 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),
  18660. asplit[a][out1]; [a] showcqt [out0]'
  18661. @end example
  18662. @item
  18663. Same as above, but with more accuracy in frequency domain:
  18664. @example
  18665. 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),
  18666. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  18667. @end example
  18668. @item
  18669. Custom volume:
  18670. @example
  18671. bar_v=10:sono_v=bar_v*a_weighting(f)
  18672. @end example
  18673. @item
  18674. Custom gamma, now spectrum is linear to the amplitude.
  18675. @example
  18676. bar_g=2:sono_g=2
  18677. @end example
  18678. @item
  18679. Custom tlength equation:
  18680. @example
  18681. 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)))'
  18682. @end example
  18683. @item
  18684. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  18685. @example
  18686. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  18687. @end example
  18688. @item
  18689. Custom font using fontconfig:
  18690. @example
  18691. font='Courier New,Monospace,mono|bold'
  18692. @end example
  18693. @item
  18694. Custom frequency range with custom axis using image file:
  18695. @example
  18696. axisfile=myaxis.png:basefreq=40:endfreq=10000
  18697. @end example
  18698. @end itemize
  18699. @section showfreqs
  18700. Convert input audio to video output representing the audio power spectrum.
  18701. Audio amplitude is on Y-axis while frequency is on X-axis.
  18702. The filter accepts the following options:
  18703. @table @option
  18704. @item size, s
  18705. Specify size of video. For the syntax of this option, check the
  18706. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18707. Default is @code{1024x512}.
  18708. @item mode
  18709. Set display mode.
  18710. This set how each frequency bin will be represented.
  18711. It accepts the following values:
  18712. @table @samp
  18713. @item line
  18714. @item bar
  18715. @item dot
  18716. @end table
  18717. Default is @code{bar}.
  18718. @item ascale
  18719. Set amplitude scale.
  18720. It accepts the following values:
  18721. @table @samp
  18722. @item lin
  18723. Linear scale.
  18724. @item sqrt
  18725. Square root scale.
  18726. @item cbrt
  18727. Cubic root scale.
  18728. @item log
  18729. Logarithmic scale.
  18730. @end table
  18731. Default is @code{log}.
  18732. @item fscale
  18733. Set frequency scale.
  18734. It accepts the following values:
  18735. @table @samp
  18736. @item lin
  18737. Linear scale.
  18738. @item log
  18739. Logarithmic scale.
  18740. @item rlog
  18741. Reverse logarithmic scale.
  18742. @end table
  18743. Default is @code{lin}.
  18744. @item win_size
  18745. Set window size. Allowed range is from 16 to 65536.
  18746. Default is @code{2048}
  18747. @item win_func
  18748. Set windowing function.
  18749. It accepts the following values:
  18750. @table @samp
  18751. @item rect
  18752. @item bartlett
  18753. @item hanning
  18754. @item hamming
  18755. @item blackman
  18756. @item welch
  18757. @item flattop
  18758. @item bharris
  18759. @item bnuttall
  18760. @item bhann
  18761. @item sine
  18762. @item nuttall
  18763. @item lanczos
  18764. @item gauss
  18765. @item tukey
  18766. @item dolph
  18767. @item cauchy
  18768. @item parzen
  18769. @item poisson
  18770. @item bohman
  18771. @end table
  18772. Default is @code{hanning}.
  18773. @item overlap
  18774. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18775. which means optimal overlap for selected window function will be picked.
  18776. @item averaging
  18777. Set time averaging. Setting this to 0 will display current maximal peaks.
  18778. Default is @code{1}, which means time averaging is disabled.
  18779. @item colors
  18780. Specify list of colors separated by space or by '|' which will be used to
  18781. draw channel frequencies. Unrecognized or missing colors will be replaced
  18782. by white color.
  18783. @item cmode
  18784. Set channel display mode.
  18785. It accepts the following values:
  18786. @table @samp
  18787. @item combined
  18788. @item separate
  18789. @end table
  18790. Default is @code{combined}.
  18791. @item minamp
  18792. Set minimum amplitude used in @code{log} amplitude scaler.
  18793. @end table
  18794. @section showspatial
  18795. Convert stereo input audio to a video output, representing the spatial relationship
  18796. between two channels.
  18797. The filter accepts the following options:
  18798. @table @option
  18799. @item size, s
  18800. Specify the video size for the output. For the syntax of this option, check the
  18801. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18802. Default value is @code{512x512}.
  18803. @item win_size
  18804. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  18805. @item win_func
  18806. Set window function.
  18807. It accepts the following values:
  18808. @table @samp
  18809. @item rect
  18810. @item bartlett
  18811. @item hann
  18812. @item hanning
  18813. @item hamming
  18814. @item blackman
  18815. @item welch
  18816. @item flattop
  18817. @item bharris
  18818. @item bnuttall
  18819. @item bhann
  18820. @item sine
  18821. @item nuttall
  18822. @item lanczos
  18823. @item gauss
  18824. @item tukey
  18825. @item dolph
  18826. @item cauchy
  18827. @item parzen
  18828. @item poisson
  18829. @item bohman
  18830. @end table
  18831. Default value is @code{hann}.
  18832. @item overlap
  18833. Set ratio of overlap window. Default value is @code{0.5}.
  18834. When value is @code{1} overlap is set to recommended size for specific
  18835. window function currently used.
  18836. @end table
  18837. @anchor{showspectrum}
  18838. @section showspectrum
  18839. Convert input audio to a video output, representing the audio frequency
  18840. spectrum.
  18841. The filter accepts the following options:
  18842. @table @option
  18843. @item size, s
  18844. Specify the video size for the output. For the syntax of this option, check the
  18845. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18846. Default value is @code{640x512}.
  18847. @item slide
  18848. Specify how the spectrum should slide along the window.
  18849. It accepts the following values:
  18850. @table @samp
  18851. @item replace
  18852. the samples start again on the left when they reach the right
  18853. @item scroll
  18854. the samples scroll from right to left
  18855. @item fullframe
  18856. frames are only produced when the samples reach the right
  18857. @item rscroll
  18858. the samples scroll from left to right
  18859. @end table
  18860. Default value is @code{replace}.
  18861. @item mode
  18862. Specify display mode.
  18863. It accepts the following values:
  18864. @table @samp
  18865. @item combined
  18866. all channels are displayed in the same row
  18867. @item separate
  18868. all channels are displayed in separate rows
  18869. @end table
  18870. Default value is @samp{combined}.
  18871. @item color
  18872. Specify display color mode.
  18873. It accepts the following values:
  18874. @table @samp
  18875. @item channel
  18876. each channel is displayed in a separate color
  18877. @item intensity
  18878. each channel is displayed using the same color scheme
  18879. @item rainbow
  18880. each channel is displayed using the rainbow color scheme
  18881. @item moreland
  18882. each channel is displayed using the moreland color scheme
  18883. @item nebulae
  18884. each channel is displayed using the nebulae color scheme
  18885. @item fire
  18886. each channel is displayed using the fire color scheme
  18887. @item fiery
  18888. each channel is displayed using the fiery color scheme
  18889. @item fruit
  18890. each channel is displayed using the fruit color scheme
  18891. @item cool
  18892. each channel is displayed using the cool color scheme
  18893. @item magma
  18894. each channel is displayed using the magma color scheme
  18895. @item green
  18896. each channel is displayed using the green color scheme
  18897. @item viridis
  18898. each channel is displayed using the viridis color scheme
  18899. @item plasma
  18900. each channel is displayed using the plasma color scheme
  18901. @item cividis
  18902. each channel is displayed using the cividis color scheme
  18903. @item terrain
  18904. each channel is displayed using the terrain color scheme
  18905. @end table
  18906. Default value is @samp{channel}.
  18907. @item scale
  18908. Specify scale used for calculating intensity color values.
  18909. It accepts the following values:
  18910. @table @samp
  18911. @item lin
  18912. linear
  18913. @item sqrt
  18914. square root, default
  18915. @item cbrt
  18916. cubic root
  18917. @item log
  18918. logarithmic
  18919. @item 4thrt
  18920. 4th root
  18921. @item 5thrt
  18922. 5th root
  18923. @end table
  18924. Default value is @samp{sqrt}.
  18925. @item fscale
  18926. Specify frequency scale.
  18927. It accepts the following values:
  18928. @table @samp
  18929. @item lin
  18930. linear
  18931. @item log
  18932. logarithmic
  18933. @end table
  18934. Default value is @samp{lin}.
  18935. @item saturation
  18936. Set saturation modifier for displayed colors. Negative values provide
  18937. alternative color scheme. @code{0} is no saturation at all.
  18938. Saturation must be in [-10.0, 10.0] range.
  18939. Default value is @code{1}.
  18940. @item win_func
  18941. Set window function.
  18942. It accepts the following values:
  18943. @table @samp
  18944. @item rect
  18945. @item bartlett
  18946. @item hann
  18947. @item hanning
  18948. @item hamming
  18949. @item blackman
  18950. @item welch
  18951. @item flattop
  18952. @item bharris
  18953. @item bnuttall
  18954. @item bhann
  18955. @item sine
  18956. @item nuttall
  18957. @item lanczos
  18958. @item gauss
  18959. @item tukey
  18960. @item dolph
  18961. @item cauchy
  18962. @item parzen
  18963. @item poisson
  18964. @item bohman
  18965. @end table
  18966. Default value is @code{hann}.
  18967. @item orientation
  18968. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18969. @code{horizontal}. Default is @code{vertical}.
  18970. @item overlap
  18971. Set ratio of overlap window. Default value is @code{0}.
  18972. When value is @code{1} overlap is set to recommended size for specific
  18973. window function currently used.
  18974. @item gain
  18975. Set scale gain for calculating intensity color values.
  18976. Default value is @code{1}.
  18977. @item data
  18978. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  18979. @item rotation
  18980. Set color rotation, must be in [-1.0, 1.0] range.
  18981. Default value is @code{0}.
  18982. @item start
  18983. Set start frequency from which to display spectrogram. Default is @code{0}.
  18984. @item stop
  18985. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18986. @item fps
  18987. Set upper frame rate limit. Default is @code{auto}, unlimited.
  18988. @item legend
  18989. Draw time and frequency axes and legends. Default is disabled.
  18990. @end table
  18991. The usage is very similar to the showwaves filter; see the examples in that
  18992. section.
  18993. @subsection Examples
  18994. @itemize
  18995. @item
  18996. Large window with logarithmic color scaling:
  18997. @example
  18998. showspectrum=s=1280x480:scale=log
  18999. @end example
  19000. @item
  19001. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19002. @example
  19003. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19004. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19005. @end example
  19006. @end itemize
  19007. @section showspectrumpic
  19008. Convert input audio to a single video frame, representing the audio frequency
  19009. spectrum.
  19010. The filter accepts the following options:
  19011. @table @option
  19012. @item size, s
  19013. Specify the video size for the output. For the syntax of this option, check the
  19014. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19015. Default value is @code{4096x2048}.
  19016. @item mode
  19017. Specify display mode.
  19018. It accepts the following values:
  19019. @table @samp
  19020. @item combined
  19021. all channels are displayed in the same row
  19022. @item separate
  19023. all channels are displayed in separate rows
  19024. @end table
  19025. Default value is @samp{combined}.
  19026. @item color
  19027. Specify display color mode.
  19028. It accepts the following values:
  19029. @table @samp
  19030. @item channel
  19031. each channel is displayed in a separate color
  19032. @item intensity
  19033. each channel is displayed using the same color scheme
  19034. @item rainbow
  19035. each channel is displayed using the rainbow color scheme
  19036. @item moreland
  19037. each channel is displayed using the moreland color scheme
  19038. @item nebulae
  19039. each channel is displayed using the nebulae color scheme
  19040. @item fire
  19041. each channel is displayed using the fire color scheme
  19042. @item fiery
  19043. each channel is displayed using the fiery color scheme
  19044. @item fruit
  19045. each channel is displayed using the fruit color scheme
  19046. @item cool
  19047. each channel is displayed using the cool color scheme
  19048. @item magma
  19049. each channel is displayed using the magma color scheme
  19050. @item green
  19051. each channel is displayed using the green color scheme
  19052. @item viridis
  19053. each channel is displayed using the viridis color scheme
  19054. @item plasma
  19055. each channel is displayed using the plasma color scheme
  19056. @item cividis
  19057. each channel is displayed using the cividis color scheme
  19058. @item terrain
  19059. each channel is displayed using the terrain color scheme
  19060. @end table
  19061. Default value is @samp{intensity}.
  19062. @item scale
  19063. Specify scale used for calculating intensity color values.
  19064. It accepts the following values:
  19065. @table @samp
  19066. @item lin
  19067. linear
  19068. @item sqrt
  19069. square root, default
  19070. @item cbrt
  19071. cubic root
  19072. @item log
  19073. logarithmic
  19074. @item 4thrt
  19075. 4th root
  19076. @item 5thrt
  19077. 5th root
  19078. @end table
  19079. Default value is @samp{log}.
  19080. @item fscale
  19081. Specify frequency scale.
  19082. It accepts the following values:
  19083. @table @samp
  19084. @item lin
  19085. linear
  19086. @item log
  19087. logarithmic
  19088. @end table
  19089. Default value is @samp{lin}.
  19090. @item saturation
  19091. Set saturation modifier for displayed colors. Negative values provide
  19092. alternative color scheme. @code{0} is no saturation at all.
  19093. Saturation must be in [-10.0, 10.0] range.
  19094. Default value is @code{1}.
  19095. @item win_func
  19096. Set window function.
  19097. It accepts the following values:
  19098. @table @samp
  19099. @item rect
  19100. @item bartlett
  19101. @item hann
  19102. @item hanning
  19103. @item hamming
  19104. @item blackman
  19105. @item welch
  19106. @item flattop
  19107. @item bharris
  19108. @item bnuttall
  19109. @item bhann
  19110. @item sine
  19111. @item nuttall
  19112. @item lanczos
  19113. @item gauss
  19114. @item tukey
  19115. @item dolph
  19116. @item cauchy
  19117. @item parzen
  19118. @item poisson
  19119. @item bohman
  19120. @end table
  19121. Default value is @code{hann}.
  19122. @item orientation
  19123. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19124. @code{horizontal}. Default is @code{vertical}.
  19125. @item gain
  19126. Set scale gain for calculating intensity color values.
  19127. Default value is @code{1}.
  19128. @item legend
  19129. Draw time and frequency axes and legends. Default is enabled.
  19130. @item rotation
  19131. Set color rotation, must be in [-1.0, 1.0] range.
  19132. Default value is @code{0}.
  19133. @item start
  19134. Set start frequency from which to display spectrogram. Default is @code{0}.
  19135. @item stop
  19136. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19137. @end table
  19138. @subsection Examples
  19139. @itemize
  19140. @item
  19141. Extract an audio spectrogram of a whole audio track
  19142. in a 1024x1024 picture using @command{ffmpeg}:
  19143. @example
  19144. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19145. @end example
  19146. @end itemize
  19147. @section showvolume
  19148. Convert input audio volume to a video output.
  19149. The filter accepts the following options:
  19150. @table @option
  19151. @item rate, r
  19152. Set video rate.
  19153. @item b
  19154. Set border width, allowed range is [0, 5]. Default is 1.
  19155. @item w
  19156. Set channel width, allowed range is [80, 8192]. Default is 400.
  19157. @item h
  19158. Set channel height, allowed range is [1, 900]. Default is 20.
  19159. @item f
  19160. Set fade, allowed range is [0, 1]. Default is 0.95.
  19161. @item c
  19162. Set volume color expression.
  19163. The expression can use the following variables:
  19164. @table @option
  19165. @item VOLUME
  19166. Current max volume of channel in dB.
  19167. @item PEAK
  19168. Current peak.
  19169. @item CHANNEL
  19170. Current channel number, starting from 0.
  19171. @end table
  19172. @item t
  19173. If set, displays channel names. Default is enabled.
  19174. @item v
  19175. If set, displays volume values. Default is enabled.
  19176. @item o
  19177. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19178. default is @code{h}.
  19179. @item s
  19180. Set step size, allowed range is [0, 5]. Default is 0, which means
  19181. step is disabled.
  19182. @item p
  19183. Set background opacity, allowed range is [0, 1]. Default is 0.
  19184. @item m
  19185. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19186. default is @code{p}.
  19187. @item ds
  19188. Set display scale, can be linear: @code{lin} or log: @code{log},
  19189. default is @code{lin}.
  19190. @item dm
  19191. In second.
  19192. If set to > 0., display a line for the max level
  19193. in the previous seconds.
  19194. default is disabled: @code{0.}
  19195. @item dmc
  19196. The color of the max line. Use when @code{dm} option is set to > 0.
  19197. default is: @code{orange}
  19198. @end table
  19199. @section showwaves
  19200. Convert input audio to a video output, representing the samples waves.
  19201. The filter accepts the following options:
  19202. @table @option
  19203. @item size, s
  19204. Specify the video size for the output. For the syntax of this option, check the
  19205. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19206. Default value is @code{600x240}.
  19207. @item mode
  19208. Set display mode.
  19209. Available values are:
  19210. @table @samp
  19211. @item point
  19212. Draw a point for each sample.
  19213. @item line
  19214. Draw a vertical line for each sample.
  19215. @item p2p
  19216. Draw a point for each sample and a line between them.
  19217. @item cline
  19218. Draw a centered vertical line for each sample.
  19219. @end table
  19220. Default value is @code{point}.
  19221. @item n
  19222. Set the number of samples which are printed on the same column. A
  19223. larger value will decrease the frame rate. Must be a positive
  19224. integer. This option can be set only if the value for @var{rate}
  19225. is not explicitly specified.
  19226. @item rate, r
  19227. Set the (approximate) output frame rate. This is done by setting the
  19228. option @var{n}. Default value is "25".
  19229. @item split_channels
  19230. Set if channels should be drawn separately or overlap. Default value is 0.
  19231. @item colors
  19232. Set colors separated by '|' which are going to be used for drawing of each channel.
  19233. @item scale
  19234. Set amplitude scale.
  19235. Available values are:
  19236. @table @samp
  19237. @item lin
  19238. Linear.
  19239. @item log
  19240. Logarithmic.
  19241. @item sqrt
  19242. Square root.
  19243. @item cbrt
  19244. Cubic root.
  19245. @end table
  19246. Default is linear.
  19247. @item draw
  19248. Set the draw mode. This is mostly useful to set for high @var{n}.
  19249. Available values are:
  19250. @table @samp
  19251. @item scale
  19252. Scale pixel values for each drawn sample.
  19253. @item full
  19254. Draw every sample directly.
  19255. @end table
  19256. Default value is @code{scale}.
  19257. @end table
  19258. @subsection Examples
  19259. @itemize
  19260. @item
  19261. Output the input file audio and the corresponding video representation
  19262. at the same time:
  19263. @example
  19264. amovie=a.mp3,asplit[out0],showwaves[out1]
  19265. @end example
  19266. @item
  19267. Create a synthetic signal and show it with showwaves, forcing a
  19268. frame rate of 30 frames per second:
  19269. @example
  19270. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19271. @end example
  19272. @end itemize
  19273. @section showwavespic
  19274. Convert input audio to a single video frame, representing the samples waves.
  19275. The filter accepts the following options:
  19276. @table @option
  19277. @item size, s
  19278. Specify the video size for the output. For the syntax of this option, check the
  19279. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19280. Default value is @code{600x240}.
  19281. @item split_channels
  19282. Set if channels should be drawn separately or overlap. Default value is 0.
  19283. @item colors
  19284. Set colors separated by '|' which are going to be used for drawing of each channel.
  19285. @item scale
  19286. Set amplitude scale.
  19287. Available values are:
  19288. @table @samp
  19289. @item lin
  19290. Linear.
  19291. @item log
  19292. Logarithmic.
  19293. @item sqrt
  19294. Square root.
  19295. @item cbrt
  19296. Cubic root.
  19297. @end table
  19298. Default is linear.
  19299. @item draw
  19300. Set the draw mode.
  19301. Available values are:
  19302. @table @samp
  19303. @item scale
  19304. Scale pixel values for each drawn sample.
  19305. @item full
  19306. Draw every sample directly.
  19307. @end table
  19308. Default value is @code{scale}.
  19309. @end table
  19310. @subsection Examples
  19311. @itemize
  19312. @item
  19313. Extract a channel split representation of the wave form of a whole audio track
  19314. in a 1024x800 picture using @command{ffmpeg}:
  19315. @example
  19316. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19317. @end example
  19318. @end itemize
  19319. @section sidedata, asidedata
  19320. Delete frame side data, or select frames based on it.
  19321. This filter accepts the following options:
  19322. @table @option
  19323. @item mode
  19324. Set mode of operation of the filter.
  19325. Can be one of the following:
  19326. @table @samp
  19327. @item select
  19328. Select every frame with side data of @code{type}.
  19329. @item delete
  19330. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19331. data in the frame.
  19332. @end table
  19333. @item type
  19334. Set side data type used with all modes. Must be set for @code{select} mode. For
  19335. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19336. in @file{libavutil/frame.h}. For example, to choose
  19337. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19338. @end table
  19339. @section spectrumsynth
  19340. Synthesize audio from 2 input video spectrums, first input stream represents
  19341. magnitude across time and second represents phase across time.
  19342. The filter will transform from frequency domain as displayed in videos back
  19343. to time domain as presented in audio output.
  19344. This filter is primarily created for reversing processed @ref{showspectrum}
  19345. filter outputs, but can synthesize sound from other spectrograms too.
  19346. But in such case results are going to be poor if the phase data is not
  19347. available, because in such cases phase data need to be recreated, usually
  19348. it's just recreated from random noise.
  19349. For best results use gray only output (@code{channel} color mode in
  19350. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19351. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19352. @code{data} option. Inputs videos should generally use @code{fullframe}
  19353. slide mode as that saves resources needed for decoding video.
  19354. The filter accepts the following options:
  19355. @table @option
  19356. @item sample_rate
  19357. Specify sample rate of output audio, the sample rate of audio from which
  19358. spectrum was generated may differ.
  19359. @item channels
  19360. Set number of channels represented in input video spectrums.
  19361. @item scale
  19362. Set scale which was used when generating magnitude input spectrum.
  19363. Can be @code{lin} or @code{log}. Default is @code{log}.
  19364. @item slide
  19365. Set slide which was used when generating inputs spectrums.
  19366. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19367. Default is @code{fullframe}.
  19368. @item win_func
  19369. Set window function used for resynthesis.
  19370. @item overlap
  19371. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19372. which means optimal overlap for selected window function will be picked.
  19373. @item orientation
  19374. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19375. Default is @code{vertical}.
  19376. @end table
  19377. @subsection Examples
  19378. @itemize
  19379. @item
  19380. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19381. then resynthesize videos back to audio with spectrumsynth:
  19382. @example
  19383. 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
  19384. 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
  19385. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19386. @end example
  19387. @end itemize
  19388. @section split, asplit
  19389. Split input into several identical outputs.
  19390. @code{asplit} works with audio input, @code{split} with video.
  19391. The filter accepts a single parameter which specifies the number of outputs. If
  19392. unspecified, it defaults to 2.
  19393. @subsection Examples
  19394. @itemize
  19395. @item
  19396. Create two separate outputs from the same input:
  19397. @example
  19398. [in] split [out0][out1]
  19399. @end example
  19400. @item
  19401. To create 3 or more outputs, you need to specify the number of
  19402. outputs, like in:
  19403. @example
  19404. [in] asplit=3 [out0][out1][out2]
  19405. @end example
  19406. @item
  19407. Create two separate outputs from the same input, one cropped and
  19408. one padded:
  19409. @example
  19410. [in] split [splitout1][splitout2];
  19411. [splitout1] crop=100:100:0:0 [cropout];
  19412. [splitout2] pad=200:200:100:100 [padout];
  19413. @end example
  19414. @item
  19415. Create 5 copies of the input audio with @command{ffmpeg}:
  19416. @example
  19417. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19418. @end example
  19419. @end itemize
  19420. @section zmq, azmq
  19421. Receive commands sent through a libzmq client, and forward them to
  19422. filters in the filtergraph.
  19423. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19424. must be inserted between two video filters, @code{azmq} between two
  19425. audio filters. Both are capable to send messages to any filter type.
  19426. To enable these filters you need to install the libzmq library and
  19427. headers and configure FFmpeg with @code{--enable-libzmq}.
  19428. For more information about libzmq see:
  19429. @url{http://www.zeromq.org/}
  19430. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19431. receives messages sent through a network interface defined by the
  19432. @option{bind_address} (or the abbreviation "@option{b}") option.
  19433. Default value of this option is @file{tcp://localhost:5555}. You may
  19434. want to alter this value to your needs, but do not forget to escape any
  19435. ':' signs (see @ref{filtergraph escaping}).
  19436. The received message must be in the form:
  19437. @example
  19438. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19439. @end example
  19440. @var{TARGET} specifies the target of the command, usually the name of
  19441. the filter class or a specific filter instance name. The default
  19442. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19443. but you can override this by using the @samp{filter_name@@id} syntax
  19444. (see @ref{Filtergraph syntax}).
  19445. @var{COMMAND} specifies the name of the command for the target filter.
  19446. @var{ARG} is optional and specifies the optional argument list for the
  19447. given @var{COMMAND}.
  19448. Upon reception, the message is processed and the corresponding command
  19449. is injected into the filtergraph. Depending on the result, the filter
  19450. will send a reply to the client, adopting the format:
  19451. @example
  19452. @var{ERROR_CODE} @var{ERROR_REASON}
  19453. @var{MESSAGE}
  19454. @end example
  19455. @var{MESSAGE} is optional.
  19456. @subsection Examples
  19457. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19458. be used to send commands processed by these filters.
  19459. Consider the following filtergraph generated by @command{ffplay}.
  19460. In this example the last overlay filter has an instance name. All other
  19461. filters will have default instance names.
  19462. @example
  19463. ffplay -dumpgraph 1 -f lavfi "
  19464. color=s=100x100:c=red [l];
  19465. color=s=100x100:c=blue [r];
  19466. nullsrc=s=200x100, zmq [bg];
  19467. [bg][l] overlay [bg+l];
  19468. [bg+l][r] overlay@@my=x=100 "
  19469. @end example
  19470. To change the color of the left side of the video, the following
  19471. command can be used:
  19472. @example
  19473. echo Parsed_color_0 c yellow | tools/zmqsend
  19474. @end example
  19475. To change the right side:
  19476. @example
  19477. echo Parsed_color_1 c pink | tools/zmqsend
  19478. @end example
  19479. To change the position of the right side:
  19480. @example
  19481. echo overlay@@my x 150 | tools/zmqsend
  19482. @end example
  19483. @c man end MULTIMEDIA FILTERS
  19484. @chapter Multimedia Sources
  19485. @c man begin MULTIMEDIA SOURCES
  19486. Below is a description of the currently available multimedia sources.
  19487. @section amovie
  19488. This is the same as @ref{movie} source, except it selects an audio
  19489. stream by default.
  19490. @anchor{movie}
  19491. @section movie
  19492. Read audio and/or video stream(s) from a movie container.
  19493. It accepts the following parameters:
  19494. @table @option
  19495. @item filename
  19496. The name of the resource to read (not necessarily a file; it can also be a
  19497. device or a stream accessed through some protocol).
  19498. @item format_name, f
  19499. Specifies the format assumed for the movie to read, and can be either
  19500. the name of a container or an input device. If not specified, the
  19501. format is guessed from @var{movie_name} or by probing.
  19502. @item seek_point, sp
  19503. Specifies the seek point in seconds. The frames will be output
  19504. starting from this seek point. The parameter is evaluated with
  19505. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19506. postfix. The default value is "0".
  19507. @item streams, s
  19508. Specifies the streams to read. Several streams can be specified,
  19509. separated by "+". The source will then have as many outputs, in the
  19510. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19511. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19512. respectively the default (best suited) video and audio stream. Default
  19513. is "dv", or "da" if the filter is called as "amovie".
  19514. @item stream_index, si
  19515. Specifies the index of the video stream to read. If the value is -1,
  19516. the most suitable video stream will be automatically selected. The default
  19517. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19518. audio instead of video.
  19519. @item loop
  19520. Specifies how many times to read the stream in sequence.
  19521. If the value is 0, the stream will be looped infinitely.
  19522. Default value is "1".
  19523. Note that when the movie is looped the source timestamps are not
  19524. changed, so it will generate non monotonically increasing timestamps.
  19525. @item discontinuity
  19526. Specifies the time difference between frames above which the point is
  19527. considered a timestamp discontinuity which is removed by adjusting the later
  19528. timestamps.
  19529. @end table
  19530. It allows overlaying a second video on top of the main input of
  19531. a filtergraph, as shown in this graph:
  19532. @example
  19533. input -----------> deltapts0 --> overlay --> output
  19534. ^
  19535. |
  19536. movie --> scale--> deltapts1 -------+
  19537. @end example
  19538. @subsection Examples
  19539. @itemize
  19540. @item
  19541. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19542. on top of the input labelled "in":
  19543. @example
  19544. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19545. [in] setpts=PTS-STARTPTS [main];
  19546. [main][over] overlay=16:16 [out]
  19547. @end example
  19548. @item
  19549. Read from a video4linux2 device, and overlay it on top of the input
  19550. labelled "in":
  19551. @example
  19552. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19553. [in] setpts=PTS-STARTPTS [main];
  19554. [main][over] overlay=16:16 [out]
  19555. @end example
  19556. @item
  19557. Read the first video stream and the audio stream with id 0x81 from
  19558. dvd.vob; the video is connected to the pad named "video" and the audio is
  19559. connected to the pad named "audio":
  19560. @example
  19561. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19562. @end example
  19563. @end itemize
  19564. @subsection Commands
  19565. Both movie and amovie support the following commands:
  19566. @table @option
  19567. @item seek
  19568. Perform seek using "av_seek_frame".
  19569. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19570. @itemize
  19571. @item
  19572. @var{stream_index}: If stream_index is -1, a default
  19573. stream is selected, and @var{timestamp} is automatically converted
  19574. from AV_TIME_BASE units to the stream specific time_base.
  19575. @item
  19576. @var{timestamp}: Timestamp in AVStream.time_base units
  19577. or, if no stream is specified, in AV_TIME_BASE units.
  19578. @item
  19579. @var{flags}: Flags which select direction and seeking mode.
  19580. @end itemize
  19581. @item get_duration
  19582. Get movie duration in AV_TIME_BASE units.
  19583. @end table
  19584. @c man end MULTIMEDIA SOURCES