filters.texi 623 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417
  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{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sound like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size. Allowed range is from 16 to 131072.
  878. Default is @code{4096}
  879. @item win_func
  880. Set window function. Default is @code{hann}.
  881. @item overlap
  882. Set window overlap. If set to 1, the recommended overlap for selected
  883. window function will be picked. Default is @code{0.75}.
  884. @end table
  885. @subsection Examples
  886. @itemize
  887. @item
  888. Leave almost only low frequencies in audio:
  889. @example
  890. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  891. @end example
  892. @end itemize
  893. @anchor{afir}
  894. @section afir
  895. Apply an arbitrary Frequency Impulse Response filter.
  896. This filter is designed for applying long FIR filters,
  897. up to 60 seconds long.
  898. It can be used as component for digital crossover filters,
  899. room equalization, cross talk cancellation, wavefield synthesis,
  900. auralization, ambiophonics, ambisonics and spatialization.
  901. This filter uses second stream as FIR coefficients.
  902. If second stream holds single channel, it will be used
  903. for all input channels in first stream, otherwise
  904. number of channels in second stream must be same as
  905. number of channels in first stream.
  906. It accepts the following parameters:
  907. @table @option
  908. @item dry
  909. Set dry gain. This sets input gain.
  910. @item wet
  911. Set wet gain. This sets final output gain.
  912. @item length
  913. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  914. @item gtype
  915. Enable applying gain measured from power of IR.
  916. Set which approach to use for auto gain measurement.
  917. @table @option
  918. @item none
  919. Do not apply any gain.
  920. @item peak
  921. select peak gain, very conservative approach. This is default value.
  922. @item dc
  923. select DC gain, limited application.
  924. @item gn
  925. select gain to noise approach, this is most popular one.
  926. @end table
  927. @item irgain
  928. Set gain to be applied to IR coefficients before filtering.
  929. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  930. @item irfmt
  931. Set format of IR stream. Can be @code{mono} or @code{input}.
  932. Default is @code{input}.
  933. @item maxir
  934. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  935. Allowed range is 0.1 to 60 seconds.
  936. @item response
  937. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  938. By default it is disabled.
  939. @item channel
  940. Set for which IR channel to display frequency response. By default is first channel
  941. displayed. This option is used only when @var{response} is enabled.
  942. @item size
  943. Set video stream size. This option is used only when @var{response} is enabled.
  944. @item rate
  945. Set video stream frame rate. This option is used only when @var{response} is enabled.
  946. @item minp
  947. Set minimal partition size used for convolution. Default is @var{8192}.
  948. Allowed range is from @var{8} to @var{32768}.
  949. Lower values decreases latency at cost of higher CPU usage.
  950. @item maxp
  951. Set maximal partition size used for convolution. Default is @var{8192}.
  952. Allowed range is from @var{8} to @var{32768}.
  953. Lower values may increase CPU usage.
  954. @end table
  955. @subsection Examples
  956. @itemize
  957. @item
  958. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  959. @example
  960. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  961. @end example
  962. @end itemize
  963. @anchor{aformat}
  964. @section aformat
  965. Set output format constraints for the input audio. The framework will
  966. negotiate the most appropriate format to minimize conversions.
  967. It accepts the following parameters:
  968. @table @option
  969. @item sample_fmts
  970. A '|'-separated list of requested sample formats.
  971. @item sample_rates
  972. A '|'-separated list of requested sample rates.
  973. @item channel_layouts
  974. A '|'-separated list of requested channel layouts.
  975. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  976. for the required syntax.
  977. @end table
  978. If a parameter is omitted, all values are allowed.
  979. Force the output to either unsigned 8-bit or signed 16-bit stereo
  980. @example
  981. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  982. @end example
  983. @section agate
  984. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  985. processing reduces disturbing noise between useful signals.
  986. Gating is done by detecting the volume below a chosen level @var{threshold}
  987. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  988. floor is set via @var{range}. Because an exact manipulation of the signal
  989. would cause distortion of the waveform the reduction can be levelled over
  990. time. This is done by setting @var{attack} and @var{release}.
  991. @var{attack} determines how long the signal has to fall below the threshold
  992. before any reduction will occur and @var{release} sets the time the signal
  993. has to rise above the threshold to reduce the reduction again.
  994. Shorter signals than the chosen attack time will be left untouched.
  995. @table @option
  996. @item level_in
  997. Set input level before filtering.
  998. Default is 1. Allowed range is from 0.015625 to 64.
  999. @item mode
  1000. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1001. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1002. will be amplified, expanding dynamic range in upward direction.
  1003. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1004. @item range
  1005. Set the level of gain reduction when the signal is below the threshold.
  1006. Default is 0.06125. Allowed range is from 0 to 1.
  1007. Setting this to 0 disables reduction and then filter behaves like expander.
  1008. @item threshold
  1009. If a signal rises above this level the gain reduction is released.
  1010. Default is 0.125. Allowed range is from 0 to 1.
  1011. @item ratio
  1012. Set a ratio by which the signal is reduced.
  1013. Default is 2. Allowed range is from 1 to 9000.
  1014. @item attack
  1015. Amount of milliseconds the signal has to rise above the threshold before gain
  1016. reduction stops.
  1017. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1018. @item release
  1019. Amount of milliseconds the signal has to fall below the threshold before the
  1020. reduction is increased again. Default is 250 milliseconds.
  1021. Allowed range is from 0.01 to 9000.
  1022. @item makeup
  1023. Set amount of amplification of signal after processing.
  1024. Default is 1. Allowed range is from 1 to 64.
  1025. @item knee
  1026. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1027. Default is 2.828427125. Allowed range is from 1 to 8.
  1028. @item detection
  1029. Choose if exact signal should be taken for detection or an RMS like one.
  1030. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1031. @item link
  1032. Choose if the average level between all channels or the louder channel affects
  1033. the reduction.
  1034. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1035. @end table
  1036. @section aiir
  1037. Apply an arbitrary Infinite Impulse Response filter.
  1038. It accepts the following parameters:
  1039. @table @option
  1040. @item z
  1041. Set numerator/zeros coefficients.
  1042. @item p
  1043. Set denominator/poles coefficients.
  1044. @item k
  1045. Set channels gains.
  1046. @item dry_gain
  1047. Set input gain.
  1048. @item wet_gain
  1049. Set output gain.
  1050. @item f
  1051. Set coefficients format.
  1052. @table @samp
  1053. @item tf
  1054. transfer function
  1055. @item zp
  1056. Z-plane zeros/poles, cartesian (default)
  1057. @item pr
  1058. Z-plane zeros/poles, polar radians
  1059. @item pd
  1060. Z-plane zeros/poles, polar degrees
  1061. @end table
  1062. @item r
  1063. Set kind of processing.
  1064. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1065. @item e
  1066. Set filtering precision.
  1067. @table @samp
  1068. @item dbl
  1069. double-precision floating-point (default)
  1070. @item flt
  1071. single-precision floating-point
  1072. @item i32
  1073. 32-bit integers
  1074. @item i16
  1075. 16-bit integers
  1076. @end table
  1077. @item mix
  1078. How much to use filtered signal in output. Default is 1.
  1079. Range is between 0 and 1.
  1080. @item response
  1081. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1082. By default it is disabled.
  1083. @item channel
  1084. Set for which IR channel to display frequency response. By default is first channel
  1085. displayed. This option is used only when @var{response} is enabled.
  1086. @item size
  1087. Set video stream size. This option is used only when @var{response} is enabled.
  1088. @end table
  1089. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1090. order.
  1091. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1092. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1093. imaginary unit.
  1094. Different coefficients and gains can be provided for every channel, in such case
  1095. use '|' to separate coefficients or gains. Last provided coefficients will be
  1096. used for all remaining channels.
  1097. @subsection Examples
  1098. @itemize
  1099. @item
  1100. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1101. @example
  1102. 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
  1103. @end example
  1104. @item
  1105. Same as above but in @code{zp} format:
  1106. @example
  1107. 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
  1108. @end example
  1109. @end itemize
  1110. @section alimiter
  1111. The limiter prevents an input signal from rising over a desired threshold.
  1112. This limiter uses lookahead technology to prevent your signal from distorting.
  1113. It means that there is a small delay after the signal is processed. Keep in mind
  1114. that the delay it produces is the attack time you set.
  1115. The filter accepts the following options:
  1116. @table @option
  1117. @item level_in
  1118. Set input gain. Default is 1.
  1119. @item level_out
  1120. Set output gain. Default is 1.
  1121. @item limit
  1122. Don't let signals above this level pass the limiter. Default is 1.
  1123. @item attack
  1124. The limiter will reach its attenuation level in this amount of time in
  1125. milliseconds. Default is 5 milliseconds.
  1126. @item release
  1127. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1128. Default is 50 milliseconds.
  1129. @item asc
  1130. When gain reduction is always needed ASC takes care of releasing to an
  1131. average reduction level rather than reaching a reduction of 0 in the release
  1132. time.
  1133. @item asc_level
  1134. Select how much the release time is affected by ASC, 0 means nearly no changes
  1135. in release time while 1 produces higher release times.
  1136. @item level
  1137. Auto level output signal. Default is enabled.
  1138. This normalizes audio back to 0dB if enabled.
  1139. @end table
  1140. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1141. with @ref{aresample} before applying this filter.
  1142. @section allpass
  1143. Apply a two-pole all-pass filter with central frequency (in Hz)
  1144. @var{frequency}, and filter-width @var{width}.
  1145. An all-pass filter changes the audio's frequency to phase relationship
  1146. without changing its frequency to amplitude relationship.
  1147. The filter accepts the following options:
  1148. @table @option
  1149. @item frequency, f
  1150. Set frequency in Hz.
  1151. @item width_type, t
  1152. Set method to specify band-width of filter.
  1153. @table @option
  1154. @item h
  1155. Hz
  1156. @item q
  1157. Q-Factor
  1158. @item o
  1159. octave
  1160. @item s
  1161. slope
  1162. @item k
  1163. kHz
  1164. @end table
  1165. @item width, w
  1166. Specify the band-width of a filter in width_type units.
  1167. @item mix, m
  1168. How much to use filtered signal in output. Default is 1.
  1169. Range is between 0 and 1.
  1170. @item channels, c
  1171. Specify which channels to filter, by default all available are filtered.
  1172. @end table
  1173. @subsection Commands
  1174. This filter supports the following commands:
  1175. @table @option
  1176. @item frequency, f
  1177. Change allpass frequency.
  1178. Syntax for the command is : "@var{frequency}"
  1179. @item width_type, t
  1180. Change allpass width_type.
  1181. Syntax for the command is : "@var{width_type}"
  1182. @item width, w
  1183. Change allpass width.
  1184. Syntax for the command is : "@var{width}"
  1185. @item mix, m
  1186. Change allpass mix.
  1187. Syntax for the command is : "@var{mix}"
  1188. @end table
  1189. @section aloop
  1190. Loop audio samples.
  1191. The filter accepts the following options:
  1192. @table @option
  1193. @item loop
  1194. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1195. Default is 0.
  1196. @item size
  1197. Set maximal number of samples. Default is 0.
  1198. @item start
  1199. Set first sample of loop. Default is 0.
  1200. @end table
  1201. @anchor{amerge}
  1202. @section amerge
  1203. Merge two or more audio streams into a single multi-channel stream.
  1204. The filter accepts the following options:
  1205. @table @option
  1206. @item inputs
  1207. Set the number of inputs. Default is 2.
  1208. @end table
  1209. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1210. the channel layout of the output will be set accordingly and the channels
  1211. will be reordered as necessary. If the channel layouts of the inputs are not
  1212. disjoint, the output will have all the channels of the first input then all
  1213. the channels of the second input, in that order, and the channel layout of
  1214. the output will be the default value corresponding to the total number of
  1215. channels.
  1216. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1217. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1218. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1219. first input, b1 is the first channel of the second input).
  1220. On the other hand, if both input are in stereo, the output channels will be
  1221. in the default order: a1, a2, b1, b2, and the channel layout will be
  1222. arbitrarily set to 4.0, which may or may not be the expected value.
  1223. All inputs must have the same sample rate, and format.
  1224. If inputs do not have the same duration, the output will stop with the
  1225. shortest.
  1226. @subsection Examples
  1227. @itemize
  1228. @item
  1229. Merge two mono files into a stereo stream:
  1230. @example
  1231. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1232. @end example
  1233. @item
  1234. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1235. @example
  1236. 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
  1237. @end example
  1238. @end itemize
  1239. @section amix
  1240. Mixes multiple audio inputs into a single output.
  1241. Note that this filter only supports float samples (the @var{amerge}
  1242. and @var{pan} audio filters support many formats). If the @var{amix}
  1243. input has integer samples then @ref{aresample} will be automatically
  1244. inserted to perform the conversion to float samples.
  1245. For example
  1246. @example
  1247. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1248. @end example
  1249. will mix 3 input audio streams to a single output with the same duration as the
  1250. first input and a dropout transition time of 3 seconds.
  1251. It accepts the following parameters:
  1252. @table @option
  1253. @item inputs
  1254. The number of inputs. If unspecified, it defaults to 2.
  1255. @item duration
  1256. How to determine the end-of-stream.
  1257. @table @option
  1258. @item longest
  1259. The duration of the longest input. (default)
  1260. @item shortest
  1261. The duration of the shortest input.
  1262. @item first
  1263. The duration of the first input.
  1264. @end table
  1265. @item dropout_transition
  1266. The transition time, in seconds, for volume renormalization when an input
  1267. stream ends. The default value is 2 seconds.
  1268. @item weights
  1269. Specify weight of each input audio stream as sequence.
  1270. Each weight is separated by space. By default all inputs have same weight.
  1271. @end table
  1272. @section amultiply
  1273. Multiply first audio stream with second audio stream and store result
  1274. in output audio stream. Multiplication is done by multiplying each
  1275. sample from first stream with sample at same position from second stream.
  1276. With this element-wise multiplication one can create amplitude fades and
  1277. amplitude modulations.
  1278. @section anequalizer
  1279. High-order parametric multiband equalizer for each channel.
  1280. It accepts the following parameters:
  1281. @table @option
  1282. @item params
  1283. This option string is in format:
  1284. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1285. Each equalizer band is separated by '|'.
  1286. @table @option
  1287. @item chn
  1288. Set channel number to which equalization will be applied.
  1289. If input doesn't have that channel the entry is ignored.
  1290. @item f
  1291. Set central frequency for band.
  1292. If input doesn't have that frequency the entry is ignored.
  1293. @item w
  1294. Set band width in hertz.
  1295. @item g
  1296. Set band gain in dB.
  1297. @item t
  1298. Set filter type for band, optional, can be:
  1299. @table @samp
  1300. @item 0
  1301. Butterworth, this is default.
  1302. @item 1
  1303. Chebyshev type 1.
  1304. @item 2
  1305. Chebyshev type 2.
  1306. @end table
  1307. @end table
  1308. @item curves
  1309. With this option activated frequency response of anequalizer is displayed
  1310. in video stream.
  1311. @item size
  1312. Set video stream size. Only useful if curves option is activated.
  1313. @item mgain
  1314. Set max gain that will be displayed. Only useful if curves option is activated.
  1315. Setting this to a reasonable value makes it possible to display gain which is derived from
  1316. neighbour bands which are too close to each other and thus produce higher gain
  1317. when both are activated.
  1318. @item fscale
  1319. Set frequency scale used to draw frequency response in video output.
  1320. Can be linear or logarithmic. Default is logarithmic.
  1321. @item colors
  1322. Set color for each channel curve which is going to be displayed in video stream.
  1323. This is list of color names separated by space or by '|'.
  1324. Unrecognised or missing colors will be replaced by white color.
  1325. @end table
  1326. @subsection Examples
  1327. @itemize
  1328. @item
  1329. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1330. for first 2 channels using Chebyshev type 1 filter:
  1331. @example
  1332. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1333. @end example
  1334. @end itemize
  1335. @subsection Commands
  1336. This filter supports the following commands:
  1337. @table @option
  1338. @item change
  1339. Alter existing filter parameters.
  1340. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1341. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1342. error is returned.
  1343. @var{freq} set new frequency parameter.
  1344. @var{width} set new width parameter in herz.
  1345. @var{gain} set new gain parameter in dB.
  1346. Full filter invocation with asendcmd may look like this:
  1347. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1348. @end table
  1349. @section anlmdn
  1350. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1351. Each sample is adjusted by looking for other samples with similar contexts. This
  1352. context similarity is defined by comparing their surrounding patches of size
  1353. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1354. The filter accepts the following options.
  1355. @table @option
  1356. @item s
  1357. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1358. @item p
  1359. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1360. Default value is 2 milliseconds.
  1361. @item r
  1362. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1363. Default value is 6 milliseconds.
  1364. @item o
  1365. Set the output mode.
  1366. It accepts the following values:
  1367. @table @option
  1368. @item i
  1369. Pass input unchanged.
  1370. @item o
  1371. Pass noise filtered out.
  1372. @item n
  1373. Pass only noise.
  1374. Default value is @var{o}.
  1375. @end table
  1376. @item m
  1377. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1378. @end table
  1379. @subsection Commands
  1380. This filter supports the following commands:
  1381. @table @option
  1382. @item s
  1383. Change denoise strength. Argument is single float number.
  1384. Syntax for the command is : "@var{s}"
  1385. @item o
  1386. Change output mode.
  1387. Syntax for the command is : "i", "o" or "n" string.
  1388. @end table
  1389. @section anull
  1390. Pass the audio source unchanged to the output.
  1391. @section apad
  1392. Pad the end of an audio stream with silence.
  1393. This can be used together with @command{ffmpeg} @option{-shortest} to
  1394. extend audio streams to the same length as the video stream.
  1395. A description of the accepted options follows.
  1396. @table @option
  1397. @item packet_size
  1398. Set silence packet size. Default value is 4096.
  1399. @item pad_len
  1400. Set the number of samples of silence to add to the end. After the
  1401. value is reached, the stream is terminated. This option is mutually
  1402. exclusive with @option{whole_len}.
  1403. @item whole_len
  1404. Set the minimum total number of samples in the output audio stream. If
  1405. the value is longer than the input audio length, silence is added to
  1406. the end, until the value is reached. This option is mutually exclusive
  1407. with @option{pad_len}.
  1408. @item pad_dur
  1409. Specify the duration of samples of silence to add. See
  1410. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1411. for the accepted syntax. Used only if set to non-zero value.
  1412. @item whole_dur
  1413. Specify the minimum total duration in the output audio stream. See
  1414. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1415. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1416. the input audio length, silence is added to the end, until the value is reached.
  1417. This option is mutually exclusive with @option{pad_dur}
  1418. @end table
  1419. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1420. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1421. the input stream indefinitely.
  1422. @subsection Examples
  1423. @itemize
  1424. @item
  1425. Add 1024 samples of silence to the end of the input:
  1426. @example
  1427. apad=pad_len=1024
  1428. @end example
  1429. @item
  1430. Make sure the audio output will contain at least 10000 samples, pad
  1431. the input with silence if required:
  1432. @example
  1433. apad=whole_len=10000
  1434. @end example
  1435. @item
  1436. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1437. video stream will always result the shortest and will be converted
  1438. until the end in the output file when using the @option{shortest}
  1439. option:
  1440. @example
  1441. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1442. @end example
  1443. @end itemize
  1444. @section aphaser
  1445. Add a phasing effect to the input audio.
  1446. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1447. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1448. A description of the accepted parameters follows.
  1449. @table @option
  1450. @item in_gain
  1451. Set input gain. Default is 0.4.
  1452. @item out_gain
  1453. Set output gain. Default is 0.74
  1454. @item delay
  1455. Set delay in milliseconds. Default is 3.0.
  1456. @item decay
  1457. Set decay. Default is 0.4.
  1458. @item speed
  1459. Set modulation speed in Hz. Default is 0.5.
  1460. @item type
  1461. Set modulation type. Default is triangular.
  1462. It accepts the following values:
  1463. @table @samp
  1464. @item triangular, t
  1465. @item sinusoidal, s
  1466. @end table
  1467. @end table
  1468. @section apulsator
  1469. Audio pulsator is something between an autopanner and a tremolo.
  1470. But it can produce funny stereo effects as well. Pulsator changes the volume
  1471. of the left and right channel based on a LFO (low frequency oscillator) with
  1472. different waveforms and shifted phases.
  1473. This filter have the ability to define an offset between left and right
  1474. channel. An offset of 0 means that both LFO shapes match each other.
  1475. The left and right channel are altered equally - a conventional tremolo.
  1476. An offset of 50% means that the shape of the right channel is exactly shifted
  1477. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1478. an autopanner. At 1 both curves match again. Every setting in between moves the
  1479. phase shift gapless between all stages and produces some "bypassing" sounds with
  1480. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1481. the 0.5) the faster the signal passes from the left to the right speaker.
  1482. The filter accepts the following options:
  1483. @table @option
  1484. @item level_in
  1485. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1486. @item level_out
  1487. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1488. @item mode
  1489. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1490. sawup or sawdown. Default is sine.
  1491. @item amount
  1492. Set modulation. Define how much of original signal is affected by the LFO.
  1493. @item offset_l
  1494. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1495. @item offset_r
  1496. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1497. @item width
  1498. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1499. @item timing
  1500. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1501. @item bpm
  1502. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1503. is set to bpm.
  1504. @item ms
  1505. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1506. is set to ms.
  1507. @item hz
  1508. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1509. if timing is set to hz.
  1510. @end table
  1511. @anchor{aresample}
  1512. @section aresample
  1513. Resample the input audio to the specified parameters, using the
  1514. libswresample library. If none are specified then the filter will
  1515. automatically convert between its input and output.
  1516. This filter is also able to stretch/squeeze the audio data to make it match
  1517. the timestamps or to inject silence / cut out audio to make it match the
  1518. timestamps, do a combination of both or do neither.
  1519. The filter accepts the syntax
  1520. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1521. expresses a sample rate and @var{resampler_options} is a list of
  1522. @var{key}=@var{value} pairs, separated by ":". See the
  1523. @ref{Resampler Options,,"Resampler Options" section in the
  1524. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1525. for the complete list of supported options.
  1526. @subsection Examples
  1527. @itemize
  1528. @item
  1529. Resample the input audio to 44100Hz:
  1530. @example
  1531. aresample=44100
  1532. @end example
  1533. @item
  1534. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1535. samples per second compensation:
  1536. @example
  1537. aresample=async=1000
  1538. @end example
  1539. @end itemize
  1540. @section areverse
  1541. Reverse an audio clip.
  1542. Warning: This filter requires memory to buffer the entire clip, so trimming
  1543. is suggested.
  1544. @subsection Examples
  1545. @itemize
  1546. @item
  1547. Take the first 5 seconds of a clip, and reverse it.
  1548. @example
  1549. atrim=end=5,areverse
  1550. @end example
  1551. @end itemize
  1552. @section asetnsamples
  1553. Set the number of samples per each output audio frame.
  1554. The last output packet may contain a different number of samples, as
  1555. the filter will flush all the remaining samples when the input audio
  1556. signals its end.
  1557. The filter accepts the following options:
  1558. @table @option
  1559. @item nb_out_samples, n
  1560. Set the number of frames per each output audio frame. The number is
  1561. intended as the number of samples @emph{per each channel}.
  1562. Default value is 1024.
  1563. @item pad, p
  1564. If set to 1, the filter will pad the last audio frame with zeroes, so
  1565. that the last frame will contain the same number of samples as the
  1566. previous ones. Default value is 1.
  1567. @end table
  1568. For example, to set the number of per-frame samples to 1234 and
  1569. disable padding for the last frame, use:
  1570. @example
  1571. asetnsamples=n=1234:p=0
  1572. @end example
  1573. @section asetrate
  1574. Set the sample rate without altering the PCM data.
  1575. This will result in a change of speed and pitch.
  1576. The filter accepts the following options:
  1577. @table @option
  1578. @item sample_rate, r
  1579. Set the output sample rate. Default is 44100 Hz.
  1580. @end table
  1581. @section ashowinfo
  1582. Show a line containing various information for each input audio frame.
  1583. The input audio is not modified.
  1584. The shown line contains a sequence of key/value pairs of the form
  1585. @var{key}:@var{value}.
  1586. The following values are shown in the output:
  1587. @table @option
  1588. @item n
  1589. The (sequential) number of the input frame, starting from 0.
  1590. @item pts
  1591. The presentation timestamp of the input frame, in time base units; the time base
  1592. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1593. @item pts_time
  1594. The presentation timestamp of the input frame in seconds.
  1595. @item pos
  1596. position of the frame in the input stream, -1 if this information in
  1597. unavailable and/or meaningless (for example in case of synthetic audio)
  1598. @item fmt
  1599. The sample format.
  1600. @item chlayout
  1601. The channel layout.
  1602. @item rate
  1603. The sample rate for the audio frame.
  1604. @item nb_samples
  1605. The number of samples (per channel) in the frame.
  1606. @item checksum
  1607. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1608. audio, the data is treated as if all the planes were concatenated.
  1609. @item plane_checksums
  1610. A list of Adler-32 checksums for each data plane.
  1611. @end table
  1612. @section asoftclip
  1613. Apply audio soft clipping.
  1614. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1615. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1616. This filter accepts the following options:
  1617. @table @option
  1618. @item type
  1619. Set type of soft-clipping.
  1620. It accepts the following values:
  1621. @table @option
  1622. @item tanh
  1623. @item atan
  1624. @item cubic
  1625. @item exp
  1626. @item alg
  1627. @item quintic
  1628. @item sin
  1629. @end table
  1630. @item param
  1631. Set additional parameter which controls sigmoid function.
  1632. @end table
  1633. @section asr
  1634. Automatic Speech Recognition
  1635. This filter uses PocketSphinx for speech recognition. To enable
  1636. compilation of this filter, you need to configure FFmpeg with
  1637. @code{--enable-pocketsphinx}.
  1638. It accepts the following options:
  1639. @table @option
  1640. @item rate
  1641. Set sampling rate of input audio. Defaults is @code{16000}.
  1642. This need to match speech models, otherwise one will get poor results.
  1643. @item hmm
  1644. Set dictionary containing acoustic model files.
  1645. @item dict
  1646. Set pronunciation dictionary.
  1647. @item lm
  1648. Set language model file.
  1649. @item lmctl
  1650. Set language model set.
  1651. @item lmname
  1652. Set which language model to use.
  1653. @item logfn
  1654. Set output for log messages.
  1655. @end table
  1656. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1657. @anchor{astats}
  1658. @section astats
  1659. Display time domain statistical information about the audio channels.
  1660. Statistics are calculated and displayed for each audio channel and,
  1661. where applicable, an overall figure is also given.
  1662. It accepts the following option:
  1663. @table @option
  1664. @item length
  1665. Short window length in seconds, used for peak and trough RMS measurement.
  1666. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1667. @item metadata
  1668. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1669. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1670. disabled.
  1671. Available keys for each channel are:
  1672. DC_offset
  1673. Min_level
  1674. Max_level
  1675. Min_difference
  1676. Max_difference
  1677. Mean_difference
  1678. RMS_difference
  1679. Peak_level
  1680. RMS_peak
  1681. RMS_trough
  1682. Crest_factor
  1683. Flat_factor
  1684. Peak_count
  1685. Bit_depth
  1686. Dynamic_range
  1687. Zero_crossings
  1688. Zero_crossings_rate
  1689. Number_of_NaNs
  1690. Number_of_Infs
  1691. Number_of_denormals
  1692. and for Overall:
  1693. DC_offset
  1694. Min_level
  1695. Max_level
  1696. Min_difference
  1697. Max_difference
  1698. Mean_difference
  1699. RMS_difference
  1700. Peak_level
  1701. RMS_level
  1702. RMS_peak
  1703. RMS_trough
  1704. Flat_factor
  1705. Peak_count
  1706. Bit_depth
  1707. Number_of_samples
  1708. Number_of_NaNs
  1709. Number_of_Infs
  1710. Number_of_denormals
  1711. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1712. this @code{lavfi.astats.Overall.Peak_count}.
  1713. For description what each key means read below.
  1714. @item reset
  1715. Set number of frame after which stats are going to be recalculated.
  1716. Default is disabled.
  1717. @item measure_perchannel
  1718. Select the entries which need to be measured per channel. The metadata keys can
  1719. be used as flags, default is @option{all} which measures everything.
  1720. @option{none} disables all per channel measurement.
  1721. @item measure_overall
  1722. Select the entries which need to be measured overall. The metadata keys can
  1723. be used as flags, default is @option{all} which measures everything.
  1724. @option{none} disables all overall measurement.
  1725. @end table
  1726. A description of each shown parameter follows:
  1727. @table @option
  1728. @item DC offset
  1729. Mean amplitude displacement from zero.
  1730. @item Min level
  1731. Minimal sample level.
  1732. @item Max level
  1733. Maximal sample level.
  1734. @item Min difference
  1735. Minimal difference between two consecutive samples.
  1736. @item Max difference
  1737. Maximal difference between two consecutive samples.
  1738. @item Mean difference
  1739. Mean difference between two consecutive samples.
  1740. The average of each difference between two consecutive samples.
  1741. @item RMS difference
  1742. Root Mean Square difference between two consecutive samples.
  1743. @item Peak level dB
  1744. @item RMS level dB
  1745. Standard peak and RMS level measured in dBFS.
  1746. @item RMS peak dB
  1747. @item RMS trough dB
  1748. Peak and trough values for RMS level measured over a short window.
  1749. @item Crest factor
  1750. Standard ratio of peak to RMS level (note: not in dB).
  1751. @item Flat factor
  1752. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1753. (i.e. either @var{Min level} or @var{Max level}).
  1754. @item Peak count
  1755. Number of occasions (not the number of samples) that the signal attained either
  1756. @var{Min level} or @var{Max level}.
  1757. @item Bit depth
  1758. Overall bit depth of audio. Number of bits used for each sample.
  1759. @item Dynamic range
  1760. Measured dynamic range of audio in dB.
  1761. @item Zero crossings
  1762. Number of points where the waveform crosses the zero level axis.
  1763. @item Zero crossings rate
  1764. Rate of Zero crossings and number of audio samples.
  1765. @end table
  1766. @section atempo
  1767. Adjust audio tempo.
  1768. The filter accepts exactly one parameter, the audio tempo. If not
  1769. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1770. be in the [0.5, 100.0] range.
  1771. Note that tempo greater than 2 will skip some samples rather than
  1772. blend them in. If for any reason this is a concern it is always
  1773. possible to daisy-chain several instances of atempo to achieve the
  1774. desired product tempo.
  1775. @subsection Examples
  1776. @itemize
  1777. @item
  1778. Slow down audio to 80% tempo:
  1779. @example
  1780. atempo=0.8
  1781. @end example
  1782. @item
  1783. To speed up audio to 300% tempo:
  1784. @example
  1785. atempo=3
  1786. @end example
  1787. @item
  1788. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1789. @example
  1790. atempo=sqrt(3),atempo=sqrt(3)
  1791. @end example
  1792. @end itemize
  1793. @section atrim
  1794. Trim the input so that the output contains one continuous subpart of the input.
  1795. It accepts the following parameters:
  1796. @table @option
  1797. @item start
  1798. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1799. sample with the timestamp @var{start} will be the first sample in the output.
  1800. @item end
  1801. Specify time of the first audio sample that will be dropped, i.e. the
  1802. audio sample immediately preceding the one with the timestamp @var{end} will be
  1803. the last sample in the output.
  1804. @item start_pts
  1805. Same as @var{start}, except this option sets the start timestamp in samples
  1806. instead of seconds.
  1807. @item end_pts
  1808. Same as @var{end}, except this option sets the end timestamp in samples instead
  1809. of seconds.
  1810. @item duration
  1811. The maximum duration of the output in seconds.
  1812. @item start_sample
  1813. The number of the first sample that should be output.
  1814. @item end_sample
  1815. The number of the first sample that should be dropped.
  1816. @end table
  1817. @option{start}, @option{end}, and @option{duration} are expressed as time
  1818. duration specifications; see
  1819. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1820. Note that the first two sets of the start/end options and the @option{duration}
  1821. option look at the frame timestamp, while the _sample options simply count the
  1822. samples that pass through the filter. So start/end_pts and start/end_sample will
  1823. give different results when the timestamps are wrong, inexact or do not start at
  1824. zero. Also note that this filter does not modify the timestamps. If you wish
  1825. to have the output timestamps start at zero, insert the asetpts filter after the
  1826. atrim filter.
  1827. If multiple start or end options are set, this filter tries to be greedy and
  1828. keep all samples that match at least one of the specified constraints. To keep
  1829. only the part that matches all the constraints at once, chain multiple atrim
  1830. filters.
  1831. The defaults are such that all the input is kept. So it is possible to set e.g.
  1832. just the end values to keep everything before the specified time.
  1833. Examples:
  1834. @itemize
  1835. @item
  1836. Drop everything except the second minute of input:
  1837. @example
  1838. ffmpeg -i INPUT -af atrim=60:120
  1839. @end example
  1840. @item
  1841. Keep only the first 1000 samples:
  1842. @example
  1843. ffmpeg -i INPUT -af atrim=end_sample=1000
  1844. @end example
  1845. @end itemize
  1846. @section bandpass
  1847. Apply a two-pole Butterworth band-pass filter with central
  1848. frequency @var{frequency}, and (3dB-point) band-width width.
  1849. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1850. instead of the default: constant 0dB peak gain.
  1851. The filter roll off at 6dB per octave (20dB per decade).
  1852. The filter accepts the following options:
  1853. @table @option
  1854. @item frequency, f
  1855. Set the filter's central frequency. Default is @code{3000}.
  1856. @item csg
  1857. Constant skirt gain if set to 1. Defaults to 0.
  1858. @item width_type, t
  1859. Set method to specify band-width of filter.
  1860. @table @option
  1861. @item h
  1862. Hz
  1863. @item q
  1864. Q-Factor
  1865. @item o
  1866. octave
  1867. @item s
  1868. slope
  1869. @item k
  1870. kHz
  1871. @end table
  1872. @item width, w
  1873. Specify the band-width of a filter in width_type units.
  1874. @item mix, m
  1875. How much to use filtered signal in output. Default is 1.
  1876. Range is between 0 and 1.
  1877. @item channels, c
  1878. Specify which channels to filter, by default all available are filtered.
  1879. @end table
  1880. @subsection Commands
  1881. This filter supports the following commands:
  1882. @table @option
  1883. @item frequency, f
  1884. Change bandpass frequency.
  1885. Syntax for the command is : "@var{frequency}"
  1886. @item width_type, t
  1887. Change bandpass width_type.
  1888. Syntax for the command is : "@var{width_type}"
  1889. @item width, w
  1890. Change bandpass width.
  1891. Syntax for the command is : "@var{width}"
  1892. @item mix, m
  1893. Change bandpass mix.
  1894. Syntax for the command is : "@var{mix}"
  1895. @end table
  1896. @section bandreject
  1897. Apply a two-pole Butterworth band-reject filter with central
  1898. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1899. The filter roll off at 6dB per octave (20dB per decade).
  1900. The filter accepts the following options:
  1901. @table @option
  1902. @item frequency, f
  1903. Set the filter's central frequency. Default is @code{3000}.
  1904. @item width_type, t
  1905. Set method to specify band-width of filter.
  1906. @table @option
  1907. @item h
  1908. Hz
  1909. @item q
  1910. Q-Factor
  1911. @item o
  1912. octave
  1913. @item s
  1914. slope
  1915. @item k
  1916. kHz
  1917. @end table
  1918. @item width, w
  1919. Specify the band-width of a filter in width_type units.
  1920. @item mix, m
  1921. How much to use filtered signal in output. Default is 1.
  1922. Range is between 0 and 1.
  1923. @item channels, c
  1924. Specify which channels to filter, by default all available are filtered.
  1925. @end table
  1926. @subsection Commands
  1927. This filter supports the following commands:
  1928. @table @option
  1929. @item frequency, f
  1930. Change bandreject frequency.
  1931. Syntax for the command is : "@var{frequency}"
  1932. @item width_type, t
  1933. Change bandreject width_type.
  1934. Syntax for the command is : "@var{width_type}"
  1935. @item width, w
  1936. Change bandreject width.
  1937. Syntax for the command is : "@var{width}"
  1938. @item mix, m
  1939. Change bandreject mix.
  1940. Syntax for the command is : "@var{mix}"
  1941. @end table
  1942. @section bass, lowshelf
  1943. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1944. shelving filter with a response similar to that of a standard
  1945. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1946. The filter accepts the following options:
  1947. @table @option
  1948. @item gain, g
  1949. Give the gain at 0 Hz. Its useful range is about -20
  1950. (for a large cut) to +20 (for a large boost).
  1951. Beware of clipping when using a positive gain.
  1952. @item frequency, f
  1953. Set the filter's central frequency and so can be used
  1954. to extend or reduce the frequency range to be boosted or cut.
  1955. The default value is @code{100} Hz.
  1956. @item width_type, t
  1957. Set method to specify band-width of filter.
  1958. @table @option
  1959. @item h
  1960. Hz
  1961. @item q
  1962. Q-Factor
  1963. @item o
  1964. octave
  1965. @item s
  1966. slope
  1967. @item k
  1968. kHz
  1969. @end table
  1970. @item width, w
  1971. Determine how steep is the filter's shelf transition.
  1972. @item mix, m
  1973. How much to use filtered signal in output. Default is 1.
  1974. Range is between 0 and 1.
  1975. @item channels, c
  1976. Specify which channels to filter, by default all available are filtered.
  1977. @end table
  1978. @subsection Commands
  1979. This filter supports the following commands:
  1980. @table @option
  1981. @item frequency, f
  1982. Change bass frequency.
  1983. Syntax for the command is : "@var{frequency}"
  1984. @item width_type, t
  1985. Change bass width_type.
  1986. Syntax for the command is : "@var{width_type}"
  1987. @item width, w
  1988. Change bass width.
  1989. Syntax for the command is : "@var{width}"
  1990. @item gain, g
  1991. Change bass gain.
  1992. Syntax for the command is : "@var{gain}"
  1993. @item mix, m
  1994. Change bass mix.
  1995. Syntax for the command is : "@var{mix}"
  1996. @end table
  1997. @section biquad
  1998. Apply a biquad IIR filter with the given coefficients.
  1999. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2000. are the numerator and denominator coefficients respectively.
  2001. and @var{channels}, @var{c} specify which channels to filter, by default all
  2002. available are filtered.
  2003. @subsection Commands
  2004. This filter supports the following commands:
  2005. @table @option
  2006. @item a0
  2007. @item a1
  2008. @item a2
  2009. @item b0
  2010. @item b1
  2011. @item b2
  2012. Change biquad parameter.
  2013. Syntax for the command is : "@var{value}"
  2014. @item mix, m
  2015. How much to use filtered signal in output. Default is 1.
  2016. Range is between 0 and 1.
  2017. @end table
  2018. @section bs2b
  2019. Bauer stereo to binaural transformation, which improves headphone listening of
  2020. stereo audio records.
  2021. To enable compilation of this filter you need to configure FFmpeg with
  2022. @code{--enable-libbs2b}.
  2023. It accepts the following parameters:
  2024. @table @option
  2025. @item profile
  2026. Pre-defined crossfeed level.
  2027. @table @option
  2028. @item default
  2029. Default level (fcut=700, feed=50).
  2030. @item cmoy
  2031. Chu Moy circuit (fcut=700, feed=60).
  2032. @item jmeier
  2033. Jan Meier circuit (fcut=650, feed=95).
  2034. @end table
  2035. @item fcut
  2036. Cut frequency (in Hz).
  2037. @item feed
  2038. Feed level (in Hz).
  2039. @end table
  2040. @section channelmap
  2041. Remap input channels to new locations.
  2042. It accepts the following parameters:
  2043. @table @option
  2044. @item map
  2045. Map channels from input to output. The argument is a '|'-separated list of
  2046. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2047. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2048. channel (e.g. FL for front left) or its index in the input channel layout.
  2049. @var{out_channel} is the name of the output channel or its index in the output
  2050. channel layout. If @var{out_channel} is not given then it is implicitly an
  2051. index, starting with zero and increasing by one for each mapping.
  2052. @item channel_layout
  2053. The channel layout of the output stream.
  2054. @end table
  2055. If no mapping is present, the filter will implicitly map input channels to
  2056. output channels, preserving indices.
  2057. @subsection Examples
  2058. @itemize
  2059. @item
  2060. For example, assuming a 5.1+downmix input MOV file,
  2061. @example
  2062. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2063. @end example
  2064. will create an output WAV file tagged as stereo from the downmix channels of
  2065. the input.
  2066. @item
  2067. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2068. @example
  2069. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2070. @end example
  2071. @end itemize
  2072. @section channelsplit
  2073. Split each channel from an input audio stream into a separate output stream.
  2074. It accepts the following parameters:
  2075. @table @option
  2076. @item channel_layout
  2077. The channel layout of the input stream. The default is "stereo".
  2078. @item channels
  2079. A channel layout describing the channels to be extracted as separate output streams
  2080. or "all" to extract each input channel as a separate stream. The default is "all".
  2081. Choosing channels not present in channel layout in the input will result in an error.
  2082. @end table
  2083. @subsection Examples
  2084. @itemize
  2085. @item
  2086. For example, assuming a stereo input MP3 file,
  2087. @example
  2088. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2089. @end example
  2090. will create an output Matroska file with two audio streams, one containing only
  2091. the left channel and the other the right channel.
  2092. @item
  2093. Split a 5.1 WAV file into per-channel files:
  2094. @example
  2095. ffmpeg -i in.wav -filter_complex
  2096. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2097. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2098. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2099. side_right.wav
  2100. @end example
  2101. @item
  2102. Extract only LFE from a 5.1 WAV file:
  2103. @example
  2104. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2105. -map '[LFE]' lfe.wav
  2106. @end example
  2107. @end itemize
  2108. @section chorus
  2109. Add a chorus effect to the audio.
  2110. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2111. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2112. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2113. The modulation depth defines the range the modulated delay is played before or after
  2114. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2115. sound tuned around the original one, like in a chorus where some vocals are slightly
  2116. off key.
  2117. It accepts the following parameters:
  2118. @table @option
  2119. @item in_gain
  2120. Set input gain. Default is 0.4.
  2121. @item out_gain
  2122. Set output gain. Default is 0.4.
  2123. @item delays
  2124. Set delays. A typical delay is around 40ms to 60ms.
  2125. @item decays
  2126. Set decays.
  2127. @item speeds
  2128. Set speeds.
  2129. @item depths
  2130. Set depths.
  2131. @end table
  2132. @subsection Examples
  2133. @itemize
  2134. @item
  2135. A single delay:
  2136. @example
  2137. chorus=0.7:0.9:55:0.4:0.25:2
  2138. @end example
  2139. @item
  2140. Two delays:
  2141. @example
  2142. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2143. @end example
  2144. @item
  2145. Fuller sounding chorus with three delays:
  2146. @example
  2147. 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
  2148. @end example
  2149. @end itemize
  2150. @section compand
  2151. Compress or expand the audio's dynamic range.
  2152. It accepts the following parameters:
  2153. @table @option
  2154. @item attacks
  2155. @item decays
  2156. A list of times in seconds for each channel over which the instantaneous level
  2157. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2158. increase of volume and @var{decays} refers to decrease of volume. For most
  2159. situations, the attack time (response to the audio getting louder) should be
  2160. shorter than the decay time, because the human ear is more sensitive to sudden
  2161. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2162. a typical value for decay is 0.8 seconds.
  2163. If specified number of attacks & decays is lower than number of channels, the last
  2164. set attack/decay will be used for all remaining channels.
  2165. @item points
  2166. A list of points for the transfer function, specified in dB relative to the
  2167. maximum possible signal amplitude. Each key points list must be defined using
  2168. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2169. @code{x0/y0 x1/y1 x2/y2 ....}
  2170. The input values must be in strictly increasing order but the transfer function
  2171. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2172. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2173. function are @code{-70/-70|-60/-20|1/0}.
  2174. @item soft-knee
  2175. Set the curve radius in dB for all joints. It defaults to 0.01.
  2176. @item gain
  2177. Set the additional gain in dB to be applied at all points on the transfer
  2178. function. This allows for easy adjustment of the overall gain.
  2179. It defaults to 0.
  2180. @item volume
  2181. Set an initial volume, in dB, to be assumed for each channel when filtering
  2182. starts. This permits the user to supply a nominal level initially, so that, for
  2183. example, a very large gain is not applied to initial signal levels before the
  2184. companding has begun to operate. A typical value for audio which is initially
  2185. quiet is -90 dB. It defaults to 0.
  2186. @item delay
  2187. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2188. delayed before being fed to the volume adjuster. Specifying a delay
  2189. approximately equal to the attack/decay times allows the filter to effectively
  2190. operate in predictive rather than reactive mode. It defaults to 0.
  2191. @end table
  2192. @subsection Examples
  2193. @itemize
  2194. @item
  2195. Make music with both quiet and loud passages suitable for listening to in a
  2196. noisy environment:
  2197. @example
  2198. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2199. @end example
  2200. Another example for audio with whisper and explosion parts:
  2201. @example
  2202. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2203. @end example
  2204. @item
  2205. A noise gate for when the noise is at a lower level than the signal:
  2206. @example
  2207. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2208. @end example
  2209. @item
  2210. Here is another noise gate, this time for when the noise is at a higher level
  2211. than the signal (making it, in some ways, similar to squelch):
  2212. @example
  2213. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2214. @end example
  2215. @item
  2216. 2:1 compression starting at -6dB:
  2217. @example
  2218. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2219. @end example
  2220. @item
  2221. 2:1 compression starting at -9dB:
  2222. @example
  2223. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2224. @end example
  2225. @item
  2226. 2:1 compression starting at -12dB:
  2227. @example
  2228. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2229. @end example
  2230. @item
  2231. 2:1 compression starting at -18dB:
  2232. @example
  2233. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2234. @end example
  2235. @item
  2236. 3:1 compression starting at -15dB:
  2237. @example
  2238. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2239. @end example
  2240. @item
  2241. Compressor/Gate:
  2242. @example
  2243. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2244. @end example
  2245. @item
  2246. Expander:
  2247. @example
  2248. 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
  2249. @end example
  2250. @item
  2251. Hard limiter at -6dB:
  2252. @example
  2253. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2254. @end example
  2255. @item
  2256. Hard limiter at -12dB:
  2257. @example
  2258. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2259. @end example
  2260. @item
  2261. Hard noise gate at -35 dB:
  2262. @example
  2263. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2264. @end example
  2265. @item
  2266. Soft limiter:
  2267. @example
  2268. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2269. @end example
  2270. @end itemize
  2271. @section compensationdelay
  2272. Compensation Delay Line is a metric based delay to compensate differing
  2273. positions of microphones or speakers.
  2274. For example, you have recorded guitar with two microphones placed in
  2275. different location. Because the front of sound wave has fixed speed in
  2276. normal conditions, the phasing of microphones can vary and depends on
  2277. their location and interposition. The best sound mix can be achieved when
  2278. these microphones are in phase (synchronized). Note that distance of
  2279. ~30 cm between microphones makes one microphone to capture signal in
  2280. antiphase to another microphone. That makes the final mix sounding moody.
  2281. This filter helps to solve phasing problems by adding different delays
  2282. to each microphone track and make them synchronized.
  2283. The best result can be reached when you take one track as base and
  2284. synchronize other tracks one by one with it.
  2285. Remember that synchronization/delay tolerance depends on sample rate, too.
  2286. Higher sample rates will give more tolerance.
  2287. It accepts the following parameters:
  2288. @table @option
  2289. @item mm
  2290. Set millimeters distance. This is compensation distance for fine tuning.
  2291. Default is 0.
  2292. @item cm
  2293. Set cm distance. This is compensation distance for tightening distance setup.
  2294. Default is 0.
  2295. @item m
  2296. Set meters distance. This is compensation distance for hard distance setup.
  2297. Default is 0.
  2298. @item dry
  2299. Set dry amount. Amount of unprocessed (dry) signal.
  2300. Default is 0.
  2301. @item wet
  2302. Set wet amount. Amount of processed (wet) signal.
  2303. Default is 1.
  2304. @item temp
  2305. Set temperature degree in Celsius. This is the temperature of the environment.
  2306. Default is 20.
  2307. @end table
  2308. @section crossfeed
  2309. Apply headphone crossfeed filter.
  2310. Crossfeed is the process of blending the left and right channels of stereo
  2311. audio recording.
  2312. It is mainly used to reduce extreme stereo separation of low frequencies.
  2313. The intent is to produce more speaker like sound to the listener.
  2314. The filter accepts the following options:
  2315. @table @option
  2316. @item strength
  2317. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2318. This sets gain of low shelf filter for side part of stereo image.
  2319. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2320. @item range
  2321. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2322. This sets cut off frequency of low shelf filter. Default is cut off near
  2323. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2324. @item level_in
  2325. Set input gain. Default is 0.9.
  2326. @item level_out
  2327. Set output gain. Default is 1.
  2328. @end table
  2329. @section crystalizer
  2330. Simple algorithm to expand audio dynamic range.
  2331. The filter accepts the following options:
  2332. @table @option
  2333. @item i
  2334. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2335. (unchanged sound) to 10.0 (maximum effect).
  2336. @item c
  2337. Enable clipping. By default is enabled.
  2338. @end table
  2339. @section dcshift
  2340. Apply a DC shift to the audio.
  2341. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2342. in the recording chain) from the audio. The effect of a DC offset is reduced
  2343. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2344. a signal has a DC offset.
  2345. @table @option
  2346. @item shift
  2347. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2348. the audio.
  2349. @item limitergain
  2350. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2351. used to prevent clipping.
  2352. @end table
  2353. @section deesser
  2354. Apply de-essing to the audio samples.
  2355. @table @option
  2356. @item i
  2357. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2358. Default is 0.
  2359. @item m
  2360. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2361. Default is 0.5.
  2362. @item f
  2363. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2364. Default is 0.5.
  2365. @item s
  2366. Set the output mode.
  2367. It accepts the following values:
  2368. @table @option
  2369. @item i
  2370. Pass input unchanged.
  2371. @item o
  2372. Pass ess filtered out.
  2373. @item e
  2374. Pass only ess.
  2375. Default value is @var{o}.
  2376. @end table
  2377. @end table
  2378. @section drmeter
  2379. Measure audio dynamic range.
  2380. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2381. is found in transition material. And anything less that 8 have very poor dynamics
  2382. and is very compressed.
  2383. The filter accepts the following options:
  2384. @table @option
  2385. @item length
  2386. Set window length in seconds used to split audio into segments of equal length.
  2387. Default is 3 seconds.
  2388. @end table
  2389. @section dynaudnorm
  2390. Dynamic Audio Normalizer.
  2391. This filter applies a certain amount of gain to the input audio in order
  2392. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2393. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2394. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2395. This allows for applying extra gain to the "quiet" sections of the audio
  2396. while avoiding distortions or clipping the "loud" sections. In other words:
  2397. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2398. sections, in the sense that the volume of each section is brought to the
  2399. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2400. this goal *without* applying "dynamic range compressing". It will retain 100%
  2401. of the dynamic range *within* each section of the audio file.
  2402. @table @option
  2403. @item f
  2404. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2405. Default is 500 milliseconds.
  2406. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2407. referred to as frames. This is required, because a peak magnitude has no
  2408. meaning for just a single sample value. Instead, we need to determine the
  2409. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2410. normalizer would simply use the peak magnitude of the complete file, the
  2411. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2412. frame. The length of a frame is specified in milliseconds. By default, the
  2413. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2414. been found to give good results with most files.
  2415. Note that the exact frame length, in number of samples, will be determined
  2416. automatically, based on the sampling rate of the individual input audio file.
  2417. @item g
  2418. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2419. number. Default is 31.
  2420. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2421. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2422. is specified in frames, centered around the current frame. For the sake of
  2423. simplicity, this must be an odd number. Consequently, the default value of 31
  2424. takes into account the current frame, as well as the 15 preceding frames and
  2425. the 15 subsequent frames. Using a larger window results in a stronger
  2426. smoothing effect and thus in less gain variation, i.e. slower gain
  2427. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2428. effect and thus in more gain variation, i.e. faster gain adaptation.
  2429. In other words, the more you increase this value, the more the Dynamic Audio
  2430. Normalizer will behave like a "traditional" normalization filter. On the
  2431. contrary, the more you decrease this value, the more the Dynamic Audio
  2432. Normalizer will behave like a dynamic range compressor.
  2433. @item p
  2434. Set the target peak value. This specifies the highest permissible magnitude
  2435. level for the normalized audio input. This filter will try to approach the
  2436. target peak magnitude as closely as possible, but at the same time it also
  2437. makes sure that the normalized signal will never exceed the peak magnitude.
  2438. A frame's maximum local gain factor is imposed directly by the target peak
  2439. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2440. It is not recommended to go above this value.
  2441. @item m
  2442. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2443. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2444. factor for each input frame, i.e. the maximum gain factor that does not
  2445. result in clipping or distortion. The maximum gain factor is determined by
  2446. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2447. additionally bounds the frame's maximum gain factor by a predetermined
  2448. (global) maximum gain factor. This is done in order to avoid excessive gain
  2449. factors in "silent" or almost silent frames. By default, the maximum gain
  2450. factor is 10.0, For most inputs the default value should be sufficient and
  2451. it usually is not recommended to increase this value. Though, for input
  2452. with an extremely low overall volume level, it may be necessary to allow even
  2453. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2454. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2455. Instead, a "sigmoid" threshold function will be applied. This way, the
  2456. gain factors will smoothly approach the threshold value, but never exceed that
  2457. value.
  2458. @item r
  2459. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2460. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2461. This means that the maximum local gain factor for each frame is defined
  2462. (only) by the frame's highest magnitude sample. This way, the samples can
  2463. be amplified as much as possible without exceeding the maximum signal
  2464. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2465. Normalizer can also take into account the frame's root mean square,
  2466. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2467. determine the power of a time-varying signal. It is therefore considered
  2468. that the RMS is a better approximation of the "perceived loudness" than
  2469. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2470. frames to a constant RMS value, a uniform "perceived loudness" can be
  2471. established. If a target RMS value has been specified, a frame's local gain
  2472. factor is defined as the factor that would result in exactly that RMS value.
  2473. Note, however, that the maximum local gain factor is still restricted by the
  2474. frame's highest magnitude sample, in order to prevent clipping.
  2475. @item n
  2476. Enable channels coupling. By default is enabled.
  2477. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2478. amount. This means the same gain factor will be applied to all channels, i.e.
  2479. the maximum possible gain factor is determined by the "loudest" channel.
  2480. However, in some recordings, it may happen that the volume of the different
  2481. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2482. In this case, this option can be used to disable the channel coupling. This way,
  2483. the gain factor will be determined independently for each channel, depending
  2484. only on the individual channel's highest magnitude sample. This allows for
  2485. harmonizing the volume of the different channels.
  2486. @item c
  2487. Enable DC bias correction. By default is disabled.
  2488. An audio signal (in the time domain) is a sequence of sample values.
  2489. In the Dynamic Audio Normalizer these sample values are represented in the
  2490. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2491. audio signal, or "waveform", should be centered around the zero point.
  2492. That means if we calculate the mean value of all samples in a file, or in a
  2493. single frame, then the result should be 0.0 or at least very close to that
  2494. value. If, however, there is a significant deviation of the mean value from
  2495. 0.0, in either positive or negative direction, this is referred to as a
  2496. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2497. Audio Normalizer provides optional DC bias correction.
  2498. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2499. the mean value, or "DC correction" offset, of each input frame and subtract
  2500. that value from all of the frame's sample values which ensures those samples
  2501. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2502. boundaries, the DC correction offset values will be interpolated smoothly
  2503. between neighbouring frames.
  2504. @item b
  2505. Enable alternative boundary mode. By default is disabled.
  2506. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2507. around each frame. This includes the preceding frames as well as the
  2508. subsequent frames. However, for the "boundary" frames, located at the very
  2509. beginning and at the very end of the audio file, not all neighbouring
  2510. frames are available. In particular, for the first few frames in the audio
  2511. file, the preceding frames are not known. And, similarly, for the last few
  2512. frames in the audio file, the subsequent frames are not known. Thus, the
  2513. question arises which gain factors should be assumed for the missing frames
  2514. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2515. to deal with this situation. The default boundary mode assumes a gain factor
  2516. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2517. "fade out" at the beginning and at the end of the input, respectively.
  2518. @item s
  2519. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2520. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2521. compression. This means that signal peaks will not be pruned and thus the
  2522. full dynamic range will be retained within each local neighbourhood. However,
  2523. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2524. normalization algorithm with a more "traditional" compression.
  2525. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2526. (thresholding) function. If (and only if) the compression feature is enabled,
  2527. all input frames will be processed by a soft knee thresholding function prior
  2528. to the actual normalization process. Put simply, the thresholding function is
  2529. going to prune all samples whose magnitude exceeds a certain threshold value.
  2530. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2531. value. Instead, the threshold value will be adjusted for each individual
  2532. frame.
  2533. In general, smaller parameters result in stronger compression, and vice versa.
  2534. Values below 3.0 are not recommended, because audible distortion may appear.
  2535. @end table
  2536. @section earwax
  2537. Make audio easier to listen to on headphones.
  2538. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2539. so that when listened to on headphones the stereo image is moved from
  2540. inside your head (standard for headphones) to outside and in front of
  2541. the listener (standard for speakers).
  2542. Ported from SoX.
  2543. @section equalizer
  2544. Apply a two-pole peaking equalisation (EQ) filter. With this
  2545. filter, the signal-level at and around a selected frequency can
  2546. be increased or decreased, whilst (unlike bandpass and bandreject
  2547. filters) that at all other frequencies is unchanged.
  2548. In order to produce complex equalisation curves, this filter can
  2549. be given several times, each with a different central frequency.
  2550. The filter accepts the following options:
  2551. @table @option
  2552. @item frequency, f
  2553. Set the filter's central frequency in Hz.
  2554. @item width_type, t
  2555. Set method to specify band-width of filter.
  2556. @table @option
  2557. @item h
  2558. Hz
  2559. @item q
  2560. Q-Factor
  2561. @item o
  2562. octave
  2563. @item s
  2564. slope
  2565. @item k
  2566. kHz
  2567. @end table
  2568. @item width, w
  2569. Specify the band-width of a filter in width_type units.
  2570. @item gain, g
  2571. Set the required gain or attenuation in dB.
  2572. Beware of clipping when using a positive gain.
  2573. @item mix, m
  2574. How much to use filtered signal in output. Default is 1.
  2575. Range is between 0 and 1.
  2576. @item channels, c
  2577. Specify which channels to filter, by default all available are filtered.
  2578. @end table
  2579. @subsection Examples
  2580. @itemize
  2581. @item
  2582. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2583. @example
  2584. equalizer=f=1000:t=h:width=200:g=-10
  2585. @end example
  2586. @item
  2587. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2588. @example
  2589. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2590. @end example
  2591. @end itemize
  2592. @subsection Commands
  2593. This filter supports the following commands:
  2594. @table @option
  2595. @item frequency, f
  2596. Change equalizer frequency.
  2597. Syntax for the command is : "@var{frequency}"
  2598. @item width_type, t
  2599. Change equalizer width_type.
  2600. Syntax for the command is : "@var{width_type}"
  2601. @item width, w
  2602. Change equalizer width.
  2603. Syntax for the command is : "@var{width}"
  2604. @item gain, g
  2605. Change equalizer gain.
  2606. Syntax for the command is : "@var{gain}"
  2607. @item mix, m
  2608. Change equalizer mix.
  2609. Syntax for the command is : "@var{mix}"
  2610. @end table
  2611. @section extrastereo
  2612. Linearly increases the difference between left and right channels which
  2613. adds some sort of "live" effect to playback.
  2614. The filter accepts the following options:
  2615. @table @option
  2616. @item m
  2617. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2618. (average of both channels), with 1.0 sound will be unchanged, with
  2619. -1.0 left and right channels will be swapped.
  2620. @item c
  2621. Enable clipping. By default is enabled.
  2622. @end table
  2623. @section firequalizer
  2624. Apply FIR Equalization using arbitrary frequency response.
  2625. The filter accepts the following option:
  2626. @table @option
  2627. @item gain
  2628. Set gain curve equation (in dB). The expression can contain variables:
  2629. @table @option
  2630. @item f
  2631. the evaluated frequency
  2632. @item sr
  2633. sample rate
  2634. @item ch
  2635. channel number, set to 0 when multichannels evaluation is disabled
  2636. @item chid
  2637. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2638. multichannels evaluation is disabled
  2639. @item chs
  2640. number of channels
  2641. @item chlayout
  2642. channel_layout, see libavutil/channel_layout.h
  2643. @end table
  2644. and functions:
  2645. @table @option
  2646. @item gain_interpolate(f)
  2647. interpolate gain on frequency f based on gain_entry
  2648. @item cubic_interpolate(f)
  2649. same as gain_interpolate, but smoother
  2650. @end table
  2651. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2652. @item gain_entry
  2653. Set gain entry for gain_interpolate function. The expression can
  2654. contain functions:
  2655. @table @option
  2656. @item entry(f, g)
  2657. store gain entry at frequency f with value g
  2658. @end table
  2659. This option is also available as command.
  2660. @item delay
  2661. Set filter delay in seconds. Higher value means more accurate.
  2662. Default is @code{0.01}.
  2663. @item accuracy
  2664. Set filter accuracy in Hz. Lower value means more accurate.
  2665. Default is @code{5}.
  2666. @item wfunc
  2667. Set window function. Acceptable values are:
  2668. @table @option
  2669. @item rectangular
  2670. rectangular window, useful when gain curve is already smooth
  2671. @item hann
  2672. hann window (default)
  2673. @item hamming
  2674. hamming window
  2675. @item blackman
  2676. blackman window
  2677. @item nuttall3
  2678. 3-terms continuous 1st derivative nuttall window
  2679. @item mnuttall3
  2680. minimum 3-terms discontinuous nuttall window
  2681. @item nuttall
  2682. 4-terms continuous 1st derivative nuttall window
  2683. @item bnuttall
  2684. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2685. @item bharris
  2686. blackman-harris window
  2687. @item tukey
  2688. tukey window
  2689. @end table
  2690. @item fixed
  2691. If enabled, use fixed number of audio samples. This improves speed when
  2692. filtering with large delay. Default is disabled.
  2693. @item multi
  2694. Enable multichannels evaluation on gain. Default is disabled.
  2695. @item zero_phase
  2696. Enable zero phase mode by subtracting timestamp to compensate delay.
  2697. Default is disabled.
  2698. @item scale
  2699. Set scale used by gain. Acceptable values are:
  2700. @table @option
  2701. @item linlin
  2702. linear frequency, linear gain
  2703. @item linlog
  2704. linear frequency, logarithmic (in dB) gain (default)
  2705. @item loglin
  2706. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2707. @item loglog
  2708. logarithmic frequency, logarithmic gain
  2709. @end table
  2710. @item dumpfile
  2711. Set file for dumping, suitable for gnuplot.
  2712. @item dumpscale
  2713. Set scale for dumpfile. Acceptable values are same with scale option.
  2714. Default is linlog.
  2715. @item fft2
  2716. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2717. Default is disabled.
  2718. @item min_phase
  2719. Enable minimum phase impulse response. Default is disabled.
  2720. @end table
  2721. @subsection Examples
  2722. @itemize
  2723. @item
  2724. lowpass at 1000 Hz:
  2725. @example
  2726. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2727. @end example
  2728. @item
  2729. lowpass at 1000 Hz with gain_entry:
  2730. @example
  2731. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2732. @end example
  2733. @item
  2734. custom equalization:
  2735. @example
  2736. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2737. @end example
  2738. @item
  2739. higher delay with zero phase to compensate delay:
  2740. @example
  2741. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2742. @end example
  2743. @item
  2744. lowpass on left channel, highpass on right channel:
  2745. @example
  2746. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2747. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2748. @end example
  2749. @end itemize
  2750. @section flanger
  2751. Apply a flanging effect to the audio.
  2752. The filter accepts the following options:
  2753. @table @option
  2754. @item delay
  2755. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2756. @item depth
  2757. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2758. @item regen
  2759. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2760. Default value is 0.
  2761. @item width
  2762. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2763. Default value is 71.
  2764. @item speed
  2765. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2766. @item shape
  2767. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2768. Default value is @var{sinusoidal}.
  2769. @item phase
  2770. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2771. Default value is 25.
  2772. @item interp
  2773. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2774. Default is @var{linear}.
  2775. @end table
  2776. @section haas
  2777. Apply Haas effect to audio.
  2778. Note that this makes most sense to apply on mono signals.
  2779. With this filter applied to mono signals it give some directionality and
  2780. stretches its stereo image.
  2781. The filter accepts the following options:
  2782. @table @option
  2783. @item level_in
  2784. Set input level. By default is @var{1}, or 0dB
  2785. @item level_out
  2786. Set output level. By default is @var{1}, or 0dB.
  2787. @item side_gain
  2788. Set gain applied to side part of signal. By default is @var{1}.
  2789. @item middle_source
  2790. Set kind of middle source. Can be one of the following:
  2791. @table @samp
  2792. @item left
  2793. Pick left channel.
  2794. @item right
  2795. Pick right channel.
  2796. @item mid
  2797. Pick middle part signal of stereo image.
  2798. @item side
  2799. Pick side part signal of stereo image.
  2800. @end table
  2801. @item middle_phase
  2802. Change middle phase. By default is disabled.
  2803. @item left_delay
  2804. Set left channel delay. By default is @var{2.05} milliseconds.
  2805. @item left_balance
  2806. Set left channel balance. By default is @var{-1}.
  2807. @item left_gain
  2808. Set left channel gain. By default is @var{1}.
  2809. @item left_phase
  2810. Change left phase. By default is disabled.
  2811. @item right_delay
  2812. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2813. @item right_balance
  2814. Set right channel balance. By default is @var{1}.
  2815. @item right_gain
  2816. Set right channel gain. By default is @var{1}.
  2817. @item right_phase
  2818. Change right phase. By default is enabled.
  2819. @end table
  2820. @section hdcd
  2821. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2822. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2823. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2824. of HDCD, and detects the Transient Filter flag.
  2825. @example
  2826. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2827. @end example
  2828. When using the filter with wav, note the default encoding for wav is 16-bit,
  2829. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2830. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2831. @example
  2832. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2833. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2834. @end example
  2835. The filter accepts the following options:
  2836. @table @option
  2837. @item disable_autoconvert
  2838. Disable any automatic format conversion or resampling in the filter graph.
  2839. @item process_stereo
  2840. Process the stereo channels together. If target_gain does not match between
  2841. channels, consider it invalid and use the last valid target_gain.
  2842. @item cdt_ms
  2843. Set the code detect timer period in ms.
  2844. @item force_pe
  2845. Always extend peaks above -3dBFS even if PE isn't signaled.
  2846. @item analyze_mode
  2847. Replace audio with a solid tone and adjust the amplitude to signal some
  2848. specific aspect of the decoding process. The output file can be loaded in
  2849. an audio editor alongside the original to aid analysis.
  2850. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2851. Modes are:
  2852. @table @samp
  2853. @item 0, off
  2854. Disabled
  2855. @item 1, lle
  2856. Gain adjustment level at each sample
  2857. @item 2, pe
  2858. Samples where peak extend occurs
  2859. @item 3, cdt
  2860. Samples where the code detect timer is active
  2861. @item 4, tgm
  2862. Samples where the target gain does not match between channels
  2863. @end table
  2864. @end table
  2865. @section headphone
  2866. Apply head-related transfer functions (HRTFs) to create virtual
  2867. loudspeakers around the user for binaural listening via headphones.
  2868. The HRIRs are provided via additional streams, for each channel
  2869. one stereo input stream is needed.
  2870. The filter accepts the following options:
  2871. @table @option
  2872. @item map
  2873. Set mapping of input streams for convolution.
  2874. The argument is a '|'-separated list of channel names in order as they
  2875. are given as additional stream inputs for filter.
  2876. This also specify number of input streams. Number of input streams
  2877. must be not less than number of channels in first stream plus one.
  2878. @item gain
  2879. Set gain applied to audio. Value is in dB. Default is 0.
  2880. @item type
  2881. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2882. processing audio in time domain which is slow.
  2883. @var{freq} is processing audio in frequency domain which is fast.
  2884. Default is @var{freq}.
  2885. @item lfe
  2886. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2887. @item size
  2888. Set size of frame in number of samples which will be processed at once.
  2889. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2890. @item hrir
  2891. Set format of hrir stream.
  2892. Default value is @var{stereo}. Alternative value is @var{multich}.
  2893. If value is set to @var{stereo}, number of additional streams should
  2894. be greater or equal to number of input channels in first input stream.
  2895. Also each additional stream should have stereo number of channels.
  2896. If value is set to @var{multich}, number of additional streams should
  2897. be exactly one. Also number of input channels of additional stream
  2898. should be equal or greater than twice number of channels of first input
  2899. stream.
  2900. @end table
  2901. @subsection Examples
  2902. @itemize
  2903. @item
  2904. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2905. each amovie filter use stereo file with IR coefficients as input.
  2906. The files give coefficients for each position of virtual loudspeaker:
  2907. @example
  2908. ffmpeg -i input.wav
  2909. -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"
  2910. output.wav
  2911. @end example
  2912. @item
  2913. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2914. but now in @var{multich} @var{hrir} format.
  2915. @example
  2916. 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"
  2917. output.wav
  2918. @end example
  2919. @end itemize
  2920. @section highpass
  2921. Apply a high-pass filter with 3dB point frequency.
  2922. The filter can be either single-pole, or double-pole (the default).
  2923. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2924. The filter accepts the following options:
  2925. @table @option
  2926. @item frequency, f
  2927. Set frequency in Hz. Default is 3000.
  2928. @item poles, p
  2929. Set number of poles. Default is 2.
  2930. @item width_type, t
  2931. Set method to specify band-width of filter.
  2932. @table @option
  2933. @item h
  2934. Hz
  2935. @item q
  2936. Q-Factor
  2937. @item o
  2938. octave
  2939. @item s
  2940. slope
  2941. @item k
  2942. kHz
  2943. @end table
  2944. @item width, w
  2945. Specify the band-width of a filter in width_type units.
  2946. Applies only to double-pole filter.
  2947. The default is 0.707q and gives a Butterworth response.
  2948. @item mix, m
  2949. How much to use filtered signal in output. Default is 1.
  2950. Range is between 0 and 1.
  2951. @item channels, c
  2952. Specify which channels to filter, by default all available are filtered.
  2953. @end table
  2954. @subsection Commands
  2955. This filter supports the following commands:
  2956. @table @option
  2957. @item frequency, f
  2958. Change highpass frequency.
  2959. Syntax for the command is : "@var{frequency}"
  2960. @item width_type, t
  2961. Change highpass width_type.
  2962. Syntax for the command is : "@var{width_type}"
  2963. @item width, w
  2964. Change highpass width.
  2965. Syntax for the command is : "@var{width}"
  2966. @item mix, m
  2967. Change highpass mix.
  2968. Syntax for the command is : "@var{mix}"
  2969. @end table
  2970. @section join
  2971. Join multiple input streams into one multi-channel stream.
  2972. It accepts the following parameters:
  2973. @table @option
  2974. @item inputs
  2975. The number of input streams. It defaults to 2.
  2976. @item channel_layout
  2977. The desired output channel layout. It defaults to stereo.
  2978. @item map
  2979. Map channels from inputs to output. The argument is a '|'-separated list of
  2980. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2981. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2982. can be either the name of the input channel (e.g. FL for front left) or its
  2983. index in the specified input stream. @var{out_channel} is the name of the output
  2984. channel.
  2985. @end table
  2986. The filter will attempt to guess the mappings when they are not specified
  2987. explicitly. It does so by first trying to find an unused matching input channel
  2988. and if that fails it picks the first unused input channel.
  2989. Join 3 inputs (with properly set channel layouts):
  2990. @example
  2991. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2992. @end example
  2993. Build a 5.1 output from 6 single-channel streams:
  2994. @example
  2995. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2996. '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'
  2997. out
  2998. @end example
  2999. @section ladspa
  3000. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3001. To enable compilation of this filter you need to configure FFmpeg with
  3002. @code{--enable-ladspa}.
  3003. @table @option
  3004. @item file, f
  3005. Specifies the name of LADSPA plugin library to load. If the environment
  3006. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3007. each one of the directories specified by the colon separated list in
  3008. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3009. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3010. @file{/usr/lib/ladspa/}.
  3011. @item plugin, p
  3012. Specifies the plugin within the library. Some libraries contain only
  3013. one plugin, but others contain many of them. If this is not set filter
  3014. will list all available plugins within the specified library.
  3015. @item controls, c
  3016. Set the '|' separated list of controls which are zero or more floating point
  3017. values that determine the behavior of the loaded plugin (for example delay,
  3018. threshold or gain).
  3019. Controls need to be defined using the following syntax:
  3020. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3021. @var{valuei} is the value set on the @var{i}-th control.
  3022. Alternatively they can be also defined using the following syntax:
  3023. @var{value0}|@var{value1}|@var{value2}|..., where
  3024. @var{valuei} is the value set on the @var{i}-th control.
  3025. If @option{controls} is set to @code{help}, all available controls and
  3026. their valid ranges are printed.
  3027. @item sample_rate, s
  3028. Specify the sample rate, default to 44100. Only used if plugin have
  3029. zero inputs.
  3030. @item nb_samples, n
  3031. Set the number of samples per channel per each output frame, default
  3032. is 1024. Only used if plugin have zero inputs.
  3033. @item duration, d
  3034. Set the minimum duration of the sourced audio. See
  3035. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3036. for the accepted syntax.
  3037. Note that the resulting duration may be greater than the specified duration,
  3038. as the generated audio is always cut at the end of a complete frame.
  3039. If not specified, or the expressed duration is negative, the audio is
  3040. supposed to be generated forever.
  3041. Only used if plugin have zero inputs.
  3042. @end table
  3043. @subsection Examples
  3044. @itemize
  3045. @item
  3046. List all available plugins within amp (LADSPA example plugin) library:
  3047. @example
  3048. ladspa=file=amp
  3049. @end example
  3050. @item
  3051. List all available controls and their valid ranges for @code{vcf_notch}
  3052. plugin from @code{VCF} library:
  3053. @example
  3054. ladspa=f=vcf:p=vcf_notch:c=help
  3055. @end example
  3056. @item
  3057. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3058. plugin library:
  3059. @example
  3060. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3061. @end example
  3062. @item
  3063. Add reverberation to the audio using TAP-plugins
  3064. (Tom's Audio Processing plugins):
  3065. @example
  3066. ladspa=file=tap_reverb:tap_reverb
  3067. @end example
  3068. @item
  3069. Generate white noise, with 0.2 amplitude:
  3070. @example
  3071. ladspa=file=cmt:noise_source_white:c=c0=.2
  3072. @end example
  3073. @item
  3074. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3075. @code{C* Audio Plugin Suite} (CAPS) library:
  3076. @example
  3077. ladspa=file=caps:Click:c=c1=20'
  3078. @end example
  3079. @item
  3080. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3081. @example
  3082. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3083. @end example
  3084. @item
  3085. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3086. @code{SWH Plugins} collection:
  3087. @example
  3088. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3089. @end example
  3090. @item
  3091. Attenuate low frequencies using Multiband EQ from Steve Harris
  3092. @code{SWH Plugins} collection:
  3093. @example
  3094. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3095. @end example
  3096. @item
  3097. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3098. (CAPS) library:
  3099. @example
  3100. ladspa=caps:Narrower
  3101. @end example
  3102. @item
  3103. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3104. @example
  3105. ladspa=caps:White:.2
  3106. @end example
  3107. @item
  3108. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3109. @example
  3110. ladspa=caps:Fractal:c=c1=1
  3111. @end example
  3112. @item
  3113. Dynamic volume normalization using @code{VLevel} plugin:
  3114. @example
  3115. ladspa=vlevel-ladspa:vlevel_mono
  3116. @end example
  3117. @end itemize
  3118. @subsection Commands
  3119. This filter supports the following commands:
  3120. @table @option
  3121. @item cN
  3122. Modify the @var{N}-th control value.
  3123. If the specified value is not valid, it is ignored and prior one is kept.
  3124. @end table
  3125. @section loudnorm
  3126. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3127. Support for both single pass (livestreams, files) and double pass (files) modes.
  3128. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3129. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3130. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3131. The filter accepts the following options:
  3132. @table @option
  3133. @item I, i
  3134. Set integrated loudness target.
  3135. Range is -70.0 - -5.0. Default value is -24.0.
  3136. @item LRA, lra
  3137. Set loudness range target.
  3138. Range is 1.0 - 20.0. Default value is 7.0.
  3139. @item TP, tp
  3140. Set maximum true peak.
  3141. Range is -9.0 - +0.0. Default value is -2.0.
  3142. @item measured_I, measured_i
  3143. Measured IL of input file.
  3144. Range is -99.0 - +0.0.
  3145. @item measured_LRA, measured_lra
  3146. Measured LRA of input file.
  3147. Range is 0.0 - 99.0.
  3148. @item measured_TP, measured_tp
  3149. Measured true peak of input file.
  3150. Range is -99.0 - +99.0.
  3151. @item measured_thresh
  3152. Measured threshold of input file.
  3153. Range is -99.0 - +0.0.
  3154. @item offset
  3155. Set offset gain. Gain is applied before the true-peak limiter.
  3156. Range is -99.0 - +99.0. Default is +0.0.
  3157. @item linear
  3158. Normalize linearly if possible.
  3159. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3160. to be specified in order to use this mode.
  3161. Options are true or false. Default is true.
  3162. @item dual_mono
  3163. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3164. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3165. If set to @code{true}, this option will compensate for this effect.
  3166. Multi-channel input files are not affected by this option.
  3167. Options are true or false. Default is false.
  3168. @item print_format
  3169. Set print format for stats. Options are summary, json, or none.
  3170. Default value is none.
  3171. @end table
  3172. @section lowpass
  3173. Apply a low-pass filter with 3dB point frequency.
  3174. The filter can be either single-pole or double-pole (the default).
  3175. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3176. The filter accepts the following options:
  3177. @table @option
  3178. @item frequency, f
  3179. Set frequency in Hz. Default is 500.
  3180. @item poles, p
  3181. Set number of poles. Default is 2.
  3182. @item width_type, t
  3183. Set method to specify band-width of filter.
  3184. @table @option
  3185. @item h
  3186. Hz
  3187. @item q
  3188. Q-Factor
  3189. @item o
  3190. octave
  3191. @item s
  3192. slope
  3193. @item k
  3194. kHz
  3195. @end table
  3196. @item width, w
  3197. Specify the band-width of a filter in width_type units.
  3198. Applies only to double-pole filter.
  3199. The default is 0.707q and gives a Butterworth response.
  3200. @item mix, m
  3201. How much to use filtered signal in output. Default is 1.
  3202. Range is between 0 and 1.
  3203. @item channels, c
  3204. Specify which channels to filter, by default all available are filtered.
  3205. @end table
  3206. @subsection Examples
  3207. @itemize
  3208. @item
  3209. Lowpass only LFE channel, it LFE is not present it does nothing:
  3210. @example
  3211. lowpass=c=LFE
  3212. @end example
  3213. @end itemize
  3214. @subsection Commands
  3215. This filter supports the following commands:
  3216. @table @option
  3217. @item frequency, f
  3218. Change lowpass frequency.
  3219. Syntax for the command is : "@var{frequency}"
  3220. @item width_type, t
  3221. Change lowpass width_type.
  3222. Syntax for the command is : "@var{width_type}"
  3223. @item width, w
  3224. Change lowpass width.
  3225. Syntax for the command is : "@var{width}"
  3226. @item mix, m
  3227. Change lowpass mix.
  3228. Syntax for the command is : "@var{mix}"
  3229. @end table
  3230. @section lv2
  3231. Load a LV2 (LADSPA Version 2) plugin.
  3232. To enable compilation of this filter you need to configure FFmpeg with
  3233. @code{--enable-lv2}.
  3234. @table @option
  3235. @item plugin, p
  3236. Specifies the plugin URI. You may need to escape ':'.
  3237. @item controls, c
  3238. Set the '|' separated list of controls which are zero or more floating point
  3239. values that determine the behavior of the loaded plugin (for example delay,
  3240. threshold or gain).
  3241. If @option{controls} is set to @code{help}, all available controls and
  3242. their valid ranges are printed.
  3243. @item sample_rate, s
  3244. Specify the sample rate, default to 44100. Only used if plugin have
  3245. zero inputs.
  3246. @item nb_samples, n
  3247. Set the number of samples per channel per each output frame, default
  3248. is 1024. Only used if plugin have zero inputs.
  3249. @item duration, d
  3250. Set the minimum duration of the sourced audio. See
  3251. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3252. for the accepted syntax.
  3253. Note that the resulting duration may be greater than the specified duration,
  3254. as the generated audio is always cut at the end of a complete frame.
  3255. If not specified, or the expressed duration is negative, the audio is
  3256. supposed to be generated forever.
  3257. Only used if plugin have zero inputs.
  3258. @end table
  3259. @subsection Examples
  3260. @itemize
  3261. @item
  3262. Apply bass enhancer plugin from Calf:
  3263. @example
  3264. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3265. @end example
  3266. @item
  3267. Apply vinyl plugin from Calf:
  3268. @example
  3269. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3270. @end example
  3271. @item
  3272. Apply bit crusher plugin from ArtyFX:
  3273. @example
  3274. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3275. @end example
  3276. @end itemize
  3277. @section mcompand
  3278. Multiband Compress or expand the audio's dynamic range.
  3279. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3280. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3281. response when absent compander action.
  3282. It accepts the following parameters:
  3283. @table @option
  3284. @item args
  3285. This option syntax is:
  3286. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3287. For explanation of each item refer to compand filter documentation.
  3288. @end table
  3289. @anchor{pan}
  3290. @section pan
  3291. Mix channels with specific gain levels. The filter accepts the output
  3292. channel layout followed by a set of channels definitions.
  3293. This filter is also designed to efficiently remap the channels of an audio
  3294. stream.
  3295. The filter accepts parameters of the form:
  3296. "@var{l}|@var{outdef}|@var{outdef}|..."
  3297. @table @option
  3298. @item l
  3299. output channel layout or number of channels
  3300. @item outdef
  3301. output channel specification, of the form:
  3302. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3303. @item out_name
  3304. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3305. number (c0, c1, etc.)
  3306. @item gain
  3307. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3308. @item in_name
  3309. input channel to use, see out_name for details; it is not possible to mix
  3310. named and numbered input channels
  3311. @end table
  3312. If the `=' in a channel specification is replaced by `<', then the gains for
  3313. that specification will be renormalized so that the total is 1, thus
  3314. avoiding clipping noise.
  3315. @subsection Mixing examples
  3316. For example, if you want to down-mix from stereo to mono, but with a bigger
  3317. factor for the left channel:
  3318. @example
  3319. pan=1c|c0=0.9*c0+0.1*c1
  3320. @end example
  3321. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3322. 7-channels surround:
  3323. @example
  3324. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3325. @end example
  3326. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3327. that should be preferred (see "-ac" option) unless you have very specific
  3328. needs.
  3329. @subsection Remapping examples
  3330. The channel remapping will be effective if, and only if:
  3331. @itemize
  3332. @item gain coefficients are zeroes or ones,
  3333. @item only one input per channel output,
  3334. @end itemize
  3335. If all these conditions are satisfied, the filter will notify the user ("Pure
  3336. channel mapping detected"), and use an optimized and lossless method to do the
  3337. remapping.
  3338. For example, if you have a 5.1 source and want a stereo audio stream by
  3339. dropping the extra channels:
  3340. @example
  3341. pan="stereo| c0=FL | c1=FR"
  3342. @end example
  3343. Given the same source, you can also switch front left and front right channels
  3344. and keep the input channel layout:
  3345. @example
  3346. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3347. @end example
  3348. If the input is a stereo audio stream, you can mute the front left channel (and
  3349. still keep the stereo channel layout) with:
  3350. @example
  3351. pan="stereo|c1=c1"
  3352. @end example
  3353. Still with a stereo audio stream input, you can copy the right channel in both
  3354. front left and right:
  3355. @example
  3356. pan="stereo| c0=FR | c1=FR"
  3357. @end example
  3358. @section replaygain
  3359. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3360. outputs it unchanged.
  3361. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3362. @section resample
  3363. Convert the audio sample format, sample rate and channel layout. It is
  3364. not meant to be used directly.
  3365. @section rubberband
  3366. Apply time-stretching and pitch-shifting with librubberband.
  3367. To enable compilation of this filter, you need to configure FFmpeg with
  3368. @code{--enable-librubberband}.
  3369. The filter accepts the following options:
  3370. @table @option
  3371. @item tempo
  3372. Set tempo scale factor.
  3373. @item pitch
  3374. Set pitch scale factor.
  3375. @item transients
  3376. Set transients detector.
  3377. Possible values are:
  3378. @table @var
  3379. @item crisp
  3380. @item mixed
  3381. @item smooth
  3382. @end table
  3383. @item detector
  3384. Set detector.
  3385. Possible values are:
  3386. @table @var
  3387. @item compound
  3388. @item percussive
  3389. @item soft
  3390. @end table
  3391. @item phase
  3392. Set phase.
  3393. Possible values are:
  3394. @table @var
  3395. @item laminar
  3396. @item independent
  3397. @end table
  3398. @item window
  3399. Set processing window size.
  3400. Possible values are:
  3401. @table @var
  3402. @item standard
  3403. @item short
  3404. @item long
  3405. @end table
  3406. @item smoothing
  3407. Set smoothing.
  3408. Possible values are:
  3409. @table @var
  3410. @item off
  3411. @item on
  3412. @end table
  3413. @item formant
  3414. Enable formant preservation when shift pitching.
  3415. Possible values are:
  3416. @table @var
  3417. @item shifted
  3418. @item preserved
  3419. @end table
  3420. @item pitchq
  3421. Set pitch quality.
  3422. Possible values are:
  3423. @table @var
  3424. @item quality
  3425. @item speed
  3426. @item consistency
  3427. @end table
  3428. @item channels
  3429. Set channels.
  3430. Possible values are:
  3431. @table @var
  3432. @item apart
  3433. @item together
  3434. @end table
  3435. @end table
  3436. @section sidechaincompress
  3437. This filter acts like normal compressor but has the ability to compress
  3438. detected signal using second input signal.
  3439. It needs two input streams and returns one output stream.
  3440. First input stream will be processed depending on second stream signal.
  3441. The filtered signal then can be filtered with other filters in later stages of
  3442. processing. See @ref{pan} and @ref{amerge} filter.
  3443. The filter accepts the following options:
  3444. @table @option
  3445. @item level_in
  3446. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3447. @item mode
  3448. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3449. Default is @code{downward}.
  3450. @item threshold
  3451. If a signal of second stream raises above this level it will affect the gain
  3452. reduction of first stream.
  3453. By default is 0.125. Range is between 0.00097563 and 1.
  3454. @item ratio
  3455. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3456. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3457. Default is 2. Range is between 1 and 20.
  3458. @item attack
  3459. Amount of milliseconds the signal has to rise above the threshold before gain
  3460. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3461. @item release
  3462. Amount of milliseconds the signal has to fall below the threshold before
  3463. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3464. @item makeup
  3465. Set the amount by how much signal will be amplified after processing.
  3466. Default is 1. Range is from 1 to 64.
  3467. @item knee
  3468. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3469. Default is 2.82843. Range is between 1 and 8.
  3470. @item link
  3471. Choose if the @code{average} level between all channels of side-chain stream
  3472. or the louder(@code{maximum}) channel of side-chain stream affects the
  3473. reduction. Default is @code{average}.
  3474. @item detection
  3475. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3476. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3477. @item level_sc
  3478. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3479. @item mix
  3480. How much to use compressed signal in output. Default is 1.
  3481. Range is between 0 and 1.
  3482. @end table
  3483. @subsection Examples
  3484. @itemize
  3485. @item
  3486. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3487. depending on the signal of 2nd input and later compressed signal to be
  3488. merged with 2nd input:
  3489. @example
  3490. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3491. @end example
  3492. @end itemize
  3493. @section sidechaingate
  3494. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3495. filter the detected signal before sending it to the gain reduction stage.
  3496. Normally a gate uses the full range signal to detect a level above the
  3497. threshold.
  3498. For example: If you cut all lower frequencies from your sidechain signal
  3499. the gate will decrease the volume of your track only if not enough highs
  3500. appear. With this technique you are able to reduce the resonation of a
  3501. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3502. guitar.
  3503. It needs two input streams and returns one output stream.
  3504. First input stream will be processed depending on second stream signal.
  3505. The filter accepts the following options:
  3506. @table @option
  3507. @item level_in
  3508. Set input level before filtering.
  3509. Default is 1. Allowed range is from 0.015625 to 64.
  3510. @item mode
  3511. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3512. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3513. will be amplified, expanding dynamic range in upward direction.
  3514. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3515. @item range
  3516. Set the level of gain reduction when the signal is below the threshold.
  3517. Default is 0.06125. Allowed range is from 0 to 1.
  3518. Setting this to 0 disables reduction and then filter behaves like expander.
  3519. @item threshold
  3520. If a signal rises above this level the gain reduction is released.
  3521. Default is 0.125. Allowed range is from 0 to 1.
  3522. @item ratio
  3523. Set a ratio about which the signal is reduced.
  3524. Default is 2. Allowed range is from 1 to 9000.
  3525. @item attack
  3526. Amount of milliseconds the signal has to rise above the threshold before gain
  3527. reduction stops.
  3528. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3529. @item release
  3530. Amount of milliseconds the signal has to fall below the threshold before the
  3531. reduction is increased again. Default is 250 milliseconds.
  3532. Allowed range is from 0.01 to 9000.
  3533. @item makeup
  3534. Set amount of amplification of signal after processing.
  3535. Default is 1. Allowed range is from 1 to 64.
  3536. @item knee
  3537. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3538. Default is 2.828427125. Allowed range is from 1 to 8.
  3539. @item detection
  3540. Choose if exact signal should be taken for detection or an RMS like one.
  3541. Default is rms. Can be peak or rms.
  3542. @item link
  3543. Choose if the average level between all channels or the louder channel affects
  3544. the reduction.
  3545. Default is average. Can be average or maximum.
  3546. @item level_sc
  3547. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3548. @end table
  3549. @section silencedetect
  3550. Detect silence in an audio stream.
  3551. This filter logs a message when it detects that the input audio volume is less
  3552. or equal to a noise tolerance value for a duration greater or equal to the
  3553. minimum detected noise duration.
  3554. The printed times and duration are expressed in seconds.
  3555. The filter accepts the following options:
  3556. @table @option
  3557. @item noise, n
  3558. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3559. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3560. @item duration, d
  3561. Set silence duration until notification (default is 2 seconds).
  3562. @item mono, m
  3563. Process each channel separately, instead of combined. By default is disabled.
  3564. @end table
  3565. @subsection Examples
  3566. @itemize
  3567. @item
  3568. Detect 5 seconds of silence with -50dB noise tolerance:
  3569. @example
  3570. silencedetect=n=-50dB:d=5
  3571. @end example
  3572. @item
  3573. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3574. tolerance in @file{silence.mp3}:
  3575. @example
  3576. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3577. @end example
  3578. @end itemize
  3579. @section silenceremove
  3580. Remove silence from the beginning, middle or end of the audio.
  3581. The filter accepts the following options:
  3582. @table @option
  3583. @item start_periods
  3584. This value is used to indicate if audio should be trimmed at beginning of
  3585. the audio. A value of zero indicates no silence should be trimmed from the
  3586. beginning. When specifying a non-zero value, it trims audio up until it
  3587. finds non-silence. Normally, when trimming silence from beginning of audio
  3588. the @var{start_periods} will be @code{1} but it can be increased to higher
  3589. values to trim all audio up to specific count of non-silence periods.
  3590. Default value is @code{0}.
  3591. @item start_duration
  3592. Specify the amount of time that non-silence must be detected before it stops
  3593. trimming audio. By increasing the duration, bursts of noises can be treated
  3594. as silence and trimmed off. Default value is @code{0}.
  3595. @item start_threshold
  3596. This indicates what sample value should be treated as silence. For digital
  3597. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3598. you may wish to increase the value to account for background noise.
  3599. Can be specified in dB (in case "dB" is appended to the specified value)
  3600. or amplitude ratio. Default value is @code{0}.
  3601. @item start_silence
  3602. Specify max duration of silence at beginning that will be kept after
  3603. trimming. Default is 0, which is equal to trimming all samples detected
  3604. as silence.
  3605. @item start_mode
  3606. Specify mode of detection of silence end in start of multi-channel audio.
  3607. Can be @var{any} or @var{all}. Default is @var{any}.
  3608. With @var{any}, any sample that is detected as non-silence will cause
  3609. stopped trimming of silence.
  3610. With @var{all}, only if all channels are detected as non-silence will cause
  3611. stopped trimming of silence.
  3612. @item stop_periods
  3613. Set the count for trimming silence from the end of audio.
  3614. To remove silence from the middle of a file, specify a @var{stop_periods}
  3615. that is negative. This value is then treated as a positive value and is
  3616. used to indicate the effect should restart processing as specified by
  3617. @var{start_periods}, making it suitable for removing periods of silence
  3618. in the middle of the audio.
  3619. Default value is @code{0}.
  3620. @item stop_duration
  3621. Specify a duration of silence that must exist before audio is not copied any
  3622. more. By specifying a higher duration, silence that is wanted can be left in
  3623. the audio.
  3624. Default value is @code{0}.
  3625. @item stop_threshold
  3626. This is the same as @option{start_threshold} but for trimming silence from
  3627. the end of audio.
  3628. Can be specified in dB (in case "dB" is appended to the specified value)
  3629. or amplitude ratio. Default value is @code{0}.
  3630. @item stop_silence
  3631. Specify max duration of silence at end that will be kept after
  3632. trimming. Default is 0, which is equal to trimming all samples detected
  3633. as silence.
  3634. @item stop_mode
  3635. Specify mode of detection of silence start in end of multi-channel audio.
  3636. Can be @var{any} or @var{all}. Default is @var{any}.
  3637. With @var{any}, any sample that is detected as non-silence will cause
  3638. stopped trimming of silence.
  3639. With @var{all}, only if all channels are detected as non-silence will cause
  3640. stopped trimming of silence.
  3641. @item detection
  3642. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3643. and works better with digital silence which is exactly 0.
  3644. Default value is @code{rms}.
  3645. @item window
  3646. Set duration in number of seconds used to calculate size of window in number
  3647. of samples for detecting silence.
  3648. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3649. @end table
  3650. @subsection Examples
  3651. @itemize
  3652. @item
  3653. The following example shows how this filter can be used to start a recording
  3654. that does not contain the delay at the start which usually occurs between
  3655. pressing the record button and the start of the performance:
  3656. @example
  3657. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3658. @end example
  3659. @item
  3660. Trim all silence encountered from beginning to end where there is more than 1
  3661. second of silence in audio:
  3662. @example
  3663. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3664. @end example
  3665. @end itemize
  3666. @section sofalizer
  3667. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3668. loudspeakers around the user for binaural listening via headphones (audio
  3669. formats up to 9 channels supported).
  3670. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3671. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3672. Austrian Academy of Sciences.
  3673. To enable compilation of this filter you need to configure FFmpeg with
  3674. @code{--enable-libmysofa}.
  3675. The filter accepts the following options:
  3676. @table @option
  3677. @item sofa
  3678. Set the SOFA file used for rendering.
  3679. @item gain
  3680. Set gain applied to audio. Value is in dB. Default is 0.
  3681. @item rotation
  3682. Set rotation of virtual loudspeakers in deg. Default is 0.
  3683. @item elevation
  3684. Set elevation of virtual speakers in deg. Default is 0.
  3685. @item radius
  3686. Set distance in meters between loudspeakers and the listener with near-field
  3687. HRTFs. Default is 1.
  3688. @item type
  3689. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3690. processing audio in time domain which is slow.
  3691. @var{freq} is processing audio in frequency domain which is fast.
  3692. Default is @var{freq}.
  3693. @item speakers
  3694. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3695. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3696. Each virtual loudspeaker is described with short channel name following with
  3697. azimuth and elevation in degrees.
  3698. Each virtual loudspeaker description is separated by '|'.
  3699. For example to override front left and front right channel positions use:
  3700. 'speakers=FL 45 15|FR 345 15'.
  3701. Descriptions with unrecognised channel names are ignored.
  3702. @item lfegain
  3703. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3704. @item framesize
  3705. Set custom frame size in number of samples. Default is 1024.
  3706. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3707. is set to @var{freq}.
  3708. @item normalize
  3709. Should all IRs be normalized upon importing SOFA file.
  3710. By default is enabled.
  3711. @item interpolate
  3712. Should nearest IRs be interpolated with neighbor IRs if exact position
  3713. does not match. By default is disabled.
  3714. @item minphase
  3715. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3716. @item anglestep
  3717. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3718. @item radstep
  3719. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3720. @end table
  3721. @subsection Examples
  3722. @itemize
  3723. @item
  3724. Using ClubFritz6 sofa file:
  3725. @example
  3726. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3727. @end example
  3728. @item
  3729. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3730. @example
  3731. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3732. @end example
  3733. @item
  3734. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3735. and also with custom gain:
  3736. @example
  3737. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3738. @end example
  3739. @end itemize
  3740. @section stereotools
  3741. This filter has some handy utilities to manage stereo signals, for converting
  3742. M/S stereo recordings to L/R signal while having control over the parameters
  3743. or spreading the stereo image of master track.
  3744. The filter accepts the following options:
  3745. @table @option
  3746. @item level_in
  3747. Set input level before filtering for both channels. Defaults is 1.
  3748. Allowed range is from 0.015625 to 64.
  3749. @item level_out
  3750. Set output level after filtering for both channels. Defaults is 1.
  3751. Allowed range is from 0.015625 to 64.
  3752. @item balance_in
  3753. Set input balance between both channels. Default is 0.
  3754. Allowed range is from -1 to 1.
  3755. @item balance_out
  3756. Set output balance between both channels. Default is 0.
  3757. Allowed range is from -1 to 1.
  3758. @item softclip
  3759. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3760. clipping. Disabled by default.
  3761. @item mutel
  3762. Mute the left channel. Disabled by default.
  3763. @item muter
  3764. Mute the right channel. Disabled by default.
  3765. @item phasel
  3766. Change the phase of the left channel. Disabled by default.
  3767. @item phaser
  3768. Change the phase of the right channel. Disabled by default.
  3769. @item mode
  3770. Set stereo mode. Available values are:
  3771. @table @samp
  3772. @item lr>lr
  3773. Left/Right to Left/Right, this is default.
  3774. @item lr>ms
  3775. Left/Right to Mid/Side.
  3776. @item ms>lr
  3777. Mid/Side to Left/Right.
  3778. @item lr>ll
  3779. Left/Right to Left/Left.
  3780. @item lr>rr
  3781. Left/Right to Right/Right.
  3782. @item lr>l+r
  3783. Left/Right to Left + Right.
  3784. @item lr>rl
  3785. Left/Right to Right/Left.
  3786. @item ms>ll
  3787. Mid/Side to Left/Left.
  3788. @item ms>rr
  3789. Mid/Side to Right/Right.
  3790. @end table
  3791. @item slev
  3792. Set level of side signal. Default is 1.
  3793. Allowed range is from 0.015625 to 64.
  3794. @item sbal
  3795. Set balance of side signal. Default is 0.
  3796. Allowed range is from -1 to 1.
  3797. @item mlev
  3798. Set level of the middle signal. Default is 1.
  3799. Allowed range is from 0.015625 to 64.
  3800. @item mpan
  3801. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3802. @item base
  3803. Set stereo base between mono and inversed channels. Default is 0.
  3804. Allowed range is from -1 to 1.
  3805. @item delay
  3806. Set delay in milliseconds how much to delay left from right channel and
  3807. vice versa. Default is 0. Allowed range is from -20 to 20.
  3808. @item sclevel
  3809. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3810. @item phase
  3811. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3812. @item bmode_in, bmode_out
  3813. Set balance mode for balance_in/balance_out option.
  3814. Can be one of the following:
  3815. @table @samp
  3816. @item balance
  3817. Classic balance mode. Attenuate one channel at time.
  3818. Gain is raised up to 1.
  3819. @item amplitude
  3820. Similar as classic mode above but gain is raised up to 2.
  3821. @item power
  3822. Equal power distribution, from -6dB to +6dB range.
  3823. @end table
  3824. @end table
  3825. @subsection Examples
  3826. @itemize
  3827. @item
  3828. Apply karaoke like effect:
  3829. @example
  3830. stereotools=mlev=0.015625
  3831. @end example
  3832. @item
  3833. Convert M/S signal to L/R:
  3834. @example
  3835. "stereotools=mode=ms>lr"
  3836. @end example
  3837. @end itemize
  3838. @section stereowiden
  3839. This filter enhance the stereo effect by suppressing signal common to both
  3840. channels and by delaying the signal of left into right and vice versa,
  3841. thereby widening the stereo effect.
  3842. The filter accepts the following options:
  3843. @table @option
  3844. @item delay
  3845. Time in milliseconds of the delay of left signal into right and vice versa.
  3846. Default is 20 milliseconds.
  3847. @item feedback
  3848. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3849. effect of left signal in right output and vice versa which gives widening
  3850. effect. Default is 0.3.
  3851. @item crossfeed
  3852. Cross feed of left into right with inverted phase. This helps in suppressing
  3853. the mono. If the value is 1 it will cancel all the signal common to both
  3854. channels. Default is 0.3.
  3855. @item drymix
  3856. Set level of input signal of original channel. Default is 0.8.
  3857. @end table
  3858. @section superequalizer
  3859. Apply 18 band equalizer.
  3860. The filter accepts the following options:
  3861. @table @option
  3862. @item 1b
  3863. Set 65Hz band gain.
  3864. @item 2b
  3865. Set 92Hz band gain.
  3866. @item 3b
  3867. Set 131Hz band gain.
  3868. @item 4b
  3869. Set 185Hz band gain.
  3870. @item 5b
  3871. Set 262Hz band gain.
  3872. @item 6b
  3873. Set 370Hz band gain.
  3874. @item 7b
  3875. Set 523Hz band gain.
  3876. @item 8b
  3877. Set 740Hz band gain.
  3878. @item 9b
  3879. Set 1047Hz band gain.
  3880. @item 10b
  3881. Set 1480Hz band gain.
  3882. @item 11b
  3883. Set 2093Hz band gain.
  3884. @item 12b
  3885. Set 2960Hz band gain.
  3886. @item 13b
  3887. Set 4186Hz band gain.
  3888. @item 14b
  3889. Set 5920Hz band gain.
  3890. @item 15b
  3891. Set 8372Hz band gain.
  3892. @item 16b
  3893. Set 11840Hz band gain.
  3894. @item 17b
  3895. Set 16744Hz band gain.
  3896. @item 18b
  3897. Set 20000Hz band gain.
  3898. @end table
  3899. @section surround
  3900. Apply audio surround upmix filter.
  3901. This filter allows to produce multichannel output from audio stream.
  3902. The filter accepts the following options:
  3903. @table @option
  3904. @item chl_out
  3905. Set output channel layout. By default, this is @var{5.1}.
  3906. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3907. for the required syntax.
  3908. @item chl_in
  3909. Set input channel layout. By default, this is @var{stereo}.
  3910. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3911. for the required syntax.
  3912. @item level_in
  3913. Set input volume level. By default, this is @var{1}.
  3914. @item level_out
  3915. Set output volume level. By default, this is @var{1}.
  3916. @item lfe
  3917. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3918. @item lfe_low
  3919. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3920. @item lfe_high
  3921. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3922. @item lfe_mode
  3923. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3924. In @var{add} mode, LFE channel is created from input audio and added to output.
  3925. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3926. also all non-LFE output channels are subtracted with output LFE channel.
  3927. @item angle
  3928. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3929. Default is @var{90}.
  3930. @item fc_in
  3931. Set front center input volume. By default, this is @var{1}.
  3932. @item fc_out
  3933. Set front center output volume. By default, this is @var{1}.
  3934. @item fl_in
  3935. Set front left input volume. By default, this is @var{1}.
  3936. @item fl_out
  3937. Set front left output volume. By default, this is @var{1}.
  3938. @item fr_in
  3939. Set front right input volume. By default, this is @var{1}.
  3940. @item fr_out
  3941. Set front right output volume. By default, this is @var{1}.
  3942. @item sl_in
  3943. Set side left input volume. By default, this is @var{1}.
  3944. @item sl_out
  3945. Set side left output volume. By default, this is @var{1}.
  3946. @item sr_in
  3947. Set side right input volume. By default, this is @var{1}.
  3948. @item sr_out
  3949. Set side right output volume. By default, this is @var{1}.
  3950. @item bl_in
  3951. Set back left input volume. By default, this is @var{1}.
  3952. @item bl_out
  3953. Set back left output volume. By default, this is @var{1}.
  3954. @item br_in
  3955. Set back right input volume. By default, this is @var{1}.
  3956. @item br_out
  3957. Set back right output volume. By default, this is @var{1}.
  3958. @item bc_in
  3959. Set back center input volume. By default, this is @var{1}.
  3960. @item bc_out
  3961. Set back center output volume. By default, this is @var{1}.
  3962. @item lfe_in
  3963. Set LFE input volume. By default, this is @var{1}.
  3964. @item lfe_out
  3965. Set LFE output volume. By default, this is @var{1}.
  3966. @item allx
  3967. Set spread usage of stereo image across X axis for all channels.
  3968. @item ally
  3969. Set spread usage of stereo image across Y axis for all channels.
  3970. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3971. Set spread usage of stereo image across X axis for each channel.
  3972. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3973. Set spread usage of stereo image across Y axis for each channel.
  3974. @item win_size
  3975. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3976. @item win_func
  3977. Set window function.
  3978. It accepts the following values:
  3979. @table @samp
  3980. @item rect
  3981. @item bartlett
  3982. @item hann, hanning
  3983. @item hamming
  3984. @item blackman
  3985. @item welch
  3986. @item flattop
  3987. @item bharris
  3988. @item bnuttall
  3989. @item bhann
  3990. @item sine
  3991. @item nuttall
  3992. @item lanczos
  3993. @item gauss
  3994. @item tukey
  3995. @item dolph
  3996. @item cauchy
  3997. @item parzen
  3998. @item poisson
  3999. @item bohman
  4000. @end table
  4001. Default is @code{hann}.
  4002. @item overlap
  4003. Set window overlap. If set to 1, the recommended overlap for selected
  4004. window function will be picked. Default is @code{0.5}.
  4005. @end table
  4006. @section treble, highshelf
  4007. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4008. shelving filter with a response similar to that of a standard
  4009. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4010. The filter accepts the following options:
  4011. @table @option
  4012. @item gain, g
  4013. Give the gain at whichever is the lower of ~22 kHz and the
  4014. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4015. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4016. @item frequency, f
  4017. Set the filter's central frequency and so can be used
  4018. to extend or reduce the frequency range to be boosted or cut.
  4019. The default value is @code{3000} Hz.
  4020. @item width_type, t
  4021. Set method to specify band-width of filter.
  4022. @table @option
  4023. @item h
  4024. Hz
  4025. @item q
  4026. Q-Factor
  4027. @item o
  4028. octave
  4029. @item s
  4030. slope
  4031. @item k
  4032. kHz
  4033. @end table
  4034. @item width, w
  4035. Determine how steep is the filter's shelf transition.
  4036. @item mix, m
  4037. How much to use filtered signal in output. Default is 1.
  4038. Range is between 0 and 1.
  4039. @item channels, c
  4040. Specify which channels to filter, by default all available are filtered.
  4041. @end table
  4042. @subsection Commands
  4043. This filter supports the following commands:
  4044. @table @option
  4045. @item frequency, f
  4046. Change treble frequency.
  4047. Syntax for the command is : "@var{frequency}"
  4048. @item width_type, t
  4049. Change treble width_type.
  4050. Syntax for the command is : "@var{width_type}"
  4051. @item width, w
  4052. Change treble width.
  4053. Syntax for the command is : "@var{width}"
  4054. @item gain, g
  4055. Change treble gain.
  4056. Syntax for the command is : "@var{gain}"
  4057. @item mix, m
  4058. Change treble mix.
  4059. Syntax for the command is : "@var{mix}"
  4060. @end table
  4061. @section tremolo
  4062. Sinusoidal amplitude modulation.
  4063. The filter accepts the following options:
  4064. @table @option
  4065. @item f
  4066. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4067. (20 Hz or lower) will result in a tremolo effect.
  4068. This filter may also be used as a ring modulator by specifying
  4069. a modulation frequency higher than 20 Hz.
  4070. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4071. @item d
  4072. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4073. Default value is 0.5.
  4074. @end table
  4075. @section vibrato
  4076. Sinusoidal phase modulation.
  4077. The filter accepts the following options:
  4078. @table @option
  4079. @item f
  4080. Modulation frequency in Hertz.
  4081. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4082. @item d
  4083. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4084. Default value is 0.5.
  4085. @end table
  4086. @section volume
  4087. Adjust the input audio volume.
  4088. It accepts the following parameters:
  4089. @table @option
  4090. @item volume
  4091. Set audio volume expression.
  4092. Output values are clipped to the maximum value.
  4093. The output audio volume is given by the relation:
  4094. @example
  4095. @var{output_volume} = @var{volume} * @var{input_volume}
  4096. @end example
  4097. The default value for @var{volume} is "1.0".
  4098. @item precision
  4099. This parameter represents the mathematical precision.
  4100. It determines which input sample formats will be allowed, which affects the
  4101. precision of the volume scaling.
  4102. @table @option
  4103. @item fixed
  4104. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4105. @item float
  4106. 32-bit floating-point; this limits input sample format to FLT. (default)
  4107. @item double
  4108. 64-bit floating-point; this limits input sample format to DBL.
  4109. @end table
  4110. @item replaygain
  4111. Choose the behaviour on encountering ReplayGain side data in input frames.
  4112. @table @option
  4113. @item drop
  4114. Remove ReplayGain side data, ignoring its contents (the default).
  4115. @item ignore
  4116. Ignore ReplayGain side data, but leave it in the frame.
  4117. @item track
  4118. Prefer the track gain, if present.
  4119. @item album
  4120. Prefer the album gain, if present.
  4121. @end table
  4122. @item replaygain_preamp
  4123. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4124. Default value for @var{replaygain_preamp} is 0.0.
  4125. @item eval
  4126. Set when the volume expression is evaluated.
  4127. It accepts the following values:
  4128. @table @samp
  4129. @item once
  4130. only evaluate expression once during the filter initialization, or
  4131. when the @samp{volume} command is sent
  4132. @item frame
  4133. evaluate expression for each incoming frame
  4134. @end table
  4135. Default value is @samp{once}.
  4136. @end table
  4137. The volume expression can contain the following parameters.
  4138. @table @option
  4139. @item n
  4140. frame number (starting at zero)
  4141. @item nb_channels
  4142. number of channels
  4143. @item nb_consumed_samples
  4144. number of samples consumed by the filter
  4145. @item nb_samples
  4146. number of samples in the current frame
  4147. @item pos
  4148. original frame position in the file
  4149. @item pts
  4150. frame PTS
  4151. @item sample_rate
  4152. sample rate
  4153. @item startpts
  4154. PTS at start of stream
  4155. @item startt
  4156. time at start of stream
  4157. @item t
  4158. frame time
  4159. @item tb
  4160. timestamp timebase
  4161. @item volume
  4162. last set volume value
  4163. @end table
  4164. Note that when @option{eval} is set to @samp{once} only the
  4165. @var{sample_rate} and @var{tb} variables are available, all other
  4166. variables will evaluate to NAN.
  4167. @subsection Commands
  4168. This filter supports the following commands:
  4169. @table @option
  4170. @item volume
  4171. Modify the volume expression.
  4172. The command accepts the same syntax of the corresponding option.
  4173. If the specified expression is not valid, it is kept at its current
  4174. value.
  4175. @item replaygain_noclip
  4176. Prevent clipping by limiting the gain applied.
  4177. Default value for @var{replaygain_noclip} is 1.
  4178. @end table
  4179. @subsection Examples
  4180. @itemize
  4181. @item
  4182. Halve the input audio volume:
  4183. @example
  4184. volume=volume=0.5
  4185. volume=volume=1/2
  4186. volume=volume=-6.0206dB
  4187. @end example
  4188. In all the above example the named key for @option{volume} can be
  4189. omitted, for example like in:
  4190. @example
  4191. volume=0.5
  4192. @end example
  4193. @item
  4194. Increase input audio power by 6 decibels using fixed-point precision:
  4195. @example
  4196. volume=volume=6dB:precision=fixed
  4197. @end example
  4198. @item
  4199. Fade volume after time 10 with an annihilation period of 5 seconds:
  4200. @example
  4201. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4202. @end example
  4203. @end itemize
  4204. @section volumedetect
  4205. Detect the volume of the input video.
  4206. The filter has no parameters. The input is not modified. Statistics about
  4207. the volume will be printed in the log when the input stream end is reached.
  4208. In particular it will show the mean volume (root mean square), maximum
  4209. volume (on a per-sample basis), and the beginning of a histogram of the
  4210. registered volume values (from the maximum value to a cumulated 1/1000 of
  4211. the samples).
  4212. All volumes are in decibels relative to the maximum PCM value.
  4213. @subsection Examples
  4214. Here is an excerpt of the output:
  4215. @example
  4216. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4217. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4218. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4219. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4220. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4221. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4222. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4223. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4224. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4225. @end example
  4226. It means that:
  4227. @itemize
  4228. @item
  4229. The mean square energy is approximately -27 dB, or 10^-2.7.
  4230. @item
  4231. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4232. @item
  4233. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4234. @end itemize
  4235. In other words, raising the volume by +4 dB does not cause any clipping,
  4236. raising it by +5 dB causes clipping for 6 samples, etc.
  4237. @c man end AUDIO FILTERS
  4238. @chapter Audio Sources
  4239. @c man begin AUDIO SOURCES
  4240. Below is a description of the currently available audio sources.
  4241. @section abuffer
  4242. Buffer audio frames, and make them available to the filter chain.
  4243. This source is mainly intended for a programmatic use, in particular
  4244. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4245. It accepts the following parameters:
  4246. @table @option
  4247. @item time_base
  4248. The timebase which will be used for timestamps of submitted frames. It must be
  4249. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4250. @item sample_rate
  4251. The sample rate of the incoming audio buffers.
  4252. @item sample_fmt
  4253. The sample format of the incoming audio buffers.
  4254. Either a sample format name or its corresponding integer representation from
  4255. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4256. @item channel_layout
  4257. The channel layout of the incoming audio buffers.
  4258. Either a channel layout name from channel_layout_map in
  4259. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4260. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4261. @item channels
  4262. The number of channels of the incoming audio buffers.
  4263. If both @var{channels} and @var{channel_layout} are specified, then they
  4264. must be consistent.
  4265. @end table
  4266. @subsection Examples
  4267. @example
  4268. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4269. @end example
  4270. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4271. Since the sample format with name "s16p" corresponds to the number
  4272. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4273. equivalent to:
  4274. @example
  4275. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4276. @end example
  4277. @section aevalsrc
  4278. Generate an audio signal specified by an expression.
  4279. This source accepts in input one or more expressions (one for each
  4280. channel), which are evaluated and used to generate a corresponding
  4281. audio signal.
  4282. This source accepts the following options:
  4283. @table @option
  4284. @item exprs
  4285. Set the '|'-separated expressions list for each separate channel. In case the
  4286. @option{channel_layout} option is not specified, the selected channel layout
  4287. depends on the number of provided expressions. Otherwise the last
  4288. specified expression is applied to the remaining output channels.
  4289. @item channel_layout, c
  4290. Set the channel layout. The number of channels in the specified layout
  4291. must be equal to the number of specified expressions.
  4292. @item duration, d
  4293. Set the minimum duration of the sourced audio. See
  4294. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4295. for the accepted syntax.
  4296. Note that the resulting duration may be greater than the specified
  4297. duration, as the generated audio is always cut at the end of a
  4298. complete frame.
  4299. If not specified, or the expressed duration is negative, the audio is
  4300. supposed to be generated forever.
  4301. @item nb_samples, n
  4302. Set the number of samples per channel per each output frame,
  4303. default to 1024.
  4304. @item sample_rate, s
  4305. Specify the sample rate, default to 44100.
  4306. @end table
  4307. Each expression in @var{exprs} can contain the following constants:
  4308. @table @option
  4309. @item n
  4310. number of the evaluated sample, starting from 0
  4311. @item t
  4312. time of the evaluated sample expressed in seconds, starting from 0
  4313. @item s
  4314. sample rate
  4315. @end table
  4316. @subsection Examples
  4317. @itemize
  4318. @item
  4319. Generate silence:
  4320. @example
  4321. aevalsrc=0
  4322. @end example
  4323. @item
  4324. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4325. 8000 Hz:
  4326. @example
  4327. aevalsrc="sin(440*2*PI*t):s=8000"
  4328. @end example
  4329. @item
  4330. Generate a two channels signal, specify the channel layout (Front
  4331. Center + Back Center) explicitly:
  4332. @example
  4333. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4334. @end example
  4335. @item
  4336. Generate white noise:
  4337. @example
  4338. aevalsrc="-2+random(0)"
  4339. @end example
  4340. @item
  4341. Generate an amplitude modulated signal:
  4342. @example
  4343. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4344. @end example
  4345. @item
  4346. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4347. @example
  4348. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4349. @end example
  4350. @end itemize
  4351. @section anullsrc
  4352. The null audio source, return unprocessed audio frames. It is mainly useful
  4353. as a template and to be employed in analysis / debugging tools, or as
  4354. the source for filters which ignore the input data (for example the sox
  4355. synth filter).
  4356. This source accepts the following options:
  4357. @table @option
  4358. @item channel_layout, cl
  4359. Specifies the channel layout, and can be either an integer or a string
  4360. representing a channel layout. The default value of @var{channel_layout}
  4361. is "stereo".
  4362. Check the channel_layout_map definition in
  4363. @file{libavutil/channel_layout.c} for the mapping between strings and
  4364. channel layout values.
  4365. @item sample_rate, r
  4366. Specifies the sample rate, and defaults to 44100.
  4367. @item nb_samples, n
  4368. Set the number of samples per requested frames.
  4369. @end table
  4370. @subsection Examples
  4371. @itemize
  4372. @item
  4373. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4374. @example
  4375. anullsrc=r=48000:cl=4
  4376. @end example
  4377. @item
  4378. Do the same operation with a more obvious syntax:
  4379. @example
  4380. anullsrc=r=48000:cl=mono
  4381. @end example
  4382. @end itemize
  4383. All the parameters need to be explicitly defined.
  4384. @section flite
  4385. Synthesize a voice utterance using the libflite library.
  4386. To enable compilation of this filter you need to configure FFmpeg with
  4387. @code{--enable-libflite}.
  4388. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4389. The filter accepts the following options:
  4390. @table @option
  4391. @item list_voices
  4392. If set to 1, list the names of the available voices and exit
  4393. immediately. Default value is 0.
  4394. @item nb_samples, n
  4395. Set the maximum number of samples per frame. Default value is 512.
  4396. @item textfile
  4397. Set the filename containing the text to speak.
  4398. @item text
  4399. Set the text to speak.
  4400. @item voice, v
  4401. Set the voice to use for the speech synthesis. Default value is
  4402. @code{kal}. See also the @var{list_voices} option.
  4403. @end table
  4404. @subsection Examples
  4405. @itemize
  4406. @item
  4407. Read from file @file{speech.txt}, and synthesize the text using the
  4408. standard flite voice:
  4409. @example
  4410. flite=textfile=speech.txt
  4411. @end example
  4412. @item
  4413. Read the specified text selecting the @code{slt} voice:
  4414. @example
  4415. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4416. @end example
  4417. @item
  4418. Input text to ffmpeg:
  4419. @example
  4420. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4421. @end example
  4422. @item
  4423. Make @file{ffplay} speak the specified text, using @code{flite} and
  4424. the @code{lavfi} device:
  4425. @example
  4426. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4427. @end example
  4428. @end itemize
  4429. For more information about libflite, check:
  4430. @url{http://www.festvox.org/flite/}
  4431. @section anoisesrc
  4432. Generate a noise audio signal.
  4433. The filter accepts the following options:
  4434. @table @option
  4435. @item sample_rate, r
  4436. Specify the sample rate. Default value is 48000 Hz.
  4437. @item amplitude, a
  4438. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4439. is 1.0.
  4440. @item duration, d
  4441. Specify the duration of the generated audio stream. Not specifying this option
  4442. results in noise with an infinite length.
  4443. @item color, colour, c
  4444. Specify the color of noise. Available noise colors are white, pink, brown,
  4445. blue and violet. Default color is white.
  4446. @item seed, s
  4447. Specify a value used to seed the PRNG.
  4448. @item nb_samples, n
  4449. Set the number of samples per each output frame, default is 1024.
  4450. @end table
  4451. @subsection Examples
  4452. @itemize
  4453. @item
  4454. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4455. @example
  4456. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4457. @end example
  4458. @end itemize
  4459. @section hilbert
  4460. Generate odd-tap Hilbert transform FIR coefficients.
  4461. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4462. the signal by 90 degrees.
  4463. This is used in many matrix coding schemes and for analytic signal generation.
  4464. The process is often written as a multiplication by i (or j), the imaginary unit.
  4465. The filter accepts the following options:
  4466. @table @option
  4467. @item sample_rate, s
  4468. Set sample rate, default is 44100.
  4469. @item taps, t
  4470. Set length of FIR filter, default is 22051.
  4471. @item nb_samples, n
  4472. Set number of samples per each frame.
  4473. @item win_func, w
  4474. Set window function to be used when generating FIR coefficients.
  4475. @end table
  4476. @section sinc
  4477. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4478. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4479. The filter accepts the following options:
  4480. @table @option
  4481. @item sample_rate, r
  4482. Set sample rate, default is 44100.
  4483. @item nb_samples, n
  4484. Set number of samples per each frame. Default is 1024.
  4485. @item hp
  4486. Set high-pass frequency. Default is 0.
  4487. @item lp
  4488. Set low-pass frequency. Default is 0.
  4489. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4490. is higher than 0 then filter will create band-pass filter coefficients,
  4491. otherwise band-reject filter coefficients.
  4492. @item phase
  4493. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4494. @item beta
  4495. Set Kaiser window beta.
  4496. @item att
  4497. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4498. @item round
  4499. Enable rounding, by default is disabled.
  4500. @item hptaps
  4501. Set number of taps for high-pass filter.
  4502. @item lptaps
  4503. Set number of taps for low-pass filter.
  4504. @end table
  4505. @section sine
  4506. Generate an audio signal made of a sine wave with amplitude 1/8.
  4507. The audio signal is bit-exact.
  4508. The filter accepts the following options:
  4509. @table @option
  4510. @item frequency, f
  4511. Set the carrier frequency. Default is 440 Hz.
  4512. @item beep_factor, b
  4513. Enable a periodic beep every second with frequency @var{beep_factor} times
  4514. the carrier frequency. Default is 0, meaning the beep is disabled.
  4515. @item sample_rate, r
  4516. Specify the sample rate, default is 44100.
  4517. @item duration, d
  4518. Specify the duration of the generated audio stream.
  4519. @item samples_per_frame
  4520. Set the number of samples per output frame.
  4521. The expression can contain the following constants:
  4522. @table @option
  4523. @item n
  4524. The (sequential) number of the output audio frame, starting from 0.
  4525. @item pts
  4526. The PTS (Presentation TimeStamp) of the output audio frame,
  4527. expressed in @var{TB} units.
  4528. @item t
  4529. The PTS of the output audio frame, expressed in seconds.
  4530. @item TB
  4531. The timebase of the output audio frames.
  4532. @end table
  4533. Default is @code{1024}.
  4534. @end table
  4535. @subsection Examples
  4536. @itemize
  4537. @item
  4538. Generate a simple 440 Hz sine wave:
  4539. @example
  4540. sine
  4541. @end example
  4542. @item
  4543. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4544. @example
  4545. sine=220:4:d=5
  4546. sine=f=220:b=4:d=5
  4547. sine=frequency=220:beep_factor=4:duration=5
  4548. @end example
  4549. @item
  4550. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4551. pattern:
  4552. @example
  4553. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4554. @end example
  4555. @end itemize
  4556. @c man end AUDIO SOURCES
  4557. @chapter Audio Sinks
  4558. @c man begin AUDIO SINKS
  4559. Below is a description of the currently available audio sinks.
  4560. @section abuffersink
  4561. Buffer audio frames, and make them available to the end of filter chain.
  4562. This sink is mainly intended for programmatic use, in particular
  4563. through the interface defined in @file{libavfilter/buffersink.h}
  4564. or the options system.
  4565. It accepts a pointer to an AVABufferSinkContext structure, which
  4566. defines the incoming buffers' formats, to be passed as the opaque
  4567. parameter to @code{avfilter_init_filter} for initialization.
  4568. @section anullsink
  4569. Null audio sink; do absolutely nothing with the input audio. It is
  4570. mainly useful as a template and for use in analysis / debugging
  4571. tools.
  4572. @c man end AUDIO SINKS
  4573. @chapter Video Filters
  4574. @c man begin VIDEO FILTERS
  4575. When you configure your FFmpeg build, you can disable any of the
  4576. existing filters using @code{--disable-filters}.
  4577. The configure output will show the video filters included in your
  4578. build.
  4579. Below is a description of the currently available video filters.
  4580. @section alphaextract
  4581. Extract the alpha component from the input as a grayscale video. This
  4582. is especially useful with the @var{alphamerge} filter.
  4583. @section alphamerge
  4584. Add or replace the alpha component of the primary input with the
  4585. grayscale value of a second input. This is intended for use with
  4586. @var{alphaextract} to allow the transmission or storage of frame
  4587. sequences that have alpha in a format that doesn't support an alpha
  4588. channel.
  4589. For example, to reconstruct full frames from a normal YUV-encoded video
  4590. and a separate video created with @var{alphaextract}, you might use:
  4591. @example
  4592. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4593. @end example
  4594. Since this filter is designed for reconstruction, it operates on frame
  4595. sequences without considering timestamps, and terminates when either
  4596. input reaches end of stream. This will cause problems if your encoding
  4597. pipeline drops frames. If you're trying to apply an image as an
  4598. overlay to a video stream, consider the @var{overlay} filter instead.
  4599. @section amplify
  4600. Amplify differences between current pixel and pixels of adjacent frames in
  4601. same pixel location.
  4602. This filter accepts the following options:
  4603. @table @option
  4604. @item radius
  4605. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4606. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4607. @item factor
  4608. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4609. @item threshold
  4610. Set threshold for difference amplification. Any difference greater or equal to
  4611. this value will not alter source pixel. Default is 10.
  4612. Allowed range is from 0 to 65535.
  4613. @item tolerance
  4614. Set tolerance for difference amplification. Any difference lower to
  4615. this value will not alter source pixel. Default is 0.
  4616. Allowed range is from 0 to 65535.
  4617. @item low
  4618. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4619. This option controls maximum possible value that will decrease source pixel value.
  4620. @item high
  4621. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4622. This option controls maximum possible value that will increase source pixel value.
  4623. @item planes
  4624. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4625. @end table
  4626. @section ass
  4627. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4628. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4629. Substation Alpha) subtitles files.
  4630. This filter accepts the following option in addition to the common options from
  4631. the @ref{subtitles} filter:
  4632. @table @option
  4633. @item shaping
  4634. Set the shaping engine
  4635. Available values are:
  4636. @table @samp
  4637. @item auto
  4638. The default libass shaping engine, which is the best available.
  4639. @item simple
  4640. Fast, font-agnostic shaper that can do only substitutions
  4641. @item complex
  4642. Slower shaper using OpenType for substitutions and positioning
  4643. @end table
  4644. The default is @code{auto}.
  4645. @end table
  4646. @section atadenoise
  4647. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4648. The filter accepts the following options:
  4649. @table @option
  4650. @item 0a
  4651. Set threshold A for 1st plane. Default is 0.02.
  4652. Valid range is 0 to 0.3.
  4653. @item 0b
  4654. Set threshold B for 1st plane. Default is 0.04.
  4655. Valid range is 0 to 5.
  4656. @item 1a
  4657. Set threshold A for 2nd plane. Default is 0.02.
  4658. Valid range is 0 to 0.3.
  4659. @item 1b
  4660. Set threshold B for 2nd plane. Default is 0.04.
  4661. Valid range is 0 to 5.
  4662. @item 2a
  4663. Set threshold A for 3rd plane. Default is 0.02.
  4664. Valid range is 0 to 0.3.
  4665. @item 2b
  4666. Set threshold B for 3rd plane. Default is 0.04.
  4667. Valid range is 0 to 5.
  4668. Threshold A is designed to react on abrupt changes in the input signal and
  4669. threshold B is designed to react on continuous changes in the input signal.
  4670. @item s
  4671. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4672. number in range [5, 129].
  4673. @item p
  4674. Set what planes of frame filter will use for averaging. Default is all.
  4675. @end table
  4676. @section avgblur
  4677. Apply average blur filter.
  4678. The filter accepts the following options:
  4679. @table @option
  4680. @item sizeX
  4681. Set horizontal radius size.
  4682. @item planes
  4683. Set which planes to filter. By default all planes are filtered.
  4684. @item sizeY
  4685. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4686. Default is @code{0}.
  4687. @end table
  4688. @section bbox
  4689. Compute the bounding box for the non-black pixels in the input frame
  4690. luminance plane.
  4691. This filter computes the bounding box containing all the pixels with a
  4692. luminance value greater than the minimum allowed value.
  4693. The parameters describing the bounding box are printed on the filter
  4694. log.
  4695. The filter accepts the following option:
  4696. @table @option
  4697. @item min_val
  4698. Set the minimal luminance value. Default is @code{16}.
  4699. @end table
  4700. @section bitplanenoise
  4701. Show and measure bit plane noise.
  4702. The filter accepts the following options:
  4703. @table @option
  4704. @item bitplane
  4705. Set which plane to analyze. Default is @code{1}.
  4706. @item filter
  4707. Filter out noisy pixels from @code{bitplane} set above.
  4708. Default is disabled.
  4709. @end table
  4710. @section blackdetect
  4711. Detect video intervals that are (almost) completely black. Can be
  4712. useful to detect chapter transitions, commercials, or invalid
  4713. recordings. Output lines contains the time for the start, end and
  4714. duration of the detected black interval expressed in seconds.
  4715. In order to display the output lines, you need to set the loglevel at
  4716. least to the AV_LOG_INFO value.
  4717. The filter accepts the following options:
  4718. @table @option
  4719. @item black_min_duration, d
  4720. Set the minimum detected black duration expressed in seconds. It must
  4721. be a non-negative floating point number.
  4722. Default value is 2.0.
  4723. @item picture_black_ratio_th, pic_th
  4724. Set the threshold for considering a picture "black".
  4725. Express the minimum value for the ratio:
  4726. @example
  4727. @var{nb_black_pixels} / @var{nb_pixels}
  4728. @end example
  4729. for which a picture is considered black.
  4730. Default value is 0.98.
  4731. @item pixel_black_th, pix_th
  4732. Set the threshold for considering a pixel "black".
  4733. The threshold expresses the maximum pixel luminance value for which a
  4734. pixel is considered "black". The provided value is scaled according to
  4735. the following equation:
  4736. @example
  4737. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4738. @end example
  4739. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4740. the input video format, the range is [0-255] for YUV full-range
  4741. formats and [16-235] for YUV non full-range formats.
  4742. Default value is 0.10.
  4743. @end table
  4744. The following example sets the maximum pixel threshold to the minimum
  4745. value, and detects only black intervals of 2 or more seconds:
  4746. @example
  4747. blackdetect=d=2:pix_th=0.00
  4748. @end example
  4749. @section blackframe
  4750. Detect frames that are (almost) completely black. Can be useful to
  4751. detect chapter transitions or commercials. Output lines consist of
  4752. the frame number of the detected frame, the percentage of blackness,
  4753. the position in the file if known or -1 and the timestamp in seconds.
  4754. In order to display the output lines, you need to set the loglevel at
  4755. least to the AV_LOG_INFO value.
  4756. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4757. The value represents the percentage of pixels in the picture that
  4758. are below the threshold value.
  4759. It accepts the following parameters:
  4760. @table @option
  4761. @item amount
  4762. The percentage of the pixels that have to be below the threshold; it defaults to
  4763. @code{98}.
  4764. @item threshold, thresh
  4765. The threshold below which a pixel value is considered black; it defaults to
  4766. @code{32}.
  4767. @end table
  4768. @section blend, tblend
  4769. Blend two video frames into each other.
  4770. The @code{blend} filter takes two input streams and outputs one
  4771. stream, the first input is the "top" layer and second input is
  4772. "bottom" layer. By default, the output terminates when the longest input terminates.
  4773. The @code{tblend} (time blend) filter takes two consecutive frames
  4774. from one single stream, and outputs the result obtained by blending
  4775. the new frame on top of the old frame.
  4776. A description of the accepted options follows.
  4777. @table @option
  4778. @item c0_mode
  4779. @item c1_mode
  4780. @item c2_mode
  4781. @item c3_mode
  4782. @item all_mode
  4783. Set blend mode for specific pixel component or all pixel components in case
  4784. of @var{all_mode}. Default value is @code{normal}.
  4785. Available values for component modes are:
  4786. @table @samp
  4787. @item addition
  4788. @item grainmerge
  4789. @item and
  4790. @item average
  4791. @item burn
  4792. @item darken
  4793. @item difference
  4794. @item grainextract
  4795. @item divide
  4796. @item dodge
  4797. @item freeze
  4798. @item exclusion
  4799. @item extremity
  4800. @item glow
  4801. @item hardlight
  4802. @item hardmix
  4803. @item heat
  4804. @item lighten
  4805. @item linearlight
  4806. @item multiply
  4807. @item multiply128
  4808. @item negation
  4809. @item normal
  4810. @item or
  4811. @item overlay
  4812. @item phoenix
  4813. @item pinlight
  4814. @item reflect
  4815. @item screen
  4816. @item softlight
  4817. @item subtract
  4818. @item vividlight
  4819. @item xor
  4820. @end table
  4821. @item c0_opacity
  4822. @item c1_opacity
  4823. @item c2_opacity
  4824. @item c3_opacity
  4825. @item all_opacity
  4826. Set blend opacity for specific pixel component or all pixel components in case
  4827. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4828. @item c0_expr
  4829. @item c1_expr
  4830. @item c2_expr
  4831. @item c3_expr
  4832. @item all_expr
  4833. Set blend expression for specific pixel component or all pixel components in case
  4834. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4835. The expressions can use the following variables:
  4836. @table @option
  4837. @item N
  4838. The sequential number of the filtered frame, starting from @code{0}.
  4839. @item X
  4840. @item Y
  4841. the coordinates of the current sample
  4842. @item W
  4843. @item H
  4844. the width and height of currently filtered plane
  4845. @item SW
  4846. @item SH
  4847. Width and height scale for the plane being filtered. It is the
  4848. ratio between the dimensions of the current plane to the luma plane,
  4849. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4850. the luma plane and @code{0.5,0.5} for the chroma planes.
  4851. @item T
  4852. Time of the current frame, expressed in seconds.
  4853. @item TOP, A
  4854. Value of pixel component at current location for first video frame (top layer).
  4855. @item BOTTOM, B
  4856. Value of pixel component at current location for second video frame (bottom layer).
  4857. @end table
  4858. @end table
  4859. The @code{blend} filter also supports the @ref{framesync} options.
  4860. @subsection Examples
  4861. @itemize
  4862. @item
  4863. Apply transition from bottom layer to top layer in first 10 seconds:
  4864. @example
  4865. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4866. @end example
  4867. @item
  4868. Apply linear horizontal transition from top layer to bottom layer:
  4869. @example
  4870. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4871. @end example
  4872. @item
  4873. Apply 1x1 checkerboard effect:
  4874. @example
  4875. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4876. @end example
  4877. @item
  4878. Apply uncover left effect:
  4879. @example
  4880. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4881. @end example
  4882. @item
  4883. Apply uncover down effect:
  4884. @example
  4885. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4886. @end example
  4887. @item
  4888. Apply uncover up-left effect:
  4889. @example
  4890. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4891. @end example
  4892. @item
  4893. Split diagonally video and shows top and bottom layer on each side:
  4894. @example
  4895. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4896. @end example
  4897. @item
  4898. Display differences between the current and the previous frame:
  4899. @example
  4900. tblend=all_mode=grainextract
  4901. @end example
  4902. @end itemize
  4903. @section bm3d
  4904. Denoise frames using Block-Matching 3D algorithm.
  4905. The filter accepts the following options.
  4906. @table @option
  4907. @item sigma
  4908. Set denoising strength. Default value is 1.
  4909. Allowed range is from 0 to 999.9.
  4910. The denoising algorithm is very sensitive to sigma, so adjust it
  4911. according to the source.
  4912. @item block
  4913. Set local patch size. This sets dimensions in 2D.
  4914. @item bstep
  4915. Set sliding step for processing blocks. Default value is 4.
  4916. Allowed range is from 1 to 64.
  4917. Smaller values allows processing more reference blocks and is slower.
  4918. @item group
  4919. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4920. When set to 1, no block matching is done. Larger values allows more blocks
  4921. in single group.
  4922. Allowed range is from 1 to 256.
  4923. @item range
  4924. Set radius for search block matching. Default is 9.
  4925. Allowed range is from 1 to INT32_MAX.
  4926. @item mstep
  4927. Set step between two search locations for block matching. Default is 1.
  4928. Allowed range is from 1 to 64. Smaller is slower.
  4929. @item thmse
  4930. Set threshold of mean square error for block matching. Valid range is 0 to
  4931. INT32_MAX.
  4932. @item hdthr
  4933. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4934. Larger values results in stronger hard-thresholding filtering in frequency
  4935. domain.
  4936. @item estim
  4937. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4938. Default is @code{basic}.
  4939. @item ref
  4940. If enabled, filter will use 2nd stream for block matching.
  4941. Default is disabled for @code{basic} value of @var{estim} option,
  4942. and always enabled if value of @var{estim} is @code{final}.
  4943. @item planes
  4944. Set planes to filter. Default is all available except alpha.
  4945. @end table
  4946. @subsection Examples
  4947. @itemize
  4948. @item
  4949. Basic filtering with bm3d:
  4950. @example
  4951. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4952. @end example
  4953. @item
  4954. Same as above, but filtering only luma:
  4955. @example
  4956. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4957. @end example
  4958. @item
  4959. Same as above, but with both estimation modes:
  4960. @example
  4961. 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
  4962. @end example
  4963. @item
  4964. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4965. @example
  4966. 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
  4967. @end example
  4968. @end itemize
  4969. @section boxblur
  4970. Apply a boxblur algorithm to the input video.
  4971. It accepts the following parameters:
  4972. @table @option
  4973. @item luma_radius, lr
  4974. @item luma_power, lp
  4975. @item chroma_radius, cr
  4976. @item chroma_power, cp
  4977. @item alpha_radius, ar
  4978. @item alpha_power, ap
  4979. @end table
  4980. A description of the accepted options follows.
  4981. @table @option
  4982. @item luma_radius, lr
  4983. @item chroma_radius, cr
  4984. @item alpha_radius, ar
  4985. Set an expression for the box radius in pixels used for blurring the
  4986. corresponding input plane.
  4987. The radius value must be a non-negative number, and must not be
  4988. greater than the value of the expression @code{min(w,h)/2} for the
  4989. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4990. planes.
  4991. Default value for @option{luma_radius} is "2". If not specified,
  4992. @option{chroma_radius} and @option{alpha_radius} default to the
  4993. corresponding value set for @option{luma_radius}.
  4994. The expressions can contain the following constants:
  4995. @table @option
  4996. @item w
  4997. @item h
  4998. The input width and height in pixels.
  4999. @item cw
  5000. @item ch
  5001. The input chroma image width and height in pixels.
  5002. @item hsub
  5003. @item vsub
  5004. The horizontal and vertical chroma subsample values. For example, for the
  5005. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5006. @end table
  5007. @item luma_power, lp
  5008. @item chroma_power, cp
  5009. @item alpha_power, ap
  5010. Specify how many times the boxblur filter is applied to the
  5011. corresponding plane.
  5012. Default value for @option{luma_power} is 2. If not specified,
  5013. @option{chroma_power} and @option{alpha_power} default to the
  5014. corresponding value set for @option{luma_power}.
  5015. A value of 0 will disable the effect.
  5016. @end table
  5017. @subsection Examples
  5018. @itemize
  5019. @item
  5020. Apply a boxblur filter with the luma, chroma, and alpha radii
  5021. set to 2:
  5022. @example
  5023. boxblur=luma_radius=2:luma_power=1
  5024. boxblur=2:1
  5025. @end example
  5026. @item
  5027. Set the luma radius to 2, and alpha and chroma radius to 0:
  5028. @example
  5029. boxblur=2:1:cr=0:ar=0
  5030. @end example
  5031. @item
  5032. Set the luma and chroma radii to a fraction of the video dimension:
  5033. @example
  5034. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5035. @end example
  5036. @end itemize
  5037. @section bwdif
  5038. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5039. Deinterlacing Filter").
  5040. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5041. interpolation algorithms.
  5042. It accepts the following parameters:
  5043. @table @option
  5044. @item mode
  5045. The interlacing mode to adopt. It accepts one of the following values:
  5046. @table @option
  5047. @item 0, send_frame
  5048. Output one frame for each frame.
  5049. @item 1, send_field
  5050. Output one frame for each field.
  5051. @end table
  5052. The default value is @code{send_field}.
  5053. @item parity
  5054. The picture field parity assumed for the input interlaced video. It accepts one
  5055. of the following values:
  5056. @table @option
  5057. @item 0, tff
  5058. Assume the top field is first.
  5059. @item 1, bff
  5060. Assume the bottom field is first.
  5061. @item -1, auto
  5062. Enable automatic detection of field parity.
  5063. @end table
  5064. The default value is @code{auto}.
  5065. If the interlacing is unknown or the decoder does not export this information,
  5066. top field first will be assumed.
  5067. @item deint
  5068. Specify which frames to deinterlace. Accept one of the following
  5069. values:
  5070. @table @option
  5071. @item 0, all
  5072. Deinterlace all frames.
  5073. @item 1, interlaced
  5074. Only deinterlace frames marked as interlaced.
  5075. @end table
  5076. The default value is @code{all}.
  5077. @end table
  5078. @section chromahold
  5079. Remove all color information for all colors except for certain one.
  5080. The filter accepts the following options:
  5081. @table @option
  5082. @item color
  5083. The color which will not be replaced with neutral chroma.
  5084. @item similarity
  5085. Similarity percentage with the above color.
  5086. 0.01 matches only the exact key color, while 1.0 matches everything.
  5087. @item blend
  5088. Blend percentage.
  5089. 0.0 makes pixels either fully gray, or not gray at all.
  5090. Higher values result in more preserved color.
  5091. @item yuv
  5092. Signals that the color passed is already in YUV instead of RGB.
  5093. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5094. This can be used to pass exact YUV values as hexadecimal numbers.
  5095. @end table
  5096. @section chromakey
  5097. YUV colorspace color/chroma keying.
  5098. The filter accepts the following options:
  5099. @table @option
  5100. @item color
  5101. The color which will be replaced with transparency.
  5102. @item similarity
  5103. Similarity percentage with the key color.
  5104. 0.01 matches only the exact key color, while 1.0 matches everything.
  5105. @item blend
  5106. Blend percentage.
  5107. 0.0 makes pixels either fully transparent, or not transparent at all.
  5108. Higher values result in semi-transparent pixels, with a higher transparency
  5109. the more similar the pixels color is to the key color.
  5110. @item yuv
  5111. Signals that the color passed is already in YUV instead of RGB.
  5112. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5113. This can be used to pass exact YUV values as hexadecimal numbers.
  5114. @end table
  5115. @subsection Examples
  5116. @itemize
  5117. @item
  5118. Make every green pixel in the input image transparent:
  5119. @example
  5120. ffmpeg -i input.png -vf chromakey=green out.png
  5121. @end example
  5122. @item
  5123. Overlay a greenscreen-video on top of a static black background.
  5124. @example
  5125. 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
  5126. @end example
  5127. @end itemize
  5128. @section chromashift
  5129. Shift chroma pixels horizontally and/or vertically.
  5130. The filter accepts the following options:
  5131. @table @option
  5132. @item cbh
  5133. Set amount to shift chroma-blue horizontally.
  5134. @item cbv
  5135. Set amount to shift chroma-blue vertically.
  5136. @item crh
  5137. Set amount to shift chroma-red horizontally.
  5138. @item crv
  5139. Set amount to shift chroma-red vertically.
  5140. @item edge
  5141. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5142. @end table
  5143. @section ciescope
  5144. Display CIE color diagram with pixels overlaid onto it.
  5145. The filter accepts the following options:
  5146. @table @option
  5147. @item system
  5148. Set color system.
  5149. @table @samp
  5150. @item ntsc, 470m
  5151. @item ebu, 470bg
  5152. @item smpte
  5153. @item 240m
  5154. @item apple
  5155. @item widergb
  5156. @item cie1931
  5157. @item rec709, hdtv
  5158. @item uhdtv, rec2020
  5159. @end table
  5160. @item cie
  5161. Set CIE system.
  5162. @table @samp
  5163. @item xyy
  5164. @item ucs
  5165. @item luv
  5166. @end table
  5167. @item gamuts
  5168. Set what gamuts to draw.
  5169. See @code{system} option for available values.
  5170. @item size, s
  5171. Set ciescope size, by default set to 512.
  5172. @item intensity, i
  5173. Set intensity used to map input pixel values to CIE diagram.
  5174. @item contrast
  5175. Set contrast used to draw tongue colors that are out of active color system gamut.
  5176. @item corrgamma
  5177. Correct gamma displayed on scope, by default enabled.
  5178. @item showwhite
  5179. Show white point on CIE diagram, by default disabled.
  5180. @item gamma
  5181. Set input gamma. Used only with XYZ input color space.
  5182. @end table
  5183. @section codecview
  5184. Visualize information exported by some codecs.
  5185. Some codecs can export information through frames using side-data or other
  5186. means. For example, some MPEG based codecs export motion vectors through the
  5187. @var{export_mvs} flag in the codec @option{flags2} option.
  5188. The filter accepts the following option:
  5189. @table @option
  5190. @item mv
  5191. Set motion vectors to visualize.
  5192. Available flags for @var{mv} are:
  5193. @table @samp
  5194. @item pf
  5195. forward predicted MVs of P-frames
  5196. @item bf
  5197. forward predicted MVs of B-frames
  5198. @item bb
  5199. backward predicted MVs of B-frames
  5200. @end table
  5201. @item qp
  5202. Display quantization parameters using the chroma planes.
  5203. @item mv_type, mvt
  5204. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5205. Available flags for @var{mv_type} are:
  5206. @table @samp
  5207. @item fp
  5208. forward predicted MVs
  5209. @item bp
  5210. backward predicted MVs
  5211. @end table
  5212. @item frame_type, ft
  5213. Set frame type to visualize motion vectors of.
  5214. Available flags for @var{frame_type} are:
  5215. @table @samp
  5216. @item if
  5217. intra-coded frames (I-frames)
  5218. @item pf
  5219. predicted frames (P-frames)
  5220. @item bf
  5221. bi-directionally predicted frames (B-frames)
  5222. @end table
  5223. @end table
  5224. @subsection Examples
  5225. @itemize
  5226. @item
  5227. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5228. @example
  5229. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5230. @end example
  5231. @item
  5232. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5233. @example
  5234. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5235. @end example
  5236. @end itemize
  5237. @section colorbalance
  5238. Modify intensity of primary colors (red, green and blue) of input frames.
  5239. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5240. regions for the red-cyan, green-magenta or blue-yellow balance.
  5241. A positive adjustment value shifts the balance towards the primary color, a negative
  5242. value towards the complementary color.
  5243. The filter accepts the following options:
  5244. @table @option
  5245. @item rs
  5246. @item gs
  5247. @item bs
  5248. Adjust red, green and blue shadows (darkest pixels).
  5249. @item rm
  5250. @item gm
  5251. @item bm
  5252. Adjust red, green and blue midtones (medium pixels).
  5253. @item rh
  5254. @item gh
  5255. @item bh
  5256. Adjust red, green and blue highlights (brightest pixels).
  5257. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5258. @end table
  5259. @subsection Examples
  5260. @itemize
  5261. @item
  5262. Add red color cast to shadows:
  5263. @example
  5264. colorbalance=rs=.3
  5265. @end example
  5266. @end itemize
  5267. @section colorkey
  5268. RGB colorspace color keying.
  5269. The filter accepts the following options:
  5270. @table @option
  5271. @item color
  5272. The color which will be replaced with transparency.
  5273. @item similarity
  5274. Similarity percentage with the key color.
  5275. 0.01 matches only the exact key color, while 1.0 matches everything.
  5276. @item blend
  5277. Blend percentage.
  5278. 0.0 makes pixels either fully transparent, or not transparent at all.
  5279. Higher values result in semi-transparent pixels, with a higher transparency
  5280. the more similar the pixels color is to the key color.
  5281. @end table
  5282. @subsection Examples
  5283. @itemize
  5284. @item
  5285. Make every green pixel in the input image transparent:
  5286. @example
  5287. ffmpeg -i input.png -vf colorkey=green out.png
  5288. @end example
  5289. @item
  5290. Overlay a greenscreen-video on top of a static background image.
  5291. @example
  5292. 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
  5293. @end example
  5294. @end itemize
  5295. @section colorhold
  5296. Remove all color information for all RGB colors except for certain one.
  5297. The filter accepts the following options:
  5298. @table @option
  5299. @item color
  5300. The color which will not be replaced with neutral gray.
  5301. @item similarity
  5302. Similarity percentage with the above color.
  5303. 0.01 matches only the exact key color, while 1.0 matches everything.
  5304. @item blend
  5305. Blend percentage. 0.0 makes pixels fully gray.
  5306. Higher values result in more preserved color.
  5307. @end table
  5308. @section colorlevels
  5309. Adjust video input frames using levels.
  5310. The filter accepts the following options:
  5311. @table @option
  5312. @item rimin
  5313. @item gimin
  5314. @item bimin
  5315. @item aimin
  5316. Adjust red, green, blue and alpha input black point.
  5317. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5318. @item rimax
  5319. @item gimax
  5320. @item bimax
  5321. @item aimax
  5322. Adjust red, green, blue and alpha input white point.
  5323. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5324. Input levels are used to lighten highlights (bright tones), darken shadows
  5325. (dark tones), change the balance of bright and dark tones.
  5326. @item romin
  5327. @item gomin
  5328. @item bomin
  5329. @item aomin
  5330. Adjust red, green, blue and alpha output black point.
  5331. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5332. @item romax
  5333. @item gomax
  5334. @item bomax
  5335. @item aomax
  5336. Adjust red, green, blue and alpha output white point.
  5337. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5338. Output levels allows manual selection of a constrained output level range.
  5339. @end table
  5340. @subsection Examples
  5341. @itemize
  5342. @item
  5343. Make video output darker:
  5344. @example
  5345. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5346. @end example
  5347. @item
  5348. Increase contrast:
  5349. @example
  5350. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5351. @end example
  5352. @item
  5353. Make video output lighter:
  5354. @example
  5355. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5356. @end example
  5357. @item
  5358. Increase brightness:
  5359. @example
  5360. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5361. @end example
  5362. @end itemize
  5363. @section colorchannelmixer
  5364. Adjust video input frames by re-mixing color channels.
  5365. This filter modifies a color channel by adding the values associated to
  5366. the other channels of the same pixels. For example if the value to
  5367. modify is red, the output value will be:
  5368. @example
  5369. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5370. @end example
  5371. The filter accepts the following options:
  5372. @table @option
  5373. @item rr
  5374. @item rg
  5375. @item rb
  5376. @item ra
  5377. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5378. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5379. @item gr
  5380. @item gg
  5381. @item gb
  5382. @item ga
  5383. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5384. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5385. @item br
  5386. @item bg
  5387. @item bb
  5388. @item ba
  5389. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5390. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5391. @item ar
  5392. @item ag
  5393. @item ab
  5394. @item aa
  5395. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5396. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5397. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5398. @end table
  5399. @subsection Examples
  5400. @itemize
  5401. @item
  5402. Convert source to grayscale:
  5403. @example
  5404. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5405. @end example
  5406. @item
  5407. Simulate sepia tones:
  5408. @example
  5409. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5410. @end example
  5411. @end itemize
  5412. @section colormatrix
  5413. Convert color matrix.
  5414. The filter accepts the following options:
  5415. @table @option
  5416. @item src
  5417. @item dst
  5418. Specify the source and destination color matrix. Both values must be
  5419. specified.
  5420. The accepted values are:
  5421. @table @samp
  5422. @item bt709
  5423. BT.709
  5424. @item fcc
  5425. FCC
  5426. @item bt601
  5427. BT.601
  5428. @item bt470
  5429. BT.470
  5430. @item bt470bg
  5431. BT.470BG
  5432. @item smpte170m
  5433. SMPTE-170M
  5434. @item smpte240m
  5435. SMPTE-240M
  5436. @item bt2020
  5437. BT.2020
  5438. @end table
  5439. @end table
  5440. For example to convert from BT.601 to SMPTE-240M, use the command:
  5441. @example
  5442. colormatrix=bt601:smpte240m
  5443. @end example
  5444. @section colorspace
  5445. Convert colorspace, transfer characteristics or color primaries.
  5446. Input video needs to have an even size.
  5447. The filter accepts the following options:
  5448. @table @option
  5449. @anchor{all}
  5450. @item all
  5451. Specify all color properties at once.
  5452. The accepted values are:
  5453. @table @samp
  5454. @item bt470m
  5455. BT.470M
  5456. @item bt470bg
  5457. BT.470BG
  5458. @item bt601-6-525
  5459. BT.601-6 525
  5460. @item bt601-6-625
  5461. BT.601-6 625
  5462. @item bt709
  5463. BT.709
  5464. @item smpte170m
  5465. SMPTE-170M
  5466. @item smpte240m
  5467. SMPTE-240M
  5468. @item bt2020
  5469. BT.2020
  5470. @end table
  5471. @anchor{space}
  5472. @item space
  5473. Specify output colorspace.
  5474. The accepted values are:
  5475. @table @samp
  5476. @item bt709
  5477. BT.709
  5478. @item fcc
  5479. FCC
  5480. @item bt470bg
  5481. BT.470BG or BT.601-6 625
  5482. @item smpte170m
  5483. SMPTE-170M or BT.601-6 525
  5484. @item smpte240m
  5485. SMPTE-240M
  5486. @item ycgco
  5487. YCgCo
  5488. @item bt2020ncl
  5489. BT.2020 with non-constant luminance
  5490. @end table
  5491. @anchor{trc}
  5492. @item trc
  5493. Specify output transfer characteristics.
  5494. The accepted values are:
  5495. @table @samp
  5496. @item bt709
  5497. BT.709
  5498. @item bt470m
  5499. BT.470M
  5500. @item bt470bg
  5501. BT.470BG
  5502. @item gamma22
  5503. Constant gamma of 2.2
  5504. @item gamma28
  5505. Constant gamma of 2.8
  5506. @item smpte170m
  5507. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5508. @item smpte240m
  5509. SMPTE-240M
  5510. @item srgb
  5511. SRGB
  5512. @item iec61966-2-1
  5513. iec61966-2-1
  5514. @item iec61966-2-4
  5515. iec61966-2-4
  5516. @item xvycc
  5517. xvycc
  5518. @item bt2020-10
  5519. BT.2020 for 10-bits content
  5520. @item bt2020-12
  5521. BT.2020 for 12-bits content
  5522. @end table
  5523. @anchor{primaries}
  5524. @item primaries
  5525. Specify output color primaries.
  5526. The accepted values are:
  5527. @table @samp
  5528. @item bt709
  5529. BT.709
  5530. @item bt470m
  5531. BT.470M
  5532. @item bt470bg
  5533. BT.470BG or BT.601-6 625
  5534. @item smpte170m
  5535. SMPTE-170M or BT.601-6 525
  5536. @item smpte240m
  5537. SMPTE-240M
  5538. @item film
  5539. film
  5540. @item smpte431
  5541. SMPTE-431
  5542. @item smpte432
  5543. SMPTE-432
  5544. @item bt2020
  5545. BT.2020
  5546. @item jedec-p22
  5547. JEDEC P22 phosphors
  5548. @end table
  5549. @anchor{range}
  5550. @item range
  5551. Specify output color range.
  5552. The accepted values are:
  5553. @table @samp
  5554. @item tv
  5555. TV (restricted) range
  5556. @item mpeg
  5557. MPEG (restricted) range
  5558. @item pc
  5559. PC (full) range
  5560. @item jpeg
  5561. JPEG (full) range
  5562. @end table
  5563. @item format
  5564. Specify output color format.
  5565. The accepted values are:
  5566. @table @samp
  5567. @item yuv420p
  5568. YUV 4:2:0 planar 8-bits
  5569. @item yuv420p10
  5570. YUV 4:2:0 planar 10-bits
  5571. @item yuv420p12
  5572. YUV 4:2:0 planar 12-bits
  5573. @item yuv422p
  5574. YUV 4:2:2 planar 8-bits
  5575. @item yuv422p10
  5576. YUV 4:2:2 planar 10-bits
  5577. @item yuv422p12
  5578. YUV 4:2:2 planar 12-bits
  5579. @item yuv444p
  5580. YUV 4:4:4 planar 8-bits
  5581. @item yuv444p10
  5582. YUV 4:4:4 planar 10-bits
  5583. @item yuv444p12
  5584. YUV 4:4:4 planar 12-bits
  5585. @end table
  5586. @item fast
  5587. Do a fast conversion, which skips gamma/primary correction. This will take
  5588. significantly less CPU, but will be mathematically incorrect. To get output
  5589. compatible with that produced by the colormatrix filter, use fast=1.
  5590. @item dither
  5591. Specify dithering mode.
  5592. The accepted values are:
  5593. @table @samp
  5594. @item none
  5595. No dithering
  5596. @item fsb
  5597. Floyd-Steinberg dithering
  5598. @end table
  5599. @item wpadapt
  5600. Whitepoint adaptation mode.
  5601. The accepted values are:
  5602. @table @samp
  5603. @item bradford
  5604. Bradford whitepoint adaptation
  5605. @item vonkries
  5606. von Kries whitepoint adaptation
  5607. @item identity
  5608. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5609. @end table
  5610. @item iall
  5611. Override all input properties at once. Same accepted values as @ref{all}.
  5612. @item ispace
  5613. Override input colorspace. Same accepted values as @ref{space}.
  5614. @item iprimaries
  5615. Override input color primaries. Same accepted values as @ref{primaries}.
  5616. @item itrc
  5617. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5618. @item irange
  5619. Override input color range. Same accepted values as @ref{range}.
  5620. @end table
  5621. The filter converts the transfer characteristics, color space and color
  5622. primaries to the specified user values. The output value, if not specified,
  5623. is set to a default value based on the "all" property. If that property is
  5624. also not specified, the filter will log an error. The output color range and
  5625. format default to the same value as the input color range and format. The
  5626. input transfer characteristics, color space, color primaries and color range
  5627. should be set on the input data. If any of these are missing, the filter will
  5628. log an error and no conversion will take place.
  5629. For example to convert the input to SMPTE-240M, use the command:
  5630. @example
  5631. colorspace=smpte240m
  5632. @end example
  5633. @section convolution
  5634. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5635. The filter accepts the following options:
  5636. @table @option
  5637. @item 0m
  5638. @item 1m
  5639. @item 2m
  5640. @item 3m
  5641. Set matrix for each plane.
  5642. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5643. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5644. @item 0rdiv
  5645. @item 1rdiv
  5646. @item 2rdiv
  5647. @item 3rdiv
  5648. Set multiplier for calculated value for each plane.
  5649. If unset or 0, it will be sum of all matrix elements.
  5650. @item 0bias
  5651. @item 1bias
  5652. @item 2bias
  5653. @item 3bias
  5654. Set bias for each plane. This value is added to the result of the multiplication.
  5655. Useful for making the overall image brighter or darker. Default is 0.0.
  5656. @item 0mode
  5657. @item 1mode
  5658. @item 2mode
  5659. @item 3mode
  5660. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5661. Default is @var{square}.
  5662. @end table
  5663. @subsection Examples
  5664. @itemize
  5665. @item
  5666. Apply sharpen:
  5667. @example
  5668. 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"
  5669. @end example
  5670. @item
  5671. Apply blur:
  5672. @example
  5673. 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"
  5674. @end example
  5675. @item
  5676. Apply edge enhance:
  5677. @example
  5678. 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"
  5679. @end example
  5680. @item
  5681. Apply edge detect:
  5682. @example
  5683. 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"
  5684. @end example
  5685. @item
  5686. Apply laplacian edge detector which includes diagonals:
  5687. @example
  5688. 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"
  5689. @end example
  5690. @item
  5691. Apply emboss:
  5692. @example
  5693. 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"
  5694. @end example
  5695. @end itemize
  5696. @section convolve
  5697. Apply 2D convolution of video stream in frequency domain using second stream
  5698. as impulse.
  5699. The filter accepts the following options:
  5700. @table @option
  5701. @item planes
  5702. Set which planes to process.
  5703. @item impulse
  5704. Set which impulse video frames will be processed, can be @var{first}
  5705. or @var{all}. Default is @var{all}.
  5706. @end table
  5707. The @code{convolve} filter also supports the @ref{framesync} options.
  5708. @section copy
  5709. Copy the input video source unchanged to the output. This is mainly useful for
  5710. testing purposes.
  5711. @anchor{coreimage}
  5712. @section coreimage
  5713. Video filtering on GPU using Apple's CoreImage API on OSX.
  5714. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5715. processed by video hardware. However, software-based OpenGL implementations
  5716. exist which means there is no guarantee for hardware processing. It depends on
  5717. the respective OSX.
  5718. There are many filters and image generators provided by Apple that come with a
  5719. large variety of options. The filter has to be referenced by its name along
  5720. with its options.
  5721. The coreimage filter accepts the following options:
  5722. @table @option
  5723. @item list_filters
  5724. List all available filters and generators along with all their respective
  5725. options as well as possible minimum and maximum values along with the default
  5726. values.
  5727. @example
  5728. list_filters=true
  5729. @end example
  5730. @item filter
  5731. Specify all filters by their respective name and options.
  5732. Use @var{list_filters} to determine all valid filter names and options.
  5733. Numerical options are specified by a float value and are automatically clamped
  5734. to their respective value range. Vector and color options have to be specified
  5735. by a list of space separated float values. Character escaping has to be done.
  5736. A special option name @code{default} is available to use default options for a
  5737. filter.
  5738. It is required to specify either @code{default} or at least one of the filter options.
  5739. All omitted options are used with their default values.
  5740. The syntax of the filter string is as follows:
  5741. @example
  5742. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5743. @end example
  5744. @item output_rect
  5745. Specify a rectangle where the output of the filter chain is copied into the
  5746. input image. It is given by a list of space separated float values:
  5747. @example
  5748. output_rect=x\ y\ width\ height
  5749. @end example
  5750. If not given, the output rectangle equals the dimensions of the input image.
  5751. The output rectangle is automatically cropped at the borders of the input
  5752. image. Negative values are valid for each component.
  5753. @example
  5754. output_rect=25\ 25\ 100\ 100
  5755. @end example
  5756. @end table
  5757. Several filters can be chained for successive processing without GPU-HOST
  5758. transfers allowing for fast processing of complex filter chains.
  5759. Currently, only filters with zero (generators) or exactly one (filters) input
  5760. image and one output image are supported. Also, transition filters are not yet
  5761. usable as intended.
  5762. Some filters generate output images with additional padding depending on the
  5763. respective filter kernel. The padding is automatically removed to ensure the
  5764. filter output has the same size as the input image.
  5765. For image generators, the size of the output image is determined by the
  5766. previous output image of the filter chain or the input image of the whole
  5767. filterchain, respectively. The generators do not use the pixel information of
  5768. this image to generate their output. However, the generated output is
  5769. blended onto this image, resulting in partial or complete coverage of the
  5770. output image.
  5771. The @ref{coreimagesrc} video source can be used for generating input images
  5772. which are directly fed into the filter chain. By using it, providing input
  5773. images by another video source or an input video is not required.
  5774. @subsection Examples
  5775. @itemize
  5776. @item
  5777. List all filters available:
  5778. @example
  5779. coreimage=list_filters=true
  5780. @end example
  5781. @item
  5782. Use the CIBoxBlur filter with default options to blur an image:
  5783. @example
  5784. coreimage=filter=CIBoxBlur@@default
  5785. @end example
  5786. @item
  5787. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5788. its center at 100x100 and a radius of 50 pixels:
  5789. @example
  5790. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5791. @end example
  5792. @item
  5793. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5794. given as complete and escaped command-line for Apple's standard bash shell:
  5795. @example
  5796. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5797. @end example
  5798. @end itemize
  5799. @section crop
  5800. Crop the input video to given dimensions.
  5801. It accepts the following parameters:
  5802. @table @option
  5803. @item w, out_w
  5804. The width of the output video. It defaults to @code{iw}.
  5805. This expression is evaluated only once during the filter
  5806. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5807. @item h, out_h
  5808. The height of the output video. It defaults to @code{ih}.
  5809. This expression is evaluated only once during the filter
  5810. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5811. @item x
  5812. The horizontal position, in the input video, of the left edge of the output
  5813. video. It defaults to @code{(in_w-out_w)/2}.
  5814. This expression is evaluated per-frame.
  5815. @item y
  5816. The vertical position, in the input video, of the top edge of the output video.
  5817. It defaults to @code{(in_h-out_h)/2}.
  5818. This expression is evaluated per-frame.
  5819. @item keep_aspect
  5820. If set to 1 will force the output display aspect ratio
  5821. to be the same of the input, by changing the output sample aspect
  5822. ratio. It defaults to 0.
  5823. @item exact
  5824. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5825. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5826. It defaults to 0.
  5827. @end table
  5828. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5829. expressions containing the following constants:
  5830. @table @option
  5831. @item x
  5832. @item y
  5833. The computed values for @var{x} and @var{y}. They are evaluated for
  5834. each new frame.
  5835. @item in_w
  5836. @item in_h
  5837. The input width and height.
  5838. @item iw
  5839. @item ih
  5840. These are the same as @var{in_w} and @var{in_h}.
  5841. @item out_w
  5842. @item out_h
  5843. The output (cropped) width and height.
  5844. @item ow
  5845. @item oh
  5846. These are the same as @var{out_w} and @var{out_h}.
  5847. @item a
  5848. same as @var{iw} / @var{ih}
  5849. @item sar
  5850. input sample aspect ratio
  5851. @item dar
  5852. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5853. @item hsub
  5854. @item vsub
  5855. horizontal and vertical chroma subsample values. For example for the
  5856. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5857. @item n
  5858. The number of the input frame, starting from 0.
  5859. @item pos
  5860. the position in the file of the input frame, NAN if unknown
  5861. @item t
  5862. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5863. @end table
  5864. The expression for @var{out_w} may depend on the value of @var{out_h},
  5865. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5866. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5867. evaluated after @var{out_w} and @var{out_h}.
  5868. The @var{x} and @var{y} parameters specify the expressions for the
  5869. position of the top-left corner of the output (non-cropped) area. They
  5870. are evaluated for each frame. If the evaluated value is not valid, it
  5871. is approximated to the nearest valid value.
  5872. The expression for @var{x} may depend on @var{y}, and the expression
  5873. for @var{y} may depend on @var{x}.
  5874. @subsection Examples
  5875. @itemize
  5876. @item
  5877. Crop area with size 100x100 at position (12,34).
  5878. @example
  5879. crop=100:100:12:34
  5880. @end example
  5881. Using named options, the example above becomes:
  5882. @example
  5883. crop=w=100:h=100:x=12:y=34
  5884. @end example
  5885. @item
  5886. Crop the central input area with size 100x100:
  5887. @example
  5888. crop=100:100
  5889. @end example
  5890. @item
  5891. Crop the central input area with size 2/3 of the input video:
  5892. @example
  5893. crop=2/3*in_w:2/3*in_h
  5894. @end example
  5895. @item
  5896. Crop the input video central square:
  5897. @example
  5898. crop=out_w=in_h
  5899. crop=in_h
  5900. @end example
  5901. @item
  5902. Delimit the rectangle with the top-left corner placed at position
  5903. 100:100 and the right-bottom corner corresponding to the right-bottom
  5904. corner of the input image.
  5905. @example
  5906. crop=in_w-100:in_h-100:100:100
  5907. @end example
  5908. @item
  5909. Crop 10 pixels from the left and right borders, and 20 pixels from
  5910. the top and bottom borders
  5911. @example
  5912. crop=in_w-2*10:in_h-2*20
  5913. @end example
  5914. @item
  5915. Keep only the bottom right quarter of the input image:
  5916. @example
  5917. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5918. @end example
  5919. @item
  5920. Crop height for getting Greek harmony:
  5921. @example
  5922. crop=in_w:1/PHI*in_w
  5923. @end example
  5924. @item
  5925. Apply trembling effect:
  5926. @example
  5927. 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)
  5928. @end example
  5929. @item
  5930. Apply erratic camera effect depending on timestamp:
  5931. @example
  5932. 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)"
  5933. @end example
  5934. @item
  5935. Set x depending on the value of y:
  5936. @example
  5937. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5938. @end example
  5939. @end itemize
  5940. @subsection Commands
  5941. This filter supports the following commands:
  5942. @table @option
  5943. @item w, out_w
  5944. @item h, out_h
  5945. @item x
  5946. @item y
  5947. Set width/height of the output video and the horizontal/vertical position
  5948. in the input video.
  5949. The command accepts the same syntax of the corresponding option.
  5950. If the specified expression is not valid, it is kept at its current
  5951. value.
  5952. @end table
  5953. @section cropdetect
  5954. Auto-detect the crop size.
  5955. It calculates the necessary cropping parameters and prints the
  5956. recommended parameters via the logging system. The detected dimensions
  5957. correspond to the non-black area of the input video.
  5958. It accepts the following parameters:
  5959. @table @option
  5960. @item limit
  5961. Set higher black value threshold, which can be optionally specified
  5962. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5963. value greater to the set value is considered non-black. It defaults to 24.
  5964. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5965. on the bitdepth of the pixel format.
  5966. @item round
  5967. The value which the width/height should be divisible by. It defaults to
  5968. 16. The offset is automatically adjusted to center the video. Use 2 to
  5969. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5970. encoding to most video codecs.
  5971. @item reset_count, reset
  5972. Set the counter that determines after how many frames cropdetect will
  5973. reset the previously detected largest video area and start over to
  5974. detect the current optimal crop area. Default value is 0.
  5975. This can be useful when channel logos distort the video area. 0
  5976. indicates 'never reset', and returns the largest area encountered during
  5977. playback.
  5978. @end table
  5979. @anchor{cue}
  5980. @section cue
  5981. Delay video filtering until a given wallclock timestamp. The filter first
  5982. passes on @option{preroll} amount of frames, then it buffers at most
  5983. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5984. it forwards the buffered frames and also any subsequent frames coming in its
  5985. input.
  5986. The filter can be used synchronize the output of multiple ffmpeg processes for
  5987. realtime output devices like decklink. By putting the delay in the filtering
  5988. chain and pre-buffering frames the process can pass on data to output almost
  5989. immediately after the target wallclock timestamp is reached.
  5990. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5991. some use cases.
  5992. @table @option
  5993. @item cue
  5994. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5995. @item preroll
  5996. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5997. @item buffer
  5998. The maximum duration of content to buffer before waiting for the cue expressed
  5999. in seconds. Default is 0.
  6000. @end table
  6001. @anchor{curves}
  6002. @section curves
  6003. Apply color adjustments using curves.
  6004. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6005. component (red, green and blue) has its values defined by @var{N} key points
  6006. tied from each other using a smooth curve. The x-axis represents the pixel
  6007. values from the input frame, and the y-axis the new pixel values to be set for
  6008. the output frame.
  6009. By default, a component curve is defined by the two points @var{(0;0)} and
  6010. @var{(1;1)}. This creates a straight line where each original pixel value is
  6011. "adjusted" to its own value, which means no change to the image.
  6012. The filter allows you to redefine these two points and add some more. A new
  6013. curve (using a natural cubic spline interpolation) will be define to pass
  6014. smoothly through all these new coordinates. The new defined points needs to be
  6015. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6016. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6017. the vector spaces, the values will be clipped accordingly.
  6018. The filter accepts the following options:
  6019. @table @option
  6020. @item preset
  6021. Select one of the available color presets. This option can be used in addition
  6022. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6023. options takes priority on the preset values.
  6024. Available presets are:
  6025. @table @samp
  6026. @item none
  6027. @item color_negative
  6028. @item cross_process
  6029. @item darker
  6030. @item increase_contrast
  6031. @item lighter
  6032. @item linear_contrast
  6033. @item medium_contrast
  6034. @item negative
  6035. @item strong_contrast
  6036. @item vintage
  6037. @end table
  6038. Default is @code{none}.
  6039. @item master, m
  6040. Set the master key points. These points will define a second pass mapping. It
  6041. is sometimes called a "luminance" or "value" mapping. It can be used with
  6042. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6043. post-processing LUT.
  6044. @item red, r
  6045. Set the key points for the red component.
  6046. @item green, g
  6047. Set the key points for the green component.
  6048. @item blue, b
  6049. Set the key points for the blue component.
  6050. @item all
  6051. Set the key points for all components (not including master).
  6052. Can be used in addition to the other key points component
  6053. options. In this case, the unset component(s) will fallback on this
  6054. @option{all} setting.
  6055. @item psfile
  6056. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6057. @item plot
  6058. Save Gnuplot script of the curves in specified file.
  6059. @end table
  6060. To avoid some filtergraph syntax conflicts, each key points list need to be
  6061. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6062. @subsection Examples
  6063. @itemize
  6064. @item
  6065. Increase slightly the middle level of blue:
  6066. @example
  6067. curves=blue='0/0 0.5/0.58 1/1'
  6068. @end example
  6069. @item
  6070. Vintage effect:
  6071. @example
  6072. 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'
  6073. @end example
  6074. Here we obtain the following coordinates for each components:
  6075. @table @var
  6076. @item red
  6077. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6078. @item green
  6079. @code{(0;0) (0.50;0.48) (1;1)}
  6080. @item blue
  6081. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6082. @end table
  6083. @item
  6084. The previous example can also be achieved with the associated built-in preset:
  6085. @example
  6086. curves=preset=vintage
  6087. @end example
  6088. @item
  6089. Or simply:
  6090. @example
  6091. curves=vintage
  6092. @end example
  6093. @item
  6094. Use a Photoshop preset and redefine the points of the green component:
  6095. @example
  6096. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6097. @end example
  6098. @item
  6099. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6100. and @command{gnuplot}:
  6101. @example
  6102. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6103. gnuplot -p /tmp/curves.plt
  6104. @end example
  6105. @end itemize
  6106. @section datascope
  6107. Video data analysis filter.
  6108. This filter shows hexadecimal pixel values of part of video.
  6109. The filter accepts the following options:
  6110. @table @option
  6111. @item size, s
  6112. Set output video size.
  6113. @item x
  6114. Set x offset from where to pick pixels.
  6115. @item y
  6116. Set y offset from where to pick pixels.
  6117. @item mode
  6118. Set scope mode, can be one of the following:
  6119. @table @samp
  6120. @item mono
  6121. Draw hexadecimal pixel values with white color on black background.
  6122. @item color
  6123. Draw hexadecimal pixel values with input video pixel color on black
  6124. background.
  6125. @item color2
  6126. Draw hexadecimal pixel values on color background picked from input video,
  6127. the text color is picked in such way so its always visible.
  6128. @end table
  6129. @item axis
  6130. Draw rows and columns numbers on left and top of video.
  6131. @item opacity
  6132. Set background opacity.
  6133. @end table
  6134. @section dctdnoiz
  6135. Denoise frames using 2D DCT (frequency domain filtering).
  6136. This filter is not designed for real time.
  6137. The filter accepts the following options:
  6138. @table @option
  6139. @item sigma, s
  6140. Set the noise sigma constant.
  6141. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6142. coefficient (absolute value) below this threshold with be dropped.
  6143. If you need a more advanced filtering, see @option{expr}.
  6144. Default is @code{0}.
  6145. @item overlap
  6146. Set number overlapping pixels for each block. Since the filter can be slow, you
  6147. may want to reduce this value, at the cost of a less effective filter and the
  6148. risk of various artefacts.
  6149. If the overlapping value doesn't permit processing the whole input width or
  6150. height, a warning will be displayed and according borders won't be denoised.
  6151. Default value is @var{blocksize}-1, which is the best possible setting.
  6152. @item expr, e
  6153. Set the coefficient factor expression.
  6154. For each coefficient of a DCT block, this expression will be evaluated as a
  6155. multiplier value for the coefficient.
  6156. If this is option is set, the @option{sigma} option will be ignored.
  6157. The absolute value of the coefficient can be accessed through the @var{c}
  6158. variable.
  6159. @item n
  6160. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6161. @var{blocksize}, which is the width and height of the processed blocks.
  6162. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6163. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6164. on the speed processing. Also, a larger block size does not necessarily means a
  6165. better de-noising.
  6166. @end table
  6167. @subsection Examples
  6168. Apply a denoise with a @option{sigma} of @code{4.5}:
  6169. @example
  6170. dctdnoiz=4.5
  6171. @end example
  6172. The same operation can be achieved using the expression system:
  6173. @example
  6174. dctdnoiz=e='gte(c, 4.5*3)'
  6175. @end example
  6176. Violent denoise using a block size of @code{16x16}:
  6177. @example
  6178. dctdnoiz=15:n=4
  6179. @end example
  6180. @section deband
  6181. Remove banding artifacts from input video.
  6182. It works by replacing banded pixels with average value of referenced pixels.
  6183. The filter accepts the following options:
  6184. @table @option
  6185. @item 1thr
  6186. @item 2thr
  6187. @item 3thr
  6188. @item 4thr
  6189. Set banding detection threshold for each plane. Default is 0.02.
  6190. Valid range is 0.00003 to 0.5.
  6191. If difference between current pixel and reference pixel is less than threshold,
  6192. it will be considered as banded.
  6193. @item range, r
  6194. Banding detection range in pixels. Default is 16. If positive, random number
  6195. in range 0 to set value will be used. If negative, exact absolute value
  6196. will be used.
  6197. The range defines square of four pixels around current pixel.
  6198. @item direction, d
  6199. Set direction in radians from which four pixel will be compared. If positive,
  6200. random direction from 0 to set direction will be picked. If negative, exact of
  6201. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6202. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6203. column.
  6204. @item blur, b
  6205. If enabled, current pixel is compared with average value of all four
  6206. surrounding pixels. The default is enabled. If disabled current pixel is
  6207. compared with all four surrounding pixels. The pixel is considered banded
  6208. if only all four differences with surrounding pixels are less than threshold.
  6209. @item coupling, c
  6210. If enabled, current pixel is changed if and only if all pixel components are banded,
  6211. e.g. banding detection threshold is triggered for all color components.
  6212. The default is disabled.
  6213. @end table
  6214. @section deblock
  6215. Remove blocking artifacts from input video.
  6216. The filter accepts the following options:
  6217. @table @option
  6218. @item filter
  6219. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6220. This controls what kind of deblocking is applied.
  6221. @item block
  6222. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6223. @item alpha
  6224. @item beta
  6225. @item gamma
  6226. @item delta
  6227. Set blocking detection thresholds. Allowed range is 0 to 1.
  6228. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6229. Using higher threshold gives more deblocking strength.
  6230. Setting @var{alpha} controls threshold detection at exact edge of block.
  6231. Remaining options controls threshold detection near the edge. Each one for
  6232. below/above or left/right. Setting any of those to @var{0} disables
  6233. deblocking.
  6234. @item planes
  6235. Set planes to filter. Default is to filter all available planes.
  6236. @end table
  6237. @subsection Examples
  6238. @itemize
  6239. @item
  6240. Deblock using weak filter and block size of 4 pixels.
  6241. @example
  6242. deblock=filter=weak:block=4
  6243. @end example
  6244. @item
  6245. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6246. deblocking more edges.
  6247. @example
  6248. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6249. @end example
  6250. @item
  6251. Similar as above, but filter only first plane.
  6252. @example
  6253. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6254. @end example
  6255. @item
  6256. Similar as above, but filter only second and third plane.
  6257. @example
  6258. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6259. @end example
  6260. @end itemize
  6261. @anchor{decimate}
  6262. @section decimate
  6263. Drop duplicated frames at regular intervals.
  6264. The filter accepts the following options:
  6265. @table @option
  6266. @item cycle
  6267. Set the number of frames from which one will be dropped. Setting this to
  6268. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6269. Default is @code{5}.
  6270. @item dupthresh
  6271. Set the threshold for duplicate detection. If the difference metric for a frame
  6272. is less than or equal to this value, then it is declared as duplicate. Default
  6273. is @code{1.1}
  6274. @item scthresh
  6275. Set scene change threshold. Default is @code{15}.
  6276. @item blockx
  6277. @item blocky
  6278. Set the size of the x and y-axis blocks used during metric calculations.
  6279. Larger blocks give better noise suppression, but also give worse detection of
  6280. small movements. Must be a power of two. Default is @code{32}.
  6281. @item ppsrc
  6282. Mark main input as a pre-processed input and activate clean source input
  6283. stream. This allows the input to be pre-processed with various filters to help
  6284. the metrics calculation while keeping the frame selection lossless. When set to
  6285. @code{1}, the first stream is for the pre-processed input, and the second
  6286. stream is the clean source from where the kept frames are chosen. Default is
  6287. @code{0}.
  6288. @item chroma
  6289. Set whether or not chroma is considered in the metric calculations. Default is
  6290. @code{1}.
  6291. @end table
  6292. @section deconvolve
  6293. Apply 2D deconvolution of video stream in frequency domain using second stream
  6294. as impulse.
  6295. The filter accepts the following options:
  6296. @table @option
  6297. @item planes
  6298. Set which planes to process.
  6299. @item impulse
  6300. Set which impulse video frames will be processed, can be @var{first}
  6301. or @var{all}. Default is @var{all}.
  6302. @item noise
  6303. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6304. and height are not same and not power of 2 or if stream prior to convolving
  6305. had noise.
  6306. @end table
  6307. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6308. @section dedot
  6309. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6310. It accepts the following options:
  6311. @table @option
  6312. @item m
  6313. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6314. @var{rainbows} for cross-color reduction.
  6315. @item lt
  6316. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6317. @item tl
  6318. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6319. @item tc
  6320. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6321. @item ct
  6322. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6323. @end table
  6324. @section deflate
  6325. Apply deflate effect to the video.
  6326. This filter replaces the pixel by the local(3x3) average by taking into account
  6327. only values lower than the pixel.
  6328. It accepts the following options:
  6329. @table @option
  6330. @item threshold0
  6331. @item threshold1
  6332. @item threshold2
  6333. @item threshold3
  6334. Limit the maximum change for each plane, default is 65535.
  6335. If 0, plane will remain unchanged.
  6336. @end table
  6337. @section deflicker
  6338. Remove temporal frame luminance variations.
  6339. It accepts the following options:
  6340. @table @option
  6341. @item size, s
  6342. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6343. @item mode, m
  6344. Set averaging mode to smooth temporal luminance variations.
  6345. Available values are:
  6346. @table @samp
  6347. @item am
  6348. Arithmetic mean
  6349. @item gm
  6350. Geometric mean
  6351. @item hm
  6352. Harmonic mean
  6353. @item qm
  6354. Quadratic mean
  6355. @item cm
  6356. Cubic mean
  6357. @item pm
  6358. Power mean
  6359. @item median
  6360. Median
  6361. @end table
  6362. @item bypass
  6363. Do not actually modify frame. Useful when one only wants metadata.
  6364. @end table
  6365. @section dejudder
  6366. Remove judder produced by partially interlaced telecined content.
  6367. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6368. source was partially telecined content then the output of @code{pullup,dejudder}
  6369. will have a variable frame rate. May change the recorded frame rate of the
  6370. container. Aside from that change, this filter will not affect constant frame
  6371. rate video.
  6372. The option available in this filter is:
  6373. @table @option
  6374. @item cycle
  6375. Specify the length of the window over which the judder repeats.
  6376. Accepts any integer greater than 1. Useful values are:
  6377. @table @samp
  6378. @item 4
  6379. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6380. @item 5
  6381. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6382. @item 20
  6383. If a mixture of the two.
  6384. @end table
  6385. The default is @samp{4}.
  6386. @end table
  6387. @section delogo
  6388. Suppress a TV station logo by a simple interpolation of the surrounding
  6389. pixels. Just set a rectangle covering the logo and watch it disappear
  6390. (and sometimes something even uglier appear - your mileage may vary).
  6391. It accepts the following parameters:
  6392. @table @option
  6393. @item x
  6394. @item y
  6395. Specify the top left corner coordinates of the logo. They must be
  6396. specified.
  6397. @item w
  6398. @item h
  6399. Specify the width and height of the logo to clear. They must be
  6400. specified.
  6401. @item band, t
  6402. Specify the thickness of the fuzzy edge of the rectangle (added to
  6403. @var{w} and @var{h}). The default value is 1. This option is
  6404. deprecated, setting higher values should no longer be necessary and
  6405. is not recommended.
  6406. @item show
  6407. When set to 1, a green rectangle is drawn on the screen to simplify
  6408. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6409. The default value is 0.
  6410. The rectangle is drawn on the outermost pixels which will be (partly)
  6411. replaced with interpolated values. The values of the next pixels
  6412. immediately outside this rectangle in each direction will be used to
  6413. compute the interpolated pixel values inside the rectangle.
  6414. @end table
  6415. @subsection Examples
  6416. @itemize
  6417. @item
  6418. Set a rectangle covering the area with top left corner coordinates 0,0
  6419. and size 100x77, and a band of size 10:
  6420. @example
  6421. delogo=x=0:y=0:w=100:h=77:band=10
  6422. @end example
  6423. @end itemize
  6424. @section derain
  6425. Remove the rain in the input image/video by applying the derain methods based on
  6426. convolutional neural networks. Supported models:
  6427. @itemize
  6428. @item
  6429. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6430. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6431. @end itemize
  6432. Training scripts as well as scripts for model generation are provided in
  6433. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6434. The filter accepts the following options:
  6435. @table @option
  6436. @item dnn_backend
  6437. Specify which DNN backend to use for model loading and execution. This option accepts
  6438. the following values:
  6439. @table @samp
  6440. @item native
  6441. Native implementation of DNN loading and execution.
  6442. @end table
  6443. Default value is @samp{native}.
  6444. @item model
  6445. Set path to model file specifying network architecture and its parameters.
  6446. Note that different backends use different file formats. TensorFlow backend
  6447. can load files for both formats, while native backend can load files for only
  6448. its format.
  6449. @end table
  6450. @section deshake
  6451. Attempt to fix small changes in horizontal and/or vertical shift. This
  6452. filter helps remove camera shake from hand-holding a camera, bumping a
  6453. tripod, moving on a vehicle, etc.
  6454. The filter accepts the following options:
  6455. @table @option
  6456. @item x
  6457. @item y
  6458. @item w
  6459. @item h
  6460. Specify a rectangular area where to limit the search for motion
  6461. vectors.
  6462. If desired the search for motion vectors can be limited to a
  6463. rectangular area of the frame defined by its top left corner, width
  6464. and height. These parameters have the same meaning as the drawbox
  6465. filter which can be used to visualise the position of the bounding
  6466. box.
  6467. This is useful when simultaneous movement of subjects within the frame
  6468. might be confused for camera motion by the motion vector search.
  6469. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6470. then the full frame is used. This allows later options to be set
  6471. without specifying the bounding box for the motion vector search.
  6472. Default - search the whole frame.
  6473. @item rx
  6474. @item ry
  6475. Specify the maximum extent of movement in x and y directions in the
  6476. range 0-64 pixels. Default 16.
  6477. @item edge
  6478. Specify how to generate pixels to fill blanks at the edge of the
  6479. frame. Available values are:
  6480. @table @samp
  6481. @item blank, 0
  6482. Fill zeroes at blank locations
  6483. @item original, 1
  6484. Original image at blank locations
  6485. @item clamp, 2
  6486. Extruded edge value at blank locations
  6487. @item mirror, 3
  6488. Mirrored edge at blank locations
  6489. @end table
  6490. Default value is @samp{mirror}.
  6491. @item blocksize
  6492. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6493. default 8.
  6494. @item contrast
  6495. Specify the contrast threshold for blocks. Only blocks with more than
  6496. the specified contrast (difference between darkest and lightest
  6497. pixels) will be considered. Range 1-255, default 125.
  6498. @item search
  6499. Specify the search strategy. Available values are:
  6500. @table @samp
  6501. @item exhaustive, 0
  6502. Set exhaustive search
  6503. @item less, 1
  6504. Set less exhaustive search.
  6505. @end table
  6506. Default value is @samp{exhaustive}.
  6507. @item filename
  6508. If set then a detailed log of the motion search is written to the
  6509. specified file.
  6510. @end table
  6511. @section despill
  6512. Remove unwanted contamination of foreground colors, caused by reflected color of
  6513. greenscreen or bluescreen.
  6514. This filter accepts the following options:
  6515. @table @option
  6516. @item type
  6517. Set what type of despill to use.
  6518. @item mix
  6519. Set how spillmap will be generated.
  6520. @item expand
  6521. Set how much to get rid of still remaining spill.
  6522. @item red
  6523. Controls amount of red in spill area.
  6524. @item green
  6525. Controls amount of green in spill area.
  6526. Should be -1 for greenscreen.
  6527. @item blue
  6528. Controls amount of blue in spill area.
  6529. Should be -1 for bluescreen.
  6530. @item brightness
  6531. Controls brightness of spill area, preserving colors.
  6532. @item alpha
  6533. Modify alpha from generated spillmap.
  6534. @end table
  6535. @section detelecine
  6536. Apply an exact inverse of the telecine operation. It requires a predefined
  6537. pattern specified using the pattern option which must be the same as that passed
  6538. to the telecine filter.
  6539. This filter accepts the following options:
  6540. @table @option
  6541. @item first_field
  6542. @table @samp
  6543. @item top, t
  6544. top field first
  6545. @item bottom, b
  6546. bottom field first
  6547. The default value is @code{top}.
  6548. @end table
  6549. @item pattern
  6550. A string of numbers representing the pulldown pattern you wish to apply.
  6551. The default value is @code{23}.
  6552. @item start_frame
  6553. A number representing position of the first frame with respect to the telecine
  6554. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6555. @end table
  6556. @section dilation
  6557. Apply dilation effect to the video.
  6558. This filter replaces the pixel by the local(3x3) maximum.
  6559. It accepts the following options:
  6560. @table @option
  6561. @item threshold0
  6562. @item threshold1
  6563. @item threshold2
  6564. @item threshold3
  6565. Limit the maximum change for each plane, default is 65535.
  6566. If 0, plane will remain unchanged.
  6567. @item coordinates
  6568. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6569. pixels are used.
  6570. Flags to local 3x3 coordinates maps like this:
  6571. 1 2 3
  6572. 4 5
  6573. 6 7 8
  6574. @end table
  6575. @section displace
  6576. Displace pixels as indicated by second and third input stream.
  6577. It takes three input streams and outputs one stream, the first input is the
  6578. source, and second and third input are displacement maps.
  6579. The second input specifies how much to displace pixels along the
  6580. x-axis, while the third input specifies how much to displace pixels
  6581. along the y-axis.
  6582. If one of displacement map streams terminates, last frame from that
  6583. displacement map will be used.
  6584. Note that once generated, displacements maps can be reused over and over again.
  6585. A description of the accepted options follows.
  6586. @table @option
  6587. @item edge
  6588. Set displace behavior for pixels that are out of range.
  6589. Available values are:
  6590. @table @samp
  6591. @item blank
  6592. Missing pixels are replaced by black pixels.
  6593. @item smear
  6594. Adjacent pixels will spread out to replace missing pixels.
  6595. @item wrap
  6596. Out of range pixels are wrapped so they point to pixels of other side.
  6597. @item mirror
  6598. Out of range pixels will be replaced with mirrored pixels.
  6599. @end table
  6600. Default is @samp{smear}.
  6601. @end table
  6602. @subsection Examples
  6603. @itemize
  6604. @item
  6605. Add ripple effect to rgb input of video size hd720:
  6606. @example
  6607. 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
  6608. @end example
  6609. @item
  6610. Add wave effect to rgb input of video size hd720:
  6611. @example
  6612. 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
  6613. @end example
  6614. @end itemize
  6615. @section drawbox
  6616. Draw a colored box on the input image.
  6617. It accepts the following parameters:
  6618. @table @option
  6619. @item x
  6620. @item y
  6621. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6622. @item width, w
  6623. @item height, h
  6624. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6625. the input width and height. It defaults to 0.
  6626. @item color, c
  6627. Specify the color of the box to write. For the general syntax of this option,
  6628. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6629. value @code{invert} is used, the box edge color is the same as the
  6630. video with inverted luma.
  6631. @item thickness, t
  6632. The expression which sets the thickness of the box edge.
  6633. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6634. See below for the list of accepted constants.
  6635. @item replace
  6636. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6637. will overwrite the video's color and alpha pixels.
  6638. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6639. @end table
  6640. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6641. following constants:
  6642. @table @option
  6643. @item dar
  6644. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6645. @item hsub
  6646. @item vsub
  6647. horizontal and vertical chroma subsample values. For example for the
  6648. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6649. @item in_h, ih
  6650. @item in_w, iw
  6651. The input width and height.
  6652. @item sar
  6653. The input sample aspect ratio.
  6654. @item x
  6655. @item y
  6656. The x and y offset coordinates where the box is drawn.
  6657. @item w
  6658. @item h
  6659. The width and height of the drawn box.
  6660. @item t
  6661. The thickness of the drawn box.
  6662. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6663. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6664. @end table
  6665. @subsection Examples
  6666. @itemize
  6667. @item
  6668. Draw a black box around the edge of the input image:
  6669. @example
  6670. drawbox
  6671. @end example
  6672. @item
  6673. Draw a box with color red and an opacity of 50%:
  6674. @example
  6675. drawbox=10:20:200:60:red@@0.5
  6676. @end example
  6677. The previous example can be specified as:
  6678. @example
  6679. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6680. @end example
  6681. @item
  6682. Fill the box with pink color:
  6683. @example
  6684. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6685. @end example
  6686. @item
  6687. Draw a 2-pixel red 2.40:1 mask:
  6688. @example
  6689. 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
  6690. @end example
  6691. @end itemize
  6692. @section drawgrid
  6693. Draw a grid on the input image.
  6694. It accepts the following parameters:
  6695. @table @option
  6696. @item x
  6697. @item y
  6698. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6699. @item width, w
  6700. @item height, h
  6701. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6702. input width and height, respectively, minus @code{thickness}, so image gets
  6703. framed. Default to 0.
  6704. @item color, c
  6705. Specify the color of the grid. For the general syntax of this option,
  6706. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6707. value @code{invert} is used, the grid color is the same as the
  6708. video with inverted luma.
  6709. @item thickness, t
  6710. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6711. See below for the list of accepted constants.
  6712. @item replace
  6713. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6714. will overwrite the video's color and alpha pixels.
  6715. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6716. @end table
  6717. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6718. following constants:
  6719. @table @option
  6720. @item dar
  6721. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6722. @item hsub
  6723. @item vsub
  6724. horizontal and vertical chroma subsample values. For example for the
  6725. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6726. @item in_h, ih
  6727. @item in_w, iw
  6728. The input grid cell width and height.
  6729. @item sar
  6730. The input sample aspect ratio.
  6731. @item x
  6732. @item y
  6733. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6734. @item w
  6735. @item h
  6736. The width and height of the drawn cell.
  6737. @item t
  6738. The thickness of the drawn cell.
  6739. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6740. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6741. @end table
  6742. @subsection Examples
  6743. @itemize
  6744. @item
  6745. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6746. @example
  6747. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6748. @end example
  6749. @item
  6750. Draw a white 3x3 grid with an opacity of 50%:
  6751. @example
  6752. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6753. @end example
  6754. @end itemize
  6755. @anchor{drawtext}
  6756. @section drawtext
  6757. Draw a text string or text from a specified file on top of a video, using the
  6758. libfreetype library.
  6759. To enable compilation of this filter, you need to configure FFmpeg with
  6760. @code{--enable-libfreetype}.
  6761. To enable default font fallback and the @var{font} option you need to
  6762. configure FFmpeg with @code{--enable-libfontconfig}.
  6763. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6764. @code{--enable-libfribidi}.
  6765. @subsection Syntax
  6766. It accepts the following parameters:
  6767. @table @option
  6768. @item box
  6769. Used to draw a box around text using the background color.
  6770. The value must be either 1 (enable) or 0 (disable).
  6771. The default value of @var{box} is 0.
  6772. @item boxborderw
  6773. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6774. The default value of @var{boxborderw} is 0.
  6775. @item boxcolor
  6776. The color to be used for drawing box around text. For the syntax of this
  6777. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6778. The default value of @var{boxcolor} is "white".
  6779. @item line_spacing
  6780. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6781. The default value of @var{line_spacing} is 0.
  6782. @item borderw
  6783. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6784. The default value of @var{borderw} is 0.
  6785. @item bordercolor
  6786. Set the color to be used for drawing border around text. For the syntax of this
  6787. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6788. The default value of @var{bordercolor} is "black".
  6789. @item expansion
  6790. Select how the @var{text} is expanded. Can be either @code{none},
  6791. @code{strftime} (deprecated) or
  6792. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6793. below for details.
  6794. @item basetime
  6795. Set a start time for the count. Value is in microseconds. Only applied
  6796. in the deprecated strftime expansion mode. To emulate in normal expansion
  6797. mode use the @code{pts} function, supplying the start time (in seconds)
  6798. as the second argument.
  6799. @item fix_bounds
  6800. If true, check and fix text coords to avoid clipping.
  6801. @item fontcolor
  6802. The color to be used for drawing fonts. For the syntax of this option, check
  6803. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6804. The default value of @var{fontcolor} is "black".
  6805. @item fontcolor_expr
  6806. String which is expanded the same way as @var{text} to obtain dynamic
  6807. @var{fontcolor} value. By default this option has empty value and is not
  6808. processed. When this option is set, it overrides @var{fontcolor} option.
  6809. @item font
  6810. The font family to be used for drawing text. By default Sans.
  6811. @item fontfile
  6812. The font file to be used for drawing text. The path must be included.
  6813. This parameter is mandatory if the fontconfig support is disabled.
  6814. @item alpha
  6815. Draw the text applying alpha blending. The value can
  6816. be a number between 0.0 and 1.0.
  6817. The expression accepts the same variables @var{x, y} as well.
  6818. The default value is 1.
  6819. Please see @var{fontcolor_expr}.
  6820. @item fontsize
  6821. The font size to be used for drawing text.
  6822. The default value of @var{fontsize} is 16.
  6823. @item text_shaping
  6824. If set to 1, attempt to shape the text (for example, reverse the order of
  6825. right-to-left text and join Arabic characters) before drawing it.
  6826. Otherwise, just draw the text exactly as given.
  6827. By default 1 (if supported).
  6828. @item ft_load_flags
  6829. The flags to be used for loading the fonts.
  6830. The flags map the corresponding flags supported by libfreetype, and are
  6831. a combination of the following values:
  6832. @table @var
  6833. @item default
  6834. @item no_scale
  6835. @item no_hinting
  6836. @item render
  6837. @item no_bitmap
  6838. @item vertical_layout
  6839. @item force_autohint
  6840. @item crop_bitmap
  6841. @item pedantic
  6842. @item ignore_global_advance_width
  6843. @item no_recurse
  6844. @item ignore_transform
  6845. @item monochrome
  6846. @item linear_design
  6847. @item no_autohint
  6848. @end table
  6849. Default value is "default".
  6850. For more information consult the documentation for the FT_LOAD_*
  6851. libfreetype flags.
  6852. @item shadowcolor
  6853. The color to be used for drawing a shadow behind the drawn text. For the
  6854. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6855. ffmpeg-utils manual,ffmpeg-utils}.
  6856. The default value of @var{shadowcolor} is "black".
  6857. @item shadowx
  6858. @item shadowy
  6859. The x and y offsets for the text shadow position with respect to the
  6860. position of the text. They can be either positive or negative
  6861. values. The default value for both is "0".
  6862. @item start_number
  6863. The starting frame number for the n/frame_num variable. The default value
  6864. is "0".
  6865. @item tabsize
  6866. The size in number of spaces to use for rendering the tab.
  6867. Default value is 4.
  6868. @item timecode
  6869. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6870. format. It can be used with or without text parameter. @var{timecode_rate}
  6871. option must be specified.
  6872. @item timecode_rate, rate, r
  6873. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6874. integer. Minimum value is "1".
  6875. Drop-frame timecode is supported for frame rates 30 & 60.
  6876. @item tc24hmax
  6877. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6878. Default is 0 (disabled).
  6879. @item text
  6880. The text string to be drawn. The text must be a sequence of UTF-8
  6881. encoded characters.
  6882. This parameter is mandatory if no file is specified with the parameter
  6883. @var{textfile}.
  6884. @item textfile
  6885. A text file containing text to be drawn. The text must be a sequence
  6886. of UTF-8 encoded characters.
  6887. This parameter is mandatory if no text string is specified with the
  6888. parameter @var{text}.
  6889. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6890. @item reload
  6891. If set to 1, the @var{textfile} will be reloaded before each frame.
  6892. Be sure to update it atomically, or it may be read partially, or even fail.
  6893. @item x
  6894. @item y
  6895. The expressions which specify the offsets where text will be drawn
  6896. within the video frame. They are relative to the top/left border of the
  6897. output image.
  6898. The default value of @var{x} and @var{y} is "0".
  6899. See below for the list of accepted constants and functions.
  6900. @end table
  6901. The parameters for @var{x} and @var{y} are expressions containing the
  6902. following constants and functions:
  6903. @table @option
  6904. @item dar
  6905. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6906. @item hsub
  6907. @item vsub
  6908. horizontal and vertical chroma subsample values. For example for the
  6909. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6910. @item line_h, lh
  6911. the height of each text line
  6912. @item main_h, h, H
  6913. the input height
  6914. @item main_w, w, W
  6915. the input width
  6916. @item max_glyph_a, ascent
  6917. the maximum distance from the baseline to the highest/upper grid
  6918. coordinate used to place a glyph outline point, for all the rendered
  6919. glyphs.
  6920. It is a positive value, due to the grid's orientation with the Y axis
  6921. upwards.
  6922. @item max_glyph_d, descent
  6923. the maximum distance from the baseline to the lowest grid coordinate
  6924. used to place a glyph outline point, for all the rendered glyphs.
  6925. This is a negative value, due to the grid's orientation, with the Y axis
  6926. upwards.
  6927. @item max_glyph_h
  6928. maximum glyph height, that is the maximum height for all the glyphs
  6929. contained in the rendered text, it is equivalent to @var{ascent} -
  6930. @var{descent}.
  6931. @item max_glyph_w
  6932. maximum glyph width, that is the maximum width for all the glyphs
  6933. contained in the rendered text
  6934. @item n
  6935. the number of input frame, starting from 0
  6936. @item rand(min, max)
  6937. return a random number included between @var{min} and @var{max}
  6938. @item sar
  6939. The input sample aspect ratio.
  6940. @item t
  6941. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6942. @item text_h, th
  6943. the height of the rendered text
  6944. @item text_w, tw
  6945. the width of the rendered text
  6946. @item x
  6947. @item y
  6948. the x and y offset coordinates where the text is drawn.
  6949. These parameters allow the @var{x} and @var{y} expressions to refer
  6950. to each other, so you can for example specify @code{y=x/dar}.
  6951. @item pict_type
  6952. A one character description of the current frame's picture type.
  6953. @item pkt_pos
  6954. The current packet's position in the input file or stream
  6955. (in bytes, from the start of the input). A value of -1 indicates
  6956. this info is not available.
  6957. @item pkt_duration
  6958. The current packet's duration, in seconds.
  6959. @item pkt_size
  6960. The current packet's size (in bytes).
  6961. @end table
  6962. @anchor{drawtext_expansion}
  6963. @subsection Text expansion
  6964. If @option{expansion} is set to @code{strftime},
  6965. the filter recognizes strftime() sequences in the provided text and
  6966. expands them accordingly. Check the documentation of strftime(). This
  6967. feature is deprecated.
  6968. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6969. If @option{expansion} is set to @code{normal} (which is the default),
  6970. the following expansion mechanism is used.
  6971. The backslash character @samp{\}, followed by any character, always expands to
  6972. the second character.
  6973. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6974. braces is a function name, possibly followed by arguments separated by ':'.
  6975. If the arguments contain special characters or delimiters (':' or '@}'),
  6976. they should be escaped.
  6977. Note that they probably must also be escaped as the value for the
  6978. @option{text} option in the filter argument string and as the filter
  6979. argument in the filtergraph description, and possibly also for the shell,
  6980. that makes up to four levels of escaping; using a text file avoids these
  6981. problems.
  6982. The following functions are available:
  6983. @table @command
  6984. @item expr, e
  6985. The expression evaluation result.
  6986. It must take one argument specifying the expression to be evaluated,
  6987. which accepts the same constants and functions as the @var{x} and
  6988. @var{y} values. Note that not all constants should be used, for
  6989. example the text size is not known when evaluating the expression, so
  6990. the constants @var{text_w} and @var{text_h} will have an undefined
  6991. value.
  6992. @item expr_int_format, eif
  6993. Evaluate the expression's value and output as formatted integer.
  6994. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6995. The second argument specifies the output format. Allowed values are @samp{x},
  6996. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6997. @code{printf} function.
  6998. The third parameter is optional and sets the number of positions taken by the output.
  6999. It can be used to add padding with zeros from the left.
  7000. @item gmtime
  7001. The time at which the filter is running, expressed in UTC.
  7002. It can accept an argument: a strftime() format string.
  7003. @item localtime
  7004. The time at which the filter is running, expressed in the local time zone.
  7005. It can accept an argument: a strftime() format string.
  7006. @item metadata
  7007. Frame metadata. Takes one or two arguments.
  7008. The first argument is mandatory and specifies the metadata key.
  7009. The second argument is optional and specifies a default value, used when the
  7010. metadata key is not found or empty.
  7011. Available metadata can be identified by inspecting entries
  7012. starting with TAG included within each frame section
  7013. printed by running @code{ffprobe -show_frames}.
  7014. String metadata generated in filters leading to
  7015. the drawtext filter are also available.
  7016. @item n, frame_num
  7017. The frame number, starting from 0.
  7018. @item pict_type
  7019. A one character description of the current picture type.
  7020. @item pts
  7021. The timestamp of the current frame.
  7022. It can take up to three arguments.
  7023. The first argument is the format of the timestamp; it defaults to @code{flt}
  7024. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7025. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7026. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7027. @code{localtime} stands for the timestamp of the frame formatted as
  7028. local time zone time.
  7029. The second argument is an offset added to the timestamp.
  7030. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7031. supplied to present the hour part of the formatted timestamp in 24h format
  7032. (00-23).
  7033. If the format is set to @code{localtime} or @code{gmtime},
  7034. a third argument may be supplied: a strftime() format string.
  7035. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7036. @end table
  7037. @subsection Commands
  7038. This filter supports altering parameters via commands:
  7039. @table @option
  7040. @item reinit
  7041. Alter existing filter parameters.
  7042. Syntax for the argument is the same as for filter invocation, e.g.
  7043. @example
  7044. fontsize=56:fontcolor=green:text='Hello World'
  7045. @end example
  7046. Full filter invocation with sendcmd would look like this:
  7047. @example
  7048. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7049. @end example
  7050. @end table
  7051. If the entire argument can't be parsed or applied as valid values then the filter will
  7052. continue with its existing parameters.
  7053. @subsection Examples
  7054. @itemize
  7055. @item
  7056. Draw "Test Text" with font FreeSerif, using the default values for the
  7057. optional parameters.
  7058. @example
  7059. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7060. @end example
  7061. @item
  7062. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7063. and y=50 (counting from the top-left corner of the screen), text is
  7064. yellow with a red box around it. Both the text and the box have an
  7065. opacity of 20%.
  7066. @example
  7067. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7068. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7069. @end example
  7070. Note that the double quotes are not necessary if spaces are not used
  7071. within the parameter list.
  7072. @item
  7073. Show the text at the center of the video frame:
  7074. @example
  7075. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7076. @end example
  7077. @item
  7078. Show the text at a random position, switching to a new position every 30 seconds:
  7079. @example
  7080. 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)"
  7081. @end example
  7082. @item
  7083. Show a text line sliding from right to left in the last row of the video
  7084. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7085. with no newlines.
  7086. @example
  7087. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7088. @end example
  7089. @item
  7090. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7091. @example
  7092. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7093. @end example
  7094. @item
  7095. Draw a single green letter "g", at the center of the input video.
  7096. The glyph baseline is placed at half screen height.
  7097. @example
  7098. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7099. @end example
  7100. @item
  7101. Show text for 1 second every 3 seconds:
  7102. @example
  7103. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7104. @end example
  7105. @item
  7106. Use fontconfig to set the font. Note that the colons need to be escaped.
  7107. @example
  7108. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7109. @end example
  7110. @item
  7111. Print the date of a real-time encoding (see strftime(3)):
  7112. @example
  7113. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7114. @end example
  7115. @item
  7116. Show text fading in and out (appearing/disappearing):
  7117. @example
  7118. #!/bin/sh
  7119. DS=1.0 # display start
  7120. DE=10.0 # display end
  7121. FID=1.5 # fade in duration
  7122. FOD=5 # fade out duration
  7123. 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 @}"
  7124. @end example
  7125. @item
  7126. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7127. and the @option{fontsize} value are included in the @option{y} offset.
  7128. @example
  7129. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7130. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7131. @end example
  7132. @end itemize
  7133. For more information about libfreetype, check:
  7134. @url{http://www.freetype.org/}.
  7135. For more information about fontconfig, check:
  7136. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7137. For more information about libfribidi, check:
  7138. @url{http://fribidi.org/}.
  7139. @section edgedetect
  7140. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7141. The filter accepts the following options:
  7142. @table @option
  7143. @item low
  7144. @item high
  7145. Set low and high threshold values used by the Canny thresholding
  7146. algorithm.
  7147. The high threshold selects the "strong" edge pixels, which are then
  7148. connected through 8-connectivity with the "weak" edge pixels selected
  7149. by the low threshold.
  7150. @var{low} and @var{high} threshold values must be chosen in the range
  7151. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7152. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7153. is @code{50/255}.
  7154. @item mode
  7155. Define the drawing mode.
  7156. @table @samp
  7157. @item wires
  7158. Draw white/gray wires on black background.
  7159. @item colormix
  7160. Mix the colors to create a paint/cartoon effect.
  7161. @item canny
  7162. Apply Canny edge detector on all selected planes.
  7163. @end table
  7164. Default value is @var{wires}.
  7165. @item planes
  7166. Select planes for filtering. By default all available planes are filtered.
  7167. @end table
  7168. @subsection Examples
  7169. @itemize
  7170. @item
  7171. Standard edge detection with custom values for the hysteresis thresholding:
  7172. @example
  7173. edgedetect=low=0.1:high=0.4
  7174. @end example
  7175. @item
  7176. Painting effect without thresholding:
  7177. @example
  7178. edgedetect=mode=colormix:high=0
  7179. @end example
  7180. @end itemize
  7181. @section eq
  7182. Set brightness, contrast, saturation and approximate gamma adjustment.
  7183. The filter accepts the following options:
  7184. @table @option
  7185. @item contrast
  7186. Set the contrast expression. The value must be a float value in range
  7187. @code{-2.0} to @code{2.0}. The default value is "1".
  7188. @item brightness
  7189. Set the brightness expression. The value must be a float value in
  7190. range @code{-1.0} to @code{1.0}. The default value is "0".
  7191. @item saturation
  7192. Set the saturation expression. The value must be a float in
  7193. range @code{0.0} to @code{3.0}. The default value is "1".
  7194. @item gamma
  7195. Set the gamma expression. The value must be a float in range
  7196. @code{0.1} to @code{10.0}. The default value is "1".
  7197. @item gamma_r
  7198. Set the gamma expression for red. The value must be a float in
  7199. range @code{0.1} to @code{10.0}. The default value is "1".
  7200. @item gamma_g
  7201. Set the gamma expression for green. The value must be a float in range
  7202. @code{0.1} to @code{10.0}. The default value is "1".
  7203. @item gamma_b
  7204. Set the gamma expression for blue. The value must be a float in range
  7205. @code{0.1} to @code{10.0}. The default value is "1".
  7206. @item gamma_weight
  7207. Set the gamma weight expression. It can be used to reduce the effect
  7208. of a high gamma value on bright image areas, e.g. keep them from
  7209. getting overamplified and just plain white. The value must be a float
  7210. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7211. gamma correction all the way down while @code{1.0} leaves it at its
  7212. full strength. Default is "1".
  7213. @item eval
  7214. Set when the expressions for brightness, contrast, saturation and
  7215. gamma expressions are evaluated.
  7216. It accepts the following values:
  7217. @table @samp
  7218. @item init
  7219. only evaluate expressions once during the filter initialization or
  7220. when a command is processed
  7221. @item frame
  7222. evaluate expressions for each incoming frame
  7223. @end table
  7224. Default value is @samp{init}.
  7225. @end table
  7226. The expressions accept the following parameters:
  7227. @table @option
  7228. @item n
  7229. frame count of the input frame starting from 0
  7230. @item pos
  7231. byte position of the corresponding packet in the input file, NAN if
  7232. unspecified
  7233. @item r
  7234. frame rate of the input video, NAN if the input frame rate is unknown
  7235. @item t
  7236. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7237. @end table
  7238. @subsection Commands
  7239. The filter supports the following commands:
  7240. @table @option
  7241. @item contrast
  7242. Set the contrast expression.
  7243. @item brightness
  7244. Set the brightness expression.
  7245. @item saturation
  7246. Set the saturation expression.
  7247. @item gamma
  7248. Set the gamma expression.
  7249. @item gamma_r
  7250. Set the gamma_r expression.
  7251. @item gamma_g
  7252. Set gamma_g expression.
  7253. @item gamma_b
  7254. Set gamma_b expression.
  7255. @item gamma_weight
  7256. Set gamma_weight expression.
  7257. The command accepts the same syntax of the corresponding option.
  7258. If the specified expression is not valid, it is kept at its current
  7259. value.
  7260. @end table
  7261. @section erosion
  7262. Apply erosion effect to the video.
  7263. This filter replaces the pixel by the local(3x3) minimum.
  7264. It accepts the following options:
  7265. @table @option
  7266. @item threshold0
  7267. @item threshold1
  7268. @item threshold2
  7269. @item threshold3
  7270. Limit the maximum change for each plane, default is 65535.
  7271. If 0, plane will remain unchanged.
  7272. @item coordinates
  7273. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7274. pixels are used.
  7275. Flags to local 3x3 coordinates maps like this:
  7276. 1 2 3
  7277. 4 5
  7278. 6 7 8
  7279. @end table
  7280. @section extractplanes
  7281. Extract color channel components from input video stream into
  7282. separate grayscale video streams.
  7283. The filter accepts the following option:
  7284. @table @option
  7285. @item planes
  7286. Set plane(s) to extract.
  7287. Available values for planes are:
  7288. @table @samp
  7289. @item y
  7290. @item u
  7291. @item v
  7292. @item a
  7293. @item r
  7294. @item g
  7295. @item b
  7296. @end table
  7297. Choosing planes not available in the input will result in an error.
  7298. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7299. with @code{y}, @code{u}, @code{v} planes at same time.
  7300. @end table
  7301. @subsection Examples
  7302. @itemize
  7303. @item
  7304. Extract luma, u and v color channel component from input video frame
  7305. into 3 grayscale outputs:
  7306. @example
  7307. 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
  7308. @end example
  7309. @end itemize
  7310. @section elbg
  7311. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7312. For each input image, the filter will compute the optimal mapping from
  7313. the input to the output given the codebook length, that is the number
  7314. of distinct output colors.
  7315. This filter accepts the following options.
  7316. @table @option
  7317. @item codebook_length, l
  7318. Set codebook length. The value must be a positive integer, and
  7319. represents the number of distinct output colors. Default value is 256.
  7320. @item nb_steps, n
  7321. Set the maximum number of iterations to apply for computing the optimal
  7322. mapping. The higher the value the better the result and the higher the
  7323. computation time. Default value is 1.
  7324. @item seed, s
  7325. Set a random seed, must be an integer included between 0 and
  7326. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7327. will try to use a good random seed on a best effort basis.
  7328. @item pal8
  7329. Set pal8 output pixel format. This option does not work with codebook
  7330. length greater than 256.
  7331. @end table
  7332. @section entropy
  7333. Measure graylevel entropy in histogram of color channels of video frames.
  7334. It accepts the following parameters:
  7335. @table @option
  7336. @item mode
  7337. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7338. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7339. between neighbour histogram values.
  7340. @end table
  7341. @section fade
  7342. Apply a fade-in/out effect to the input video.
  7343. It accepts the following parameters:
  7344. @table @option
  7345. @item type, t
  7346. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7347. effect.
  7348. Default is @code{in}.
  7349. @item start_frame, s
  7350. Specify the number of the frame to start applying the fade
  7351. effect at. Default is 0.
  7352. @item nb_frames, n
  7353. The number of frames that the fade effect lasts. At the end of the
  7354. fade-in effect, the output video will have the same intensity as the input video.
  7355. At the end of the fade-out transition, the output video will be filled with the
  7356. selected @option{color}.
  7357. Default is 25.
  7358. @item alpha
  7359. If set to 1, fade only alpha channel, if one exists on the input.
  7360. Default value is 0.
  7361. @item start_time, st
  7362. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7363. effect. If both start_frame and start_time are specified, the fade will start at
  7364. whichever comes last. Default is 0.
  7365. @item duration, d
  7366. The number of seconds for which the fade effect has to last. At the end of the
  7367. fade-in effect the output video will have the same intensity as the input video,
  7368. at the end of the fade-out transition the output video will be filled with the
  7369. selected @option{color}.
  7370. If both duration and nb_frames are specified, duration is used. Default is 0
  7371. (nb_frames is used by default).
  7372. @item color, c
  7373. Specify the color of the fade. Default is "black".
  7374. @end table
  7375. @subsection Examples
  7376. @itemize
  7377. @item
  7378. Fade in the first 30 frames of video:
  7379. @example
  7380. fade=in:0:30
  7381. @end example
  7382. The command above is equivalent to:
  7383. @example
  7384. fade=t=in:s=0:n=30
  7385. @end example
  7386. @item
  7387. Fade out the last 45 frames of a 200-frame video:
  7388. @example
  7389. fade=out:155:45
  7390. fade=type=out:start_frame=155:nb_frames=45
  7391. @end example
  7392. @item
  7393. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7394. @example
  7395. fade=in:0:25, fade=out:975:25
  7396. @end example
  7397. @item
  7398. Make the first 5 frames yellow, then fade in from frame 5-24:
  7399. @example
  7400. fade=in:5:20:color=yellow
  7401. @end example
  7402. @item
  7403. Fade in alpha over first 25 frames of video:
  7404. @example
  7405. fade=in:0:25:alpha=1
  7406. @end example
  7407. @item
  7408. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7409. @example
  7410. fade=t=in:st=5.5:d=0.5
  7411. @end example
  7412. @end itemize
  7413. @section fftfilt
  7414. Apply arbitrary expressions to samples in frequency domain
  7415. @table @option
  7416. @item dc_Y
  7417. Adjust the dc value (gain) of the luma plane of the image. The filter
  7418. accepts an integer value in range @code{0} to @code{1000}. The default
  7419. value is set to @code{0}.
  7420. @item dc_U
  7421. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7422. filter accepts an integer value in range @code{0} to @code{1000}. The
  7423. default value is set to @code{0}.
  7424. @item dc_V
  7425. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7426. filter accepts an integer value in range @code{0} to @code{1000}. The
  7427. default value is set to @code{0}.
  7428. @item weight_Y
  7429. Set the frequency domain weight expression for the luma plane.
  7430. @item weight_U
  7431. Set the frequency domain weight expression for the 1st chroma plane.
  7432. @item weight_V
  7433. Set the frequency domain weight expression for the 2nd chroma plane.
  7434. @item eval
  7435. Set when the expressions are evaluated.
  7436. It accepts the following values:
  7437. @table @samp
  7438. @item init
  7439. Only evaluate expressions once during the filter initialization.
  7440. @item frame
  7441. Evaluate expressions for each incoming frame.
  7442. @end table
  7443. Default value is @samp{init}.
  7444. The filter accepts the following variables:
  7445. @item X
  7446. @item Y
  7447. The coordinates of the current sample.
  7448. @item W
  7449. @item H
  7450. The width and height of the image.
  7451. @item N
  7452. The number of input frame, starting from 0.
  7453. @end table
  7454. @subsection Examples
  7455. @itemize
  7456. @item
  7457. High-pass:
  7458. @example
  7459. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7460. @end example
  7461. @item
  7462. Low-pass:
  7463. @example
  7464. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7465. @end example
  7466. @item
  7467. Sharpen:
  7468. @example
  7469. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7470. @end example
  7471. @item
  7472. Blur:
  7473. @example
  7474. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7475. @end example
  7476. @end itemize
  7477. @section fftdnoiz
  7478. Denoise frames using 3D FFT (frequency domain filtering).
  7479. The filter accepts the following options:
  7480. @table @option
  7481. @item sigma
  7482. Set the noise sigma constant. This sets denoising strength.
  7483. Default value is 1. Allowed range is from 0 to 30.
  7484. Using very high sigma with low overlap may give blocking artifacts.
  7485. @item amount
  7486. Set amount of denoising. By default all detected noise is reduced.
  7487. Default value is 1. Allowed range is from 0 to 1.
  7488. @item block
  7489. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7490. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7491. block size in pixels is 2^4 which is 16.
  7492. @item overlap
  7493. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7494. @item prev
  7495. Set number of previous frames to use for denoising. By default is set to 0.
  7496. @item next
  7497. Set number of next frames to to use for denoising. By default is set to 0.
  7498. @item planes
  7499. Set planes which will be filtered, by default are all available filtered
  7500. except alpha.
  7501. @end table
  7502. @section field
  7503. Extract a single field from an interlaced image using stride
  7504. arithmetic to avoid wasting CPU time. The output frames are marked as
  7505. non-interlaced.
  7506. The filter accepts the following options:
  7507. @table @option
  7508. @item type
  7509. Specify whether to extract the top (if the value is @code{0} or
  7510. @code{top}) or the bottom field (if the value is @code{1} or
  7511. @code{bottom}).
  7512. @end table
  7513. @section fieldhint
  7514. Create new frames by copying the top and bottom fields from surrounding frames
  7515. supplied as numbers by the hint file.
  7516. @table @option
  7517. @item hint
  7518. Set file containing hints: absolute/relative frame numbers.
  7519. There must be one line for each frame in a clip. Each line must contain two
  7520. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7521. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7522. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7523. for @code{relative} mode. First number tells from which frame to pick up top
  7524. field and second number tells from which frame to pick up bottom field.
  7525. If optionally followed by @code{+} output frame will be marked as interlaced,
  7526. else if followed by @code{-} output frame will be marked as progressive, else
  7527. it will be marked same as input frame.
  7528. If line starts with @code{#} or @code{;} that line is skipped.
  7529. @item mode
  7530. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7531. @end table
  7532. Example of first several lines of @code{hint} file for @code{relative} mode:
  7533. @example
  7534. 0,0 - # first frame
  7535. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7536. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7537. 1,0 -
  7538. 0,0 -
  7539. 0,0 -
  7540. 1,0 -
  7541. 1,0 -
  7542. 1,0 -
  7543. 0,0 -
  7544. 0,0 -
  7545. 1,0 -
  7546. 1,0 -
  7547. 1,0 -
  7548. 0,0 -
  7549. @end example
  7550. @section fieldmatch
  7551. Field matching filter for inverse telecine. It is meant to reconstruct the
  7552. progressive frames from a telecined stream. The filter does not drop duplicated
  7553. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7554. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7555. The separation of the field matching and the decimation is notably motivated by
  7556. the possibility of inserting a de-interlacing filter fallback between the two.
  7557. If the source has mixed telecined and real interlaced content,
  7558. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7559. But these remaining combed frames will be marked as interlaced, and thus can be
  7560. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7561. In addition to the various configuration options, @code{fieldmatch} can take an
  7562. optional second stream, activated through the @option{ppsrc} option. If
  7563. enabled, the frames reconstruction will be based on the fields and frames from
  7564. this second stream. This allows the first input to be pre-processed in order to
  7565. help the various algorithms of the filter, while keeping the output lossless
  7566. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7567. or brightness/contrast adjustments can help.
  7568. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7569. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7570. which @code{fieldmatch} is based on. While the semantic and usage are very
  7571. close, some behaviour and options names can differ.
  7572. The @ref{decimate} filter currently only works for constant frame rate input.
  7573. If your input has mixed telecined (30fps) and progressive content with a lower
  7574. framerate like 24fps use the following filterchain to produce the necessary cfr
  7575. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7576. The filter accepts the following options:
  7577. @table @option
  7578. @item order
  7579. Specify the assumed field order of the input stream. Available values are:
  7580. @table @samp
  7581. @item auto
  7582. Auto detect parity (use FFmpeg's internal parity value).
  7583. @item bff
  7584. Assume bottom field first.
  7585. @item tff
  7586. Assume top field first.
  7587. @end table
  7588. Note that it is sometimes recommended not to trust the parity announced by the
  7589. stream.
  7590. Default value is @var{auto}.
  7591. @item mode
  7592. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7593. sense that it won't risk creating jerkiness due to duplicate frames when
  7594. possible, but if there are bad edits or blended fields it will end up
  7595. outputting combed frames when a good match might actually exist. On the other
  7596. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7597. but will almost always find a good frame if there is one. The other values are
  7598. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7599. jerkiness and creating duplicate frames versus finding good matches in sections
  7600. with bad edits, orphaned fields, blended fields, etc.
  7601. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7602. Available values are:
  7603. @table @samp
  7604. @item pc
  7605. 2-way matching (p/c)
  7606. @item pc_n
  7607. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7608. @item pc_u
  7609. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7610. @item pc_n_ub
  7611. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7612. still combed (p/c + n + u/b)
  7613. @item pcn
  7614. 3-way matching (p/c/n)
  7615. @item pcn_ub
  7616. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7617. detected as combed (p/c/n + u/b)
  7618. @end table
  7619. The parenthesis at the end indicate the matches that would be used for that
  7620. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7621. @var{top}).
  7622. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7623. the slowest.
  7624. Default value is @var{pc_n}.
  7625. @item ppsrc
  7626. Mark the main input stream as a pre-processed input, and enable the secondary
  7627. input stream as the clean source to pick the fields from. See the filter
  7628. introduction for more details. It is similar to the @option{clip2} feature from
  7629. VFM/TFM.
  7630. Default value is @code{0} (disabled).
  7631. @item field
  7632. Set the field to match from. It is recommended to set this to the same value as
  7633. @option{order} unless you experience matching failures with that setting. In
  7634. certain circumstances changing the field that is used to match from can have a
  7635. large impact on matching performance. Available values are:
  7636. @table @samp
  7637. @item auto
  7638. Automatic (same value as @option{order}).
  7639. @item bottom
  7640. Match from the bottom field.
  7641. @item top
  7642. Match from the top field.
  7643. @end table
  7644. Default value is @var{auto}.
  7645. @item mchroma
  7646. Set whether or not chroma is included during the match comparisons. In most
  7647. cases it is recommended to leave this enabled. You should set this to @code{0}
  7648. only if your clip has bad chroma problems such as heavy rainbowing or other
  7649. artifacts. Setting this to @code{0} could also be used to speed things up at
  7650. the cost of some accuracy.
  7651. Default value is @code{1}.
  7652. @item y0
  7653. @item y1
  7654. These define an exclusion band which excludes the lines between @option{y0} and
  7655. @option{y1} from being included in the field matching decision. An exclusion
  7656. band can be used to ignore subtitles, a logo, or other things that may
  7657. interfere with the matching. @option{y0} sets the starting scan line and
  7658. @option{y1} sets the ending line; all lines in between @option{y0} and
  7659. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7660. @option{y0} and @option{y1} to the same value will disable the feature.
  7661. @option{y0} and @option{y1} defaults to @code{0}.
  7662. @item scthresh
  7663. Set the scene change detection threshold as a percentage of maximum change on
  7664. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7665. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7666. @option{scthresh} is @code{[0.0, 100.0]}.
  7667. Default value is @code{12.0}.
  7668. @item combmatch
  7669. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7670. account the combed scores of matches when deciding what match to use as the
  7671. final match. Available values are:
  7672. @table @samp
  7673. @item none
  7674. No final matching based on combed scores.
  7675. @item sc
  7676. Combed scores are only used when a scene change is detected.
  7677. @item full
  7678. Use combed scores all the time.
  7679. @end table
  7680. Default is @var{sc}.
  7681. @item combdbg
  7682. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7683. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7684. Available values are:
  7685. @table @samp
  7686. @item none
  7687. No forced calculation.
  7688. @item pcn
  7689. Force p/c/n calculations.
  7690. @item pcnub
  7691. Force p/c/n/u/b calculations.
  7692. @end table
  7693. Default value is @var{none}.
  7694. @item cthresh
  7695. This is the area combing threshold used for combed frame detection. This
  7696. essentially controls how "strong" or "visible" combing must be to be detected.
  7697. Larger values mean combing must be more visible and smaller values mean combing
  7698. can be less visible or strong and still be detected. Valid settings are from
  7699. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7700. be detected as combed). This is basically a pixel difference value. A good
  7701. range is @code{[8, 12]}.
  7702. Default value is @code{9}.
  7703. @item chroma
  7704. Sets whether or not chroma is considered in the combed frame decision. Only
  7705. disable this if your source has chroma problems (rainbowing, etc.) that are
  7706. causing problems for the combed frame detection with chroma enabled. Actually,
  7707. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7708. where there is chroma only combing in the source.
  7709. Default value is @code{0}.
  7710. @item blockx
  7711. @item blocky
  7712. Respectively set the x-axis and y-axis size of the window used during combed
  7713. frame detection. This has to do with the size of the area in which
  7714. @option{combpel} pixels are required to be detected as combed for a frame to be
  7715. declared combed. See the @option{combpel} parameter description for more info.
  7716. Possible values are any number that is a power of 2 starting at 4 and going up
  7717. to 512.
  7718. Default value is @code{16}.
  7719. @item combpel
  7720. The number of combed pixels inside any of the @option{blocky} by
  7721. @option{blockx} size blocks on the frame for the frame to be detected as
  7722. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7723. setting controls "how much" combing there must be in any localized area (a
  7724. window defined by the @option{blockx} and @option{blocky} settings) on the
  7725. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7726. which point no frames will ever be detected as combed). This setting is known
  7727. as @option{MI} in TFM/VFM vocabulary.
  7728. Default value is @code{80}.
  7729. @end table
  7730. @anchor{p/c/n/u/b meaning}
  7731. @subsection p/c/n/u/b meaning
  7732. @subsubsection p/c/n
  7733. We assume the following telecined stream:
  7734. @example
  7735. Top fields: 1 2 2 3 4
  7736. Bottom fields: 1 2 3 4 4
  7737. @end example
  7738. The numbers correspond to the progressive frame the fields relate to. Here, the
  7739. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7740. When @code{fieldmatch} is configured to run a matching from bottom
  7741. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7742. @example
  7743. Input stream:
  7744. T 1 2 2 3 4
  7745. B 1 2 3 4 4 <-- matching reference
  7746. Matches: c c n n c
  7747. Output stream:
  7748. T 1 2 3 4 4
  7749. B 1 2 3 4 4
  7750. @end example
  7751. As a result of the field matching, we can see that some frames get duplicated.
  7752. To perform a complete inverse telecine, you need to rely on a decimation filter
  7753. after this operation. See for instance the @ref{decimate} filter.
  7754. The same operation now matching from top fields (@option{field}=@var{top})
  7755. looks like this:
  7756. @example
  7757. Input stream:
  7758. T 1 2 2 3 4 <-- matching reference
  7759. B 1 2 3 4 4
  7760. Matches: c c p p c
  7761. Output stream:
  7762. T 1 2 2 3 4
  7763. B 1 2 2 3 4
  7764. @end example
  7765. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7766. basically, they refer to the frame and field of the opposite parity:
  7767. @itemize
  7768. @item @var{p} matches the field of the opposite parity in the previous frame
  7769. @item @var{c} matches the field of the opposite parity in the current frame
  7770. @item @var{n} matches the field of the opposite parity in the next frame
  7771. @end itemize
  7772. @subsubsection u/b
  7773. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7774. from the opposite parity flag. In the following examples, we assume that we are
  7775. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7776. 'x' is placed above and below each matched fields.
  7777. With bottom matching (@option{field}=@var{bottom}):
  7778. @example
  7779. Match: c p n b u
  7780. x x x x x
  7781. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7782. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7783. x x x x x
  7784. Output frames:
  7785. 2 1 2 2 2
  7786. 2 2 2 1 3
  7787. @end example
  7788. With top matching (@option{field}=@var{top}):
  7789. @example
  7790. Match: c p n b u
  7791. x x x x x
  7792. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7793. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7794. x x x x x
  7795. Output frames:
  7796. 2 2 2 1 2
  7797. 2 1 3 2 2
  7798. @end example
  7799. @subsection Examples
  7800. Simple IVTC of a top field first telecined stream:
  7801. @example
  7802. fieldmatch=order=tff:combmatch=none, decimate
  7803. @end example
  7804. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7805. @example
  7806. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7807. @end example
  7808. @section fieldorder
  7809. Transform the field order of the input video.
  7810. It accepts the following parameters:
  7811. @table @option
  7812. @item order
  7813. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7814. for bottom field first.
  7815. @end table
  7816. The default value is @samp{tff}.
  7817. The transformation is done by shifting the picture content up or down
  7818. by one line, and filling the remaining line with appropriate picture content.
  7819. This method is consistent with most broadcast field order converters.
  7820. If the input video is not flagged as being interlaced, or it is already
  7821. flagged as being of the required output field order, then this filter does
  7822. not alter the incoming video.
  7823. It is very useful when converting to or from PAL DV material,
  7824. which is bottom field first.
  7825. For example:
  7826. @example
  7827. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7828. @end example
  7829. @section fifo, afifo
  7830. Buffer input images and send them when they are requested.
  7831. It is mainly useful when auto-inserted by the libavfilter
  7832. framework.
  7833. It does not take parameters.
  7834. @section fillborders
  7835. Fill borders of the input video, without changing video stream dimensions.
  7836. Sometimes video can have garbage at the four edges and you may not want to
  7837. crop video input to keep size multiple of some number.
  7838. This filter accepts the following options:
  7839. @table @option
  7840. @item left
  7841. Number of pixels to fill from left border.
  7842. @item right
  7843. Number of pixels to fill from right border.
  7844. @item top
  7845. Number of pixels to fill from top border.
  7846. @item bottom
  7847. Number of pixels to fill from bottom border.
  7848. @item mode
  7849. Set fill mode.
  7850. It accepts the following values:
  7851. @table @samp
  7852. @item smear
  7853. fill pixels using outermost pixels
  7854. @item mirror
  7855. fill pixels using mirroring
  7856. @item fixed
  7857. fill pixels with constant value
  7858. @end table
  7859. Default is @var{smear}.
  7860. @item color
  7861. Set color for pixels in fixed mode. Default is @var{black}.
  7862. @end table
  7863. @section find_rect
  7864. Find a rectangular object
  7865. It accepts the following options:
  7866. @table @option
  7867. @item object
  7868. Filepath of the object image, needs to be in gray8.
  7869. @item threshold
  7870. Detection threshold, default is 0.5.
  7871. @item mipmaps
  7872. Number of mipmaps, default is 3.
  7873. @item xmin, ymin, xmax, ymax
  7874. Specifies the rectangle in which to search.
  7875. @end table
  7876. @subsection Examples
  7877. @itemize
  7878. @item
  7879. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7880. @example
  7881. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7882. @end example
  7883. @end itemize
  7884. @section cover_rect
  7885. Cover a rectangular object
  7886. It accepts the following options:
  7887. @table @option
  7888. @item cover
  7889. Filepath of the optional cover image, needs to be in yuv420.
  7890. @item mode
  7891. Set covering mode.
  7892. It accepts the following values:
  7893. @table @samp
  7894. @item cover
  7895. cover it by the supplied image
  7896. @item blur
  7897. cover it by interpolating the surrounding pixels
  7898. @end table
  7899. Default value is @var{blur}.
  7900. @end table
  7901. @subsection Examples
  7902. @itemize
  7903. @item
  7904. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7905. @example
  7906. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7907. @end example
  7908. @end itemize
  7909. @section floodfill
  7910. Flood area with values of same pixel components with another values.
  7911. It accepts the following options:
  7912. @table @option
  7913. @item x
  7914. Set pixel x coordinate.
  7915. @item y
  7916. Set pixel y coordinate.
  7917. @item s0
  7918. Set source #0 component value.
  7919. @item s1
  7920. Set source #1 component value.
  7921. @item s2
  7922. Set source #2 component value.
  7923. @item s3
  7924. Set source #3 component value.
  7925. @item d0
  7926. Set destination #0 component value.
  7927. @item d1
  7928. Set destination #1 component value.
  7929. @item d2
  7930. Set destination #2 component value.
  7931. @item d3
  7932. Set destination #3 component value.
  7933. @end table
  7934. @anchor{format}
  7935. @section format
  7936. Convert the input video to one of the specified pixel formats.
  7937. Libavfilter will try to pick one that is suitable as input to
  7938. the next filter.
  7939. It accepts the following parameters:
  7940. @table @option
  7941. @item pix_fmts
  7942. A '|'-separated list of pixel format names, such as
  7943. "pix_fmts=yuv420p|monow|rgb24".
  7944. @end table
  7945. @subsection Examples
  7946. @itemize
  7947. @item
  7948. Convert the input video to the @var{yuv420p} format
  7949. @example
  7950. format=pix_fmts=yuv420p
  7951. @end example
  7952. Convert the input video to any of the formats in the list
  7953. @example
  7954. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7955. @end example
  7956. @end itemize
  7957. @anchor{fps}
  7958. @section fps
  7959. Convert the video to specified constant frame rate by duplicating or dropping
  7960. frames as necessary.
  7961. It accepts the following parameters:
  7962. @table @option
  7963. @item fps
  7964. The desired output frame rate. The default is @code{25}.
  7965. @item start_time
  7966. Assume the first PTS should be the given value, in seconds. This allows for
  7967. padding/trimming at the start of stream. By default, no assumption is made
  7968. about the first frame's expected PTS, so no padding or trimming is done.
  7969. For example, this could be set to 0 to pad the beginning with duplicates of
  7970. the first frame if a video stream starts after the audio stream or to trim any
  7971. frames with a negative PTS.
  7972. @item round
  7973. Timestamp (PTS) rounding method.
  7974. Possible values are:
  7975. @table @option
  7976. @item zero
  7977. round towards 0
  7978. @item inf
  7979. round away from 0
  7980. @item down
  7981. round towards -infinity
  7982. @item up
  7983. round towards +infinity
  7984. @item near
  7985. round to nearest
  7986. @end table
  7987. The default is @code{near}.
  7988. @item eof_action
  7989. Action performed when reading the last frame.
  7990. Possible values are:
  7991. @table @option
  7992. @item round
  7993. Use same timestamp rounding method as used for other frames.
  7994. @item pass
  7995. Pass through last frame if input duration has not been reached yet.
  7996. @end table
  7997. The default is @code{round}.
  7998. @end table
  7999. Alternatively, the options can be specified as a flat string:
  8000. @var{fps}[:@var{start_time}[:@var{round}]].
  8001. See also the @ref{setpts} filter.
  8002. @subsection Examples
  8003. @itemize
  8004. @item
  8005. A typical usage in order to set the fps to 25:
  8006. @example
  8007. fps=fps=25
  8008. @end example
  8009. @item
  8010. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8011. @example
  8012. fps=fps=film:round=near
  8013. @end example
  8014. @end itemize
  8015. @section framepack
  8016. Pack two different video streams into a stereoscopic video, setting proper
  8017. metadata on supported codecs. The two views should have the same size and
  8018. framerate and processing will stop when the shorter video ends. Please note
  8019. that you may conveniently adjust view properties with the @ref{scale} and
  8020. @ref{fps} filters.
  8021. It accepts the following parameters:
  8022. @table @option
  8023. @item format
  8024. The desired packing format. Supported values are:
  8025. @table @option
  8026. @item sbs
  8027. The views are next to each other (default).
  8028. @item tab
  8029. The views are on top of each other.
  8030. @item lines
  8031. The views are packed by line.
  8032. @item columns
  8033. The views are packed by column.
  8034. @item frameseq
  8035. The views are temporally interleaved.
  8036. @end table
  8037. @end table
  8038. Some examples:
  8039. @example
  8040. # Convert left and right views into a frame-sequential video
  8041. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8042. # Convert views into a side-by-side video with the same output resolution as the input
  8043. 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
  8044. @end example
  8045. @section framerate
  8046. Change the frame rate by interpolating new video output frames from the source
  8047. frames.
  8048. This filter is not designed to function correctly with interlaced media. If
  8049. you wish to change the frame rate of interlaced media then you are required
  8050. to deinterlace before this filter and re-interlace after this filter.
  8051. A description of the accepted options follows.
  8052. @table @option
  8053. @item fps
  8054. Specify the output frames per second. This option can also be specified
  8055. as a value alone. The default is @code{50}.
  8056. @item interp_start
  8057. Specify the start of a range where the output frame will be created as a
  8058. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8059. the default is @code{15}.
  8060. @item interp_end
  8061. Specify the end of a range where the output frame will be created as a
  8062. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8063. the default is @code{240}.
  8064. @item scene
  8065. Specify the level at which a scene change is detected as a value between
  8066. 0 and 100 to indicate a new scene; a low value reflects a low
  8067. probability for the current frame to introduce a new scene, while a higher
  8068. value means the current frame is more likely to be one.
  8069. The default is @code{8.2}.
  8070. @item flags
  8071. Specify flags influencing the filter process.
  8072. Available value for @var{flags} is:
  8073. @table @option
  8074. @item scene_change_detect, scd
  8075. Enable scene change detection using the value of the option @var{scene}.
  8076. This flag is enabled by default.
  8077. @end table
  8078. @end table
  8079. @section framestep
  8080. Select one frame every N-th frame.
  8081. This filter accepts the following option:
  8082. @table @option
  8083. @item step
  8084. Select frame after every @code{step} frames.
  8085. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8086. @end table
  8087. @section freezedetect
  8088. Detect frozen video.
  8089. This filter logs a message and sets frame metadata when it detects that the
  8090. input video has no significant change in content during a specified duration.
  8091. Video freeze detection calculates the mean average absolute difference of all
  8092. the components of video frames and compares it to a noise floor.
  8093. The printed times and duration are expressed in seconds. The
  8094. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8095. whose timestamp equals or exceeds the detection duration and it contains the
  8096. timestamp of the first frame of the freeze. The
  8097. @code{lavfi.freezedetect.freeze_duration} and
  8098. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8099. after the freeze.
  8100. The filter accepts the following options:
  8101. @table @option
  8102. @item noise, n
  8103. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8104. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8105. 0.001.
  8106. @item duration, d
  8107. Set freeze duration until notification (default is 2 seconds).
  8108. @end table
  8109. @anchor{frei0r}
  8110. @section frei0r
  8111. Apply a frei0r effect to the input video.
  8112. To enable the compilation of this filter, you need to install the frei0r
  8113. header and configure FFmpeg with @code{--enable-frei0r}.
  8114. It accepts the following parameters:
  8115. @table @option
  8116. @item filter_name
  8117. The name of the frei0r effect to load. If the environment variable
  8118. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8119. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8120. Otherwise, the standard frei0r paths are searched, in this order:
  8121. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8122. @file{/usr/lib/frei0r-1/}.
  8123. @item filter_params
  8124. A '|'-separated list of parameters to pass to the frei0r effect.
  8125. @end table
  8126. A frei0r effect parameter can be a boolean (its value is either
  8127. "y" or "n"), a double, a color (specified as
  8128. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8129. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8130. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8131. a position (specified as @var{X}/@var{Y}, where
  8132. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8133. The number and types of parameters depend on the loaded effect. If an
  8134. effect parameter is not specified, the default value is set.
  8135. @subsection Examples
  8136. @itemize
  8137. @item
  8138. Apply the distort0r effect, setting the first two double parameters:
  8139. @example
  8140. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8141. @end example
  8142. @item
  8143. Apply the colordistance effect, taking a color as the first parameter:
  8144. @example
  8145. frei0r=colordistance:0.2/0.3/0.4
  8146. frei0r=colordistance:violet
  8147. frei0r=colordistance:0x112233
  8148. @end example
  8149. @item
  8150. Apply the perspective effect, specifying the top left and top right image
  8151. positions:
  8152. @example
  8153. frei0r=perspective:0.2/0.2|0.8/0.2
  8154. @end example
  8155. @end itemize
  8156. For more information, see
  8157. @url{http://frei0r.dyne.org}
  8158. @section fspp
  8159. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8160. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8161. processing filter, one of them is performed once per block, not per pixel.
  8162. This allows for much higher speed.
  8163. The filter accepts the following options:
  8164. @table @option
  8165. @item quality
  8166. Set quality. This option defines the number of levels for averaging. It accepts
  8167. an integer in the range 4-5. Default value is @code{4}.
  8168. @item qp
  8169. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8170. If not set, the filter will use the QP from the video stream (if available).
  8171. @item strength
  8172. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8173. more details but also more artifacts, while higher values make the image smoother
  8174. but also blurrier. Default value is @code{0} − PSNR optimal.
  8175. @item use_bframe_qp
  8176. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8177. option may cause flicker since the B-Frames have often larger QP. Default is
  8178. @code{0} (not enabled).
  8179. @end table
  8180. @section gblur
  8181. Apply Gaussian blur filter.
  8182. The filter accepts the following options:
  8183. @table @option
  8184. @item sigma
  8185. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8186. @item steps
  8187. Set number of steps for Gaussian approximation. Default is @code{1}.
  8188. @item planes
  8189. Set which planes to filter. By default all planes are filtered.
  8190. @item sigmaV
  8191. Set vertical sigma, if negative it will be same as @code{sigma}.
  8192. Default is @code{-1}.
  8193. @end table
  8194. @section geq
  8195. Apply generic equation to each pixel.
  8196. The filter accepts the following options:
  8197. @table @option
  8198. @item lum_expr, lum
  8199. Set the luminance expression.
  8200. @item cb_expr, cb
  8201. Set the chrominance blue expression.
  8202. @item cr_expr, cr
  8203. Set the chrominance red expression.
  8204. @item alpha_expr, a
  8205. Set the alpha expression.
  8206. @item red_expr, r
  8207. Set the red expression.
  8208. @item green_expr, g
  8209. Set the green expression.
  8210. @item blue_expr, b
  8211. Set the blue expression.
  8212. @end table
  8213. The colorspace is selected according to the specified options. If one
  8214. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8215. options is specified, the filter will automatically select a YCbCr
  8216. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8217. @option{blue_expr} options is specified, it will select an RGB
  8218. colorspace.
  8219. If one of the chrominance expression is not defined, it falls back on the other
  8220. one. If no alpha expression is specified it will evaluate to opaque value.
  8221. If none of chrominance expressions are specified, they will evaluate
  8222. to the luminance expression.
  8223. The expressions can use the following variables and functions:
  8224. @table @option
  8225. @item N
  8226. The sequential number of the filtered frame, starting from @code{0}.
  8227. @item X
  8228. @item Y
  8229. The coordinates of the current sample.
  8230. @item W
  8231. @item H
  8232. The width and height of the image.
  8233. @item SW
  8234. @item SH
  8235. Width and height scale depending on the currently filtered plane. It is the
  8236. ratio between the corresponding luma plane number of pixels and the current
  8237. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8238. @code{0.5,0.5} for chroma planes.
  8239. @item T
  8240. Time of the current frame, expressed in seconds.
  8241. @item p(x, y)
  8242. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8243. plane.
  8244. @item lum(x, y)
  8245. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8246. plane.
  8247. @item cb(x, y)
  8248. Return the value of the pixel at location (@var{x},@var{y}) of the
  8249. blue-difference chroma plane. Return 0 if there is no such plane.
  8250. @item cr(x, y)
  8251. Return the value of the pixel at location (@var{x},@var{y}) of the
  8252. red-difference chroma plane. Return 0 if there is no such plane.
  8253. @item r(x, y)
  8254. @item g(x, y)
  8255. @item b(x, y)
  8256. Return the value of the pixel at location (@var{x},@var{y}) of the
  8257. red/green/blue component. Return 0 if there is no such component.
  8258. @item alpha(x, y)
  8259. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8260. plane. Return 0 if there is no such plane.
  8261. @end table
  8262. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8263. automatically clipped to the closer edge.
  8264. @subsection Examples
  8265. @itemize
  8266. @item
  8267. Flip the image horizontally:
  8268. @example
  8269. geq=p(W-X\,Y)
  8270. @end example
  8271. @item
  8272. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8273. wavelength of 100 pixels:
  8274. @example
  8275. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8276. @end example
  8277. @item
  8278. Generate a fancy enigmatic moving light:
  8279. @example
  8280. 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
  8281. @end example
  8282. @item
  8283. Generate a quick emboss effect:
  8284. @example
  8285. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8286. @end example
  8287. @item
  8288. Modify RGB components depending on pixel position:
  8289. @example
  8290. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8291. @end example
  8292. @item
  8293. Create a radial gradient that is the same size as the input (also see
  8294. the @ref{vignette} filter):
  8295. @example
  8296. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8297. @end example
  8298. @end itemize
  8299. @section gradfun
  8300. Fix the banding artifacts that are sometimes introduced into nearly flat
  8301. regions by truncation to 8-bit color depth.
  8302. Interpolate the gradients that should go where the bands are, and
  8303. dither them.
  8304. It is designed for playback only. Do not use it prior to
  8305. lossy compression, because compression tends to lose the dither and
  8306. bring back the bands.
  8307. It accepts the following parameters:
  8308. @table @option
  8309. @item strength
  8310. The maximum amount by which the filter will change any one pixel. This is also
  8311. the threshold for detecting nearly flat regions. Acceptable values range from
  8312. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8313. valid range.
  8314. @item radius
  8315. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8316. gradients, but also prevents the filter from modifying the pixels near detailed
  8317. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8318. values will be clipped to the valid range.
  8319. @end table
  8320. Alternatively, the options can be specified as a flat string:
  8321. @var{strength}[:@var{radius}]
  8322. @subsection Examples
  8323. @itemize
  8324. @item
  8325. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8326. @example
  8327. gradfun=3.5:8
  8328. @end example
  8329. @item
  8330. Specify radius, omitting the strength (which will fall-back to the default
  8331. value):
  8332. @example
  8333. gradfun=radius=8
  8334. @end example
  8335. @end itemize
  8336. @section graphmonitor, agraphmonitor
  8337. Show various filtergraph stats.
  8338. With this filter one can debug complete filtergraph.
  8339. Especially issues with links filling with queued frames.
  8340. The filter accepts the following options:
  8341. @table @option
  8342. @item size, s
  8343. Set video output size. Default is @var{hd720}.
  8344. @item opacity, o
  8345. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8346. @item mode, m
  8347. Set output mode, can be @var{fulll} or @var{compact}.
  8348. In @var{compact} mode only filters with some queued frames have displayed stats.
  8349. @item flags, f
  8350. Set flags which enable which stats are shown in video.
  8351. Available values for flags are:
  8352. @table @samp
  8353. @item queue
  8354. Display number of queued frames in each link.
  8355. @item frame_count_in
  8356. Display number of frames taken from filter.
  8357. @item frame_count_out
  8358. Display number of frames given out from filter.
  8359. @item pts
  8360. Display current filtered frame pts.
  8361. @item time
  8362. Display current filtered frame time.
  8363. @item timebase
  8364. Display time base for filter link.
  8365. @item format
  8366. Display used format for filter link.
  8367. @item size
  8368. Display video size or number of audio channels in case of audio used by filter link.
  8369. @item rate
  8370. Display video frame rate or sample rate in case of audio used by filter link.
  8371. @end table
  8372. @item rate, r
  8373. Set upper limit for video rate of output stream, Default value is @var{25}.
  8374. This guarantee that output video frame rate will not be higher than this value.
  8375. @end table
  8376. @section greyedge
  8377. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8378. and corrects the scene colors accordingly.
  8379. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8380. The filter accepts the following options:
  8381. @table @option
  8382. @item difford
  8383. The order of differentiation to be applied on the scene. Must be chosen in the range
  8384. [0,2] and default value is 1.
  8385. @item minknorm
  8386. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8387. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8388. max value instead of calculating Minkowski distance.
  8389. @item sigma
  8390. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8391. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8392. can't be equal to 0 if @var{difford} is greater than 0.
  8393. @end table
  8394. @subsection Examples
  8395. @itemize
  8396. @item
  8397. Grey Edge:
  8398. @example
  8399. greyedge=difford=1:minknorm=5:sigma=2
  8400. @end example
  8401. @item
  8402. Max Edge:
  8403. @example
  8404. greyedge=difford=1:minknorm=0:sigma=2
  8405. @end example
  8406. @end itemize
  8407. @anchor{haldclut}
  8408. @section haldclut
  8409. Apply a Hald CLUT to a video stream.
  8410. First input is the video stream to process, and second one is the Hald CLUT.
  8411. The Hald CLUT input can be a simple picture or a complete video stream.
  8412. The filter accepts the following options:
  8413. @table @option
  8414. @item shortest
  8415. Force termination when the shortest input terminates. Default is @code{0}.
  8416. @item repeatlast
  8417. Continue applying the last CLUT after the end of the stream. A value of
  8418. @code{0} disable the filter after the last frame of the CLUT is reached.
  8419. Default is @code{1}.
  8420. @end table
  8421. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8422. filters share the same internals).
  8423. This filter also supports the @ref{framesync} options.
  8424. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8425. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8426. @subsection Workflow examples
  8427. @subsubsection Hald CLUT video stream
  8428. Generate an identity Hald CLUT stream altered with various effects:
  8429. @example
  8430. 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
  8431. @end example
  8432. Note: make sure you use a lossless codec.
  8433. Then use it with @code{haldclut} to apply it on some random stream:
  8434. @example
  8435. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8436. @end example
  8437. The Hald CLUT will be applied to the 10 first seconds (duration of
  8438. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8439. to the remaining frames of the @code{mandelbrot} stream.
  8440. @subsubsection Hald CLUT with preview
  8441. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8442. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8443. biggest possible square starting at the top left of the picture. The remaining
  8444. padding pixels (bottom or right) will be ignored. This area can be used to add
  8445. a preview of the Hald CLUT.
  8446. Typically, the following generated Hald CLUT will be supported by the
  8447. @code{haldclut} filter:
  8448. @example
  8449. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8450. pad=iw+320 [padded_clut];
  8451. smptebars=s=320x256, split [a][b];
  8452. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8453. [main][b] overlay=W-320" -frames:v 1 clut.png
  8454. @end example
  8455. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8456. bars are displayed on the right-top, and below the same color bars processed by
  8457. the color changes.
  8458. Then, the effect of this Hald CLUT can be visualized with:
  8459. @example
  8460. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8461. @end example
  8462. @section hflip
  8463. Flip the input video horizontally.
  8464. For example, to horizontally flip the input video with @command{ffmpeg}:
  8465. @example
  8466. ffmpeg -i in.avi -vf "hflip" out.avi
  8467. @end example
  8468. @section histeq
  8469. This filter applies a global color histogram equalization on a
  8470. per-frame basis.
  8471. It can be used to correct video that has a compressed range of pixel
  8472. intensities. The filter redistributes the pixel intensities to
  8473. equalize their distribution across the intensity range. It may be
  8474. viewed as an "automatically adjusting contrast filter". This filter is
  8475. useful only for correcting degraded or poorly captured source
  8476. video.
  8477. The filter accepts the following options:
  8478. @table @option
  8479. @item strength
  8480. Determine the amount of equalization to be applied. As the strength
  8481. is reduced, the distribution of pixel intensities more-and-more
  8482. approaches that of the input frame. The value must be a float number
  8483. in the range [0,1] and defaults to 0.200.
  8484. @item intensity
  8485. Set the maximum intensity that can generated and scale the output
  8486. values appropriately. The strength should be set as desired and then
  8487. the intensity can be limited if needed to avoid washing-out. The value
  8488. must be a float number in the range [0,1] and defaults to 0.210.
  8489. @item antibanding
  8490. Set the antibanding level. If enabled the filter will randomly vary
  8491. the luminance of output pixels by a small amount to avoid banding of
  8492. the histogram. Possible values are @code{none}, @code{weak} or
  8493. @code{strong}. It defaults to @code{none}.
  8494. @end table
  8495. @section histogram
  8496. Compute and draw a color distribution histogram for the input video.
  8497. The computed histogram is a representation of the color component
  8498. distribution in an image.
  8499. Standard histogram displays the color components distribution in an image.
  8500. Displays color graph for each color component. Shows distribution of
  8501. the Y, U, V, A or R, G, B components, depending on input format, in the
  8502. current frame. Below each graph a color component scale meter is shown.
  8503. The filter accepts the following options:
  8504. @table @option
  8505. @item level_height
  8506. Set height of level. Default value is @code{200}.
  8507. Allowed range is [50, 2048].
  8508. @item scale_height
  8509. Set height of color scale. Default value is @code{12}.
  8510. Allowed range is [0, 40].
  8511. @item display_mode
  8512. Set display mode.
  8513. It accepts the following values:
  8514. @table @samp
  8515. @item stack
  8516. Per color component graphs are placed below each other.
  8517. @item parade
  8518. Per color component graphs are placed side by side.
  8519. @item overlay
  8520. Presents information identical to that in the @code{parade}, except
  8521. that the graphs representing color components are superimposed directly
  8522. over one another.
  8523. @end table
  8524. Default is @code{stack}.
  8525. @item levels_mode
  8526. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8527. Default is @code{linear}.
  8528. @item components
  8529. Set what color components to display.
  8530. Default is @code{7}.
  8531. @item fgopacity
  8532. Set foreground opacity. Default is @code{0.7}.
  8533. @item bgopacity
  8534. Set background opacity. Default is @code{0.5}.
  8535. @end table
  8536. @subsection Examples
  8537. @itemize
  8538. @item
  8539. Calculate and draw histogram:
  8540. @example
  8541. ffplay -i input -vf histogram
  8542. @end example
  8543. @end itemize
  8544. @anchor{hqdn3d}
  8545. @section hqdn3d
  8546. This is a high precision/quality 3d denoise filter. It aims to reduce
  8547. image noise, producing smooth images and making still images really
  8548. still. It should enhance compressibility.
  8549. It accepts the following optional parameters:
  8550. @table @option
  8551. @item luma_spatial
  8552. A non-negative floating point number which specifies spatial luma strength.
  8553. It defaults to 4.0.
  8554. @item chroma_spatial
  8555. A non-negative floating point number which specifies spatial chroma strength.
  8556. It defaults to 3.0*@var{luma_spatial}/4.0.
  8557. @item luma_tmp
  8558. A floating point number which specifies luma temporal strength. It defaults to
  8559. 6.0*@var{luma_spatial}/4.0.
  8560. @item chroma_tmp
  8561. A floating point number which specifies chroma temporal strength. It defaults to
  8562. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8563. @end table
  8564. @anchor{hwdownload}
  8565. @section hwdownload
  8566. Download hardware frames to system memory.
  8567. The input must be in hardware frames, and the output a non-hardware format.
  8568. Not all formats will be supported on the output - it may be necessary to insert
  8569. an additional @option{format} filter immediately following in the graph to get
  8570. the output in a supported format.
  8571. @section hwmap
  8572. Map hardware frames to system memory or to another device.
  8573. This filter has several different modes of operation; which one is used depends
  8574. on the input and output formats:
  8575. @itemize
  8576. @item
  8577. Hardware frame input, normal frame output
  8578. Map the input frames to system memory and pass them to the output. If the
  8579. original hardware frame is later required (for example, after overlaying
  8580. something else on part of it), the @option{hwmap} filter can be used again
  8581. in the next mode to retrieve it.
  8582. @item
  8583. Normal frame input, hardware frame output
  8584. If the input is actually a software-mapped hardware frame, then unmap it -
  8585. that is, return the original hardware frame.
  8586. Otherwise, a device must be provided. Create new hardware surfaces on that
  8587. device for the output, then map them back to the software format at the input
  8588. and give those frames to the preceding filter. This will then act like the
  8589. @option{hwupload} filter, but may be able to avoid an additional copy when
  8590. the input is already in a compatible format.
  8591. @item
  8592. Hardware frame input and output
  8593. A device must be supplied for the output, either directly or with the
  8594. @option{derive_device} option. The input and output devices must be of
  8595. different types and compatible - the exact meaning of this is
  8596. system-dependent, but typically it means that they must refer to the same
  8597. underlying hardware context (for example, refer to the same graphics card).
  8598. If the input frames were originally created on the output device, then unmap
  8599. to retrieve the original frames.
  8600. Otherwise, map the frames to the output device - create new hardware frames
  8601. on the output corresponding to the frames on the input.
  8602. @end itemize
  8603. The following additional parameters are accepted:
  8604. @table @option
  8605. @item mode
  8606. Set the frame mapping mode. Some combination of:
  8607. @table @var
  8608. @item read
  8609. The mapped frame should be readable.
  8610. @item write
  8611. The mapped frame should be writeable.
  8612. @item overwrite
  8613. The mapping will always overwrite the entire frame.
  8614. This may improve performance in some cases, as the original contents of the
  8615. frame need not be loaded.
  8616. @item direct
  8617. The mapping must not involve any copying.
  8618. Indirect mappings to copies of frames are created in some cases where either
  8619. direct mapping is not possible or it would have unexpected properties.
  8620. Setting this flag ensures that the mapping is direct and will fail if that is
  8621. not possible.
  8622. @end table
  8623. Defaults to @var{read+write} if not specified.
  8624. @item derive_device @var{type}
  8625. Rather than using the device supplied at initialisation, instead derive a new
  8626. device of type @var{type} from the device the input frames exist on.
  8627. @item reverse
  8628. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8629. and map them back to the source. This may be necessary in some cases where
  8630. a mapping in one direction is required but only the opposite direction is
  8631. supported by the devices being used.
  8632. This option is dangerous - it may break the preceding filter in undefined
  8633. ways if there are any additional constraints on that filter's output.
  8634. Do not use it without fully understanding the implications of its use.
  8635. @end table
  8636. @anchor{hwupload}
  8637. @section hwupload
  8638. Upload system memory frames to hardware surfaces.
  8639. The device to upload to must be supplied when the filter is initialised. If
  8640. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8641. option.
  8642. @anchor{hwupload_cuda}
  8643. @section hwupload_cuda
  8644. Upload system memory frames to a CUDA device.
  8645. It accepts the following optional parameters:
  8646. @table @option
  8647. @item device
  8648. The number of the CUDA device to use
  8649. @end table
  8650. @section hqx
  8651. Apply a high-quality magnification filter designed for pixel art. This filter
  8652. was originally created by Maxim Stepin.
  8653. It accepts the following option:
  8654. @table @option
  8655. @item n
  8656. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8657. @code{hq3x} and @code{4} for @code{hq4x}.
  8658. Default is @code{3}.
  8659. @end table
  8660. @section hstack
  8661. Stack input videos horizontally.
  8662. All streams must be of same pixel format and of same height.
  8663. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8664. to create same output.
  8665. The filter accept the following option:
  8666. @table @option
  8667. @item inputs
  8668. Set number of input streams. Default is 2.
  8669. @item shortest
  8670. If set to 1, force the output to terminate when the shortest input
  8671. terminates. Default value is 0.
  8672. @end table
  8673. @section hue
  8674. Modify the hue and/or the saturation of the input.
  8675. It accepts the following parameters:
  8676. @table @option
  8677. @item h
  8678. Specify the hue angle as a number of degrees. It accepts an expression,
  8679. and defaults to "0".
  8680. @item s
  8681. Specify the saturation in the [-10,10] range. It accepts an expression and
  8682. defaults to "1".
  8683. @item H
  8684. Specify the hue angle as a number of radians. It accepts an
  8685. expression, and defaults to "0".
  8686. @item b
  8687. Specify the brightness in the [-10,10] range. It accepts an expression and
  8688. defaults to "0".
  8689. @end table
  8690. @option{h} and @option{H} are mutually exclusive, and can't be
  8691. specified at the same time.
  8692. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8693. expressions containing the following constants:
  8694. @table @option
  8695. @item n
  8696. frame count of the input frame starting from 0
  8697. @item pts
  8698. presentation timestamp of the input frame expressed in time base units
  8699. @item r
  8700. frame rate of the input video, NAN if the input frame rate is unknown
  8701. @item t
  8702. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8703. @item tb
  8704. time base of the input video
  8705. @end table
  8706. @subsection Examples
  8707. @itemize
  8708. @item
  8709. Set the hue to 90 degrees and the saturation to 1.0:
  8710. @example
  8711. hue=h=90:s=1
  8712. @end example
  8713. @item
  8714. Same command but expressing the hue in radians:
  8715. @example
  8716. hue=H=PI/2:s=1
  8717. @end example
  8718. @item
  8719. Rotate hue and make the saturation swing between 0
  8720. and 2 over a period of 1 second:
  8721. @example
  8722. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8723. @end example
  8724. @item
  8725. Apply a 3 seconds saturation fade-in effect starting at 0:
  8726. @example
  8727. hue="s=min(t/3\,1)"
  8728. @end example
  8729. The general fade-in expression can be written as:
  8730. @example
  8731. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8732. @end example
  8733. @item
  8734. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8735. @example
  8736. hue="s=max(0\, min(1\, (8-t)/3))"
  8737. @end example
  8738. The general fade-out expression can be written as:
  8739. @example
  8740. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8741. @end example
  8742. @end itemize
  8743. @subsection Commands
  8744. This filter supports the following commands:
  8745. @table @option
  8746. @item b
  8747. @item s
  8748. @item h
  8749. @item H
  8750. Modify the hue and/or the saturation and/or brightness of the input video.
  8751. The command accepts the same syntax of the corresponding option.
  8752. If the specified expression is not valid, it is kept at its current
  8753. value.
  8754. @end table
  8755. @section hysteresis
  8756. Grow first stream into second stream by connecting components.
  8757. This makes it possible to build more robust edge masks.
  8758. This filter accepts the following options:
  8759. @table @option
  8760. @item planes
  8761. Set which planes will be processed as bitmap, unprocessed planes will be
  8762. copied from first stream.
  8763. By default value 0xf, all planes will be processed.
  8764. @item threshold
  8765. Set threshold which is used in filtering. If pixel component value is higher than
  8766. this value filter algorithm for connecting components is activated.
  8767. By default value is 0.
  8768. @end table
  8769. @section idet
  8770. Detect video interlacing type.
  8771. This filter tries to detect if the input frames are interlaced, progressive,
  8772. top or bottom field first. It will also try to detect fields that are
  8773. repeated between adjacent frames (a sign of telecine).
  8774. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8775. Multiple frame detection incorporates the classification history of previous frames.
  8776. The filter will log these metadata values:
  8777. @table @option
  8778. @item single.current_frame
  8779. Detected type of current frame using single-frame detection. One of:
  8780. ``tff'' (top field first), ``bff'' (bottom field first),
  8781. ``progressive'', or ``undetermined''
  8782. @item single.tff
  8783. Cumulative number of frames detected as top field first using single-frame detection.
  8784. @item multiple.tff
  8785. Cumulative number of frames detected as top field first using multiple-frame detection.
  8786. @item single.bff
  8787. Cumulative number of frames detected as bottom field first using single-frame detection.
  8788. @item multiple.current_frame
  8789. Detected type of current frame using multiple-frame detection. One of:
  8790. ``tff'' (top field first), ``bff'' (bottom field first),
  8791. ``progressive'', or ``undetermined''
  8792. @item multiple.bff
  8793. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8794. @item single.progressive
  8795. Cumulative number of frames detected as progressive using single-frame detection.
  8796. @item multiple.progressive
  8797. Cumulative number of frames detected as progressive using multiple-frame detection.
  8798. @item single.undetermined
  8799. Cumulative number of frames that could not be classified using single-frame detection.
  8800. @item multiple.undetermined
  8801. Cumulative number of frames that could not be classified using multiple-frame detection.
  8802. @item repeated.current_frame
  8803. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8804. @item repeated.neither
  8805. Cumulative number of frames with no repeated field.
  8806. @item repeated.top
  8807. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8808. @item repeated.bottom
  8809. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8810. @end table
  8811. The filter accepts the following options:
  8812. @table @option
  8813. @item intl_thres
  8814. Set interlacing threshold.
  8815. @item prog_thres
  8816. Set progressive threshold.
  8817. @item rep_thres
  8818. Threshold for repeated field detection.
  8819. @item half_life
  8820. Number of frames after which a given frame's contribution to the
  8821. statistics is halved (i.e., it contributes only 0.5 to its
  8822. classification). The default of 0 means that all frames seen are given
  8823. full weight of 1.0 forever.
  8824. @item analyze_interlaced_flag
  8825. When this is not 0 then idet will use the specified number of frames to determine
  8826. if the interlaced flag is accurate, it will not count undetermined frames.
  8827. If the flag is found to be accurate it will be used without any further
  8828. computations, if it is found to be inaccurate it will be cleared without any
  8829. further computations. This allows inserting the idet filter as a low computational
  8830. method to clean up the interlaced flag
  8831. @end table
  8832. @section il
  8833. Deinterleave or interleave fields.
  8834. This filter allows one to process interlaced images fields without
  8835. deinterlacing them. Deinterleaving splits the input frame into 2
  8836. fields (so called half pictures). Odd lines are moved to the top
  8837. half of the output image, even lines to the bottom half.
  8838. You can process (filter) them independently and then re-interleave them.
  8839. The filter accepts the following options:
  8840. @table @option
  8841. @item luma_mode, l
  8842. @item chroma_mode, c
  8843. @item alpha_mode, a
  8844. Available values for @var{luma_mode}, @var{chroma_mode} and
  8845. @var{alpha_mode} are:
  8846. @table @samp
  8847. @item none
  8848. Do nothing.
  8849. @item deinterleave, d
  8850. Deinterleave fields, placing one above the other.
  8851. @item interleave, i
  8852. Interleave fields. Reverse the effect of deinterleaving.
  8853. @end table
  8854. Default value is @code{none}.
  8855. @item luma_swap, ls
  8856. @item chroma_swap, cs
  8857. @item alpha_swap, as
  8858. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8859. @end table
  8860. @section inflate
  8861. Apply inflate effect to the video.
  8862. This filter replaces the pixel by the local(3x3) average by taking into account
  8863. only values higher than the pixel.
  8864. It accepts the following options:
  8865. @table @option
  8866. @item threshold0
  8867. @item threshold1
  8868. @item threshold2
  8869. @item threshold3
  8870. Limit the maximum change for each plane, default is 65535.
  8871. If 0, plane will remain unchanged.
  8872. @end table
  8873. @section interlace
  8874. Simple interlacing filter from progressive contents. This interleaves upper (or
  8875. lower) lines from odd frames with lower (or upper) lines from even frames,
  8876. halving the frame rate and preserving image height.
  8877. @example
  8878. Original Original New Frame
  8879. Frame 'j' Frame 'j+1' (tff)
  8880. ========== =========== ==================
  8881. Line 0 --------------------> Frame 'j' Line 0
  8882. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8883. Line 2 ---------------------> Frame 'j' Line 2
  8884. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8885. ... ... ...
  8886. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8887. @end example
  8888. It accepts the following optional parameters:
  8889. @table @option
  8890. @item scan
  8891. This determines whether the interlaced frame is taken from the even
  8892. (tff - default) or odd (bff) lines of the progressive frame.
  8893. @item lowpass
  8894. Vertical lowpass filter to avoid twitter interlacing and
  8895. reduce moire patterns.
  8896. @table @samp
  8897. @item 0, off
  8898. Disable vertical lowpass filter
  8899. @item 1, linear
  8900. Enable linear filter (default)
  8901. @item 2, complex
  8902. Enable complex filter. This will slightly less reduce twitter and moire
  8903. but better retain detail and subjective sharpness impression.
  8904. @end table
  8905. @end table
  8906. @section kerndeint
  8907. Deinterlace input video by applying Donald Graft's adaptive kernel
  8908. deinterling. Work on interlaced parts of a video to produce
  8909. progressive frames.
  8910. The description of the accepted parameters follows.
  8911. @table @option
  8912. @item thresh
  8913. Set the threshold which affects the filter's tolerance when
  8914. determining if a pixel line must be processed. It must be an integer
  8915. in the range [0,255] and defaults to 10. A value of 0 will result in
  8916. applying the process on every pixels.
  8917. @item map
  8918. Paint pixels exceeding the threshold value to white if set to 1.
  8919. Default is 0.
  8920. @item order
  8921. Set the fields order. Swap fields if set to 1, leave fields alone if
  8922. 0. Default is 0.
  8923. @item sharp
  8924. Enable additional sharpening if set to 1. Default is 0.
  8925. @item twoway
  8926. Enable twoway sharpening if set to 1. Default is 0.
  8927. @end table
  8928. @subsection Examples
  8929. @itemize
  8930. @item
  8931. Apply default values:
  8932. @example
  8933. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8934. @end example
  8935. @item
  8936. Enable additional sharpening:
  8937. @example
  8938. kerndeint=sharp=1
  8939. @end example
  8940. @item
  8941. Paint processed pixels in white:
  8942. @example
  8943. kerndeint=map=1
  8944. @end example
  8945. @end itemize
  8946. @section lagfun
  8947. Slowly update darker pixels.
  8948. This filter makes short flashes of light appear longer.
  8949. This filter accepts the following options:
  8950. @table @option
  8951. @item decay
  8952. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  8953. @item planes
  8954. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  8955. @end table
  8956. @section lenscorrection
  8957. Correct radial lens distortion
  8958. This filter can be used to correct for radial distortion as can result from the use
  8959. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8960. one can use tools available for example as part of opencv or simply trial-and-error.
  8961. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8962. and extract the k1 and k2 coefficients from the resulting matrix.
  8963. Note that effectively the same filter is available in the open-source tools Krita and
  8964. Digikam from the KDE project.
  8965. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8966. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8967. brightness distribution, so you may want to use both filters together in certain
  8968. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8969. be applied before or after lens correction.
  8970. @subsection Options
  8971. The filter accepts the following options:
  8972. @table @option
  8973. @item cx
  8974. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8975. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8976. width. Default is 0.5.
  8977. @item cy
  8978. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8979. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8980. height. Default is 0.5.
  8981. @item k1
  8982. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8983. no correction. Default is 0.
  8984. @item k2
  8985. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8986. 0 means no correction. Default is 0.
  8987. @end table
  8988. The formula that generates the correction is:
  8989. @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)
  8990. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8991. distances from the focal point in the source and target images, respectively.
  8992. @section lensfun
  8993. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8994. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8995. to apply the lens correction. The filter will load the lensfun database and
  8996. query it to find the corresponding camera and lens entries in the database. As
  8997. long as these entries can be found with the given options, the filter can
  8998. perform corrections on frames. Note that incomplete strings will result in the
  8999. filter choosing the best match with the given options, and the filter will
  9000. output the chosen camera and lens models (logged with level "info"). You must
  9001. provide the make, camera model, and lens model as they are required.
  9002. The filter accepts the following options:
  9003. @table @option
  9004. @item make
  9005. The make of the camera (for example, "Canon"). This option is required.
  9006. @item model
  9007. The model of the camera (for example, "Canon EOS 100D"). This option is
  9008. required.
  9009. @item lens_model
  9010. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9011. option is required.
  9012. @item mode
  9013. The type of correction to apply. The following values are valid options:
  9014. @table @samp
  9015. @item vignetting
  9016. Enables fixing lens vignetting.
  9017. @item geometry
  9018. Enables fixing lens geometry. This is the default.
  9019. @item subpixel
  9020. Enables fixing chromatic aberrations.
  9021. @item vig_geo
  9022. Enables fixing lens vignetting and lens geometry.
  9023. @item vig_subpixel
  9024. Enables fixing lens vignetting and chromatic aberrations.
  9025. @item distortion
  9026. Enables fixing both lens geometry and chromatic aberrations.
  9027. @item all
  9028. Enables all possible corrections.
  9029. @end table
  9030. @item focal_length
  9031. The focal length of the image/video (zoom; expected constant for video). For
  9032. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9033. range should be chosen when using that lens. Default 18.
  9034. @item aperture
  9035. The aperture of the image/video (expected constant for video). Note that
  9036. aperture is only used for vignetting correction. Default 3.5.
  9037. @item focus_distance
  9038. The focus distance of the image/video (expected constant for video). Note that
  9039. focus distance is only used for vignetting and only slightly affects the
  9040. vignetting correction process. If unknown, leave it at the default value (which
  9041. is 1000).
  9042. @item scale
  9043. The scale factor which is applied after transformation. After correction the
  9044. video is no longer necessarily rectangular. This parameter controls how much of
  9045. the resulting image is visible. The value 0 means that a value will be chosen
  9046. automatically such that there is little or no unmapped area in the output
  9047. image. 1.0 means that no additional scaling is done. Lower values may result
  9048. in more of the corrected image being visible, while higher values may avoid
  9049. unmapped areas in the output.
  9050. @item target_geometry
  9051. The target geometry of the output image/video. The following values are valid
  9052. options:
  9053. @table @samp
  9054. @item rectilinear (default)
  9055. @item fisheye
  9056. @item panoramic
  9057. @item equirectangular
  9058. @item fisheye_orthographic
  9059. @item fisheye_stereographic
  9060. @item fisheye_equisolid
  9061. @item fisheye_thoby
  9062. @end table
  9063. @item reverse
  9064. Apply the reverse of image correction (instead of correcting distortion, apply
  9065. it).
  9066. @item interpolation
  9067. The type of interpolation used when correcting distortion. The following values
  9068. are valid options:
  9069. @table @samp
  9070. @item nearest
  9071. @item linear (default)
  9072. @item lanczos
  9073. @end table
  9074. @end table
  9075. @subsection Examples
  9076. @itemize
  9077. @item
  9078. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9079. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9080. aperture of "8.0".
  9081. @example
  9082. 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
  9083. @end example
  9084. @item
  9085. Apply the same as before, but only for the first 5 seconds of video.
  9086. @example
  9087. 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
  9088. @end example
  9089. @end itemize
  9090. @section libvmaf
  9091. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9092. score between two input videos.
  9093. The obtained VMAF score is printed through the logging system.
  9094. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9095. After installing the library it can be enabled using:
  9096. @code{./configure --enable-libvmaf --enable-version3}.
  9097. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9098. The filter has following options:
  9099. @table @option
  9100. @item model_path
  9101. Set the model path which is to be used for SVM.
  9102. Default value: @code{"vmaf_v0.6.1.pkl"}
  9103. @item log_path
  9104. Set the file path to be used to store logs.
  9105. @item log_fmt
  9106. Set the format of the log file (xml or json).
  9107. @item enable_transform
  9108. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9109. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9110. Default value: @code{false}
  9111. @item phone_model
  9112. Invokes the phone model which will generate VMAF scores higher than in the
  9113. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9114. @item psnr
  9115. Enables computing psnr along with vmaf.
  9116. @item ssim
  9117. Enables computing ssim along with vmaf.
  9118. @item ms_ssim
  9119. Enables computing ms_ssim along with vmaf.
  9120. @item pool
  9121. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9122. @item n_threads
  9123. Set number of threads to be used when computing vmaf.
  9124. @item n_subsample
  9125. Set interval for frame subsampling used when computing vmaf.
  9126. @item enable_conf_interval
  9127. Enables confidence interval.
  9128. @end table
  9129. This filter also supports the @ref{framesync} options.
  9130. On the below examples the input file @file{main.mpg} being processed is
  9131. compared with the reference file @file{ref.mpg}.
  9132. @example
  9133. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9134. @end example
  9135. Example with options:
  9136. @example
  9137. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9138. @end example
  9139. @section limiter
  9140. Limits the pixel components values to the specified range [min, max].
  9141. The filter accepts the following options:
  9142. @table @option
  9143. @item min
  9144. Lower bound. Defaults to the lowest allowed value for the input.
  9145. @item max
  9146. Upper bound. Defaults to the highest allowed value for the input.
  9147. @item planes
  9148. Specify which planes will be processed. Defaults to all available.
  9149. @end table
  9150. @section loop
  9151. Loop video frames.
  9152. The filter accepts the following options:
  9153. @table @option
  9154. @item loop
  9155. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9156. Default is 0.
  9157. @item size
  9158. Set maximal size in number of frames. Default is 0.
  9159. @item start
  9160. Set first frame of loop. Default is 0.
  9161. @end table
  9162. @subsection Examples
  9163. @itemize
  9164. @item
  9165. Loop single first frame infinitely:
  9166. @example
  9167. loop=loop=-1:size=1:start=0
  9168. @end example
  9169. @item
  9170. Loop single first frame 10 times:
  9171. @example
  9172. loop=loop=10:size=1:start=0
  9173. @end example
  9174. @item
  9175. Loop 10 first frames 5 times:
  9176. @example
  9177. loop=loop=5:size=10:start=0
  9178. @end example
  9179. @end itemize
  9180. @section lut1d
  9181. Apply a 1D LUT to an input video.
  9182. The filter accepts the following options:
  9183. @table @option
  9184. @item file
  9185. Set the 1D LUT file name.
  9186. Currently supported formats:
  9187. @table @samp
  9188. @item cube
  9189. Iridas
  9190. @item csp
  9191. cineSpace
  9192. @end table
  9193. @item interp
  9194. Select interpolation mode.
  9195. Available values are:
  9196. @table @samp
  9197. @item nearest
  9198. Use values from the nearest defined point.
  9199. @item linear
  9200. Interpolate values using the linear interpolation.
  9201. @item cosine
  9202. Interpolate values using the cosine interpolation.
  9203. @item cubic
  9204. Interpolate values using the cubic interpolation.
  9205. @item spline
  9206. Interpolate values using the spline interpolation.
  9207. @end table
  9208. @end table
  9209. @anchor{lut3d}
  9210. @section lut3d
  9211. Apply a 3D LUT to an input video.
  9212. The filter accepts the following options:
  9213. @table @option
  9214. @item file
  9215. Set the 3D LUT file name.
  9216. Currently supported formats:
  9217. @table @samp
  9218. @item 3dl
  9219. AfterEffects
  9220. @item cube
  9221. Iridas
  9222. @item dat
  9223. DaVinci
  9224. @item m3d
  9225. Pandora
  9226. @item csp
  9227. cineSpace
  9228. @end table
  9229. @item interp
  9230. Select interpolation mode.
  9231. Available values are:
  9232. @table @samp
  9233. @item nearest
  9234. Use values from the nearest defined point.
  9235. @item trilinear
  9236. Interpolate values using the 8 points defining a cube.
  9237. @item tetrahedral
  9238. Interpolate values using a tetrahedron.
  9239. @end table
  9240. @end table
  9241. @section lumakey
  9242. Turn certain luma values into transparency.
  9243. The filter accepts the following options:
  9244. @table @option
  9245. @item threshold
  9246. Set the luma which will be used as base for transparency.
  9247. Default value is @code{0}.
  9248. @item tolerance
  9249. Set the range of luma values to be keyed out.
  9250. Default value is @code{0}.
  9251. @item softness
  9252. Set the range of softness. Default value is @code{0}.
  9253. Use this to control gradual transition from zero to full transparency.
  9254. @end table
  9255. @section lut, lutrgb, lutyuv
  9256. Compute a look-up table for binding each pixel component input value
  9257. to an output value, and apply it to the input video.
  9258. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9259. to an RGB input video.
  9260. These filters accept the following parameters:
  9261. @table @option
  9262. @item c0
  9263. set first pixel component expression
  9264. @item c1
  9265. set second pixel component expression
  9266. @item c2
  9267. set third pixel component expression
  9268. @item c3
  9269. set fourth pixel component expression, corresponds to the alpha component
  9270. @item r
  9271. set red component expression
  9272. @item g
  9273. set green component expression
  9274. @item b
  9275. set blue component expression
  9276. @item a
  9277. alpha component expression
  9278. @item y
  9279. set Y/luminance component expression
  9280. @item u
  9281. set U/Cb component expression
  9282. @item v
  9283. set V/Cr component expression
  9284. @end table
  9285. Each of them specifies the expression to use for computing the lookup table for
  9286. the corresponding pixel component values.
  9287. The exact component associated to each of the @var{c*} options depends on the
  9288. format in input.
  9289. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9290. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9291. The expressions can contain the following constants and functions:
  9292. @table @option
  9293. @item w
  9294. @item h
  9295. The input width and height.
  9296. @item val
  9297. The input value for the pixel component.
  9298. @item clipval
  9299. The input value, clipped to the @var{minval}-@var{maxval} range.
  9300. @item maxval
  9301. The maximum value for the pixel component.
  9302. @item minval
  9303. The minimum value for the pixel component.
  9304. @item negval
  9305. The negated value for the pixel component value, clipped to the
  9306. @var{minval}-@var{maxval} range; it corresponds to the expression
  9307. "maxval-clipval+minval".
  9308. @item clip(val)
  9309. The computed value in @var{val}, clipped to the
  9310. @var{minval}-@var{maxval} range.
  9311. @item gammaval(gamma)
  9312. The computed gamma correction value of the pixel component value,
  9313. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9314. expression
  9315. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9316. @end table
  9317. All expressions default to "val".
  9318. @subsection Examples
  9319. @itemize
  9320. @item
  9321. Negate input video:
  9322. @example
  9323. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9324. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9325. @end example
  9326. The above is the same as:
  9327. @example
  9328. lutrgb="r=negval:g=negval:b=negval"
  9329. lutyuv="y=negval:u=negval:v=negval"
  9330. @end example
  9331. @item
  9332. Negate luminance:
  9333. @example
  9334. lutyuv=y=negval
  9335. @end example
  9336. @item
  9337. Remove chroma components, turning the video into a graytone image:
  9338. @example
  9339. lutyuv="u=128:v=128"
  9340. @end example
  9341. @item
  9342. Apply a luma burning effect:
  9343. @example
  9344. lutyuv="y=2*val"
  9345. @end example
  9346. @item
  9347. Remove green and blue components:
  9348. @example
  9349. lutrgb="g=0:b=0"
  9350. @end example
  9351. @item
  9352. Set a constant alpha channel value on input:
  9353. @example
  9354. format=rgba,lutrgb=a="maxval-minval/2"
  9355. @end example
  9356. @item
  9357. Correct luminance gamma by a factor of 0.5:
  9358. @example
  9359. lutyuv=y=gammaval(0.5)
  9360. @end example
  9361. @item
  9362. Discard least significant bits of luma:
  9363. @example
  9364. lutyuv=y='bitand(val, 128+64+32)'
  9365. @end example
  9366. @item
  9367. Technicolor like effect:
  9368. @example
  9369. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9370. @end example
  9371. @end itemize
  9372. @section lut2, tlut2
  9373. The @code{lut2} filter takes two input streams and outputs one
  9374. stream.
  9375. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9376. from one single stream.
  9377. This filter accepts the following parameters:
  9378. @table @option
  9379. @item c0
  9380. set first pixel component expression
  9381. @item c1
  9382. set second pixel component expression
  9383. @item c2
  9384. set third pixel component expression
  9385. @item c3
  9386. set fourth pixel component expression, corresponds to the alpha component
  9387. @item d
  9388. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9389. which means bit depth is automatically picked from first input format.
  9390. @end table
  9391. Each of them specifies the expression to use for computing the lookup table for
  9392. the corresponding pixel component values.
  9393. The exact component associated to each of the @var{c*} options depends on the
  9394. format in inputs.
  9395. The expressions can contain the following constants:
  9396. @table @option
  9397. @item w
  9398. @item h
  9399. The input width and height.
  9400. @item x
  9401. The first input value for the pixel component.
  9402. @item y
  9403. The second input value for the pixel component.
  9404. @item bdx
  9405. The first input video bit depth.
  9406. @item bdy
  9407. The second input video bit depth.
  9408. @end table
  9409. All expressions default to "x".
  9410. @subsection Examples
  9411. @itemize
  9412. @item
  9413. Highlight differences between two RGB video streams:
  9414. @example
  9415. 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)'
  9416. @end example
  9417. @item
  9418. Highlight differences between two YUV video streams:
  9419. @example
  9420. 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)'
  9421. @end example
  9422. @item
  9423. Show max difference between two video streams:
  9424. @example
  9425. 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)))'
  9426. @end example
  9427. @end itemize
  9428. @section maskedclamp
  9429. Clamp the first input stream with the second input and third input stream.
  9430. Returns the value of first stream to be between second input
  9431. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9432. This filter accepts the following options:
  9433. @table @option
  9434. @item undershoot
  9435. Default value is @code{0}.
  9436. @item overshoot
  9437. Default value is @code{0}.
  9438. @item planes
  9439. Set which planes will be processed as bitmap, unprocessed planes will be
  9440. copied from first stream.
  9441. By default value 0xf, all planes will be processed.
  9442. @end table
  9443. @section maskedmerge
  9444. Merge the first input stream with the second input stream using per pixel
  9445. weights in the third input stream.
  9446. A value of 0 in the third stream pixel component means that pixel component
  9447. from first stream is returned unchanged, while maximum value (eg. 255 for
  9448. 8-bit videos) means that pixel component from second stream is returned
  9449. unchanged. Intermediate values define the amount of merging between both
  9450. input stream's pixel components.
  9451. This filter accepts the following options:
  9452. @table @option
  9453. @item planes
  9454. Set which planes will be processed as bitmap, unprocessed planes will be
  9455. copied from first stream.
  9456. By default value 0xf, all planes will be processed.
  9457. @end table
  9458. @section maskfun
  9459. Create mask from input video.
  9460. For example it is useful to create motion masks after @code{tblend} filter.
  9461. This filter accepts the following options:
  9462. @table @option
  9463. @item low
  9464. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9465. @item high
  9466. Set high threshold. Any pixel component higher than this value will be set to max value
  9467. allowed for current pixel format.
  9468. @item planes
  9469. Set planes to filter, by default all available planes are filtered.
  9470. @item fill
  9471. Fill all frame pixels with this value.
  9472. @item sum
  9473. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9474. average, output frame will be completely filled with value set by @var{fill} option.
  9475. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9476. @end table
  9477. @section mcdeint
  9478. Apply motion-compensation deinterlacing.
  9479. It needs one field per frame as input and must thus be used together
  9480. with yadif=1/3 or equivalent.
  9481. This filter accepts the following options:
  9482. @table @option
  9483. @item mode
  9484. Set the deinterlacing mode.
  9485. It accepts one of the following values:
  9486. @table @samp
  9487. @item fast
  9488. @item medium
  9489. @item slow
  9490. use iterative motion estimation
  9491. @item extra_slow
  9492. like @samp{slow}, but use multiple reference frames.
  9493. @end table
  9494. Default value is @samp{fast}.
  9495. @item parity
  9496. Set the picture field parity assumed for the input video. It must be
  9497. one of the following values:
  9498. @table @samp
  9499. @item 0, tff
  9500. assume top field first
  9501. @item 1, bff
  9502. assume bottom field first
  9503. @end table
  9504. Default value is @samp{bff}.
  9505. @item qp
  9506. Set per-block quantization parameter (QP) used by the internal
  9507. encoder.
  9508. Higher values should result in a smoother motion vector field but less
  9509. optimal individual vectors. Default value is 1.
  9510. @end table
  9511. @section mergeplanes
  9512. Merge color channel components from several video streams.
  9513. The filter accepts up to 4 input streams, and merge selected input
  9514. planes to the output video.
  9515. This filter accepts the following options:
  9516. @table @option
  9517. @item mapping
  9518. Set input to output plane mapping. Default is @code{0}.
  9519. The mappings is specified as a bitmap. It should be specified as a
  9520. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9521. mapping for the first plane of the output stream. 'A' sets the number of
  9522. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9523. corresponding input to use (from 0 to 3). The rest of the mappings is
  9524. similar, 'Bb' describes the mapping for the output stream second
  9525. plane, 'Cc' describes the mapping for the output stream third plane and
  9526. 'Dd' describes the mapping for the output stream fourth plane.
  9527. @item format
  9528. Set output pixel format. Default is @code{yuva444p}.
  9529. @end table
  9530. @subsection Examples
  9531. @itemize
  9532. @item
  9533. Merge three gray video streams of same width and height into single video stream:
  9534. @example
  9535. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9536. @end example
  9537. @item
  9538. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9539. @example
  9540. [a0][a1]mergeplanes=0x00010210:yuva444p
  9541. @end example
  9542. @item
  9543. Swap Y and A plane in yuva444p stream:
  9544. @example
  9545. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9546. @end example
  9547. @item
  9548. Swap U and V plane in yuv420p stream:
  9549. @example
  9550. format=yuv420p,mergeplanes=0x000201:yuv420p
  9551. @end example
  9552. @item
  9553. Cast a rgb24 clip to yuv444p:
  9554. @example
  9555. format=rgb24,mergeplanes=0x000102:yuv444p
  9556. @end example
  9557. @end itemize
  9558. @section mestimate
  9559. Estimate and export motion vectors using block matching algorithms.
  9560. Motion vectors are stored in frame side data to be used by other filters.
  9561. This filter accepts the following options:
  9562. @table @option
  9563. @item method
  9564. Specify the motion estimation method. Accepts one of the following values:
  9565. @table @samp
  9566. @item esa
  9567. Exhaustive search algorithm.
  9568. @item tss
  9569. Three step search algorithm.
  9570. @item tdls
  9571. Two dimensional logarithmic search algorithm.
  9572. @item ntss
  9573. New three step search algorithm.
  9574. @item fss
  9575. Four step search algorithm.
  9576. @item ds
  9577. Diamond search algorithm.
  9578. @item hexbs
  9579. Hexagon-based search algorithm.
  9580. @item epzs
  9581. Enhanced predictive zonal search algorithm.
  9582. @item umh
  9583. Uneven multi-hexagon search algorithm.
  9584. @end table
  9585. Default value is @samp{esa}.
  9586. @item mb_size
  9587. Macroblock size. Default @code{16}.
  9588. @item search_param
  9589. Search parameter. Default @code{7}.
  9590. @end table
  9591. @section midequalizer
  9592. Apply Midway Image Equalization effect using two video streams.
  9593. Midway Image Equalization adjusts a pair of images to have the same
  9594. histogram, while maintaining their dynamics as much as possible. It's
  9595. useful for e.g. matching exposures from a pair of stereo cameras.
  9596. This filter has two inputs and one output, which must be of same pixel format, but
  9597. may be of different sizes. The output of filter is first input adjusted with
  9598. midway histogram of both inputs.
  9599. This filter accepts the following option:
  9600. @table @option
  9601. @item planes
  9602. Set which planes to process. Default is @code{15}, which is all available planes.
  9603. @end table
  9604. @section minterpolate
  9605. Convert the video to specified frame rate using motion interpolation.
  9606. This filter accepts the following options:
  9607. @table @option
  9608. @item fps
  9609. 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}.
  9610. @item mi_mode
  9611. Motion interpolation mode. Following values are accepted:
  9612. @table @samp
  9613. @item dup
  9614. Duplicate previous or next frame for interpolating new ones.
  9615. @item blend
  9616. Blend source frames. Interpolated frame is mean of previous and next frames.
  9617. @item mci
  9618. Motion compensated interpolation. Following options are effective when this mode is selected:
  9619. @table @samp
  9620. @item mc_mode
  9621. Motion compensation mode. Following values are accepted:
  9622. @table @samp
  9623. @item obmc
  9624. Overlapped block motion compensation.
  9625. @item aobmc
  9626. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9627. @end table
  9628. Default mode is @samp{obmc}.
  9629. @item me_mode
  9630. Motion estimation mode. Following values are accepted:
  9631. @table @samp
  9632. @item bidir
  9633. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9634. @item bilat
  9635. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9636. @end table
  9637. Default mode is @samp{bilat}.
  9638. @item me
  9639. The algorithm to be used for motion estimation. Following values are accepted:
  9640. @table @samp
  9641. @item esa
  9642. Exhaustive search algorithm.
  9643. @item tss
  9644. Three step search algorithm.
  9645. @item tdls
  9646. Two dimensional logarithmic search algorithm.
  9647. @item ntss
  9648. New three step search algorithm.
  9649. @item fss
  9650. Four step search algorithm.
  9651. @item ds
  9652. Diamond search algorithm.
  9653. @item hexbs
  9654. Hexagon-based search algorithm.
  9655. @item epzs
  9656. Enhanced predictive zonal search algorithm.
  9657. @item umh
  9658. Uneven multi-hexagon search algorithm.
  9659. @end table
  9660. Default algorithm is @samp{epzs}.
  9661. @item mb_size
  9662. Macroblock size. Default @code{16}.
  9663. @item search_param
  9664. Motion estimation search parameter. Default @code{32}.
  9665. @item vsbmc
  9666. 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).
  9667. @end table
  9668. @end table
  9669. @item scd
  9670. 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:
  9671. @table @samp
  9672. @item none
  9673. Disable scene change detection.
  9674. @item fdiff
  9675. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9676. @end table
  9677. Default method is @samp{fdiff}.
  9678. @item scd_threshold
  9679. Scene change detection threshold. Default is @code{5.0}.
  9680. @end table
  9681. @section mix
  9682. Mix several video input streams into one video stream.
  9683. A description of the accepted options follows.
  9684. @table @option
  9685. @item nb_inputs
  9686. The number of inputs. If unspecified, it defaults to 2.
  9687. @item weights
  9688. Specify weight of each input video stream as sequence.
  9689. Each weight is separated by space. If number of weights
  9690. is smaller than number of @var{frames} last specified
  9691. weight will be used for all remaining unset weights.
  9692. @item scale
  9693. Specify scale, if it is set it will be multiplied with sum
  9694. of each weight multiplied with pixel values to give final destination
  9695. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9696. @item duration
  9697. Specify how end of stream is determined.
  9698. @table @samp
  9699. @item longest
  9700. The duration of the longest input. (default)
  9701. @item shortest
  9702. The duration of the shortest input.
  9703. @item first
  9704. The duration of the first input.
  9705. @end table
  9706. @end table
  9707. @section mpdecimate
  9708. Drop frames that do not differ greatly from the previous frame in
  9709. order to reduce frame rate.
  9710. The main use of this filter is for very-low-bitrate encoding
  9711. (e.g. streaming over dialup modem), but it could in theory be used for
  9712. fixing movies that were inverse-telecined incorrectly.
  9713. A description of the accepted options follows.
  9714. @table @option
  9715. @item max
  9716. Set the maximum number of consecutive frames which can be dropped (if
  9717. positive), or the minimum interval between dropped frames (if
  9718. negative). If the value is 0, the frame is dropped disregarding the
  9719. number of previous sequentially dropped frames.
  9720. Default value is 0.
  9721. @item hi
  9722. @item lo
  9723. @item frac
  9724. Set the dropping threshold values.
  9725. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9726. represent actual pixel value differences, so a threshold of 64
  9727. corresponds to 1 unit of difference for each pixel, or the same spread
  9728. out differently over the block.
  9729. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9730. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9731. meaning the whole image) differ by more than a threshold of @option{lo}.
  9732. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9733. 64*5, and default value for @option{frac} is 0.33.
  9734. @end table
  9735. @section negate
  9736. Negate (invert) the input video.
  9737. It accepts the following option:
  9738. @table @option
  9739. @item negate_alpha
  9740. With value 1, it negates the alpha component, if present. Default value is 0.
  9741. @end table
  9742. @anchor{nlmeans}
  9743. @section nlmeans
  9744. Denoise frames using Non-Local Means algorithm.
  9745. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9746. context similarity is defined by comparing their surrounding patches of size
  9747. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9748. around the pixel.
  9749. Note that the research area defines centers for patches, which means some
  9750. patches will be made of pixels outside that research area.
  9751. The filter accepts the following options.
  9752. @table @option
  9753. @item s
  9754. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9755. @item p
  9756. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9757. @item pc
  9758. Same as @option{p} but for chroma planes.
  9759. The default value is @var{0} and means automatic.
  9760. @item r
  9761. Set research size. Default is 15. Must be odd number in range [0, 99].
  9762. @item rc
  9763. Same as @option{r} but for chroma planes.
  9764. The default value is @var{0} and means automatic.
  9765. @end table
  9766. @section nnedi
  9767. Deinterlace video using neural network edge directed interpolation.
  9768. This filter accepts the following options:
  9769. @table @option
  9770. @item weights
  9771. Mandatory option, without binary file filter can not work.
  9772. Currently file can be found here:
  9773. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9774. @item deint
  9775. Set which frames to deinterlace, by default it is @code{all}.
  9776. Can be @code{all} or @code{interlaced}.
  9777. @item field
  9778. Set mode of operation.
  9779. Can be one of the following:
  9780. @table @samp
  9781. @item af
  9782. Use frame flags, both fields.
  9783. @item a
  9784. Use frame flags, single field.
  9785. @item t
  9786. Use top field only.
  9787. @item b
  9788. Use bottom field only.
  9789. @item tf
  9790. Use both fields, top first.
  9791. @item bf
  9792. Use both fields, bottom first.
  9793. @end table
  9794. @item planes
  9795. Set which planes to process, by default filter process all frames.
  9796. @item nsize
  9797. Set size of local neighborhood around each pixel, used by the predictor neural
  9798. network.
  9799. Can be one of the following:
  9800. @table @samp
  9801. @item s8x6
  9802. @item s16x6
  9803. @item s32x6
  9804. @item s48x6
  9805. @item s8x4
  9806. @item s16x4
  9807. @item s32x4
  9808. @end table
  9809. @item nns
  9810. Set the number of neurons in predictor neural network.
  9811. Can be one of the following:
  9812. @table @samp
  9813. @item n16
  9814. @item n32
  9815. @item n64
  9816. @item n128
  9817. @item n256
  9818. @end table
  9819. @item qual
  9820. Controls the number of different neural network predictions that are blended
  9821. together to compute the final output value. Can be @code{fast}, default or
  9822. @code{slow}.
  9823. @item etype
  9824. Set which set of weights to use in the predictor.
  9825. Can be one of the following:
  9826. @table @samp
  9827. @item a
  9828. weights trained to minimize absolute error
  9829. @item s
  9830. weights trained to minimize squared error
  9831. @end table
  9832. @item pscrn
  9833. Controls whether or not the prescreener neural network is used to decide
  9834. which pixels should be processed by the predictor neural network and which
  9835. can be handled by simple cubic interpolation.
  9836. The prescreener is trained to know whether cubic interpolation will be
  9837. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9838. The computational complexity of the prescreener nn is much less than that of
  9839. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9840. using the prescreener generally results in much faster processing.
  9841. The prescreener is pretty accurate, so the difference between using it and not
  9842. using it is almost always unnoticeable.
  9843. Can be one of the following:
  9844. @table @samp
  9845. @item none
  9846. @item original
  9847. @item new
  9848. @end table
  9849. Default is @code{new}.
  9850. @item fapprox
  9851. Set various debugging flags.
  9852. @end table
  9853. @section noformat
  9854. Force libavfilter not to use any of the specified pixel formats for the
  9855. input to the next filter.
  9856. It accepts the following parameters:
  9857. @table @option
  9858. @item pix_fmts
  9859. A '|'-separated list of pixel format names, such as
  9860. pix_fmts=yuv420p|monow|rgb24".
  9861. @end table
  9862. @subsection Examples
  9863. @itemize
  9864. @item
  9865. Force libavfilter to use a format different from @var{yuv420p} for the
  9866. input to the vflip filter:
  9867. @example
  9868. noformat=pix_fmts=yuv420p,vflip
  9869. @end example
  9870. @item
  9871. Convert the input video to any of the formats not contained in the list:
  9872. @example
  9873. noformat=yuv420p|yuv444p|yuv410p
  9874. @end example
  9875. @end itemize
  9876. @section noise
  9877. Add noise on video input frame.
  9878. The filter accepts the following options:
  9879. @table @option
  9880. @item all_seed
  9881. @item c0_seed
  9882. @item c1_seed
  9883. @item c2_seed
  9884. @item c3_seed
  9885. Set noise seed for specific pixel component or all pixel components in case
  9886. of @var{all_seed}. Default value is @code{123457}.
  9887. @item all_strength, alls
  9888. @item c0_strength, c0s
  9889. @item c1_strength, c1s
  9890. @item c2_strength, c2s
  9891. @item c3_strength, c3s
  9892. Set noise strength for specific pixel component or all pixel components in case
  9893. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9894. @item all_flags, allf
  9895. @item c0_flags, c0f
  9896. @item c1_flags, c1f
  9897. @item c2_flags, c2f
  9898. @item c3_flags, c3f
  9899. Set pixel component flags or set flags for all components if @var{all_flags}.
  9900. Available values for component flags are:
  9901. @table @samp
  9902. @item a
  9903. averaged temporal noise (smoother)
  9904. @item p
  9905. mix random noise with a (semi)regular pattern
  9906. @item t
  9907. temporal noise (noise pattern changes between frames)
  9908. @item u
  9909. uniform noise (gaussian otherwise)
  9910. @end table
  9911. @end table
  9912. @subsection Examples
  9913. Add temporal and uniform noise to input video:
  9914. @example
  9915. noise=alls=20:allf=t+u
  9916. @end example
  9917. @section normalize
  9918. Normalize RGB video (aka histogram stretching, contrast stretching).
  9919. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9920. For each channel of each frame, the filter computes the input range and maps
  9921. it linearly to the user-specified output range. The output range defaults
  9922. to the full dynamic range from pure black to pure white.
  9923. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9924. changes in brightness) caused when small dark or bright objects enter or leave
  9925. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9926. video camera, and, like a video camera, it may cause a period of over- or
  9927. under-exposure of the video.
  9928. The R,G,B channels can be normalized independently, which may cause some
  9929. color shifting, or linked together as a single channel, which prevents
  9930. color shifting. Linked normalization preserves hue. Independent normalization
  9931. does not, so it can be used to remove some color casts. Independent and linked
  9932. normalization can be combined in any ratio.
  9933. The normalize filter accepts the following options:
  9934. @table @option
  9935. @item blackpt
  9936. @item whitept
  9937. Colors which define the output range. The minimum input value is mapped to
  9938. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9939. The defaults are black and white respectively. Specifying white for
  9940. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9941. normalized video. Shades of grey can be used to reduce the dynamic range
  9942. (contrast). Specifying saturated colors here can create some interesting
  9943. effects.
  9944. @item smoothing
  9945. The number of previous frames to use for temporal smoothing. The input range
  9946. of each channel is smoothed using a rolling average over the current frame
  9947. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9948. smoothing).
  9949. @item independence
  9950. Controls the ratio of independent (color shifting) channel normalization to
  9951. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9952. independent. Defaults to 1.0 (fully independent).
  9953. @item strength
  9954. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9955. expensive no-op. Defaults to 1.0 (full strength).
  9956. @end table
  9957. @subsection Examples
  9958. Stretch video contrast to use the full dynamic range, with no temporal
  9959. smoothing; may flicker depending on the source content:
  9960. @example
  9961. normalize=blackpt=black:whitept=white:smoothing=0
  9962. @end example
  9963. As above, but with 50 frames of temporal smoothing; flicker should be
  9964. reduced, depending on the source content:
  9965. @example
  9966. normalize=blackpt=black:whitept=white:smoothing=50
  9967. @end example
  9968. As above, but with hue-preserving linked channel normalization:
  9969. @example
  9970. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9971. @end example
  9972. As above, but with half strength:
  9973. @example
  9974. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9975. @end example
  9976. Map the darkest input color to red, the brightest input color to cyan:
  9977. @example
  9978. normalize=blackpt=red:whitept=cyan
  9979. @end example
  9980. @section null
  9981. Pass the video source unchanged to the output.
  9982. @section ocr
  9983. Optical Character Recognition
  9984. This filter uses Tesseract for optical character recognition. To enable
  9985. compilation of this filter, you need to configure FFmpeg with
  9986. @code{--enable-libtesseract}.
  9987. It accepts the following options:
  9988. @table @option
  9989. @item datapath
  9990. Set datapath to tesseract data. Default is to use whatever was
  9991. set at installation.
  9992. @item language
  9993. Set language, default is "eng".
  9994. @item whitelist
  9995. Set character whitelist.
  9996. @item blacklist
  9997. Set character blacklist.
  9998. @end table
  9999. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10000. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10001. @section ocv
  10002. Apply a video transform using libopencv.
  10003. To enable this filter, install the libopencv library and headers and
  10004. configure FFmpeg with @code{--enable-libopencv}.
  10005. It accepts the following parameters:
  10006. @table @option
  10007. @item filter_name
  10008. The name of the libopencv filter to apply.
  10009. @item filter_params
  10010. The parameters to pass to the libopencv filter. If not specified, the default
  10011. values are assumed.
  10012. @end table
  10013. Refer to the official libopencv documentation for more precise
  10014. information:
  10015. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10016. Several libopencv filters are supported; see the following subsections.
  10017. @anchor{dilate}
  10018. @subsection dilate
  10019. Dilate an image by using a specific structuring element.
  10020. It corresponds to the libopencv function @code{cvDilate}.
  10021. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10022. @var{struct_el} represents a structuring element, and has the syntax:
  10023. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10024. @var{cols} and @var{rows} represent the number of columns and rows of
  10025. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10026. point, and @var{shape} the shape for the structuring element. @var{shape}
  10027. must be "rect", "cross", "ellipse", or "custom".
  10028. If the value for @var{shape} is "custom", it must be followed by a
  10029. string of the form "=@var{filename}". The file with name
  10030. @var{filename} is assumed to represent a binary image, with each
  10031. printable character corresponding to a bright pixel. When a custom
  10032. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10033. or columns and rows of the read file are assumed instead.
  10034. The default value for @var{struct_el} is "3x3+0x0/rect".
  10035. @var{nb_iterations} specifies the number of times the transform is
  10036. applied to the image, and defaults to 1.
  10037. Some examples:
  10038. @example
  10039. # Use the default values
  10040. ocv=dilate
  10041. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10042. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10043. # Read the shape from the file diamond.shape, iterating two times.
  10044. # The file diamond.shape may contain a pattern of characters like this
  10045. # *
  10046. # ***
  10047. # *****
  10048. # ***
  10049. # *
  10050. # The specified columns and rows are ignored
  10051. # but the anchor point coordinates are not
  10052. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10053. @end example
  10054. @subsection erode
  10055. Erode an image by using a specific structuring element.
  10056. It corresponds to the libopencv function @code{cvErode}.
  10057. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10058. with the same syntax and semantics as the @ref{dilate} filter.
  10059. @subsection smooth
  10060. Smooth the input video.
  10061. The filter takes the following parameters:
  10062. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10063. @var{type} is the type of smooth filter to apply, and must be one of
  10064. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10065. or "bilateral". The default value is "gaussian".
  10066. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10067. depend on the smooth type. @var{param1} and
  10068. @var{param2} accept integer positive values or 0. @var{param3} and
  10069. @var{param4} accept floating point values.
  10070. The default value for @var{param1} is 3. The default value for the
  10071. other parameters is 0.
  10072. These parameters correspond to the parameters assigned to the
  10073. libopencv function @code{cvSmooth}.
  10074. @section oscilloscope
  10075. 2D Video Oscilloscope.
  10076. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10077. It accepts the following parameters:
  10078. @table @option
  10079. @item x
  10080. Set scope center x position.
  10081. @item y
  10082. Set scope center y position.
  10083. @item s
  10084. Set scope size, relative to frame diagonal.
  10085. @item t
  10086. Set scope tilt/rotation.
  10087. @item o
  10088. Set trace opacity.
  10089. @item tx
  10090. Set trace center x position.
  10091. @item ty
  10092. Set trace center y position.
  10093. @item tw
  10094. Set trace width, relative to width of frame.
  10095. @item th
  10096. Set trace height, relative to height of frame.
  10097. @item c
  10098. Set which components to trace. By default it traces first three components.
  10099. @item g
  10100. Draw trace grid. By default is enabled.
  10101. @item st
  10102. Draw some statistics. By default is enabled.
  10103. @item sc
  10104. Draw scope. By default is enabled.
  10105. @end table
  10106. @subsection Examples
  10107. @itemize
  10108. @item
  10109. Inspect full first row of video frame.
  10110. @example
  10111. oscilloscope=x=0.5:y=0:s=1
  10112. @end example
  10113. @item
  10114. Inspect full last row of video frame.
  10115. @example
  10116. oscilloscope=x=0.5:y=1:s=1
  10117. @end example
  10118. @item
  10119. Inspect full 5th line of video frame of height 1080.
  10120. @example
  10121. oscilloscope=x=0.5:y=5/1080:s=1
  10122. @end example
  10123. @item
  10124. Inspect full last column of video frame.
  10125. @example
  10126. oscilloscope=x=1:y=0.5:s=1:t=1
  10127. @end example
  10128. @end itemize
  10129. @anchor{overlay}
  10130. @section overlay
  10131. Overlay one video on top of another.
  10132. It takes two inputs and has one output. The first input is the "main"
  10133. video on which the second input is overlaid.
  10134. It accepts the following parameters:
  10135. A description of the accepted options follows.
  10136. @table @option
  10137. @item x
  10138. @item y
  10139. Set the expression for the x and y coordinates of the overlaid video
  10140. on the main video. Default value is "0" for both expressions. In case
  10141. the expression is invalid, it is set to a huge value (meaning that the
  10142. overlay will not be displayed within the output visible area).
  10143. @item eof_action
  10144. See @ref{framesync}.
  10145. @item eval
  10146. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10147. It accepts the following values:
  10148. @table @samp
  10149. @item init
  10150. only evaluate expressions once during the filter initialization or
  10151. when a command is processed
  10152. @item frame
  10153. evaluate expressions for each incoming frame
  10154. @end table
  10155. Default value is @samp{frame}.
  10156. @item shortest
  10157. See @ref{framesync}.
  10158. @item format
  10159. Set the format for the output video.
  10160. It accepts the following values:
  10161. @table @samp
  10162. @item yuv420
  10163. force YUV420 output
  10164. @item yuv422
  10165. force YUV422 output
  10166. @item yuv444
  10167. force YUV444 output
  10168. @item rgb
  10169. force packed RGB output
  10170. @item gbrp
  10171. force planar RGB output
  10172. @item auto
  10173. automatically pick format
  10174. @end table
  10175. Default value is @samp{yuv420}.
  10176. @item repeatlast
  10177. See @ref{framesync}.
  10178. @item alpha
  10179. Set format of alpha of the overlaid video, it can be @var{straight} or
  10180. @var{premultiplied}. Default is @var{straight}.
  10181. @end table
  10182. The @option{x}, and @option{y} expressions can contain the following
  10183. parameters.
  10184. @table @option
  10185. @item main_w, W
  10186. @item main_h, H
  10187. The main input width and height.
  10188. @item overlay_w, w
  10189. @item overlay_h, h
  10190. The overlay input width and height.
  10191. @item x
  10192. @item y
  10193. The computed values for @var{x} and @var{y}. They are evaluated for
  10194. each new frame.
  10195. @item hsub
  10196. @item vsub
  10197. horizontal and vertical chroma subsample values of the output
  10198. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10199. @var{vsub} is 1.
  10200. @item n
  10201. the number of input frame, starting from 0
  10202. @item pos
  10203. the position in the file of the input frame, NAN if unknown
  10204. @item t
  10205. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10206. @end table
  10207. This filter also supports the @ref{framesync} options.
  10208. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10209. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10210. when @option{eval} is set to @samp{init}.
  10211. Be aware that frames are taken from each input video in timestamp
  10212. order, hence, if their initial timestamps differ, it is a good idea
  10213. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10214. have them begin in the same zero timestamp, as the example for
  10215. the @var{movie} filter does.
  10216. You can chain together more overlays but you should test the
  10217. efficiency of such approach.
  10218. @subsection Commands
  10219. This filter supports the following commands:
  10220. @table @option
  10221. @item x
  10222. @item y
  10223. Modify the x and y of the overlay input.
  10224. The command accepts the same syntax of the corresponding option.
  10225. If the specified expression is not valid, it is kept at its current
  10226. value.
  10227. @end table
  10228. @subsection Examples
  10229. @itemize
  10230. @item
  10231. Draw the overlay at 10 pixels from the bottom right corner of the main
  10232. video:
  10233. @example
  10234. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10235. @end example
  10236. Using named options the example above becomes:
  10237. @example
  10238. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10239. @end example
  10240. @item
  10241. Insert a transparent PNG logo in the bottom left corner of the input,
  10242. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10243. @example
  10244. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10245. @end example
  10246. @item
  10247. Insert 2 different transparent PNG logos (second logo on bottom
  10248. right corner) using the @command{ffmpeg} tool:
  10249. @example
  10250. 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
  10251. @end example
  10252. @item
  10253. Add a transparent color layer on top of the main video; @code{WxH}
  10254. must specify the size of the main input to the overlay filter:
  10255. @example
  10256. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10257. @end example
  10258. @item
  10259. Play an original video and a filtered version (here with the deshake
  10260. filter) side by side using the @command{ffplay} tool:
  10261. @example
  10262. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10263. @end example
  10264. The above command is the same as:
  10265. @example
  10266. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10267. @end example
  10268. @item
  10269. Make a sliding overlay appearing from the left to the right top part of the
  10270. screen starting since time 2:
  10271. @example
  10272. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10273. @end example
  10274. @item
  10275. Compose output by putting two input videos side to side:
  10276. @example
  10277. ffmpeg -i left.avi -i right.avi -filter_complex "
  10278. nullsrc=size=200x100 [background];
  10279. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10280. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10281. [background][left] overlay=shortest=1 [background+left];
  10282. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10283. "
  10284. @end example
  10285. @item
  10286. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10287. @example
  10288. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10289. -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]'
  10290. masked.avi
  10291. @end example
  10292. @item
  10293. Chain several overlays in cascade:
  10294. @example
  10295. nullsrc=s=200x200 [bg];
  10296. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10297. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10298. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10299. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10300. [in3] null, [mid2] overlay=100:100 [out0]
  10301. @end example
  10302. @end itemize
  10303. @section owdenoise
  10304. Apply Overcomplete Wavelet denoiser.
  10305. The filter accepts the following options:
  10306. @table @option
  10307. @item depth
  10308. Set depth.
  10309. Larger depth values will denoise lower frequency components more, but
  10310. slow down filtering.
  10311. Must be an int in the range 8-16, default is @code{8}.
  10312. @item luma_strength, ls
  10313. Set luma strength.
  10314. Must be a double value in the range 0-1000, default is @code{1.0}.
  10315. @item chroma_strength, cs
  10316. Set chroma strength.
  10317. Must be a double value in the range 0-1000, default is @code{1.0}.
  10318. @end table
  10319. @anchor{pad}
  10320. @section pad
  10321. Add paddings to the input image, and place the original input at the
  10322. provided @var{x}, @var{y} coordinates.
  10323. It accepts the following parameters:
  10324. @table @option
  10325. @item width, w
  10326. @item height, h
  10327. Specify an expression for the size of the output image with the
  10328. paddings added. If the value for @var{width} or @var{height} is 0, the
  10329. corresponding input size is used for the output.
  10330. The @var{width} expression can reference the value set by the
  10331. @var{height} expression, and vice versa.
  10332. The default value of @var{width} and @var{height} is 0.
  10333. @item x
  10334. @item y
  10335. Specify the offsets to place the input image at within the padded area,
  10336. with respect to the top/left border of the output image.
  10337. The @var{x} expression can reference the value set by the @var{y}
  10338. expression, and vice versa.
  10339. The default value of @var{x} and @var{y} is 0.
  10340. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10341. so the input image is centered on the padded area.
  10342. @item color
  10343. Specify the color of the padded area. For the syntax of this option,
  10344. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10345. manual,ffmpeg-utils}.
  10346. The default value of @var{color} is "black".
  10347. @item eval
  10348. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10349. It accepts the following values:
  10350. @table @samp
  10351. @item init
  10352. Only evaluate expressions once during the filter initialization or when
  10353. a command is processed.
  10354. @item frame
  10355. Evaluate expressions for each incoming frame.
  10356. @end table
  10357. Default value is @samp{init}.
  10358. @item aspect
  10359. Pad to aspect instead to a resolution.
  10360. @end table
  10361. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10362. options are expressions containing the following constants:
  10363. @table @option
  10364. @item in_w
  10365. @item in_h
  10366. The input video width and height.
  10367. @item iw
  10368. @item ih
  10369. These are the same as @var{in_w} and @var{in_h}.
  10370. @item out_w
  10371. @item out_h
  10372. The output width and height (the size of the padded area), as
  10373. specified by the @var{width} and @var{height} expressions.
  10374. @item ow
  10375. @item oh
  10376. These are the same as @var{out_w} and @var{out_h}.
  10377. @item x
  10378. @item y
  10379. The x and y offsets as specified by the @var{x} and @var{y}
  10380. expressions, or NAN if not yet specified.
  10381. @item a
  10382. same as @var{iw} / @var{ih}
  10383. @item sar
  10384. input sample aspect ratio
  10385. @item dar
  10386. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10387. @item hsub
  10388. @item vsub
  10389. The horizontal and vertical chroma subsample values. For example for the
  10390. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10391. @end table
  10392. @subsection Examples
  10393. @itemize
  10394. @item
  10395. Add paddings with the color "violet" to the input video. The output video
  10396. size is 640x480, and the top-left corner of the input video is placed at
  10397. column 0, row 40
  10398. @example
  10399. pad=640:480:0:40:violet
  10400. @end example
  10401. The example above is equivalent to the following command:
  10402. @example
  10403. pad=width=640:height=480:x=0:y=40:color=violet
  10404. @end example
  10405. @item
  10406. Pad the input to get an output with dimensions increased by 3/2,
  10407. and put the input video at the center of the padded area:
  10408. @example
  10409. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10410. @end example
  10411. @item
  10412. Pad the input to get a squared output with size equal to the maximum
  10413. value between the input width and height, and put the input video at
  10414. the center of the padded area:
  10415. @example
  10416. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10417. @end example
  10418. @item
  10419. Pad the input to get a final w/h ratio of 16:9:
  10420. @example
  10421. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10422. @end example
  10423. @item
  10424. In case of anamorphic video, in order to set the output display aspect
  10425. correctly, it is necessary to use @var{sar} in the expression,
  10426. according to the relation:
  10427. @example
  10428. (ih * X / ih) * sar = output_dar
  10429. X = output_dar / sar
  10430. @end example
  10431. Thus the previous example needs to be modified to:
  10432. @example
  10433. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10434. @end example
  10435. @item
  10436. Double the output size and put the input video in the bottom-right
  10437. corner of the output padded area:
  10438. @example
  10439. pad="2*iw:2*ih:ow-iw:oh-ih"
  10440. @end example
  10441. @end itemize
  10442. @anchor{palettegen}
  10443. @section palettegen
  10444. Generate one palette for a whole video stream.
  10445. It accepts the following options:
  10446. @table @option
  10447. @item max_colors
  10448. Set the maximum number of colors to quantize in the palette.
  10449. Note: the palette will still contain 256 colors; the unused palette entries
  10450. will be black.
  10451. @item reserve_transparent
  10452. Create a palette of 255 colors maximum and reserve the last one for
  10453. transparency. Reserving the transparency color is useful for GIF optimization.
  10454. If not set, the maximum of colors in the palette will be 256. You probably want
  10455. to disable this option for a standalone image.
  10456. Set by default.
  10457. @item transparency_color
  10458. Set the color that will be used as background for transparency.
  10459. @item stats_mode
  10460. Set statistics mode.
  10461. It accepts the following values:
  10462. @table @samp
  10463. @item full
  10464. Compute full frame histograms.
  10465. @item diff
  10466. Compute histograms only for the part that differs from previous frame. This
  10467. might be relevant to give more importance to the moving part of your input if
  10468. the background is static.
  10469. @item single
  10470. Compute new histogram for each frame.
  10471. @end table
  10472. Default value is @var{full}.
  10473. @end table
  10474. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10475. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10476. color quantization of the palette. This information is also visible at
  10477. @var{info} logging level.
  10478. @subsection Examples
  10479. @itemize
  10480. @item
  10481. Generate a representative palette of a given video using @command{ffmpeg}:
  10482. @example
  10483. ffmpeg -i input.mkv -vf palettegen palette.png
  10484. @end example
  10485. @end itemize
  10486. @section paletteuse
  10487. Use a palette to downsample an input video stream.
  10488. The filter takes two inputs: one video stream and a palette. The palette must
  10489. be a 256 pixels image.
  10490. It accepts the following options:
  10491. @table @option
  10492. @item dither
  10493. Select dithering mode. Available algorithms are:
  10494. @table @samp
  10495. @item bayer
  10496. Ordered 8x8 bayer dithering (deterministic)
  10497. @item heckbert
  10498. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10499. Note: this dithering is sometimes considered "wrong" and is included as a
  10500. reference.
  10501. @item floyd_steinberg
  10502. Floyd and Steingberg dithering (error diffusion)
  10503. @item sierra2
  10504. Frankie Sierra dithering v2 (error diffusion)
  10505. @item sierra2_4a
  10506. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10507. @end table
  10508. Default is @var{sierra2_4a}.
  10509. @item bayer_scale
  10510. When @var{bayer} dithering is selected, this option defines the scale of the
  10511. pattern (how much the crosshatch pattern is visible). A low value means more
  10512. visible pattern for less banding, and higher value means less visible pattern
  10513. at the cost of more banding.
  10514. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10515. @item diff_mode
  10516. If set, define the zone to process
  10517. @table @samp
  10518. @item rectangle
  10519. Only the changing rectangle will be reprocessed. This is similar to GIF
  10520. cropping/offsetting compression mechanism. This option can be useful for speed
  10521. if only a part of the image is changing, and has use cases such as limiting the
  10522. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10523. moving scene (it leads to more deterministic output if the scene doesn't change
  10524. much, and as a result less moving noise and better GIF compression).
  10525. @end table
  10526. Default is @var{none}.
  10527. @item new
  10528. Take new palette for each output frame.
  10529. @item alpha_threshold
  10530. Sets the alpha threshold for transparency. Alpha values above this threshold
  10531. will be treated as completely opaque, and values below this threshold will be
  10532. treated as completely transparent.
  10533. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10534. @end table
  10535. @subsection Examples
  10536. @itemize
  10537. @item
  10538. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10539. using @command{ffmpeg}:
  10540. @example
  10541. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10542. @end example
  10543. @end itemize
  10544. @section perspective
  10545. Correct perspective of video not recorded perpendicular to the screen.
  10546. A description of the accepted parameters follows.
  10547. @table @option
  10548. @item x0
  10549. @item y0
  10550. @item x1
  10551. @item y1
  10552. @item x2
  10553. @item y2
  10554. @item x3
  10555. @item y3
  10556. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10557. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10558. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10559. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10560. then the corners of the source will be sent to the specified coordinates.
  10561. The expressions can use the following variables:
  10562. @table @option
  10563. @item W
  10564. @item H
  10565. the width and height of video frame.
  10566. @item in
  10567. Input frame count.
  10568. @item on
  10569. Output frame count.
  10570. @end table
  10571. @item interpolation
  10572. Set interpolation for perspective correction.
  10573. It accepts the following values:
  10574. @table @samp
  10575. @item linear
  10576. @item cubic
  10577. @end table
  10578. Default value is @samp{linear}.
  10579. @item sense
  10580. Set interpretation of coordinate options.
  10581. It accepts the following values:
  10582. @table @samp
  10583. @item 0, source
  10584. Send point in the source specified by the given coordinates to
  10585. the corners of the destination.
  10586. @item 1, destination
  10587. Send the corners of the source to the point in the destination specified
  10588. by the given coordinates.
  10589. Default value is @samp{source}.
  10590. @end table
  10591. @item eval
  10592. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10593. It accepts the following values:
  10594. @table @samp
  10595. @item init
  10596. only evaluate expressions once during the filter initialization or
  10597. when a command is processed
  10598. @item frame
  10599. evaluate expressions for each incoming frame
  10600. @end table
  10601. Default value is @samp{init}.
  10602. @end table
  10603. @section phase
  10604. Delay interlaced video by one field time so that the field order changes.
  10605. The intended use is to fix PAL movies that have been captured with the
  10606. opposite field order to the film-to-video transfer.
  10607. A description of the accepted parameters follows.
  10608. @table @option
  10609. @item mode
  10610. Set phase mode.
  10611. It accepts the following values:
  10612. @table @samp
  10613. @item t
  10614. Capture field order top-first, transfer bottom-first.
  10615. Filter will delay the bottom field.
  10616. @item b
  10617. Capture field order bottom-first, transfer top-first.
  10618. Filter will delay the top field.
  10619. @item p
  10620. Capture and transfer with the same field order. This mode only exists
  10621. for the documentation of the other options to refer to, but if you
  10622. actually select it, the filter will faithfully do nothing.
  10623. @item a
  10624. Capture field order determined automatically by field flags, transfer
  10625. opposite.
  10626. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10627. basis using field flags. If no field information is available,
  10628. then this works just like @samp{u}.
  10629. @item u
  10630. Capture unknown or varying, transfer opposite.
  10631. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10632. analyzing the images and selecting the alternative that produces best
  10633. match between the fields.
  10634. @item T
  10635. Capture top-first, transfer unknown or varying.
  10636. Filter selects among @samp{t} and @samp{p} using image analysis.
  10637. @item B
  10638. Capture bottom-first, transfer unknown or varying.
  10639. Filter selects among @samp{b} and @samp{p} using image analysis.
  10640. @item A
  10641. Capture determined by field flags, transfer unknown or varying.
  10642. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10643. image analysis. If no field information is available, then this works just
  10644. like @samp{U}. This is the default mode.
  10645. @item U
  10646. Both capture and transfer unknown or varying.
  10647. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10648. @end table
  10649. @end table
  10650. @section pixdesctest
  10651. Pixel format descriptor test filter, mainly useful for internal
  10652. testing. The output video should be equal to the input video.
  10653. For example:
  10654. @example
  10655. format=monow, pixdesctest
  10656. @end example
  10657. can be used to test the monowhite pixel format descriptor definition.
  10658. @section pixscope
  10659. Display sample values of color channels. Mainly useful for checking color
  10660. and levels. Minimum supported resolution is 640x480.
  10661. The filters accept the following options:
  10662. @table @option
  10663. @item x
  10664. Set scope X position, relative offset on X axis.
  10665. @item y
  10666. Set scope Y position, relative offset on Y axis.
  10667. @item w
  10668. Set scope width.
  10669. @item h
  10670. Set scope height.
  10671. @item o
  10672. Set window opacity. This window also holds statistics about pixel area.
  10673. @item wx
  10674. Set window X position, relative offset on X axis.
  10675. @item wy
  10676. Set window Y position, relative offset on Y axis.
  10677. @end table
  10678. @section pp
  10679. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10680. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10681. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10682. Each subfilter and some options have a short and a long name that can be used
  10683. interchangeably, i.e. dr/dering are the same.
  10684. The filters accept the following options:
  10685. @table @option
  10686. @item subfilters
  10687. Set postprocessing subfilters string.
  10688. @end table
  10689. All subfilters share common options to determine their scope:
  10690. @table @option
  10691. @item a/autoq
  10692. Honor the quality commands for this subfilter.
  10693. @item c/chrom
  10694. Do chrominance filtering, too (default).
  10695. @item y/nochrom
  10696. Do luminance filtering only (no chrominance).
  10697. @item n/noluma
  10698. Do chrominance filtering only (no luminance).
  10699. @end table
  10700. These options can be appended after the subfilter name, separated by a '|'.
  10701. Available subfilters are:
  10702. @table @option
  10703. @item hb/hdeblock[|difference[|flatness]]
  10704. Horizontal deblocking filter
  10705. @table @option
  10706. @item difference
  10707. Difference factor where higher values mean more deblocking (default: @code{32}).
  10708. @item flatness
  10709. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10710. @end table
  10711. @item vb/vdeblock[|difference[|flatness]]
  10712. Vertical deblocking filter
  10713. @table @option
  10714. @item difference
  10715. Difference factor where higher values mean more deblocking (default: @code{32}).
  10716. @item flatness
  10717. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10718. @end table
  10719. @item ha/hadeblock[|difference[|flatness]]
  10720. Accurate horizontal deblocking filter
  10721. @table @option
  10722. @item difference
  10723. Difference factor where higher values mean more deblocking (default: @code{32}).
  10724. @item flatness
  10725. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10726. @end table
  10727. @item va/vadeblock[|difference[|flatness]]
  10728. Accurate vertical deblocking filter
  10729. @table @option
  10730. @item difference
  10731. Difference factor where higher values mean more deblocking (default: @code{32}).
  10732. @item flatness
  10733. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10734. @end table
  10735. @end table
  10736. The horizontal and vertical deblocking filters share the difference and
  10737. flatness values so you cannot set different horizontal and vertical
  10738. thresholds.
  10739. @table @option
  10740. @item h1/x1hdeblock
  10741. Experimental horizontal deblocking filter
  10742. @item v1/x1vdeblock
  10743. Experimental vertical deblocking filter
  10744. @item dr/dering
  10745. Deringing filter
  10746. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10747. @table @option
  10748. @item threshold1
  10749. larger -> stronger filtering
  10750. @item threshold2
  10751. larger -> stronger filtering
  10752. @item threshold3
  10753. larger -> stronger filtering
  10754. @end table
  10755. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10756. @table @option
  10757. @item f/fullyrange
  10758. Stretch luminance to @code{0-255}.
  10759. @end table
  10760. @item lb/linblenddeint
  10761. Linear blend deinterlacing filter that deinterlaces the given block by
  10762. filtering all lines with a @code{(1 2 1)} filter.
  10763. @item li/linipoldeint
  10764. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10765. linearly interpolating every second line.
  10766. @item ci/cubicipoldeint
  10767. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10768. cubically interpolating every second line.
  10769. @item md/mediandeint
  10770. Median deinterlacing filter that deinterlaces the given block by applying a
  10771. median filter to every second line.
  10772. @item fd/ffmpegdeint
  10773. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10774. second line with a @code{(-1 4 2 4 -1)} filter.
  10775. @item l5/lowpass5
  10776. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10777. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10778. @item fq/forceQuant[|quantizer]
  10779. Overrides the quantizer table from the input with the constant quantizer you
  10780. specify.
  10781. @table @option
  10782. @item quantizer
  10783. Quantizer to use
  10784. @end table
  10785. @item de/default
  10786. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10787. @item fa/fast
  10788. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10789. @item ac
  10790. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10791. @end table
  10792. @subsection Examples
  10793. @itemize
  10794. @item
  10795. Apply horizontal and vertical deblocking, deringing and automatic
  10796. brightness/contrast:
  10797. @example
  10798. pp=hb/vb/dr/al
  10799. @end example
  10800. @item
  10801. Apply default filters without brightness/contrast correction:
  10802. @example
  10803. pp=de/-al
  10804. @end example
  10805. @item
  10806. Apply default filters and temporal denoiser:
  10807. @example
  10808. pp=default/tmpnoise|1|2|3
  10809. @end example
  10810. @item
  10811. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10812. automatically depending on available CPU time:
  10813. @example
  10814. pp=hb|y/vb|a
  10815. @end example
  10816. @end itemize
  10817. @section pp7
  10818. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10819. similar to spp = 6 with 7 point DCT, where only the center sample is
  10820. used after IDCT.
  10821. The filter accepts the following options:
  10822. @table @option
  10823. @item qp
  10824. Force a constant quantization parameter. It accepts an integer in range
  10825. 0 to 63. If not set, the filter will use the QP from the video stream
  10826. (if available).
  10827. @item mode
  10828. Set thresholding mode. Available modes are:
  10829. @table @samp
  10830. @item hard
  10831. Set hard thresholding.
  10832. @item soft
  10833. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10834. @item medium
  10835. Set medium thresholding (good results, default).
  10836. @end table
  10837. @end table
  10838. @section premultiply
  10839. Apply alpha premultiply effect to input video stream using first plane
  10840. of second stream as alpha.
  10841. Both streams must have same dimensions and same pixel format.
  10842. The filter accepts the following option:
  10843. @table @option
  10844. @item planes
  10845. Set which planes will be processed, unprocessed planes will be copied.
  10846. By default value 0xf, all planes will be processed.
  10847. @item inplace
  10848. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10849. @end table
  10850. @section prewitt
  10851. Apply prewitt operator to input video stream.
  10852. The filter accepts the following option:
  10853. @table @option
  10854. @item planes
  10855. Set which planes will be processed, unprocessed planes will be copied.
  10856. By default value 0xf, all planes will be processed.
  10857. @item scale
  10858. Set value which will be multiplied with filtered result.
  10859. @item delta
  10860. Set value which will be added to filtered result.
  10861. @end table
  10862. @anchor{program_opencl}
  10863. @section program_opencl
  10864. Filter video using an OpenCL program.
  10865. @table @option
  10866. @item source
  10867. OpenCL program source file.
  10868. @item kernel
  10869. Kernel name in program.
  10870. @item inputs
  10871. Number of inputs to the filter. Defaults to 1.
  10872. @item size, s
  10873. Size of output frames. Defaults to the same as the first input.
  10874. @end table
  10875. The program source file must contain a kernel function with the given name,
  10876. which will be run once for each plane of the output. Each run on a plane
  10877. gets enqueued as a separate 2D global NDRange with one work-item for each
  10878. pixel to be generated. The global ID offset for each work-item is therefore
  10879. the coordinates of a pixel in the destination image.
  10880. The kernel function needs to take the following arguments:
  10881. @itemize
  10882. @item
  10883. Destination image, @var{__write_only image2d_t}.
  10884. This image will become the output; the kernel should write all of it.
  10885. @item
  10886. Frame index, @var{unsigned int}.
  10887. This is a counter starting from zero and increasing by one for each frame.
  10888. @item
  10889. Source images, @var{__read_only image2d_t}.
  10890. These are the most recent images on each input. The kernel may read from
  10891. them to generate the output, but they can't be written to.
  10892. @end itemize
  10893. Example programs:
  10894. @itemize
  10895. @item
  10896. Copy the input to the output (output must be the same size as the input).
  10897. @verbatim
  10898. __kernel void copy(__write_only image2d_t destination,
  10899. unsigned int index,
  10900. __read_only image2d_t source)
  10901. {
  10902. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10903. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10904. float4 value = read_imagef(source, sampler, location);
  10905. write_imagef(destination, location, value);
  10906. }
  10907. @end verbatim
  10908. @item
  10909. Apply a simple transformation, rotating the input by an amount increasing
  10910. with the index counter. Pixel values are linearly interpolated by the
  10911. sampler, and the output need not have the same dimensions as the input.
  10912. @verbatim
  10913. __kernel void rotate_image(__write_only image2d_t dst,
  10914. unsigned int index,
  10915. __read_only image2d_t src)
  10916. {
  10917. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10918. CLK_FILTER_LINEAR);
  10919. float angle = (float)index / 100.0f;
  10920. float2 dst_dim = convert_float2(get_image_dim(dst));
  10921. float2 src_dim = convert_float2(get_image_dim(src));
  10922. float2 dst_cen = dst_dim / 2.0f;
  10923. float2 src_cen = src_dim / 2.0f;
  10924. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10925. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10926. float2 src_pos = {
  10927. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10928. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10929. };
  10930. src_pos = src_pos * src_dim / dst_dim;
  10931. float2 src_loc = src_pos + src_cen;
  10932. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10933. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10934. write_imagef(dst, dst_loc, 0.5f);
  10935. else
  10936. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10937. }
  10938. @end verbatim
  10939. @item
  10940. Blend two inputs together, with the amount of each input used varying
  10941. with the index counter.
  10942. @verbatim
  10943. __kernel void blend_images(__write_only image2d_t dst,
  10944. unsigned int index,
  10945. __read_only image2d_t src1,
  10946. __read_only image2d_t src2)
  10947. {
  10948. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10949. CLK_FILTER_LINEAR);
  10950. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10951. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10952. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10953. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10954. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10955. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10956. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10957. }
  10958. @end verbatim
  10959. @end itemize
  10960. @section pseudocolor
  10961. Alter frame colors in video with pseudocolors.
  10962. This filter accept the following options:
  10963. @table @option
  10964. @item c0
  10965. set pixel first component expression
  10966. @item c1
  10967. set pixel second component expression
  10968. @item c2
  10969. set pixel third component expression
  10970. @item c3
  10971. set pixel fourth component expression, corresponds to the alpha component
  10972. @item i
  10973. set component to use as base for altering colors
  10974. @end table
  10975. Each of them specifies the expression to use for computing the lookup table for
  10976. the corresponding pixel component values.
  10977. The expressions can contain the following constants and functions:
  10978. @table @option
  10979. @item w
  10980. @item h
  10981. The input width and height.
  10982. @item val
  10983. The input value for the pixel component.
  10984. @item ymin, umin, vmin, amin
  10985. The minimum allowed component value.
  10986. @item ymax, umax, vmax, amax
  10987. The maximum allowed component value.
  10988. @end table
  10989. All expressions default to "val".
  10990. @subsection Examples
  10991. @itemize
  10992. @item
  10993. Change too high luma values to gradient:
  10994. @example
  10995. 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'"
  10996. @end example
  10997. @end itemize
  10998. @section psnr
  10999. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11000. Ratio) between two input videos.
  11001. This filter takes in input two input videos, the first input is
  11002. considered the "main" source and is passed unchanged to the
  11003. output. The second input is used as a "reference" video for computing
  11004. the PSNR.
  11005. Both video inputs must have the same resolution and pixel format for
  11006. this filter to work correctly. Also it assumes that both inputs
  11007. have the same number of frames, which are compared one by one.
  11008. The obtained average PSNR is printed through the logging system.
  11009. The filter stores the accumulated MSE (mean squared error) of each
  11010. frame, and at the end of the processing it is averaged across all frames
  11011. equally, and the following formula is applied to obtain the PSNR:
  11012. @example
  11013. PSNR = 10*log10(MAX^2/MSE)
  11014. @end example
  11015. Where MAX is the average of the maximum values of each component of the
  11016. image.
  11017. The description of the accepted parameters follows.
  11018. @table @option
  11019. @item stats_file, f
  11020. If specified the filter will use the named file to save the PSNR of
  11021. each individual frame. When filename equals "-" the data is sent to
  11022. standard output.
  11023. @item stats_version
  11024. Specifies which version of the stats file format to use. Details of
  11025. each format are written below.
  11026. Default value is 1.
  11027. @item stats_add_max
  11028. Determines whether the max value is output to the stats log.
  11029. Default value is 0.
  11030. Requires stats_version >= 2. If this is set and stats_version < 2,
  11031. the filter will return an error.
  11032. @end table
  11033. This filter also supports the @ref{framesync} options.
  11034. The file printed if @var{stats_file} is selected, contains a sequence of
  11035. key/value pairs of the form @var{key}:@var{value} for each compared
  11036. couple of frames.
  11037. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11038. the list of per-frame-pair stats, with key value pairs following the frame
  11039. format with the following parameters:
  11040. @table @option
  11041. @item psnr_log_version
  11042. The version of the log file format. Will match @var{stats_version}.
  11043. @item fields
  11044. A comma separated list of the per-frame-pair parameters included in
  11045. the log.
  11046. @end table
  11047. A description of each shown per-frame-pair parameter follows:
  11048. @table @option
  11049. @item n
  11050. sequential number of the input frame, starting from 1
  11051. @item mse_avg
  11052. Mean Square Error pixel-by-pixel average difference of the compared
  11053. frames, averaged over all the image components.
  11054. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11055. Mean Square Error pixel-by-pixel average difference of the compared
  11056. frames for the component specified by the suffix.
  11057. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11058. Peak Signal to Noise ratio of the compared frames for the component
  11059. specified by the suffix.
  11060. @item max_avg, max_y, max_u, max_v
  11061. Maximum allowed value for each channel, and average over all
  11062. channels.
  11063. @end table
  11064. For example:
  11065. @example
  11066. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11067. [main][ref] psnr="stats_file=stats.log" [out]
  11068. @end example
  11069. On this example the input file being processed is compared with the
  11070. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11071. is stored in @file{stats.log}.
  11072. @anchor{pullup}
  11073. @section pullup
  11074. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11075. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11076. content.
  11077. The pullup filter is designed to take advantage of future context in making
  11078. its decisions. This filter is stateless in the sense that it does not lock
  11079. onto a pattern to follow, but it instead looks forward to the following
  11080. fields in order to identify matches and rebuild progressive frames.
  11081. To produce content with an even framerate, insert the fps filter after
  11082. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11083. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11084. The filter accepts the following options:
  11085. @table @option
  11086. @item jl
  11087. @item jr
  11088. @item jt
  11089. @item jb
  11090. These options set the amount of "junk" to ignore at the left, right, top, and
  11091. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11092. while top and bottom are in units of 2 lines.
  11093. The default is 8 pixels on each side.
  11094. @item sb
  11095. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11096. filter generating an occasional mismatched frame, but it may also cause an
  11097. excessive number of frames to be dropped during high motion sequences.
  11098. Conversely, setting it to -1 will make filter match fields more easily.
  11099. This may help processing of video where there is slight blurring between
  11100. the fields, but may also cause there to be interlaced frames in the output.
  11101. Default value is @code{0}.
  11102. @item mp
  11103. Set the metric plane to use. It accepts the following values:
  11104. @table @samp
  11105. @item l
  11106. Use luma plane.
  11107. @item u
  11108. Use chroma blue plane.
  11109. @item v
  11110. Use chroma red plane.
  11111. @end table
  11112. This option may be set to use chroma plane instead of the default luma plane
  11113. for doing filter's computations. This may improve accuracy on very clean
  11114. source material, but more likely will decrease accuracy, especially if there
  11115. is chroma noise (rainbow effect) or any grayscale video.
  11116. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11117. load and make pullup usable in realtime on slow machines.
  11118. @end table
  11119. For best results (without duplicated frames in the output file) it is
  11120. necessary to change the output frame rate. For example, to inverse
  11121. telecine NTSC input:
  11122. @example
  11123. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11124. @end example
  11125. @section qp
  11126. Change video quantization parameters (QP).
  11127. The filter accepts the following option:
  11128. @table @option
  11129. @item qp
  11130. Set expression for quantization parameter.
  11131. @end table
  11132. The expression is evaluated through the eval API and can contain, among others,
  11133. the following constants:
  11134. @table @var
  11135. @item known
  11136. 1 if index is not 129, 0 otherwise.
  11137. @item qp
  11138. Sequential index starting from -129 to 128.
  11139. @end table
  11140. @subsection Examples
  11141. @itemize
  11142. @item
  11143. Some equation like:
  11144. @example
  11145. qp=2+2*sin(PI*qp)
  11146. @end example
  11147. @end itemize
  11148. @section random
  11149. Flush video frames from internal cache of frames into a random order.
  11150. No frame is discarded.
  11151. Inspired by @ref{frei0r} nervous filter.
  11152. @table @option
  11153. @item frames
  11154. Set size in number of frames of internal cache, in range from @code{2} to
  11155. @code{512}. Default is @code{30}.
  11156. @item seed
  11157. Set seed for random number generator, must be an integer included between
  11158. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11159. less than @code{0}, the filter will try to use a good random seed on a
  11160. best effort basis.
  11161. @end table
  11162. @section readeia608
  11163. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11164. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11165. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11166. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11167. @table @option
  11168. @item lavfi.readeia608.X.cc
  11169. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11170. @item lavfi.readeia608.X.line
  11171. The number of the line on which the EIA-608 data was identified and read.
  11172. @end table
  11173. This filter accepts the following options:
  11174. @table @option
  11175. @item scan_min
  11176. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11177. @item scan_max
  11178. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11179. @item mac
  11180. Set minimal acceptable amplitude change for sync codes detection.
  11181. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11182. @item spw
  11183. Set the ratio of width reserved for sync code detection.
  11184. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11185. @item mhd
  11186. Set the max peaks height difference for sync code detection.
  11187. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11188. @item mpd
  11189. Set max peaks period difference for sync code detection.
  11190. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11191. @item msd
  11192. Set the first two max start code bits differences.
  11193. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11194. @item bhd
  11195. Set the minimum ratio of bits height compared to 3rd start code bit.
  11196. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11197. @item th_w
  11198. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11199. @item th_b
  11200. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11201. @item chp
  11202. Enable checking the parity bit. In the event of a parity error, the filter will output
  11203. @code{0x00} for that character. Default is false.
  11204. @item lp
  11205. Lowpass lines prior further proccessing. Default is disabled.
  11206. @end table
  11207. @subsection Examples
  11208. @itemize
  11209. @item
  11210. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11211. @example
  11212. 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
  11213. @end example
  11214. @end itemize
  11215. @section readvitc
  11216. Read vertical interval timecode (VITC) information from the top lines of a
  11217. video frame.
  11218. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11219. timecode value, if a valid timecode has been detected. Further metadata key
  11220. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11221. timecode data has been found or not.
  11222. This filter accepts the following options:
  11223. @table @option
  11224. @item scan_max
  11225. Set the maximum number of lines to scan for VITC data. If the value is set to
  11226. @code{-1} the full video frame is scanned. Default is @code{45}.
  11227. @item thr_b
  11228. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11229. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11230. @item thr_w
  11231. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11232. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11233. @end table
  11234. @subsection Examples
  11235. @itemize
  11236. @item
  11237. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11238. draw @code{--:--:--:--} as a placeholder:
  11239. @example
  11240. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11241. @end example
  11242. @end itemize
  11243. @section remap
  11244. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11245. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11246. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11247. value for pixel will be used for destination pixel.
  11248. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11249. will have Xmap/Ymap video stream dimensions.
  11250. Xmap and Ymap input video streams are 16bit depth, single channel.
  11251. @table @option
  11252. @item format
  11253. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11254. Default is @code{color}.
  11255. @end table
  11256. @section removegrain
  11257. The removegrain filter is a spatial denoiser for progressive video.
  11258. @table @option
  11259. @item m0
  11260. Set mode for the first plane.
  11261. @item m1
  11262. Set mode for the second plane.
  11263. @item m2
  11264. Set mode for the third plane.
  11265. @item m3
  11266. Set mode for the fourth plane.
  11267. @end table
  11268. Range of mode is from 0 to 24. Description of each mode follows:
  11269. @table @var
  11270. @item 0
  11271. Leave input plane unchanged. Default.
  11272. @item 1
  11273. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11274. @item 2
  11275. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11276. @item 3
  11277. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11278. @item 4
  11279. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11280. This is equivalent to a median filter.
  11281. @item 5
  11282. Line-sensitive clipping giving the minimal change.
  11283. @item 6
  11284. Line-sensitive clipping, intermediate.
  11285. @item 7
  11286. Line-sensitive clipping, intermediate.
  11287. @item 8
  11288. Line-sensitive clipping, intermediate.
  11289. @item 9
  11290. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11291. @item 10
  11292. Replaces the target pixel with the closest neighbour.
  11293. @item 11
  11294. [1 2 1] horizontal and vertical kernel blur.
  11295. @item 12
  11296. Same as mode 11.
  11297. @item 13
  11298. Bob mode, interpolates top field from the line where the neighbours
  11299. pixels are the closest.
  11300. @item 14
  11301. Bob mode, interpolates bottom field from the line where the neighbours
  11302. pixels are the closest.
  11303. @item 15
  11304. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11305. interpolation formula.
  11306. @item 16
  11307. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11308. interpolation formula.
  11309. @item 17
  11310. Clips the pixel with the minimum and maximum of respectively the maximum and
  11311. minimum of each pair of opposite neighbour pixels.
  11312. @item 18
  11313. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11314. the current pixel is minimal.
  11315. @item 19
  11316. Replaces the pixel with the average of its 8 neighbours.
  11317. @item 20
  11318. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11319. @item 21
  11320. Clips pixels using the averages of opposite neighbour.
  11321. @item 22
  11322. Same as mode 21 but simpler and faster.
  11323. @item 23
  11324. Small edge and halo removal, but reputed useless.
  11325. @item 24
  11326. Similar as 23.
  11327. @end table
  11328. @section removelogo
  11329. Suppress a TV station logo, using an image file to determine which
  11330. pixels comprise the logo. It works by filling in the pixels that
  11331. comprise the logo with neighboring pixels.
  11332. The filter accepts the following options:
  11333. @table @option
  11334. @item filename, f
  11335. Set the filter bitmap file, which can be any image format supported by
  11336. libavformat. The width and height of the image file must match those of the
  11337. video stream being processed.
  11338. @end table
  11339. Pixels in the provided bitmap image with a value of zero are not
  11340. considered part of the logo, non-zero pixels are considered part of
  11341. the logo. If you use white (255) for the logo and black (0) for the
  11342. rest, you will be safe. For making the filter bitmap, it is
  11343. recommended to take a screen capture of a black frame with the logo
  11344. visible, and then using a threshold filter followed by the erode
  11345. filter once or twice.
  11346. If needed, little splotches can be fixed manually. Remember that if
  11347. logo pixels are not covered, the filter quality will be much
  11348. reduced. Marking too many pixels as part of the logo does not hurt as
  11349. much, but it will increase the amount of blurring needed to cover over
  11350. the image and will destroy more information than necessary, and extra
  11351. pixels will slow things down on a large logo.
  11352. @section repeatfields
  11353. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11354. fields based on its value.
  11355. @section reverse
  11356. Reverse a video clip.
  11357. Warning: This filter requires memory to buffer the entire clip, so trimming
  11358. is suggested.
  11359. @subsection Examples
  11360. @itemize
  11361. @item
  11362. Take the first 5 seconds of a clip, and reverse it.
  11363. @example
  11364. trim=end=5,reverse
  11365. @end example
  11366. @end itemize
  11367. @section rgbashift
  11368. Shift R/G/B/A pixels horizontally and/or vertically.
  11369. The filter accepts the following options:
  11370. @table @option
  11371. @item rh
  11372. Set amount to shift red horizontally.
  11373. @item rv
  11374. Set amount to shift red vertically.
  11375. @item gh
  11376. Set amount to shift green horizontally.
  11377. @item gv
  11378. Set amount to shift green vertically.
  11379. @item bh
  11380. Set amount to shift blue horizontally.
  11381. @item bv
  11382. Set amount to shift blue vertically.
  11383. @item ah
  11384. Set amount to shift alpha horizontally.
  11385. @item av
  11386. Set amount to shift alpha vertically.
  11387. @item edge
  11388. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11389. @end table
  11390. @section roberts
  11391. Apply roberts cross operator to input video stream.
  11392. The filter accepts the following option:
  11393. @table @option
  11394. @item planes
  11395. Set which planes will be processed, unprocessed planes will be copied.
  11396. By default value 0xf, all planes will be processed.
  11397. @item scale
  11398. Set value which will be multiplied with filtered result.
  11399. @item delta
  11400. Set value which will be added to filtered result.
  11401. @end table
  11402. @section rotate
  11403. Rotate video by an arbitrary angle expressed in radians.
  11404. The filter accepts the following options:
  11405. A description of the optional parameters follows.
  11406. @table @option
  11407. @item angle, a
  11408. Set an expression for the angle by which to rotate the input video
  11409. clockwise, expressed as a number of radians. A negative value will
  11410. result in a counter-clockwise rotation. By default it is set to "0".
  11411. This expression is evaluated for each frame.
  11412. @item out_w, ow
  11413. Set the output width expression, default value is "iw".
  11414. This expression is evaluated just once during configuration.
  11415. @item out_h, oh
  11416. Set the output height expression, default value is "ih".
  11417. This expression is evaluated just once during configuration.
  11418. @item bilinear
  11419. Enable bilinear interpolation if set to 1, a value of 0 disables
  11420. it. Default value is 1.
  11421. @item fillcolor, c
  11422. Set the color used to fill the output area not covered by the rotated
  11423. image. For the general syntax of this option, check the
  11424. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11425. If the special value "none" is selected then no
  11426. background is printed (useful for example if the background is never shown).
  11427. Default value is "black".
  11428. @end table
  11429. The expressions for the angle and the output size can contain the
  11430. following constants and functions:
  11431. @table @option
  11432. @item n
  11433. sequential number of the input frame, starting from 0. It is always NAN
  11434. before the first frame is filtered.
  11435. @item t
  11436. time in seconds of the input frame, it is set to 0 when the filter is
  11437. configured. It is always NAN before the first frame is filtered.
  11438. @item hsub
  11439. @item vsub
  11440. horizontal and vertical chroma subsample values. For example for the
  11441. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11442. @item in_w, iw
  11443. @item in_h, ih
  11444. the input video width and height
  11445. @item out_w, ow
  11446. @item out_h, oh
  11447. the output width and height, that is the size of the padded area as
  11448. specified by the @var{width} and @var{height} expressions
  11449. @item rotw(a)
  11450. @item roth(a)
  11451. the minimal width/height required for completely containing the input
  11452. video rotated by @var{a} radians.
  11453. These are only available when computing the @option{out_w} and
  11454. @option{out_h} expressions.
  11455. @end table
  11456. @subsection Examples
  11457. @itemize
  11458. @item
  11459. Rotate the input by PI/6 radians clockwise:
  11460. @example
  11461. rotate=PI/6
  11462. @end example
  11463. @item
  11464. Rotate the input by PI/6 radians counter-clockwise:
  11465. @example
  11466. rotate=-PI/6
  11467. @end example
  11468. @item
  11469. Rotate the input by 45 degrees clockwise:
  11470. @example
  11471. rotate=45*PI/180
  11472. @end example
  11473. @item
  11474. Apply a constant rotation with period T, starting from an angle of PI/3:
  11475. @example
  11476. rotate=PI/3+2*PI*t/T
  11477. @end example
  11478. @item
  11479. Make the input video rotation oscillating with a period of T
  11480. seconds and an amplitude of A radians:
  11481. @example
  11482. rotate=A*sin(2*PI/T*t)
  11483. @end example
  11484. @item
  11485. Rotate the video, output size is chosen so that the whole rotating
  11486. input video is always completely contained in the output:
  11487. @example
  11488. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11489. @end example
  11490. @item
  11491. Rotate the video, reduce the output size so that no background is ever
  11492. shown:
  11493. @example
  11494. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11495. @end example
  11496. @end itemize
  11497. @subsection Commands
  11498. The filter supports the following commands:
  11499. @table @option
  11500. @item a, angle
  11501. Set the angle expression.
  11502. The command accepts the same syntax of the corresponding option.
  11503. If the specified expression is not valid, it is kept at its current
  11504. value.
  11505. @end table
  11506. @section sab
  11507. Apply Shape Adaptive Blur.
  11508. The filter accepts the following options:
  11509. @table @option
  11510. @item luma_radius, lr
  11511. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11512. value is 1.0. A greater value will result in a more blurred image, and
  11513. in slower processing.
  11514. @item luma_pre_filter_radius, lpfr
  11515. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11516. value is 1.0.
  11517. @item luma_strength, ls
  11518. Set luma maximum difference between pixels to still be considered, must
  11519. be a value in the 0.1-100.0 range, default value is 1.0.
  11520. @item chroma_radius, cr
  11521. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11522. greater value will result in a more blurred image, and in slower
  11523. processing.
  11524. @item chroma_pre_filter_radius, cpfr
  11525. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11526. @item chroma_strength, cs
  11527. Set chroma maximum difference between pixels to still be considered,
  11528. must be a value in the -0.9-100.0 range.
  11529. @end table
  11530. Each chroma option value, if not explicitly specified, is set to the
  11531. corresponding luma option value.
  11532. @anchor{scale}
  11533. @section scale
  11534. Scale (resize) the input video, using the libswscale library.
  11535. The scale filter forces the output display aspect ratio to be the same
  11536. of the input, by changing the output sample aspect ratio.
  11537. If the input image format is different from the format requested by
  11538. the next filter, the scale filter will convert the input to the
  11539. requested format.
  11540. @subsection Options
  11541. The filter accepts the following options, or any of the options
  11542. supported by the libswscale scaler.
  11543. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11544. the complete list of scaler options.
  11545. @table @option
  11546. @item width, w
  11547. @item height, h
  11548. Set the output video dimension expression. Default value is the input
  11549. dimension.
  11550. If the @var{width} or @var{w} value is 0, the input width is used for
  11551. the output. If the @var{height} or @var{h} value is 0, the input height
  11552. is used for the output.
  11553. If one and only one of the values is -n with n >= 1, the scale filter
  11554. will use a value that maintains the aspect ratio of the input image,
  11555. calculated from the other specified dimension. After that it will,
  11556. however, make sure that the calculated dimension is divisible by n and
  11557. adjust the value if necessary.
  11558. If both values are -n with n >= 1, the behavior will be identical to
  11559. both values being set to 0 as previously detailed.
  11560. See below for the list of accepted constants for use in the dimension
  11561. expression.
  11562. @item eval
  11563. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11564. @table @samp
  11565. @item init
  11566. Only evaluate expressions once during the filter initialization or when a command is processed.
  11567. @item frame
  11568. Evaluate expressions for each incoming frame.
  11569. @end table
  11570. Default value is @samp{init}.
  11571. @item interl
  11572. Set the interlacing mode. It accepts the following values:
  11573. @table @samp
  11574. @item 1
  11575. Force interlaced aware scaling.
  11576. @item 0
  11577. Do not apply interlaced scaling.
  11578. @item -1
  11579. Select interlaced aware scaling depending on whether the source frames
  11580. are flagged as interlaced or not.
  11581. @end table
  11582. Default value is @samp{0}.
  11583. @item flags
  11584. Set libswscale scaling flags. See
  11585. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11586. complete list of values. If not explicitly specified the filter applies
  11587. the default flags.
  11588. @item param0, param1
  11589. Set libswscale input parameters for scaling algorithms that need them. See
  11590. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11591. complete documentation. If not explicitly specified the filter applies
  11592. empty parameters.
  11593. @item size, s
  11594. Set the video size. For the syntax of this option, check the
  11595. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11596. @item in_color_matrix
  11597. @item out_color_matrix
  11598. Set in/output YCbCr color space type.
  11599. This allows the autodetected value to be overridden as well as allows forcing
  11600. a specific value used for the output and encoder.
  11601. If not specified, the color space type depends on the pixel format.
  11602. Possible values:
  11603. @table @samp
  11604. @item auto
  11605. Choose automatically.
  11606. @item bt709
  11607. Format conforming to International Telecommunication Union (ITU)
  11608. Recommendation BT.709.
  11609. @item fcc
  11610. Set color space conforming to the United States Federal Communications
  11611. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11612. @item bt601
  11613. @item bt470
  11614. @item smpte170m
  11615. Set color space conforming to:
  11616. @itemize
  11617. @item
  11618. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11619. @item
  11620. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11621. @item
  11622. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11623. @end itemize
  11624. @item smpte240m
  11625. Set color space conforming to SMPTE ST 240:1999.
  11626. @item bt2020
  11627. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11628. @end table
  11629. @item in_range
  11630. @item out_range
  11631. Set in/output YCbCr sample range.
  11632. This allows the autodetected value to be overridden as well as allows forcing
  11633. a specific value used for the output and encoder. If not specified, the
  11634. range depends on the pixel format. Possible values:
  11635. @table @samp
  11636. @item auto/unknown
  11637. Choose automatically.
  11638. @item jpeg/full/pc
  11639. Set full range (0-255 in case of 8-bit luma).
  11640. @item mpeg/limited/tv
  11641. Set "MPEG" range (16-235 in case of 8-bit luma).
  11642. @end table
  11643. @item force_original_aspect_ratio
  11644. Enable decreasing or increasing output video width or height if necessary to
  11645. keep the original aspect ratio. Possible values:
  11646. @table @samp
  11647. @item disable
  11648. Scale the video as specified and disable this feature.
  11649. @item decrease
  11650. The output video dimensions will automatically be decreased if needed.
  11651. @item increase
  11652. The output video dimensions will automatically be increased if needed.
  11653. @end table
  11654. One useful instance of this option is that when you know a specific device's
  11655. maximum allowed resolution, you can use this to limit the output video to
  11656. that, while retaining the aspect ratio. For example, device A allows
  11657. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11658. decrease) and specifying 1280x720 to the command line makes the output
  11659. 1280x533.
  11660. Please note that this is a different thing than specifying -1 for @option{w}
  11661. or @option{h}, you still need to specify the output resolution for this option
  11662. to work.
  11663. @end table
  11664. The values of the @option{w} and @option{h} options are expressions
  11665. containing the following constants:
  11666. @table @var
  11667. @item in_w
  11668. @item in_h
  11669. The input width and height
  11670. @item iw
  11671. @item ih
  11672. These are the same as @var{in_w} and @var{in_h}.
  11673. @item out_w
  11674. @item out_h
  11675. The output (scaled) width and height
  11676. @item ow
  11677. @item oh
  11678. These are the same as @var{out_w} and @var{out_h}
  11679. @item a
  11680. The same as @var{iw} / @var{ih}
  11681. @item sar
  11682. input sample aspect ratio
  11683. @item dar
  11684. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11685. @item hsub
  11686. @item vsub
  11687. horizontal and vertical input chroma subsample values. For example for the
  11688. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11689. @item ohsub
  11690. @item ovsub
  11691. horizontal and vertical output chroma subsample values. For example for the
  11692. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11693. @end table
  11694. @subsection Examples
  11695. @itemize
  11696. @item
  11697. Scale the input video to a size of 200x100
  11698. @example
  11699. scale=w=200:h=100
  11700. @end example
  11701. This is equivalent to:
  11702. @example
  11703. scale=200:100
  11704. @end example
  11705. or:
  11706. @example
  11707. scale=200x100
  11708. @end example
  11709. @item
  11710. Specify a size abbreviation for the output size:
  11711. @example
  11712. scale=qcif
  11713. @end example
  11714. which can also be written as:
  11715. @example
  11716. scale=size=qcif
  11717. @end example
  11718. @item
  11719. Scale the input to 2x:
  11720. @example
  11721. scale=w=2*iw:h=2*ih
  11722. @end example
  11723. @item
  11724. The above is the same as:
  11725. @example
  11726. scale=2*in_w:2*in_h
  11727. @end example
  11728. @item
  11729. Scale the input to 2x with forced interlaced scaling:
  11730. @example
  11731. scale=2*iw:2*ih:interl=1
  11732. @end example
  11733. @item
  11734. Scale the input to half size:
  11735. @example
  11736. scale=w=iw/2:h=ih/2
  11737. @end example
  11738. @item
  11739. Increase the width, and set the height to the same size:
  11740. @example
  11741. scale=3/2*iw:ow
  11742. @end example
  11743. @item
  11744. Seek Greek harmony:
  11745. @example
  11746. scale=iw:1/PHI*iw
  11747. scale=ih*PHI:ih
  11748. @end example
  11749. @item
  11750. Increase the height, and set the width to 3/2 of the height:
  11751. @example
  11752. scale=w=3/2*oh:h=3/5*ih
  11753. @end example
  11754. @item
  11755. Increase the size, making the size a multiple of the chroma
  11756. subsample values:
  11757. @example
  11758. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11759. @end example
  11760. @item
  11761. Increase the width to a maximum of 500 pixels,
  11762. keeping the same aspect ratio as the input:
  11763. @example
  11764. scale=w='min(500\, iw*3/2):h=-1'
  11765. @end example
  11766. @item
  11767. Make pixels square by combining scale and setsar:
  11768. @example
  11769. scale='trunc(ih*dar):ih',setsar=1/1
  11770. @end example
  11771. @item
  11772. Make pixels square by combining scale and setsar,
  11773. making sure the resulting resolution is even (required by some codecs):
  11774. @example
  11775. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11776. @end example
  11777. @end itemize
  11778. @subsection Commands
  11779. This filter supports the following commands:
  11780. @table @option
  11781. @item width, w
  11782. @item height, h
  11783. Set the output video dimension expression.
  11784. The command accepts the same syntax of the corresponding option.
  11785. If the specified expression is not valid, it is kept at its current
  11786. value.
  11787. @end table
  11788. @section scale_npp
  11789. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11790. format conversion on CUDA video frames. Setting the output width and height
  11791. works in the same way as for the @var{scale} filter.
  11792. The following additional options are accepted:
  11793. @table @option
  11794. @item format
  11795. The pixel format of the output CUDA frames. If set to the string "same" (the
  11796. default), the input format will be kept. Note that automatic format negotiation
  11797. and conversion is not yet supported for hardware frames
  11798. @item interp_algo
  11799. The interpolation algorithm used for resizing. One of the following:
  11800. @table @option
  11801. @item nn
  11802. Nearest neighbour.
  11803. @item linear
  11804. @item cubic
  11805. @item cubic2p_bspline
  11806. 2-parameter cubic (B=1, C=0)
  11807. @item cubic2p_catmullrom
  11808. 2-parameter cubic (B=0, C=1/2)
  11809. @item cubic2p_b05c03
  11810. 2-parameter cubic (B=1/2, C=3/10)
  11811. @item super
  11812. Supersampling
  11813. @item lanczos
  11814. @end table
  11815. @end table
  11816. @section scale2ref
  11817. Scale (resize) the input video, based on a reference video.
  11818. See the scale filter for available options, scale2ref supports the same but
  11819. uses the reference video instead of the main input as basis. scale2ref also
  11820. supports the following additional constants for the @option{w} and
  11821. @option{h} options:
  11822. @table @var
  11823. @item main_w
  11824. @item main_h
  11825. The main input video's width and height
  11826. @item main_a
  11827. The same as @var{main_w} / @var{main_h}
  11828. @item main_sar
  11829. The main input video's sample aspect ratio
  11830. @item main_dar, mdar
  11831. The main input video's display aspect ratio. Calculated from
  11832. @code{(main_w / main_h) * main_sar}.
  11833. @item main_hsub
  11834. @item main_vsub
  11835. The main input video's horizontal and vertical chroma subsample values.
  11836. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11837. is 1.
  11838. @end table
  11839. @subsection Examples
  11840. @itemize
  11841. @item
  11842. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11843. @example
  11844. 'scale2ref[b][a];[a][b]overlay'
  11845. @end example
  11846. @item
  11847. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  11848. @example
  11849. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  11850. @end example
  11851. @end itemize
  11852. @anchor{selectivecolor}
  11853. @section selectivecolor
  11854. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11855. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11856. by the "purity" of the color (that is, how saturated it already is).
  11857. This filter is similar to the Adobe Photoshop Selective Color tool.
  11858. The filter accepts the following options:
  11859. @table @option
  11860. @item correction_method
  11861. Select color correction method.
  11862. Available values are:
  11863. @table @samp
  11864. @item absolute
  11865. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11866. component value).
  11867. @item relative
  11868. Specified adjustments are relative to the original component value.
  11869. @end table
  11870. Default is @code{absolute}.
  11871. @item reds
  11872. Adjustments for red pixels (pixels where the red component is the maximum)
  11873. @item yellows
  11874. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11875. @item greens
  11876. Adjustments for green pixels (pixels where the green component is the maximum)
  11877. @item cyans
  11878. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11879. @item blues
  11880. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11881. @item magentas
  11882. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11883. @item whites
  11884. Adjustments for white pixels (pixels where all components are greater than 128)
  11885. @item neutrals
  11886. Adjustments for all pixels except pure black and pure white
  11887. @item blacks
  11888. Adjustments for black pixels (pixels where all components are lesser than 128)
  11889. @item psfile
  11890. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11891. @end table
  11892. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11893. 4 space separated floating point adjustment values in the [-1,1] range,
  11894. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11895. pixels of its range.
  11896. @subsection Examples
  11897. @itemize
  11898. @item
  11899. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11900. increase magenta by 27% in blue areas:
  11901. @example
  11902. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11903. @end example
  11904. @item
  11905. Use a Photoshop selective color preset:
  11906. @example
  11907. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11908. @end example
  11909. @end itemize
  11910. @anchor{separatefields}
  11911. @section separatefields
  11912. The @code{separatefields} takes a frame-based video input and splits
  11913. each frame into its components fields, producing a new half height clip
  11914. with twice the frame rate and twice the frame count.
  11915. This filter use field-dominance information in frame to decide which
  11916. of each pair of fields to place first in the output.
  11917. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11918. @section setdar, setsar
  11919. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11920. output video.
  11921. This is done by changing the specified Sample (aka Pixel) Aspect
  11922. Ratio, according to the following equation:
  11923. @example
  11924. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11925. @end example
  11926. Keep in mind that the @code{setdar} filter does not modify the pixel
  11927. dimensions of the video frame. Also, the display aspect ratio set by
  11928. this filter may be changed by later filters in the filterchain,
  11929. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11930. applied.
  11931. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11932. the filter output video.
  11933. Note that as a consequence of the application of this filter, the
  11934. output display aspect ratio will change according to the equation
  11935. above.
  11936. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11937. filter may be changed by later filters in the filterchain, e.g. if
  11938. another "setsar" or a "setdar" filter is applied.
  11939. It accepts the following parameters:
  11940. @table @option
  11941. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11942. Set the aspect ratio used by the filter.
  11943. The parameter can be a floating point number string, an expression, or
  11944. a string of the form @var{num}:@var{den}, where @var{num} and
  11945. @var{den} are the numerator and denominator of the aspect ratio. If
  11946. the parameter is not specified, it is assumed the value "0".
  11947. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11948. should be escaped.
  11949. @item max
  11950. Set the maximum integer value to use for expressing numerator and
  11951. denominator when reducing the expressed aspect ratio to a rational.
  11952. Default value is @code{100}.
  11953. @end table
  11954. The parameter @var{sar} is an expression containing
  11955. the following constants:
  11956. @table @option
  11957. @item E, PI, PHI
  11958. These are approximated values for the mathematical constants e
  11959. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11960. @item w, h
  11961. The input width and height.
  11962. @item a
  11963. These are the same as @var{w} / @var{h}.
  11964. @item sar
  11965. The input sample aspect ratio.
  11966. @item dar
  11967. The input display aspect ratio. It is the same as
  11968. (@var{w} / @var{h}) * @var{sar}.
  11969. @item hsub, vsub
  11970. Horizontal and vertical chroma subsample values. For example, for the
  11971. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11972. @end table
  11973. @subsection Examples
  11974. @itemize
  11975. @item
  11976. To change the display aspect ratio to 16:9, specify one of the following:
  11977. @example
  11978. setdar=dar=1.77777
  11979. setdar=dar=16/9
  11980. @end example
  11981. @item
  11982. To change the sample aspect ratio to 10:11, specify:
  11983. @example
  11984. setsar=sar=10/11
  11985. @end example
  11986. @item
  11987. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11988. 1000 in the aspect ratio reduction, use the command:
  11989. @example
  11990. setdar=ratio=16/9:max=1000
  11991. @end example
  11992. @end itemize
  11993. @anchor{setfield}
  11994. @section setfield
  11995. Force field for the output video frame.
  11996. The @code{setfield} filter marks the interlace type field for the
  11997. output frames. It does not change the input frame, but only sets the
  11998. corresponding property, which affects how the frame is treated by
  11999. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12000. The filter accepts the following options:
  12001. @table @option
  12002. @item mode
  12003. Available values are:
  12004. @table @samp
  12005. @item auto
  12006. Keep the same field property.
  12007. @item bff
  12008. Mark the frame as bottom-field-first.
  12009. @item tff
  12010. Mark the frame as top-field-first.
  12011. @item prog
  12012. Mark the frame as progressive.
  12013. @end table
  12014. @end table
  12015. @anchor{setparams}
  12016. @section setparams
  12017. Force frame parameter for the output video frame.
  12018. The @code{setparams} filter marks interlace and color range for the
  12019. output frames. It does not change the input frame, but only sets the
  12020. corresponding property, which affects how the frame is treated by
  12021. filters/encoders.
  12022. @table @option
  12023. @item field_mode
  12024. Available values are:
  12025. @table @samp
  12026. @item auto
  12027. Keep the same field property (default).
  12028. @item bff
  12029. Mark the frame as bottom-field-first.
  12030. @item tff
  12031. Mark the frame as top-field-first.
  12032. @item prog
  12033. Mark the frame as progressive.
  12034. @end table
  12035. @item range
  12036. Available values are:
  12037. @table @samp
  12038. @item auto
  12039. Keep the same color range property (default).
  12040. @item unspecified, unknown
  12041. Mark the frame as unspecified color range.
  12042. @item limited, tv, mpeg
  12043. Mark the frame as limited range.
  12044. @item full, pc, jpeg
  12045. Mark the frame as full range.
  12046. @end table
  12047. @item color_primaries
  12048. Set the color primaries.
  12049. Available values are:
  12050. @table @samp
  12051. @item auto
  12052. Keep the same color primaries property (default).
  12053. @item bt709
  12054. @item unknown
  12055. @item bt470m
  12056. @item bt470bg
  12057. @item smpte170m
  12058. @item smpte240m
  12059. @item film
  12060. @item bt2020
  12061. @item smpte428
  12062. @item smpte431
  12063. @item smpte432
  12064. @item jedec-p22
  12065. @end table
  12066. @item color_trc
  12067. Set the color transfer.
  12068. Available values are:
  12069. @table @samp
  12070. @item auto
  12071. Keep the same color trc property (default).
  12072. @item bt709
  12073. @item unknown
  12074. @item bt470m
  12075. @item bt470bg
  12076. @item smpte170m
  12077. @item smpte240m
  12078. @item linear
  12079. @item log100
  12080. @item log316
  12081. @item iec61966-2-4
  12082. @item bt1361e
  12083. @item iec61966-2-1
  12084. @item bt2020-10
  12085. @item bt2020-12
  12086. @item smpte2084
  12087. @item smpte428
  12088. @item arib-std-b67
  12089. @end table
  12090. @item colorspace
  12091. Set the colorspace.
  12092. Available values are:
  12093. @table @samp
  12094. @item auto
  12095. Keep the same colorspace property (default).
  12096. @item gbr
  12097. @item bt709
  12098. @item unknown
  12099. @item fcc
  12100. @item bt470bg
  12101. @item smpte170m
  12102. @item smpte240m
  12103. @item ycgco
  12104. @item bt2020nc
  12105. @item bt2020c
  12106. @item smpte2085
  12107. @item chroma-derived-nc
  12108. @item chroma-derived-c
  12109. @item ictcp
  12110. @end table
  12111. @end table
  12112. @section showinfo
  12113. Show a line containing various information for each input video frame.
  12114. The input video is not modified.
  12115. This filter supports the following options:
  12116. @table @option
  12117. @item checksum
  12118. Calculate checksums of each plane. By default enabled.
  12119. @end table
  12120. The shown line contains a sequence of key/value pairs of the form
  12121. @var{key}:@var{value}.
  12122. The following values are shown in the output:
  12123. @table @option
  12124. @item n
  12125. The (sequential) number of the input frame, starting from 0.
  12126. @item pts
  12127. The Presentation TimeStamp of the input frame, expressed as a number of
  12128. time base units. The time base unit depends on the filter input pad.
  12129. @item pts_time
  12130. The Presentation TimeStamp of the input frame, expressed as a number of
  12131. seconds.
  12132. @item pos
  12133. The position of the frame in the input stream, or -1 if this information is
  12134. unavailable and/or meaningless (for example in case of synthetic video).
  12135. @item fmt
  12136. The pixel format name.
  12137. @item sar
  12138. The sample aspect ratio of the input frame, expressed in the form
  12139. @var{num}/@var{den}.
  12140. @item s
  12141. The size of the input frame. For the syntax of this option, check the
  12142. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12143. @item i
  12144. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12145. for bottom field first).
  12146. @item iskey
  12147. This is 1 if the frame is a key frame, 0 otherwise.
  12148. @item type
  12149. The picture type of the input frame ("I" for an I-frame, "P" for a
  12150. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12151. Also refer to the documentation of the @code{AVPictureType} enum and of
  12152. the @code{av_get_picture_type_char} function defined in
  12153. @file{libavutil/avutil.h}.
  12154. @item checksum
  12155. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12156. @item plane_checksum
  12157. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12158. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12159. @end table
  12160. @section showpalette
  12161. Displays the 256 colors palette of each frame. This filter is only relevant for
  12162. @var{pal8} pixel format frames.
  12163. It accepts the following option:
  12164. @table @option
  12165. @item s
  12166. Set the size of the box used to represent one palette color entry. Default is
  12167. @code{30} (for a @code{30x30} pixel box).
  12168. @end table
  12169. @section shuffleframes
  12170. Reorder and/or duplicate and/or drop video frames.
  12171. It accepts the following parameters:
  12172. @table @option
  12173. @item mapping
  12174. Set the destination indexes of input frames.
  12175. This is space or '|' separated list of indexes that maps input frames to output
  12176. frames. Number of indexes also sets maximal value that each index may have.
  12177. '-1' index have special meaning and that is to drop frame.
  12178. @end table
  12179. The first frame has the index 0. The default is to keep the input unchanged.
  12180. @subsection Examples
  12181. @itemize
  12182. @item
  12183. Swap second and third frame of every three frames of the input:
  12184. @example
  12185. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12186. @end example
  12187. @item
  12188. Swap 10th and 1st frame of every ten frames of the input:
  12189. @example
  12190. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12191. @end example
  12192. @end itemize
  12193. @section shuffleplanes
  12194. Reorder and/or duplicate video planes.
  12195. It accepts the following parameters:
  12196. @table @option
  12197. @item map0
  12198. The index of the input plane to be used as the first output plane.
  12199. @item map1
  12200. The index of the input plane to be used as the second output plane.
  12201. @item map2
  12202. The index of the input plane to be used as the third output plane.
  12203. @item map3
  12204. The index of the input plane to be used as the fourth output plane.
  12205. @end table
  12206. The first plane has the index 0. The default is to keep the input unchanged.
  12207. @subsection Examples
  12208. @itemize
  12209. @item
  12210. Swap the second and third planes of the input:
  12211. @example
  12212. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12213. @end example
  12214. @end itemize
  12215. @anchor{signalstats}
  12216. @section signalstats
  12217. Evaluate various visual metrics that assist in determining issues associated
  12218. with the digitization of analog video media.
  12219. By default the filter will log these metadata values:
  12220. @table @option
  12221. @item YMIN
  12222. Display the minimal Y value contained within the input frame. Expressed in
  12223. range of [0-255].
  12224. @item YLOW
  12225. Display the Y value at the 10% percentile within the input frame. Expressed in
  12226. range of [0-255].
  12227. @item YAVG
  12228. Display the average Y value within the input frame. Expressed in range of
  12229. [0-255].
  12230. @item YHIGH
  12231. Display the Y value at the 90% percentile within the input frame. Expressed in
  12232. range of [0-255].
  12233. @item YMAX
  12234. Display the maximum Y value contained within the input frame. Expressed in
  12235. range of [0-255].
  12236. @item UMIN
  12237. Display the minimal U value contained within the input frame. Expressed in
  12238. range of [0-255].
  12239. @item ULOW
  12240. Display the U value at the 10% percentile within the input frame. Expressed in
  12241. range of [0-255].
  12242. @item UAVG
  12243. Display the average U value within the input frame. Expressed in range of
  12244. [0-255].
  12245. @item UHIGH
  12246. Display the U value at the 90% percentile within the input frame. Expressed in
  12247. range of [0-255].
  12248. @item UMAX
  12249. Display the maximum U value contained within the input frame. Expressed in
  12250. range of [0-255].
  12251. @item VMIN
  12252. Display the minimal V value contained within the input frame. Expressed in
  12253. range of [0-255].
  12254. @item VLOW
  12255. Display the V value at the 10% percentile within the input frame. Expressed in
  12256. range of [0-255].
  12257. @item VAVG
  12258. Display the average V value within the input frame. Expressed in range of
  12259. [0-255].
  12260. @item VHIGH
  12261. Display the V value at the 90% percentile within the input frame. Expressed in
  12262. range of [0-255].
  12263. @item VMAX
  12264. Display the maximum V value contained within the input frame. Expressed in
  12265. range of [0-255].
  12266. @item SATMIN
  12267. Display the minimal saturation value contained within the input frame.
  12268. Expressed in range of [0-~181.02].
  12269. @item SATLOW
  12270. Display the saturation value at the 10% percentile within the input frame.
  12271. Expressed in range of [0-~181.02].
  12272. @item SATAVG
  12273. Display the average saturation value within the input frame. Expressed in range
  12274. of [0-~181.02].
  12275. @item SATHIGH
  12276. Display the saturation value at the 90% percentile within the input frame.
  12277. Expressed in range of [0-~181.02].
  12278. @item SATMAX
  12279. Display the maximum saturation value contained within the input frame.
  12280. Expressed in range of [0-~181.02].
  12281. @item HUEMED
  12282. Display the median value for hue within the input frame. Expressed in range of
  12283. [0-360].
  12284. @item HUEAVG
  12285. Display the average value for hue within the input frame. Expressed in range of
  12286. [0-360].
  12287. @item YDIF
  12288. Display the average of sample value difference between all values of the Y
  12289. plane in the current frame and corresponding values of the previous input frame.
  12290. Expressed in range of [0-255].
  12291. @item UDIF
  12292. Display the average of sample value difference between all values of the U
  12293. plane in the current frame and corresponding values of the previous input frame.
  12294. Expressed in range of [0-255].
  12295. @item VDIF
  12296. Display the average of sample value difference between all values of the V
  12297. plane in the current frame and corresponding values of the previous input frame.
  12298. Expressed in range of [0-255].
  12299. @item YBITDEPTH
  12300. Display bit depth of Y plane in current frame.
  12301. Expressed in range of [0-16].
  12302. @item UBITDEPTH
  12303. Display bit depth of U plane in current frame.
  12304. Expressed in range of [0-16].
  12305. @item VBITDEPTH
  12306. Display bit depth of V plane in current frame.
  12307. Expressed in range of [0-16].
  12308. @end table
  12309. The filter accepts the following options:
  12310. @table @option
  12311. @item stat
  12312. @item out
  12313. @option{stat} specify an additional form of image analysis.
  12314. @option{out} output video with the specified type of pixel highlighted.
  12315. Both options accept the following values:
  12316. @table @samp
  12317. @item tout
  12318. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12319. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12320. include the results of video dropouts, head clogs, or tape tracking issues.
  12321. @item vrep
  12322. Identify @var{vertical line repetition}. Vertical line repetition includes
  12323. similar rows of pixels within a frame. In born-digital video vertical line
  12324. repetition is common, but this pattern is uncommon in video digitized from an
  12325. analog source. When it occurs in video that results from the digitization of an
  12326. analog source it can indicate concealment from a dropout compensator.
  12327. @item brng
  12328. Identify pixels that fall outside of legal broadcast range.
  12329. @end table
  12330. @item color, c
  12331. Set the highlight color for the @option{out} option. The default color is
  12332. yellow.
  12333. @end table
  12334. @subsection Examples
  12335. @itemize
  12336. @item
  12337. Output data of various video metrics:
  12338. @example
  12339. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12340. @end example
  12341. @item
  12342. Output specific data about the minimum and maximum values of the Y plane per frame:
  12343. @example
  12344. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12345. @end example
  12346. @item
  12347. Playback video while highlighting pixels that are outside of broadcast range in red.
  12348. @example
  12349. ffplay example.mov -vf signalstats="out=brng:color=red"
  12350. @end example
  12351. @item
  12352. Playback video with signalstats metadata drawn over the frame.
  12353. @example
  12354. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12355. @end example
  12356. The contents of signalstat_drawtext.txt used in the command are:
  12357. @example
  12358. time %@{pts:hms@}
  12359. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12360. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12361. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12362. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12363. @end example
  12364. @end itemize
  12365. @anchor{signature}
  12366. @section signature
  12367. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12368. input. In this case the matching between the inputs can be calculated additionally.
  12369. The filter always passes through the first input. The signature of each stream can
  12370. be written into a file.
  12371. It accepts the following options:
  12372. @table @option
  12373. @item detectmode
  12374. Enable or disable the matching process.
  12375. Available values are:
  12376. @table @samp
  12377. @item off
  12378. Disable the calculation of a matching (default).
  12379. @item full
  12380. Calculate the matching for the whole video and output whether the whole video
  12381. matches or only parts.
  12382. @item fast
  12383. Calculate only until a matching is found or the video ends. Should be faster in
  12384. some cases.
  12385. @end table
  12386. @item nb_inputs
  12387. Set the number of inputs. The option value must be a non negative integer.
  12388. Default value is 1.
  12389. @item filename
  12390. Set the path to which the output is written. If there is more than one input,
  12391. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12392. integer), that will be replaced with the input number. If no filename is
  12393. specified, no output will be written. This is the default.
  12394. @item format
  12395. Choose the output format.
  12396. Available values are:
  12397. @table @samp
  12398. @item binary
  12399. Use the specified binary representation (default).
  12400. @item xml
  12401. Use the specified xml representation.
  12402. @end table
  12403. @item th_d
  12404. Set threshold to detect one word as similar. The option value must be an integer
  12405. greater than zero. The default value is 9000.
  12406. @item th_dc
  12407. Set threshold to detect all words as similar. The option value must be an integer
  12408. greater than zero. The default value is 60000.
  12409. @item th_xh
  12410. Set threshold to detect frames as similar. The option value must be an integer
  12411. greater than zero. The default value is 116.
  12412. @item th_di
  12413. Set the minimum length of a sequence in frames to recognize it as matching
  12414. sequence. The option value must be a non negative integer value.
  12415. The default value is 0.
  12416. @item th_it
  12417. Set the minimum relation, that matching frames to all frames must have.
  12418. The option value must be a double value between 0 and 1. The default value is 0.5.
  12419. @end table
  12420. @subsection Examples
  12421. @itemize
  12422. @item
  12423. To calculate the signature of an input video and store it in signature.bin:
  12424. @example
  12425. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12426. @end example
  12427. @item
  12428. To detect whether two videos match and store the signatures in XML format in
  12429. signature0.xml and signature1.xml:
  12430. @example
  12431. 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 -
  12432. @end example
  12433. @end itemize
  12434. @anchor{smartblur}
  12435. @section smartblur
  12436. Blur the input video without impacting the outlines.
  12437. It accepts the following options:
  12438. @table @option
  12439. @item luma_radius, lr
  12440. Set the luma radius. The option value must be a float number in
  12441. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12442. used to blur the image (slower if larger). Default value is 1.0.
  12443. @item luma_strength, ls
  12444. Set the luma strength. The option value must be a float number
  12445. in the range [-1.0,1.0] that configures the blurring. A value included
  12446. in [0.0,1.0] will blur the image whereas a value included in
  12447. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12448. @item luma_threshold, lt
  12449. Set the luma threshold used as a coefficient to determine
  12450. whether a pixel should be blurred or not. The option value must be an
  12451. integer in the range [-30,30]. A value of 0 will filter all the image,
  12452. a value included in [0,30] will filter flat areas and a value included
  12453. in [-30,0] will filter edges. Default value is 0.
  12454. @item chroma_radius, cr
  12455. Set the chroma radius. The option value must be a float number in
  12456. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12457. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12458. @item chroma_strength, cs
  12459. Set the chroma strength. The option value must be a float number
  12460. in the range [-1.0,1.0] that configures the blurring. A value included
  12461. in [0.0,1.0] will blur the image whereas a value included in
  12462. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12463. @item chroma_threshold, ct
  12464. Set the chroma threshold used as a coefficient to determine
  12465. whether a pixel should be blurred or not. The option value must be an
  12466. integer in the range [-30,30]. A value of 0 will filter all the image,
  12467. a value included in [0,30] will filter flat areas and a value included
  12468. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12469. @end table
  12470. If a chroma option is not explicitly set, the corresponding luma value
  12471. is set.
  12472. @section ssim
  12473. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12474. This filter takes in input two input videos, the first input is
  12475. considered the "main" source and is passed unchanged to the
  12476. output. The second input is used as a "reference" video for computing
  12477. the SSIM.
  12478. Both video inputs must have the same resolution and pixel format for
  12479. this filter to work correctly. Also it assumes that both inputs
  12480. have the same number of frames, which are compared one by one.
  12481. The filter stores the calculated SSIM of each frame.
  12482. The description of the accepted parameters follows.
  12483. @table @option
  12484. @item stats_file, f
  12485. If specified the filter will use the named file to save the SSIM of
  12486. each individual frame. When filename equals "-" the data is sent to
  12487. standard output.
  12488. @end table
  12489. The file printed if @var{stats_file} is selected, contains a sequence of
  12490. key/value pairs of the form @var{key}:@var{value} for each compared
  12491. couple of frames.
  12492. A description of each shown parameter follows:
  12493. @table @option
  12494. @item n
  12495. sequential number of the input frame, starting from 1
  12496. @item Y, U, V, R, G, B
  12497. SSIM of the compared frames for the component specified by the suffix.
  12498. @item All
  12499. SSIM of the compared frames for the whole frame.
  12500. @item dB
  12501. Same as above but in dB representation.
  12502. @end table
  12503. This filter also supports the @ref{framesync} options.
  12504. For example:
  12505. @example
  12506. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12507. [main][ref] ssim="stats_file=stats.log" [out]
  12508. @end example
  12509. On this example the input file being processed is compared with the
  12510. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12511. is stored in @file{stats.log}.
  12512. Another example with both psnr and ssim at same time:
  12513. @example
  12514. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12515. @end example
  12516. @section stereo3d
  12517. Convert between different stereoscopic image formats.
  12518. The filters accept the following options:
  12519. @table @option
  12520. @item in
  12521. Set stereoscopic image format of input.
  12522. Available values for input image formats are:
  12523. @table @samp
  12524. @item sbsl
  12525. side by side parallel (left eye left, right eye right)
  12526. @item sbsr
  12527. side by side crosseye (right eye left, left eye right)
  12528. @item sbs2l
  12529. side by side parallel with half width resolution
  12530. (left eye left, right eye right)
  12531. @item sbs2r
  12532. side by side crosseye with half width resolution
  12533. (right eye left, left eye right)
  12534. @item abl
  12535. above-below (left eye above, right eye below)
  12536. @item abr
  12537. above-below (right eye above, left eye below)
  12538. @item ab2l
  12539. above-below with half height resolution
  12540. (left eye above, right eye below)
  12541. @item ab2r
  12542. above-below with half height resolution
  12543. (right eye above, left eye below)
  12544. @item al
  12545. alternating frames (left eye first, right eye second)
  12546. @item ar
  12547. alternating frames (right eye first, left eye second)
  12548. @item irl
  12549. interleaved rows (left eye has top row, right eye starts on next row)
  12550. @item irr
  12551. interleaved rows (right eye has top row, left eye starts on next row)
  12552. @item icl
  12553. interleaved columns, left eye first
  12554. @item icr
  12555. interleaved columns, right eye first
  12556. Default value is @samp{sbsl}.
  12557. @end table
  12558. @item out
  12559. Set stereoscopic image format of output.
  12560. @table @samp
  12561. @item sbsl
  12562. side by side parallel (left eye left, right eye right)
  12563. @item sbsr
  12564. side by side crosseye (right eye left, left eye right)
  12565. @item sbs2l
  12566. side by side parallel with half width resolution
  12567. (left eye left, right eye right)
  12568. @item sbs2r
  12569. side by side crosseye with half width resolution
  12570. (right eye left, left eye right)
  12571. @item abl
  12572. above-below (left eye above, right eye below)
  12573. @item abr
  12574. above-below (right eye above, left eye below)
  12575. @item ab2l
  12576. above-below with half height resolution
  12577. (left eye above, right eye below)
  12578. @item ab2r
  12579. above-below with half height resolution
  12580. (right eye above, left eye below)
  12581. @item al
  12582. alternating frames (left eye first, right eye second)
  12583. @item ar
  12584. alternating frames (right eye first, left eye second)
  12585. @item irl
  12586. interleaved rows (left eye has top row, right eye starts on next row)
  12587. @item irr
  12588. interleaved rows (right eye has top row, left eye starts on next row)
  12589. @item arbg
  12590. anaglyph red/blue gray
  12591. (red filter on left eye, blue filter on right eye)
  12592. @item argg
  12593. anaglyph red/green gray
  12594. (red filter on left eye, green filter on right eye)
  12595. @item arcg
  12596. anaglyph red/cyan gray
  12597. (red filter on left eye, cyan filter on right eye)
  12598. @item arch
  12599. anaglyph red/cyan half colored
  12600. (red filter on left eye, cyan filter on right eye)
  12601. @item arcc
  12602. anaglyph red/cyan color
  12603. (red filter on left eye, cyan filter on right eye)
  12604. @item arcd
  12605. anaglyph red/cyan color optimized with the least squares projection of dubois
  12606. (red filter on left eye, cyan filter on right eye)
  12607. @item agmg
  12608. anaglyph green/magenta gray
  12609. (green filter on left eye, magenta filter on right eye)
  12610. @item agmh
  12611. anaglyph green/magenta half colored
  12612. (green filter on left eye, magenta filter on right eye)
  12613. @item agmc
  12614. anaglyph green/magenta colored
  12615. (green filter on left eye, magenta filter on right eye)
  12616. @item agmd
  12617. anaglyph green/magenta color optimized with the least squares projection of dubois
  12618. (green filter on left eye, magenta filter on right eye)
  12619. @item aybg
  12620. anaglyph yellow/blue gray
  12621. (yellow filter on left eye, blue filter on right eye)
  12622. @item aybh
  12623. anaglyph yellow/blue half colored
  12624. (yellow filter on left eye, blue filter on right eye)
  12625. @item aybc
  12626. anaglyph yellow/blue colored
  12627. (yellow filter on left eye, blue filter on right eye)
  12628. @item aybd
  12629. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12630. (yellow filter on left eye, blue filter on right eye)
  12631. @item ml
  12632. mono output (left eye only)
  12633. @item mr
  12634. mono output (right eye only)
  12635. @item chl
  12636. checkerboard, left eye first
  12637. @item chr
  12638. checkerboard, right eye first
  12639. @item icl
  12640. interleaved columns, left eye first
  12641. @item icr
  12642. interleaved columns, right eye first
  12643. @item hdmi
  12644. HDMI frame pack
  12645. @end table
  12646. Default value is @samp{arcd}.
  12647. @end table
  12648. @subsection Examples
  12649. @itemize
  12650. @item
  12651. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12652. @example
  12653. stereo3d=sbsl:aybd
  12654. @end example
  12655. @item
  12656. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12657. @example
  12658. stereo3d=abl:sbsr
  12659. @end example
  12660. @end itemize
  12661. @section streamselect, astreamselect
  12662. Select video or audio streams.
  12663. The filter accepts the following options:
  12664. @table @option
  12665. @item inputs
  12666. Set number of inputs. Default is 2.
  12667. @item map
  12668. Set input indexes to remap to outputs.
  12669. @end table
  12670. @subsection Commands
  12671. The @code{streamselect} and @code{astreamselect} filter supports the following
  12672. commands:
  12673. @table @option
  12674. @item map
  12675. Set input indexes to remap to outputs.
  12676. @end table
  12677. @subsection Examples
  12678. @itemize
  12679. @item
  12680. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12681. @example
  12682. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12683. @end example
  12684. @item
  12685. Same as above, but for audio:
  12686. @example
  12687. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12688. @end example
  12689. @end itemize
  12690. @section sobel
  12691. Apply sobel operator to input video stream.
  12692. The filter accepts the following option:
  12693. @table @option
  12694. @item planes
  12695. Set which planes will be processed, unprocessed planes will be copied.
  12696. By default value 0xf, all planes will be processed.
  12697. @item scale
  12698. Set value which will be multiplied with filtered result.
  12699. @item delta
  12700. Set value which will be added to filtered result.
  12701. @end table
  12702. @anchor{spp}
  12703. @section spp
  12704. Apply a simple postprocessing filter that compresses and decompresses the image
  12705. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12706. and average the results.
  12707. The filter accepts the following options:
  12708. @table @option
  12709. @item quality
  12710. Set quality. This option defines the number of levels for averaging. It accepts
  12711. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12712. effect. A value of @code{6} means the higher quality. For each increment of
  12713. that value the speed drops by a factor of approximately 2. Default value is
  12714. @code{3}.
  12715. @item qp
  12716. Force a constant quantization parameter. If not set, the filter will use the QP
  12717. from the video stream (if available).
  12718. @item mode
  12719. Set thresholding mode. Available modes are:
  12720. @table @samp
  12721. @item hard
  12722. Set hard thresholding (default).
  12723. @item soft
  12724. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12725. @end table
  12726. @item use_bframe_qp
  12727. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12728. option may cause flicker since the B-Frames have often larger QP. Default is
  12729. @code{0} (not enabled).
  12730. @end table
  12731. @section sr
  12732. Scale the input by applying one of the super-resolution methods based on
  12733. convolutional neural networks. Supported models:
  12734. @itemize
  12735. @item
  12736. Super-Resolution Convolutional Neural Network model (SRCNN).
  12737. See @url{https://arxiv.org/abs/1501.00092}.
  12738. @item
  12739. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12740. See @url{https://arxiv.org/abs/1609.05158}.
  12741. @end itemize
  12742. Training scripts as well as scripts for model file (.pb) saving can be found at
  12743. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12744. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12745. Native model files (.model) can be generated from TensorFlow model
  12746. files (.pb) by using tools/python/convert.py
  12747. The filter accepts the following options:
  12748. @table @option
  12749. @item dnn_backend
  12750. Specify which DNN backend to use for model loading and execution. This option accepts
  12751. the following values:
  12752. @table @samp
  12753. @item native
  12754. Native implementation of DNN loading and execution.
  12755. @item tensorflow
  12756. TensorFlow backend. To enable this backend you
  12757. need to install the TensorFlow for C library (see
  12758. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12759. @code{--enable-libtensorflow}
  12760. @end table
  12761. Default value is @samp{native}.
  12762. @item model
  12763. Set path to model file specifying network architecture and its parameters.
  12764. Note that different backends use different file formats. TensorFlow backend
  12765. can load files for both formats, while native backend can load files for only
  12766. its format.
  12767. @item scale_factor
  12768. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12769. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12770. input upscaled using bicubic upscaling with proper scale factor.
  12771. @end table
  12772. @anchor{subtitles}
  12773. @section subtitles
  12774. Draw subtitles on top of input video using the libass library.
  12775. To enable compilation of this filter you need to configure FFmpeg with
  12776. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12777. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12778. Alpha) subtitles format.
  12779. The filter accepts the following options:
  12780. @table @option
  12781. @item filename, f
  12782. Set the filename of the subtitle file to read. It must be specified.
  12783. @item original_size
  12784. Specify the size of the original video, the video for which the ASS file
  12785. was composed. For the syntax of this option, check the
  12786. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12787. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12788. correctly scale the fonts if the aspect ratio has been changed.
  12789. @item fontsdir
  12790. Set a directory path containing fonts that can be used by the filter.
  12791. These fonts will be used in addition to whatever the font provider uses.
  12792. @item alpha
  12793. Process alpha channel, by default alpha channel is untouched.
  12794. @item charenc
  12795. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12796. useful if not UTF-8.
  12797. @item stream_index, si
  12798. Set subtitles stream index. @code{subtitles} filter only.
  12799. @item force_style
  12800. Override default style or script info parameters of the subtitles. It accepts a
  12801. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12802. @end table
  12803. If the first key is not specified, it is assumed that the first value
  12804. specifies the @option{filename}.
  12805. For example, to render the file @file{sub.srt} on top of the input
  12806. video, use the command:
  12807. @example
  12808. subtitles=sub.srt
  12809. @end example
  12810. which is equivalent to:
  12811. @example
  12812. subtitles=filename=sub.srt
  12813. @end example
  12814. To render the default subtitles stream from file @file{video.mkv}, use:
  12815. @example
  12816. subtitles=video.mkv
  12817. @end example
  12818. To render the second subtitles stream from that file, use:
  12819. @example
  12820. subtitles=video.mkv:si=1
  12821. @end example
  12822. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12823. @code{DejaVu Serif}, use:
  12824. @example
  12825. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12826. @end example
  12827. @section super2xsai
  12828. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12829. Interpolate) pixel art scaling algorithm.
  12830. Useful for enlarging pixel art images without reducing sharpness.
  12831. @section swaprect
  12832. Swap two rectangular objects in video.
  12833. This filter accepts the following options:
  12834. @table @option
  12835. @item w
  12836. Set object width.
  12837. @item h
  12838. Set object height.
  12839. @item x1
  12840. Set 1st rect x coordinate.
  12841. @item y1
  12842. Set 1st rect y coordinate.
  12843. @item x2
  12844. Set 2nd rect x coordinate.
  12845. @item y2
  12846. Set 2nd rect y coordinate.
  12847. All expressions are evaluated once for each frame.
  12848. @end table
  12849. The all options are expressions containing the following constants:
  12850. @table @option
  12851. @item w
  12852. @item h
  12853. The input width and height.
  12854. @item a
  12855. same as @var{w} / @var{h}
  12856. @item sar
  12857. input sample aspect ratio
  12858. @item dar
  12859. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12860. @item n
  12861. The number of the input frame, starting from 0.
  12862. @item t
  12863. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12864. @item pos
  12865. the position in the file of the input frame, NAN if unknown
  12866. @end table
  12867. @section swapuv
  12868. Swap U & V plane.
  12869. @section telecine
  12870. Apply telecine process to the video.
  12871. This filter accepts the following options:
  12872. @table @option
  12873. @item first_field
  12874. @table @samp
  12875. @item top, t
  12876. top field first
  12877. @item bottom, b
  12878. bottom field first
  12879. The default value is @code{top}.
  12880. @end table
  12881. @item pattern
  12882. A string of numbers representing the pulldown pattern you wish to apply.
  12883. The default value is @code{23}.
  12884. @end table
  12885. @example
  12886. Some typical patterns:
  12887. NTSC output (30i):
  12888. 27.5p: 32222
  12889. 24p: 23 (classic)
  12890. 24p: 2332 (preferred)
  12891. 20p: 33
  12892. 18p: 334
  12893. 16p: 3444
  12894. PAL output (25i):
  12895. 27.5p: 12222
  12896. 24p: 222222222223 ("Euro pulldown")
  12897. 16.67p: 33
  12898. 16p: 33333334
  12899. @end example
  12900. @section threshold
  12901. Apply threshold effect to video stream.
  12902. This filter needs four video streams to perform thresholding.
  12903. First stream is stream we are filtering.
  12904. Second stream is holding threshold values, third stream is holding min values,
  12905. and last, fourth stream is holding max values.
  12906. The filter accepts the following option:
  12907. @table @option
  12908. @item planes
  12909. Set which planes will be processed, unprocessed planes will be copied.
  12910. By default value 0xf, all planes will be processed.
  12911. @end table
  12912. For example if first stream pixel's component value is less then threshold value
  12913. of pixel component from 2nd threshold stream, third stream value will picked,
  12914. otherwise fourth stream pixel component value will be picked.
  12915. Using color source filter one can perform various types of thresholding:
  12916. @subsection Examples
  12917. @itemize
  12918. @item
  12919. Binary threshold, using gray color as threshold:
  12920. @example
  12921. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12922. @end example
  12923. @item
  12924. Inverted binary threshold, using gray color as threshold:
  12925. @example
  12926. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12927. @end example
  12928. @item
  12929. Truncate binary threshold, using gray color as threshold:
  12930. @example
  12931. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12932. @end example
  12933. @item
  12934. Threshold to zero, using gray color as threshold:
  12935. @example
  12936. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12937. @end example
  12938. @item
  12939. Inverted threshold to zero, using gray color as threshold:
  12940. @example
  12941. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12942. @end example
  12943. @end itemize
  12944. @section thumbnail
  12945. Select the most representative frame in a given sequence of consecutive frames.
  12946. The filter accepts the following options:
  12947. @table @option
  12948. @item n
  12949. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12950. will pick one of them, and then handle the next batch of @var{n} frames until
  12951. the end. Default is @code{100}.
  12952. @end table
  12953. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12954. value will result in a higher memory usage, so a high value is not recommended.
  12955. @subsection Examples
  12956. @itemize
  12957. @item
  12958. Extract one picture each 50 frames:
  12959. @example
  12960. thumbnail=50
  12961. @end example
  12962. @item
  12963. Complete example of a thumbnail creation with @command{ffmpeg}:
  12964. @example
  12965. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12966. @end example
  12967. @end itemize
  12968. @section tile
  12969. Tile several successive frames together.
  12970. The filter accepts the following options:
  12971. @table @option
  12972. @item layout
  12973. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12974. this option, check the
  12975. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12976. @item nb_frames
  12977. Set the maximum number of frames to render in the given area. It must be less
  12978. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12979. the area will be used.
  12980. @item margin
  12981. Set the outer border margin in pixels.
  12982. @item padding
  12983. Set the inner border thickness (i.e. the number of pixels between frames). For
  12984. more advanced padding options (such as having different values for the edges),
  12985. refer to the pad video filter.
  12986. @item color
  12987. Specify the color of the unused area. For the syntax of this option, check the
  12988. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12989. The default value of @var{color} is "black".
  12990. @item overlap
  12991. Set the number of frames to overlap when tiling several successive frames together.
  12992. The value must be between @code{0} and @var{nb_frames - 1}.
  12993. @item init_padding
  12994. Set the number of frames to initially be empty before displaying first output frame.
  12995. This controls how soon will one get first output frame.
  12996. The value must be between @code{0} and @var{nb_frames - 1}.
  12997. @end table
  12998. @subsection Examples
  12999. @itemize
  13000. @item
  13001. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13002. @example
  13003. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13004. @end example
  13005. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13006. duplicating each output frame to accommodate the originally detected frame
  13007. rate.
  13008. @item
  13009. Display @code{5} pictures in an area of @code{3x2} frames,
  13010. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13011. mixed flat and named options:
  13012. @example
  13013. tile=3x2:nb_frames=5:padding=7:margin=2
  13014. @end example
  13015. @end itemize
  13016. @section tinterlace
  13017. Perform various types of temporal field interlacing.
  13018. Frames are counted starting from 1, so the first input frame is
  13019. considered odd.
  13020. The filter accepts the following options:
  13021. @table @option
  13022. @item mode
  13023. Specify the mode of the interlacing. This option can also be specified
  13024. as a value alone. See below for a list of values for this option.
  13025. Available values are:
  13026. @table @samp
  13027. @item merge, 0
  13028. Move odd frames into the upper field, even into the lower field,
  13029. generating a double height frame at half frame rate.
  13030. @example
  13031. ------> time
  13032. Input:
  13033. Frame 1 Frame 2 Frame 3 Frame 4
  13034. 11111 22222 33333 44444
  13035. 11111 22222 33333 44444
  13036. 11111 22222 33333 44444
  13037. 11111 22222 33333 44444
  13038. Output:
  13039. 11111 33333
  13040. 22222 44444
  13041. 11111 33333
  13042. 22222 44444
  13043. 11111 33333
  13044. 22222 44444
  13045. 11111 33333
  13046. 22222 44444
  13047. @end example
  13048. @item drop_even, 1
  13049. Only output odd frames, even frames are dropped, generating a frame with
  13050. unchanged height at half frame rate.
  13051. @example
  13052. ------> time
  13053. Input:
  13054. Frame 1 Frame 2 Frame 3 Frame 4
  13055. 11111 22222 33333 44444
  13056. 11111 22222 33333 44444
  13057. 11111 22222 33333 44444
  13058. 11111 22222 33333 44444
  13059. Output:
  13060. 11111 33333
  13061. 11111 33333
  13062. 11111 33333
  13063. 11111 33333
  13064. @end example
  13065. @item drop_odd, 2
  13066. Only output even frames, odd frames are dropped, generating a frame with
  13067. unchanged height at half frame rate.
  13068. @example
  13069. ------> time
  13070. Input:
  13071. Frame 1 Frame 2 Frame 3 Frame 4
  13072. 11111 22222 33333 44444
  13073. 11111 22222 33333 44444
  13074. 11111 22222 33333 44444
  13075. 11111 22222 33333 44444
  13076. Output:
  13077. 22222 44444
  13078. 22222 44444
  13079. 22222 44444
  13080. 22222 44444
  13081. @end example
  13082. @item pad, 3
  13083. Expand each frame to full height, but pad alternate lines with black,
  13084. generating a frame with double height at the same input frame rate.
  13085. @example
  13086. ------> time
  13087. Input:
  13088. Frame 1 Frame 2 Frame 3 Frame 4
  13089. 11111 22222 33333 44444
  13090. 11111 22222 33333 44444
  13091. 11111 22222 33333 44444
  13092. 11111 22222 33333 44444
  13093. Output:
  13094. 11111 ..... 33333 .....
  13095. ..... 22222 ..... 44444
  13096. 11111 ..... 33333 .....
  13097. ..... 22222 ..... 44444
  13098. 11111 ..... 33333 .....
  13099. ..... 22222 ..... 44444
  13100. 11111 ..... 33333 .....
  13101. ..... 22222 ..... 44444
  13102. @end example
  13103. @item interleave_top, 4
  13104. Interleave the upper field from odd frames with the lower field from
  13105. even frames, generating a frame with unchanged height at half frame rate.
  13106. @example
  13107. ------> time
  13108. Input:
  13109. Frame 1 Frame 2 Frame 3 Frame 4
  13110. 11111<- 22222 33333<- 44444
  13111. 11111 22222<- 33333 44444<-
  13112. 11111<- 22222 33333<- 44444
  13113. 11111 22222<- 33333 44444<-
  13114. Output:
  13115. 11111 33333
  13116. 22222 44444
  13117. 11111 33333
  13118. 22222 44444
  13119. @end example
  13120. @item interleave_bottom, 5
  13121. Interleave the lower field from odd frames with the upper field from
  13122. even frames, generating a frame with unchanged height at half frame rate.
  13123. @example
  13124. ------> time
  13125. Input:
  13126. Frame 1 Frame 2 Frame 3 Frame 4
  13127. 11111 22222<- 33333 44444<-
  13128. 11111<- 22222 33333<- 44444
  13129. 11111 22222<- 33333 44444<-
  13130. 11111<- 22222 33333<- 44444
  13131. Output:
  13132. 22222 44444
  13133. 11111 33333
  13134. 22222 44444
  13135. 11111 33333
  13136. @end example
  13137. @item interlacex2, 6
  13138. Double frame rate with unchanged height. Frames are inserted each
  13139. containing the second temporal field from the previous input frame and
  13140. the first temporal field from the next input frame. This mode relies on
  13141. the top_field_first flag. Useful for interlaced video displays with no
  13142. field synchronisation.
  13143. @example
  13144. ------> time
  13145. Input:
  13146. Frame 1 Frame 2 Frame 3 Frame 4
  13147. 11111 22222 33333 44444
  13148. 11111 22222 33333 44444
  13149. 11111 22222 33333 44444
  13150. 11111 22222 33333 44444
  13151. Output:
  13152. 11111 22222 22222 33333 33333 44444 44444
  13153. 11111 11111 22222 22222 33333 33333 44444
  13154. 11111 22222 22222 33333 33333 44444 44444
  13155. 11111 11111 22222 22222 33333 33333 44444
  13156. @end example
  13157. @item mergex2, 7
  13158. Move odd frames into the upper field, even into the lower field,
  13159. generating a double height frame at same frame rate.
  13160. @example
  13161. ------> time
  13162. Input:
  13163. Frame 1 Frame 2 Frame 3 Frame 4
  13164. 11111 22222 33333 44444
  13165. 11111 22222 33333 44444
  13166. 11111 22222 33333 44444
  13167. 11111 22222 33333 44444
  13168. Output:
  13169. 11111 33333 33333 55555
  13170. 22222 22222 44444 44444
  13171. 11111 33333 33333 55555
  13172. 22222 22222 44444 44444
  13173. 11111 33333 33333 55555
  13174. 22222 22222 44444 44444
  13175. 11111 33333 33333 55555
  13176. 22222 22222 44444 44444
  13177. @end example
  13178. @end table
  13179. Numeric values are deprecated but are accepted for backward
  13180. compatibility reasons.
  13181. Default mode is @code{merge}.
  13182. @item flags
  13183. Specify flags influencing the filter process.
  13184. Available value for @var{flags} is:
  13185. @table @option
  13186. @item low_pass_filter, vlpf
  13187. Enable linear vertical low-pass filtering in the filter.
  13188. Vertical low-pass filtering is required when creating an interlaced
  13189. destination from a progressive source which contains high-frequency
  13190. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13191. patterning.
  13192. @item complex_filter, cvlpf
  13193. Enable complex vertical low-pass filtering.
  13194. This will slightly less reduce interlace 'twitter' and Moire
  13195. patterning but better retain detail and subjective sharpness impression.
  13196. @end table
  13197. Vertical low-pass filtering can only be enabled for @option{mode}
  13198. @var{interleave_top} and @var{interleave_bottom}.
  13199. @end table
  13200. @section tmix
  13201. Mix successive video frames.
  13202. A description of the accepted options follows.
  13203. @table @option
  13204. @item frames
  13205. The number of successive frames to mix. If unspecified, it defaults to 3.
  13206. @item weights
  13207. Specify weight of each input video frame.
  13208. Each weight is separated by space. If number of weights is smaller than
  13209. number of @var{frames} last specified weight will be used for all remaining
  13210. unset weights.
  13211. @item scale
  13212. Specify scale, if it is set it will be multiplied with sum
  13213. of each weight multiplied with pixel values to give final destination
  13214. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13215. @end table
  13216. @subsection Examples
  13217. @itemize
  13218. @item
  13219. Average 7 successive frames:
  13220. @example
  13221. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13222. @end example
  13223. @item
  13224. Apply simple temporal convolution:
  13225. @example
  13226. tmix=frames=3:weights="-1 3 -1"
  13227. @end example
  13228. @item
  13229. Similar as above but only showing temporal differences:
  13230. @example
  13231. tmix=frames=3:weights="-1 2 -1":scale=1
  13232. @end example
  13233. @end itemize
  13234. @anchor{tonemap}
  13235. @section tonemap
  13236. Tone map colors from different dynamic ranges.
  13237. This filter expects data in single precision floating point, as it needs to
  13238. operate on (and can output) out-of-range values. Another filter, such as
  13239. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13240. The tonemapping algorithms implemented only work on linear light, so input
  13241. data should be linearized beforehand (and possibly correctly tagged).
  13242. @example
  13243. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13244. @end example
  13245. @subsection Options
  13246. The filter accepts the following options.
  13247. @table @option
  13248. @item tonemap
  13249. Set the tone map algorithm to use.
  13250. Possible values are:
  13251. @table @var
  13252. @item none
  13253. Do not apply any tone map, only desaturate overbright pixels.
  13254. @item clip
  13255. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13256. in-range values, while distorting out-of-range values.
  13257. @item linear
  13258. Stretch the entire reference gamut to a linear multiple of the display.
  13259. @item gamma
  13260. Fit a logarithmic transfer between the tone curves.
  13261. @item reinhard
  13262. Preserve overall image brightness with a simple curve, using nonlinear
  13263. contrast, which results in flattening details and degrading color accuracy.
  13264. @item hable
  13265. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13266. of slightly darkening everything. Use it when detail preservation is more
  13267. important than color and brightness accuracy.
  13268. @item mobius
  13269. Smoothly map out-of-range values, while retaining contrast and colors for
  13270. in-range material as much as possible. Use it when color accuracy is more
  13271. important than detail preservation.
  13272. @end table
  13273. Default is none.
  13274. @item param
  13275. Tune the tone mapping algorithm.
  13276. This affects the following algorithms:
  13277. @table @var
  13278. @item none
  13279. Ignored.
  13280. @item linear
  13281. Specifies the scale factor to use while stretching.
  13282. Default to 1.0.
  13283. @item gamma
  13284. Specifies the exponent of the function.
  13285. Default to 1.8.
  13286. @item clip
  13287. Specify an extra linear coefficient to multiply into the signal before clipping.
  13288. Default to 1.0.
  13289. @item reinhard
  13290. Specify the local contrast coefficient at the display peak.
  13291. Default to 0.5, which means that in-gamut values will be about half as bright
  13292. as when clipping.
  13293. @item hable
  13294. Ignored.
  13295. @item mobius
  13296. Specify the transition point from linear to mobius transform. Every value
  13297. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13298. more accurate the result will be, at the cost of losing bright details.
  13299. Default to 0.3, which due to the steep initial slope still preserves in-range
  13300. colors fairly accurately.
  13301. @end table
  13302. @item desat
  13303. Apply desaturation for highlights that exceed this level of brightness. The
  13304. higher the parameter, the more color information will be preserved. This
  13305. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13306. (smoothly) turning into white instead. This makes images feel more natural,
  13307. at the cost of reducing information about out-of-range colors.
  13308. The default of 2.0 is somewhat conservative and will mostly just apply to
  13309. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13310. This option works only if the input frame has a supported color tag.
  13311. @item peak
  13312. Override signal/nominal/reference peak with this value. Useful when the
  13313. embedded peak information in display metadata is not reliable or when tone
  13314. mapping from a lower range to a higher range.
  13315. @end table
  13316. @section tpad
  13317. Temporarily pad video frames.
  13318. The filter accepts the following options:
  13319. @table @option
  13320. @item start
  13321. Specify number of delay frames before input video stream.
  13322. @item stop
  13323. Specify number of padding frames after input video stream.
  13324. Set to -1 to pad indefinitely.
  13325. @item start_mode
  13326. Set kind of frames added to beginning of stream.
  13327. Can be either @var{add} or @var{clone}.
  13328. With @var{add} frames of solid-color are added.
  13329. With @var{clone} frames are clones of first frame.
  13330. @item stop_mode
  13331. Set kind of frames added to end of stream.
  13332. Can be either @var{add} or @var{clone}.
  13333. With @var{add} frames of solid-color are added.
  13334. With @var{clone} frames are clones of last frame.
  13335. @item start_duration, stop_duration
  13336. Specify the duration of the start/stop delay. See
  13337. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13338. for the accepted syntax.
  13339. These options override @var{start} and @var{stop}.
  13340. @item color
  13341. Specify the color of the padded area. For the syntax of this option,
  13342. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13343. manual,ffmpeg-utils}.
  13344. The default value of @var{color} is "black".
  13345. @end table
  13346. @anchor{transpose}
  13347. @section transpose
  13348. Transpose rows with columns in the input video and optionally flip it.
  13349. It accepts the following parameters:
  13350. @table @option
  13351. @item dir
  13352. Specify the transposition direction.
  13353. Can assume the following values:
  13354. @table @samp
  13355. @item 0, 4, cclock_flip
  13356. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13357. @example
  13358. L.R L.l
  13359. . . -> . .
  13360. l.r R.r
  13361. @end example
  13362. @item 1, 5, clock
  13363. Rotate by 90 degrees clockwise, that is:
  13364. @example
  13365. L.R l.L
  13366. . . -> . .
  13367. l.r r.R
  13368. @end example
  13369. @item 2, 6, cclock
  13370. Rotate by 90 degrees counterclockwise, that is:
  13371. @example
  13372. L.R R.r
  13373. . . -> . .
  13374. l.r L.l
  13375. @end example
  13376. @item 3, 7, clock_flip
  13377. Rotate by 90 degrees clockwise and vertically flip, that is:
  13378. @example
  13379. L.R r.R
  13380. . . -> . .
  13381. l.r l.L
  13382. @end example
  13383. @end table
  13384. For values between 4-7, the transposition is only done if the input
  13385. video geometry is portrait and not landscape. These values are
  13386. deprecated, the @code{passthrough} option should be used instead.
  13387. Numerical values are deprecated, and should be dropped in favor of
  13388. symbolic constants.
  13389. @item passthrough
  13390. Do not apply the transposition if the input geometry matches the one
  13391. specified by the specified value. It accepts the following values:
  13392. @table @samp
  13393. @item none
  13394. Always apply transposition.
  13395. @item portrait
  13396. Preserve portrait geometry (when @var{height} >= @var{width}).
  13397. @item landscape
  13398. Preserve landscape geometry (when @var{width} >= @var{height}).
  13399. @end table
  13400. Default value is @code{none}.
  13401. @end table
  13402. For example to rotate by 90 degrees clockwise and preserve portrait
  13403. layout:
  13404. @example
  13405. transpose=dir=1:passthrough=portrait
  13406. @end example
  13407. The command above can also be specified as:
  13408. @example
  13409. transpose=1:portrait
  13410. @end example
  13411. @section transpose_npp
  13412. Transpose rows with columns in the input video and optionally flip it.
  13413. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13414. It accepts the following parameters:
  13415. @table @option
  13416. @item dir
  13417. Specify the transposition direction.
  13418. Can assume the following values:
  13419. @table @samp
  13420. @item cclock_flip
  13421. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13422. @item clock
  13423. Rotate by 90 degrees clockwise.
  13424. @item cclock
  13425. Rotate by 90 degrees counterclockwise.
  13426. @item clock_flip
  13427. Rotate by 90 degrees clockwise and vertically flip.
  13428. @end table
  13429. @item passthrough
  13430. Do not apply the transposition if the input geometry matches the one
  13431. specified by the specified value. It accepts the following values:
  13432. @table @samp
  13433. @item none
  13434. Always apply transposition. (default)
  13435. @item portrait
  13436. Preserve portrait geometry (when @var{height} >= @var{width}).
  13437. @item landscape
  13438. Preserve landscape geometry (when @var{width} >= @var{height}).
  13439. @end table
  13440. @end table
  13441. @section trim
  13442. Trim the input so that the output contains one continuous subpart of the input.
  13443. It accepts the following parameters:
  13444. @table @option
  13445. @item start
  13446. Specify the time of the start of the kept section, i.e. the frame with the
  13447. timestamp @var{start} will be the first frame in the output.
  13448. @item end
  13449. Specify the time of the first frame that will be dropped, i.e. the frame
  13450. immediately preceding the one with the timestamp @var{end} will be the last
  13451. frame in the output.
  13452. @item start_pts
  13453. This is the same as @var{start}, except this option sets the start timestamp
  13454. in timebase units instead of seconds.
  13455. @item end_pts
  13456. This is the same as @var{end}, except this option sets the end timestamp
  13457. in timebase units instead of seconds.
  13458. @item duration
  13459. The maximum duration of the output in seconds.
  13460. @item start_frame
  13461. The number of the first frame that should be passed to the output.
  13462. @item end_frame
  13463. The number of the first frame that should be dropped.
  13464. @end table
  13465. @option{start}, @option{end}, and @option{duration} are expressed as time
  13466. duration specifications; see
  13467. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13468. for the accepted syntax.
  13469. Note that the first two sets of the start/end options and the @option{duration}
  13470. option look at the frame timestamp, while the _frame variants simply count the
  13471. frames that pass through the filter. Also note that this filter does not modify
  13472. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13473. setpts filter after the trim filter.
  13474. If multiple start or end options are set, this filter tries to be greedy and
  13475. keep all the frames that match at least one of the specified constraints. To keep
  13476. only the part that matches all the constraints at once, chain multiple trim
  13477. filters.
  13478. The defaults are such that all the input is kept. So it is possible to set e.g.
  13479. just the end values to keep everything before the specified time.
  13480. Examples:
  13481. @itemize
  13482. @item
  13483. Drop everything except the second minute of input:
  13484. @example
  13485. ffmpeg -i INPUT -vf trim=60:120
  13486. @end example
  13487. @item
  13488. Keep only the first second:
  13489. @example
  13490. ffmpeg -i INPUT -vf trim=duration=1
  13491. @end example
  13492. @end itemize
  13493. @section unpremultiply
  13494. Apply alpha unpremultiply effect to input video stream using first plane
  13495. of second stream as alpha.
  13496. Both streams must have same dimensions and same pixel format.
  13497. The filter accepts the following option:
  13498. @table @option
  13499. @item planes
  13500. Set which planes will be processed, unprocessed planes will be copied.
  13501. By default value 0xf, all planes will be processed.
  13502. If the format has 1 or 2 components, then luma is bit 0.
  13503. If the format has 3 or 4 components:
  13504. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13505. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13506. If present, the alpha channel is always the last bit.
  13507. @item inplace
  13508. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13509. @end table
  13510. @anchor{unsharp}
  13511. @section unsharp
  13512. Sharpen or blur the input video.
  13513. It accepts the following parameters:
  13514. @table @option
  13515. @item luma_msize_x, lx
  13516. Set the luma matrix horizontal size. It must be an odd integer between
  13517. 3 and 23. The default value is 5.
  13518. @item luma_msize_y, ly
  13519. Set the luma matrix vertical size. It must be an odd integer between 3
  13520. and 23. The default value is 5.
  13521. @item luma_amount, la
  13522. Set the luma effect strength. It must be a floating point number, reasonable
  13523. values lay between -1.5 and 1.5.
  13524. Negative values will blur the input video, while positive values will
  13525. sharpen it, a value of zero will disable the effect.
  13526. Default value is 1.0.
  13527. @item chroma_msize_x, cx
  13528. Set the chroma matrix horizontal size. It must be an odd integer
  13529. between 3 and 23. The default value is 5.
  13530. @item chroma_msize_y, cy
  13531. Set the chroma matrix vertical size. It must be an odd integer
  13532. between 3 and 23. The default value is 5.
  13533. @item chroma_amount, ca
  13534. Set the chroma effect strength. It must be a floating point number, reasonable
  13535. values lay between -1.5 and 1.5.
  13536. Negative values will blur the input video, while positive values will
  13537. sharpen it, a value of zero will disable the effect.
  13538. Default value is 0.0.
  13539. @end table
  13540. All parameters are optional and default to the equivalent of the
  13541. string '5:5:1.0:5:5:0.0'.
  13542. @subsection Examples
  13543. @itemize
  13544. @item
  13545. Apply strong luma sharpen effect:
  13546. @example
  13547. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13548. @end example
  13549. @item
  13550. Apply a strong blur of both luma and chroma parameters:
  13551. @example
  13552. unsharp=7:7:-2:7:7:-2
  13553. @end example
  13554. @end itemize
  13555. @section uspp
  13556. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13557. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13558. shifts and average the results.
  13559. The way this differs from the behavior of spp is that uspp actually encodes &
  13560. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13561. DCT similar to MJPEG.
  13562. The filter accepts the following options:
  13563. @table @option
  13564. @item quality
  13565. Set quality. This option defines the number of levels for averaging. It accepts
  13566. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13567. effect. A value of @code{8} means the higher quality. For each increment of
  13568. that value the speed drops by a factor of approximately 2. Default value is
  13569. @code{3}.
  13570. @item qp
  13571. Force a constant quantization parameter. If not set, the filter will use the QP
  13572. from the video stream (if available).
  13573. @end table
  13574. @section vaguedenoiser
  13575. Apply a wavelet based denoiser.
  13576. It transforms each frame from the video input into the wavelet domain,
  13577. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13578. the obtained coefficients. It does an inverse wavelet transform after.
  13579. Due to wavelet properties, it should give a nice smoothed result, and
  13580. reduced noise, without blurring picture features.
  13581. This filter accepts the following options:
  13582. @table @option
  13583. @item threshold
  13584. The filtering strength. The higher, the more filtered the video will be.
  13585. Hard thresholding can use a higher threshold than soft thresholding
  13586. before the video looks overfiltered. Default value is 2.
  13587. @item method
  13588. The filtering method the filter will use.
  13589. It accepts the following values:
  13590. @table @samp
  13591. @item hard
  13592. All values under the threshold will be zeroed.
  13593. @item soft
  13594. All values under the threshold will be zeroed. All values above will be
  13595. reduced by the threshold.
  13596. @item garrote
  13597. Scales or nullifies coefficients - intermediary between (more) soft and
  13598. (less) hard thresholding.
  13599. @end table
  13600. Default is garrote.
  13601. @item nsteps
  13602. Number of times, the wavelet will decompose the picture. Picture can't
  13603. be decomposed beyond a particular point (typically, 8 for a 640x480
  13604. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13605. @item percent
  13606. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13607. @item planes
  13608. A list of the planes to process. By default all planes are processed.
  13609. @end table
  13610. @section vectorscope
  13611. Display 2 color component values in the two dimensional graph (which is called
  13612. a vectorscope).
  13613. This filter accepts the following options:
  13614. @table @option
  13615. @item mode, m
  13616. Set vectorscope mode.
  13617. It accepts the following values:
  13618. @table @samp
  13619. @item gray
  13620. Gray values are displayed on graph, higher brightness means more pixels have
  13621. same component color value on location in graph. This is the default mode.
  13622. @item color
  13623. Gray values are displayed on graph. Surrounding pixels values which are not
  13624. present in video frame are drawn in gradient of 2 color components which are
  13625. set by option @code{x} and @code{y}. The 3rd color component is static.
  13626. @item color2
  13627. Actual color components values present in video frame are displayed on graph.
  13628. @item color3
  13629. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13630. on graph increases value of another color component, which is luminance by
  13631. default values of @code{x} and @code{y}.
  13632. @item color4
  13633. Actual colors present in video frame are displayed on graph. If two different
  13634. colors map to same position on graph then color with higher value of component
  13635. not present in graph is picked.
  13636. @item color5
  13637. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13638. component picked from radial gradient.
  13639. @end table
  13640. @item x
  13641. Set which color component will be represented on X-axis. Default is @code{1}.
  13642. @item y
  13643. Set which color component will be represented on Y-axis. Default is @code{2}.
  13644. @item intensity, i
  13645. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13646. of color component which represents frequency of (X, Y) location in graph.
  13647. @item envelope, e
  13648. @table @samp
  13649. @item none
  13650. No envelope, this is default.
  13651. @item instant
  13652. Instant envelope, even darkest single pixel will be clearly highlighted.
  13653. @item peak
  13654. Hold maximum and minimum values presented in graph over time. This way you
  13655. can still spot out of range values without constantly looking at vectorscope.
  13656. @item peak+instant
  13657. Peak and instant envelope combined together.
  13658. @end table
  13659. @item graticule, g
  13660. Set what kind of graticule to draw.
  13661. @table @samp
  13662. @item none
  13663. @item green
  13664. @item color
  13665. @end table
  13666. @item opacity, o
  13667. Set graticule opacity.
  13668. @item flags, f
  13669. Set graticule flags.
  13670. @table @samp
  13671. @item white
  13672. Draw graticule for white point.
  13673. @item black
  13674. Draw graticule for black point.
  13675. @item name
  13676. Draw color points short names.
  13677. @end table
  13678. @item bgopacity, b
  13679. Set background opacity.
  13680. @item lthreshold, l
  13681. Set low threshold for color component not represented on X or Y axis.
  13682. Values lower than this value will be ignored. Default is 0.
  13683. Note this value is multiplied with actual max possible value one pixel component
  13684. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13685. is 0.1 * 255 = 25.
  13686. @item hthreshold, h
  13687. Set high threshold for color component not represented on X or Y axis.
  13688. Values higher than this value will be ignored. Default is 1.
  13689. Note this value is multiplied with actual max possible value one pixel component
  13690. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13691. is 0.9 * 255 = 230.
  13692. @item colorspace, c
  13693. Set what kind of colorspace to use when drawing graticule.
  13694. @table @samp
  13695. @item auto
  13696. @item 601
  13697. @item 709
  13698. @end table
  13699. Default is auto.
  13700. @end table
  13701. @anchor{vidstabdetect}
  13702. @section vidstabdetect
  13703. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13704. @ref{vidstabtransform} for pass 2.
  13705. This filter generates a file with relative translation and rotation
  13706. transform information about subsequent frames, which is then used by
  13707. the @ref{vidstabtransform} filter.
  13708. To enable compilation of this filter you need to configure FFmpeg with
  13709. @code{--enable-libvidstab}.
  13710. This filter accepts the following options:
  13711. @table @option
  13712. @item result
  13713. Set the path to the file used to write the transforms information.
  13714. Default value is @file{transforms.trf}.
  13715. @item shakiness
  13716. Set how shaky the video is and how quick the camera is. It accepts an
  13717. integer in the range 1-10, a value of 1 means little shakiness, a
  13718. value of 10 means strong shakiness. Default value is 5.
  13719. @item accuracy
  13720. Set the accuracy of the detection process. It must be a value in the
  13721. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13722. accuracy. Default value is 15.
  13723. @item stepsize
  13724. Set stepsize of the search process. The region around minimum is
  13725. scanned with 1 pixel resolution. Default value is 6.
  13726. @item mincontrast
  13727. Set minimum contrast. Below this value a local measurement field is
  13728. discarded. Must be a floating point value in the range 0-1. Default
  13729. value is 0.3.
  13730. @item tripod
  13731. Set reference frame number for tripod mode.
  13732. If enabled, the motion of the frames is compared to a reference frame
  13733. in the filtered stream, identified by the specified number. The idea
  13734. is to compensate all movements in a more-or-less static scene and keep
  13735. the camera view absolutely still.
  13736. If set to 0, it is disabled. The frames are counted starting from 1.
  13737. @item show
  13738. Show fields and transforms in the resulting frames. It accepts an
  13739. integer in the range 0-2. Default value is 0, which disables any
  13740. visualization.
  13741. @end table
  13742. @subsection Examples
  13743. @itemize
  13744. @item
  13745. Use default values:
  13746. @example
  13747. vidstabdetect
  13748. @end example
  13749. @item
  13750. Analyze strongly shaky movie and put the results in file
  13751. @file{mytransforms.trf}:
  13752. @example
  13753. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13754. @end example
  13755. @item
  13756. Visualize the result of internal transformations in the resulting
  13757. video:
  13758. @example
  13759. vidstabdetect=show=1
  13760. @end example
  13761. @item
  13762. Analyze a video with medium shakiness using @command{ffmpeg}:
  13763. @example
  13764. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13765. @end example
  13766. @end itemize
  13767. @anchor{vidstabtransform}
  13768. @section vidstabtransform
  13769. Video stabilization/deshaking: pass 2 of 2,
  13770. see @ref{vidstabdetect} for pass 1.
  13771. Read a file with transform information for each frame and
  13772. apply/compensate them. Together with the @ref{vidstabdetect}
  13773. filter this can be used to deshake videos. See also
  13774. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13775. the @ref{unsharp} filter, see below.
  13776. To enable compilation of this filter you need to configure FFmpeg with
  13777. @code{--enable-libvidstab}.
  13778. @subsection Options
  13779. @table @option
  13780. @item input
  13781. Set path to the file used to read the transforms. Default value is
  13782. @file{transforms.trf}.
  13783. @item smoothing
  13784. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13785. camera movements. Default value is 10.
  13786. For example a number of 10 means that 21 frames are used (10 in the
  13787. past and 10 in the future) to smoothen the motion in the video. A
  13788. larger value leads to a smoother video, but limits the acceleration of
  13789. the camera (pan/tilt movements). 0 is a special case where a static
  13790. camera is simulated.
  13791. @item optalgo
  13792. Set the camera path optimization algorithm.
  13793. Accepted values are:
  13794. @table @samp
  13795. @item gauss
  13796. gaussian kernel low-pass filter on camera motion (default)
  13797. @item avg
  13798. averaging on transformations
  13799. @end table
  13800. @item maxshift
  13801. Set maximal number of pixels to translate frames. Default value is -1,
  13802. meaning no limit.
  13803. @item maxangle
  13804. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13805. value is -1, meaning no limit.
  13806. @item crop
  13807. Specify how to deal with borders that may be visible due to movement
  13808. compensation.
  13809. Available values are:
  13810. @table @samp
  13811. @item keep
  13812. keep image information from previous frame (default)
  13813. @item black
  13814. fill the border black
  13815. @end table
  13816. @item invert
  13817. Invert transforms if set to 1. Default value is 0.
  13818. @item relative
  13819. Consider transforms as relative to previous frame if set to 1,
  13820. absolute if set to 0. Default value is 0.
  13821. @item zoom
  13822. Set percentage to zoom. A positive value will result in a zoom-in
  13823. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13824. zoom).
  13825. @item optzoom
  13826. Set optimal zooming to avoid borders.
  13827. Accepted values are:
  13828. @table @samp
  13829. @item 0
  13830. disabled
  13831. @item 1
  13832. optimal static zoom value is determined (only very strong movements
  13833. will lead to visible borders) (default)
  13834. @item 2
  13835. optimal adaptive zoom value is determined (no borders will be
  13836. visible), see @option{zoomspeed}
  13837. @end table
  13838. Note that the value given at zoom is added to the one calculated here.
  13839. @item zoomspeed
  13840. Set percent to zoom maximally each frame (enabled when
  13841. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13842. 0.25.
  13843. @item interpol
  13844. Specify type of interpolation.
  13845. Available values are:
  13846. @table @samp
  13847. @item no
  13848. no interpolation
  13849. @item linear
  13850. linear only horizontal
  13851. @item bilinear
  13852. linear in both directions (default)
  13853. @item bicubic
  13854. cubic in both directions (slow)
  13855. @end table
  13856. @item tripod
  13857. Enable virtual tripod mode if set to 1, which is equivalent to
  13858. @code{relative=0:smoothing=0}. Default value is 0.
  13859. Use also @code{tripod} option of @ref{vidstabdetect}.
  13860. @item debug
  13861. Increase log verbosity if set to 1. Also the detected global motions
  13862. are written to the temporary file @file{global_motions.trf}. Default
  13863. value is 0.
  13864. @end table
  13865. @subsection Examples
  13866. @itemize
  13867. @item
  13868. Use @command{ffmpeg} for a typical stabilization with default values:
  13869. @example
  13870. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13871. @end example
  13872. Note the use of the @ref{unsharp} filter which is always recommended.
  13873. @item
  13874. Zoom in a bit more and load transform data from a given file:
  13875. @example
  13876. vidstabtransform=zoom=5:input="mytransforms.trf"
  13877. @end example
  13878. @item
  13879. Smoothen the video even more:
  13880. @example
  13881. vidstabtransform=smoothing=30
  13882. @end example
  13883. @end itemize
  13884. @section vflip
  13885. Flip the input video vertically.
  13886. For example, to vertically flip a video with @command{ffmpeg}:
  13887. @example
  13888. ffmpeg -i in.avi -vf "vflip" out.avi
  13889. @end example
  13890. @section vfrdet
  13891. Detect variable frame rate video.
  13892. This filter tries to detect if the input is variable or constant frame rate.
  13893. At end it will output number of frames detected as having variable delta pts,
  13894. and ones with constant delta pts.
  13895. If there was frames with variable delta, than it will also show min and max delta
  13896. encountered.
  13897. @section vibrance
  13898. Boost or alter saturation.
  13899. The filter accepts the following options:
  13900. @table @option
  13901. @item intensity
  13902. Set strength of boost if positive value or strength of alter if negative value.
  13903. Default is 0. Allowed range is from -2 to 2.
  13904. @item rbal
  13905. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13906. @item gbal
  13907. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13908. @item bbal
  13909. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13910. @item rlum
  13911. Set the red luma coefficient.
  13912. @item glum
  13913. Set the green luma coefficient.
  13914. @item blum
  13915. Set the blue luma coefficient.
  13916. @item alternate
  13917. If @code{intensity} is negative and this is set to 1, colors will change,
  13918. otherwise colors will be less saturated, more towards gray.
  13919. @end table
  13920. @anchor{vignette}
  13921. @section vignette
  13922. Make or reverse a natural vignetting effect.
  13923. The filter accepts the following options:
  13924. @table @option
  13925. @item angle, a
  13926. Set lens angle expression as a number of radians.
  13927. The value is clipped in the @code{[0,PI/2]} range.
  13928. Default value: @code{"PI/5"}
  13929. @item x0
  13930. @item y0
  13931. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13932. by default.
  13933. @item mode
  13934. Set forward/backward mode.
  13935. Available modes are:
  13936. @table @samp
  13937. @item forward
  13938. The larger the distance from the central point, the darker the image becomes.
  13939. @item backward
  13940. The larger the distance from the central point, the brighter the image becomes.
  13941. This can be used to reverse a vignette effect, though there is no automatic
  13942. detection to extract the lens @option{angle} and other settings (yet). It can
  13943. also be used to create a burning effect.
  13944. @end table
  13945. Default value is @samp{forward}.
  13946. @item eval
  13947. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13948. It accepts the following values:
  13949. @table @samp
  13950. @item init
  13951. Evaluate expressions only once during the filter initialization.
  13952. @item frame
  13953. Evaluate expressions for each incoming frame. This is way slower than the
  13954. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13955. allows advanced dynamic expressions.
  13956. @end table
  13957. Default value is @samp{init}.
  13958. @item dither
  13959. Set dithering to reduce the circular banding effects. Default is @code{1}
  13960. (enabled).
  13961. @item aspect
  13962. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13963. Setting this value to the SAR of the input will make a rectangular vignetting
  13964. following the dimensions of the video.
  13965. Default is @code{1/1}.
  13966. @end table
  13967. @subsection Expressions
  13968. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13969. following parameters.
  13970. @table @option
  13971. @item w
  13972. @item h
  13973. input width and height
  13974. @item n
  13975. the number of input frame, starting from 0
  13976. @item pts
  13977. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13978. @var{TB} units, NAN if undefined
  13979. @item r
  13980. frame rate of the input video, NAN if the input frame rate is unknown
  13981. @item t
  13982. the PTS (Presentation TimeStamp) of the filtered video frame,
  13983. expressed in seconds, NAN if undefined
  13984. @item tb
  13985. time base of the input video
  13986. @end table
  13987. @subsection Examples
  13988. @itemize
  13989. @item
  13990. Apply simple strong vignetting effect:
  13991. @example
  13992. vignette=PI/4
  13993. @end example
  13994. @item
  13995. Make a flickering vignetting:
  13996. @example
  13997. vignette='PI/4+random(1)*PI/50':eval=frame
  13998. @end example
  13999. @end itemize
  14000. @section vmafmotion
  14001. Obtain the average vmaf motion score of a video.
  14002. It is one of the component filters of VMAF.
  14003. The obtained average motion score is printed through the logging system.
  14004. In the below example the input file @file{ref.mpg} is being processed and score
  14005. is computed.
  14006. @example
  14007. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14008. @end example
  14009. @section vstack
  14010. Stack input videos vertically.
  14011. All streams must be of same pixel format and of same width.
  14012. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14013. to create same output.
  14014. The filter accept the following option:
  14015. @table @option
  14016. @item inputs
  14017. Set number of input streams. Default is 2.
  14018. @item shortest
  14019. If set to 1, force the output to terminate when the shortest input
  14020. terminates. Default value is 0.
  14021. @end table
  14022. @section w3fdif
  14023. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14024. Deinterlacing Filter").
  14025. Based on the process described by Martin Weston for BBC R&D, and
  14026. implemented based on the de-interlace algorithm written by Jim
  14027. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14028. uses filter coefficients calculated by BBC R&D.
  14029. This filter use field-dominance information in frame to decide which
  14030. of each pair of fields to place first in the output.
  14031. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14032. There are two sets of filter coefficients, so called "simple":
  14033. and "complex". Which set of filter coefficients is used can
  14034. be set by passing an optional parameter:
  14035. @table @option
  14036. @item filter
  14037. Set the interlacing filter coefficients. Accepts one of the following values:
  14038. @table @samp
  14039. @item simple
  14040. Simple filter coefficient set.
  14041. @item complex
  14042. More-complex filter coefficient set.
  14043. @end table
  14044. Default value is @samp{complex}.
  14045. @item deint
  14046. Specify which frames to deinterlace. Accept one of the following values:
  14047. @table @samp
  14048. @item all
  14049. Deinterlace all frames,
  14050. @item interlaced
  14051. Only deinterlace frames marked as interlaced.
  14052. @end table
  14053. Default value is @samp{all}.
  14054. @end table
  14055. @section waveform
  14056. Video waveform monitor.
  14057. The waveform monitor plots color component intensity. By default luminance
  14058. only. Each column of the waveform corresponds to a column of pixels in the
  14059. source video.
  14060. It accepts the following options:
  14061. @table @option
  14062. @item mode, m
  14063. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14064. In row mode, the graph on the left side represents color component value 0 and
  14065. the right side represents value = 255. In column mode, the top side represents
  14066. color component value = 0 and bottom side represents value = 255.
  14067. @item intensity, i
  14068. Set intensity. Smaller values are useful to find out how many values of the same
  14069. luminance are distributed across input rows/columns.
  14070. Default value is @code{0.04}. Allowed range is [0, 1].
  14071. @item mirror, r
  14072. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14073. In mirrored mode, higher values will be represented on the left
  14074. side for @code{row} mode and at the top for @code{column} mode. Default is
  14075. @code{1} (mirrored).
  14076. @item display, d
  14077. Set display mode.
  14078. It accepts the following values:
  14079. @table @samp
  14080. @item overlay
  14081. Presents information identical to that in the @code{parade}, except
  14082. that the graphs representing color components are superimposed directly
  14083. over one another.
  14084. This display mode makes it easier to spot relative differences or similarities
  14085. in overlapping areas of the color components that are supposed to be identical,
  14086. such as neutral whites, grays, or blacks.
  14087. @item stack
  14088. Display separate graph for the color components side by side in
  14089. @code{row} mode or one below the other in @code{column} mode.
  14090. @item parade
  14091. Display separate graph for the color components side by side in
  14092. @code{column} mode or one below the other in @code{row} mode.
  14093. Using this display mode makes it easy to spot color casts in the highlights
  14094. and shadows of an image, by comparing the contours of the top and the bottom
  14095. graphs of each waveform. Since whites, grays, and blacks are characterized
  14096. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14097. should display three waveforms of roughly equal width/height. If not, the
  14098. correction is easy to perform by making level adjustments the three waveforms.
  14099. @end table
  14100. Default is @code{stack}.
  14101. @item components, c
  14102. Set which color components to display. Default is 1, which means only luminance
  14103. or red color component if input is in RGB colorspace. If is set for example to
  14104. 7 it will display all 3 (if) available color components.
  14105. @item envelope, e
  14106. @table @samp
  14107. @item none
  14108. No envelope, this is default.
  14109. @item instant
  14110. Instant envelope, minimum and maximum values presented in graph will be easily
  14111. visible even with small @code{step} value.
  14112. @item peak
  14113. Hold minimum and maximum values presented in graph across time. This way you
  14114. can still spot out of range values without constantly looking at waveforms.
  14115. @item peak+instant
  14116. Peak and instant envelope combined together.
  14117. @end table
  14118. @item filter, f
  14119. @table @samp
  14120. @item lowpass
  14121. No filtering, this is default.
  14122. @item flat
  14123. Luma and chroma combined together.
  14124. @item aflat
  14125. Similar as above, but shows difference between blue and red chroma.
  14126. @item xflat
  14127. Similar as above, but use different colors.
  14128. @item chroma
  14129. Displays only chroma.
  14130. @item color
  14131. Displays actual color value on waveform.
  14132. @item acolor
  14133. Similar as above, but with luma showing frequency of chroma values.
  14134. @end table
  14135. @item graticule, g
  14136. Set which graticule to display.
  14137. @table @samp
  14138. @item none
  14139. Do not display graticule.
  14140. @item green
  14141. Display green graticule showing legal broadcast ranges.
  14142. @item orange
  14143. Display orange graticule showing legal broadcast ranges.
  14144. @end table
  14145. @item opacity, o
  14146. Set graticule opacity.
  14147. @item flags, fl
  14148. Set graticule flags.
  14149. @table @samp
  14150. @item numbers
  14151. Draw numbers above lines. By default enabled.
  14152. @item dots
  14153. Draw dots instead of lines.
  14154. @end table
  14155. @item scale, s
  14156. Set scale used for displaying graticule.
  14157. @table @samp
  14158. @item digital
  14159. @item millivolts
  14160. @item ire
  14161. @end table
  14162. Default is digital.
  14163. @item bgopacity, b
  14164. Set background opacity.
  14165. @end table
  14166. @section weave, doubleweave
  14167. The @code{weave} takes a field-based video input and join
  14168. each two sequential fields into single frame, producing a new double
  14169. height clip with half the frame rate and half the frame count.
  14170. The @code{doubleweave} works same as @code{weave} but without
  14171. halving frame rate and frame count.
  14172. It accepts the following option:
  14173. @table @option
  14174. @item first_field
  14175. Set first field. Available values are:
  14176. @table @samp
  14177. @item top, t
  14178. Set the frame as top-field-first.
  14179. @item bottom, b
  14180. Set the frame as bottom-field-first.
  14181. @end table
  14182. @end table
  14183. @subsection Examples
  14184. @itemize
  14185. @item
  14186. Interlace video using @ref{select} and @ref{separatefields} filter:
  14187. @example
  14188. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14189. @end example
  14190. @end itemize
  14191. @section xbr
  14192. Apply the xBR high-quality magnification filter which is designed for pixel
  14193. art. It follows a set of edge-detection rules, see
  14194. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14195. It accepts the following option:
  14196. @table @option
  14197. @item n
  14198. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14199. @code{3xBR} and @code{4} for @code{4xBR}.
  14200. Default is @code{3}.
  14201. @end table
  14202. @section xmedian
  14203. Pick median pixels from several input videos.
  14204. The filter accept the following options:
  14205. @table @option
  14206. @item inputs
  14207. Set number of inputs.
  14208. Default is 3. Allowed range is from 3 to 255.
  14209. If number of inputs is even number, than result will be mean value between two median values.
  14210. @item planes
  14211. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14212. @end table
  14213. @section xstack
  14214. Stack video inputs into custom layout.
  14215. All streams must be of same pixel format.
  14216. The filter accept the following option:
  14217. @table @option
  14218. @item inputs
  14219. Set number of input streams. Default is 2.
  14220. @item layout
  14221. Specify layout of inputs.
  14222. This option requires the desired layout configuration to be explicitly set by the user.
  14223. This sets position of each video input in output. Each input
  14224. is separated by '|'.
  14225. The first number represents the column, and the second number represents the row.
  14226. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14227. where X is video input from which to take width or height.
  14228. Multiple values can be used when separated by '+'. In such
  14229. case values are summed together.
  14230. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14231. a layout must be set by the user.
  14232. @item shortest
  14233. If set to 1, force the output to terminate when the shortest input
  14234. terminates. Default value is 0.
  14235. @end table
  14236. @subsection Examples
  14237. @itemize
  14238. @item
  14239. Display 4 inputs into 2x2 grid,
  14240. note that if inputs are of different sizes unused gaps might appear,
  14241. as not all of output video is used.
  14242. @example
  14243. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14244. @end example
  14245. @item
  14246. Display 4 inputs into 1x4 grid,
  14247. note that if inputs are of different sizes unused gaps might appear,
  14248. as not all of output video is used.
  14249. @example
  14250. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14251. @end example
  14252. @item
  14253. Display 9 inputs into 3x3 grid,
  14254. note that if inputs are of different sizes unused gaps might appear,
  14255. as not all of output video is used.
  14256. @example
  14257. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  14258. @end example
  14259. @end itemize
  14260. @anchor{yadif}
  14261. @section yadif
  14262. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14263. filter").
  14264. It accepts the following parameters:
  14265. @table @option
  14266. @item mode
  14267. The interlacing mode to adopt. It accepts one of the following values:
  14268. @table @option
  14269. @item 0, send_frame
  14270. Output one frame for each frame.
  14271. @item 1, send_field
  14272. Output one frame for each field.
  14273. @item 2, send_frame_nospatial
  14274. Like @code{send_frame}, but it skips the spatial interlacing check.
  14275. @item 3, send_field_nospatial
  14276. Like @code{send_field}, but it skips the spatial interlacing check.
  14277. @end table
  14278. The default value is @code{send_frame}.
  14279. @item parity
  14280. The picture field parity assumed for the input interlaced video. It accepts one
  14281. of the following values:
  14282. @table @option
  14283. @item 0, tff
  14284. Assume the top field is first.
  14285. @item 1, bff
  14286. Assume the bottom field is first.
  14287. @item -1, auto
  14288. Enable automatic detection of field parity.
  14289. @end table
  14290. The default value is @code{auto}.
  14291. If the interlacing is unknown or the decoder does not export this information,
  14292. top field first will be assumed.
  14293. @item deint
  14294. Specify which frames to deinterlace. Accept one of the following
  14295. values:
  14296. @table @option
  14297. @item 0, all
  14298. Deinterlace all frames.
  14299. @item 1, interlaced
  14300. Only deinterlace frames marked as interlaced.
  14301. @end table
  14302. The default value is @code{all}.
  14303. @end table
  14304. @section yadif_cuda
  14305. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14306. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14307. and/or nvenc.
  14308. It accepts the following parameters:
  14309. @table @option
  14310. @item mode
  14311. The interlacing mode to adopt. It accepts one of the following values:
  14312. @table @option
  14313. @item 0, send_frame
  14314. Output one frame for each frame.
  14315. @item 1, send_field
  14316. Output one frame for each field.
  14317. @item 2, send_frame_nospatial
  14318. Like @code{send_frame}, but it skips the spatial interlacing check.
  14319. @item 3, send_field_nospatial
  14320. Like @code{send_field}, but it skips the spatial interlacing check.
  14321. @end table
  14322. The default value is @code{send_frame}.
  14323. @item parity
  14324. The picture field parity assumed for the input interlaced video. It accepts one
  14325. of the following values:
  14326. @table @option
  14327. @item 0, tff
  14328. Assume the top field is first.
  14329. @item 1, bff
  14330. Assume the bottom field is first.
  14331. @item -1, auto
  14332. Enable automatic detection of field parity.
  14333. @end table
  14334. The default value is @code{auto}.
  14335. If the interlacing is unknown or the decoder does not export this information,
  14336. top field first will be assumed.
  14337. @item deint
  14338. Specify which frames to deinterlace. Accept one of the following
  14339. values:
  14340. @table @option
  14341. @item 0, all
  14342. Deinterlace all frames.
  14343. @item 1, interlaced
  14344. Only deinterlace frames marked as interlaced.
  14345. @end table
  14346. The default value is @code{all}.
  14347. @end table
  14348. @section zoompan
  14349. Apply Zoom & Pan effect.
  14350. This filter accepts the following options:
  14351. @table @option
  14352. @item zoom, z
  14353. Set the zoom expression. Range is 1-10. Default is 1.
  14354. @item x
  14355. @item y
  14356. Set the x and y expression. Default is 0.
  14357. @item d
  14358. Set the duration expression in number of frames.
  14359. This sets for how many number of frames effect will last for
  14360. single input image.
  14361. @item s
  14362. Set the output image size, default is 'hd720'.
  14363. @item fps
  14364. Set the output frame rate, default is '25'.
  14365. @end table
  14366. Each expression can contain the following constants:
  14367. @table @option
  14368. @item in_w, iw
  14369. Input width.
  14370. @item in_h, ih
  14371. Input height.
  14372. @item out_w, ow
  14373. Output width.
  14374. @item out_h, oh
  14375. Output height.
  14376. @item in
  14377. Input frame count.
  14378. @item on
  14379. Output frame count.
  14380. @item x
  14381. @item y
  14382. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14383. for current input frame.
  14384. @item px
  14385. @item py
  14386. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14387. not yet such frame (first input frame).
  14388. @item zoom
  14389. Last calculated zoom from 'z' expression for current input frame.
  14390. @item pzoom
  14391. Last calculated zoom of last output frame of previous input frame.
  14392. @item duration
  14393. Number of output frames for current input frame. Calculated from 'd' expression
  14394. for each input frame.
  14395. @item pduration
  14396. number of output frames created for previous input frame
  14397. @item a
  14398. Rational number: input width / input height
  14399. @item sar
  14400. sample aspect ratio
  14401. @item dar
  14402. display aspect ratio
  14403. @end table
  14404. @subsection Examples
  14405. @itemize
  14406. @item
  14407. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14408. @example
  14409. 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
  14410. @end example
  14411. @item
  14412. Zoom-in up to 1.5 and pan always at center of picture:
  14413. @example
  14414. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14415. @end example
  14416. @item
  14417. Same as above but without pausing:
  14418. @example
  14419. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14420. @end example
  14421. @end itemize
  14422. @anchor{zscale}
  14423. @section zscale
  14424. Scale (resize) the input video, using the z.lib library:
  14425. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14426. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14427. The zscale filter forces the output display aspect ratio to be the same
  14428. as the input, by changing the output sample aspect ratio.
  14429. If the input image format is different from the format requested by
  14430. the next filter, the zscale filter will convert the input to the
  14431. requested format.
  14432. @subsection Options
  14433. The filter accepts the following options.
  14434. @table @option
  14435. @item width, w
  14436. @item height, h
  14437. Set the output video dimension expression. Default value is the input
  14438. dimension.
  14439. If the @var{width} or @var{w} value is 0, the input width is used for
  14440. the output. If the @var{height} or @var{h} value is 0, the input height
  14441. is used for the output.
  14442. If one and only one of the values is -n with n >= 1, the zscale filter
  14443. will use a value that maintains the aspect ratio of the input image,
  14444. calculated from the other specified dimension. After that it will,
  14445. however, make sure that the calculated dimension is divisible by n and
  14446. adjust the value if necessary.
  14447. If both values are -n with n >= 1, the behavior will be identical to
  14448. both values being set to 0 as previously detailed.
  14449. See below for the list of accepted constants for use in the dimension
  14450. expression.
  14451. @item size, s
  14452. Set the video size. For the syntax of this option, check the
  14453. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14454. @item dither, d
  14455. Set the dither type.
  14456. Possible values are:
  14457. @table @var
  14458. @item none
  14459. @item ordered
  14460. @item random
  14461. @item error_diffusion
  14462. @end table
  14463. Default is none.
  14464. @item filter, f
  14465. Set the resize filter type.
  14466. Possible values are:
  14467. @table @var
  14468. @item point
  14469. @item bilinear
  14470. @item bicubic
  14471. @item spline16
  14472. @item spline36
  14473. @item lanczos
  14474. @end table
  14475. Default is bilinear.
  14476. @item range, r
  14477. Set the color range.
  14478. Possible values are:
  14479. @table @var
  14480. @item input
  14481. @item limited
  14482. @item full
  14483. @end table
  14484. Default is same as input.
  14485. @item primaries, p
  14486. Set the color primaries.
  14487. Possible values are:
  14488. @table @var
  14489. @item input
  14490. @item 709
  14491. @item unspecified
  14492. @item 170m
  14493. @item 240m
  14494. @item 2020
  14495. @end table
  14496. Default is same as input.
  14497. @item transfer, t
  14498. Set the transfer characteristics.
  14499. Possible values are:
  14500. @table @var
  14501. @item input
  14502. @item 709
  14503. @item unspecified
  14504. @item 601
  14505. @item linear
  14506. @item 2020_10
  14507. @item 2020_12
  14508. @item smpte2084
  14509. @item iec61966-2-1
  14510. @item arib-std-b67
  14511. @end table
  14512. Default is same as input.
  14513. @item matrix, m
  14514. Set the colorspace matrix.
  14515. Possible value are:
  14516. @table @var
  14517. @item input
  14518. @item 709
  14519. @item unspecified
  14520. @item 470bg
  14521. @item 170m
  14522. @item 2020_ncl
  14523. @item 2020_cl
  14524. @end table
  14525. Default is same as input.
  14526. @item rangein, rin
  14527. Set the input color range.
  14528. Possible values are:
  14529. @table @var
  14530. @item input
  14531. @item limited
  14532. @item full
  14533. @end table
  14534. Default is same as input.
  14535. @item primariesin, pin
  14536. Set the input color primaries.
  14537. Possible values are:
  14538. @table @var
  14539. @item input
  14540. @item 709
  14541. @item unspecified
  14542. @item 170m
  14543. @item 240m
  14544. @item 2020
  14545. @end table
  14546. Default is same as input.
  14547. @item transferin, tin
  14548. Set the input transfer characteristics.
  14549. Possible values are:
  14550. @table @var
  14551. @item input
  14552. @item 709
  14553. @item unspecified
  14554. @item 601
  14555. @item linear
  14556. @item 2020_10
  14557. @item 2020_12
  14558. @end table
  14559. Default is same as input.
  14560. @item matrixin, min
  14561. Set the input colorspace matrix.
  14562. Possible value are:
  14563. @table @var
  14564. @item input
  14565. @item 709
  14566. @item unspecified
  14567. @item 470bg
  14568. @item 170m
  14569. @item 2020_ncl
  14570. @item 2020_cl
  14571. @end table
  14572. @item chromal, c
  14573. Set the output chroma location.
  14574. Possible values are:
  14575. @table @var
  14576. @item input
  14577. @item left
  14578. @item center
  14579. @item topleft
  14580. @item top
  14581. @item bottomleft
  14582. @item bottom
  14583. @end table
  14584. @item chromalin, cin
  14585. Set the input chroma location.
  14586. Possible values are:
  14587. @table @var
  14588. @item input
  14589. @item left
  14590. @item center
  14591. @item topleft
  14592. @item top
  14593. @item bottomleft
  14594. @item bottom
  14595. @end table
  14596. @item npl
  14597. Set the nominal peak luminance.
  14598. @end table
  14599. The values of the @option{w} and @option{h} options are expressions
  14600. containing the following constants:
  14601. @table @var
  14602. @item in_w
  14603. @item in_h
  14604. The input width and height
  14605. @item iw
  14606. @item ih
  14607. These are the same as @var{in_w} and @var{in_h}.
  14608. @item out_w
  14609. @item out_h
  14610. The output (scaled) width and height
  14611. @item ow
  14612. @item oh
  14613. These are the same as @var{out_w} and @var{out_h}
  14614. @item a
  14615. The same as @var{iw} / @var{ih}
  14616. @item sar
  14617. input sample aspect ratio
  14618. @item dar
  14619. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14620. @item hsub
  14621. @item vsub
  14622. horizontal and vertical input chroma subsample values. For example for the
  14623. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14624. @item ohsub
  14625. @item ovsub
  14626. horizontal and vertical output chroma subsample values. For example for the
  14627. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14628. @end table
  14629. @table @option
  14630. @end table
  14631. @c man end VIDEO FILTERS
  14632. @chapter OpenCL Video Filters
  14633. @c man begin OPENCL VIDEO FILTERS
  14634. Below is a description of the currently available OpenCL video filters.
  14635. To enable compilation of these filters you need to configure FFmpeg with
  14636. @code{--enable-opencl}.
  14637. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14638. @table @option
  14639. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14640. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14641. given device parameters.
  14642. @item -filter_hw_device @var{name}
  14643. Pass the hardware device called @var{name} to all filters in any filter graph.
  14644. @end table
  14645. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14646. @itemize
  14647. @item
  14648. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14649. @example
  14650. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14651. @end example
  14652. @end itemize
  14653. 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.
  14654. @section avgblur_opencl
  14655. Apply average blur filter.
  14656. The filter accepts the following options:
  14657. @table @option
  14658. @item sizeX
  14659. Set horizontal radius size.
  14660. Range is @code{[1, 1024]} and default value is @code{1}.
  14661. @item planes
  14662. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14663. @item sizeY
  14664. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14665. @end table
  14666. @subsection Example
  14667. @itemize
  14668. @item
  14669. 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.
  14670. @example
  14671. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14672. @end example
  14673. @end itemize
  14674. @section boxblur_opencl
  14675. Apply a boxblur algorithm to the input video.
  14676. It accepts the following parameters:
  14677. @table @option
  14678. @item luma_radius, lr
  14679. @item luma_power, lp
  14680. @item chroma_radius, cr
  14681. @item chroma_power, cp
  14682. @item alpha_radius, ar
  14683. @item alpha_power, ap
  14684. @end table
  14685. A description of the accepted options follows.
  14686. @table @option
  14687. @item luma_radius, lr
  14688. @item chroma_radius, cr
  14689. @item alpha_radius, ar
  14690. Set an expression for the box radius in pixels used for blurring the
  14691. corresponding input plane.
  14692. The radius value must be a non-negative number, and must not be
  14693. greater than the value of the expression @code{min(w,h)/2} for the
  14694. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14695. planes.
  14696. Default value for @option{luma_radius} is "2". If not specified,
  14697. @option{chroma_radius} and @option{alpha_radius} default to the
  14698. corresponding value set for @option{luma_radius}.
  14699. The expressions can contain the following constants:
  14700. @table @option
  14701. @item w
  14702. @item h
  14703. The input width and height in pixels.
  14704. @item cw
  14705. @item ch
  14706. The input chroma image width and height in pixels.
  14707. @item hsub
  14708. @item vsub
  14709. The horizontal and vertical chroma subsample values. For example, for the
  14710. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14711. @end table
  14712. @item luma_power, lp
  14713. @item chroma_power, cp
  14714. @item alpha_power, ap
  14715. Specify how many times the boxblur filter is applied to the
  14716. corresponding plane.
  14717. Default value for @option{luma_power} is 2. If not specified,
  14718. @option{chroma_power} and @option{alpha_power} default to the
  14719. corresponding value set for @option{luma_power}.
  14720. A value of 0 will disable the effect.
  14721. @end table
  14722. @subsection Examples
  14723. 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.
  14724. @itemize
  14725. @item
  14726. Apply a boxblur filter with the luma, chroma, and alpha radius
  14727. 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.
  14728. @example
  14729. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14730. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14731. @end example
  14732. @item
  14733. 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.
  14734. For the luma plane, a 2x2 box radius will be run once.
  14735. For the chroma plane, a 4x4 box radius will be run 5 times.
  14736. For the alpha plane, a 3x3 box radius will be run 7 times.
  14737. @example
  14738. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14739. @end example
  14740. @end itemize
  14741. @section convolution_opencl
  14742. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14743. The filter accepts the following options:
  14744. @table @option
  14745. @item 0m
  14746. @item 1m
  14747. @item 2m
  14748. @item 3m
  14749. Set matrix for each plane.
  14750. Matrix is sequence of 9, 25 or 49 signed numbers.
  14751. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14752. @item 0rdiv
  14753. @item 1rdiv
  14754. @item 2rdiv
  14755. @item 3rdiv
  14756. Set multiplier for calculated value for each plane.
  14757. If unset or 0, it will be sum of all matrix elements.
  14758. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14759. @item 0bias
  14760. @item 1bias
  14761. @item 2bias
  14762. @item 3bias
  14763. Set bias for each plane. This value is added to the result of the multiplication.
  14764. Useful for making the overall image brighter or darker.
  14765. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14766. @end table
  14767. @subsection Examples
  14768. @itemize
  14769. @item
  14770. Apply sharpen:
  14771. @example
  14772. -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
  14773. @end example
  14774. @item
  14775. Apply blur:
  14776. @example
  14777. -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
  14778. @end example
  14779. @item
  14780. Apply edge enhance:
  14781. @example
  14782. -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
  14783. @end example
  14784. @item
  14785. Apply edge detect:
  14786. @example
  14787. -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
  14788. @end example
  14789. @item
  14790. Apply laplacian edge detector which includes diagonals:
  14791. @example
  14792. -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
  14793. @end example
  14794. @item
  14795. Apply emboss:
  14796. @example
  14797. -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
  14798. @end example
  14799. @end itemize
  14800. @section dilation_opencl
  14801. Apply dilation effect to the video.
  14802. This filter replaces the pixel by the local(3x3) maximum.
  14803. It accepts the following options:
  14804. @table @option
  14805. @item threshold0
  14806. @item threshold1
  14807. @item threshold2
  14808. @item threshold3
  14809. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14810. If @code{0}, plane will remain unchanged.
  14811. @item coordinates
  14812. Flag which specifies the pixel to refer to.
  14813. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14814. Flags to local 3x3 coordinates region centered on @code{x}:
  14815. 1 2 3
  14816. 4 x 5
  14817. 6 7 8
  14818. @end table
  14819. @subsection Example
  14820. @itemize
  14821. @item
  14822. 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.
  14823. @example
  14824. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14825. @end example
  14826. @end itemize
  14827. @section erosion_opencl
  14828. Apply erosion effect to the video.
  14829. This filter replaces the pixel by the local(3x3) minimum.
  14830. It accepts the following options:
  14831. @table @option
  14832. @item threshold0
  14833. @item threshold1
  14834. @item threshold2
  14835. @item threshold3
  14836. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14837. If @code{0}, plane will remain unchanged.
  14838. @item coordinates
  14839. Flag which specifies the pixel to refer to.
  14840. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14841. Flags to local 3x3 coordinates region centered on @code{x}:
  14842. 1 2 3
  14843. 4 x 5
  14844. 6 7 8
  14845. @end table
  14846. @subsection Example
  14847. @itemize
  14848. @item
  14849. 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.
  14850. @example
  14851. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14852. @end example
  14853. @end itemize
  14854. @section colorkey_opencl
  14855. RGB colorspace color keying.
  14856. The filter accepts the following options:
  14857. @table @option
  14858. @item color
  14859. The color which will be replaced with transparency.
  14860. @item similarity
  14861. Similarity percentage with the key color.
  14862. 0.01 matches only the exact key color, while 1.0 matches everything.
  14863. @item blend
  14864. Blend percentage.
  14865. 0.0 makes pixels either fully transparent, or not transparent at all.
  14866. Higher values result in semi-transparent pixels, with a higher transparency
  14867. the more similar the pixels color is to the key color.
  14868. @end table
  14869. @subsection Examples
  14870. @itemize
  14871. @item
  14872. Make every semi-green pixel in the input transparent with some slight blending:
  14873. @example
  14874. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  14875. @end example
  14876. @end itemize
  14877. @section nlmeans_opencl
  14878. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  14879. @section overlay_opencl
  14880. Overlay one video on top of another.
  14881. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14882. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14883. The filter accepts the following options:
  14884. @table @option
  14885. @item x
  14886. Set the x coordinate of the overlaid video on the main video.
  14887. Default value is @code{0}.
  14888. @item y
  14889. Set the x coordinate of the overlaid video on the main video.
  14890. Default value is @code{0}.
  14891. @end table
  14892. @subsection Examples
  14893. @itemize
  14894. @item
  14895. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14896. @example
  14897. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14898. @end example
  14899. @item
  14900. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14901. @example
  14902. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14903. @end example
  14904. @end itemize
  14905. @section prewitt_opencl
  14906. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14907. The filter accepts the following option:
  14908. @table @option
  14909. @item planes
  14910. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14911. @item scale
  14912. Set value which will be multiplied with filtered result.
  14913. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14914. @item delta
  14915. Set value which will be added to filtered result.
  14916. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14917. @end table
  14918. @subsection Example
  14919. @itemize
  14920. @item
  14921. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14922. @example
  14923. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14924. @end example
  14925. @end itemize
  14926. @section roberts_opencl
  14927. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14928. The filter accepts the following option:
  14929. @table @option
  14930. @item planes
  14931. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14932. @item scale
  14933. Set value which will be multiplied with filtered result.
  14934. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14935. @item delta
  14936. Set value which will be added to filtered result.
  14937. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14938. @end table
  14939. @subsection Example
  14940. @itemize
  14941. @item
  14942. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14943. @example
  14944. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14945. @end example
  14946. @end itemize
  14947. @section sobel_opencl
  14948. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14949. The filter accepts the following option:
  14950. @table @option
  14951. @item planes
  14952. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14953. @item scale
  14954. Set value which will be multiplied with filtered result.
  14955. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14956. @item delta
  14957. Set value which will be added to filtered result.
  14958. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14959. @end table
  14960. @subsection Example
  14961. @itemize
  14962. @item
  14963. Apply sobel operator with scale set to 2 and delta set to 10
  14964. @example
  14965. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14966. @end example
  14967. @end itemize
  14968. @section tonemap_opencl
  14969. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14970. It accepts the following parameters:
  14971. @table @option
  14972. @item tonemap
  14973. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14974. @item param
  14975. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14976. @item desat
  14977. Apply desaturation for highlights that exceed this level of brightness. The
  14978. higher the parameter, the more color information will be preserved. This
  14979. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14980. (smoothly) turning into white instead. This makes images feel more natural,
  14981. at the cost of reducing information about out-of-range colors.
  14982. The default value is 0.5, and the algorithm here is a little different from
  14983. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14984. @item threshold
  14985. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14986. is used to detect whether the scene has changed or not. If the distance between
  14987. the current frame average brightness and the current running average exceeds
  14988. a threshold value, we would re-calculate scene average and peak brightness.
  14989. The default value is 0.2.
  14990. @item format
  14991. Specify the output pixel format.
  14992. Currently supported formats are:
  14993. @table @var
  14994. @item p010
  14995. @item nv12
  14996. @end table
  14997. @item range, r
  14998. Set the output color range.
  14999. Possible values are:
  15000. @table @var
  15001. @item tv/mpeg
  15002. @item pc/jpeg
  15003. @end table
  15004. Default is same as input.
  15005. @item primaries, p
  15006. Set the output color primaries.
  15007. Possible values are:
  15008. @table @var
  15009. @item bt709
  15010. @item bt2020
  15011. @end table
  15012. Default is same as input.
  15013. @item transfer, t
  15014. Set the output transfer characteristics.
  15015. Possible values are:
  15016. @table @var
  15017. @item bt709
  15018. @item bt2020
  15019. @end table
  15020. Default is bt709.
  15021. @item matrix, m
  15022. Set the output colorspace matrix.
  15023. Possible value are:
  15024. @table @var
  15025. @item bt709
  15026. @item bt2020
  15027. @end table
  15028. Default is same as input.
  15029. @end table
  15030. @subsection Example
  15031. @itemize
  15032. @item
  15033. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15034. @example
  15035. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15036. @end example
  15037. @end itemize
  15038. @section unsharp_opencl
  15039. Sharpen or blur the input video.
  15040. It accepts the following parameters:
  15041. @table @option
  15042. @item luma_msize_x, lx
  15043. Set the luma matrix horizontal size.
  15044. Range is @code{[1, 23]} and default value is @code{5}.
  15045. @item luma_msize_y, ly
  15046. Set the luma matrix vertical size.
  15047. Range is @code{[1, 23]} and default value is @code{5}.
  15048. @item luma_amount, la
  15049. Set the luma effect strength.
  15050. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15051. Negative values will blur the input video, while positive values will
  15052. sharpen it, a value of zero will disable the effect.
  15053. @item chroma_msize_x, cx
  15054. Set the chroma matrix horizontal size.
  15055. Range is @code{[1, 23]} and default value is @code{5}.
  15056. @item chroma_msize_y, cy
  15057. Set the chroma matrix vertical size.
  15058. Range is @code{[1, 23]} and default value is @code{5}.
  15059. @item chroma_amount, ca
  15060. Set the chroma effect strength.
  15061. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15062. Negative values will blur the input video, while positive values will
  15063. sharpen it, a value of zero will disable the effect.
  15064. @end table
  15065. All parameters are optional and default to the equivalent of the
  15066. string '5:5:1.0:5:5:0.0'.
  15067. @subsection Examples
  15068. @itemize
  15069. @item
  15070. Apply strong luma sharpen effect:
  15071. @example
  15072. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15073. @end example
  15074. @item
  15075. Apply a strong blur of both luma and chroma parameters:
  15076. @example
  15077. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15078. @end example
  15079. @end itemize
  15080. @c man end OPENCL VIDEO FILTERS
  15081. @chapter Video Sources
  15082. @c man begin VIDEO SOURCES
  15083. Below is a description of the currently available video sources.
  15084. @section buffer
  15085. Buffer video frames, and make them available to the filter chain.
  15086. This source is mainly intended for a programmatic use, in particular
  15087. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15088. It accepts the following parameters:
  15089. @table @option
  15090. @item video_size
  15091. Specify the size (width and height) of the buffered video frames. For the
  15092. syntax of this option, check the
  15093. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15094. @item width
  15095. The input video width.
  15096. @item height
  15097. The input video height.
  15098. @item pix_fmt
  15099. A string representing the pixel format of the buffered video frames.
  15100. It may be a number corresponding to a pixel format, or a pixel format
  15101. name.
  15102. @item time_base
  15103. Specify the timebase assumed by the timestamps of the buffered frames.
  15104. @item frame_rate
  15105. Specify the frame rate expected for the video stream.
  15106. @item pixel_aspect, sar
  15107. The sample (pixel) aspect ratio of the input video.
  15108. @item sws_param
  15109. Specify the optional parameters to be used for the scale filter which
  15110. is automatically inserted when an input change is detected in the
  15111. input size or format.
  15112. @item hw_frames_ctx
  15113. When using a hardware pixel format, this should be a reference to an
  15114. AVHWFramesContext describing input frames.
  15115. @end table
  15116. For example:
  15117. @example
  15118. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15119. @end example
  15120. will instruct the source to accept video frames with size 320x240 and
  15121. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15122. square pixels (1:1 sample aspect ratio).
  15123. Since the pixel format with name "yuv410p" corresponds to the number 6
  15124. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15125. this example corresponds to:
  15126. @example
  15127. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15128. @end example
  15129. Alternatively, the options can be specified as a flat string, but this
  15130. syntax is deprecated:
  15131. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  15132. @section cellauto
  15133. Create a pattern generated by an elementary cellular automaton.
  15134. The initial state of the cellular automaton can be defined through the
  15135. @option{filename} and @option{pattern} options. If such options are
  15136. not specified an initial state is created randomly.
  15137. At each new frame a new row in the video is filled with the result of
  15138. the cellular automaton next generation. The behavior when the whole
  15139. frame is filled is defined by the @option{scroll} option.
  15140. This source accepts the following options:
  15141. @table @option
  15142. @item filename, f
  15143. Read the initial cellular automaton state, i.e. the starting row, from
  15144. the specified file.
  15145. In the file, each non-whitespace character is considered an alive
  15146. cell, a newline will terminate the row, and further characters in the
  15147. file will be ignored.
  15148. @item pattern, p
  15149. Read the initial cellular automaton state, i.e. the starting row, from
  15150. the specified string.
  15151. Each non-whitespace character in the string is considered an alive
  15152. cell, a newline will terminate the row, and further characters in the
  15153. string will be ignored.
  15154. @item rate, r
  15155. Set the video rate, that is the number of frames generated per second.
  15156. Default is 25.
  15157. @item random_fill_ratio, ratio
  15158. Set the random fill ratio for the initial cellular automaton row. It
  15159. is a floating point number value ranging from 0 to 1, defaults to
  15160. 1/PHI.
  15161. This option is ignored when a file or a pattern is specified.
  15162. @item random_seed, seed
  15163. Set the seed for filling randomly the initial row, must be an integer
  15164. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15165. set to -1, the filter will try to use a good random seed on a best
  15166. effort basis.
  15167. @item rule
  15168. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15169. Default value is 110.
  15170. @item size, s
  15171. Set the size of the output video. For the syntax of this option, check the
  15172. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15173. If @option{filename} or @option{pattern} is specified, the size is set
  15174. by default to the width of the specified initial state row, and the
  15175. height is set to @var{width} * PHI.
  15176. If @option{size} is set, it must contain the width of the specified
  15177. pattern string, and the specified pattern will be centered in the
  15178. larger row.
  15179. If a filename or a pattern string is not specified, the size value
  15180. defaults to "320x518" (used for a randomly generated initial state).
  15181. @item scroll
  15182. If set to 1, scroll the output upward when all the rows in the output
  15183. have been already filled. If set to 0, the new generated row will be
  15184. written over the top row just after the bottom row is filled.
  15185. Defaults to 1.
  15186. @item start_full, full
  15187. If set to 1, completely fill the output with generated rows before
  15188. outputting the first frame.
  15189. This is the default behavior, for disabling set the value to 0.
  15190. @item stitch
  15191. If set to 1, stitch the left and right row edges together.
  15192. This is the default behavior, for disabling set the value to 0.
  15193. @end table
  15194. @subsection Examples
  15195. @itemize
  15196. @item
  15197. Read the initial state from @file{pattern}, and specify an output of
  15198. size 200x400.
  15199. @example
  15200. cellauto=f=pattern:s=200x400
  15201. @end example
  15202. @item
  15203. Generate a random initial row with a width of 200 cells, with a fill
  15204. ratio of 2/3:
  15205. @example
  15206. cellauto=ratio=2/3:s=200x200
  15207. @end example
  15208. @item
  15209. Create a pattern generated by rule 18 starting by a single alive cell
  15210. centered on an initial row with width 100:
  15211. @example
  15212. cellauto=p=@@:s=100x400:full=0:rule=18
  15213. @end example
  15214. @item
  15215. Specify a more elaborated initial pattern:
  15216. @example
  15217. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15218. @end example
  15219. @end itemize
  15220. @anchor{coreimagesrc}
  15221. @section coreimagesrc
  15222. Video source generated on GPU using Apple's CoreImage API on OSX.
  15223. This video source is a specialized version of the @ref{coreimage} video filter.
  15224. Use a core image generator at the beginning of the applied filterchain to
  15225. generate the content.
  15226. The coreimagesrc video source accepts the following options:
  15227. @table @option
  15228. @item list_generators
  15229. List all available generators along with all their respective options as well as
  15230. possible minimum and maximum values along with the default values.
  15231. @example
  15232. list_generators=true
  15233. @end example
  15234. @item size, s
  15235. Specify the size of the sourced video. For the syntax of this option, check the
  15236. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15237. The default value is @code{320x240}.
  15238. @item rate, r
  15239. Specify the frame rate of the sourced video, as the number of frames
  15240. generated per second. It has to be a string in the format
  15241. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15242. number or a valid video frame rate abbreviation. The default value is
  15243. "25".
  15244. @item sar
  15245. Set the sample aspect ratio of the sourced video.
  15246. @item duration, d
  15247. Set the duration of the sourced video. See
  15248. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15249. for the accepted syntax.
  15250. If not specified, or the expressed duration is negative, the video is
  15251. supposed to be generated forever.
  15252. @end table
  15253. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15254. A complete filterchain can be used for further processing of the
  15255. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15256. and examples for details.
  15257. @subsection Examples
  15258. @itemize
  15259. @item
  15260. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15261. given as complete and escaped command-line for Apple's standard bash shell:
  15262. @example
  15263. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15264. @end example
  15265. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15266. need for a nullsrc video source.
  15267. @end itemize
  15268. @section mandelbrot
  15269. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15270. point specified with @var{start_x} and @var{start_y}.
  15271. This source accepts the following options:
  15272. @table @option
  15273. @item end_pts
  15274. Set the terminal pts value. Default value is 400.
  15275. @item end_scale
  15276. Set the terminal scale value.
  15277. Must be a floating point value. Default value is 0.3.
  15278. @item inner
  15279. Set the inner coloring mode, that is the algorithm used to draw the
  15280. Mandelbrot fractal internal region.
  15281. It shall assume one of the following values:
  15282. @table @option
  15283. @item black
  15284. Set black mode.
  15285. @item convergence
  15286. Show time until convergence.
  15287. @item mincol
  15288. Set color based on point closest to the origin of the iterations.
  15289. @item period
  15290. Set period mode.
  15291. @end table
  15292. Default value is @var{mincol}.
  15293. @item bailout
  15294. Set the bailout value. Default value is 10.0.
  15295. @item maxiter
  15296. Set the maximum of iterations performed by the rendering
  15297. algorithm. Default value is 7189.
  15298. @item outer
  15299. Set outer coloring mode.
  15300. It shall assume one of following values:
  15301. @table @option
  15302. @item iteration_count
  15303. Set iteration count mode.
  15304. @item normalized_iteration_count
  15305. set normalized iteration count mode.
  15306. @end table
  15307. Default value is @var{normalized_iteration_count}.
  15308. @item rate, r
  15309. Set frame rate, expressed as number of frames per second. Default
  15310. value is "25".
  15311. @item size, s
  15312. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15313. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15314. @item start_scale
  15315. Set the initial scale value. Default value is 3.0.
  15316. @item start_x
  15317. Set the initial x position. Must be a floating point value between
  15318. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15319. @item start_y
  15320. Set the initial y position. Must be a floating point value between
  15321. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15322. @end table
  15323. @section mptestsrc
  15324. Generate various test patterns, as generated by the MPlayer test filter.
  15325. The size of the generated video is fixed, and is 256x256.
  15326. This source is useful in particular for testing encoding features.
  15327. This source accepts the following options:
  15328. @table @option
  15329. @item rate, r
  15330. Specify the frame rate of the sourced video, as the number of frames
  15331. generated per second. It has to be a string in the format
  15332. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15333. number or a valid video frame rate abbreviation. The default value is
  15334. "25".
  15335. @item duration, d
  15336. Set the duration of the sourced video. See
  15337. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15338. for the accepted syntax.
  15339. If not specified, or the expressed duration is negative, the video is
  15340. supposed to be generated forever.
  15341. @item test, t
  15342. Set the number or the name of the test to perform. Supported tests are:
  15343. @table @option
  15344. @item dc_luma
  15345. @item dc_chroma
  15346. @item freq_luma
  15347. @item freq_chroma
  15348. @item amp_luma
  15349. @item amp_chroma
  15350. @item cbp
  15351. @item mv
  15352. @item ring1
  15353. @item ring2
  15354. @item all
  15355. @end table
  15356. Default value is "all", which will cycle through the list of all tests.
  15357. @end table
  15358. Some examples:
  15359. @example
  15360. mptestsrc=t=dc_luma
  15361. @end example
  15362. will generate a "dc_luma" test pattern.
  15363. @section frei0r_src
  15364. Provide a frei0r source.
  15365. To enable compilation of this filter you need to install the frei0r
  15366. header and configure FFmpeg with @code{--enable-frei0r}.
  15367. This source accepts the following parameters:
  15368. @table @option
  15369. @item size
  15370. The size of the video to generate. For the syntax of this option, check the
  15371. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15372. @item framerate
  15373. The framerate of the generated video. It may be a string of the form
  15374. @var{num}/@var{den} or a frame rate abbreviation.
  15375. @item filter_name
  15376. The name to the frei0r source to load. For more information regarding frei0r and
  15377. how to set the parameters, read the @ref{frei0r} section in the video filters
  15378. documentation.
  15379. @item filter_params
  15380. A '|'-separated list of parameters to pass to the frei0r source.
  15381. @end table
  15382. For example, to generate a frei0r partik0l source with size 200x200
  15383. and frame rate 10 which is overlaid on the overlay filter main input:
  15384. @example
  15385. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15386. @end example
  15387. @section life
  15388. Generate a life pattern.
  15389. This source is based on a generalization of John Conway's life game.
  15390. The sourced input represents a life grid, each pixel represents a cell
  15391. which can be in one of two possible states, alive or dead. Every cell
  15392. interacts with its eight neighbours, which are the cells that are
  15393. horizontally, vertically, or diagonally adjacent.
  15394. At each interaction the grid evolves according to the adopted rule,
  15395. which specifies the number of neighbor alive cells which will make a
  15396. cell stay alive or born. The @option{rule} option allows one to specify
  15397. the rule to adopt.
  15398. This source accepts the following options:
  15399. @table @option
  15400. @item filename, f
  15401. Set the file from which to read the initial grid state. In the file,
  15402. each non-whitespace character is considered an alive cell, and newline
  15403. is used to delimit the end of each row.
  15404. If this option is not specified, the initial grid is generated
  15405. randomly.
  15406. @item rate, r
  15407. Set the video rate, that is the number of frames generated per second.
  15408. Default is 25.
  15409. @item random_fill_ratio, ratio
  15410. Set the random fill ratio for the initial random grid. It is a
  15411. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15412. It is ignored when a file is specified.
  15413. @item random_seed, seed
  15414. Set the seed for filling the initial random grid, must be an integer
  15415. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15416. set to -1, the filter will try to use a good random seed on a best
  15417. effort basis.
  15418. @item rule
  15419. Set the life rule.
  15420. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15421. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15422. @var{NS} specifies the number of alive neighbor cells which make a
  15423. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15424. which make a dead cell to become alive (i.e. to "born").
  15425. "s" and "b" can be used in place of "S" and "B", respectively.
  15426. Alternatively a rule can be specified by an 18-bits integer. The 9
  15427. high order bits are used to encode the next cell state if it is alive
  15428. for each number of neighbor alive cells, the low order bits specify
  15429. the rule for "borning" new cells. Higher order bits encode for an
  15430. higher number of neighbor cells.
  15431. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15432. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15433. Default value is "S23/B3", which is the original Conway's game of life
  15434. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15435. cells, and will born a new cell if there are three alive cells around
  15436. a dead cell.
  15437. @item size, s
  15438. Set the size of the output video. For the syntax of this option, check the
  15439. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15440. If @option{filename} is specified, the size is set by default to the
  15441. same size of the input file. If @option{size} is set, it must contain
  15442. the size specified in the input file, and the initial grid defined in
  15443. that file is centered in the larger resulting area.
  15444. If a filename is not specified, the size value defaults to "320x240"
  15445. (used for a randomly generated initial grid).
  15446. @item stitch
  15447. If set to 1, stitch the left and right grid edges together, and the
  15448. top and bottom edges also. Defaults to 1.
  15449. @item mold
  15450. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15451. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15452. value from 0 to 255.
  15453. @item life_color
  15454. Set the color of living (or new born) cells.
  15455. @item death_color
  15456. Set the color of dead cells. If @option{mold} is set, this is the first color
  15457. used to represent a dead cell.
  15458. @item mold_color
  15459. Set mold color, for definitely dead and moldy cells.
  15460. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15461. ffmpeg-utils manual,ffmpeg-utils}.
  15462. @end table
  15463. @subsection Examples
  15464. @itemize
  15465. @item
  15466. Read a grid from @file{pattern}, and center it on a grid of size
  15467. 300x300 pixels:
  15468. @example
  15469. life=f=pattern:s=300x300
  15470. @end example
  15471. @item
  15472. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15473. @example
  15474. life=ratio=2/3:s=200x200
  15475. @end example
  15476. @item
  15477. Specify a custom rule for evolving a randomly generated grid:
  15478. @example
  15479. life=rule=S14/B34
  15480. @end example
  15481. @item
  15482. Full example with slow death effect (mold) using @command{ffplay}:
  15483. @example
  15484. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15485. @end example
  15486. @end itemize
  15487. @anchor{allrgb}
  15488. @anchor{allyuv}
  15489. @anchor{color}
  15490. @anchor{haldclutsrc}
  15491. @anchor{nullsrc}
  15492. @anchor{pal75bars}
  15493. @anchor{pal100bars}
  15494. @anchor{rgbtestsrc}
  15495. @anchor{smptebars}
  15496. @anchor{smptehdbars}
  15497. @anchor{testsrc}
  15498. @anchor{testsrc2}
  15499. @anchor{yuvtestsrc}
  15500. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15501. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15502. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15503. The @code{color} source provides an uniformly colored input.
  15504. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15505. @ref{haldclut} filter.
  15506. The @code{nullsrc} source returns unprocessed video frames. It is
  15507. mainly useful to be employed in analysis / debugging tools, or as the
  15508. source for filters which ignore the input data.
  15509. The @code{pal75bars} source generates a color bars pattern, based on
  15510. EBU PAL recommendations with 75% color levels.
  15511. The @code{pal100bars} source generates a color bars pattern, based on
  15512. EBU PAL recommendations with 100% color levels.
  15513. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15514. detecting RGB vs BGR issues. You should see a red, green and blue
  15515. stripe from top to bottom.
  15516. The @code{smptebars} source generates a color bars pattern, based on
  15517. the SMPTE Engineering Guideline EG 1-1990.
  15518. The @code{smptehdbars} source generates a color bars pattern, based on
  15519. the SMPTE RP 219-2002.
  15520. The @code{testsrc} source generates a test video pattern, showing a
  15521. color pattern, a scrolling gradient and a timestamp. This is mainly
  15522. intended for testing purposes.
  15523. The @code{testsrc2} source is similar to testsrc, but supports more
  15524. pixel formats instead of just @code{rgb24}. This allows using it as an
  15525. input for other tests without requiring a format conversion.
  15526. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15527. see a y, cb and cr stripe from top to bottom.
  15528. The sources accept the following parameters:
  15529. @table @option
  15530. @item level
  15531. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15532. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15533. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15534. coded on a @code{1/(N*N)} scale.
  15535. @item color, c
  15536. Specify the color of the source, only available in the @code{color}
  15537. source. For the syntax of this option, check the
  15538. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15539. @item size, s
  15540. Specify the size of the sourced video. For the syntax of this option, check the
  15541. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15542. The default value is @code{320x240}.
  15543. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15544. @code{haldclutsrc} filters.
  15545. @item rate, r
  15546. Specify the frame rate of the sourced video, as the number of frames
  15547. generated per second. It has to be a string in the format
  15548. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15549. number or a valid video frame rate abbreviation. The default value is
  15550. "25".
  15551. @item duration, d
  15552. Set the duration of the sourced video. See
  15553. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15554. for the accepted syntax.
  15555. If not specified, or the expressed duration is negative, the video is
  15556. supposed to be generated forever.
  15557. @item sar
  15558. Set the sample aspect ratio of the sourced video.
  15559. @item alpha
  15560. Specify the alpha (opacity) of the background, only available in the
  15561. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15562. 255 (fully opaque, the default).
  15563. @item decimals, n
  15564. Set the number of decimals to show in the timestamp, only available in the
  15565. @code{testsrc} source.
  15566. The displayed timestamp value will correspond to the original
  15567. timestamp value multiplied by the power of 10 of the specified
  15568. value. Default value is 0.
  15569. @end table
  15570. @subsection Examples
  15571. @itemize
  15572. @item
  15573. Generate a video with a duration of 5.3 seconds, with size
  15574. 176x144 and a frame rate of 10 frames per second:
  15575. @example
  15576. testsrc=duration=5.3:size=qcif:rate=10
  15577. @end example
  15578. @item
  15579. The following graph description will generate a red source
  15580. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15581. frames per second:
  15582. @example
  15583. color=c=red@@0.2:s=qcif:r=10
  15584. @end example
  15585. @item
  15586. If the input content is to be ignored, @code{nullsrc} can be used. The
  15587. following command generates noise in the luminance plane by employing
  15588. the @code{geq} filter:
  15589. @example
  15590. nullsrc=s=256x256, geq=random(1)*255:128:128
  15591. @end example
  15592. @end itemize
  15593. @subsection Commands
  15594. The @code{color} source supports the following commands:
  15595. @table @option
  15596. @item c, color
  15597. Set the color of the created image. Accepts the same syntax of the
  15598. corresponding @option{color} option.
  15599. @end table
  15600. @section openclsrc
  15601. Generate video using an OpenCL program.
  15602. @table @option
  15603. @item source
  15604. OpenCL program source file.
  15605. @item kernel
  15606. Kernel name in program.
  15607. @item size, s
  15608. Size of frames to generate. This must be set.
  15609. @item format
  15610. Pixel format to use for the generated frames. This must be set.
  15611. @item rate, r
  15612. Number of frames generated every second. Default value is '25'.
  15613. @end table
  15614. For details of how the program loading works, see the @ref{program_opencl}
  15615. filter.
  15616. Example programs:
  15617. @itemize
  15618. @item
  15619. Generate a colour ramp by setting pixel values from the position of the pixel
  15620. in the output image. (Note that this will work with all pixel formats, but
  15621. the generated output will not be the same.)
  15622. @verbatim
  15623. __kernel void ramp(__write_only image2d_t dst,
  15624. unsigned int index)
  15625. {
  15626. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15627. float4 val;
  15628. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15629. write_imagef(dst, loc, val);
  15630. }
  15631. @end verbatim
  15632. @item
  15633. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15634. @verbatim
  15635. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15636. unsigned int index)
  15637. {
  15638. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15639. float4 value = 0.0f;
  15640. int x = loc.x + index;
  15641. int y = loc.y + index;
  15642. while (x > 0 || y > 0) {
  15643. if (x % 3 == 1 && y % 3 == 1) {
  15644. value = 1.0f;
  15645. break;
  15646. }
  15647. x /= 3;
  15648. y /= 3;
  15649. }
  15650. write_imagef(dst, loc, value);
  15651. }
  15652. @end verbatim
  15653. @end itemize
  15654. @c man end VIDEO SOURCES
  15655. @chapter Video Sinks
  15656. @c man begin VIDEO SINKS
  15657. Below is a description of the currently available video sinks.
  15658. @section buffersink
  15659. Buffer video frames, and make them available to the end of the filter
  15660. graph.
  15661. This sink is mainly intended for programmatic use, in particular
  15662. through the interface defined in @file{libavfilter/buffersink.h}
  15663. or the options system.
  15664. It accepts a pointer to an AVBufferSinkContext structure, which
  15665. defines the incoming buffers' formats, to be passed as the opaque
  15666. parameter to @code{avfilter_init_filter} for initialization.
  15667. @section nullsink
  15668. Null video sink: do absolutely nothing with the input video. It is
  15669. mainly useful as a template and for use in analysis / debugging
  15670. tools.
  15671. @c man end VIDEO SINKS
  15672. @chapter Multimedia Filters
  15673. @c man begin MULTIMEDIA FILTERS
  15674. Below is a description of the currently available multimedia filters.
  15675. @section abitscope
  15676. Convert input audio to a video output, displaying the audio bit scope.
  15677. The filter accepts the following options:
  15678. @table @option
  15679. @item rate, r
  15680. Set frame rate, expressed as number of frames per second. Default
  15681. value is "25".
  15682. @item size, s
  15683. Specify the video size for the output. For the syntax of this option, check the
  15684. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15685. Default value is @code{1024x256}.
  15686. @item colors
  15687. Specify list of colors separated by space or by '|' which will be used to
  15688. draw channels. Unrecognized or missing colors will be replaced
  15689. by white color.
  15690. @end table
  15691. @section ahistogram
  15692. Convert input audio to a video output, displaying the volume histogram.
  15693. The filter accepts the following options:
  15694. @table @option
  15695. @item dmode
  15696. Specify how histogram is calculated.
  15697. It accepts the following values:
  15698. @table @samp
  15699. @item single
  15700. Use single histogram for all channels.
  15701. @item separate
  15702. Use separate histogram for each channel.
  15703. @end table
  15704. Default is @code{single}.
  15705. @item rate, r
  15706. Set frame rate, expressed as number of frames per second. Default
  15707. value is "25".
  15708. @item size, s
  15709. Specify the video size for the output. For the syntax of this option, check the
  15710. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15711. Default value is @code{hd720}.
  15712. @item scale
  15713. Set display scale.
  15714. It accepts the following values:
  15715. @table @samp
  15716. @item log
  15717. logarithmic
  15718. @item sqrt
  15719. square root
  15720. @item cbrt
  15721. cubic root
  15722. @item lin
  15723. linear
  15724. @item rlog
  15725. reverse logarithmic
  15726. @end table
  15727. Default is @code{log}.
  15728. @item ascale
  15729. Set amplitude scale.
  15730. It accepts the following values:
  15731. @table @samp
  15732. @item log
  15733. logarithmic
  15734. @item lin
  15735. linear
  15736. @end table
  15737. Default is @code{log}.
  15738. @item acount
  15739. Set how much frames to accumulate in histogram.
  15740. Default is 1. Setting this to -1 accumulates all frames.
  15741. @item rheight
  15742. Set histogram ratio of window height.
  15743. @item slide
  15744. Set sonogram sliding.
  15745. It accepts the following values:
  15746. @table @samp
  15747. @item replace
  15748. replace old rows with new ones.
  15749. @item scroll
  15750. scroll from top to bottom.
  15751. @end table
  15752. Default is @code{replace}.
  15753. @end table
  15754. @section aphasemeter
  15755. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15756. representing mean phase of current audio frame. A video output can also be produced and is
  15757. enabled by default. The audio is passed through as first output.
  15758. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15759. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15760. and @code{1} means channels are in phase.
  15761. The filter accepts the following options, all related to its video output:
  15762. @table @option
  15763. @item rate, r
  15764. Set the output frame rate. Default value is @code{25}.
  15765. @item size, s
  15766. Set the video size for the output. For the syntax of this option, check the
  15767. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15768. Default value is @code{800x400}.
  15769. @item rc
  15770. @item gc
  15771. @item bc
  15772. Specify the red, green, blue contrast. Default values are @code{2},
  15773. @code{7} and @code{1}.
  15774. Allowed range is @code{[0, 255]}.
  15775. @item mpc
  15776. Set color which will be used for drawing median phase. If color is
  15777. @code{none} which is default, no median phase value will be drawn.
  15778. @item video
  15779. Enable video output. Default is enabled.
  15780. @end table
  15781. @section avectorscope
  15782. Convert input audio to a video output, representing the audio vector
  15783. scope.
  15784. The filter is used to measure the difference between channels of stereo
  15785. audio stream. A monoaural signal, consisting of identical left and right
  15786. signal, results in straight vertical line. Any stereo separation is visible
  15787. as a deviation from this line, creating a Lissajous figure.
  15788. If the straight (or deviation from it) but horizontal line appears this
  15789. indicates that the left and right channels are out of phase.
  15790. The filter accepts the following options:
  15791. @table @option
  15792. @item mode, m
  15793. Set the vectorscope mode.
  15794. Available values are:
  15795. @table @samp
  15796. @item lissajous
  15797. Lissajous rotated by 45 degrees.
  15798. @item lissajous_xy
  15799. Same as above but not rotated.
  15800. @item polar
  15801. Shape resembling half of circle.
  15802. @end table
  15803. Default value is @samp{lissajous}.
  15804. @item size, s
  15805. Set the video size for the output. For the syntax of this option, check the
  15806. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15807. Default value is @code{400x400}.
  15808. @item rate, r
  15809. Set the output frame rate. Default value is @code{25}.
  15810. @item rc
  15811. @item gc
  15812. @item bc
  15813. @item ac
  15814. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15815. @code{160}, @code{80} and @code{255}.
  15816. Allowed range is @code{[0, 255]}.
  15817. @item rf
  15818. @item gf
  15819. @item bf
  15820. @item af
  15821. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15822. @code{10}, @code{5} and @code{5}.
  15823. Allowed range is @code{[0, 255]}.
  15824. @item zoom
  15825. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15826. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15827. @item draw
  15828. Set the vectorscope drawing mode.
  15829. Available values are:
  15830. @table @samp
  15831. @item dot
  15832. Draw dot for each sample.
  15833. @item line
  15834. Draw line between previous and current sample.
  15835. @end table
  15836. Default value is @samp{dot}.
  15837. @item scale
  15838. Specify amplitude scale of audio samples.
  15839. Available values are:
  15840. @table @samp
  15841. @item lin
  15842. Linear.
  15843. @item sqrt
  15844. Square root.
  15845. @item cbrt
  15846. Cubic root.
  15847. @item log
  15848. Logarithmic.
  15849. @end table
  15850. @item swap
  15851. Swap left channel axis with right channel axis.
  15852. @item mirror
  15853. Mirror axis.
  15854. @table @samp
  15855. @item none
  15856. No mirror.
  15857. @item x
  15858. Mirror only x axis.
  15859. @item y
  15860. Mirror only y axis.
  15861. @item xy
  15862. Mirror both axis.
  15863. @end table
  15864. @end table
  15865. @subsection Examples
  15866. @itemize
  15867. @item
  15868. Complete example using @command{ffplay}:
  15869. @example
  15870. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15871. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15872. @end example
  15873. @end itemize
  15874. @section bench, abench
  15875. Benchmark part of a filtergraph.
  15876. The filter accepts the following options:
  15877. @table @option
  15878. @item action
  15879. Start or stop a timer.
  15880. Available values are:
  15881. @table @samp
  15882. @item start
  15883. Get the current time, set it as frame metadata (using the key
  15884. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15885. @item stop
  15886. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15887. the input frame metadata to get the time difference. Time difference, average,
  15888. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15889. @code{min}) are then printed. The timestamps are expressed in seconds.
  15890. @end table
  15891. @end table
  15892. @subsection Examples
  15893. @itemize
  15894. @item
  15895. Benchmark @ref{selectivecolor} filter:
  15896. @example
  15897. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15898. @end example
  15899. @end itemize
  15900. @section concat
  15901. Concatenate audio and video streams, joining them together one after the
  15902. other.
  15903. The filter works on segments of synchronized video and audio streams. All
  15904. segments must have the same number of streams of each type, and that will
  15905. also be the number of streams at output.
  15906. The filter accepts the following options:
  15907. @table @option
  15908. @item n
  15909. Set the number of segments. Default is 2.
  15910. @item v
  15911. Set the number of output video streams, that is also the number of video
  15912. streams in each segment. Default is 1.
  15913. @item a
  15914. Set the number of output audio streams, that is also the number of audio
  15915. streams in each segment. Default is 0.
  15916. @item unsafe
  15917. Activate unsafe mode: do not fail if segments have a different format.
  15918. @end table
  15919. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15920. @var{a} audio outputs.
  15921. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15922. segment, in the same order as the outputs, then the inputs for the second
  15923. segment, etc.
  15924. Related streams do not always have exactly the same duration, for various
  15925. reasons including codec frame size or sloppy authoring. For that reason,
  15926. related synchronized streams (e.g. a video and its audio track) should be
  15927. concatenated at once. The concat filter will use the duration of the longest
  15928. stream in each segment (except the last one), and if necessary pad shorter
  15929. audio streams with silence.
  15930. For this filter to work correctly, all segments must start at timestamp 0.
  15931. All corresponding streams must have the same parameters in all segments; the
  15932. filtering system will automatically select a common pixel format for video
  15933. streams, and a common sample format, sample rate and channel layout for
  15934. audio streams, but other settings, such as resolution, must be converted
  15935. explicitly by the user.
  15936. Different frame rates are acceptable but will result in variable frame rate
  15937. at output; be sure to configure the output file to handle it.
  15938. @subsection Examples
  15939. @itemize
  15940. @item
  15941. Concatenate an opening, an episode and an ending, all in bilingual version
  15942. (video in stream 0, audio in streams 1 and 2):
  15943. @example
  15944. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15945. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15946. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15947. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15948. @end example
  15949. @item
  15950. Concatenate two parts, handling audio and video separately, using the
  15951. (a)movie sources, and adjusting the resolution:
  15952. @example
  15953. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15954. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15955. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15956. @end example
  15957. Note that a desync will happen at the stitch if the audio and video streams
  15958. do not have exactly the same duration in the first file.
  15959. @end itemize
  15960. @subsection Commands
  15961. This filter supports the following commands:
  15962. @table @option
  15963. @item next
  15964. Close the current segment and step to the next one
  15965. @end table
  15966. @section drawgraph, adrawgraph
  15967. Draw a graph using input video or audio metadata.
  15968. It accepts the following parameters:
  15969. @table @option
  15970. @item m1
  15971. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15972. @item fg1
  15973. Set 1st foreground color expression.
  15974. @item m2
  15975. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15976. @item fg2
  15977. Set 2nd foreground color expression.
  15978. @item m3
  15979. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15980. @item fg3
  15981. Set 3rd foreground color expression.
  15982. @item m4
  15983. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15984. @item fg4
  15985. Set 4th foreground color expression.
  15986. @item min
  15987. Set minimal value of metadata value.
  15988. @item max
  15989. Set maximal value of metadata value.
  15990. @item bg
  15991. Set graph background color. Default is white.
  15992. @item mode
  15993. Set graph mode.
  15994. Available values for mode is:
  15995. @table @samp
  15996. @item bar
  15997. @item dot
  15998. @item line
  15999. @end table
  16000. Default is @code{line}.
  16001. @item slide
  16002. Set slide mode.
  16003. Available values for slide is:
  16004. @table @samp
  16005. @item frame
  16006. Draw new frame when right border is reached.
  16007. @item replace
  16008. Replace old columns with new ones.
  16009. @item scroll
  16010. Scroll from right to left.
  16011. @item rscroll
  16012. Scroll from left to right.
  16013. @item picture
  16014. Draw single picture.
  16015. @end table
  16016. Default is @code{frame}.
  16017. @item size
  16018. Set size of graph video. For the syntax of this option, check the
  16019. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16020. The default value is @code{900x256}.
  16021. The foreground color expressions can use the following variables:
  16022. @table @option
  16023. @item MIN
  16024. Minimal value of metadata value.
  16025. @item MAX
  16026. Maximal value of metadata value.
  16027. @item VAL
  16028. Current metadata key value.
  16029. @end table
  16030. The color is defined as 0xAABBGGRR.
  16031. @end table
  16032. Example using metadata from @ref{signalstats} filter:
  16033. @example
  16034. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16035. @end example
  16036. Example using metadata from @ref{ebur128} filter:
  16037. @example
  16038. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16039. @end example
  16040. @anchor{ebur128}
  16041. @section ebur128
  16042. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16043. level. By default, it logs a message at a frequency of 10Hz with the
  16044. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16045. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16046. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16047. sample format is double-precision floating point. The input stream will be converted to
  16048. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16049. after this filter to obtain the original parameters.
  16050. The filter also has a video output (see the @var{video} option) with a real
  16051. time graph to observe the loudness evolution. The graphic contains the logged
  16052. message mentioned above, so it is not printed anymore when this option is set,
  16053. unless the verbose logging is set. The main graphing area contains the
  16054. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16055. the momentary loudness (400 milliseconds), but can optionally be configured
  16056. to instead display short-term loudness (see @var{gauge}).
  16057. The green area marks a +/- 1LU target range around the target loudness
  16058. (-23LUFS by default, unless modified through @var{target}).
  16059. More information about the Loudness Recommendation EBU R128 on
  16060. @url{http://tech.ebu.ch/loudness}.
  16061. The filter accepts the following options:
  16062. @table @option
  16063. @item video
  16064. Activate the video output. The audio stream is passed unchanged whether this
  16065. option is set or no. The video stream will be the first output stream if
  16066. activated. Default is @code{0}.
  16067. @item size
  16068. Set the video size. This option is for video only. For the syntax of this
  16069. option, check the
  16070. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16071. Default and minimum resolution is @code{640x480}.
  16072. @item meter
  16073. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16074. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16075. other integer value between this range is allowed.
  16076. @item metadata
  16077. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16078. into 100ms output frames, each of them containing various loudness information
  16079. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16080. Default is @code{0}.
  16081. @item framelog
  16082. Force the frame logging level.
  16083. Available values are:
  16084. @table @samp
  16085. @item info
  16086. information logging level
  16087. @item verbose
  16088. verbose logging level
  16089. @end table
  16090. By default, the logging level is set to @var{info}. If the @option{video} or
  16091. the @option{metadata} options are set, it switches to @var{verbose}.
  16092. @item peak
  16093. Set peak mode(s).
  16094. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16095. values are:
  16096. @table @samp
  16097. @item none
  16098. Disable any peak mode (default).
  16099. @item sample
  16100. Enable sample-peak mode.
  16101. Simple peak mode looking for the higher sample value. It logs a message
  16102. for sample-peak (identified by @code{SPK}).
  16103. @item true
  16104. Enable true-peak mode.
  16105. If enabled, the peak lookup is done on an over-sampled version of the input
  16106. stream for better peak accuracy. It logs a message for true-peak.
  16107. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16108. This mode requires a build with @code{libswresample}.
  16109. @end table
  16110. @item dualmono
  16111. Treat mono input files as "dual mono". If a mono file is intended for playback
  16112. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16113. If set to @code{true}, this option will compensate for this effect.
  16114. Multi-channel input files are not affected by this option.
  16115. @item panlaw
  16116. Set a specific pan law to be used for the measurement of dual mono files.
  16117. This parameter is optional, and has a default value of -3.01dB.
  16118. @item target
  16119. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16120. This parameter is optional and has a default value of -23LUFS as specified
  16121. by EBU R128. However, material published online may prefer a level of -16LUFS
  16122. (e.g. for use with podcasts or video platforms).
  16123. @item gauge
  16124. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16125. @code{shortterm}. By default the momentary value will be used, but in certain
  16126. scenarios it may be more useful to observe the short term value instead (e.g.
  16127. live mixing).
  16128. @item scale
  16129. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16130. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16131. video output, not the summary or continuous log output.
  16132. @end table
  16133. @subsection Examples
  16134. @itemize
  16135. @item
  16136. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16137. @example
  16138. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16139. @end example
  16140. @item
  16141. Run an analysis with @command{ffmpeg}:
  16142. @example
  16143. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16144. @end example
  16145. @end itemize
  16146. @section interleave, ainterleave
  16147. Temporally interleave frames from several inputs.
  16148. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16149. These filters read frames from several inputs and send the oldest
  16150. queued frame to the output.
  16151. Input streams must have well defined, monotonically increasing frame
  16152. timestamp values.
  16153. In order to submit one frame to output, these filters need to enqueue
  16154. at least one frame for each input, so they cannot work in case one
  16155. input is not yet terminated and will not receive incoming frames.
  16156. For example consider the case when one input is a @code{select} filter
  16157. which always drops input frames. The @code{interleave} filter will keep
  16158. reading from that input, but it will never be able to send new frames
  16159. to output until the input sends an end-of-stream signal.
  16160. Also, depending on inputs synchronization, the filters will drop
  16161. frames in case one input receives more frames than the other ones, and
  16162. the queue is already filled.
  16163. These filters accept the following options:
  16164. @table @option
  16165. @item nb_inputs, n
  16166. Set the number of different inputs, it is 2 by default.
  16167. @end table
  16168. @subsection Examples
  16169. @itemize
  16170. @item
  16171. Interleave frames belonging to different streams using @command{ffmpeg}:
  16172. @example
  16173. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16174. @end example
  16175. @item
  16176. Add flickering blur effect:
  16177. @example
  16178. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16179. @end example
  16180. @end itemize
  16181. @section metadata, ametadata
  16182. Manipulate frame metadata.
  16183. This filter accepts the following options:
  16184. @table @option
  16185. @item mode
  16186. Set mode of operation of the filter.
  16187. Can be one of the following:
  16188. @table @samp
  16189. @item select
  16190. If both @code{value} and @code{key} is set, select frames
  16191. which have such metadata. If only @code{key} is set, select
  16192. every frame that has such key in metadata.
  16193. @item add
  16194. Add new metadata @code{key} and @code{value}. If key is already available
  16195. do nothing.
  16196. @item modify
  16197. Modify value of already present key.
  16198. @item delete
  16199. If @code{value} is set, delete only keys that have such value.
  16200. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16201. the frame.
  16202. @item print
  16203. Print key and its value if metadata was found. If @code{key} is not set print all
  16204. metadata values available in frame.
  16205. @end table
  16206. @item key
  16207. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16208. @item value
  16209. Set metadata value which will be used. This option is mandatory for
  16210. @code{modify} and @code{add} mode.
  16211. @item function
  16212. Which function to use when comparing metadata value and @code{value}.
  16213. Can be one of following:
  16214. @table @samp
  16215. @item same_str
  16216. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16217. @item starts_with
  16218. Values are interpreted as strings, returns true if metadata value starts with
  16219. the @code{value} option string.
  16220. @item less
  16221. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16222. @item equal
  16223. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16224. @item greater
  16225. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16226. @item expr
  16227. Values are interpreted as floats, returns true if expression from option @code{expr}
  16228. evaluates to true.
  16229. @end table
  16230. @item expr
  16231. Set expression which is used when @code{function} is set to @code{expr}.
  16232. The expression is evaluated through the eval API and can contain the following
  16233. constants:
  16234. @table @option
  16235. @item VALUE1
  16236. Float representation of @code{value} from metadata key.
  16237. @item VALUE2
  16238. Float representation of @code{value} as supplied by user in @code{value} option.
  16239. @end table
  16240. @item file
  16241. If specified in @code{print} mode, output is written to the named file. Instead of
  16242. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16243. for standard output. If @code{file} option is not set, output is written to the log
  16244. with AV_LOG_INFO loglevel.
  16245. @end table
  16246. @subsection Examples
  16247. @itemize
  16248. @item
  16249. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16250. between 0 and 1.
  16251. @example
  16252. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16253. @end example
  16254. @item
  16255. Print silencedetect output to file @file{metadata.txt}.
  16256. @example
  16257. silencedetect,ametadata=mode=print:file=metadata.txt
  16258. @end example
  16259. @item
  16260. Direct all metadata to a pipe with file descriptor 4.
  16261. @example
  16262. metadata=mode=print:file='pipe\:4'
  16263. @end example
  16264. @end itemize
  16265. @section perms, aperms
  16266. Set read/write permissions for the output frames.
  16267. These filters are mainly aimed at developers to test direct path in the
  16268. following filter in the filtergraph.
  16269. The filters accept the following options:
  16270. @table @option
  16271. @item mode
  16272. Select the permissions mode.
  16273. It accepts the following values:
  16274. @table @samp
  16275. @item none
  16276. Do nothing. This is the default.
  16277. @item ro
  16278. Set all the output frames read-only.
  16279. @item rw
  16280. Set all the output frames directly writable.
  16281. @item toggle
  16282. Make the frame read-only if writable, and writable if read-only.
  16283. @item random
  16284. Set each output frame read-only or writable randomly.
  16285. @end table
  16286. @item seed
  16287. Set the seed for the @var{random} mode, must be an integer included between
  16288. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16289. @code{-1}, the filter will try to use a good random seed on a best effort
  16290. basis.
  16291. @end table
  16292. Note: in case of auto-inserted filter between the permission filter and the
  16293. following one, the permission might not be received as expected in that
  16294. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16295. perms/aperms filter can avoid this problem.
  16296. @section realtime, arealtime
  16297. Slow down filtering to match real time approximately.
  16298. These filters will pause the filtering for a variable amount of time to
  16299. match the output rate with the input timestamps.
  16300. They are similar to the @option{re} option to @code{ffmpeg}.
  16301. They accept the following options:
  16302. @table @option
  16303. @item limit
  16304. Time limit for the pauses. Any pause longer than that will be considered
  16305. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16306. @item speed
  16307. Speed factor for processing. The value must be a float larger than zero.
  16308. Values larger than 1.0 will result in faster than realtime processing,
  16309. smaller will slow processing down. The @var{limit} is automatically adapted
  16310. accordingly. Default is 1.0.
  16311. A processing speed faster than what is possible without these filters cannot
  16312. be achieved.
  16313. @end table
  16314. @anchor{select}
  16315. @section select, aselect
  16316. Select frames to pass in output.
  16317. This filter accepts the following options:
  16318. @table @option
  16319. @item expr, e
  16320. Set expression, which is evaluated for each input frame.
  16321. If the expression is evaluated to zero, the frame is discarded.
  16322. If the evaluation result is negative or NaN, the frame is sent to the
  16323. first output; otherwise it is sent to the output with index
  16324. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16325. For example a value of @code{1.2} corresponds to the output with index
  16326. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16327. @item outputs, n
  16328. Set the number of outputs. The output to which to send the selected
  16329. frame is based on the result of the evaluation. Default value is 1.
  16330. @end table
  16331. The expression can contain the following constants:
  16332. @table @option
  16333. @item n
  16334. The (sequential) number of the filtered frame, starting from 0.
  16335. @item selected_n
  16336. The (sequential) number of the selected frame, starting from 0.
  16337. @item prev_selected_n
  16338. The sequential number of the last selected frame. It's NAN if undefined.
  16339. @item TB
  16340. The timebase of the input timestamps.
  16341. @item pts
  16342. The PTS (Presentation TimeStamp) of the filtered video frame,
  16343. expressed in @var{TB} units. It's NAN if undefined.
  16344. @item t
  16345. The PTS of the filtered video frame,
  16346. expressed in seconds. It's NAN if undefined.
  16347. @item prev_pts
  16348. The PTS of the previously filtered video frame. It's NAN if undefined.
  16349. @item prev_selected_pts
  16350. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16351. @item prev_selected_t
  16352. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16353. @item start_pts
  16354. The PTS of the first video frame in the video. It's NAN if undefined.
  16355. @item start_t
  16356. The time of the first video frame in the video. It's NAN if undefined.
  16357. @item pict_type @emph{(video only)}
  16358. The type of the filtered frame. It can assume one of the following
  16359. values:
  16360. @table @option
  16361. @item I
  16362. @item P
  16363. @item B
  16364. @item S
  16365. @item SI
  16366. @item SP
  16367. @item BI
  16368. @end table
  16369. @item interlace_type @emph{(video only)}
  16370. The frame interlace type. It can assume one of the following values:
  16371. @table @option
  16372. @item PROGRESSIVE
  16373. The frame is progressive (not interlaced).
  16374. @item TOPFIRST
  16375. The frame is top-field-first.
  16376. @item BOTTOMFIRST
  16377. The frame is bottom-field-first.
  16378. @end table
  16379. @item consumed_sample_n @emph{(audio only)}
  16380. the number of selected samples before the current frame
  16381. @item samples_n @emph{(audio only)}
  16382. the number of samples in the current frame
  16383. @item sample_rate @emph{(audio only)}
  16384. the input sample rate
  16385. @item key
  16386. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16387. @item pos
  16388. the position in the file of the filtered frame, -1 if the information
  16389. is not available (e.g. for synthetic video)
  16390. @item scene @emph{(video only)}
  16391. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16392. probability for the current frame to introduce a new scene, while a higher
  16393. value means the current frame is more likely to be one (see the example below)
  16394. @item concatdec_select
  16395. The concat demuxer can select only part of a concat input file by setting an
  16396. inpoint and an outpoint, but the output packets may not be entirely contained
  16397. in the selected interval. By using this variable, it is possible to skip frames
  16398. generated by the concat demuxer which are not exactly contained in the selected
  16399. interval.
  16400. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16401. and the @var{lavf.concat.duration} packet metadata values which are also
  16402. present in the decoded frames.
  16403. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16404. start_time and either the duration metadata is missing or the frame pts is less
  16405. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16406. missing.
  16407. That basically means that an input frame is selected if its pts is within the
  16408. interval set by the concat demuxer.
  16409. @end table
  16410. The default value of the select expression is "1".
  16411. @subsection Examples
  16412. @itemize
  16413. @item
  16414. Select all frames in input:
  16415. @example
  16416. select
  16417. @end example
  16418. The example above is the same as:
  16419. @example
  16420. select=1
  16421. @end example
  16422. @item
  16423. Skip all frames:
  16424. @example
  16425. select=0
  16426. @end example
  16427. @item
  16428. Select only I-frames:
  16429. @example
  16430. select='eq(pict_type\,I)'
  16431. @end example
  16432. @item
  16433. Select one frame every 100:
  16434. @example
  16435. select='not(mod(n\,100))'
  16436. @end example
  16437. @item
  16438. Select only frames contained in the 10-20 time interval:
  16439. @example
  16440. select=between(t\,10\,20)
  16441. @end example
  16442. @item
  16443. Select only I-frames contained in the 10-20 time interval:
  16444. @example
  16445. select=between(t\,10\,20)*eq(pict_type\,I)
  16446. @end example
  16447. @item
  16448. Select frames with a minimum distance of 10 seconds:
  16449. @example
  16450. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16451. @end example
  16452. @item
  16453. Use aselect to select only audio frames with samples number > 100:
  16454. @example
  16455. aselect='gt(samples_n\,100)'
  16456. @end example
  16457. @item
  16458. Create a mosaic of the first scenes:
  16459. @example
  16460. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16461. @end example
  16462. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16463. choice.
  16464. @item
  16465. Send even and odd frames to separate outputs, and compose them:
  16466. @example
  16467. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16468. @end example
  16469. @item
  16470. Select useful frames from an ffconcat file which is using inpoints and
  16471. outpoints but where the source files are not intra frame only.
  16472. @example
  16473. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16474. @end example
  16475. @end itemize
  16476. @section sendcmd, asendcmd
  16477. Send commands to filters in the filtergraph.
  16478. These filters read commands to be sent to other filters in the
  16479. filtergraph.
  16480. @code{sendcmd} must be inserted between two video filters,
  16481. @code{asendcmd} must be inserted between two audio filters, but apart
  16482. from that they act the same way.
  16483. The specification of commands can be provided in the filter arguments
  16484. with the @var{commands} option, or in a file specified by the
  16485. @var{filename} option.
  16486. These filters accept the following options:
  16487. @table @option
  16488. @item commands, c
  16489. Set the commands to be read and sent to the other filters.
  16490. @item filename, f
  16491. Set the filename of the commands to be read and sent to the other
  16492. filters.
  16493. @end table
  16494. @subsection Commands syntax
  16495. A commands description consists of a sequence of interval
  16496. specifications, comprising a list of commands to be executed when a
  16497. particular event related to that interval occurs. The occurring event
  16498. is typically the current frame time entering or leaving a given time
  16499. interval.
  16500. An interval is specified by the following syntax:
  16501. @example
  16502. @var{START}[-@var{END}] @var{COMMANDS};
  16503. @end example
  16504. The time interval is specified by the @var{START} and @var{END} times.
  16505. @var{END} is optional and defaults to the maximum time.
  16506. The current frame time is considered within the specified interval if
  16507. it is included in the interval [@var{START}, @var{END}), that is when
  16508. the time is greater or equal to @var{START} and is lesser than
  16509. @var{END}.
  16510. @var{COMMANDS} consists of a sequence of one or more command
  16511. specifications, separated by ",", relating to that interval. The
  16512. syntax of a command specification is given by:
  16513. @example
  16514. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16515. @end example
  16516. @var{FLAGS} is optional and specifies the type of events relating to
  16517. the time interval which enable sending the specified command, and must
  16518. be a non-null sequence of identifier flags separated by "+" or "|" and
  16519. enclosed between "[" and "]".
  16520. The following flags are recognized:
  16521. @table @option
  16522. @item enter
  16523. The command is sent when the current frame timestamp enters the
  16524. specified interval. In other words, the command is sent when the
  16525. previous frame timestamp was not in the given interval, and the
  16526. current is.
  16527. @item leave
  16528. The command is sent when the current frame timestamp leaves the
  16529. specified interval. In other words, the command is sent when the
  16530. previous frame timestamp was in the given interval, and the
  16531. current is not.
  16532. @end table
  16533. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16534. assumed.
  16535. @var{TARGET} specifies the target of the command, usually the name of
  16536. the filter class or a specific filter instance name.
  16537. @var{COMMAND} specifies the name of the command for the target filter.
  16538. @var{ARG} is optional and specifies the optional list of argument for
  16539. the given @var{COMMAND}.
  16540. Between one interval specification and another, whitespaces, or
  16541. sequences of characters starting with @code{#} until the end of line,
  16542. are ignored and can be used to annotate comments.
  16543. A simplified BNF description of the commands specification syntax
  16544. follows:
  16545. @example
  16546. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16547. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16548. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16549. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16550. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16551. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16552. @end example
  16553. @subsection Examples
  16554. @itemize
  16555. @item
  16556. Specify audio tempo change at second 4:
  16557. @example
  16558. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16559. @end example
  16560. @item
  16561. Target a specific filter instance:
  16562. @example
  16563. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16564. @end example
  16565. @item
  16566. Specify a list of drawtext and hue commands in a file.
  16567. @example
  16568. # show text in the interval 5-10
  16569. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16570. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16571. # desaturate the image in the interval 15-20
  16572. 15.0-20.0 [enter] hue s 0,
  16573. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16574. [leave] hue s 1,
  16575. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16576. # apply an exponential saturation fade-out effect, starting from time 25
  16577. 25 [enter] hue s exp(25-t)
  16578. @end example
  16579. A filtergraph allowing to read and process the above command list
  16580. stored in a file @file{test.cmd}, can be specified with:
  16581. @example
  16582. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16583. @end example
  16584. @end itemize
  16585. @anchor{setpts}
  16586. @section setpts, asetpts
  16587. Change the PTS (presentation timestamp) of the input frames.
  16588. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16589. This filter accepts the following options:
  16590. @table @option
  16591. @item expr
  16592. The expression which is evaluated for each frame to construct its timestamp.
  16593. @end table
  16594. The expression is evaluated through the eval API and can contain the following
  16595. constants:
  16596. @table @option
  16597. @item FRAME_RATE, FR
  16598. frame rate, only defined for constant frame-rate video
  16599. @item PTS
  16600. The presentation timestamp in input
  16601. @item N
  16602. The count of the input frame for video or the number of consumed samples,
  16603. not including the current frame for audio, starting from 0.
  16604. @item NB_CONSUMED_SAMPLES
  16605. The number of consumed samples, not including the current frame (only
  16606. audio)
  16607. @item NB_SAMPLES, S
  16608. The number of samples in the current frame (only audio)
  16609. @item SAMPLE_RATE, SR
  16610. The audio sample rate.
  16611. @item STARTPTS
  16612. The PTS of the first frame.
  16613. @item STARTT
  16614. the time in seconds of the first frame
  16615. @item INTERLACED
  16616. State whether the current frame is interlaced.
  16617. @item T
  16618. the time in seconds of the current frame
  16619. @item POS
  16620. original position in the file of the frame, or undefined if undefined
  16621. for the current frame
  16622. @item PREV_INPTS
  16623. The previous input PTS.
  16624. @item PREV_INT
  16625. previous input time in seconds
  16626. @item PREV_OUTPTS
  16627. The previous output PTS.
  16628. @item PREV_OUTT
  16629. previous output time in seconds
  16630. @item RTCTIME
  16631. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16632. instead.
  16633. @item RTCSTART
  16634. The wallclock (RTC) time at the start of the movie in microseconds.
  16635. @item TB
  16636. The timebase of the input timestamps.
  16637. @end table
  16638. @subsection Examples
  16639. @itemize
  16640. @item
  16641. Start counting PTS from zero
  16642. @example
  16643. setpts=PTS-STARTPTS
  16644. @end example
  16645. @item
  16646. Apply fast motion effect:
  16647. @example
  16648. setpts=0.5*PTS
  16649. @end example
  16650. @item
  16651. Apply slow motion effect:
  16652. @example
  16653. setpts=2.0*PTS
  16654. @end example
  16655. @item
  16656. Set fixed rate of 25 frames per second:
  16657. @example
  16658. setpts=N/(25*TB)
  16659. @end example
  16660. @item
  16661. Set fixed rate 25 fps with some jitter:
  16662. @example
  16663. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16664. @end example
  16665. @item
  16666. Apply an offset of 10 seconds to the input PTS:
  16667. @example
  16668. setpts=PTS+10/TB
  16669. @end example
  16670. @item
  16671. Generate timestamps from a "live source" and rebase onto the current timebase:
  16672. @example
  16673. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16674. @end example
  16675. @item
  16676. Generate timestamps by counting samples:
  16677. @example
  16678. asetpts=N/SR/TB
  16679. @end example
  16680. @end itemize
  16681. @section setrange
  16682. Force color range for the output video frame.
  16683. The @code{setrange} filter marks the color range property for the
  16684. output frames. It does not change the input frame, but only sets the
  16685. corresponding property, which affects how the frame is treated by
  16686. following filters.
  16687. The filter accepts the following options:
  16688. @table @option
  16689. @item range
  16690. Available values are:
  16691. @table @samp
  16692. @item auto
  16693. Keep the same color range property.
  16694. @item unspecified, unknown
  16695. Set the color range as unspecified.
  16696. @item limited, tv, mpeg
  16697. Set the color range as limited.
  16698. @item full, pc, jpeg
  16699. Set the color range as full.
  16700. @end table
  16701. @end table
  16702. @section settb, asettb
  16703. Set the timebase to use for the output frames timestamps.
  16704. It is mainly useful for testing timebase configuration.
  16705. It accepts the following parameters:
  16706. @table @option
  16707. @item expr, tb
  16708. The expression which is evaluated into the output timebase.
  16709. @end table
  16710. The value for @option{tb} is an arithmetic expression representing a
  16711. rational. The expression can contain the constants "AVTB" (the default
  16712. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16713. audio only). Default value is "intb".
  16714. @subsection Examples
  16715. @itemize
  16716. @item
  16717. Set the timebase to 1/25:
  16718. @example
  16719. settb=expr=1/25
  16720. @end example
  16721. @item
  16722. Set the timebase to 1/10:
  16723. @example
  16724. settb=expr=0.1
  16725. @end example
  16726. @item
  16727. Set the timebase to 1001/1000:
  16728. @example
  16729. settb=1+0.001
  16730. @end example
  16731. @item
  16732. Set the timebase to 2*intb:
  16733. @example
  16734. settb=2*intb
  16735. @end example
  16736. @item
  16737. Set the default timebase value:
  16738. @example
  16739. settb=AVTB
  16740. @end example
  16741. @end itemize
  16742. @section showcqt
  16743. Convert input audio to a video output representing frequency spectrum
  16744. logarithmically using Brown-Puckette constant Q transform algorithm with
  16745. direct frequency domain coefficient calculation (but the transform itself
  16746. is not really constant Q, instead the Q factor is actually variable/clamped),
  16747. with musical tone scale, from E0 to D#10.
  16748. The filter accepts the following options:
  16749. @table @option
  16750. @item size, s
  16751. Specify the video size for the output. It must be even. For the syntax of this option,
  16752. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16753. Default value is @code{1920x1080}.
  16754. @item fps, rate, r
  16755. Set the output frame rate. Default value is @code{25}.
  16756. @item bar_h
  16757. Set the bargraph height. It must be even. Default value is @code{-1} which
  16758. computes the bargraph height automatically.
  16759. @item axis_h
  16760. Set the axis height. It must be even. Default value is @code{-1} which computes
  16761. the axis height automatically.
  16762. @item sono_h
  16763. Set the sonogram height. It must be even. Default value is @code{-1} which
  16764. computes the sonogram height automatically.
  16765. @item fullhd
  16766. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16767. instead. Default value is @code{1}.
  16768. @item sono_v, volume
  16769. Specify the sonogram volume expression. It can contain variables:
  16770. @table @option
  16771. @item bar_v
  16772. the @var{bar_v} evaluated expression
  16773. @item frequency, freq, f
  16774. the frequency where it is evaluated
  16775. @item timeclamp, tc
  16776. the value of @var{timeclamp} option
  16777. @end table
  16778. and functions:
  16779. @table @option
  16780. @item a_weighting(f)
  16781. A-weighting of equal loudness
  16782. @item b_weighting(f)
  16783. B-weighting of equal loudness
  16784. @item c_weighting(f)
  16785. C-weighting of equal loudness.
  16786. @end table
  16787. Default value is @code{16}.
  16788. @item bar_v, volume2
  16789. Specify the bargraph volume expression. It can contain variables:
  16790. @table @option
  16791. @item sono_v
  16792. the @var{sono_v} evaluated expression
  16793. @item frequency, freq, f
  16794. the frequency where it is evaluated
  16795. @item timeclamp, tc
  16796. the value of @var{timeclamp} option
  16797. @end table
  16798. and functions:
  16799. @table @option
  16800. @item a_weighting(f)
  16801. A-weighting of equal loudness
  16802. @item b_weighting(f)
  16803. B-weighting of equal loudness
  16804. @item c_weighting(f)
  16805. C-weighting of equal loudness.
  16806. @end table
  16807. Default value is @code{sono_v}.
  16808. @item sono_g, gamma
  16809. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16810. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16811. Acceptable range is @code{[1, 7]}.
  16812. @item bar_g, gamma2
  16813. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16814. @code{[1, 7]}.
  16815. @item bar_t
  16816. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16817. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16818. @item timeclamp, tc
  16819. Specify the transform timeclamp. At low frequency, there is trade-off between
  16820. accuracy in time domain and frequency domain. If timeclamp is lower,
  16821. event in time domain is represented more accurately (such as fast bass drum),
  16822. otherwise event in frequency domain is represented more accurately
  16823. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16824. @item attack
  16825. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16826. limits future samples by applying asymmetric windowing in time domain, useful
  16827. when low latency is required. Accepted range is @code{[0, 1]}.
  16828. @item basefreq
  16829. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16830. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16831. @item endfreq
  16832. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16833. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16834. @item coeffclamp
  16835. This option is deprecated and ignored.
  16836. @item tlength
  16837. Specify the transform length in time domain. Use this option to control accuracy
  16838. trade-off between time domain and frequency domain at every frequency sample.
  16839. It can contain variables:
  16840. @table @option
  16841. @item frequency, freq, f
  16842. the frequency where it is evaluated
  16843. @item timeclamp, tc
  16844. the value of @var{timeclamp} option.
  16845. @end table
  16846. Default value is @code{384*tc/(384+tc*f)}.
  16847. @item count
  16848. Specify the transform count for every video frame. Default value is @code{6}.
  16849. Acceptable range is @code{[1, 30]}.
  16850. @item fcount
  16851. Specify the transform count for every single pixel. Default value is @code{0},
  16852. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16853. @item fontfile
  16854. Specify font file for use with freetype to draw the axis. If not specified,
  16855. use embedded font. Note that drawing with font file or embedded font is not
  16856. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16857. option instead.
  16858. @item font
  16859. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16860. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16861. @item fontcolor
  16862. Specify font color expression. This is arithmetic expression that should return
  16863. integer value 0xRRGGBB. It can contain variables:
  16864. @table @option
  16865. @item frequency, freq, f
  16866. the frequency where it is evaluated
  16867. @item timeclamp, tc
  16868. the value of @var{timeclamp} option
  16869. @end table
  16870. and functions:
  16871. @table @option
  16872. @item midi(f)
  16873. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16874. @item r(x), g(x), b(x)
  16875. red, green, and blue value of intensity x.
  16876. @end table
  16877. Default value is @code{st(0, (midi(f)-59.5)/12);
  16878. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16879. r(1-ld(1)) + b(ld(1))}.
  16880. @item axisfile
  16881. Specify image file to draw the axis. This option override @var{fontfile} and
  16882. @var{fontcolor} option.
  16883. @item axis, text
  16884. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16885. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16886. Default value is @code{1}.
  16887. @item csp
  16888. Set colorspace. The accepted values are:
  16889. @table @samp
  16890. @item unspecified
  16891. Unspecified (default)
  16892. @item bt709
  16893. BT.709
  16894. @item fcc
  16895. FCC
  16896. @item bt470bg
  16897. BT.470BG or BT.601-6 625
  16898. @item smpte170m
  16899. SMPTE-170M or BT.601-6 525
  16900. @item smpte240m
  16901. SMPTE-240M
  16902. @item bt2020ncl
  16903. BT.2020 with non-constant luminance
  16904. @end table
  16905. @item cscheme
  16906. Set spectrogram color scheme. This is list of floating point values with format
  16907. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16908. The default is @code{1|0.5|0|0|0.5|1}.
  16909. @end table
  16910. @subsection Examples
  16911. @itemize
  16912. @item
  16913. Playing audio while showing the spectrum:
  16914. @example
  16915. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16916. @end example
  16917. @item
  16918. Same as above, but with frame rate 30 fps:
  16919. @example
  16920. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16921. @end example
  16922. @item
  16923. Playing at 1280x720:
  16924. @example
  16925. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16926. @end example
  16927. @item
  16928. Disable sonogram display:
  16929. @example
  16930. sono_h=0
  16931. @end example
  16932. @item
  16933. A1 and its harmonics: A1, A2, (near)E3, A3:
  16934. @example
  16935. 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),
  16936. asplit[a][out1]; [a] showcqt [out0]'
  16937. @end example
  16938. @item
  16939. Same as above, but with more accuracy in frequency domain:
  16940. @example
  16941. 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),
  16942. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16943. @end example
  16944. @item
  16945. Custom volume:
  16946. @example
  16947. bar_v=10:sono_v=bar_v*a_weighting(f)
  16948. @end example
  16949. @item
  16950. Custom gamma, now spectrum is linear to the amplitude.
  16951. @example
  16952. bar_g=2:sono_g=2
  16953. @end example
  16954. @item
  16955. Custom tlength equation:
  16956. @example
  16957. 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)))'
  16958. @end example
  16959. @item
  16960. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16961. @example
  16962. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16963. @end example
  16964. @item
  16965. Custom font using fontconfig:
  16966. @example
  16967. font='Courier New,Monospace,mono|bold'
  16968. @end example
  16969. @item
  16970. Custom frequency range with custom axis using image file:
  16971. @example
  16972. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16973. @end example
  16974. @end itemize
  16975. @section showfreqs
  16976. Convert input audio to video output representing the audio power spectrum.
  16977. Audio amplitude is on Y-axis while frequency is on X-axis.
  16978. The filter accepts the following options:
  16979. @table @option
  16980. @item size, s
  16981. Specify size of video. For the syntax of this option, check the
  16982. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16983. Default is @code{1024x512}.
  16984. @item mode
  16985. Set display mode.
  16986. This set how each frequency bin will be represented.
  16987. It accepts the following values:
  16988. @table @samp
  16989. @item line
  16990. @item bar
  16991. @item dot
  16992. @end table
  16993. Default is @code{bar}.
  16994. @item ascale
  16995. Set amplitude scale.
  16996. It accepts the following values:
  16997. @table @samp
  16998. @item lin
  16999. Linear scale.
  17000. @item sqrt
  17001. Square root scale.
  17002. @item cbrt
  17003. Cubic root scale.
  17004. @item log
  17005. Logarithmic scale.
  17006. @end table
  17007. Default is @code{log}.
  17008. @item fscale
  17009. Set frequency scale.
  17010. It accepts the following values:
  17011. @table @samp
  17012. @item lin
  17013. Linear scale.
  17014. @item log
  17015. Logarithmic scale.
  17016. @item rlog
  17017. Reverse logarithmic scale.
  17018. @end table
  17019. Default is @code{lin}.
  17020. @item win_size
  17021. Set window size. Allowed range is from 16 to 65536.
  17022. Default is @code{2048}
  17023. @item win_func
  17024. Set windowing function.
  17025. It accepts the following values:
  17026. @table @samp
  17027. @item rect
  17028. @item bartlett
  17029. @item hanning
  17030. @item hamming
  17031. @item blackman
  17032. @item welch
  17033. @item flattop
  17034. @item bharris
  17035. @item bnuttall
  17036. @item bhann
  17037. @item sine
  17038. @item nuttall
  17039. @item lanczos
  17040. @item gauss
  17041. @item tukey
  17042. @item dolph
  17043. @item cauchy
  17044. @item parzen
  17045. @item poisson
  17046. @item bohman
  17047. @end table
  17048. Default is @code{hanning}.
  17049. @item overlap
  17050. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17051. which means optimal overlap for selected window function will be picked.
  17052. @item averaging
  17053. Set time averaging. Setting this to 0 will display current maximal peaks.
  17054. Default is @code{1}, which means time averaging is disabled.
  17055. @item colors
  17056. Specify list of colors separated by space or by '|' which will be used to
  17057. draw channel frequencies. Unrecognized or missing colors will be replaced
  17058. by white color.
  17059. @item cmode
  17060. Set channel display mode.
  17061. It accepts the following values:
  17062. @table @samp
  17063. @item combined
  17064. @item separate
  17065. @end table
  17066. Default is @code{combined}.
  17067. @item minamp
  17068. Set minimum amplitude used in @code{log} amplitude scaler.
  17069. @end table
  17070. @section showspatial
  17071. Convert stereo input audio to a video output, representing the spatial relationship
  17072. between two channels.
  17073. The filter accepts the following options:
  17074. @table @option
  17075. @item size, s
  17076. Specify the video size for the output. For the syntax of this option, check the
  17077. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17078. Default value is @code{512x512}.
  17079. @item win_size
  17080. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17081. @item win_func
  17082. Set window function.
  17083. It accepts the following values:
  17084. @table @samp
  17085. @item rect
  17086. @item bartlett
  17087. @item hann
  17088. @item hanning
  17089. @item hamming
  17090. @item blackman
  17091. @item welch
  17092. @item flattop
  17093. @item bharris
  17094. @item bnuttall
  17095. @item bhann
  17096. @item sine
  17097. @item nuttall
  17098. @item lanczos
  17099. @item gauss
  17100. @item tukey
  17101. @item dolph
  17102. @item cauchy
  17103. @item parzen
  17104. @item poisson
  17105. @item bohman
  17106. @end table
  17107. Default value is @code{hann}.
  17108. @item overlap
  17109. Set ratio of overlap window. Default value is @code{0.5}.
  17110. When value is @code{1} overlap is set to recommended size for specific
  17111. window function currently used.
  17112. @end table
  17113. @anchor{showspectrum}
  17114. @section showspectrum
  17115. Convert input audio to a video output, representing the audio frequency
  17116. spectrum.
  17117. The filter accepts the following options:
  17118. @table @option
  17119. @item size, s
  17120. Specify the video size for the output. For the syntax of this option, check the
  17121. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17122. Default value is @code{640x512}.
  17123. @item slide
  17124. Specify how the spectrum should slide along the window.
  17125. It accepts the following values:
  17126. @table @samp
  17127. @item replace
  17128. the samples start again on the left when they reach the right
  17129. @item scroll
  17130. the samples scroll from right to left
  17131. @item fullframe
  17132. frames are only produced when the samples reach the right
  17133. @item rscroll
  17134. the samples scroll from left to right
  17135. @end table
  17136. Default value is @code{replace}.
  17137. @item mode
  17138. Specify display mode.
  17139. It accepts the following values:
  17140. @table @samp
  17141. @item combined
  17142. all channels are displayed in the same row
  17143. @item separate
  17144. all channels are displayed in separate rows
  17145. @end table
  17146. Default value is @samp{combined}.
  17147. @item color
  17148. Specify display color mode.
  17149. It accepts the following values:
  17150. @table @samp
  17151. @item channel
  17152. each channel is displayed in a separate color
  17153. @item intensity
  17154. each channel is displayed using the same color scheme
  17155. @item rainbow
  17156. each channel is displayed using the rainbow color scheme
  17157. @item moreland
  17158. each channel is displayed using the moreland color scheme
  17159. @item nebulae
  17160. each channel is displayed using the nebulae color scheme
  17161. @item fire
  17162. each channel is displayed using the fire color scheme
  17163. @item fiery
  17164. each channel is displayed using the fiery color scheme
  17165. @item fruit
  17166. each channel is displayed using the fruit color scheme
  17167. @item cool
  17168. each channel is displayed using the cool color scheme
  17169. @item magma
  17170. each channel is displayed using the magma color scheme
  17171. @item green
  17172. each channel is displayed using the green color scheme
  17173. @item viridis
  17174. each channel is displayed using the viridis color scheme
  17175. @item plasma
  17176. each channel is displayed using the plasma color scheme
  17177. @item cividis
  17178. each channel is displayed using the cividis color scheme
  17179. @item terrain
  17180. each channel is displayed using the terrain color scheme
  17181. @end table
  17182. Default value is @samp{channel}.
  17183. @item scale
  17184. Specify scale used for calculating intensity color values.
  17185. It accepts the following values:
  17186. @table @samp
  17187. @item lin
  17188. linear
  17189. @item sqrt
  17190. square root, default
  17191. @item cbrt
  17192. cubic root
  17193. @item log
  17194. logarithmic
  17195. @item 4thrt
  17196. 4th root
  17197. @item 5thrt
  17198. 5th root
  17199. @end table
  17200. Default value is @samp{sqrt}.
  17201. @item fscale
  17202. Specify frequency scale.
  17203. It accepts the following values:
  17204. @table @samp
  17205. @item lin
  17206. linear
  17207. @item log
  17208. logarithmic
  17209. @end table
  17210. Default value is @samp{lin}.
  17211. @item saturation
  17212. Set saturation modifier for displayed colors. Negative values provide
  17213. alternative color scheme. @code{0} is no saturation at all.
  17214. Saturation must be in [-10.0, 10.0] range.
  17215. Default value is @code{1}.
  17216. @item win_func
  17217. Set window function.
  17218. It accepts the following values:
  17219. @table @samp
  17220. @item rect
  17221. @item bartlett
  17222. @item hann
  17223. @item hanning
  17224. @item hamming
  17225. @item blackman
  17226. @item welch
  17227. @item flattop
  17228. @item bharris
  17229. @item bnuttall
  17230. @item bhann
  17231. @item sine
  17232. @item nuttall
  17233. @item lanczos
  17234. @item gauss
  17235. @item tukey
  17236. @item dolph
  17237. @item cauchy
  17238. @item parzen
  17239. @item poisson
  17240. @item bohman
  17241. @end table
  17242. Default value is @code{hann}.
  17243. @item orientation
  17244. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17245. @code{horizontal}. Default is @code{vertical}.
  17246. @item overlap
  17247. Set ratio of overlap window. Default value is @code{0}.
  17248. When value is @code{1} overlap is set to recommended size for specific
  17249. window function currently used.
  17250. @item gain
  17251. Set scale gain for calculating intensity color values.
  17252. Default value is @code{1}.
  17253. @item data
  17254. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17255. @item rotation
  17256. Set color rotation, must be in [-1.0, 1.0] range.
  17257. Default value is @code{0}.
  17258. @item start
  17259. Set start frequency from which to display spectrogram. Default is @code{0}.
  17260. @item stop
  17261. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17262. @item fps
  17263. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17264. @item legend
  17265. Draw time and frequency axes and legends. Default is disabled.
  17266. @end table
  17267. The usage is very similar to the showwaves filter; see the examples in that
  17268. section.
  17269. @subsection Examples
  17270. @itemize
  17271. @item
  17272. Large window with logarithmic color scaling:
  17273. @example
  17274. showspectrum=s=1280x480:scale=log
  17275. @end example
  17276. @item
  17277. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17278. @example
  17279. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17280. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17281. @end example
  17282. @end itemize
  17283. @section showspectrumpic
  17284. Convert input audio to a single video frame, representing the audio frequency
  17285. spectrum.
  17286. The filter accepts the following options:
  17287. @table @option
  17288. @item size, s
  17289. Specify the video size for the output. For the syntax of this option, check the
  17290. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17291. Default value is @code{4096x2048}.
  17292. @item mode
  17293. Specify display mode.
  17294. It accepts the following values:
  17295. @table @samp
  17296. @item combined
  17297. all channels are displayed in the same row
  17298. @item separate
  17299. all channels are displayed in separate rows
  17300. @end table
  17301. Default value is @samp{combined}.
  17302. @item color
  17303. Specify display color mode.
  17304. It accepts the following values:
  17305. @table @samp
  17306. @item channel
  17307. each channel is displayed in a separate color
  17308. @item intensity
  17309. each channel is displayed using the same color scheme
  17310. @item rainbow
  17311. each channel is displayed using the rainbow color scheme
  17312. @item moreland
  17313. each channel is displayed using the moreland color scheme
  17314. @item nebulae
  17315. each channel is displayed using the nebulae color scheme
  17316. @item fire
  17317. each channel is displayed using the fire color scheme
  17318. @item fiery
  17319. each channel is displayed using the fiery color scheme
  17320. @item fruit
  17321. each channel is displayed using the fruit color scheme
  17322. @item cool
  17323. each channel is displayed using the cool color scheme
  17324. @item magma
  17325. each channel is displayed using the magma color scheme
  17326. @item green
  17327. each channel is displayed using the green color scheme
  17328. @item viridis
  17329. each channel is displayed using the viridis color scheme
  17330. @item plasma
  17331. each channel is displayed using the plasma color scheme
  17332. @item cividis
  17333. each channel is displayed using the cividis color scheme
  17334. @item terrain
  17335. each channel is displayed using the terrain color scheme
  17336. @end table
  17337. Default value is @samp{intensity}.
  17338. @item scale
  17339. Specify scale used for calculating intensity color values.
  17340. It accepts the following values:
  17341. @table @samp
  17342. @item lin
  17343. linear
  17344. @item sqrt
  17345. square root, default
  17346. @item cbrt
  17347. cubic root
  17348. @item log
  17349. logarithmic
  17350. @item 4thrt
  17351. 4th root
  17352. @item 5thrt
  17353. 5th root
  17354. @end table
  17355. Default value is @samp{log}.
  17356. @item fscale
  17357. Specify frequency scale.
  17358. It accepts the following values:
  17359. @table @samp
  17360. @item lin
  17361. linear
  17362. @item log
  17363. logarithmic
  17364. @end table
  17365. Default value is @samp{lin}.
  17366. @item saturation
  17367. Set saturation modifier for displayed colors. Negative values provide
  17368. alternative color scheme. @code{0} is no saturation at all.
  17369. Saturation must be in [-10.0, 10.0] range.
  17370. Default value is @code{1}.
  17371. @item win_func
  17372. Set window function.
  17373. It accepts the following values:
  17374. @table @samp
  17375. @item rect
  17376. @item bartlett
  17377. @item hann
  17378. @item hanning
  17379. @item hamming
  17380. @item blackman
  17381. @item welch
  17382. @item flattop
  17383. @item bharris
  17384. @item bnuttall
  17385. @item bhann
  17386. @item sine
  17387. @item nuttall
  17388. @item lanczos
  17389. @item gauss
  17390. @item tukey
  17391. @item dolph
  17392. @item cauchy
  17393. @item parzen
  17394. @item poisson
  17395. @item bohman
  17396. @end table
  17397. Default value is @code{hann}.
  17398. @item orientation
  17399. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17400. @code{horizontal}. Default is @code{vertical}.
  17401. @item gain
  17402. Set scale gain for calculating intensity color values.
  17403. Default value is @code{1}.
  17404. @item legend
  17405. Draw time and frequency axes and legends. Default is enabled.
  17406. @item rotation
  17407. Set color rotation, must be in [-1.0, 1.0] range.
  17408. Default value is @code{0}.
  17409. @item start
  17410. Set start frequency from which to display spectrogram. Default is @code{0}.
  17411. @item stop
  17412. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17413. @end table
  17414. @subsection Examples
  17415. @itemize
  17416. @item
  17417. Extract an audio spectrogram of a whole audio track
  17418. in a 1024x1024 picture using @command{ffmpeg}:
  17419. @example
  17420. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17421. @end example
  17422. @end itemize
  17423. @section showvolume
  17424. Convert input audio volume to a video output.
  17425. The filter accepts the following options:
  17426. @table @option
  17427. @item rate, r
  17428. Set video rate.
  17429. @item b
  17430. Set border width, allowed range is [0, 5]. Default is 1.
  17431. @item w
  17432. Set channel width, allowed range is [80, 8192]. Default is 400.
  17433. @item h
  17434. Set channel height, allowed range is [1, 900]. Default is 20.
  17435. @item f
  17436. Set fade, allowed range is [0, 1]. Default is 0.95.
  17437. @item c
  17438. Set volume color expression.
  17439. The expression can use the following variables:
  17440. @table @option
  17441. @item VOLUME
  17442. Current max volume of channel in dB.
  17443. @item PEAK
  17444. Current peak.
  17445. @item CHANNEL
  17446. Current channel number, starting from 0.
  17447. @end table
  17448. @item t
  17449. If set, displays channel names. Default is enabled.
  17450. @item v
  17451. If set, displays volume values. Default is enabled.
  17452. @item o
  17453. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17454. default is @code{h}.
  17455. @item s
  17456. Set step size, allowed range is [0, 5]. Default is 0, which means
  17457. step is disabled.
  17458. @item p
  17459. Set background opacity, allowed range is [0, 1]. Default is 0.
  17460. @item m
  17461. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17462. default is @code{p}.
  17463. @item ds
  17464. Set display scale, can be linear: @code{lin} or log: @code{log},
  17465. default is @code{lin}.
  17466. @item dm
  17467. In second.
  17468. If set to > 0., display a line for the max level
  17469. in the previous seconds.
  17470. default is disabled: @code{0.}
  17471. @item dmc
  17472. The color of the max line. Use when @code{dm} option is set to > 0.
  17473. default is: @code{orange}
  17474. @end table
  17475. @section showwaves
  17476. Convert input audio to a video output, representing the samples waves.
  17477. The filter accepts the following options:
  17478. @table @option
  17479. @item size, s
  17480. Specify the video size for the output. For the syntax of this option, check the
  17481. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17482. Default value is @code{600x240}.
  17483. @item mode
  17484. Set display mode.
  17485. Available values are:
  17486. @table @samp
  17487. @item point
  17488. Draw a point for each sample.
  17489. @item line
  17490. Draw a vertical line for each sample.
  17491. @item p2p
  17492. Draw a point for each sample and a line between them.
  17493. @item cline
  17494. Draw a centered vertical line for each sample.
  17495. @end table
  17496. Default value is @code{point}.
  17497. @item n
  17498. Set the number of samples which are printed on the same column. A
  17499. larger value will decrease the frame rate. Must be a positive
  17500. integer. This option can be set only if the value for @var{rate}
  17501. is not explicitly specified.
  17502. @item rate, r
  17503. Set the (approximate) output frame rate. This is done by setting the
  17504. option @var{n}. Default value is "25".
  17505. @item split_channels
  17506. Set if channels should be drawn separately or overlap. Default value is 0.
  17507. @item colors
  17508. Set colors separated by '|' which are going to be used for drawing of each channel.
  17509. @item scale
  17510. Set amplitude scale.
  17511. Available values are:
  17512. @table @samp
  17513. @item lin
  17514. Linear.
  17515. @item log
  17516. Logarithmic.
  17517. @item sqrt
  17518. Square root.
  17519. @item cbrt
  17520. Cubic root.
  17521. @end table
  17522. Default is linear.
  17523. @item draw
  17524. Set the draw mode. This is mostly useful to set for high @var{n}.
  17525. Available values are:
  17526. @table @samp
  17527. @item scale
  17528. Scale pixel values for each drawn sample.
  17529. @item full
  17530. Draw every sample directly.
  17531. @end table
  17532. Default value is @code{scale}.
  17533. @end table
  17534. @subsection Examples
  17535. @itemize
  17536. @item
  17537. Output the input file audio and the corresponding video representation
  17538. at the same time:
  17539. @example
  17540. amovie=a.mp3,asplit[out0],showwaves[out1]
  17541. @end example
  17542. @item
  17543. Create a synthetic signal and show it with showwaves, forcing a
  17544. frame rate of 30 frames per second:
  17545. @example
  17546. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17547. @end example
  17548. @end itemize
  17549. @section showwavespic
  17550. Convert input audio to a single video frame, representing the samples waves.
  17551. The filter accepts the following options:
  17552. @table @option
  17553. @item size, s
  17554. Specify the video size for the output. For the syntax of this option, check the
  17555. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17556. Default value is @code{600x240}.
  17557. @item split_channels
  17558. Set if channels should be drawn separately or overlap. Default value is 0.
  17559. @item colors
  17560. Set colors separated by '|' which are going to be used for drawing of each channel.
  17561. @item scale
  17562. Set amplitude scale.
  17563. Available values are:
  17564. @table @samp
  17565. @item lin
  17566. Linear.
  17567. @item log
  17568. Logarithmic.
  17569. @item sqrt
  17570. Square root.
  17571. @item cbrt
  17572. Cubic root.
  17573. @end table
  17574. Default is linear.
  17575. @item draw
  17576. Set the draw mode.
  17577. Available values are:
  17578. @table @samp
  17579. @item scale
  17580. Scale pixel values for each drawn sample.
  17581. @item full
  17582. Draw every sample directly.
  17583. @end table
  17584. Default value is @code{scale}.
  17585. @end table
  17586. @subsection Examples
  17587. @itemize
  17588. @item
  17589. Extract a channel split representation of the wave form of a whole audio track
  17590. in a 1024x800 picture using @command{ffmpeg}:
  17591. @example
  17592. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17593. @end example
  17594. @end itemize
  17595. @section sidedata, asidedata
  17596. Delete frame side data, or select frames based on it.
  17597. This filter accepts the following options:
  17598. @table @option
  17599. @item mode
  17600. Set mode of operation of the filter.
  17601. Can be one of the following:
  17602. @table @samp
  17603. @item select
  17604. Select every frame with side data of @code{type}.
  17605. @item delete
  17606. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17607. data in the frame.
  17608. @end table
  17609. @item type
  17610. Set side data type used with all modes. Must be set for @code{select} mode. For
  17611. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17612. in @file{libavutil/frame.h}. For example, to choose
  17613. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17614. @end table
  17615. @section spectrumsynth
  17616. Sythesize audio from 2 input video spectrums, first input stream represents
  17617. magnitude across time and second represents phase across time.
  17618. The filter will transform from frequency domain as displayed in videos back
  17619. to time domain as presented in audio output.
  17620. This filter is primarily created for reversing processed @ref{showspectrum}
  17621. filter outputs, but can synthesize sound from other spectrograms too.
  17622. But in such case results are going to be poor if the phase data is not
  17623. available, because in such cases phase data need to be recreated, usually
  17624. it's just recreated from random noise.
  17625. For best results use gray only output (@code{channel} color mode in
  17626. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17627. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17628. @code{data} option. Inputs videos should generally use @code{fullframe}
  17629. slide mode as that saves resources needed for decoding video.
  17630. The filter accepts the following options:
  17631. @table @option
  17632. @item sample_rate
  17633. Specify sample rate of output audio, the sample rate of audio from which
  17634. spectrum was generated may differ.
  17635. @item channels
  17636. Set number of channels represented in input video spectrums.
  17637. @item scale
  17638. Set scale which was used when generating magnitude input spectrum.
  17639. Can be @code{lin} or @code{log}. Default is @code{log}.
  17640. @item slide
  17641. Set slide which was used when generating inputs spectrums.
  17642. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17643. Default is @code{fullframe}.
  17644. @item win_func
  17645. Set window function used for resynthesis.
  17646. @item overlap
  17647. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17648. which means optimal overlap for selected window function will be picked.
  17649. @item orientation
  17650. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17651. Default is @code{vertical}.
  17652. @end table
  17653. @subsection Examples
  17654. @itemize
  17655. @item
  17656. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17657. then resynthesize videos back to audio with spectrumsynth:
  17658. @example
  17659. 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
  17660. 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
  17661. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17662. @end example
  17663. @end itemize
  17664. @section split, asplit
  17665. Split input into several identical outputs.
  17666. @code{asplit} works with audio input, @code{split} with video.
  17667. The filter accepts a single parameter which specifies the number of outputs. If
  17668. unspecified, it defaults to 2.
  17669. @subsection Examples
  17670. @itemize
  17671. @item
  17672. Create two separate outputs from the same input:
  17673. @example
  17674. [in] split [out0][out1]
  17675. @end example
  17676. @item
  17677. To create 3 or more outputs, you need to specify the number of
  17678. outputs, like in:
  17679. @example
  17680. [in] asplit=3 [out0][out1][out2]
  17681. @end example
  17682. @item
  17683. Create two separate outputs from the same input, one cropped and
  17684. one padded:
  17685. @example
  17686. [in] split [splitout1][splitout2];
  17687. [splitout1] crop=100:100:0:0 [cropout];
  17688. [splitout2] pad=200:200:100:100 [padout];
  17689. @end example
  17690. @item
  17691. Create 5 copies of the input audio with @command{ffmpeg}:
  17692. @example
  17693. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17694. @end example
  17695. @end itemize
  17696. @section zmq, azmq
  17697. Receive commands sent through a libzmq client, and forward them to
  17698. filters in the filtergraph.
  17699. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17700. must be inserted between two video filters, @code{azmq} between two
  17701. audio filters. Both are capable to send messages to any filter type.
  17702. To enable these filters you need to install the libzmq library and
  17703. headers and configure FFmpeg with @code{--enable-libzmq}.
  17704. For more information about libzmq see:
  17705. @url{http://www.zeromq.org/}
  17706. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17707. receives messages sent through a network interface defined by the
  17708. @option{bind_address} (or the abbreviation "@option{b}") option.
  17709. Default value of this option is @file{tcp://localhost:5555}. You may
  17710. want to alter this value to your needs, but do not forget to escape any
  17711. ':' signs (see @ref{filtergraph escaping}).
  17712. The received message must be in the form:
  17713. @example
  17714. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17715. @end example
  17716. @var{TARGET} specifies the target of the command, usually the name of
  17717. the filter class or a specific filter instance name. The default
  17718. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17719. but you can override this by using the @samp{filter_name@@id} syntax
  17720. (see @ref{Filtergraph syntax}).
  17721. @var{COMMAND} specifies the name of the command for the target filter.
  17722. @var{ARG} is optional and specifies the optional argument list for the
  17723. given @var{COMMAND}.
  17724. Upon reception, the message is processed and the corresponding command
  17725. is injected into the filtergraph. Depending on the result, the filter
  17726. will send a reply to the client, adopting the format:
  17727. @example
  17728. @var{ERROR_CODE} @var{ERROR_REASON}
  17729. @var{MESSAGE}
  17730. @end example
  17731. @var{MESSAGE} is optional.
  17732. @subsection Examples
  17733. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17734. be used to send commands processed by these filters.
  17735. Consider the following filtergraph generated by @command{ffplay}.
  17736. In this example the last overlay filter has an instance name. All other
  17737. filters will have default instance names.
  17738. @example
  17739. ffplay -dumpgraph 1 -f lavfi "
  17740. color=s=100x100:c=red [l];
  17741. color=s=100x100:c=blue [r];
  17742. nullsrc=s=200x100, zmq [bg];
  17743. [bg][l] overlay [bg+l];
  17744. [bg+l][r] overlay@@my=x=100 "
  17745. @end example
  17746. To change the color of the left side of the video, the following
  17747. command can be used:
  17748. @example
  17749. echo Parsed_color_0 c yellow | tools/zmqsend
  17750. @end example
  17751. To change the right side:
  17752. @example
  17753. echo Parsed_color_1 c pink | tools/zmqsend
  17754. @end example
  17755. To change the position of the right side:
  17756. @example
  17757. echo overlay@@my x 150 | tools/zmqsend
  17758. @end example
  17759. @c man end MULTIMEDIA FILTERS
  17760. @chapter Multimedia Sources
  17761. @c man begin MULTIMEDIA SOURCES
  17762. Below is a description of the currently available multimedia sources.
  17763. @section amovie
  17764. This is the same as @ref{movie} source, except it selects an audio
  17765. stream by default.
  17766. @anchor{movie}
  17767. @section movie
  17768. Read audio and/or video stream(s) from a movie container.
  17769. It accepts the following parameters:
  17770. @table @option
  17771. @item filename
  17772. The name of the resource to read (not necessarily a file; it can also be a
  17773. device or a stream accessed through some protocol).
  17774. @item format_name, f
  17775. Specifies the format assumed for the movie to read, and can be either
  17776. the name of a container or an input device. If not specified, the
  17777. format is guessed from @var{movie_name} or by probing.
  17778. @item seek_point, sp
  17779. Specifies the seek point in seconds. The frames will be output
  17780. starting from this seek point. The parameter is evaluated with
  17781. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17782. postfix. The default value is "0".
  17783. @item streams, s
  17784. Specifies the streams to read. Several streams can be specified,
  17785. separated by "+". The source will then have as many outputs, in the
  17786. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17787. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17788. respectively the default (best suited) video and audio stream. Default
  17789. is "dv", or "da" if the filter is called as "amovie".
  17790. @item stream_index, si
  17791. Specifies the index of the video stream to read. If the value is -1,
  17792. the most suitable video stream will be automatically selected. The default
  17793. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17794. audio instead of video.
  17795. @item loop
  17796. Specifies how many times to read the stream in sequence.
  17797. If the value is 0, the stream will be looped infinitely.
  17798. Default value is "1".
  17799. Note that when the movie is looped the source timestamps are not
  17800. changed, so it will generate non monotonically increasing timestamps.
  17801. @item discontinuity
  17802. Specifies the time difference between frames above which the point is
  17803. considered a timestamp discontinuity which is removed by adjusting the later
  17804. timestamps.
  17805. @end table
  17806. It allows overlaying a second video on top of the main input of
  17807. a filtergraph, as shown in this graph:
  17808. @example
  17809. input -----------> deltapts0 --> overlay --> output
  17810. ^
  17811. |
  17812. movie --> scale--> deltapts1 -------+
  17813. @end example
  17814. @subsection Examples
  17815. @itemize
  17816. @item
  17817. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17818. on top of the input labelled "in":
  17819. @example
  17820. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17821. [in] setpts=PTS-STARTPTS [main];
  17822. [main][over] overlay=16:16 [out]
  17823. @end example
  17824. @item
  17825. Read from a video4linux2 device, and overlay it on top of the input
  17826. labelled "in":
  17827. @example
  17828. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17829. [in] setpts=PTS-STARTPTS [main];
  17830. [main][over] overlay=16:16 [out]
  17831. @end example
  17832. @item
  17833. Read the first video stream and the audio stream with id 0x81 from
  17834. dvd.vob; the video is connected to the pad named "video" and the audio is
  17835. connected to the pad named "audio":
  17836. @example
  17837. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17838. @end example
  17839. @end itemize
  17840. @subsection Commands
  17841. Both movie and amovie support the following commands:
  17842. @table @option
  17843. @item seek
  17844. Perform seek using "av_seek_frame".
  17845. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17846. @itemize
  17847. @item
  17848. @var{stream_index}: If stream_index is -1, a default
  17849. stream is selected, and @var{timestamp} is automatically converted
  17850. from AV_TIME_BASE units to the stream specific time_base.
  17851. @item
  17852. @var{timestamp}: Timestamp in AVStream.time_base units
  17853. or, if no stream is specified, in AV_TIME_BASE units.
  17854. @item
  17855. @var{flags}: Flags which select direction and seeking mode.
  17856. @end itemize
  17857. @item get_duration
  17858. Get movie duration in AV_TIME_BASE units.
  17859. @end table
  17860. @c man end MULTIMEDIA SOURCES